extends CXS packet to work with varying credit settings
All checks were successful
SCC Test/pipeline/head This commit looks good

This commit is contained in:
2025-09-30 07:20:03 +02:00
parent 73e4d5d644
commit d7e691337d
5 changed files with 33 additions and 20 deletions

1
.launch/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
/cxs_tlm single-packet.launch

View File

@@ -30,7 +30,7 @@
</listAttribute> </listAttribute>
<mapAttribute key="org.eclipse.debug.core.environmentVariables"> <mapAttribute key="org.eclipse.debug.core.environmentVariables">
<mapEntry key="SCC_TEST_TRACE" value="1"/> <mapEntry key="SCC_TEST_TRACE" value="1"/>
<mapEntry key="SCC_TEST_VERBOSE_" value="1"/> <mapEntry key="SCC_TEST_VERBOSE" value="0"/>
</mapAttribute> </mapAttribute>
<stringAttribute key="org.eclipse.dsf.launch.MEMORY_BLOCKS" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&lt;memoryBlockExpressionList context=&quot;reserved-for-future-use&quot;/&gt;"/> <stringAttribute key="org.eclipse.dsf.launch.MEMORY_BLOCKS" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&lt;memoryBlockExpressionList context=&quot;reserved-for-future-use&quot;/&gt;"/>
<stringAttribute key="process_factory_id" value="org.eclipse.cdt.dsf.gdb.GdbProcessFactory"/> <stringAttribute key="process_factory_id" value="org.eclipse.cdt.dsf.gdb.GdbProcessFactory"/>

2
scc

Submodule scc updated: 4429911c18...3b715da553

View File

