From ab48a45736e9e9fc46153791f5e0119e0fe86c72 Mon Sep 17 00:00:00 2001 From: joern274 Date: Sat, 22 Jun 2024 14:37:37 +0200 Subject: [PATCH] Test whether clock data is required when simulation input entered by user --- .../netlist_simulator_controller.h | 6 ++++++ .../include/netlist_simulator_controller/simulation_input.h | 6 ++++++ .../src/netlist_simulator_controller.cpp | 5 +++++ .../netlist_simulator_controller/src/simulation_input.cpp | 5 +++++ .../include/waveform_viewer/wavedata_table_editor.h | 2 +- .../simulator/waveform_viewer/src/wavedata_table_editor.cpp | 3 ++- plugins/simulator/waveform_viewer/src/wizard.cpp | 2 +- 7 files changed, 26 insertions(+), 3 deletions(-) diff --git a/plugins/simulator/netlist_simulator_controller/include/netlist_simulator_controller/netlist_simulator_controller.h b/plugins/simulator/netlist_simulator_controller/include/netlist_simulator_controller/netlist_simulator_controller.h index e2212361aff..d42b6a7d40b 100644 --- a/plugins/simulator/netlist_simulator_controller/include/netlist_simulator_controller/netlist_simulator_controller.h +++ b/plugins/simulator/netlist_simulator_controller/include/netlist_simulator_controller/netlist_simulator_controller.h @@ -127,6 +127,12 @@ class NETLIST_API NetlistSimulatorController : public QObject { */ void set_no_clock_used(); + /** + * Check wether no clock signal will be automatically generated as simulation input. Either there + * is no clock present or the clock signal will be passed as normal waveform input. + */ + bool is_no_clock_used() const; + /** * Add waveform group. Netlist must not be empty. First net in list is considered the lowest significant bit. * @param name The waveform group name diff --git a/plugins/simulator/netlist_simulator_controller/include/netlist_simulator_controller/simulation_input.h b/plugins/simulator/netlist_simulator_controller/include/netlist_simulator_controller/simulation_input.h index f0486887804..42e5c201b23 100644 --- a/plugins/simulator/netlist_simulator_controller/include/netlist_simulator_controller/simulation_input.h +++ b/plugins/simulator/netlist_simulator_controller/include/netlist_simulator_controller/simulation_input.h @@ -129,6 +129,12 @@ namespace hal { */ void set_no_clock_used(); + /** + * Check wether no clock signal will be automatically generated as simulation input. Either there + * is no clock present or the clock signal will be passed as normal waveform input. + */ + bool is_no_clock_used() const; + /** * Tests whether net is an input net * @param[in] n pointer to net diff --git a/plugins/simulator/netlist_simulator_controller/src/netlist_simulator_controller.cpp b/plugins/simulator/netlist_simulator_controller/src/netlist_simulator_controller.cpp index 267b8bf5b76..217092286ea 100644 --- a/plugins/simulator/netlist_simulator_controller/src/netlist_simulator_controller.cpp +++ b/plugins/simulator/netlist_simulator_controller/src/netlist_simulator_controller.cpp @@ -261,6 +261,11 @@ namespace hal checkReadyState(); } + bool NetlistSimulatorController::is_no_clock_used() const + { + return mSimulationInput->is_no_clock_used(); + } + u32 NetlistSimulatorController::add_trigger_time(const std::vector& trigger_waves, const std::vector& trigger_on_values) { if (trigger_waves.empty()) diff --git a/plugins/simulator/netlist_simulator_controller/src/simulation_input.cpp b/plugins/simulator/netlist_simulator_controller/src/simulation_input.cpp index 9797ecb0517..bcd58d5ee39 100644 --- a/plugins/simulator/netlist_simulator_controller/src/simulation_input.cpp +++ b/plugins/simulator/netlist_simulator_controller/src/simulation_input.cpp @@ -108,6 +108,11 @@ namespace hal { mNoClockUsed = true; } + bool SimulationInput::is_no_clock_used() const + { + return mNoClockUsed; + } + void SimulationInput::dump(std::string filename) const { FILE* of = stderr; diff --git a/plugins/simulator/waveform_viewer/include/waveform_viewer/wavedata_table_editor.h b/plugins/simulator/waveform_viewer/include/waveform_viewer/wavedata_table_editor.h index 636208c14d3..2228ded30d8 100644 --- a/plugins/simulator/waveform_viewer/include/waveform_viewer/wavedata_table_editor.h +++ b/plugins/simulator/waveform_viewer/include/waveform_viewer/wavedata_table_editor.h @@ -25,7 +25,7 @@ namespace hal { public: WavedataTableEditor(QWidget* parent = nullptr); - void setup(const std::vector& inpColHeads); + void setup(const std::vector& inpColHeads, bool omitClock); int validLines() const; diff --git a/plugins/simulator/waveform_viewer/src/wavedata_table_editor.cpp b/plugins/simulator/waveform_viewer/src/wavedata_table_editor.cpp index a46edc5f11e..2cc9dc568a7 100644 --- a/plugins/simulator/waveform_viewer/src/wavedata_table_editor.cpp +++ b/plugins/simulator/waveform_viewer/src/wavedata_table_editor.cpp @@ -11,7 +11,7 @@ namespace hal { : QTableWidget(parent), mMaxTime(0) {;} - void WavedataTableEditor::setup(const std::vector &inpColHeads) + void WavedataTableEditor::setup(const std::vector &inpColHeads, bool omitClock) { int n = inpColHeads.size()+1; setColumnCount(n); @@ -19,6 +19,7 @@ namespace hal { QStringList headerLabel; for (NetlistSimulatorController::InputColumnHeader ich : inpColHeads) { + if (omitClock && ich.is_clock) continue; QString colName = QString::fromStdString(ich.name); if (ich.nets.size() > 1) colName += QString("[%1:0]").arg(ich.nets.size()-1); mInputColumnHeader.append(ich); diff --git a/plugins/simulator/waveform_viewer/src/wizard.cpp b/plugins/simulator/waveform_viewer/src/wizard.cpp index 0202ece3b48..0d27439cc0e 100644 --- a/plugins/simulator/waveform_viewer/src/wizard.cpp +++ b/plugins/simulator/waveform_viewer/src/wizard.cpp @@ -493,7 +493,7 @@ namespace hal { void PageInputData::initializePage() { - mTableEditor->setup(mController->get_input_column_headers()); + mTableEditor->setup(mController->get_input_column_headers(), mController->is_no_clock_used()); handleRadioToggled(true); }