diff options
author | Pavel Pisa <pisa@cmp.felk.cvut.cz> | 2019-02-08 10:47:27 +0100 |
---|---|---|
committer | Pavel Pisa <pisa@cmp.felk.cvut.cz> | 2019-02-08 10:47:27 +0100 |
commit | 6b639c50c93e4a682b15dcdf20f3d46a47d68a64 (patch) | |
tree | 631b71bf5d1125297918c1f73a680fe738e3cbd9 | |
parent | 0137207cb51ef3dd8b097d6cf88fd627fc468af2 (diff) | |
download | qtmips-6b639c50c93e4a682b15dcdf20f3d46a47d68a64.tar.gz qtmips-6b639c50c93e4a682b15dcdf20f3d46a47d68a64.tar.bz2 qtmips-6b639c50c93e4a682b15dcdf20f3d46a47d68a64.zip |
Add write and read notification to the simple peripheral component.
Signed-off-by: Pavel Pisa <pisa@cmp.felk.cvut.cz>
-rw-r--r-- | qtmips_machine/peripheral.cpp | 8 | ||||
-rw-r--r-- | qtmips_machine/peripheral.h | 5 | ||||
-rw-r--r-- | qtmips_machine/qtmipsexception.h | 3 |
3 files changed, 14 insertions, 2 deletions
diff --git a/qtmips_machine/peripheral.cpp b/qtmips_machine/peripheral.cpp index 161f760..ac74c2a 100644 --- a/qtmips_machine/peripheral.cpp +++ b/qtmips_machine/peripheral.cpp @@ -50,13 +50,19 @@ bool SimplePeripheral::wword(std::uint32_t address, std::uint32_t value) { printf("SimplePeripheral::wword address 0x%08lx data 0x%08lx\n", (unsigned long)address, (unsigned long)value); #endif + emit write_notification(address, value); + return true; } std::uint32_t SimplePeripheral::rword(std::uint32_t address) const { + std::uint32_t value = 0x12345678; #if 0 printf("SimplePeripheral::rword address 0x%08lx\n", (unsigned long)address); #endif - return 0x12345678; + + emit read_notification(address, &value); + + return value; } diff --git a/qtmips_machine/peripheral.h b/qtmips_machine/peripheral.h index dfc4db7..92df1d7 100644 --- a/qtmips_machine/peripheral.h +++ b/qtmips_machine/peripheral.h @@ -51,6 +51,11 @@ public: SimplePeripheral(); ~SimplePeripheral(); +signals: + void write_notification(std::uint32_t address, std::uint32_t value); + void read_notification(std::uint32_t address, std::uint32_t *value) const; + +public: bool wword(std::uint32_t address, std::uint32_t value); std::uint32_t rword(std::uint32_t address) const; }; diff --git a/qtmips_machine/qtmipsexception.h b/qtmips_machine/qtmipsexception.h index e48bf1c..e592ef0 100644 --- a/qtmips_machine/qtmipsexception.h +++ b/qtmips_machine/qtmipsexception.h @@ -90,7 +90,8 @@ protected: EXCEPTION(UnalignedJump, Runtime) \ EXCEPTION(UnknownMemoryControl, Runtime) \ EXCEPTION(OutOfMemoryAccess, Runtime) \ - EXCEPTION(Sanity,) + EXCEPTION(Sanity,) \ + EXCEPTION(SyscallUnknown, Runtime) \ #define EXCEPTION(NAME, PARENT) \ class QtMipsException##NAME : public QtMipsException##PARENT { \ |