summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSiddarth-Suresh <65844402+Siddarth-Suresh@users.noreply.github.com>2025-03-11 15:24:57 -0400
committerSiddarth-Suresh <65844402+Siddarth-Suresh@users.noreply.github.com>2025-03-11 15:24:57 -0400
commit21187ae663a8450553881851e8450315c8d9ca1c (patch)
tree2a1a7b5b7847d979052ea4aae2f04d7915332c79 /src
parentb87fa0973b7a3ec08b08e86a2505e68879455b0e (diff)
Tests for write line in Dram, memory address wrapping implementation and tests
Diffstat (limited to 'src')
-rw-r--r--src/utils/utils.cc7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/utils/utils.cc b/src/utils/utils.cc
index 5de8e89..f95d88f 100644
--- a/src/utils/utils.cc
+++ b/src/utils/utils.cc
@@ -28,3 +28,10 @@ const std::string string_format(const char *const zcFormat, ...)
va_end(vaArgs);
return std::string(zc.data(), iLen);
}
+
+int wrap_address(int address) {
+ if (address < 0){
+ return ((address % MEM_SIZE) + MEM_SIZE) % MEM_SIZE;
+ }
+ return address % MEM_SIZE;
+}