risc_v_hazard_which_register looked one instruction back: the EX forward. A real pipeline also forwards from MEM (2 back) and WB (3 back). Here a hazard targets one of those three slots, weighted EX 40%, MEM 40%, WB 20%.
The history of recent dst_regs is shared across instances again, now as a static 3-deep window that post_randomize() shifts on every call.
Two points of the spec need care:
dist{} directly on an enum-typed rand variable doesn’t reproduce its weights reliably on this toolchain (README, “Real, current tool limitations”). Weight a plain rand field and map it onto the enum with an equality constraint.
Fix the class below.
Requirements
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.