diff options
author | Siddarth Suresh <155843085+SiddarthSuresh98@users.noreply.github.com> | 2025-03-11 20:34:40 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-03-11 20:34:40 -0400 |
commit | 1b01b557e76f8643964e5c367c072ab7778036f6 (patch) | |
tree | 30947c7018653ca18d4a69de20936b3615768f9e /inc | |
parent | 92e8c2583695a3bf652e0e8dedb79e7a99922f5f (diff) | |
parent | c55104f8e99ea6ccb0c66a5e0d3cfc81dbbc19ab (diff) |
Merge pull request #26 from bdunahu/bdunahu
clarify macro names, implement load in CLI, fix many display issues
Diffstat (limited to 'inc')
-rw-r--r-- | inc/cache.h | 4 | ||||
-rw-r--r-- | inc/definitions.h | 26 |
2 files changed, 15 insertions, 15 deletions
diff --git a/inc/cache.h b/inc/cache.h index 17abcdd..31602ca 100644 --- a/inc/cache.h +++ b/inc/cache.h @@ -38,7 +38,7 @@ class Cache : public Storage * TODO this doesn't seem like good object-oriented practice. * @return this->meta */ - std::array<std::array<int, 2>, L1_CACHE_SIZE> get_meta() const; + std::array<std::array<int, 2>, L1_CACHE_LINES> get_meta() const; private: /** @@ -54,7 +54,7 @@ class Cache : public Storage * element in `data` is invalid. If the most second value of an element * is nonzero, the corresponding element in `data` is dirty. */ - std::array<std::array<int, 2>, L1_CACHE_SIZE> meta; + std::array<std::array<int, 2>, L1_CACHE_LINES> meta; }; std::ostream &operator<<(std::ostream &os, const Cache &c); diff --git a/inc/definitions.h b/inc/definitions.h index f015ce9..eced554 100644 --- a/inc/definitions.h +++ b/inc/definitions.h @@ -13,33 +13,33 @@ #define LINE_SIZE static_cast<int>(pow(2, 2)) /** + * The number of bits to specify a memory word * The number of bits to specify a memory line - * calculated as: (/ (expt 2 15) 4) + * The total number of lines in memory */ -#define MEM_SPEC 8 -/** - * The total number of words in memory - */ -#define MEM_SIZE static_cast<int>(pow(2, MEM_SPEC)) +#define MEM_WORD_SPEC 10 +#define MEM_LINE_SPEC static_cast<unsigned int>(MEM_WORD_SPEC - LINE_SPEC) +#define MEM_WORDS static_cast<int>(pow(2, MEM_WORD_SPEC)) +#define MEM_LINES static_cast<int>(pow(2, MEM_LINE_SPEC)) /** + * The number of bits to specify a l1 cache word * The number of bits to specify a l1 cache line + * The total number of lines in l1 cache */ -#define L1_CACHE_SPEC 5 -/** - * The total number of words in l1 cache - */ -#define L1_CACHE_SIZE static_cast<int>(pow(2, L1_CACHE_SPEC)) +#define L1_CACHE_WORD_SPEC 7 +#define L1_CACHE_LINE_SPEC static_cast<unsigned int>(L1_CACHE_WORD_SPEC - LINE_SPEC) +#define L1_CACHE_LINES static_cast<int>(pow(2, L1_CACHE_LINE_SPEC)) /** * The total number of cycles a memory access takes. */ -#define MEM_DELAY 4 +#define MEM_DELAY 3 /** * The total number of cycles a level one cache access takes */ -#define L1_CACHE_DELAY 1 +#define L1_CACHE_DELAY 0 /** * Return the N least-significant bits from integer K using a bit mask |