From ee433509972d9390a52f188e902eb74e55596822 Mon Sep 17 00:00:00 2001 From: bd Date: Mon, 14 Apr 2025 16:28:05 -0400 Subject: Allow multi-level cache by passing a size into the constructor --- inc/dram.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'inc/dram.h') 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 #include +// 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: -- cgit v1.2.3