Skip to content

Commit

Permalink
Add VSRTL VCD tracing enable setting
Browse files Browse the repository at this point in the history
  • Loading branch information
mortbopet committed Nov 4, 2023
1 parent 27fcc58 commit 5a5f481
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 1 deletion.
2 changes: 1 addition & 1 deletion external/VSRTL
17 changes: 17 additions & 0 deletions src/processorhandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,23 @@ ProcessorHandler::ProcessorHandler() {
m_currentProcessor->setMaxReverseCycles(
RipesSettings::value(RIPES_SETTING_REWINDSTACKSIZE).toInt());

connect(RipesSettings::getObserver(RIPES_SETTING_VCD_TRACE),
&SettingObserver::modified, this, [=](const auto &enabled) {
m_currentProcessor->vcdTrace(
enabled.toBool(),
RipesSettings::value(RIPES_SETTING_VCD_TRACE_FILE).toString());
});

connect(RipesSettings::getObserver(RIPES_SETTING_VCD_TRACE_FILE),
&SettingObserver::modified, this, [=](const auto &file) {
m_currentProcessor->vcdTrace(
RipesSettings::value(RIPES_SETTING_VCD_TRACE).toBool(),
file.toString());
});

// Reset VCD trace status.
RipesSettings::getObserver(RIPES_SETTING_VCD_TRACE_FILE)->trigger();

// Reset request handling
connect(RipesSettings::getObserver(RIPES_GLOBALSIGNAL_REQRESET),
&SettingObserver::modified, this, &ProcessorHandler::_reset);
Expand Down
6 changes: 6 additions & 0 deletions src/processors/interface/ripesprocessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,12 @@ class RipesProcessor {
*/
virtual void resetProcessor() = 0;

/*
* @brief vcdTrace
* Enables VCD tracing of the processor model, if supported by the simulator.
*/
virtual void vcdTrace(bool enable, const QString &filename){};

/**
* @brief clock
* Clocks the processor.
Expand Down
4 changes: 4 additions & 0 deletions src/processors/ripesvsrtlprocessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ class RipesVSRTLProcessor : public RipesProcessor, public vsrtl::core::Design {

virtual void reverseProcessor() override { reverse(); }

virtual void vcdTrace(bool enable, const QString &filename) override {
vsrtl::core::Design::vcdTrace(enable, filename.toStdString());
}

long long getInstructionsRetired() const override {
return m_instructionsRetired;
}
Expand Down
2 changes: 2 additions & 0 deletions src/ripessettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ const std::map<QString, QVariant> s_defaultSettings = {
{RIPES_SETTING_EDITORREGS, true},
{RIPES_SETTING_EDITORCONSOLE, true},
{RIPES_SETTING_EDITORSTAGEHIGHLIGHTING, true},
{RIPES_SETTING_VCD_TRACE_FILE, "ripes.vcd"},
{RIPES_SETTING_VCD_TRACE, false},

{RIPES_SETTING_PIPEDIAGRAM_MAXCYCLES, 100},
{RIPES_SETTING_CACHE_MAXCYCLES, 10000},
Expand Down
2 changes: 2 additions & 0 deletions src/ripessettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ namespace Ripes {
#define RIPES_SETTING_CACHE_MAXPOINTS ("cacheplot_maxpoints")
#define RIPES_SETTING_CACHE_PRESETS ("cache_presets")
#define RIPES_SETTING_PERIPHERAL_SETTINGS ("peripheral_settings")
#define RIPES_SETTING_VCD_TRACE ("enable_vcd_trace")
#define RIPES_SETTING_VCD_TRACE_FILE ("vcd_trace_file")

// This is not really a setting, but instead a method to leverage the static
// observer objects that are generated for a setting. Used for other objects to
Expand Down
10 changes: 10 additions & 0 deletions src/settingsdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -311,12 +311,22 @@ QWidget *SettingsDialog::createSimulatorPage() {
appendToLayout({rewindLabel, rewindSpinbox}, pageLayout,
"Maximum cycles that the simulator is able to undo.");

// Setting: RIPES_SETTING_PERIPHERALS_START
appendToLayout(createSettingsWidgets<HexSpinBox>(
RIPES_SETTING_PERIPHERALS_START, "I/O start address:"),
pageLayout,
"Start address in the address space where peripherals will be "
"allocated from, growing upwards");

// Setting: RIPES_SETTING_VCD_TRACE
auto [vcdEnableLabel, vcdEnable] = createSettingsWidgets<QCheckBox>(
RIPES_SETTING_VCD_TRACE, "Enable simulation VCD traces.");
auto [vcdTraceFileLabel, vcdTraceFile] = createSettingsWidgets<QLineEdit>(
RIPES_SETTING_VCD_TRACE_FILE, "VCD trace file:");

appendToLayout({vcdEnableLabel, vcdEnable}, pageLayout);
appendToLayout({vcdTraceFileLabel, vcdTraceFile}, pageLayout);

return pageWidget;
}

Expand Down

0 comments on commit 5a5f481

Please sign in to comment.