|
wiRedPanda
Logic Circuit Simulator
|
Drives the circuit simulation across the waveform's time columns. More...
#include <WaveformSimulator.h>
Public Member Functions | |
| void | sweep (const QVector< GraphicElementInput * > &inputs, const QVector< GraphicElement * > &outputs, int inputPorts, int columns, const std::function< bool(int row, int col)> &readInput, const std::function< void(int row, int col, int value)> &writeOutput) const |
| Runs the simulation across columns time steps. | |
| WaveformSimulator (Scene *externalScene, Simulation *simulation) | |
| Constructs the driver for externalScene and its simulation. | |
Static Public Member Functions | |
| static QVector< Status > | captureInputs (const QVector< GraphicElementInput * > &inputs, int inputPorts) |
| Snapshots the live output-port state of every input element. | |
| static void | restoreInputs (const QVector< GraphicElementInput * > &inputs, const QVector< Status > &saved) |
| Restores input-port states previously captured by captureInputs(). | |
Drives the circuit simulation across the waveform's time columns.
Extracted from BewavedDolphin: this owns the circuit-coupled sweep logic — resetting sequential state, applying input values per time step, advancing the simulation, and reading back output statuses — while leaving the waveform model and its presentation to the caller via read/write callbacks.
Definition at line 30 of file WaveformSimulator.h.
| WaveformSimulator::WaveformSimulator | ( | Scene * | externalScene, |
| Simulation * | simulation ) |
Constructs the driver for externalScene and its simulation.
Definition at line 16 of file WaveformSimulator.cpp.
|
static |
Snapshots the live output-port state of every input element.
| inputs | Input elements to snapshot. |
| inputPorts | Total number of output ports across inputs (snapshot size). |
Definition at line 22 of file WaveformSimulator.cpp.
|
static |
Restores input-port states previously captured by captureInputs().
Definition at line 38 of file WaveformSimulator.cpp.
References qCDebug.
Referenced by BewavedDolphin::run(), and BewavedDolphin::saveToTxt().
| void WaveformSimulator::sweep | ( | const QVector< GraphicElementInput * > & | inputs, |
| const QVector< GraphicElement * > & | outputs, | ||
| int | inputPorts, | ||
| int | columns, | ||
| const std::function< bool(int row, int col)> & | readInput, | ||
| const std::function< void(int row, int col, int value)> & | writeOutput ) const |
Runs the simulation across columns time steps.
| inputs | Input elements, in row order. |
| outputs | Output elements, in row order. |
| inputPorts | Number of input rows (offset of the first output row). |
| columns | Number of time-step columns to sweep. |
| readInput | Returns the input bit at (row, col) from the waveform model. |
| writeOutput | Stores the computed output bit at (row, col) into the model. |
Resets every element's sequential state before sweeping. Does not restore inputs — the caller pairs this with restoreInputs().
Definition at line 58 of file WaveformSimulator.cpp.
References qCDebug, and GraphicElement::Type.