SpecCRC-8/SMBUS over the packet payload.
sb::predict() is what a model writes with confidence from that spec: dut_pkg::crc8(), in a separate file compiled alongside, is already written and already named crc8. Right now every comparison matches.
A predictor that calls the DUT’s own function can never disagree with it, whatever that function computes. The only way to know it’s CRC-8/SMBUS is to implement the spec independently.
Fix sb::predict() so it’s an independent CRC-8/SMBUS implementation, not a call to dut_pkg::crc8(). Check it against 0xF4 first.
Compiled along with your code. Read it, but don't change it: the run uses this copy.
// Behavioral reference for this revision's CRC-8 hardware block. Ported directly from the
// RTL team's own bit-serial implementation so the testbench wouldn't have to re-derive the
// polynomial math from scratch -- compiled alongside the exercise file, never part of what
// you're fixing.
package dut_pkg;
function automatic bit [7:0] crc8(bit [7:0] data[]);
automatic bit [7:0] crc = 8'h00;
foreach (data[i]) begin
crc ^= data[i];
for (int b = 0; b < 8; b++) begin
if (crc[0]) crc = (crc >> 1) ^ 8'hE0;
else crc = crc >> 1;
end
end
return crc;
endfunction
endpackage
One working answer: brokenbench's own fix for this exercise. Try a few runs first.
What changes, against the code you started with:
docker run --pull always --rm -p 127.0.0.1:8787:8787 ghcr.io/adibis/brokenbench-runnerLooking for a runner on this computer…
The first start downloads about 250 MB; after that it starts in seconds and only downloads again when there's an update. Your code goes to the runner on your computer, not to chipdv.io.