fixes ordered_semaphore test

This commit is contained in:
2022-10-02 19:18:57 +02:00
parent 34d4102422
commit b9f2344981
3 changed files with 10 additions and 9 deletions

View File

@ -160,6 +160,9 @@ TEST_CASE("pin level narrow burst", "[AXI][pin-level]") {
run_scenario(state);
REQUIRE(sc_report_handler::get_count(SC_ERROR) == 0);
REQUIRE(sc_report_handler::get_count(SC_WARNING) == 0);
REQUIRE(state.resp_cnt==4*state.NumberOfIterations);
for(auto& e: state.write_tx) {
auto const& send_tx = e.second.first;

View File

@ -7,8 +7,9 @@
using namespace sc_core;
class top: public sc_core::sc_module {
public:
struct top: public sc_core::sc_module {
top():top("top"){}
top(sc_module_name const& nm):sc_core::sc_module(nm) {}
scc::ordered_semaphore sem{"sem", 2};
scc::ordered_semaphore_t<2> sem_t{"sem_t"};
};
@ -22,11 +23,13 @@ TEST_CASE("simple ordered_semaphore test", "[SCC][ordered_semaphore]") {
dut.sem.wait();
dut.sem_t.wait();
dut.sem.set_capacity(4);
dut.sem_t.set_capacity(4);
dut.sem_t.set_capacity(4); // should fail
dut.sem_t.post();
dut.sem.post();
});
sc_start(1_ns);
REQUIRE(run1.terminated());
REQUIRE(sc_report_handler::get_count(SC_ERROR) == 0);
REQUIRE(sc_report_handler::get_count(SC_WARNING) == 1);
}