diff options
author | bd <bdunahu@operationnull.com> | 2025-04-14 16:28:05 -0400 |
---|---|---|
committer | bd <bdunahu@operationnull.com> | 2025-04-14 16:28:05 -0400 |
commit | ee433509972d9390a52f188e902eb74e55596822 (patch) | |
tree | a2bb8d9eb7220cbaf147c3af3fb837bec6736296 /tests | |
parent | b91eb002d4e6b2dc0c51b03df57c5089659ac669 (diff) |
Allow multi-level cache by passing a size into the constructor
Diffstat (limited to 'tests')
-rw-r--r-- | tests/c11.h | 11 | ||||
-rw-r--r-- | tests/cache_2_1.cc | 21 |
2 files changed, 30 insertions, 2 deletions
diff --git a/tests/c11.h b/tests/c11.h index eb59cc0..6d63c77 100644 --- a/tests/c11.h +++ b/tests/c11.h @@ -6,12 +6,19 @@ #include <catch2/catch_test_macros.hpp> #include <functional> +/** + * one way associative, single level + */ class C11 { public: - C11() : m_delay(4), c_delay(2), mem(new int), fetch(new int) + C11() { - this->c = new Cache(new Dram(this->m_delay), this->c_delay); + this->m_delay = 4; + this->c_delay = 2; + this->mem = new int(); + this->fetch = new int(); + this->c = new Cache(new Dram(this->m_delay), 5, this->c_delay); this->expected = {0, 0, 0, 0}; this->actual = this->c->view(0, 1)[0]; } diff --git a/tests/cache_2_1.cc b/tests/cache_2_1.cc new file mode 100644 index 0000000..101c6c3 --- /dev/null +++ b/tests/cache_2_1.cc @@ -0,0 +1,21 @@ +#include "c11.h" +#include "cache.h" +#include "dram.h" +#include "storage.h" +#include <catch2/catch_test_macros.hpp> + +/** + * one way associative, two level + */ +class C21 : public C11 +{ + public: + C21() : C11() + { + Storage *s; + + s = new Dram(this->m_delay); + s = new Cache(s, 5, this->c_delay); + this->c = new Cache(s, 7, this->c_delay); + } +}; |