diff options
author | bd <bdunahu@operationnull.com> | 2025-03-06 00:34:35 -0500 |
---|---|---|
committer | bd <bdunahu@operationnull.com> | 2025-03-06 00:34:35 -0500 |
commit | 3322aa0845f7fe9cc98aa4e429bd5ecf72a5c27e (patch) | |
tree | 75f627ee8e75c0763ab8b048496464c60e486490 /tests | |
parent | 20fe698a4074df4abe02f14a1a14481770e90abc (diff) |
dram write (no delay, no accessor tracking
Diffstat (limited to 'tests')
-rw-r--r-- | tests/cache.cc | 11 | ||||
-rw-r--r-- | tests/dram.cc | 30 |
2 files changed, 32 insertions, 9 deletions
diff --git a/tests/cache.cc b/tests/cache.cc index 3b3787d..3c1fba6 100644 --- a/tests/cache.cc +++ b/tests/cache.cc @@ -1,11 +1,12 @@ #include "cache.h" +#include "definitions.h" #include <catch2/catch_test_macros.hpp> -TEST_CASE("Constructor initialize test 1", "[cache]") +TEST_CASE("Constructor singleton dram", "[cache]") { - Cache *c = new Cache(1, nullptr, 4); - std::array<signed int, 4> expected = {0, 0, 0, 0}; - std::array<signed int, 4> actual = c->view(0, 1)[0]; - CHECK(expected == actual); + Cache *c = new Cache(1, nullptr, LINE_SIZE); + std::array<signed int, LINE_SIZE> expected = {0, 0, 0, 0}; + std::array<signed int, LINE_SIZE> actual = c->view(0, 1)[0]; + REQUIRE(expected == actual); delete c; } diff --git a/tests/dram.cc b/tests/dram.cc index 8d5d03b..15e2990 100644 --- a/tests/dram.cc +++ b/tests/dram.cc @@ -1,12 +1,34 @@ #include "dram.h" +#include "definitions.h" #include <catch2/catch_test_macros.hpp> #include <array> -TEST_CASE("Constructor initialize test 1", "[dram]") +TEST_CASE("Construct singleton dram", "[dram]") { - Dram *d = new Dram(1, 4); - std::array<signed int, 4> expected = {0, 0, 0, 0}; - std::array<signed int, 4> actual = d->view(0, 1)[0]; + Dram *d = new Dram(1, 1); + std::array<signed int, LINE_SIZE> expected = {0, 0, 0, 0}; + std::array<signed int, LINE_SIZE> actual = d->view(0, 1)[0]; + REQUIRE(expected == actual); + delete d; +} + +TEST_CASE("Construct ingleton dram, store 0th element in zero cycles", "[dram]") +{ + Dram *d = new Dram(1, 0); + std::array<signed int, LINE_SIZE> expected = {0, 0, 0, 0}; + std::array<signed int, LINE_SIZE> actual = d->view(0, 1)[0]; CHECK(expected == actual); + + signed int w = 0x11223344; + + Response *r = d->write(MEMORY, w, 0x00000000); + REQUIRE(r->status == OK); + + + expected.at(0) = w; + actual = d->view(0, 1)[0]; + REQUIRE(expected == actual); + + delete r; delete d; } |