aboutsummaryrefslogtreecommitdiff
path: root/qtmips_machine/memory.h
diff options
context:
space:
mode:
authorPavel Pisa <pisa@cmp.felk.cvut.cz>2019-02-03 23:03:59 +0100
committerPavel Pisa <pisa@cmp.felk.cvut.cz>2019-02-03 23:03:59 +0100
commit361f5aab10d72e2200dfc7985a1511044b987db8 (patch)
tree02688761a1dc29731c0fc069a2d89205a867a8ef /qtmips_machine/memory.h
parent55e1bc746a45118e14554c957b4ee4663039d9af (diff)
downloadqtmips-361f5aab10d72e2200dfc7985a1511044b987db8.tar.gz
qtmips-361f5aab10d72e2200dfc7985a1511044b987db8.tar.bz2
qtmips-361f5aab10d72e2200dfc7985a1511044b987db8.zip
Correct memory view updates for uncached and write-through case.
Signed-off-by: Pavel Pisa <pisa@cmp.felk.cvut.cz>
Diffstat (limited to 'qtmips_machine/memory.h')
-rw-r--r--qtmips_machine/memory.h18
1 files changed, 12 insertions, 6 deletions
diff --git a/qtmips_machine/memory.h b/qtmips_machine/memory.h
index e4777b3..4b40243 100644
--- a/qtmips_machine/memory.h
+++ b/qtmips_machine/memory.h
@@ -12,9 +12,9 @@ class MemoryAccess : public QObject {
Q_OBJECT
public:
// Note: hword and word methods are throwing away lowest bits so unaligned access is ignored without error.
- void write_byte(std::uint32_t offset, std::uint8_t value);
- void write_hword(std::uint32_t offset, std::uint16_t value);
- void write_word(std::uint32_t offset, std::uint32_t value);
+ bool write_byte(std::uint32_t offset, std::uint8_t value);
+ bool write_hword(std::uint32_t offset, std::uint16_t value);
+ bool write_word(std::uint32_t offset, std::uint32_t value);
std::uint8_t read_byte(std::uint32_t offset) const;
std::uint16_t read_hword(std::uint32_t offset) const;
@@ -34,7 +34,7 @@ public:
virtual void sync();
protected:
- virtual void wword(std::uint32_t offset, std::uint32_t value) = 0;
+ virtual bool wword(std::uint32_t offset, std::uint32_t value) = 0;
virtual std::uint32_t rword(std::uint32_t offset) const = 0;
private:
@@ -47,7 +47,7 @@ public:
MemorySection(const MemorySection&);
~MemorySection();
- void wword(std::uint32_t offset, std::uint32_t value);
+ bool wword(std::uint32_t offset, std::uint32_t value);
std::uint32_t rword(std::uint32_t offset) const;
void merge(MemorySection&);
@@ -77,7 +77,7 @@ public:
void reset(const Memory&);
MemorySection *get_section(std::uint32_t address, bool create) const; // returns section containing given address
- void wword(std::uint32_t address, std::uint32_t value);
+ bool wword(std::uint32_t address, std::uint32_t value);
std::uint32_t rword(std::uint32_t address) const;
bool operator==(const Memory&) const;
@@ -85,8 +85,14 @@ public:
const union MemoryTree *get_memorytree_root() const;
+ inline std::uint32_t get_change_counter() const {
+ return change_counter;
+ }
+
private:
union MemoryTree *mt_root;
+ std::uint32_t change_counter;
+ std::uint32_t write_counter;
static union MemoryTree *allocate_section_tree();
static void free_section_tree(union MemoryTree*, size_t depth);
static bool compare_section_tree(const union MemoryTree*, const union MemoryTree*, size_t depth);