From 21187ae663a8450553881851e8450315c8d9ca1c Mon Sep 17 00:00:00 2001 From: Siddarth-Suresh <65844402+Siddarth-Suresh@users.noreply.github.com> Date: Tue, 11 Mar 2025 15:24:57 -0400 Subject: Tests for write line in Dram, memory address wrapping implementation and tests --- src/utils/utils.cc | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/utils') 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; +} -- cgit v1.2.3