Browse by type
SystemVerilog 2017 Pre-processor, Parser, Elaborator, UHDM Compiler. Provides IEEE Design/TB C/C++ VPI and Python AST API.
This project aims at providing a complete SystemVerilog 2017 front-end: a preprocessor, a parser, an elaborator for both design and testbench. We are aiming at supporting all open-source cores. * Current status: * Surelog's elaboration trees for BlackParrot, Ariane cores are equivalent with Verilator's elaboration tree. * Ibex and Earlgrey completely Synthesizes and runs in Hardware with the Surelog/UHDM/Yosys flow.
Linter, Simulator, Synthesis tool, Formal tools can use this front-end. They either can be developed as plugins (linked with) or use this front-end as an intermediate step of their compilation flows using the on-disk serialized models (UHDM).
This project is open to contributions from any users! From the commercial vendor to the Verilog enthusiast, all are welcome. We started maintaining a list of ideas for contribution under Help Wanted
INSTALLIf you had a previous install, remove it first:
make uninstall (PREFIX=...)
make
or
make debug
or
make release_no_tcmalloc (For no tcmalloc)
or
make release_with_python
make install (/usr/local/bin and /usr/local/lib by default,
use PREFIX= for alternative location)
For more build/test options and system requirements for building see
src/README file.
For your project to use Surelog as an external module, you need to tell CMake where to find Surelog. Note that CMake expects the module directory organized a certain way and Surelog's installation step does that so make sure to run that. You can provide the path to CMake in few different ways -
CMAKE_MODULE_PATH variable in your project's CMakeLists.txt file by adding the following lines -set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} <absolute or relative path to surelog installation folder>)
find_package(Surelog)
find_package command itself, as in the following -find_package(Surelog PATHS <absolute or relative path to surelog installation folder>)
cmake -DSurelog_DIR=<absolute or relative path to surelog installation folder> -S . -B out
For additional help, refer to cmake documentation on external modules.
Once CMake successfully finds Surelog, all you would need is to add the following line after the call to add_library/add_executable in your CMakeLists.txt file.
target_link_libraries(<your project name> surelog)
/usr/local/bin/surelog (After install)
STANDARD VERILOG COMMAND LINE: ``` -f Accepts a file containing command line arguments -v Library file -sv Forces this file to be parsed as a SystemVerilog file -sverilog Forces all files to be parsed as SystemVerilog files -y
[+...] Specifies include paths -Idir Specifies include paths +libext++... Specifies the library extensions .v Verilog File .sv SystemVerilog File +liborder Lib Order option (ignored) +librescan Lib Rescan option (ignored) +libverbose Lib Verbose option (ignored) +nolibcell No Lib Cell option (ignored) +define+name=value[+name=value...] Defines a macro and optionally its value -L Defines library compilation order -map Specifies a library mapping file (multiple -map options supported) -cfgfile Specifies a configuration file (multiple -cfgFile options supported) -cfg Specifies a configuration to use (multiple -cfg options supported) -Dvar=value Same as env var definition for -f files var substitution -Pparameter=value Overrides a toplevel module parameter * EDA TOOLS COMPATIBILITY OPTIONS:
```
-cmd_ign <cmd> <argc> Ignore <cmd> when encountered and drop <argc> arguments
-cmd_ren <flag1> <flag2> rename <flag1> into <flag2> when encountered
-cmd_mrg <flag1> <flag2> merge <flag1> argument into a unified <flag2> '+' argument when encountered
Example: surelog top.sv -parse -d uhdm
* SEPARATE COMPILATION FLOW OPTIONS:
```
-init Initializes cache for separate compile flow
-sepcomp Separate compilation, each invocation of surelog creates a compilation unit (Optional -nohash)
Each -sepcomp step can run in parallel
-link Links and elaborates the separately compiled files (Optional -nohash and -elabuhdm)
Example:
surelog -init
surelog pkg1.sv pkg2.sv -sepcomp
surelog top.sv -sepcomp
surelog -link
To disable feature:
--disable-feature=,
Possible features:
parametersubstitution Enables/Disables substitution of assignment patterns in parameters
letexprsubstitution Enables/Disables Let expr substitution
```
* TRACES OPTIONS:
-d <int> Debug <level> 1-4, lib, ast, inst, incl, uhdm, coveruhdm, cache
-nostdout Mutes Standard output
-verbose Gives verbose processing information
-profile Gives Profiling information
-l <file> Specifies log file, default is surelog.log under output dir
-odir/--Mdir <dir> Specifies the output directory, default is ./
-writeppfile <file> Writes out Preprocessor output in file (all compilation units will override this file)
-writepp Writes out Preprocessor output (all compilation units will generate files under slpp_all/ or slpp_unit/)
-lineoffsetascomments Writes the preprocessor line offsets as comments as opposed as parser directives
-nocache Default allows to create a cache for include files, this option prevents it
-cache <dir> Specifies the cache directory, default is slpp_all/cache or slpp_unit/cache
-nohash Don't use hash mechanism for cache file path, always treat cache as valid (no timestamp/dependancy check)
-createcache Create cache for precompiled packages
-filterdirectives Filters out simple directives like default_nettype in pre-processor's output
-filterprotected Filters out protected regions in pre-processor's output
-filtercomments Filters out comments in pre-processor's output
-outputlineinfo Outputs SLline directives in pre-processor's output
-pploc Output message location in terms of post preprocessor location
-noinfo Filters out INFO messages
-nonote Filters out NOTE messages
-nowarning Filters out WARNING messages
-synth Reports non-synthesizable constructs
Honnors //pragma translate_off , //pragma translate_on
-formal Reports non-synthesizable constructs line -synth
but still allows model checking constructs
-o <path> Turns on all compilation stages, produces all outputs under that path
-cd <dir> Internally change directory to <dir>
-exe <command> Post execute a system call <command>, passes it the preprocessor file list.
--help This help
--version Surelog version and build date
Bit mask the return code, more than 1 bit can be on.
0 - No issues
0x1 - Fatal error(s)
0x2 - Syntax error(s)
0x4 - Error(s)
src/README file.src/hellosureworld.cpp, src/hellouhdm.cpp, src/hellodesign.cpp illustrate how to navigate the Surelog internal data structure or the UHDM "VPI Standard Object Model" of the design using the libsurelog.a library.src/READMEslformatmsg.py illustrates how messages can be reformated.Place a modified version of this file either in the execution directory, or install directory /usr/local/lib/surelog-python
A simple example of creating a new error message and generating errors can be found here: python_listener.py
A simple example for design-level data model exploration can be found here: myscriptPerDesign.py
The complete Python API is described in the following files: SLAPI.h vobjecttypes
Waivers can be installed in slwaivers.py files in the e
$ claude mcp add Surelog \
-- python -m otcore.mcp_server <graph>