|
SILICON
|
Elaborates a source design once and owns its runtime Simulator. More...
#include <simulationSession.hpp>
Public Member Functions | |
| Session (std::shared_ptr< Circuit > sourceCircuit, Simulator::CancellationCheck isCancelled={}, const SILICON::core::CircuitResolver *resolver=nullptr) | |
| Creates a simulation session for a source circuit. | |
| ~Session ()=default | |
| Session (const Session &)=delete | |
| Session & | operator= (const Session &)=delete |
| Simulator::RunResult | run (uint64_t duration, Simulator::CancellationCheck isCancelled={}) |
| Runs the active simulation for a bounded duration. | |
| Simulator::RunResult | runUntilIdle (Simulator::CancellationCheck isCancelled={}) |
| Runs pending simulation events until the runtime circuit is idle. | |
| Simulator::RunResult | simulateWaveform (uint64_t duration, std::span< const Sample > inputSnapshots, std::span< const Simulator::WaveformInputDriver > inputDrivers, Simulator::CancellationCheck isCancelled={}) |
| Drives input buses from waveform samples and simulates the runtime circuit. | |
| Simulator::RunResult | setBus (Bus bus, const BusValue &value, Simulator::CancellationCheck isCancelled={}) |
| Forces a bus value and propagates the change through the runtime circuit. | |
| Simulator::RunResult | setBus (Bus bus, const BusValue &value, const Component_weakPtr &source, Simulator::CancellationCheck isCancelled={}) |
| Forces a bus value with an explicit source component authorization. | |
| void | setTraceBuses (std::vector< CircuitWriter::NamedBus > buses) |
| Configures the named buses emitted by trace snapshots. | |
| void | setTraceSink (Simulator::TraceSink sink) |
| Configures the callback that receives encoded trace snapshots. | |
| void | setFstWriter (std::unique_ptr< CircuitWriter > writer) |
| Installs or clears the active FST writer on the current runtime simulator. | |
| void | enableFstTracing (std::string_view fileName, CircuitWriter::Options options={}) |
| Creates and installs an FST writer for the current runtime simulator. | |
| uint64_t | getCurrentTime () const |
| Returns the current runtime simulator time. | |
Private Attributes | |
| std::unique_ptr< Simulator > | runtimeSimulator |
Elaborates a source design once and owns its runtime Simulator.
Source components are cloned and subcircuits are expanded before simulation. Root wires remain shared so UI handles can drive inputs and observe outputs. The runtime topology is fixed; create a new session after design changes. Saved circuit JSON and UI component state remain source-level data.
Definition at line 40 of file simulationSession.hpp.
|
explicit |
Creates a simulation session for a source circuit.
| sourceCircuit | Source/editable circuit to simulate. |
| isCancelled | Optional cancellation callback used during initial runtime construction. |
| resolver | Optional resolver used only during construction. |
| std::invalid_argument | if sourceCircuit is null. |
Definition at line 32 of file simulationSession.cpp.
|
default |
|
delete |
| void enableFstTracing | ( | std::string_view | fileName, |
| CircuitWriter::Options | options = {} ) |
Creates and installs an FST writer for the current runtime simulator.
Definition at line 92 of file simulationSession.cpp.
|
nodiscard |
Returns the current runtime simulator time.
Definition at line 97 of file simulationSession.cpp.
| Simulator::RunResult run | ( | uint64_t | duration, |
| Simulator::CancellationCheck | isCancelled = {} ) |
Runs the active simulation for a bounded duration.
Definition at line 44 of file simulationSession.cpp.
| Simulator::RunResult runUntilIdle | ( | Simulator::CancellationCheck | isCancelled = {} | ) |
Runs pending simulation events until the runtime circuit is idle.
Definition at line 50 of file simulationSession.cpp.
| Simulator::RunResult setBus | ( | Bus | bus, |
| const BusValue & | value, | ||
| const Component_weakPtr & | source, | ||
| Simulator::CancellationCheck | isCancelled = {} ) |
Forces a bus value with an explicit source component authorization.
Definition at line 70 of file simulationSession.cpp.
| Simulator::RunResult setBus | ( | Bus | bus, |
| const BusValue & | value, | ||
| Simulator::CancellationCheck | isCancelled = {} ) |
Forces a bus value and propagates the change through the runtime circuit.
Definition at line 64 of file simulationSession.cpp.
| void setFstWriter | ( | std::unique_ptr< CircuitWriter > | writer | ) |
Installs or clears the active FST writer on the current runtime simulator.
Definition at line 87 of file simulationSession.cpp.
| void setTraceBuses | ( | std::vector< CircuitWriter::NamedBus > | buses | ) |
Configures the named buses emitted by trace snapshots.
Definition at line 77 of file simulationSession.cpp.
| void setTraceSink | ( | Simulator::TraceSink | sink | ) |
Configures the callback that receives encoded trace snapshots.
Definition at line 82 of file simulationSession.cpp.
| Simulator::RunResult simulateWaveform | ( | uint64_t | duration, |
| std::span< const Sample > | inputSnapshots, | ||
| std::span< const Simulator::WaveformInputDriver > | inputDrivers, | ||
| Simulator::CancellationCheck | isCancelled = {} ) |
Drives input buses from waveform samples and simulates the runtime circuit.
Definition at line 56 of file simulationSession.cpp.
|
private |
Definition at line 118 of file simulationSession.hpp.