diff options
author | bd <bdunahu@operationnull.com> | 2025-04-11 21:14:25 -0400 |
---|---|---|
committer | bd <bdunahu@operationnull.com> | 2025-04-11 21:14:25 -0400 |
commit | 101f0facf8002907ca6e19faabfdcf472c0c3152 (patch) | |
tree | f5cdc59276f18428a02db3898be6ccf23753c349 /src/utils | |
parent | 1b5a73c67f9eaaf73e5046f52c48105579a7dae4 (diff) |
Move source files to top-level src directory
Diffstat (limited to 'src/utils')
-rw-r--r-- | src/utils/accessor.cc | 10 | ||||
-rw-r--r-- | src/utils/response.cc | 8 | ||||
-rw-r--r-- | src/utils/utils.cc | 42 |
3 files changed, 0 insertions, 60 deletions
diff --git a/src/utils/accessor.cc b/src/utils/accessor.cc deleted file mode 100644 index 99347ed..0000000 --- a/src/utils/accessor.cc +++ /dev/null @@ -1,10 +0,0 @@ -#include "accessor.h" -#include <iostream> - -std::ostream &operator<<(std::ostream &os, Accessor a) -{ - const std::string nameA[] = { - "IDLE", "WRITE", "MEM", "EXEC", "DCDE", "FETCH", "L1CACHE", "SIDE", - }; - return os << nameA[a]; -} diff --git a/src/utils/response.cc b/src/utils/response.cc deleted file mode 100644 index 3d6e439..0000000 --- a/src/utils/response.cc +++ /dev/null @@ -1,8 +0,0 @@ -#include "response.h" -#include <iostream> - -std::ostream &operator<<(std::ostream &os, Response r) -{ - const std::string nameR[] = {"OK", "WAIT", "BLOCKED", "STALLED"}; - return os << nameR[r]; -} diff --git a/src/utils/utils.cc b/src/utils/utils.cc deleted file mode 100644 index e12a0e0..0000000 --- a/src/utils/utils.cc +++ /dev/null @@ -1,42 +0,0 @@ -#include "utils.h" -#include "definitions.h" -#include <cstdarg> -#include <string> -#include <vector> - -void get_cache_fields(int address, int *tag, int *index, int *offset) -{ - *tag = GET_MID_BITS(address, L1_CACHE_LINE_SPEC + LINE_SPEC, MEM_WORD_SPEC); - *index = GET_MID_BITS(address, LINE_SPEC, L1_CACHE_LINE_SPEC + LINE_SPEC); - *offset = GET_LS_BITS(address, LINE_SPEC); -} - -const std::string string_format(const char *const zcFormat, ...) -{ - va_list vaArgs; - va_start(vaArgs, zcFormat); - - va_list vaArgsCopy; - va_copy(vaArgsCopy, vaArgs); - const int iLen = std::vsnprintf(NULL, 0, zcFormat, vaArgsCopy); - va_end(vaArgsCopy); - - std::vector<char> zc(iLen + 1); - std::vsnprintf(zc.data(), zc.size(), zcFormat, vaArgs); - va_end(vaArgs); - return std::string(zc.data(), iLen); -} - -int wrap_address(int address) -{ - if (address < 0) { - return ((address % MEM_WORDS) + MEM_WORDS) % MEM_WORDS; - } - return address % MEM_WORDS; -} - -void get_memory_index(int address, int &line, int &word) -{ - line = wrap_address(address) / LINE_SIZE; - word = address % LINE_SIZE; -} |