From 27b38375203880cbc991eaac1d97c927346fa7e0 Mon Sep 17 00:00:00 2001 From: Pavel Pisa Date: Mon, 6 Apr 2020 22:38:46 +0200 Subject: qtmips_cli: add option to specify used hazard unit - none, stall, forward. Signed-off-by: Pavel Pisa --- qtmips_machine/machineconfig.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'qtmips_machine/machineconfig.cpp') diff --git a/qtmips_machine/machineconfig.cpp b/qtmips_machine/machineconfig.cpp index 2e0cf78..b81d7c6 100644 --- a/qtmips_machine/machineconfig.cpp +++ b/qtmips_machine/machineconfig.cpp @@ -34,6 +34,7 @@ ******************************************************************************/ #include "machineconfig.h" +#include using namespace machine; @@ -304,6 +305,19 @@ void MachineConfig::set_hazard_unit(enum MachineConfig::HazardUnit hu) { hunit = hu; } +bool MachineConfig::set_hazard_unit(QString hukind) { + static QMap hukind_map = { + {"none", HU_NONE}, + {"stall", HU_STALL}, + {"forward", HU_STALL_FORWARD}, + {"stall-forward", HU_STALL_FORWARD}, + }; + if (!hukind_map.contains(hukind)) + return false; + set_hazard_unit(hukind_map.value(hukind)); + return true; +} + void MachineConfig::set_memory_execute_protection(bool v) { exec_protect = v; } -- cgit v1.2.3