From 6b639c50c93e4a682b15dcdf20f3d46a47d68a64 Mon Sep 17 00:00:00 2001 From: Pavel Pisa Date: Fri, 8 Feb 2019 10:47:27 +0100 Subject: Add write and read notification to the simple peripheral component. Signed-off-by: Pavel Pisa --- qtmips_machine/peripheral.cpp | 8 +++++++- qtmips_machine/peripheral.h | 5 +++++ qtmips_machine/qtmipsexception.h | 3 ++- 3 files changed, 14 insertions(+), 2 deletions(-) (limited to 'qtmips_machine') 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 { \ -- cgit v1.2.3