updates scc and adds burst packet handling
This commit is contained in:
		
							
								
								
									
										2
									
								
								scc
									
									
									
									
									
								
							
							
								
								
								
								
								
							
						
						
									
										2
									
								
								scc
									
									
									
									
									
								
							 Submodule scc updated: 331b6d77ea...d6f2a80b1b
									
								
							@@ -13,9 +13,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) {
 | 
					template <unsigned WIDTH, typename STATE> unsigned run_scenario(STATE& state, unsigned burst_factor = 0) {
 | 
				
			||||||
    auto& dut = factory::get<testbench<WIDTH>>();
 | 
					    auto& dut = factory::get<testbench<WIDTH>>();
 | 
				
			||||||
 | 
					    if(burst_factor)
 | 
				
			||||||
 | 
					        dut.tx.burst_len.set_value(burst_factor);
 | 
				
			||||||
    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);
 | 
				
			||||||
@@ -66,7 +67,7 @@ template <unsigned WIDTH, typename STATE> unsigned run_scenario(STATE& state) {
 | 
				
			|||||||
    return cycles;
 | 
					    return cycles;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
template <typename STATE> unsigned run_scenario(int width, STATE& state) {
 | 
					template <typename STATE> unsigned run_scenario(int width, STATE& state, unsigned burst_factor = 0) {
 | 
				
			||||||
    switch(width) {
 | 
					    switch(width) {
 | 
				
			||||||
    case 8:
 | 
					    case 8:
 | 
				
			||||||
    case 256:
 | 
					    case 256:
 | 
				
			||||||
@@ -124,4 +125,47 @@ TEST_CASE("multi-packet", "[CXS][tlm-level]") {
 | 
				
			|||||||
        REQUIRE(state.resp_cnt == state.packet_sizes.size());
 | 
					        REQUIRE(state.resp_cnt == state.packet_sizes.size());
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					TEST_CASE("single-packet-burst2", "[CXS][tlm-level]") {
 | 
				
			||||||
 | 
					    struct {
 | 
				
			||||||
 | 
					        unsigned int reset_cycles{4};
 | 
				
			||||||
 | 
					        unsigned int max_cycles = 5000;
 | 
				
			||||||
 | 
					        std::vector<unsigned int> packet_sizes;
 | 
				
			||||||
 | 
					        unsigned granularity{1};
 | 
				
			||||||
 | 
					        unsigned resp_cnt{0};
 | 
				
			||||||
 | 
					    } state;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    state.packet_sizes.assign({4, 8, 16, 32, 64, 128, 256, 1024});
 | 
				
			||||||
 | 
					    for(auto width = 8; width < 11; ++width) {
 | 
				
			||||||
 | 
					        state.resp_cnt = 0;
 | 
				
			||||||
 | 
					        auto cycles = run_scenario(width, state, 2);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        REQUIRE(cycles < state.max_cycles);
 | 
				
			||||||
 | 
					        REQUIRE(sc_report_handler::get_count(SC_ERROR) == 0);
 | 
				
			||||||
 | 
					        REQUIRE(sc_report_handler::get_count(SC_WARNING) == 0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        REQUIRE(state.resp_cnt == state.packet_sizes.size());
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					TEST_CASE("multi-packet-burst2", "[CXS][tlm-level]") {
 | 
				
			||||||
 | 
					    struct {
 | 
				
			||||||
 | 
					        unsigned int reset_cycles{4};
 | 
				
			||||||
 | 
					        unsigned int max_cycles = 5000;
 | 
				
			||||||
 | 
					        std::vector<unsigned int> packet_sizes;
 | 
				
			||||||
 | 
					        unsigned granularity{2};
 | 
				
			||||||
 | 
					        unsigned resp_cnt{0};
 | 
				
			||||||
 | 
					    } state;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    state.packet_sizes.assign({4, 8, 16, 32, 16, 64, 16, 128, 16, 256, 16, 1024});
 | 
				
			||||||
 | 
					    for(auto width = 8; width < 11; ++width) {
 | 
				
			||||||
 | 
					        state.resp_cnt = 0;
 | 
				
			||||||
 | 
					        auto cycles = run_scenario(width, state, 2);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        REQUIRE(cycles < state.max_cycles);
 | 
				
			||||||
 | 
					        REQUIRE(sc_report_handler::get_count(SC_ERROR) == 0);
 | 
				
			||||||
 | 
					        REQUIRE(sc_report_handler::get_count(SC_WARNING) == 0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        REQUIRE(state.resp_cnt == state.packet_sizes.size());
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
} // namespace cxs
 | 
					} // namespace cxs
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -42,6 +42,7 @@ template <unsigned PHIT_WIDTH> struct testbench : public sc_core::sc_module {
 | 
				
			|||||||
            [this](transaction_type& trans, phase_type& phase, sc_core::sc_time& t) { return this->nb_transport_fw(trans, phase, t); });
 | 
					            [this](transaction_type& trans, phase_type& phase, sc_core::sc_time& t) { return this->nb_transport_fw(trans, phase, t); });
 | 
				
			||||||
        isck(tx.tsck);
 | 
					        isck(tx.tsck);
 | 
				
			||||||
        tx.clk_i(clk);
 | 
					        tx.clk_i(clk);
 | 
				
			||||||
 | 
					        tx.rst_i(rst);
 | 
				
			||||||
        tx.isck(cxs_chan.tsck);
 | 
					        tx.isck(cxs_chan.tsck);
 | 
				
			||||||
        cxs_chan.isck(rx.tsck);
 | 
					        cxs_chan.isck(rx.tsck);
 | 
				
			||||||
        rx.clk_i(clk);
 | 
					        rx.clk_i(clk);
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user