aboutsummaryrefslogtreecommitdiff
path: root/qtmips_machine/cache.cpp
diff options
context:
space:
mode:
authorPavel Pisa <pisa@cmp.felk.cvut.cz>2019-02-04 22:03:38 +0100
committerPavel Pisa <pisa@cmp.felk.cvut.cz>2019-02-04 22:03:38 +0100
commit8c7a41702faf6760c74382ae269f0bf4603a0abe (patch)
treeda207dcf5cae0dc64982584403c6508d5ce91c3d /qtmips_machine/cache.cpp
parentd3363c3430029eba44464469176b3b27bb12089a (diff)
downloadqtmips-8c7a41702faf6760c74382ae269f0bf4603a0abe.tar.gz
qtmips-8c7a41702faf6760c74382ae269f0bf4603a0abe.tar.bz2
qtmips-8c7a41702faf6760c74382ae269f0bf4603a0abe.zip
Define uncached region in range from 0xf0000000 to 0xffffffff.
Signed-off-by: Pavel Pisa <pisa@cmp.felk.cvut.cz>
Diffstat (limited to 'qtmips_machine/cache.cpp')
-rw-r--r--qtmips_machine/cache.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/qtmips_machine/cache.cpp b/qtmips_machine/cache.cpp
index 3fbfc3f..7925dc0 100644
--- a/qtmips_machine/cache.cpp
+++ b/qtmips_machine/cache.cpp
@@ -41,6 +41,8 @@ Cache::Cache(Memory *m, const MachineConfigCache *cc, unsigned memory_access_pen
mem = m;
access_pen_r = memory_access_penalty_r;
access_pen_w = memory_access_penalty_w;
+ uncached_start = 0xf0000000;
+ uncached_last = 0xffffffff;
// Zero hit and miss rate
hit_read = 0;
hit_write = 0;
@@ -77,7 +79,9 @@ Cache::Cache(Memory *m, const MachineConfigCache *cc, unsigned memory_access_pen
bool Cache::wword(std::uint32_t address, std::uint32_t value) {
bool changed;
- if (!cnf.enabled()) {
+
+ if (!cnf.enabled() ||
+ (address >= uncached_start && address <= uncached_last)) {
return mem->write_word(address, value);
}
@@ -90,8 +94,10 @@ bool Cache::wword(std::uint32_t address, std::uint32_t value) {
}
std::uint32_t Cache::rword(std::uint32_t address) const {
- if (!cnf.enabled())
+ if (!cnf.enabled() ||
+ (address >= uncached_start && address <= uncached_last)) {
return mem->read_word(address);
+ }
std::uint32_t data;
access(address, &data, false);