From 0916bef42e28218b08b05342d5b571b8a45afb5a Mon Sep 17 00:00:00 2001 From: Pavel Pisa Date: Thu, 14 Feb 2019 00:41:06 +0100 Subject: Implement function to setup core C0 userlocal register. Signed-off-by: Pavel Pisa --- qtmips_machine/core.cpp | 8 ++++++-- qtmips_machine/core.h | 4 +++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/qtmips_machine/core.cpp b/qtmips_machine/core.cpp index d4a3ce6..a276b3b 100644 --- a/qtmips_machine/core.cpp +++ b/qtmips_machine/core.cpp @@ -47,7 +47,7 @@ Core::Core(Registers *regs, MemoryAccess *mem_program, MemoryAccess *mem_data, this->mem_data = mem_data; this->ex_default_handler = new StopExceptionHandler(); this->min_cache_row_size = min_cache_row_size; - this->hwr_user_local = 0xe0000000; + this->hwr_userlocal = 0xe0000000; } void Core::step(bool skip_break) { @@ -135,6 +135,10 @@ bool Core::handle_exception(Core *core, Registers *regs, ExceptionCause excause, return false; } +void Core::set_c0_userlocal(std::uint32_t address) { + hwr_userlocal = address; +} + struct Core::dtFetch Core::fetch(bool skip_break) { enum ExceptionCause excause = EXCAUSE_NONE; std::uint32_t inst_addr = regs->read_pc(); @@ -276,7 +280,7 @@ struct Core::dtExecute Core::execute(const struct dtDecode &dt) { alu_val = 1; break; case 29: // UserLocal - alu_val = hwr_user_local; + alu_val = hwr_userlocal; break; default: alu_val = 0; diff --git a/qtmips_machine/core.h b/qtmips_machine/core.h index 97a15c1..889a30c 100644 --- a/qtmips_machine/core.h +++ b/qtmips_machine/core.h @@ -85,6 +85,8 @@ public: void remove_hwbreak(std::uint32_t address); bool is_hwbreak(std::uint32_t address); + void set_c0_userlocal(std::uint32_t address); + enum ForwardFrom { FORWARD_NONE = 0b00, FORWARD_FROM_W = 0b01, @@ -247,7 +249,7 @@ private: }; unsigned int cycle_c; unsigned int min_cache_row_size; - std::uint32_t hwr_user_local; + std::uint32_t hwr_userlocal; QMap hw_breaks; }; -- cgit v1.2.3