From 28a2788e2c59357d9269e558b0bd45db3241c42d Mon Sep 17 00:00:00 2001 From: bd Date: Sat, 12 Apr 2025 00:44:29 -0400 Subject: Rewrite utils functions as macros --- src/dram.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/dram.cc') diff --git a/src/dram.cc b/src/dram.cc index d81e2d2..2fd8a91 100644 --- a/src/dram.cc +++ b/src/dram.cc @@ -4,7 +4,6 @@ #include #include #include -#include Dram::Dram(int delay) : Storage(delay) { this->data->resize(MEM_LINES); } @@ -85,3 +84,10 @@ Dram::is_access_cleared(void *id) } return 0; } + +void +Dram::get_memory_index(int address, int &line, int &word) +{ + line = WRAP_ADDRESS(address) / LINE_SIZE; + word = address % LINE_SIZE; +} -- cgit v1.2.3