API Reference
deltasimulator.lib
-
deltasimulator.lib.
build_graph
(program, main_cpp, build_dir, excluded_body_tags=None, preferred_body_tags=None)[source] Generates an executable to be stored in a build directory.
- Parameters:
program (_DynamicStructBuilder) – The Deltaflow program to be converted into SystemC.
main_cpp (str) – SystemC top level file that starts the SystemC simulation and defines an implementation for eventual templatedNodes.
build_dir (str) – The target directory in which to store the output.
excluded_body_tags (typing.List[object]) – typing.List of keys to exclude from selection
preferred_body_tags (typing.List[object]) – typing.List of keys to be preferred for selection if available
Examples
The main.cpp (other filenames are allowed) should at least contain the following:
#include <systemc> #include <Python.h> #include "dut.h" using namespace sc_dt; int sc_main(__attribute__(int argc, char** argv) { Py_UnbufferedStdioFlag = 1; Py_Initialize(); sc_trace_file *Tf = nullptr; sc_clock clk("clk", sc_time(1, SC_NS)); sc_signal<bool> rst; // Dut is the name you Dut dut("Dut", Tf); dut.clk.bind(clk); dut.rst.bind(rst); rst.write(0); sc_start(1000, SC_NS); return 0; }
With the associate Python code:
import deltalanguage as dl from deltasimulator.lib import build_graph ... _, program = dl.serialize_graph(graph, name="dut") build_graph(program, main_cpp="main.cpp", build_dir="/workdir/build") ...
-
deltasimulator.lib.
generate_wiring
(program, excluded_body_tags=None, preferred_body_tags=None)[source] Creates the wiring of the nodes defined in a program.
- Parameters:
program (_DynamicStructBuilder) – A Deltaflow serialized graph.
excluded_body_tags (typing.List[object]) – typing.List of keys to exclude from selection
preferred_body_tags (typing.List[object]) – typing.List of keys to be preferred for selection if available
- Returns:
node_bodies (list) – The bodies of the extracted nodes.
node_inits (list) – All the ROM files found in the migen nodes, extracted as strings. This solves an incompatibility between some migen generated outputs and verilator.
wiring (dict) – The graph wiring, used to generate a SystemC top level to wire the graph.