diff --git a/Pasted image 20261006154222.png b/Pasted image 20261006154222.png new file mode 100644 index 0000000..80cf2c1 Binary files /dev/null and b/Pasted image 20261006154222.png differ diff --git a/src/verilog/tb/cpu_tb_top.sv b/src/verilog/tb/cpu_tb_top.sv index bf4d248..2fd54f5 100644 --- a/src/verilog/tb/cpu_tb_top.sv +++ b/src/verilog/tb/cpu_tb_top.sv @@ -547,11 +547,36 @@ module cpu_tb_top; }; run_directed("beq_backward_loop", prog); - // 1.33: bulk register readback inside run_directed already reads x0 - // and x31 (index 0 and REG_COUNT-1), so no dedicated task is needed. prog = '{asm_instr(.op(OP_ADDI), .rd(31), .rs1(0), .imm(-1)), EBREAK_WORD}; run_directed("external_register_boundary_reads", prog); + // test derived from bug hunt seed = 2222 + // failing after duplicate store then beq taken + prog = '{ + asm_instr(.op(OP_ADD), .rd(2), .rs1(1), .rs2(2)), + asm_instr(.op(OP_SUB), .rd(0), .rs1(27), .rs2(7)), + asm_instr(.op(OP_LW), .rd(10), .rs1(0), .imm(464)), + asm_instr(.op(OP_SRL), .rd(13), .rs1(0), .rs2(21)), + asm_instr(.op(OP_LW), .rd(21), .rs1(0), .imm(1980)), + asm_instr(.op(OP_LW), .rd(0), .rs1(6), .imm(868)), + asm_instr(.op(OP_SW), .rs1(1), .rs2(1), .imm(1004)), + asm_instr(.op(OP_BEQ), .rs1(4), .rs2(23), .imm(28)), + asm_instr(.op(OP_SLL), .rd(9), .rs1(7), .rs2(27)), + asm_instr(.op(OP_SW), .rs1(0), .rs2(27), .imm(1416)), + asm_instr(.op(OP_BEQ), .rs1(2), .rs2(6), .imm(20)), + asm_instr(.op(OP_SW), .rs1(6), .rs2(1), .imm(540)), + asm_instr(.op(OP_ADD), .rd(4), .rs1(15), .rs2(5)), + asm_instr(.op(OP_LW), .rd(9), .rs1(14), .imm(8)), + asm_instr(.op(OP_SLL), .rd(6), .rs1(31), .rs2(2)), + asm_instr(.op(OP_BEQ), .rs1(7), .rs2(31), .imm(12)), + asm_instr(.op(OP_SUB), .rd(6), .rs1(6), .rs2(5)), + asm_instr(.op(OP_SLL), .rd(19), .rs1(3), .rs2(3)), + asm_instr(.op(OP_ADD), .rd(3), .rs1(2), .rs2(7)), + asm_instr(.op(OP_SLL), .rd(19), .rs1(3), .rs2(7)), + EBREAK_WORD + }; + run_directed("duplicate_store_beq", prog); + // CHIP-LEVEL DIRECTED TESTS run_reset_while_running(); run_external_halt(); diff --git a/testplan_final.md b/testplan_final.md index 132d7df..e2a1265 100644 --- a/testplan_final.md +++ b/testplan_final.md @@ -1329,32 +1329,51 @@ STABLE_WHEN_DISABLED : **Evidence that it detects a violation:** ## 4. Encrypted CPU Bug Hunt - ### Random discovery -| Field | Evidence | -| ------------------------ | ----------------------------- | -| Discovery command | `make bug_hunt SEED=random` | -| Numeric `SVSEED` | | -| Failing iteration | | -| First failure message | | -| Reproduction command | `make bug_hunt SEED=________` | -| Reproduces consistently? | Yes / No | +| Field | Evidence | +| ------------------------ | ------------------------------------------------------------------------------ | +| Discovery command | `make bug_hunt SEED=random` | +| Numeric `SVSEED` | 2222 | +| Failing iteration | 0 | +| First failure message | unexpected store to dmem[0x0fb] = 0x00000000 with no predicted store remaining | +| Reproduction command | `make bug_hunt SEED=2222` | +| Reproduces consistently? | Yes | **Original failing program:** ```systemverilog prog = '{ - // Paste original generated sequence + asm_instr(.op(OP_ADD), .rd(2), .rs1(1), .rs2(2)), + asm_instr(.op(OP_SUB), .rd(0), .rs1(27), .rs2(7)), + asm_instr(.op(OP_LW), .rd(10), .rs1(0), .imm(464)), + asm_instr(.op(OP_SRL), .rd(13), .rs1(0), .rs2(21)), + asm_instr(.op(OP_LW), .rd(21), .rs1(0), .imm(1980)), + asm_instr(.op(OP_LW), .rd(0), .rs1(6), .imm(868)), + asm_instr(.op(OP_SW), .rs1(1), .rs2(1), .imm(1004)), + asm_instr(.op(OP_BEQ), .rs1(4), .rs2(23), .imm(28)), + asm_instr(.op(OP_SLL), .rd(9), .rs1(7), .rs2(27)), + asm_instr(.op(OP_SW), .rs1(0), .rs2(27), .imm(1416)), + asm_instr(.op(OP_BEQ), .rs1(2), .rs2(6), .imm(20)), + asm_instr(.op(OP_SW), .rs1(6), .rs2(1), .imm(540)), + asm_instr(.op(OP_ADD), .rd(4), .rs1(15), .rs2(5)), + asm_instr(.op(OP_LW), .rd(9), .rs1(14), .imm(8)), + asm_instr(.op(OP_SLL), .rd(6), .rs1(31), .rs2(2)), + asm_instr(.op(OP_BEQ), .rs1(7), .rs2(31), .imm(12)), + asm_instr(.op(OP_SUB), .rd(6), .rs1(6), .rs2(5)), + asm_instr(.op(OP_SLL), .rd(19), .rs1(3), .rs2(3)), + asm_instr(.op(OP_ADD), .rd(3), .rs1(2), .rs2(7)), + asm_instr(.op(OP_SLL), .rd(19), .rs1(3), .rs2(7)), EBREAK_WORD }; +run_directed("duplicate_store_beq", prog); ``` ### Expected vs. actual -| Instruction / event | Expected | Actual | Cycle/time | -| ------------------- | -------- | ------ | ---------- | -| | | | | +| Instruction / event | Expected | Actual | Cycle/time | +| ------------------- | ---------- | ------------------------- | ---------- | +| sw x1, 1004(x1) | 0x00000000 | 0x00000000 (stored twice) | | **First architectural divergence:** @@ -1375,6 +1394,8 @@ prog = '{ Include a screenshot showing the offending instruction and the first incorrect architectural result. +![[Pasted image 20261006154222.png]] + ### Conclusion **Trigger:**