summaryrefslogtreecommitdiff
path: root/inc/dram.h
diff options
context:
space:
mode:
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: