Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dut/OpenLLC
15 changes: 15 additions & 0 deletions main/Events/TLSystemEvent.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,5 +66,20 @@ class TLSystemFinishEvent : public Gravity::Event<TLSystemFinishEvent>
//


/*
* TL-Test TileLink subsystem finished events
* -----------------------------------------------------------------------
* This event is called by main routine to broadcast the finished state of
* main routine and never called by TL-Test components.
* It is guaranteed that all circuit activity was ended after this event.
*/
class TLSystemFinishedEvent : public Gravity::Event<TLSystemFinishedEvent>
{ };

class TLSystemFailedEvent : public Gravity::Event<TLSystemFailedEvent>
{ };
//


#endif // TLC_TEST_EVENTS_SYSTEM_EVENT_H

6 changes: 3 additions & 3 deletions main/Fuzzer/CFuzzer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,10 @@ CFuzzer::CFuzzer(tl_agent::CAgent *cAgent) noexcept {

//
Gravity::RegisterListener(
Gravity::MakeListener<TLSystemFinishEvent>(
Gravity::StringAppender("tltest.cfuzzer.bwprof.finish", uint64_t(this)).ToString(),
Gravity::MakeListener<TLSystemFinishedEvent>(
Gravity::StringAppender("tltest.cfuzzer.bwprof.finished", uint64_t(this)).ToString(),
0,
[this] (TLSystemFinishEvent& event) -> void {
[this] (TLSystemFinishedEvent& event) -> void {

if (this->mode == TLSequenceMode::BWPROF_STREAM_STRIDE_READ)
{
Expand Down
8 changes: 4 additions & 4 deletions main/TLAgent/CAgent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,10 @@ namespace tl_agent {
);

Gravity::RegisterListener(
Gravity::MakeListener<TLSystemFinishEvent>(
Gravity::StringAppender("tltest.cagent.l2tol1hintprof.finish@", uint64_t(this)).ToString(),
0,
[this] (TLSystemFinishEvent& event) -> void {
Gravity::MakeListener<TLSystemFinishedEvent>(
Gravity::StringAppender("tltest.cagent.l2tol1hintprof.finished@", uint64_t(this)).ToString(),
1,
[this] (TLSystemFinishedEvent& event) -> void {

uint64_t lostOrLateHint = this->lostOrLateL2ToL1Hints;
uint64_t dissociatedHint = this->unconsumedL2ToL1Hints.size();
Expand Down
103 changes: 79 additions & 24 deletions main/V3/v3_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@
#include "../Plugins/PluginManager.hpp"
#include "../System/TLSystem.hpp"
#include "../PortGen/portgen_dynamic.hpp"
#include "../Events/TLSystemEvent.hpp"

#include <verilated_fst_c.h>

#if TLTEST_MEMORY == 1
#include "v3_memaxi.hpp"
#endif


static bool wave_enable = true;
static uint64_t wave_begin = 0;
static uint64_t wave_end = 0;
Expand Down Expand Up @@ -104,24 +104,6 @@ inline static void V3EvalPosedge(uint64_t& time, VTestTop* top)
}


void V3Finalize()
{
if (!initialized)
return;

if (!finalized)
{
TLFinalize(&tltest, &plugins);
finalized = true;
}
}

void V3SignalHandler(int signum)
{
V3Finalize();
}


template<typename, typename = void>
struct has_port_time : std::false_type {};

Expand Down Expand Up @@ -153,7 +135,7 @@ template<ConceptPortL2ToL1Hint T>
struct has_port_l2_to_l1_hint<T, void> : std::true_type {};

template<ConceptPortL2ToL1Hint T>
typename std::enable_if<has_port_l2_to_l1_hint<T>::value>::type V3PullL2ToL1Hint(
typename std::enable_if<has_port_l2_to_l1_hint<T>::value>::type V3PushL2ToL1Hint(
T* top,
uint8_t& valid,
uint32_t& sourceId,
Expand All @@ -165,23 +147,70 @@ typename std::enable_if<has_port_l2_to_l1_hint<T>::value>::type V3PullL2ToL1Hint
}

template<typename T>
typename std::enable_if<!has_port_l2_to_l1_hint<T>::value>::type V3PullL2ToL1Hint(
typename std::enable_if<!has_port_l2_to_l1_hint<T>::value>::type V3PushL2ToL1Hint(
T* top,
uint8_t& valid,
uint32_t& sourceId,
uint8_t& isKeyword)
{ }

void V3PullL2ToL1Hint(VTestTop* verilated, TLSequencer* tltest)
void V3PushL2ToL1Hint(VTestTop* verilated, TLSequencer* tltest)
{
auto& io = tltest->L2ToL1Hint(0);

V3PullL2ToL1Hint<VTestTop>(verilated,
V3PushL2ToL1Hint<VTestTop>(verilated,
io.valid,
io.sourceId,
io.isKeyword);
}

template<typename T>
concept ConceptPortLogPerf = requires {
{ std::declval<T>().log_dump } -> std::convertible_to<uint8_t>;
{ std::declval<T>().log_clean } -> std::convertible_to<uint8_t>;
};

template<typename, typename = void>
struct has_port_log_perf : std::false_type {};

template<ConceptPortLogPerf T>
struct has_port_log_perf<T, void> : std::true_type {};

template<ConceptPortLogPerf T>
typename std::enable_if<has_port_log_perf<T>::value>::type V3PullLogPerf(
T* top,
uint8_t dump,
uint8_t clean)
{
top->log_dump = dump;
top->log_clean = clean;
}

template<typename T>
typename std::enable_if<!has_port_log_perf<T>::value>::type V3PullLogPerf(
T* top,
uint8_t dump,
uint8_t clean)
{ }


void V3Finalize()
{
if (!initialized)
return;

if (!finalized)
{
TLFinalize(&tltest, &plugins);
finalized = true;
}
}

void V3SignalHandler(int signum)
{
V3Finalize();
}


int main(int argc, char **argv)
{
Expand Down Expand Up @@ -210,13 +239,30 @@ int main(int argc, char **argv)
else
std::cout << "[V3Main] \033[31mNot accepting L2ToL1Hint from TestTop\033[0m." << std::endl;

if constexpr (has_port_log_perf<VTestTop>::value)
std::cout << "[V3Main] \033[1;32mControlling Performance Logging of TestTop\033[0m." << std::endl;
else
std::cout << "[V3Main] \033[31mNot controlling Performance Logging of TestTop\033[0m." << std::endl;

//
Verilated::commandArgs(argc, argv);

// initialize TL-Test subsystem
TLInitialize(&tltest, &plugins, [](TLLocalConfig&) -> void {});
initialized = true;

Gravity::RegisterListener(
Gravity::MakeListener<TLSystemFinishEvent>(
Gravity::StringAppender("v3main.finish").ToString(),
-1,
[&time] (TLSystemFinishEvent& event) -> void {

std::ios_base::sync_with_stdio(true);
V3PullLogPerf(top, 1, 0);
}
)
);

// load PortGen component
# ifdef TLTEST_PORTGEN_DYNAMIC
V3::PortGen::LoadDynamic(
Expand Down Expand Up @@ -267,6 +313,8 @@ int main(int argc, char **argv)
fst->open(GetFstFileName().c_str());
}

V3PullLogPerf(top, 0, 0);

V3Reset(time, top, 10);
V3PushTime(top, time);

Expand All @@ -280,7 +328,7 @@ int main(int argc, char **argv)
V3::PortGen::PushChannelB(top, tltest);
V3::PortGen::PushChannelD(top, tltest);

V3PullL2ToL1Hint(top, tltest);
V3PushL2ToL1Hint(top, tltest);

#if TLTEST_MEMORY == 1
V3::Memory::PushChannelAW(top, tltest);
Expand Down Expand Up @@ -337,15 +385,22 @@ int main(int argc, char **argv)
//
int error = 0;

std::cerr << std::flush;
std::cout << std::flush;

//
if (tltest->IsFinished())
{
TLSystemFinishedEvent().Fire();

LogInfo("test_top",
Append("TL-Test TileLink subsystem FINISHED.")
.EndLine());
}
else if (tltest->IsFailed())
{
TLSystemFailedEvent().Fire();

LogInfo("test_top",
Append("TL-Test TileLink subsystem FAILED.")
.EndLine());
Expand Down