summaryrefslogtreecommitdiff
path: root/src/utils
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/utils.cc11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/utils/utils.cc b/src/utils/utils.cc
new file mode 100644
index 0000000..dfeb2b3
--- /dev/null
+++ b/src/utils/utils.cc
@@ -0,0 +1,11 @@
+#include "utils.h"
+#include "definitions.h"
+
+void get_bit_fields(int address, int *tag, int *index, int *offset)
+{
+ *tag =
+ GET_MID_BITS(address, LINE_SPEC + L1_CACHE_SPEC,
+ MEM_SPEC + LINE_SPEC + L1_CACHE_SPEC);
+ *index = GET_MID_BITS(address, LINE_SPEC, L1_CACHE_SPEC + LINE_SPEC);
+ *offset = GET_LS_BITS(address, LINE_SPEC);
+}