Add some cache test cases
This commit is contained in:
49
tests/tests_simulator/cache/tests_cache.cpp
vendored
49
tests/tests_simulator/cache/tests_cache.cpp
vendored
@@ -78,16 +78,51 @@ protected:
|
||||
Cache cache;
|
||||
};
|
||||
|
||||
TEST_F(DirectMappedCache, Hello)
|
||||
TEST_F(DirectMappedCache, Basic)
|
||||
{
|
||||
using sc_core::SC_NS;
|
||||
using sc_core::sc_time;
|
||||
using Command = ListInitiator::TestTransactionData::Command;
|
||||
|
||||
std::vector<ListInitiator::TestTransactionData> list{
|
||||
{sc_core::sc_time(1000, sc_core::SC_NS),
|
||||
sc_core::sc_time(1017, sc_core::SC_NS),
|
||||
ListInitiator::TestTransactionData::Command::Read,
|
||||
0x0,
|
||||
4,
|
||||
0x0}};
|
||||
// Test miss
|
||||
{sc_time(0, SC_NS), sc_time(17, SC_NS), Command::Read, 0x0, 4, 0x0},
|
||||
|
||||
// Test secondary miss
|
||||
{sc_time(1, SC_NS), sc_time(18, SC_NS), Command::Read, 0x0, 4, 0x0},
|
||||
|
||||
// Test hit
|
||||
{sc_time(100, SC_NS), sc_time(106, SC_NS), Command::Read, 0x0, 4, 0x0},
|
||||
|
||||
// Test write hit
|
||||
{sc_time(200, SC_NS), sc_time(206, SC_NS), Command::Write, 0x0, 4, 0x8},
|
||||
|
||||
// Test eviction
|
||||
{sc_time(300, SC_NS), sc_time(317, SC_NS), Command::Write, 1024 * 32, 4, 0x0}};
|
||||
|
||||
initiator.appendTestTransactionList(list);
|
||||
sc_core::sc_start();
|
||||
}
|
||||
|
||||
// Does not work yet
|
||||
// Unclear if a snoop should even happen when the line eviction fails
|
||||
// TEST_F(DirectMappedCache, WriteBufferSnooping)
|
||||
// {
|
||||
// using sc_core::SC_NS;
|
||||
// using sc_core::sc_time;
|
||||
// using Command = ListInitiator::TestTransactionData::Command;
|
||||
|
||||
// std::vector<ListInitiator::TestTransactionData> list{
|
||||
// // Allocate line
|
||||
// {sc_time(0, SC_NS), sc_time(17, SC_NS), Command::Write, 0x0, 4, 0x0},
|
||||
|
||||
// // Evict line
|
||||
// {sc_time(100, SC_NS), sc_time(117, SC_NS), Command::Read, 1024 * 32, 4, 0x0},
|
||||
|
||||
// // Snoop from write buffer
|
||||
// {sc_time(102, SC_NS), sc_time(108, SC_NS), Command::Read, 0x0, 4, 0x0},
|
||||
// };
|
||||
|
||||
// initiator.appendTestTransactionList(list);
|
||||
// sc_core::sc_start();
|
||||
// }
|
||||
|
||||
Reference in New Issue
Block a user