Install the project dependencies.
- Install the project dependencies by executing the following command:
- Debian/Ubuntu:
sudo apt install git g++ cmake bison flex curl zip unzip tar pkg-config iverilog yosys
- Debian/Ubuntu:
- Install the project dependencies by downloading the following tools:
- Download the latest release of the OSS CAD Suite for Windows from: https://github.com/YosysHQ/oss-cad-suite-build/releases/latest and extract the content of the downloaded archive in
thirdparty/oss-cad-suite - Install MSVC by installing Visual Studio Community Edition - https://visualstudio.microsoft.com - select the installer 'Desktop Development with C++'
- Download the latest release of the OSS CAD Suite for Windows from: https://github.com/YosysHQ/oss-cad-suite-build/releases/latest and extract the content of the downloaded archive in
Clone the project repository:
git clone https://github.com/TUHH-IES/DuRTL.git
Compile the project by executing the following commands:
git clone https://github.com/microsoft/vcpkg.git thirdparty/vcpkgmkdir buildcd buildcmake ..
-
Run all tests using the
testerexecutable. -
The following two flows are for creating your own TESTCASE as an execution environment or a new executable:
-
IFT Flow
-
Necessary inputs include:
- Verilog design file
- Corresponding design testbench file
- Json netlist for the design
-
Simulate the design to verify its functionality
-
Generate JSON for the design using YOSYS(more about the commands in the documentation- https://yosyshq.readthedocs.io/projects/yosys/en/latest/):
DESIGN= design.v JSON=`basename ${DESIGN} .v`.json echo " read_verilog -sv ${DESIGN} #read modules from Verilog file hierarchy -auto-top #check, expand and clean up design hierarchy along with automatically determing the top module proc #translate processes to netlists memory_collect #translate memories to basic cells opt #perform simple optimizations write_json ${JSON} #write design to a JSON file" \ | yosys -
IFT for the design:
-
Use a
nlohmann::jsonobject to set general parameters for IFTtag_size- size of the tag_vector in bits (default: 32, maximum(tested): 2048)ift- enable IFT (default: true)
-
Generate design object by parsing JSON file :
- Use the
Designclass fromdesign.hppto create a design object - function
Design::parse_jsonto parse the JSON file and populate the design object
- Use the
-
Generate VCD data for tag generation
-
Use the
ducode::simulate_designfunction to simulate the design and generate simulation data (VCD format) -
define a stepsize for the simulation data (e.g. 1000 steps)
alternatively, you can use
ducode::get_stepsizeto get the stepsize of the design + testbench -
Use
ducode::get_timesteps_per_simulation_runto get the number of timesteps per simulation run -
Use
ducode::get_number_of_simulation_runsto get the number of simulation runs -
Create a
TagGeneratorobject (full-resolution or random) to generate tags for signals (you can specify which signals to tag by passing a list of signal names; however only primary inputs can be tagged right now)
-
-
Generate IFT design and IFT testbench
-
Use
Design::export_designto export the designParameter
iftdecides if the design is exported with IFT -
Create a
Testbenchobject for the design- Use
Testbench::export_testbenchto export the testbench- Parameter
iftdecides if the testbench is exported with IFT
- Parameter
- Use
-
-
Use
ducode::simulate_designwith the exported IFT design and testbench to generate VCD data including the IFT data -
Create a
SignalTagTrackerobject (VCDSignalTagTracker for simulation-based IFT) that stores the VCD data internally -
Create a
DesignInstanceobject- contains a flattened graph of the design
- contains analysis functions to analyze the IFT data on the design
-
Refer to the existing TESTCASE -
hierarchy_ift_flowintests/ift/ift_flow.cpp, as a template for the above steps
-
-
All temp generated data understanding
ift_design.v- Verilog file of the IFT designift_design_tb.v- Verilog file of the IFT testbenchoutput.vcd- VCD file generated from the simulation of the IFT design and IFT testbench
-
-
SMT Flow -- not thoroughly tested, yet, and known to have bugs
- Necessary inputs include:
- Verilog design file
- Json netlist for the design
- Create the necessary Z3 solver objects
- Use
z3::solverto create a Z3 solver object - Use
z3::contextto create a Z3 context object - Use
z3::expr_vectorto create a vector of Z3 expressions for the signals in the design - Create a
std::unordered_map<std::string, z3::expr>to map signal names to Z3 expressions
- Use
- Parse the design JSON file to create a
Designobject- Use the
Design::parse_jsonfunction to parse the JSON file and populate the design object
- Use the
- Create a
DesignInstanceobject- This object contains a flattened graph of the design and analysis functions to analyze the design
- Use
DesignInstance::export_smt2function to create an SMT2 model inside the solver-object from 2.- The signal names are created for every signal(net) of the design
- The signal names have the format
|D1_top_module1_signal_a_time_0|whereD1is the design ID,top_module1is the top module name,signal_ais the signal name, andtime_0is the time step (or unrolling step) of the signal- The function
ducode::create_smt2_signal_namecan be used to create the signal names - Use the unordered_map created in step 2.4 to map to access the corresponding Z3 expressions
- The function
- For Information Flow Analysis, call
DesignInstance::export_smt2_ifta second time with another design ID e.g.D2to create the IFT model- The signal names for the IFT model will have the format
|D2_top_module1_signal_a_time_0|
- The signal names for the IFT model will have the format
- Use
DesignInstanceobject to call an analysis function - OR add your own z3 constraints and call
solver.check()to check the satisfiability of the constraints on the design (see 5.2.2 for accessing signal values)
- Necessary inputs include:
-
Limitations SMT
-
design must have a single clock domain
-
only positive edge triggered flipflops are supported
- the current method of unrolling the design for SMT assumes the above to be true which causes the next state of a flipflop to be updated at every time step
- from this follows that only synchronous designs are supported
-
so: sequential elements with asynchronous set/reset are not supported currently!
-
there are simple checks implemented one can use to check if the design meets the above limitations
-
DesignInstance::check_clock_signalchecks if all flipflops in the design use the same clock signal- currently limited to designs with a single module only (i.e. no module instantiations)
- this can be extended in the future if needed
- currently limited to designs with a single module only (i.e. no module instantiations)
-
DesignInstance::check_clock_edgechecks if all flipflops in the design are positive edge triggered -
both functions return a boolean value
-
these functions traverse all flipflops through the flattened instance graph of the design
-
Module::check_clock_signal_consistencychecks if all flipflops in a module use the same clock signal- this function traverses all flipflops through the module graph of the module
-
Module::check_clock_rising_edge_consistencychecks if all flipflops in a module are positive edge triggered- this function traverses all flipflops through the module graph of the module Limitations SMT End
-
-
-
general:
- signals are uniquely identified by their name and the module hierarchy they belong to.
-
Run the
mainexecutable to execute the basic IFT analysis on a design.- Run
main -hto get more information about the command options available.
- Run
- Ubuntu: run
doyxgen doc/doxyfilefrom the main directory - Documentation replicating the experiments/feature tests performed with DuRTL for research work in /doc/useCases
- Supporting documentation related to Build, Release and Software Management plan included in /doc/strategy
Check the formatting of the code base:
- scripts/format_check.sh Check the linter errors:
- scripts/linter_script.sh