summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSiddarth Suresh <155843085+SiddarthSuresh98@users.noreply.github.com>2025-04-18 04:27:04 -0400
committerGitHub <noreply@github.com>2025-04-18 04:27:04 -0400
commit3072eead6fa128398a3cbc0d874473385aef6878 (patch)
tree6aaa187b02b3ca6f6523963d89c736ffd91e33fa
parenta2381acb5489a735576a43f25053a7a5551a7667 (diff)
parent644b9ef0c380a7fc0ec3496de1c3a54793ca1fbf (diff)
Merge pull request #4 from bdunahu/bdunahu
Wrap all addresses immediately
-rw-r--r--inc/definitions.h5
-rw-r--r--inc/dram.h9
-rw-r--r--inc/storage.h9
-rw-r--r--src/cache.cc1
4 files changed, 10 insertions, 14 deletions
diff --git a/inc/definitions.h b/inc/definitions.h
index 8513361..a9077b2 100644
--- a/inc/definitions.h
+++ b/inc/definitions.h
@@ -31,11 +31,6 @@
#define MEM_DELAY 3
/**
- * The total number of cycles a level one cache access takes
- */
-#define L1_CACHE_DELAY 0
-
-/**
* Return the N least-significant bits from integer K using a bit mask
* @param the integer to be parsed
* @param the number of bits to be parsed
diff --git a/inc/dram.h b/inc/dram.h
index 2a4e358..847642d 100644
--- a/inc/dram.h
+++ b/inc/dram.h
@@ -5,15 +5,6 @@
#include <functional>
#include <ostream>
-// clang-format off
-/**
- * Ensures address is within the current memory size using a clean wrap.
- * @param an address
- */
-#define WRAP_ADDRESS(a) \
- ((a < 0) ? ((a % MEM_WORDS) + MEM_WORDS) % MEM_WORDS : a % MEM_WORDS)
-// clang-format on
-
class Dram : public Storage
{
public:
diff --git a/inc/storage.h b/inc/storage.h
index 1bf5805..994bb8f 100644
--- a/inc/storage.h
+++ b/inc/storage.h
@@ -7,6 +7,15 @@
#include <map>
#include <vector>
+// clang-format off
+/**
+ * Ensures address is within the current memory size using a clean wrap.
+ * @param an address
+ */
+#define WRAP_ADDRESS(a) \
+ ((a < 0) ? ((a % MEM_WORDS) + MEM_WORDS) % MEM_WORDS : a % MEM_WORDS)
+// clang-format on
+
class Storage
{
public:
diff --git a/src/cache.cc b/src/cache.cc
index a2d4525..c934a26 100644
--- a/src/cache.cc
+++ b/src/cache.cc
@@ -62,6 +62,7 @@ Cache::read_word(void *id, int address, signed int &data)
int
Cache::process(void *id, int address, std::function<void(int index, int offset)> request_handler)
{
+ address = WRAP_ADDRESS(address);
if (!preprocess(id) || priming_address(address) || !this->is_data_ready())
return 0;