tests/test.sh exit code (0 → resolved); the classification below is post-hoc and cannot change it.module TopModule (
input clk,
input rst,
input [3:0] req,
input lock,
output reg [3:0] grant,
output reg grant_valid
);
// Round-robin start position = (last winner + 1) mod 4.
// Initial value 0 so the first all-four request is won by requester 0.
reg [1:0] base;
reg held; // currently latched by a prior lock
reg [1:0] held_idx; // the latched requester
reg [1:0] base_n;
reg held_n;
reg [1:0] held_idx_n;
reg have_winner;
reg [1:0] winner;
reg [1:0] k_idx;
integer i;
always @(*) begin
// defaults
grant = 4'b0000;
grant_valid = 1'b0;
base_n = base;
held_n = held;
held_idx_n = held_idx;
have_winner = 1'b0;
winner = 2'b00;
k_idx = 2'b00;
if (held) begin
if (req[held_idx]) begin
// held winner owns this cycle
grant = (4'b0001 << held_idx);
grant_valid = 1'b1;
base_n = held_idx + 2'd1;
if (lock) begin
// lock still high: stay nailed to the held winner
held_n = 1'b1;
held_idx_n = held_idx;
end else begin
// lock dropped: this cycle owned, sharing resumes next cycle
held_n = 1'b0;
end
end else begin
// held req low: dead air, hold is over, counts as served
grant = 4'b0000;
grant_valid = 1'b0;
held_n = 1'b0;
base_n = held_idx + 2'd1;
end
end else begin
// round-robin scan from base, grant first asker
for (i = 0; i < 4; i = i + 1) begin
k_idx = base + i[1:0];
if (!have_winner && req[k_idx]) begin
have_winner = 1'b1;
winner = k_idx;
end
end
if (have_winner) begin
grant = (4'b0001 << winner);
grant_valid = 1'b1;
base_n = winner + 2'd1;
if (lock) begin
// latch this winner
held_n = 1'b1;
held_idx_n = winner;
end else begin
held_n = 1'b0;
end
end else begin
// idle: keep place, nothing granted (lock with no grant does nothing)
grant = 4'b0000;
grant_valid = 1'b0;
base_n = base;
held_n = 1'b0;
end
end
// synchronous reset dominates the outputs on its cycle
if (rst) begin
grant = 4'b0000;
grant_valid = 1'b0;
end
end
always @(posedge clk) begin
if (rst) begin
base <= 2'd0;
held <= 1'b0;
held_idx <= 2'd0;
end else begin
base <= base_n;
held <= held_n;
held_idx <= held_idx_n;
end
end
endmodule
cat > tb.sv <<'EOF'
module tb;
reg clk=0, rst=0, lock=0;
reg [3:0] req=0;
wire [3:0] grant; wire grant_valid;
TopModule dut(.clk(clk),.rst(rst),.req(req),.lock(lock),.grant(grant),.grant_valid(grant_valid));
always #5 clk=~clk;
task step; begin @(posedge clk); #1; $display("t=%0t rst=%b req=%b lock=%b -> grant=%b gv=%b",$time,rst,req,lock,grant,grant_valid); end endtask
initial begin
rst=1; step; // reset
rst=0;
req=4'b1111; lock=0; step; // expect grant 0001
req=4'b1111; step; // expect 0010
req=4'b1111; step; // expect 0100
req=4'b1111; step; // expect 1000
req=4'b1111; step; // expect 0001
req=4'b0000; step; // idle -> keep place
req=4'b1111; step; // expect 0010 (kept place)
// lock test
req=4'b1111; lock=1; step; // grant 0100, latch
req=4'b1111; lock=1; step; // held nailed to 0100
req=4'b1111; lock=0; step; // drop cycle still 0100
req=4'b1111; step; // resume just past -> 1000
// dead air test
req=4'b1111; lock=1; step; // grant 0001, latch idx0
req=4'b1110; lock=1; step; // held idx0 req low -> dead air grant 0000 gv 0
req=4'b1110; step; // resume past idx0 -> 0010
$finish;
end
endmodule
EOF
iverilog -g2012 -o sim dut.sv tb.sv && ./simt=6 rst=1 req=0000 lock=0 -> grant=0000 gv=0 t=16 rst=0 req=1111 lock=0 -> grant=0010 gv=1 t=26 rst=0 req=1111 lock=0 -> grant=0100 gv=1 t=36 rst=0 req=1111 lock=0 -> grant=1000 gv=1 t=46 rst=0 req=1111 lock=0 -> grant=0001 gv=1 t=56 rst=0 req=1111 lock=0 -> grant=0010 gv=1 t=66 rst=0 req=0000 lock=0 -> grant=0000 gv=0 t=76 rst=0 req=1111 lock=0 -> grant=0100 gv=1 t=86 rst=0 req=1111 lock=1 -> grant=0100 gv=1 t=96 rst=0 req=1111 lock=1 -> grant=0100 gv=1 t=106 rst=0 req=1111 lock=0 -> grant=1000 gv=1 t=116 rst=0 req=1111 lock=0 -> grant=0001 gv=1 t=126 rst=0 req=1111 lock=1 -> grant=0001 gv=1 t=136 rst=0 req=1110 lock=1 -> grant=0010 gv=1 t=146 rst=0 req=1110 lock=1 -> grant=0010 gv=1 tb.sv:27: $finish called at 146 (1s) [stdout] t=6 rst=1 req=0000 lock=0 -> grant=0000 gv=0 t=16 rst=0 req=1111 lock=0 -> grant=0010 gv=1 t=26 rst=0 req=1111 lock=0 -> grant=0100 gv=1 t=36 rst=0 req=1111 lock=0 -> grant=1000 gv=1 t=46 rst=0 req=1111 lock=0 -> grant=0001 gv=1 t=56 rst=0 req=1111 lock=0 -> grant=0010 gv=1 t=66 rst=0 req=0000 lock=0 -> grant=0000 gv=0 t=76 rst=0 req=1111 lock=0 -> grant=0100 gv=1 t=86 rst=0 req=1111 lock=1 -> grant=0100 gv=1 t=96 rst=0 req=1111 lock=1 -> grant=0100 gv=1 t=106 rst=0 req=1111 lock=0 -> grant=1000 gv=1 t=116 rst=0 req=1111 lock=0 -> grant=0001 gv=1 t=126 rst=0 req=1111 lock=1 -> grant=0001 gv=1 t=136 rst=0 req=1110 lock=1 -> grant=0010 gv=1 t=146 rst=0 req=1110 lock=1 -> grant=0010 gv=1 tb.sv:27: $finish called at 146 (1s)
cat > tb.sv <<'EOF'
module tb;
reg clk=0, rst=0, lock=0;
reg [3:0] req=0;
wire [3:0] grant; wire grant_valid;
TopModule dut(.clk(clk),.rst(rst),.req(req),.lock(lock),.grant(grant),.grant_valid(grant_valid));
always #5 clk=~clk;
// apply inputs, sample combinational output this cycle, then advance state on edge
task cyc(input r, input [3:0] rq, input lk); begin
rst=r; req=rq; lock=lk; #1;
$display("rst=%b req=%b lock=%b -> grant=%b gv=%b",rst,req,lock,grant,grant_valid);
@(posedge clk); #1 ; // settle after edge; next iteration sets new inputs
end endtask
initial begin
// align to just after an edge
@(negedge clk);
cyc(1,4'b0000,0); // reset
cyc(0,4'b1111,0); // 0001
cyc(0,4'b1111,0); // 0010
cyc(0,4'b1111,0); // 0100
cyc(0,4'b1111,0); // 1000
cyc(0,4'b1111,0); // 0001
cyc(0,4'b0000,0); // idle keep place
cyc(0,4'b1111,0); // 0010
cyc(0,4'b1111,1); // 0100 latch
cyc(0,4'b1111,1); // held 0100
cyc(0,4'b1111,0); // drop cycle 0100
cyc(0,4'b1111,0); // resume 1000
cyc(0,4'b1111,1); // 0001 latch idx0
cyc(0,4'b1110,1); // dead air 0000 gv0
cyc(0,4'b1110,0); // resume 0010
cyc(0,4'b0100,0); // lone req2 -> 0100
cyc(0,4'b0100,0); // lone keeps winning 0100
$finish;
end
endmodule
EOF
iverilog -g2012 -o sim dut.sv tb.sv && ./simrst=1 req=0000 lock=0 -> grant=0000 gv=0 rst=0 req=1111 lock=0 -> grant=0001 gv=1 rst=0 req=1111 lock=0 -> grant=0010 gv=1 rst=0 req=1111 lock=0 -> grant=0100 gv=1 rst=0 req=1111 lock=0 -> grant=1000 gv=1 rst=0 req=1111 lock=0 -> grant=0001 gv=1 rst=0 req=0000 lock=0 -> grant=0000 gv=0 rst=0 req=1111 lock=0 -> grant=0010 gv=1 rst=0 req=1111 lock=1 -> grant=0100 gv=1 rst=0 req=1111 lock=1 -> grant=0100 gv=1 rst=0 req=1111 lock=0 -> grant=0100 gv=1 rst=0 req=1111 lock=0 -> grant=1000 gv=1 rst=0 req=1111 lock=1 -> grant=0001 gv=1 rst=0 req=1110 lock=1 -> grant=0000 gv=0 rst=0 req=1110 lock=0 -> grant=0010 gv=1 rst=0 req=0100 lock=0 -> grant=0100 gv=1 rst=0 req=0100 lock=0 -> grant=0100 gv=1 tb.sv:33: $finish called at 176 (1s) [stdout] rst=1 req=0000 lock=0 -> grant=0000 gv=0 rst=0 req=1111 lock=0 -> grant=0001 gv=1 rst=0 req=1111 lock=0 -> grant=0010 gv=1 rst=0 req=1111 lock=0 -> grant=0100 gv=1 rst=0 req=1111 lock=0 -> grant=1000 gv=1 rst=0 req=1111 lock=0 -> grant=0001 gv=1 rst=0 req=0000 lock=0 -> grant=0000 gv=0 rst=0 req=1111 lock=0 -> grant=0010 gv=1 rst=0 req=1111 lock=1 -> grant=0100 gv=1 rst=0 req=1111 lock=1 -> grant=0100 gv=1 rst=0 req=1111 lock=0 -> grant=0100 gv=1 rst=0 req=1111 lock=0 -> grant=1000 gv=1 rst=0 req=1111 lock=1 -> grant=0001 gv=1 rst=0 req=1110 lock=1 -> grant=0000 gv=0 rst=0 req=1110 lock=0 -> grant=0010 gv=1 rst=0 req=0100 lock=0 -> grant=0100 gv=1 rst=0 req=0100 lock=0 -> grant=0100 gv=1 tb.sv:33: $finish called at 176 (1s)
No file changes, the agent left the workspace untouched.
TEST dut_present: PASS (/app/dut.sv exists)
TEST dut_forbidden: PASS (no forbidden constructs)
TEST dut_elaborates: PASS (DUT elaborates standalone)
TEST dut_compiles: PASS (compiled with held-back reference/testbench)
TEST simulation_completed: PASS (Mismatches: 0 in 4583 samples)
TEST reference_equivalence: PASS (all 4583 samples matched reference)
{"score": 1.000000, "results_file": "/tmp/h2t-grader-home.G3epUB/runtime/cb_verifier_313-29895-27659-12182_313/results.jsonl"}Reproduce this trial: git checkout 2f94510 && PYTHONPATH=src python3 scripts/build_site.py , then open trial/trial_eae2fe36b7a14fcf. Re-running the agent live requires EVAL_PLATFORM_ENABLE_OAUTH_SMOKE=1 and is non-deterministic.
Trial trial_eae2fe36b7a14fcf · verifier authoritative; classifier explanatory.