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_cli/main.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'qtmips_cli') diff --git a/qtmips_cli/main.cpp b/qtmips_cli/main.cpp index c77ba2f..2984d8c 100644 --- a/qtmips_cli/main.cpp +++ b/qtmips_cli/main.cpp @@ -59,6 +59,7 @@ void create_parser(QCommandLineParser &p) { p.addOption({"asm", "Treat provided file argument as assembler source."}); p.addOption({"pipelined", "Configure CPU to use five stage pipeline."}); p.addOption({"no-delay-slot", "Disable jump delay slot."}); + p.addOption({"hazard-unit", "Specify hazard unit imeplementation [none|stall|forward].", "HUKIND"}); p.addOption({{"trace-fetch", "tr-fetch"}, "Trace fetched instruction (for both pipelined and not core)."}); p.addOption({{"trace-decode", "tr-decode"}, "Trace instruction in decode stage. (only for pipelined core)"}); p.addOption({{"trace-execute", "tr-execute"}, "Trace instruction in execute stage. (only for pipelined core)"}); @@ -145,6 +146,15 @@ void configure_machine(QCommandLineParser &p, MachineConfig &cc) { cc.set_delay_slot(!p.isSet("no-delay-slot")); cc.set_pipelined(p.isSet("pipelined")); + siz = p.values("hazard-unit").size(); + if (siz >= 1) { + QString hukind = p.values("hazard-unit").at(siz - 1).toLower(); + if (!cc.set_hazard_unit(hukind)) { + std::cerr << "Unknown kind of hazard unit specified" << std::endl; + exit(1); + } + } + siz = p.values("read-time").size(); if (siz >= 1) cc.set_memory_access_time_read(p.values("read-time").at(siz - 1).toLong()); -- cgit v1.2.3