RTL Test Case Design Policy
Purpose
Codifies systematic test case design techniques for deriving test vectors from specifications.
Referenced by testbench-dev and verification orchestrators.
Equivalence Class Partitioning (ECP)
For each input signal:
- Identify valid equivalence classes from uarch spec (e.g., opcode ranges, mode encodings)
- Identify invalid equivalence classes (undefined encodings, reserved ranges)
- Select at least one representative value from each class
- Document:
{input_name: [{class: "valid_normal", range: "0x00-0x0F", representative: "0x05"}, ...]}
Boundary Value Analysis (BVA)
For each integer input of width W:
- Unsigned: test 0, 1, 2^(W-1)-1, 2^(W-1), 2^W-2, 2^W-1
- Signed: test -(2^(W-1)), -(2^(W-1))+1, -1, 0, +1, 2^(W-1)-1
- For address inputs: test base, base+1, top-1, top (alignment boundaries)
- For counter/depth inputs: test 0, 1, depth-1, depth (full/empty conditions)
State Transition Testing
For each FSM defined in uarch spec:
- Extract state list and valid transitions from spec
- Build state transition matrix (source_state x event -> target_state)
- Mandatory tests: all valid transitions (0-switch coverage)
- Recommended: all 1-switch transition pairs (N-1 switch coverage)
- At least one illegal transition attempt per state (verify no state corruption)
- Reset recovery: verify return to spec-defined reset state from every reachable state
Decision Table Testing
For modules with >=3 boolean control inputs:
- Enumerate condition combinations (2^N for N conditions, or reduced set for don't-cares)
- Map each combination to expected action/output
- Generate one test per row (or per distinct action group if rows collapse)
Corner Case Categories (by module type)
Datapath modules
- All-zeros, all-ones input
- Sign extension boundary (MSB toggle)
- Overflow/underflow at arithmetic boundaries
- Back-to-back operations (no idle between)
FSM/Control modules
- Immediate re-trigger after completion
- Simultaneous conflicting requests
- Stall/backpressure at every state boundary
- Timeout/watchdog expiry
Interface modules (valid/ready)
- valid without ready (backpressure, hold >N cycles)
- ready without valid (idle consumption)
- Simultaneous assert/deassert
- Back-to-back transfers (zero-gap throughput)
- Single-beat and max-burst-length transfers
Test Vector Derivation Workflow
- Read uarch spec + io_definition.json
- For each input: apply ECP -> list equivalence classes
- For each integer input: apply BVA -> list boundary values
- For each FSM: extract state transition matrix
- For modules with >=3 boolean controls: build decision table
- Merge results into unified test plan with coverage mapping
- Prioritize: boundary values + state transitions first, then ECP representatives
Anti-Patterns
- "100 random vectors" without coverage goal
- Testing only happy path (no error injection)
- Testing only reset -> single operation -> check (no sustained/stress scenarios)
- Copy-paste test vectors without traceability to spec requirement
1---2name: test-design-policy3description: Internal reference: test design policy (agent-loaded; do not invoke).4---56# RTL Test Case Design Policy78## Purpose910Codifies systematic test case design techniques for deriving test vectors from specifications.11Referenced by testbench-dev and verification orchestrators.1213## Equivalence Class Partitioning (ECP)1415For each input signal:16- Identify valid equivalence classes from uarch spec (e.g., opcode ranges, mode encodings)17- Identify invalid equivalence classes (undefined encodings, reserved ranges)18- Select at least one representative value from each class19- Document: `{input_name: [{class: "valid_normal", range: "0x00-0x0F", representative: "0x05"}, ...]}`2021## Boundary Value Analysis (BVA)2223For each integer input of width W:24- Unsigned: test 0, 1, 2^(W-1)-1, 2^(W-1), 2^W-2, 2^W-125- Signed: test -(2^(W-1)), -(2^(W-1))+1, -1, 0, +1, 2^(W-1)-126- For address inputs: test base, base+1, top-1, top (alignment boundaries)27- For counter/depth inputs: test 0, 1, depth-1, depth (full/empty conditions)2829## State Transition Testing3031For each FSM defined in uarch spec:32- Extract state list and valid transitions from spec33- Build state transition matrix (source_state x event -> target_state)34- Mandatory tests: all valid transitions (0-switch coverage)35- Recommended: all 1-switch transition pairs (N-1 switch coverage)36- At least one illegal transition attempt per state (verify no state corruption)37- Reset recovery: verify return to spec-defined reset state from every reachable state3839## Decision Table Testing4041For modules with >=3 boolean control inputs:42- Enumerate condition combinations (2^N for N conditions, or reduced set for don't-cares)43- Map each combination to expected action/output44- Generate one test per row (or per distinct action group if rows collapse)4546## Corner Case Categories (by module type)4748### Datapath modules49- All-zeros, all-ones input50- Sign extension boundary (MSB toggle)51- Overflow/underflow at arithmetic boundaries52- Back-to-back operations (no idle between)5354### FSM/Control modules55- Immediate re-trigger after completion56- Simultaneous conflicting requests57- Stall/backpressure at every state boundary58- Timeout/watchdog expiry5960### Interface modules (valid/ready)61- valid without ready (backpressure, hold >N cycles)62- ready without valid (idle consumption)63- Simultaneous assert/deassert64- Back-to-back transfers (zero-gap throughput)65- Single-beat and max-burst-length transfers6667## Test Vector Derivation Workflow68691. Read uarch spec + io_definition.json702. For each input: apply ECP -> list equivalence classes713. For each integer input: apply BVA -> list boundary values724. For each FSM: extract state transition matrix735. For modules with >=3 boolean controls: build decision table746. Merge results into unified test plan with coverage mapping757. Prioritize: boundary values + state transitions first, then ECP representatives7677## Anti-Patterns7879- "100 random vectors" without coverage goal80- Testing only happy path (no error injection)81- Testing only reset -> single operation -> check (no sustained/stress scenarios)82- Copy-paste test vectors without traceability to spec requirement