diff options
author | Siddarth-Suresh <65844402+Siddarth-Suresh@users.noreply.github.com> | 2025-03-11 15:24:57 -0400 |
---|---|---|
committer | Siddarth-Suresh <65844402+Siddarth-Suresh@users.noreply.github.com> | 2025-03-11 15:24:57 -0400 |
commit | 21187ae663a8450553881851e8450315c8d9ca1c (patch) | |
tree | 2a1a7b5b7847d979052ea4aae2f04d7915332c79 /src | |
parent | b87fa0973b7a3ec08b08e86a2505e68879455b0e (diff) |
Tests for write line in Dram, memory address wrapping implementation and tests
Diffstat (limited to 'src')
-rw-r--r-- | src/utils/utils.cc | 7 |
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; +} |