diff --git a/testplan_final.md b/testplan_final.md index 3985a8f..bdfd906 100644 --- a/testplan_final.md +++ b/testplan_final.md @@ -19,10 +19,10 @@ instructions and disappear from rendered Markdown. ### Revision history -| Revision | Date | Changes | -| -------- | ---------- | ----------------------------------------------------------------------- | -| Initial | 2026-09-26 | Initial planned tests | -| Final | 2026-09-29 | | +| Revision | Date | Changes | +| -------- | ---------- | ------------------------------------------- | +| Initial | 2026-09-26 | Initial planned tests | +| Final | 2026-09-29 | Added tests, completed coverage, found bugs | ## 1. Functional tests @@ -1295,10 +1295,10 @@ evidence from a temporary violation proving that the assertion can fire. ### Assertion summary -| Assertion ID/name | Behavior checked | When it is sampled/disabled | Activating test | -| ------------------------- | ------------------- | --------------------------- | --------------- | -| 3.1 / `X0_REMAINS_0` | x0 = 0 | posedge clk | lw_x0 | -| 3.2 / `NO_RW_CONCURRENCY` | !(w_en_i && r_en_i) | posedge clk | | +| Assertion ID/name | Behavior checked | When it is sampled/disabled | Activating test | +| ---------------------------- | ------------------- | --------------------------- | --------------- | +| 3.1 / `X0_REMAINS_0` | x0 = 0 | posedge clk | lw_x0 | +| 3.2 / `STABLE_WHEN_DISABLED` | !(w_en_i && r_en_i) | posedge clk | | ### 3.1 — `X0_REMAINS_0` @@ -1336,10 +1336,10 @@ STABLE_WHEN_DISABLED : | ------------------------ | ------------------------------------------------------------------------------ | | Discovery command | `make bug_hunt SEED=random` | | Numeric `SVSEED` | 2222 | -| Failing iteration | 0 | +| Failing iteration | CPU 0 - random gen 17 | | First failure message | unexpected store to dmem[0x0fb] = 0x00000000 with no predicted store remaining | | Reproduction command | `make bug_hunt SEED=2222` | -| Reproduces consistently? | Yes | +| Reproduces consistently? | Yes | **Original failing program:** @@ -1372,11 +1372,13 @@ run_directed("duplicate_store_beq", prog); ### Expected vs. actual -| Instruction / event | Expected | Actual | Cycle/time | -| ------------------- | ---------- | ------------------------- | ---------- | -| sw x1, 1004(x1) | 0x00000000 | 0x00000000 (stored twice) | | +| Instruction / event | Expected | Actual | Cycle/time | +| ------------------------------------------------------------ | ----------------------------------- | ------------------------------------------------------- | ---------- | +| `sw x1, 1004(x1)` (seed 2222) | one write: dmem[0x0fb] = 0x00000000 | two writes to dmem[0x0fb]; second flagged as unexpected | | +| `sw x1, 8(x1)`, x1 = 100 (`sw_addr_no_carry_control`) | one write: dmem[0x01b] = 0x00000064 | two writes to dmem[0x01b]; second flagged as unexpected | 133815 ns | +| `sw x2, 540(x4)` as first instruction (`random_gen_7_len_4`) | one write: dmem[0x087] = 0x00000000 | two writes to dmem[0x087]; second flagged as unexpected | 520395 ns | -**First architectural divergence:** duplicate SW when one is expected, seems to happen when branch is taken +**First architectural divergence:** the first `sw` is written to data memory twice. The scoreboard predicts one store, so the second write is reported as an unexpected store with no predicted store remaining. A branch is not required, since a lone `sw` duplicates too. ### Minimization @@ -1400,7 +1402,7 @@ Include a screenshot showing the offending instruction and the first incorrect a ### Conclusion -**Trigger:** sw + beq +**Trigger:** any `sw` @@ -1422,7 +1424,7 @@ Include a screenshot showing the offending instruction and the first incorrect a | ------------------------ | -------------------------------------------------------------------------- | | Discovery command | `make bug_hunt SEED=random` | | Numeric `SVSEED` | 3333 | -| Failing iteration | 0 | +| Failing iteration | CPU 0 - random gen 5 | | First failure message | store #2 wrote dmem[0x17d] = 0x00000000, expected dmem[0x233] = 0x00000000 | | Reproduction command | `make bug_hunt SEED=3333` | | Reproduces consistently? | Yes | @@ -1487,11 +1489,14 @@ run_directed("incorrect_store_bug", prog); ### Expected vs. actual -| Instruction / event | Expected | Actual | Cycle/time | -| ------------------- | ---------- | ------------------------- | ---------- | -| sw x1, 1004(x1) | 0x00000000 | 0x00000000 (stored twice) | | +| Instruction / event | Expected | Actual | Cycle/time | +| ------------------------------------------- | --------------------------------- | --------------------------------- | ---------- | +| `sw x3, 213(x1)`, x1 = 2039 (seed 3333) | store to dmem[0x233] = 0x00000000 | store to dmem[0x1f3] = 0x00000000 | 434845 ns | +| `sw x0, 213(x1)`, x1 = 2039 (minimized) | store to dmem[0x233] = 0x00000000 | store to dmem[0x1f3] = 0x00000000 | 131065 ns | +| `sw x1, 8(x1)`, x1 = 252 (aligned) | store to dmem[0x041] = 0x000000fc | store to dmem[0x001] = 0x000000fc | 132435 ns | +| `sw x1, 8(x1)`, x1 = 100 (no-carry control) | store to dmem[0x01b] = 0x00000064 | store to dmem[0x01b] = 0x00000064 | 133815 ns | -**First architectural divergence:** 17d is the computed addr to store into, which is not what the scoreboard is expecting +**First architectural divergence:** the final `sw x3, 213(x1)` writes dmem[0x1f3] instead of dmem[0x233] (x1 = 2039, so the address is 2039 + 213 = 0x8CC, word 0x233). The first error in the log (store #2 wrote dmem[0x17d]) is the duplicate-store bug shifting the store stream, not this bug. ### Minimization @@ -1552,13 +1557,13 @@ Include a screenshot showing the offending instruction and the first incorrect a -##### 4.3 Bug 3 - Early Halt +##### 4.3 Bug 3 - Stale Branch Operand | Field | Evidence | | ------------------------ | ----------------------------------------------------- | | Discovery command | `make bug_hunt SEED=random` | | Numeric `SVSEED` | 4444 | -| Failing iteration | 0 | +| Failing iteration | CPU 0 - random gen 39 | | First failure message | CPU halted with 1 predicted store(s) still unobserved | | Reproduction command | `make bug_hunt SEED=4444` | | Reproduces consistently? | Yes | @@ -1582,11 +1587,14 @@ run_directed("halt_prior_to_sw", prog); ### Expected vs. actual -| Instruction / event | Expected | Actual | Cycle/time | -| ------------------- | ---------- | ------------------------- | ---------- | -| sw x1, 1004(x1) | 0x00000000 | 0x00000000 (stored twice) | | +| Instruction / event | Expected | Actual | Cycle/time | +| ---------------------------------------------------------- | --------------------------------------------------------- | ----------------------------------------------------------------- | ---------- | +| `beq x7, x3, 8` after `lw x7, 2032(x5)` (seed 4444) | not taken; `sw x9, 1644(x31)` writes dmem[0x19b] | branch taken; no write to dmem[0x19b] | 1903595 ns | +| `lw x2, 0(x0)` then `beq x2, x0, 8`, x2 = 1 (`lw_use_beq`) | not taken; `sw x1, 4(x0)` writes dmem[0x001] = 0x00000001 | branch taken; dmem[0x001] = 0x000000fc after halt (never written) | 138225 ns | +| same with a nop between (`lw_nop_beq_control`) | `sw x1, 4(x0)` writes dmem[0x001] = 0x00000001 | dmem[0x001] = 0x00000001 written | 139705 ns | +| `lw x2, 0(x0)` then `add x3, x2, x2` (`lw_use_alu`) | stored value 0x0000000a | stored value 0x0000000a | 141185 ns | -**First architectural divergence:** the CPU halts prior to the completion of the program +**First architectural divergence:** the `beq` that follows the `lw` is taken, so the `sw` after it is skipped. The CPU then reaches `ebreak` and the scoreboard reports a predicted store that was never observed. ### Minimization @@ -1633,19 +1641,19 @@ Include a screenshot showing the offending instruction and the first incorrect a ### Conclusion -**Trigger:** imm in sw causes some type of bit mismatch, the addresses are all off by 0x100 bytes +**Trigger:** lw followed by beq that uses the same register as a source -**Expected behavior:** addr is computed correctly +**Expected behavior:** branch isn’t taken in this case, and sw executes -**Observed behavior:** store goes to sum without the carry from bit 7 to bit 8 +**Observed behavior:** branch is taken, and the CPU early halts -**Behavioral characterization:** the ALU is computing the correct address, but somewhere the bit carry when using the store address is lost +**Behavioral characterization:** branch reads the register prior to the completion of the lw