summaryrefslogtreecommitdiff
path: root/inc/dram.h
diff options
context:
space:
mode:
authorbd <bdunahu@operationnull.com>2025-04-14 16:28:05 -0400
committerbd <bdunahu@operationnull.com>2025-04-14 16:28:05 -0400
commitee433509972d9390a52f188e902eb74e55596822 (patch)
treea2bb8d9eb7220cbaf147c3af3fb837bec6736296 /inc/dram.h
parentb91eb002d4e6b2dc0c51b03df57c5089659ac669 (diff)
Allow multi-level cache by passing a size into the constructor
Diffstat (limited to 'inc/dram.h')
-rw-r--r--inc/dram.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/inc/dram.h b/inc/dram.h
index 140cbb1..fc46b47 100644
--- a/inc/dram.h
+++ b/inc/dram.h
@@ -5,6 +5,15 @@
#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: