Skip to content

Commit

Permalink
Store processor extension selection between invocations
Browse files Browse the repository at this point in the history
  • Loading branch information
mortbopet committed Jan 30, 2022
1 parent c1e6e11 commit 8bfe673
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/processorhandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ ProcessorHandler::ProcessorHandler() {
m_constructing = true;

// Contruct the default processor
// Processor ID
if (RipesSettings::value(RIPES_SETTING_PROCESSOR_ID).isNull()) {
m_currentID = ProcessorID::RV32_5S;
} else {
Expand All @@ -28,8 +29,15 @@ ProcessorHandler::ProcessorHandler() {
// Some sanity checking
m_currentID = m_currentID >= ProcessorID::NUM_PROCESSORS ? ProcessorID::RV32_5S : m_currentID;
}
_selectProcessor(m_currentID, ProcessorRegistry::getDescription(m_currentID).isaInfo().isa->supportedExtensions(),
ProcessorRegistry::getDescription(m_currentID).defaultRegisterVals);

// Processor extensions
QStringList extensions;
if (RipesSettings::value(RIPES_SETTING_PROCESSOR_EXTENSIONS).isNull())
extensions = ProcessorRegistry::getDescription(m_currentID).isaInfo().isa->supportedExtensions();
else
extensions = RipesSettings::value(RIPES_SETTING_PROCESSOR_EXTENSIONS).value<QStringList>();

_selectProcessor(m_currentID, extensions, ProcessorRegistry::getDescription(m_currentID).defaultRegisterVals);

// The m_procStateChangeTimer limits maximum frequency of which the procStateChangedNonRun is emitted.
m_procStateChangeTimer.setSingleShot(true);
Expand Down Expand Up @@ -248,6 +256,7 @@ void ProcessorHandler::_selectProcessor(const ProcessorID& id, const QStringList
m_currentID = id;
m_currentRegInits = setup;
RipesSettings::setValue(RIPES_SETTING_PROCESSOR_ID, id);
RipesSettings::setValue(RIPES_SETTING_PROCESSOR_EXTENSIONS, extensions);

// Keep current program if the ISA between the two processors are identical
const bool keepProgram =
Expand Down
1 change: 1 addition & 0 deletions src/ripessettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ const std::map<QString, QVariant> s_defaultSettings = {
{RIPES_SETTING_VIEW_ZOOM, 250},
{RIPES_SETTING_PERIPHERAL_SETTINGS, ""},
{RIPES_SETTING_PROCESSOR_ID, QVariant() /* Let processorhandler define default */},
{RIPES_SETTING_PROCESSOR_EXTENSIONS, QVariant() /* Let processorhandler define default */},
{RIPES_SETTING_PROCESSOR_LAYOUT_ID, 0},
{RIPES_SETTING_FOLLOW_EXEC, "true"},
{RIPES_SETTING_SOURCECODE, ""},
Expand Down
1 change: 1 addition & 0 deletions src/ripessettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ namespace Ripes {
#define RIPES_SETTING_SETTING_TAB ("settings_tab")
#define RIPES_SETTING_VIEW_ZOOM ("view_zoom")
#define RIPES_SETTING_PROCESSOR_ID ("processor_id")
#define RIPES_SETTING_PROCESSOR_EXTENSIONS ("processor_extensions")
#define RIPES_SETTING_PROCESSOR_LAYOUT_ID ("processor_layout_id")
#define RIPES_SETTING_FOLLOW_EXEC ("follow_execution")
#define RIPES_SETTING_INPUT_TYPE ("input_type")
Expand Down

0 comments on commit 8bfe673

Please sign in to comment.