tests/test.sh exit code (0 → resolved); the classification below is post-hoc and cannot change it.module TopModule(
input clk,
input rst,
input cyc_i,
input stb_i,
input we_i,
input [1:0] adr_i,
input [15:0] dat_i,
output reg stall_o,
output reg ack_o,
output reg [15:0] dat_o
);
// mix(a,x): into lane k pack the bit-reversed source lane (k+a) mod 4.
// Lane k of a word is bits k, k+4, k+8, k+12 in increasing bit order.
function automatic [15:0] mix;
input [1:0] a;
input [15:0] x;
integer k, i, s;
begin
mix = 16'b0;
for (k = 0; k < 4; k = k + 1) begin
s = (k + a) & 2'h3; // source lane index (mod 4)
for (i = 0; i < 4; i = i + 1) begin
// output lane k, bit i <- bit-reversed source lane bit (3-i)
mix[k + 4*i] = x[s + 4*(3-i)];
end
end
end
endfunction
// Four 16-bit slots and their primed bits.
reg [15:0] slots [0:3];
reg [3:0] primed;
// Read response pipeline: accept at E -> response at E+2 (2 stages).
reg rd1_v, rd2_v;
reg [15:0] rd1_d, rd2_d;
// Write commit/response pipeline: accept at E -> commit at E+3 (3 stages).
reg wr1_v, wr2_v, wr3_v;
reg [1:0] wr1_a, wr2_a, wr3_a;
reg [15:0] wr1_d, wr2_d, wr3_d;
// Stall schedule: a write accepted at E raises stall after E+1 and E+2.
// stall_o(after X) = acc_write(X-1) | acc_write(X-2)
reg s1, s2;
// Acceptance uses pre-edge stall_o.
wire accept = cyc_i & stb_i & ~stall_o;
wire acc_read = accept & ~we_i;
wire acc_write = accept & we_i;
// Read data captured at accept edge E.
wire [15:0] rd_data = primed[adr_i] ? mix(adr_i, slots[adr_i]) : 16'b0;
// Committed slot value (old_slot is the pre-edge slot value at commit edge).
wire [15:0] wr_commit = mix(wr3_a, slots[wr3_a]) ^ wr3_d;
integer j;
always @(posedge clk) begin
if (rst) begin
for (j = 0; j < 4; j = j + 1)
slots[j] <= 16'b0;
primed <= 4'b0;
rd1_v <= 1'b0; rd2_v <= 1'b0;
rd1_d <= 16'b0; rd2_d <= 16'b0;
wr1_v <= 1'b0; wr2_v <= 1'b0; wr3_v <= 1'b0;
wr1_a <= 2'b0; wr2_a <= 2'b0; wr3_a <= 2'b0;
wr1_d <= 16'b0; wr2_d <= 16'b0; wr3_d <= 16'b0;
s1 <= 1'b0; s2 <= 1'b0;
stall_o <= 1'b0;
ack_o <= 1'b0;
dat_o <= 16'b0;
end else begin
// Stall scheduling (writes only).
s1 <= acc_write;
s2 <= s1;
stall_o <= s1 | s2;
// Read pipeline.
rd1_v <= acc_read;
rd1_d <= rd_data;
rd2_v <= rd1_v;
rd2_d <= rd1_d;
// Write pipeline.
wr1_v <= acc_write; wr1_a <= adr_i; wr1_d <= dat_i;
wr2_v <= wr1_v; wr2_a <= wr1_a; wr2_d <= wr1_d;
wr3_v <= wr2_v; wr3_a <= wr2_a; wr3_d <= wr2_d;
// Commit (happens even when the response is dropped).
if (wr3_v) begin
slots[wr3_a] <= wr_commit;
primed[wr3_a] <= 1'b1;
end
// Response arbitration: read data wins a shared edge; ack only when cyc_i.
ack_o <= 1'b0;
dat_o <= 16'b0;
if (rd2_v) begin
if (cyc_i) begin
dat_o <= rd2_d;
ack_o <= 1'b1;
end
end else if (wr3_v) begin
if (cyc_i) begin
dat_o <= wr_commit;
ack_o <= 1'b1;
end
end
end
end
endmodule
Compile/lint the Verilog
(iverilog -g2012 -o /tmp/dut.out dut.sv 2>&1 && echo "COMPILE_OK") || (verilator --lint-only -Wall dut.sv 2>&1) || echo "no verilog tool available"
COMPILE_OK [stdout] COMPILE_OK
Run timing sanity testbench
cat > /tmp/tb.v << 'EOF'
module tb;
reg clk=0, rst, cyc_i, stb_i, we_i;
reg [1:0] adr_i; reg [15:0] dat_i;
wire stall_o, ack_o; wire [15:0] dat_o;
integer t;
TopModule d(.clk(clk),.rst(rst),.cyc_i(cyc_i),.stb_i(stb_i),.we_i(we_i),
.adr_i(adr_i),.dat_i(dat_i),.stall_o(stall_o),.ack_o(ack_o),.dat_o(dat_o));
always #5 clk=~clk;
// reference mix
function [15:0] mix; input [1:0] a; input [15:0] x; integer k,i,s; begin
mix=0; for(k=0;k<4;k=k+1) begin s=(k+a)&3; for(i=0;i<4;i=i+1) mix[k+4*i]=x[s+4*(3-i)]; end
end endfunction
task step; begin @(posedge clk); #1; end endtask
initial begin
rst=1; cyc_i=0; stb_i=0; we_i=0; adr_i=0; dat_i=0;
step; // apply reset
rst=0;
// Issue a WRITE to slot 1, data 0xABCD at this edge (E). stall must be low.
if (stall_o!==0) $display("FAIL stall not low pre-write");
cyc_i=1; stb_i=1; we_i=1; adr_i=1; dat_i=16'hABCD;
step; // edge E : accepted
cyc_i=1; stb_i=0; we_i=0; // idle but keep cyc high so responses ack
step; // E+1 : stall should now be high
$display("after E+1 stall=%b (exp 1)", stall_o);
step; // E+2 : stall high
$display("after E+2 stall=%b (exp 1)", stall_o);
step; // E+3 : commit + write response
$display("after E+3 stall=%b (exp 0) ack=%b dat=%h (exp %h)",
stall_o, ack_o, dat_o, mix(1,16'h0)^16'hABCD);
// Now read slot 1
cyc_i=1; stb_i=1; we_i=0; adr_i=1;
step; // Er : read accepted
cyc_i=1; stb_i=0; adr_i=0;
step; // Er+1
$display("read Er+1 ack=%b (exp 0)", ack_o);
step; // Er+2 : read response
$display("read Er+2 ack=%b dat=%h (exp %h)", ack_o, dat_o, mix(1,16'hABCD));
step;
$display("after read+3 ack=%b dat=%h (exp 0 0)", ack_o, dat_o);
$finish;
end
endmodule
EOF
iverilog -g2012 -o /tmp/sim.out /tmp/tb.v /app/dut.sv && vvp /tmp/sim.outafter E+1 stall=1 (exp 1) after E+2 stall=1 (exp 1) after E+3 stall=0 (exp 0) ack=1 dat=abcd (exp abcd) read Er+1 ack=0 (exp 0) read Er+2 ack=1 dat=e6d5 (exp e6d5) after read+3 ack=0 dat=0000 (exp 0 0) /tmp/tb.v:43: $finish called at 86 (1s) [stdout] after E+1 stall=1 (exp 1) after E+2 stall=1 (exp 1) after E+3 stall=0 (exp 0) ack=1 dat=abcd (exp abcd) read Er+1 ack=0 (exp 0) read Er+2 ack=1 dat=e6d5 (exp e6d5) after read+3 ack=0 dat=0000 (exp 0 0) /tmp/tb.v:43: $finish called at 86 (1s)
Test dropped write still commits
cat > /tmp/tb2.v << 'EOF'
module tb;
reg clk=0, rst, cyc_i, stb_i, we_i; reg [1:0] adr_i; reg [15:0] dat_i;
wire stall_o, ack_o; wire [15:0] dat_o;
TopModule d(.clk(clk),.rst(rst),.cyc_i(cyc_i),.stb_i(stb_i),.we_i(we_i),
.adr_i(adr_i),.dat_i(dat_i),.stall_o(stall_o),.ack_o(ack_o),.dat_o(dat_o));
always #5 clk=~clk;
function [15:0] mix; input [1:0] a; input [15:0] x; integer k,i,s; begin
mix=0; for(k=0;k<4;k=k+1) begin s=(k+a)&3; for(i=0;i<4;i=i+1) mix[k+4*i]=x[s+4*(3-i)]; end
end endfunction
task step; begin @(posedge clk); #1; end endtask
initial begin
rst=1; cyc_i=0; stb_i=0; we_i=0; adr_i=0; dat_i=0; step; rst=0;
// WRITE slot2=0x1234, but drop cyc_i at the E+3 response edge
cyc_i=1; stb_i=1; we_i=1; adr_i=2; dat_i=16'h1234; step; // E accept
stb_i=0; we_i=0;
cyc_i=0; step; // E+1
step; // E+2
step; // E+3 commit, cyc low -> dropped response
$display("dropped resp: ack=%b dat=%h (exp 0 0)", ack_o, dat_o);
// read it back to confirm it still committed
cyc_i=1; stb_i=1; we_i=0; adr_i=2; step; stb_i=0; cyc_i=1;
step; step;
$display("readback ack=%b dat=%h (exp1 %h)", ack_o, dat_o, mix(2,16'h1234));
$finish;
end
endmodule
EOF
iverilog -g2012 -o /tmp/sim2.out /tmp/tb2.v /app/dut.sv && vvp /tmp/sim2.outdropped resp: ack=0 dat=0000 (exp 0 0) readback ack=1 dat=1c84 (exp1 1c84) /tmp/tb2.v:24: $finish called at 76 (1s) [stdout] dropped resp: ack=0 dat=0000 (exp 0 0) readback ack=1 dat=1c84 (exp1 1c84) /tmp/tb2.v:24: $finish called at 76 (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_compiles: PASS (compiled with held-back reference/testbench)
TEST simulation_completed: PASS (Mismatches: 0 in 5367 samples)
TEST reference_equivalence: PASS (all 5367 samples matched reference)
{"score": 1.000000, "results_file": "/tmp/h2t-grader-home.28sC0s/runtime/cb_verifier_321-12901-27481-30315_321/results.jsonl"}Reproduce this trial: git checkout 2f94510 && PYTHONPATH=src python3 scripts/build_site.py , then open trial/trial_093c37b954dd4b25. Re-running the agent live requires EVAL_PLATFORM_ENABLE_OAUTH_SMOKE=1 and is non-deterministic.
Trial trial_093c37b954dd4b25 · verifier authoritative; classifier explanatory.