|
CIRCT 22.0.0git
|


Public Member Functions | |
| __init__ (self, SourceFiles sources, Path run_dir, bool debug, Optional[Callable[[str], None]] run_stdout_callback=None, Optional[Callable[[str], None]] run_stderr_callback=None, Optional[Callable[[str], None]] compile_stdout_callback=None, Optional[Callable[[str], None]] compile_stderr_callback=None, bool make_default_logs=True, Optional[Dict[str, str]] macro_definitions=None) | |
| List[List[str]] | compile_commands (self) |
| int | compile (self) |
| List[str] | run_command (self, bool gui) |
| SimProcess | run_proc (self, bool gui=False) |
| int | run (self, str inner_command, bool gui=False, bool server_only=False) |
Static Public Member Functions | |
| Dict[str, str] | get_env () |
Public Attributes | |
| sources | |
| run_dir | |
| debug | |
| macro_definitions | |
Static Public Attributes | |
| bool | UsesStderr = True |
Protected Member Functions | |
| int|tuple[subprocess.Popen, List[threading.Thread]] | _start_process_with_callbacks (self, List[str] cmd, Optional[Dict[str, str]] env, Optional[Path] cwd, Optional[Callable[[str], None]] stdout_cb, Optional[Callable[[str], None]] stderr_cb, bool wait) |
Protected Attributes | |
| _compile_stdout_cb | |
| _compile_stdout_log | |
| _compile_stderr_cb | |
| _compile_stderr_log | |
| _run_stdout_cb | |
| _run_stdout_log | |
| _run_stderr_cb | |
| _run_stderr_log | |
Definition at line 108 of file simulator.py.
| simulator.Simulator.__init__ | ( | self, | |
| SourceFiles | sources, | ||
| Path | run_dir, | ||
| bool | debug, | ||
| Optional[Callable[[str], None]] | run_stdout_callback = None, |
||
| Optional[Callable[[str], None]] | run_stderr_callback = None, |
||
| Optional[Callable[[str], None]] | compile_stdout_callback = None, |
||
| Optional[Callable[[str], None]] | compile_stderr_callback = None, |
||
| bool | make_default_logs = True, |
||
| Optional[Dict[str, str]] | macro_definitions = None |
||
| ) |
Simulator base class.
Optional sinks can be provided for capturing output. If not provided,
the simulator will write to log files in `run_dir`.
Args:
sources: SourceFiles describing RTL/DPI inputs.
run_dir: Directory where build/run artifacts are placed.
debug: Enable cosim debug mode.
run_stdout_callback: Line-based callback for runtime stdout.
run_stderr_callback: Line-based callback for runtime stderr.
compile_stdout_callback: Line-based callback for compile stdout.
compile_stderr_callback: Line-based callback for compile stderr.
make_default_logs: If True and corresponding callback is not supplied,
create log file and emit via internally-created callback.
macro_definitions: Optional dictionary of macro definitions to be defined
during compilation.
Reimplemented in verilator.Verilator, and questa.Questa.
Definition at line 115 of file simulator.py.
Referenced by synth.LongestPathCollection.drop_non_critical_paths(), and synth.LongestPathCollection.merge().
|
protected |
Start a subprocess and stream its stdout/stderr to callbacks. If wait is True, blocks until process completes and returns its exit code. If wait is False, returns the Popen object (threads keep streaming).
Definition at line 296 of file simulator.py.
References print().
Referenced by simulator.Simulator.compile(), and simulator.Simulator.run_proc().
| int simulator.Simulator.compile | ( | self | ) |
Definition at line 200 of file simulator.py.
References simulator.Simulator._compile_stderr_cb, simulator.Simulator._compile_stderr_log, simulator.Simulator._compile_stdout_cb, simulator.Simulator._compile_stdout_log, simulator.Simulator._start_process_with_callbacks(), questa.Questa.compile_commands(), simulator.Simulator.compile_commands(), verilator.Verilator.compile_commands(), print(), simulator.Simulator.run_dir, questa.Questa.UsesStderr, and simulator.Simulator.UsesStderr.
| List[List[str]] simulator.Simulator.compile_commands | ( | self | ) |
Compile the sources. Returns the exit code of the simulation compiler.
Reimplemented in questa.Questa, and verilator.Verilator.
Definition at line 196 of file simulator.py.
Referenced by simulator.Simulator.compile().
|
static |
Get the environment variables to locate shared objects.
Definition at line 186 of file simulator.py.
| int simulator.Simulator.run | ( | self, | |
| str | inner_command, | ||
| bool | gui = False, |
||
| bool | server_only = False |
||
| ) |
Start the simulation then run the command specified. Kill the simulation when the command exits.
Reimplemented in questa.Questa.
Definition at line 352 of file simulator.py.
References print(), and simulator.Simulator.run_proc().
| List[str] simulator.Simulator.run_command | ( | self, | |
| bool | gui | ||
| ) |
Return the command to run the simulation.
Reimplemented in questa.Questa, and verilator.Verilator.
Definition at line 228 of file simulator.py.
Referenced by Python.setup.CustomBuild.run(), setup.CustomBuild.run(), and simulator.Simulator.run_proc().
| SimProcess simulator.Simulator.run_proc | ( | self, | |
| bool | gui = False |
||
| ) |
Run the simulation process. Returns the Popen object and the port which the simulation is listening on. If user-provided stdout/stderr sinks were supplied in the constructor, they are used. Otherwise, log files are created in `run_dir`.
Definition at line 232 of file simulator.py.
References simulator.Simulator._run_stderr_cb, simulator.Simulator._run_stdout_cb, simulator.Simulator._start_process_with_callbacks(), circt::arc::runtime::impl::TraceEncoder.debug, esi::CliParser.debug, esi::Logger.debug(), esi::Logger.debug(), simulator.Simulator.debug, simulator.is_port_open(), questa.Questa.run_command(), simulator.Simulator.run_command(), verilator.Verilator.run_command(), and simulator.Simulator.run_dir.
Referenced by simulator.Simulator.run().
|
protected |
Definition at line 178 of file simulator.py.
Referenced by simulator.Simulator.compile().
|
protected |
Definition at line 178 of file simulator.py.
Referenced by simulator.Simulator.compile().
|
protected |
Definition at line 176 of file simulator.py.
Referenced by simulator.Simulator.compile().
|
protected |
Definition at line 176 of file simulator.py.
Referenced by simulator.Simulator.compile().
|
protected |
Definition at line 182 of file simulator.py.
Referenced by simulator.Simulator.run_proc().
|
protected |
Definition at line 182 of file simulator.py.
|
protected |
Definition at line 180 of file simulator.py.
Referenced by simulator.Simulator.run_proc().
|
protected |
Definition at line 180 of file simulator.py.
| simulator.Simulator.debug |
Definition at line 145 of file simulator.py.
Referenced by verilator.Verilator.compile_commands(), questa.Questa.run_command(), and simulator.Simulator.run_proc().
| simulator.Simulator.macro_definitions |
Definition at line 146 of file simulator.py.
Referenced by verilator.Verilator.compile_commands(), and questa.Questa.internal_compile_commands().
| simulator.Simulator.run_dir |
Definition at line 144 of file simulator.py.
Referenced by simulator.Simulator.compile(), questa.Questa.run(), and simulator.Simulator.run_proc().
| simulator.Simulator.sources |
Definition at line 143 of file simulator.py.
Referenced by verilator.Verilator.compile_commands(), questa.Questa.internal_compile_commands(), questa.Questa.run_command(), and verilator.Verilator.run_command().
|
static |
Definition at line 113 of file simulator.py.
Referenced by simulator.Simulator.compile().