diff options
author | Karel Kočí <cynerd@email.cz> | 2017-12-12 20:07:29 +0100 |
---|---|---|
committer | Karel Kočí <cynerd@email.cz> | 2017-12-12 20:07:29 +0100 |
commit | 535fe1cab28a630e311bcf82778f6d14f35c3ed0 (patch) | |
tree | 3cdbcb5f7edf64fc42ceae403daab5b0c486a819 /qtmips_machine/memory.h | |
parent | 15398c34d38489bf14a100bbf01fb9fb4c7e46cb (diff) | |
download | qtmips-535fe1cab28a630e311bcf82778f6d14f35c3ed0.tar.gz qtmips-535fe1cab28a630e311bcf82778f6d14f35c3ed0.tar.bz2 qtmips-535fe1cab28a630e311bcf82778f6d14f35c3ed0.zip |
Add memory type abstract function
This functions can be used to write or read 32bit values from memory and
memory on its own does signextends for example depending on passed
control value.
Diffstat (limited to 'qtmips_machine/memory.h')
-rw-r--r-- | qtmips_machine/memory.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/qtmips_machine/memory.h b/qtmips_machine/memory.h index 1b56d7c..90fda1b 100644 --- a/qtmips_machine/memory.h +++ b/qtmips_machine/memory.h @@ -18,11 +18,23 @@ public: std::uint16_t read_hword(std::uint32_t offset); std::uint32_t read_word(std::uint32_t offset); + enum AccessControl { + AC_BYTE, + AC_HALFWORD, + AC_WORD, + AC_BYTE_UNSIGNED, + AC_HALFWORD_UNSIGNED + }; + void write_ctl(enum AccessControl ctl, std::uint32_t offset, std::uint32_t value); + std::uint32_t read_ctl(enum AccessControl ctl, std::uint32_t offset); + signals: // TODO trigger void byte_change(std::uint32_t address, std::uint32_t value); }; +Q_DECLARE_METATYPE(MemoryAccess::AccessControl) + class MemorySection : public MemoryAccess { public: MemorySection(std::uint32_t length); |