summaryrefslogtreecommitdiff
path: root/src/utils/utils.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils/utils.cc')
-rw-r--r--src/utils/utils.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/utils/utils.cc b/src/utils/utils.cc
index ebbc1e9..3a11c2c 100644
--- a/src/utils/utils.cc
+++ b/src/utils/utils.cc
@@ -34,3 +34,9 @@ int wrap_address(int address) {
}
return address % MEM_WORDS;
}
+
+void get_memory_index(int address, int &line, int &word)
+{
+ line = wrap_address(address) / LINE_SIZE;
+ word = address % LINE_SIZE;
+}