54 KiB
Fall 2026 DV Onboarding Test Plan
NOTE: THIS IS A TEMPLATE FOR YOU TO FOLLOW. THIS IS NOT A COMPREHENSIVE TESTPLAN. YOU NEED TO EXTEND IT.
Document information
| Field | Value |
|---|---|
| Verification engineer | Dylan Benzi, benziboy, dbenzi3 |
| Plan revision | Final |
| Date | 2026-09-29 |
Revision history
| Revision | Date | Changes |
|---|---|---|
| Initial | 2026-09-26 | Initial planned tests |
| Final | 2026-09-29 |
1. Functional tests
Functional-test summary
Implemented ISA to test
- ADD
- ADDI
- SUB
- LW
- SW
- BEQ
- SLL
- SRL
- EBREAK
| Test ID | Test name | Functionality being tested | Expected result | Status |
|---|---|---|---|---|
| 1.1 | add_overflow |
add two regs causing an overflow | overflow discarded | Planned |
| 1.2 | addi_overflow |
add imm to reg causing an overflow | overflow discarded | Planned |
| 1.3 | addi_negative |
add negative imm | imm is subtracted | Planned |
| 1.4 | add_typical |
add two regs | regs added properly | Planned |
| 1.5 | addi_typical |
add imm to reg | imm added properly | Planned |
| 1.6 | addi_negative_overflow |
add negative numbers causing an overflow | negative overflow wrap around | Planned |
| 1.7 | sub_overflow |
subtract two regs causing an overflow | negative overflow wrap around | Planned |
| 1.8 | sub_typical |
subtract two regs | regs subtracted properly | Planned |
| 1.9 | sll_oob |
shift left by larger than 2^5 bits | left shift constrainted to 2^5 | Planned |
| 1.10 | srl_oob |
shift right by larger than 2^5 bits | right shift constrainted to 2^5 | Planned |
| 1.11 | sll_zero |
shift left by zero bits | no shift | Planned |
| 1.12 | srl_zero |
shift right by zero bits | no shift | Planned |
| 1.13 | sll_one |
shift left by one bit | logical left shift by one bit | Planned |
| 1.14 | srl_one |
shift right by one bit | logical right shift by one bit | Planned |
| 1.15 | sll_typical |
shift left by <2^5 bits | correct logical left shift | Planned |
| 1.16 | srl_typical |
shift right by <2^5 bits | correct logical right shift | Planned |
| 1.17 | lw_zero_offset |
lw with zero offset | zero offset computed | Planned |
| 1.18 | sw_zero_offset |
sw with zero offset | zero offset computed + stored | Planned |
| 1.19 | lw_positive |
lw with positive offset | correct offset computed | Planned |
| 1.20 | sw_positive |
sw with positive offset | correct offset computed + stored | Planned |
| 1.21 | lw_negative |
lw with negative offset | correct offset computed | Planned |
| 1.22 | sw_negative |
sw with negative offset | correct offset computed + stored | Planned |
| 1.23 | lw_x0 |
lw into x0 reg | write discarded, x0 remains 0 | Planned |
| 1.24 | beq_x0 |
beq with both regs as x0 | take branch | Planned |
| 1.25 | beq_not_taken |
beq with non-equal regs | branch not taken | Planned |
| 1.26 | beq_typical |
beq with equal regs | branch taken | Planned |
| 1.27 | ebreak_immediately |
ebreak as first instruction | halt CPU | Planned |
| 1.28 | beq_backward_loop |
beq used as a backward branch | loop runs to completion | Planned |
| 1.29 | reset_while_running |
rst_i asserted mid-program | registers clear, execution does not resume | Planned |
| 1.30 | external_halt |
halt_cpu_i pulsed mid-program | CPU stops short of completion, memory ownership returns externally | Planned |
| 1.31 | isram_boundary_words |
external access to isram word 0 and 1023 | both words read back correctly, no aliasing | Planned |
| 1.32 | dsram_boundary_words |
external access to dsram word 0 and 1023 | both words read back correctly, no aliasing | Planned |
| 1.33 | external_register_boundary_reads |
external read of x0 and x31 | x0 reads 0, x31 reads the value the CPU wrote | Planned |
Functional-test details
1.1 — add_overflow
Functionality: add two registers together that would cause an overflow
Initial state:
- Registers: x1 = 0xFFFFFFFF, x2 = 0xFFFFFFFF
- Data memory: none
- Other setup: none
Program:
prog = '{
asm_instr(.op(OP_ADDI), .rd(1), .rs1(0), .imm(-1)),
asm_instr(.op(OP_ADDI), .rd(2), .rs1(0), .imm(-1)),
asm_instr(.op(OP_ADD), .rd(2), .rs1(1), .rs2(2)),
EBREAK_WORD
};
run_directed("add_overflow", prog);
Expected result:
| Register or memory word | Expected value | Calculation or explanation |
|---|---|---|
x2 |
32'hFFFFFFFE |
0xFFFFFFFF + 0xFFFFFFFF = 0x(1)FFFFFFFE, the leading 1 is truncated |
Pass criteria: 3 cycle operation
Final result:
1.2 — addi_overflow
Functionality: add an immediate to a register that would cause an overflow
Initial state:
- Registers: x1 = 0xFFFFFFFF
- Data memory: none
- Other setup: none
Program:
prog = '{
asm_instr(.op(OP_ADDI), .rd(1), .rs1(0), .imm(-1)),
asm_instr(.op(OP_ADDI), .rd(1), .rs1(1), .imm(1)),
EBREAK_WORD
};
run_directed("addi_overflow", prog);
Expected result:
| Register or memory word | Expected value | Calculation or explanation |
|---|---|---|
x1 |
32'h00000000 |
0xFFFFFFFF + 0x1 = 0x(1)00000000, the leading 1 is truncated |
Pass criteria: 2 cycle operation
Final result:
1.3 — addi_negative
Functionality: adds a negative value to a register using addi, effectively subtracting from that register
Initial state:
- Registers: x1 = 0x1
- Data memory: none
- Other setup: none
Program:
prog = '{
asm_instr(.op(OP_ADDI), .rd(1), .rs1(0), .imm(1)),
asm_instr(.op(OP_ADDI), .rd(1), .rs1(1), .imm(-1)),
EBREAK_WORD
};
run_directed("addi_negative", prog);
Expected result:
| Register or memory word | Expected value | Calculation or explanation |
|---|---|---|
x1 |
32'h0 |
0x1 - 0x1 = 0x0 |
Pass criteria: 2 cycle operation
Final result:
1.4 — add_typical
Functionality: add two registers with values that will not cause an overflow
Initial state:
- Registers: x1 = 0x123, x2 = 0x123
- Data memory: none
- Other setup: none
Program:
prog = '{
asm_instr(.op(OP_ADDI), .rd(1), .rs1(0), .imm('h123)),
asm_instr(.op(OP_ADDI), .rd(2), .rs1(0), .imm('h123)),
asm_instr(.op(OP_ADD), .rd(2), .rs1(1), .rs2(2)),
EBREAK_WORD
};
run_directed("add_typical", prog);
Expected result:
| Register or memory word | Expected value | Calculation or explanation |
|---|---|---|
x2 |
32'h246 |
0x123 + 0x123 = 0x246 |
Pass criteria: 3 cycle operation
Final result:
1.5 — addi_typical
Functionality: addi with immediate added to register without causing an overflow
Initial state:
- Registers: none
- Data memory: none
- Other setup: none
Program:
prog = '{
asm_instr(.op(OP_ADDI), .rd(1), .rs1(0), .imm('h123)),
EBREAK_WORD
};
run_directed("addi_typical", prog);
Expected result:
| Register or memory word | Expected value | Calculation or explanation |
|---|---|---|
x1 |
32'h123 |
0x0 + 0x123 = 0x123 |
Pass criteria: 1 cycle operation
Final result:
1.6 — addi_negative_overflow
Functionality: addi with a negative number causes an overflow wrap around to the register
Initial state:
- Registers: x1 = 0x0
- Data memory: none
- Other setup: none
Program:
prog = '{
asm_instr(.op(OP_ADDI), .rd(1), .rs1(0), .imm(-1)),
EBREAK_WORD
};
run_directed("addi_negative_overflow", prog);
Expected result:
| Register or memory word | Expected value | Calculation or explanation |
|---|---|---|
x1 |
32'hFFFFFFFF |
0x0 - 0x1 = 0xFFFFFFFF, overflow back to full reg |
Pass criteria: 1 cycle operation
Final result:
1.7 — sub_overflow
Functionality: sub registers that would cause an overflow wrap around
Initial state:
- Registers: x1 = 0x1
- Data memory: none
- Other setup: none
Program:
prog = '{
asm_instr(.op(OP_ADDI), .rd(1), .rs1(0), .imm(1)),
asm_instr(.op(OP_SUB), .rd(1), .rs1(0), .rs2(1)),
EBREAK_WORD
};
run_directed("sub_overflow", prog);
Expected result:
| Register or memory word | Expected value | Calculation or explanation |
|---|---|---|
x1 |
32'hFFFFFFFF |
0x0 - 0x1 = 0xFFFFFFFF overflow wrap around |
Pass criteria: 2 cycle operation
Final result:
1.8 — sub_typical
Functionality: sub two registers without causing an overflow
Initial state:
- Registers: x1 = 0x123, x2 = 0x23
- Data memory: none
- Other setup: none
Program:
prog = '{
asm_instr(.op(OP_ADDI), .rd(1), .rs1(0), .imm('h123)),
asm_instr(.op(OP_ADDI), .rd(2), .rs1(0), .imm('h23)),
asm_instr(.op(OP_SUB), .rd(2), .rs1(1), .rs2(2)),
EBREAK_WORD
};
run_directed("sub_typical", prog);
Expected result:
| Register or memory word | Expected value | Calculation or explanation |
|---|---|---|
x2 |
32'h100 |
0x123 - 0x23 = 0x100 |
Pass criteria: 3 cycle operation
Final result:
1.9 — srl_oob
Functionality: srl masks to bottom 5 bits of data only, cannot shift more than 31
Initial state:
- Registers: x1 = 0xFFFFFFFF, x2 = 0x20
- Data memory: none
- Other setup: none
Program:
prog = '{
asm_instr(.op(OP_ADDI), .rd(1), .rs1(0), .imm(-1)),
asm_instr(.op(OP_ADDI), .rd(2), .rs1(0), .imm(32)),
asm_instr(.op(OP_SRL), .rd(1), .rs1(1), .rs2(2)),
EBREAK_WORD
};
run_directed("srl_oob", prog);
Expected result:
| Register or memory word | Expected value | Calculation or explanation |
|---|---|---|
x1 |
32'hFFFFFFFF |
0x20 == 2^5 => no shift |
Pass criteria: 3 cycle operation
Final result:
1.10 — sll_oob
Functionality: sll masks to bottom 5 bits of data only, cannot shift more than 31
Initial state:
- Registers: x1 = 0xFFFFFFFF, x2 = 0x20
- Data memory: none
- Other setup: none
Program:
prog = '{
asm_instr(.op(OP_ADDI), .rd(1), .rs1(0), .imm(-1)),
asm_instr(.op(OP_ADDI), .rd(2), .rs1(0), .imm(32)),
asm_instr(.op(OP_SLL), .rd(1), .rs1(1), .rs2(2)),
EBREAK_WORD
};
run_directed("sll_oob", prog);
Expected result:
| Register or memory word | Expected value | Calculation or explanation |
|---|---|---|
x1 |
32'hFFFFFFFF |
0x20 == 2^5 => no shift |
Pass criteria: 3 cycle operation
Final result:
1.11 — sll_zero
Functionality: sll with zero, causing no shift
Initial state:
- Registers: x1 = 0xFFFFFFFF
- Data memory: none
- Other setup: none
Program:
prog = '{
asm_instr(.op(OP_ADDI), .rd(1), .rs1(0), .imm(-1)),
asm_instr(.op(OP_SLL), .rd(1), .rs1(1), .rs2(0)),
EBREAK_WORD
};
run_directed("sll_zero", prog);
Expected result:
| Register or memory word | Expected value | Calculation or explanation |
|---|---|---|
x1 |
32'hFFFFFFFF |
0xFFFFFFFF << 0x0 = 0xFFFFFFFF |
Pass criteria: 2 cycle operation
Final result:
1.12 — srl_zero
Functionality: srl with zero, causing no shift
Initial state:
- Registers: x1 = 0xFFFFFFFF
- Data memory: none
- Other setup: none
Program:
prog = '{
asm_instr(.op(OP_ADDI), .rd(1), .rs1(0), .imm(-1)),
asm_instr(.op(OP_SRL), .rd(1), .rs1(1), .rs2(0)),
EBREAK_WORD
};
run_directed("srl_zero", prog);
Expected result:
| Register or memory word | Expected value | Calculation or explanation |
|---|---|---|
x1 |
32'hFFFFFFFF |
0xFFFFFFFF << 0x0 = 0xFFFFFFFF |
Pass criteria: 2 cycle operation
Final result:
1.13 — sll_one
Functionality: sll with one, causing a shift once to the left
Initial state:
- Registers: x1 = 0xFFFFFFFF, x2 = 0x1
- Data memory: none
- Other setup: none
Program:
prog = '{
asm_instr(.op(OP_ADDI), .rd(1), .rs1(0), .imm(-1)),
asm_instr(.op(OP_ADDI), .rd(2), .rs1(0), .imm(1)),
asm_instr(.op(OP_SLL), .rd(1), .rs1(1), .rs2(2)),
EBREAK_WORD
};
run_directed("sll_one", prog);
Expected result:
| Register or memory word | Expected value | Calculation or explanation |
|---|---|---|
x1 |
32'hFFFFFFFE |
0xFFFFFFFF << 0x1 = 0xFFFFFFFE |
Pass criteria: 3 cycle operation
Final result:
1.14 — srl_one
Functionality: srl with one, causing a shift once to the right
Initial state:
- Registers: x1 = 0xFFFFFFFF, x2 = 1
- Data memory: none
- Other setup: none
Program:
prog = '{
asm_instr(.op(OP_ADDI), .rd(1), .rs1(0), .imm(-1)),
asm_instr(.op(OP_ADDI), .rd(2), .rs1(0), .imm(1)),
asm_instr(.op(OP_SRL), .rd(1), .rs1(1), .rs2(2)),
EBREAK_WORD
};
run_directed("srl_one", prog);
Expected result:
| Register or memory word | Expected value | Calculation or explanation |
|---|---|---|
x1 |
32'h7FFFFFFF |
0xFFFFFFFF >> 0x1 = 0x7FFFFFFF |
Pass criteria: 3 cycle operation
Final result:
1.15 — sll_typical
Functionality: sll with a shift greater than 1 and less than 2^5
Initial state:
- Registers: x1 = 0xFFFFFFFF, x2 = 0x4
- Data memory: none
- Other setup: none
Program:
prog = '{
asm_instr(.op(OP_ADDI), .rd(1), .rs1(0), .imm(-1)),
asm_instr(.op(OP_ADDI), .rd(2), .rs1(0), .imm(4)),
asm_instr(.op(OP_SLL), .rd(1), .rs1(1), .rs2(2)),
EBREAK_WORD
};
run_directed("sll_typical", prog);
Expected result:
| Register or memory word | Expected value | Calculation or explanation |
|---|---|---|
x1 |
32'hFFFFFFF0 |
0xFFFFFFFF << 0x4 = 0xFFFFFFF0 |
Pass criteria: 3 cycle operation
Final result:
1.16 — srl_typical
Functionality: srl with a shift greater than 1 and less than 2^5
Initial state:
- Registers: x1 = 0xFFFFFFFF, x2 = 0x4
- Data memory: none
- Other setup: none
Program:
prog = '{
asm_instr(.op(OP_ADDI), .rd(1), .rs1(0), .imm(-1)),
asm_instr(.op(OP_ADDI), .rd(2), .rs1(0), .imm(4)),
asm_instr(.op(OP_SRL), .rd(1), .rs1(1), .rs2(2)),
EBREAK_WORD
};
run_directed("srl_typical", prog);
Expected result:
| Register or memory word | Expected value | Calculation or explanation |
|---|---|---|
x1 |
32'h0FFFFFFF |
0xFFFFFFFF >> 0x4 = 0x0FFFFFFF |
Pass criteria: 3 cycle operation
Final result:
1.17 — lw_zero_offset
Functionality: lw with zero offset, loading in the register rs1
Initial state:
- Registers: none
- Data memory: dmem[0] = 0xFFFFFFFF
- Other setup: none
Program:
prog = '{
asm_instr(.op(OP_LW), .rd(1), .rs1(0), .imm(0)),
EBREAK_WORD
};
run_directed("lw_zero_offset", prog);
Expected result:
| Register or memory word | Expected value | Calculation or explanation |
|---|---|---|
x1 |
32'hFFFFFFFF |
x1 = M[0] => 0xFFFFFFFF |
Pass criteria: 2 cycle operation
Final result:
1.18 — sw_zero_offset
Functionality: sw with zero offset, storing in memory addr of rs1
Initial state:
- Registers: x1 = 0xFFFFFFFF
- Data memory: none
- Other setup: none
Program:
prog = '{
asm_instr(.op(OP_ADDI), .rd(1), .rs1(0), .imm(-1)),
asm_instr(.op(OP_SW), .rs1(0), .rs2(1), .imm(0)),
EBREAK_WORD
};
run_directed("sw_zero_offset", prog);
Expected result:
| Register or memory word | Expected value | Calculation or explanation |
|---|---|---|
dmem[0] |
32'hFFFFFFFF |
M[0] = x1 => 0xFFFFFFFF |
Pass criteria: 2 cycle operation
Final result:
1.19 — lw_positive
Functionality: lw with a positive offset
Initial state:
- Registers: none
- Data memory: dmem[1] = 0xFFFFFFFF
- Other setup: none
Program:
prog = '{
asm_instr(.op(OP_LW), .rd(1), .rs1(0), .imm(4)),
EBREAK_WORD
};
run_directed("lw_positive", prog);
Expected result:
| Register or memory word | Expected value | Calculation or explanation |
|---|---|---|
x1 |
32'hFFFFFFFF |
x1 = dmem[1] => 0xFFFFFFFF |
Pass criteria: 2 cycle operation
Final result:
1.20 — sw_positive
Functionality: sw with a positive offset
Initial state:
- Registers: x1 = 0xFFFFFFFF
- Data memory: none
- Other setup: none
Program:
prog = '{
asm_instr(.op(OP_ADDI), .rd(1), .rs1(0), .imm(-1)),
asm_instr(.op(OP_SW), .rs1(0), .rs2(1), .imm(4)),
EBREAK_WORD
};
run_directed("sw_positive", prog);
Expected result:
| Register or memory word | Expected value | Calculation or explanation |
|---|---|---|
dmem[1] |
32'hFFFFFFFF |
dmem[1] = x1 => 0xFFFFFFFF |
Pass criteria: 2 cycle operation
Final result:
1.21 — lw_negative
Functionality: lw with a negative offset from a nonzero base register, landing on a legal, word-aligned address inside DSRAM
Initial state:
- Registers: none
- Data memory: dmem[15] = 0xFFFFFFFF
- Other setup: none
Program:
prog = '{
asm_instr(.op(OP_ADDI), .rd(1), .rs1(0), .imm(64)),
asm_instr(.op(OP_LW), .rd(2), .rs1(1), .imm(-4)),
EBREAK_WORD
};
run_directed("lw_negative", prog);
Expected result:
| Register or memory word | Expected value | Calculation or explanation |
|---|---|---|
x2 |
32'hFFFFFFFF |
effective addr = 64 + (-4) = 60 = 4*15 => x2 = dmem[15] |
Pass criteria: 3 cycle operation
Final result:
1.22 — sw_negative
Functionality: sw with a negative offset from a nonzero base register, landing on a legal, word-aligned address inside DSRAM
Initial state:
- Registers: none
- Data memory: none
- Other setup: none
Program:
prog = '{
asm_instr(.op(OP_ADDI), .rd(1), .rs1(0), .imm(64)),
asm_instr(.op(OP_ADDI), .rd(2), .rs1(0), .imm(-1)),
asm_instr(.op(OP_SW), .rs1(1), .rs2(2), .imm(-4)),
EBREAK_WORD
};
run_directed("sw_negative", prog);
Expected result:
| Register or memory word | Expected value | Calculation or explanation |
|---|---|---|
dmem[15] |
32'hFFFFFFFF |
effective addr = 64 + (-4) = 60 = 4*15 => dmem[15] = x2 |
Pass criteria: 3 cycle operation
Final result:
1.23 — lw_x0
Functionality: attempt to lw into x0 register
Initial state:
- Registers: none
- Data memory: dmem[0] = 0xFFFFFFFF
- Other setup: none
Program:
prog = '{
asm_instr(.op(OP_LW), .rd(0), .rs1(0), .imm(0)),
EBREAK_WORD
};
run_directed("lw_x0", prog);
Expected result:
| Register or memory word | Expected value | Calculation or explanation |
|---|---|---|
x0 |
32'h0 |
x0 is to always remain 0 |
Pass criteria: 2 cycle operation
Final result:
1.24 — beq_x0
Functionality: beq with both sources as x0
Initial state:
- Registers: none
- Data memory: none
- Other setup: none
Program:
prog = '{
asm_instr(.op(OP_BEQ), .rs1(0), .rs2(0), .imm(8)),
asm_instr(.op(OP_ADDI), .rd(1), .rs1(0), .imm(1)),
asm_instr(.op(OP_ADDI), .rd(1), .rs1(0), .imm(2)),
EBREAK_WORD
};
run_directed("beq_x0", prog);
Expected result:
| Register or memory word | Expected value | Calculation or explanation |
|---|---|---|
x1 |
32'h2 |
skip ADDI x1, x0, 1, and run ADDI x1, x0, 2 |
Pass criteria: 2 cycle operation
Final result:
1.25 — beq_not_taken
Functionality: beq on two non-equal registers
Initial state:
- Registers: x1 = 0xFFFFFFFF
- Data memory: none
- Other setup: none
Program:
prog = '{
asm_instr(.op(OP_ADDI), .rd(1), .rs1(0), .imm(-1)),
asm_instr(.op(OP_BEQ), .rs1(0), .rs2(1), .imm(8)),
asm_instr(.op(OP_ADDI), .rd(2), .rs1(0), .imm(-1)),
EBREAK_WORD
};
run_directed("beq_not_taken", prog);
Expected result:
| Register or memory word | Expected value | Calculation or explanation |
|---|---|---|
x2 |
32'hFFFFFFFF |
do not skip to EBREAK, and run ADDI x2, x0, -1 |
Pass criteria: 3 cycle operation
Final result:
1.26 — beq_typical
Functionality: beq on two equal registers that are not x0
Initial state:
- Registers: x1 = 0xFFFFFFFF, x2 = 0xFFFFFFFF
- Data memory: none
- Other setup: none
Program:
prog = '{
asm_instr(.op(OP_ADDI), .rd(1), .rs1(0), .imm(-1)),
asm_instr(.op(OP_ADDI), .rd(2), .rs1(0), .imm(-1)),
asm_instr(.op(OP_BEQ), .rs1(1), .rs2(2), .imm(8)),
asm_instr(.op(OP_ADDI), .rd(3), .rs1(0), .imm(1)),
asm_instr(.op(OP_ADDI), .rd(3), .rs1(0), .imm(2)),
EBREAK_WORD
};
run_directed("beq_typical", prog);
Expected result:
| Register or memory word | Expected value | Calculation or explanation |
|---|---|---|
x3 |
32'h2 |
skip ADDI x3, x0, 1, and run ADDI x3, x0, 2 |
Pass criteria: 4 cycle operation
Final result:
1.27 — ebreak_immediately
Functionality: ebreak as first instruction, subsequent instructions not run
Initial state:
- Registers: none
- Data memory: none
- Other setup: none
Program:
prog = '{
EBREAK_WORD,
asm_instr(.op(OP_ADDI), .rd(1), .rs1(0), .imm(-1))
};
run_directed("ebreak_immediately", prog);
Expected result:
| Register or memory word | Expected value | Calculation or explanation |
|---|---|---|
x1 |
32'h0 |
ebreak before ADDI instruction |
Pass criteria: ebreak takes one cycle, other instructions not run
Final result:
1.28 — beq_backward_loop
Functionality: beq used as a backward branch creating a countdown loop
Initial state:
- Registers: none
- Data memory: none
- Other setup: none
Program:
prog = '{
asm_instr(.op(OP_ADDI), .rd(1), .rs1(0), .imm(3)),
asm_instr(.op(OP_ADDI), .rd(1), .rs1(1), .imm(-1)),
asm_instr(.op(OP_BEQ), .rs1(1), .rs2(0), .imm(8)),
asm_instr(.op(OP_BEQ), .rs1(0), .rs2(0), .imm(-8)),
EBREAK_WORD
};
run_directed("beq_backward_loop", prog);
Expected result:
| Register or memory word | Expected value | Calculation or explanation |
|---|---|---|
x1 |
32'h0 |
x1 counts down 3 to 0, taking the backward branch twice before the forward branch |
Pass criteria: 10 cycle operation
Final result:
1.29 — reset_while_running
Functionality: rst_i asserted partway through a running program
Initial state:
- Registers: none
- Data memory: none
- Other setup: none
Program:
prog = '{
asm_instr(.op(OP_ADDI), .rd(1), .rs1(0), .imm(1)),
asm_instr(.op(OP_ADDI), .rd(1), .rs1(1), .imm(1)),
asm_instr(.op(OP_ADDI), .rd(1), .rs1(1), .imm(1)),
asm_instr(.op(OP_ADDI), .rd(1), .rs1(1), .imm(1)),
EBREAK_WORD
};
drv.reset_task();
seqr.load_program(prog);
seqr.wait_for_empty();
repeat (2) @(cpu_if.cb);
drv.start_cpu();
repeat (2) @(cpu_if.cb);
cpu_if.cb.reset <= 1;
repeat (4) @(cpu_if.cb);
cpu_if.cb.reset <= 0;
repeat (2) @(cpu_if.cb);
readback(2, 1, 1);
Expected result:
| Register or memory word | Expected value | Calculation or explanation |
|---|---|---|
x1 (external read) |
32'h0 |
reset clears the register file even though x1 was nonzero |
Pass criteria: external read of x1 returns 0 after reset
Final result:
1.30 — external_halt
Functionality: halt_cpu_i pulsed partway through a running program
Initial state:
- Registers: none
- Data memory: none
- Other setup: 32 instruction loop so execution remains when halt is pulsed
Program:
logic [31:0] long_prog [$];
for (int i = 0; i < 32; i++) begin
long_prog.push_back(asm_instr(.op(OP_ADDI), .rd(1), .rs1(1), .imm(1)));
end
long_prog.push_back(EBREAK_WORD);
drv.reset_task();
seqr.load_program(long_prog);
seqr.wait_for_empty();
repeat (2) @(cpu_if.cb);
drv.start_cpu();
repeat (12) @(cpu_if.cb);
drv.halt_cpu_now();
readback(2, 1, 1);
Expected result:
| Register or memory word | Expected value | Calculation or explanation |
|---|---|---|
cpu_active |
0 |
halt_cpu_now() waits for cpu_active to deassert before returning |
x1 |
less than 32'h20 |
partial count reached before the halt |
Pass criteria: cpu_active deasserts within xbar_timeout window and x1 is lower than 32
Final result:
1.31 — isram_boundary_words
Functionality: external port access to the first and last ISRAM words
Initial state:
- Registers: none
- Data memory: none
- Other setup: none
Program:
drv.reset_task();
seqr.send_write_trans(word_addr(ISRAM_BASE, 0), asm_instr(.op(OP_ADDI), .rd(1), .rs1(0), .imm(5)));
seqr.send_write_trans(word_addr(ISRAM_BASE, 1023), EBREAK_WORD);
seqr.wait_for_empty();
repeat (2) @(cpu_if.cb);
readback(0, 1, 0);
readback(0, 1, 1023);
Expected result:
| Register or memory word | Expected value | Calculation or explanation |
|---|---|---|
isram[0] |
encoding of addi x1, x0, 5 |
first instruction word, addr 14'h0 |
isram[1023] |
32'h00100073 |
last instruction word, addr 14'h0FFC |
Pass criteria: both reads return the written values with no aliasing between word 0 and word 1023
Final result:
1.32 — dsram_boundary_words
Functionality: external port access to the first and last DSRAM words
Initial state:
- Registers: none
- Data memory: none
- Other setup: none
Program:
drv.reset_task();
seqr.send_write_trans(word_addr(DSRAM_BASE, 0), 32'hA5A5A5A5);
seqr.send_write_trans(word_addr(DSRAM_BASE, 1023), 32'h5A5A5A5A);
seqr.wait_for_empty();
repeat (2) @(cpu_if.cb);
readback(1, 1, 0);
readback(1, 1, 1023);
Expected result:
| Register or memory word | Expected value | Calculation or explanation |
|---|---|---|
dmem[0] |
32'hA5A5A5A5 |
first data word, addr 14'h1000 |
dmem[1023] |
32'h5A5A5A5A |
last data word, addr 14'h1FFC |
Pass criteria: both reads return the written values with no aliasing between word 0 and word 1023
Final result:
1.33 — external_register_boundary_reads
Functionality: external, read-only register-file port access to x0 and x31
Initial state:
- Registers: none
- Data memory: none
- Other setup: none
Program:
prog = '{
asm_instr(.op(OP_ADDI), .rd(31), .rs1(0), .imm(-1)),
EBREAK_WORD
};
drv.reset_task();
seqr.load_program(prog);
seqr.wait_for_empty();
repeat (2) @(cpu_if.cb);
drv.run_program();
readback(2, 1, 0);
readback(2, 1, 31);
Expected result:
| Register or memory word | Expected value | Calculation or explanation |
|---|---|---|
x31 |
32'hFFFFFFFF |
external read returns value written into x31 |
Pass criteria: 2 cycle program plus two external reads, both matching the register file's contents
Final result:
2. Constrained-random tests
Instruction constraints
| Constraint | Provided, partial, or open | Behavior and purpose | Final implementation summary |
|---|---|---|---|
c_opcode |
Provided | use only opcodes implemented | No member change |
c_reg_bias |
Provided | encourage more reg-reg collisions, test x0 r/w | No member change |
c_imm_range |
Partial | use only immediates that fit into instruction | separate imm_range for I/S and B types |
c_mem_align |
Open | keep load/store effective addresses legal | constrain reg_snapshot[rs1] + imm to be word-aligned and within DSRAM |
c_imm_unused |
Provided | set imm to zero if not used in instr | No member change |
c_branch_target |
Partial | keep the target within the program mem | % 4, ≥ 4, <prog len |
c_no_branch_at_end |
Provided | prevent branching at the end of the program | No member change |
c_branch_taken_bias |
Open | bias rs1/rs2 to being equal values to eachother | weight rs1/rs2 values to encourage equal values |
External-port constraints
| Constraint | Provided, partial, or open | Behavior and purpose | Final implementation summary |
|---|---|---|---|
c_align |
Provided | word align instr | No member change |
c_valid_window |
Partial | ensure addr is inside register file | restrict to 32 entries |
c_reg_read_only |
Provided | do not write to reg via port | No member change |
c_data_corners |
Open | bias towards specific data values to test | all 1s, all 0s, checkerboard, etc |
Random-program test
| Item | Plan |
|---|---|
| Number of programs per seed | 50 |
| Program-length range | 2 ≤ len ≤ 50 |
| Information logged for reproduction | Numeric SVSEED, iteration, and complete generated program |
Implementation outline:
task automatic run_constrained_random_tests();
int min_len = 2;
int max_len = 50;
int max_cycles = 2000;
int dmem_words = 16;
drv.reset_task();
init_memories();
seqr.gen_xbar(NUM_RANDOM_XBAR);
seqr.wait_for_empty();
repeat (2) @(cpu_if.cb);
for (int i = 0; i < NUM_RANDOM_PROGRAMS; i++) begin
int len = $urandom_range(min_len, max_len);
string name = $sformatf("random_gen_%0d_len_%0d", i, len);
sb.set_test(name);
drv.reset_task();
init_memories();
seqr.gen_program(len);
seqr.wait_for_empty();
repeat (2) @(cpu_if.cb);
drv.run_program(max_cycles);
if (drv.last_run_completed) begin
readback(2, REG_COUNT);
readback(1, dmem_words);
end else begin
$display($stime, " TB: Skipping %s readback after CPU timeout\n", name);
drv.reset_task();
end
end
endtask : run_constrained_random_tests
3. Assertions
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 |
3.1 — X0_REMAINS_0
Timing requirement in words: on every clock pulse, check that x0 is 0
X0_REMAINS_0:
assert property (@(posedge clk) disable iff (rst)
dut.register_crossbar[0] == 32'b0)
else assertion_fail("x0 is nonzero");
Evidence that it detects a violation:
3.2 — STABLE_WHEN_DISABLED
Timing requirement in words: when the CPU is disabled or inactive, the PC and register file should not change
STABLE_WHEN_DISABLED :
assert property (@(posedge clk) disable iff (rst)
(!cpu_if.en_cpu || !cpu_if.cpu_active) |=> ($stable(
dut.register_crossbar
)))
else assertion_fail("register file/pc changed while cpu inactive");
Evidence that it detects a violation:
4. Encrypted CPU Bug Hunt
Random discovery
4.1 Bug 1 - Duplicate Store
| 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:
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);
Expected vs. actual
| Instruction / event | Expected | Actual | Cycle/time |
|---|---|---|---|
| sw x1, 1004(x1) | 0x00000000 | 0x00000000 (stored twice) |
First architectural divergence: duplicate SW when one is expected, seems to happen when branch is taken
Minimization
Minimized reproducer:
prog = '{
asm_instr(.op(OP_SW), .rs1(0), .rs2(0), .imm(1004)),
asm_instr(.op(OP_BEQ), .rs1(0), .rs2(0), .imm(8)),
asm_instr(.op(OP_ADDI), .rd(1), .rs1(0), .imm(1)),
EBREAK_WORD
};
Waveform evidence
Include a screenshot showing the offending instruction and the first incorrect architectural result.
Conclusion
Trigger: sw + beq
Expected behavior: one single sw and beq is successful
Observed behavior: sw is counted twice, while the scoreboard only expects one store
Behavioral characterization: the cpu holds write enable high for more than one cycle, leading to two stores
4.2 Bug 2 - Incorrect Store Addr
| Field | Evidence |
|---|---|
| Discovery command | make bug_hunt SEED=random |
Numeric SVSEED |
3333 |
| Failing iteration | 0 |
| First failure message | store #2 wrote dmem[0x17d] = 0x00000000, expected dmem[0x233] = 0x00000000 |
| Reproduction command | make bug_hunt SEED=3333 |
| Reproduces consistently? | Yes |
Original failing program:
prog = '{
asm_instr(.op(OP_ADD), .rd(2), .rs1(5), .rs2(3)),
asm_instr(.op(OP_ADD), .rd(18), .rs1(1), .rs2(2)),
asm_instr(.op(OP_SLL), .rd(15), .rs1(1), .rs2(3)),
asm_instr(.op(OP_ADDI), .rd(2), .rs1(12), .imm(1703)),
asm_instr(.op(OP_SRL), .rd(4), .rs1(12), .rs2(0)),
asm_instr(.op(OP_SLL), .rd(6), .rs1(28), .rs2(7)),
asm_instr(.op(OP_ADD), .rd(6), .rs1(1), .rs2(6)),
asm_instr(.op(OP_SW), .rs1(10), .rs2(4), .imm(1524)),
asm_instr(.op(OP_ADDI), .rd(2), .rs1(7), .imm(1309)),
asm_instr(.op(OP_SLL), .rd(6), .rs1(4), .rs2(7)),
asm_instr(.op(OP_BEQ), .rs1(4), .rs2(1), .imm(8)),
asm_instr(.op(OP_BEQ), .rs1(9), .rs2(6), .imm(36)),
asm_instr(.op(OP_SRL), .rd(24), .rs1(0), .rs2(13)),
asm_instr(.op(OP_ADDI), .rd(1), .rs1(7), .imm(2039)),
asm_instr(.op(OP_ADD), .rd(4), .rs1(5), .rs2(6)),
asm_instr(.op(OP_ADD), .rd(6), .rs1(22), .rs2(2)),
asm_instr(.op(OP_SLL), .rd(6), .rs1(12), .rs2(4)),
asm_instr(.op(OP_BEQ), .rs1(6), .rs2(6), .imm(64)),
asm_instr(.op(OP_SW), .rs1(6), .rs2(3), .imm(496)),
asm_instr(.op(OP_BEQ), .rs1(11), .rs2(3), .imm(108)),
asm_instr(.op(OP_ADD), .rd(10), .rs1(0), .rs2(29)),
asm_instr(.op(OP_ADD), .rd(5), .rs1(9), .rs2(5)),
asm_instr(.op(OP_SLL), .rd(10), .rs1(4), .rs2(17)),
asm_instr(.op(OP_SUB), .rd(27), .rs1(0), .rs2(5)),
asm_instr(.op(OP_BEQ), .rs1(14), .rs2(1), .imm(48)),
asm_instr(.op(OP_BEQ), .rs1(19), .rs2(7), .imm(76)),
asm_instr(.op(OP_SRL), .rd(3), .rs1(2), .rs2(2)),
asm_instr(.op(OP_LW), .rd(7), .rs1(0), .imm(828)),
asm_instr(.op(OP_SRL), .rd(3), .rs1(3), .rs2(23)),
asm_instr(.op(OP_SRL), .rd(0), .rs1(3), .rs2(15)),
asm_instr(.op(OP_ADDI), .rd(6), .rs1(4), .imm(997)),
asm_instr(.op(OP_LW), .rd(14), .rs1(2), .imm(-1297)),
asm_instr(.op(OP_BEQ), .rs1(5), .rs2(7), .imm(56)),
asm_instr(.op(OP_SUB), .rd(0), .rs1(7), .rs2(0)),
asm_instr(.op(OP_ADD), .rd(5), .rs1(6), .rs2(2)),
asm_instr(.op(OP_SLL), .rd(4), .rs1(15), .rs2(1)),
asm_instr(.op(OP_LW), .rd(4), .rs1(0), .imm(1576)),
asm_instr(.op(OP_SLL), .rd(9), .rs1(7), .rs2(7)),
asm_instr(.op(OP_SLL), .rd(4), .rs1(1), .rs2(2)),
asm_instr(.op(OP_SRL), .rd(9), .rs1(7), .rs2(1)),
asm_instr(.op(OP_ADD), .rd(6), .rs1(6), .rs2(7)),
asm_instr(.op(OP_SUB), .rd(7), .rs1(6), .rs2(28)),
asm_instr(.op(OP_ADD), .rd(5), .rs1(24), .rs2(6)),
asm_instr(.op(OP_ADDI), .rd(4), .rs1(4), .imm(765)),
asm_instr(.op(OP_SRL), .rd(2), .rs1(3), .rs2(4)),
asm_instr(.op(OP_BEQ), .rs1(6), .rs2(4), .imm(12)),
asm_instr(.op(OP_SUB), .rd(23), .rs1(0), .rs2(12)),
asm_instr(.op(OP_SLL), .rd(2), .rs1(4), .rs2(24)),
asm_instr(.op(OP_SW), .rs1(1), .rs2(3), .imm(213)),
EBREAK_WORD
};
run_directed("incorrect_store_bug", prog);
Expected vs. actual
| Instruction / event | Expected | Actual | Cycle/time |
|---|---|---|---|
| sw x1, 1004(x1) | 0x00000000 | 0x00000000 (stored twice) |
First architectural divergence: 17d is the computed addr to store into, which is not what the scoreboard is expecting
Minimization
Minimized reproducer:
prog = '{
asm_instr(.op(OP_ADDI), .rd(1), .rs1(0), .imm(2039)),
asm_instr(.op(OP_SW), .rs1(1), .rs2(0), .imm(213)),
EBREAK_WORD
};
run_directed("sw_addr_carry_bit8_orig", prog);
prog = '{
asm_instr(.op(OP_ADDI), .rd(1), .rs1(0), .imm(252)),
asm_instr(.op(OP_SW), .rs1(1), .rs2(1), .imm(8)),
EBREAK_WORD
};
run_directed("sw_addr_carry_bit8_aligned", prog);
prog = '{
asm_instr(.op(OP_ADDI), .rd(1), .rs1(0), .imm(100)),
asm_instr(.op(OP_SW), .rs1(1), .rs2(1), .imm(8)),
EBREAK_WORD
};
run_directed("sw_addr_no_carry_control", prog);
prog = '{
asm_instr(.op(OP_ADDI), .rd(1), .rs1(0), .imm(255)),
asm_instr(.op(OP_ADDI), .rd(2), .rs1(1), .imm(1)),
asm_instr(.op(OP_SW), .rs1(0), .rs2(2), .imm(0)),
EBREAK_WORD
};
run_directed("alu_carry_bit8", prog);
Waveform evidence
Include a screenshot showing the offending instruction and the first incorrect architectural result.
!
Conclusion
Trigger: sw + beq
Expected behavior: one single sw and beq is successful
Observed behavior: sw is counted twice, while the scoreboard only expects one store
Behavioral characterization: the cpu holds write enable high for more than one cycle, leading to two stores

