SpecPer the register map doc, status_reg packs one byte into two fields
confirmer::confirm_write() is what a model writes with confidence to prove a write landed. With auto-prediction on, as the env sets it, r.write() sets the mirror from the data you passed, whatever the hardware did, so reading the mirror back always agrees. Right now it reports confirmed_count=3, flagged_count=0, including the writes that set cfg and lock together and left cfg unchanged.
Fix confirm_write() so it compares expected with a frontdoor read, not the mirror.
Compiled along with your code. Read it, but don't change it: the run uses this copy.
// Behavioral reference for this revision's control-register hardware. Compiled alongside the
// exercise file, never part of what you're fixing -- read it if the register-map doc in the
// exercise file doesn't settle what a given write actually does.
import uvm_pkg::*;
class reg_bus_item extends uvm_sequence_item;
`uvm_object_utils(reg_bus_item)
rand bit [31:0] addr;
rand bit [31:0] data;
bit is_read;
function new(string name = "reg_bus_item");
super.new(name);
endfunction
endclass
class reg_bus_driver extends uvm_driver #(reg_bus_item);
`uvm_component_utils(reg_bus_driver)
bit [7:0] storage = 8'h00;
bit locked = 1'b0;
function new(string name, uvm_component parent = null);
super.new(name, parent);
endfunction
virtual task run_phase(uvm_phase phase);
reg_bus_item it;
forever begin
seq_item_port.get_next_item(it);
if (it.is_read) begin
it.data = storage;
end else begin
automatic bit new_lock = it.data[7];
if (!locked && !new_lock) storage[6:0] = it.data[6:0];
storage[7] |= new_lock;
if (new_lock) locked = 1'b1;
end
seq_item_port.item_done();
end
endtask
endclass
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.