17 : m_externalScene(externalScene)
18 , m_simulation(simulation)
24 QVector<Status> oldValues(inputPorts);
27 for (
auto *input : std::as_const(inputs)) {
28 for (
int port = 0; port < input->outputSize(); ++port) {
30 oldValues[oldIndex] = input->outputPort(port)->status();
40 qCDebug(zero) <<
"Restoring old values to inputs, prior to simulation.";
46 for (
auto *input : std::as_const(inputs)) {
47 for (
int port = 0; port < input->outputSize(); ++port) {
48 const bool oldValue =
static_cast<bool>(saved.at(portIndex++));
49 if (input->outputSize() > 1) {
50 input->setOn(oldValue, port);
52 input->setOn(oldValue);
59 const QVector<GraphicElement *> &outputs,
60 const int inputPorts,
const int columns,
61 const std::function<
bool(
int row,
int col)> &readInput,
62 const std::function<
void(
int row,
int col,
int value)> &writeOutput)
const
65 qCDebug(zero) <<
"Creating class to pause main window simulator while creating waveform.";
75 qCDebug(zero) <<
"Resetting simulation state of all elements.";
76 for (
auto *elm : m_externalScene->elements()) {
83 for (
int column = 0; column < columns; ++column) {
84 qCDebug(four) <<
"Itr: " << column <<
", inputs: " << inputs.size();
87 for (
auto *input : std::as_const(inputs)) {
88 for (
int port = 0; port < input->outputSize(); ++port) {
90 input->setWaveformValue(readInput(row++, column), port);
94 qCDebug(four) <<
"Updating the values of the circuit logic based on current input values.";
95 m_simulation->update();
98 qCDebug(four) <<
"Setting the computed output values to the waveform results.";
101 for (
auto *output : std::as_const(outputs)) {
102 for (
int port = 0; port < output->inputSize(); ++port) {
103 const int value =
static_cast<int>(output->inputPort(port)->status());
104 writeOutput(row, column, value);
Common logging utilities, the Pandaception error type, and helper macros.
#define qCDebug(category)
Abstract base class for all graphical circuit elements.
Main circuit editing scene with undo/redo and user interaction.
RAII guard that temporarily stops the simulation while in scope.
RAII guard that disables the visual refresh throttle while in scope.
Synchronous cycle-based simulation engine with event-driven clock support.
Main circuit editing scene.
RAII guard that stops the simulation on construction and restarts it on destruction.
RAII guard that disables the visual refresh throttle for the duration of its scope.
Manages the digital circuit simulation loop.