Protected Course Page
Enter the password to view Day 27 of the UVM 30-Day plan.
Day 27: Capstone Project (Day 1 of 3) — DUT Selection and Testbench Architecture
A 30-day SystemVerilog/UVM verification series. Twenty-six days of building blocks. Three days of putting them all together. Today, the plan. Tomorrow, the code. The day after, the proof.
The capstone is not a new topic. It is the moment the previous 26 days either work as a whole or don't. Every mechanism you have learned — agents, sequences, scoreboard, coverage, RAL, virtual sequencer, drain time, regression — has to fit into one testbench without breaking any of the others. That is what a real UVM project is, and it is why the capstone is three days, not one.
Today is architecture. No code worth writing yet, except the skeleton and the plan. The testbench you build tomorrow is only as good as the decisions you make today.
1. DUT Selection
Three candidates, in increasing complexity. Choose one; you can extend the same structure to a bigger DUT later.
| DUT | Complexity | What it exercises from the course |
|---|---|---|
| APB UART | Medium | Bus protocol, register file, data path, error conditions, parity, baud rate |
| GPIO Controller | Low–Medium | Register file, interrupts, pin muxing, edge detection |
| FIFO with APB register interface | Low | Everything from Days 1–21, with a clean reference DUT that you can easily break to test the checker |
Pick the one you have the RTL for. If you have all three, the FIFO with APB register interface is the best learning vehicle: it exercises every layer you have built, has well-understood expected behavior (so the model is easy to write correctly), and has enough corner cases (full, empty, wrap-around, reset) to make the coverage model meaningful.
2. The Architecture Diagram
Before writing any code, draw the testbench. The diagram for the FIFO-with-APB-registers capstone looks like this:
┌──────────────────────────────────┐
│ fifo_capstone_test │
│ (chooses sequence, configures) │
└──────────────┬───────────────────┘
│ creates
┌──────────────▼───────────────────┐
│ fifo_capstone_env │
└──┬────────────────┬────────────┬─┘
│ │ │
┌──────────▼──────┐ ┌──────▼──────┐ ┌──▼────────────┐
│ apb_agent │ │ ref_model │ │ reg_scoreboard│
│ (active) │ │ │ │ (analyzes │
│ │ │ │ │ reads/writes)│
│ ┌───────────┐ │ └──────┬──────┘ └──▲─────────────┘
│ │ driver │ │ │ │
│ │ sequencer │ │ │ │
│ │ monitor │──┼─────────┼────────────┘
│ └───────────┘ │ │
└─────────────────┘ │
│ │
│ APB vif │
▼ │
┌───────────────────────┐ │
│ DUT: FIFO + APB regs │ │
└───────┬───────────────┘ │
│ │
│ FIFO data path │
▼ │
┌───────────────────┐ │
│ fifo_data_if │ │
│ (write/read pins)│ │
└───────┬───────────┘ │
│ │
┌───────▼───────────┐ │
│ fifo_data_monitor│───────┘
│ (publishes data │
│ to model/coverage│
│ /scoreboard) │
└───────────────────┘
┌────────────────────┐
│ virtual sequencer │
│ (coordinates apb │
│ and data paths) │
└────────────────────┘
Three observations from the diagram:
- The APB agent drives the register bus. All register reads and writes go through it. RAL connects to its sequencer through the adapter.
- The FIFO data path is separate. It has its own monitor, its own transaction type, and its own coverage. Do not try to shoehorn data-path transactions through the APB monitor.
- The reference model sits between them. It watches APB register writes (e.g., a "push data" write) and predicts what the FIFO data path should emit next.
3. The Component List
Every file you are going to write. This is the build plan for Days 28 and 29.
| File | Layer | Status |
|---|---|---|
apb_if.sv | Interface | From Day 22 |
apb_transaction.sv | Transaction | From Day 22 |
apb_driver.sv, apb_monitor.sv, apb_sequencer.sv, apb_agent.sv | Agent | From Day 22 |
fifo_data_if.sv | Interface | From Day 4 |
fifo_tx.sv | Transaction | From Day 4 |
fifo_data_monitor.sv | Monitor | From Day 4 (no driver needed — the DUT drives the data) |
dut_reg_block.sv, ctrl_reg.sv, status_reg.sv, data_reg.sv | RAL | From Days 15–17 |
apb_reg_adapter.sv | RAL | From Day 22 |
fifo_ref_model.sv | Model | New |
fifo_reg_scoreboard.sv | Checker | From Day 9, adapted |
fifo_data_scoreboard.sv | Checker | From Day 9 |
fifo_capstone_coverage.sv | Coverage | From Day 10, extended |
fifo_capstone_vseqr.sv | Coordinator | From Day 8, extended |
fifo_capstone_seq_lib.sv | Sequences | New |
fifo_capstone_env.sv | Env | New — wires everything |
fifo_capstone_test.sv, fifo_capstone_err_test.sv | Tests | New |
fifo_capstone_tb_top.sv | Top | New |
Roughly forty files, but most of them are one you have written before. The genuinely new work is the reference model, the env wiring, and the top. That is why Days 28–29 are enough time: the rest is assembly.
4. The Register Plan
The register model is the DUT's public API. Write it out before writing the SV. This is the same table the DUT's spec provides, but in the form you will need for the RAL model:
| Offset | Name | Fields | Access | Reset |
|---|---|---|---|---|
| 0x00 | CTRL | EN[0], MODE[2:1], RST[3] | RW | 0x0 |
| 0x04 | STATUS | FULL[0], EMPTY[1], ERR[2] | RO | 0x2 (empty) |
| 0x08 | DATA | DATA[7:0] | WO/RO (push/pop) | 0x0 |
| 0x0C | INT_EN | FULL_EN[0], EMPTY_EN[1], ERR_EN[2] | RW | 0x0 |
| 0x10 | INT_STAT | FULL[0], EMPTY[1], ERR[2] | W1C | 0x0 |
Two subtleties worth checking before Day 28:
- DATA is WO on write (push) and RO on read (pop). This is unusual for
uvm_reg— a single field cannot have different access on read vs. write. The standard trick is to model DATA as two fields (or two registers at the same offset with different access policies). Decide now which approach you will use. - INT_STAT is W1C. Do not model it as RW. If you do, every interrupt-flag test will fail with a mismatch that looks like a DUT bug but isn't.
5. The Sequence Plan
Five sequences, in order of complexity. Each targets a category of bug.
| Sequence | What it proves | Runtime |
|---|---|---|
fifo_reset_seq | All registers reset to spec values. | < 1µs |
fifo_write_read_seq | Write a value, read it back — the data path works. | ~10µs |
fifo_full_seq | Write until FULL asserts; verify STATUS. Then write again and verify the DUT rejects. | ~50µs |
fifo_empty_seq | Read until EMPTY asserts; verify STATUS. Then read again and verify the DUT rejects. | ~50µs |
fifo_wrap_seq | Fill, drain, fill again — the pointer wraps correctly and data is not corrupted. | ~100µs |
The sequence library also includes the standard RAL sequences from Day 20 — uvm_reg_hw_reset_seq, uvm_reg_bit_bash_seq, uvm_reg_access_seq — which you run as-is. Together they form the smoke regression.
6. The Coverage Plan
Coverage is a declaration of intent. Every line below maps to a covergroup bin, and every line corresponds to a real verification goal.
| Coverage goal | Covergroup / bin |
|---|---|
| Write a value, read it back correctly | cross_wr_rd / single_pair |
| Write while FULL | cp_full intersect {1} on push |
| Read while EMPTY | cp_empty intersect {1} on pop |
| Data at extremes (0x00, 0xFF) | cp_wdata / zero, max |
| Data at mid-range | cp_wdata / low, high |
| Pointer wrap-around | cp_wr_ptr / max_to_zero |
| Reset to reset (no data corruption) | cp_reset_after_data |
| Concurrent write+read | cross_wr_rd / simultaneous |
Eight goals. If the DUT's spec says any of these are legal, all eight must be closed. If a spec line is absent from the coverage plan, the coverage is incomplete.
7. What Day 28 Will Add
Tomorrow: Capstone Project (Day 2 of 3) — Build. You will implement the file list above, start with the DUT and the interfaces, then the agent and monitor, then the scoreboards and reference model, and get a smoke test running by end of day. The wiring is the hard part; individual components are already familiar.
8. Quiz
Ten questions on capstone planning — architecture, register model, sequences, coverage.
Coming Up Next: Day 28 — Capstone Project (Day 2 of 3) — Build
- Assemble the file list — top module, interfaces, agent, monitor, transactions.
- Build the register model and adapter — connect RAL to the APB agent.
- Wire the reference model — between APB writes and the FIFO data path.
- Get the smoke test passing — one write, one read, clean log.
Series: 30 days of SystemVerilog/UVM verification. Day 27's capstone plan.
No comments:
Post a Comment