@@ -12,11 +12,10 @@ factory::add<testbench<256>> tb8;
factory::add<testbench<512>> tb9; factory::add<testbench<512>> tb9;
factory::add<testbench<1024>> tb10; factory::add<testbench<1024>> tb10;
template <unsigned WIDTH, typename STATE> unsigned run_scenario(STATE& state, unsigned burst_factor = 0) { template <unsigned WIDTH, typename STATE> unsigned run_scenario(STATE& state) {
auto& dut = factory::get<testbench<WIDTH>>(); auto& dut = factory::get<testbench<WIDTH>>();
if(burst_factor) dut.tx.burst_len.set_value(state.burst_factor);
dut.tx.burst_len.set_value(burst_factor); dut.rx.max_credit.set_value(state.credits);
dut.rx.max_credit.set_value(5);
dut.rst.write(true); dut.rst.write(true);
sc_start(state.reset_cycles * dut.clk.period()); sc_start(state.reset_cycles * dut.clk.period());
dut.rst.write(false); dut.rst.write(false);
@@ -67,7 +66,7 @@ template <unsigned WIDTH, typename STATE> unsigned run_scenario(STATE& state, un
return cycles; return cycles;
} }
template <typename STATE> unsigned run_scenario(int width, STATE& state, unsigned burst_factor = 0) { template <typename STATE> unsigned run_scenario(int width, STATE& state) {
switch(width) { switch(width) {
case 8: case 8:
case 256: case 256:
@@ -85,32 +84,40 @@ template <typename STATE> unsigned run_scenario(int width, STATE& state, unsigne
TEST_CASE("single-packet", "[CXS][tlm-level]") { TEST_CASE("single-packet", "[CXS][tlm-level]") {
struct { struct {
unsigned int reset_cycles{4}; unsigned int reset_cycles{4};
unsigned int max_cycles = 5000; unsigned int max_cycles = 20000;
std::vector<unsigned int> packet_sizes; std::vector<unsigned int> packet_sizes;
unsigned granularity{1}; unsigned granularity{1};
unsigned resp_cnt{0}; unsigned resp_cnt{0};
unsigned burst_factor{1};
unsigned credits{1};
} state; } state;
state.packet_sizes.assign({4, 8, 16, 32, 64, 128, 256, 1024}); state.packet_sizes.assign({4, 8, 16, 32, 64, 128, 256, 1024});
std::array<unsigned, 3> credits{1, 4, 15};
for(auto width = 8; width < 11; ++width) { for(auto width = 8; width < 11; ++width) {
state.resp_cnt = 0; for(auto credit : credits) {
auto cycles = run_scenario(width, state); state.resp_cnt = 0;
state.credits = credit;
auto cycles = run_scenario(width, state);
REQUIRE(cycles < state.max_cycles); REQUIRE(cycles < state.max_cycles);
REQUIRE(sc_report_handler::get_count(SC_ERROR) == 0); REQUIRE(sc_report_handler::get_count(SC_ERROR) == 0);
REQUIRE(sc_report_handler::get_count(SC_WARNING) == 0); REQUIRE(sc_report_handler::get_count(SC_WARNING) == 0);
REQUIRE(state.resp_cnt == state.packet_sizes.size()); REQUIRE(state.resp_cnt == state.packet_sizes.size());
}
} }
} }
TEST_CASE("multi-packet", "[CXS][tlm-level]") { TEST_CASE("multi-packet", "[CXS][tlm-level]") {
struct { struct {
unsigned int reset_cycles{4}; unsigned int reset_cycles{4};
unsigned int max_cycles = 5000; unsigned int max_cycles = 20000;
std::vector<unsigned int> packet_sizes; std::vector<unsigned int> packet_sizes;
unsigned granularity{2}; unsigned granularity{2};
unsigned resp_cnt{0}; unsigned resp_cnt{0};
unsigned burst_factor{1};
unsigned credits{15};
} state; } state;
state.packet_sizes.assign({4, 8, 16, 32, 16, 64, 16, 128, 16, 256, 16, 1024}); state.packet_sizes.assign({4, 8, 16, 32, 16, 64, 16, 128, 16, 256, 16, 1024});
@@ -128,16 +135,18 @@ TEST_CASE("multi-packet", "[CXS][tlm-level]") {
TEST_CASE("single-packet-burst2", "[CXS][tlm-level]") { TEST_CASE("single-packet-burst2", "[CXS][tlm-level]") {
struct { struct {
unsigned int reset_cycles{4}; unsigned int reset_cycles{4};
unsigned int max_cycles = 5000; unsigned int max_cycles = 20000;
std::vector<unsigned int> packet_sizes; std::vector<unsigned int> packet_sizes;
unsigned granularity{1}; unsigned granularity{1};
unsigned resp_cnt{0}; unsigned resp_cnt{0};
unsigned burst_factor{2};
unsigned credits{2};
} state; } state;
state.packet_sizes.assign({4, 8, 16, 32, 64, 128, 256, 1024}); state.packet_sizes.assign({4, 8, 16, 32, 64, 128, 256, 1024});
for(auto width = 8; width < 11; ++width) { for(auto width = 8; width < 11; ++width) {
state.resp_cnt = 0; state.resp_cnt = 0;
auto cycles = run_scenario(width, state, 2); auto cycles = run_scenario(width, state);
REQUIRE(cycles < state.max_cycles); REQUIRE(cycles < state.max_cycles);
REQUIRE(sc_report_handler::get_count(SC_ERROR) == 0); REQUIRE(sc_report_handler::get_count(SC_ERROR) == 0);
@@ -150,16 +159,18 @@ TEST_CASE("single-packet-burst2", "[CXS][tlm-level]") {
TEST_CASE("multi-packet-burst2", "[CXS][tlm-level]") { TEST_CASE("multi-packet-burst2", "[CXS][tlm-level]") {
struct { struct {
unsigned int reset_cycles{4}; unsigned int reset_cycles{4};
unsigned int max_cycles = 5000; unsigned int max_cycles = 20000;
std::vector<unsigned int> packet_sizes; std::vector<unsigned int> packet_sizes;
unsigned granularity{2}; unsigned granularity{2};
unsigned resp_cnt{0}; unsigned resp_cnt{0};
unsigned burst_factor{2};
unsigned credits{2};
} state; } state;
state.packet_sizes.assign({4, 8, 16, 32, 16, 64, 16, 128, 16, 256, 16, 1024}); state.packet_sizes.assign({4, 8, 16, 32, 16, 64, 16, 128, 16, 256, 16, 1024});
for(auto width = 8; width < 11; ++width) { for(auto width = 8; width < 11; ++width) {
state.resp_cnt = 0; state.resp_cnt = 0;
auto cycles = run_scenario(width, state, 2); auto cycles = run_scenario(width, state);
REQUIRE(cycles < state.max_cycles); REQUIRE(cycles < state.max_cycles);
REQUIRE(sc_report_handler::get_count(SC_ERROR) == 0); REQUIRE(sc_report_handler::get_count(SC_ERROR) == 0);

View File

@@ -5,6 +5,7 @@
#include <cxs/scv/tlm_recording.h> #include <cxs/scv/tlm_recording.h>
#include <scc/cci_util.h> #include <scc/cci_util.h>
#include <scc/configurer.h> #include <scc/configurer.h>
#include <scc/fifo_w_cb.h>
#include <scc/observer.h> #include <scc/observer.h>
#include <scc/sc_variable.h> #include <scc/sc_variable.h>
#include <scc/tracer.h> #include <scc/tracer.h>
@@ -69,7 +70,7 @@ template <unsigned PHIT_WIDTH> struct testbench : public sc_core::sc_module {
tlm::tlm_sync_enum nb_transport_fw(transaction_type& trans, phase_type& phase, sc_core::sc_time& t) { tlm::tlm_sync_enum nb_transport_fw(transaction_type& trans, phase_type& phase, sc_core::sc_time& t) {
if(phase == tlm::nw::REQUEST) { if(phase == tlm::nw::REQUEST) {
SCCINFO(SCMOD) << "Received non-blocking transaction with phase " << phase.get_name(); SCCDEBUG(SCMOD) << "Received non-blocking transaction with phase " << phase.get_name();
recv.push_back(&trans); recv.push_back(&trans);
phase = tlm::nw::CONFIRM; phase = tlm::nw::CONFIRM;
return tlm::TLM_UPDATED; return tlm::TLM_UPDATED;