diff options
author | Pavel Pisa <pisa@cmp.felk.cvut.cz> | 2019-02-14 00:41:06 +0100 |
---|---|---|
committer | Pavel Pisa <pisa@cmp.felk.cvut.cz> | 2019-02-14 00:41:06 +0100 |
commit | 0916bef42e28218b08b05342d5b571b8a45afb5a (patch) | |
tree | 3136a3f02d14f344aada02ba00249722431f8532 | |
parent | 8dca954e854386ea9ab81da328d515b48b04affe (diff) | |
download | qtmips-0916bef42e28218b08b05342d5b571b8a45afb5a.tar.gz qtmips-0916bef42e28218b08b05342d5b571b8a45afb5a.tar.bz2 qtmips-0916bef42e28218b08b05342d5b571b8a45afb5a.zip |
Implement function to setup core C0 userlocal register.
Signed-off-by: Pavel Pisa <pisa@cmp.felk.cvut.cz>
-rw-r--r-- | qtmips_machine/core.cpp | 8 | ||||
-rw-r--r-- | 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<std::uint32_t, hwBreak *> hw_breaks; }; |