I want to extend the Endian Swapper example of Cocotb, so that, it also checks the contents of the packages outputted by the device under test (DUT). In the provided example code, the model
function which generates the expected output appends the unmodified input transaction to the list of expected outputs. This list is given as a parameter to the scoreboard.
To understand how the scoreboarding works and why the model
function did not append the byte-swapped transactions, I introduced a design error in the DUT. Within the following code block of endian_swapper.vhdl
if (byteswapping = '0') then
stream_out_data <= stream_in_data;
else
stream_out_data <= byteswap(stream_in_data);
end if;
I just inverted the if
condition in the first line to: (byteswapping /= '0')
.
After re-running the testbench, I would have expected that the test fails, but it still passes:
# 62345.03ns INFO cocotb.regression regression.py:209 in handle_result Test Passed: wavedrom_test
# 62345.03ns INFO cocotb.regression regression.py:170 in tear_down Passed 33 tests (0 skipped)
# 62345.03ns INFO cocotb.regression regression.py:176 in tear_down Shutting down...
It seems, that the compare function is missing in the creation of the scoreboard:
self.scoreboard = Scoreboard(dut)
self.scoreboard.add_interface(self.stream_out, self.expected_output)
It should have a third parameter in the call of add_interface
, but this parameter is undocumented.
So, how do I specify this compare function, so that, also the package content is checked?
I am using QuestaSim for simulation and executed the testbench with make SIM=questa
. I also clean-upped the build directory between the runs.