Atanu Mondal
page

Projects

I'm in my first semester, and the testbenches are the point. The RTL is my playground for practising verification.

methodology.vcdStill climbing

The verification ladder

Each project is one rung up. I started with directed tests and I'm now writing UVM, all in my first semester.

  1. 1

    Directed tests

    Hand-written stimulus for small blocks such as adders, counters and a traffic light.

    basics
  2. 2

    Constrained-random and coverage

    My first time with rand, constraints, covergroups and interfaces.

    4-bit ALU
  3. 3

    Layered testbench

    Generator, driver, monitor and scoreboard in classes, wired with mailboxes.

    Shift registerAlarm clock
  4. 4

    UVM

    Agent, sequencer, scoreboard with a reference model, coverage and assertions.

    UART
  5. 5

    UVM across a protocol

    An environment that grows block by block until it verifies I2C.

    I2C
uart.sv4UVMVerified in loopback

UART TX/RX, verified with UVM

The UVM testbench is the real project here. The UART is a parameterized transmitter and a 16x-oversampling receiver, and it gives me something small enough to run my UVM skills on: a driver, a sequencer, two monitors, a scoreboard with a reference model and coverage, plus SystemVerilog assertions on the interface.

It has two modes. In loopback the TX feeds the RX. In bit-bang mode the testbench drives the RX line itself, which injects a bad stop bit to test rx_error and scales the bit period to check the baud-rate tolerance.

My simulator, Questa Starter Edition, has no randomize() or covergroup, so the stimulus uses $urandom_range and the coverage is counted by hand in a uvm_subscriber.

Language
SystemVerilog, UVM
Framing
8N1 at 115200 baud, 100 MHz clock
Checks
Scoreboard, 6 assertions with cover properties, hand-coded coverage
View the repository

loopback result

1000of 1000 passed

  • failures0
  • coverage100%
  • corner values6 of 6

bit-bang: one frame, stop bit forced low

  1. S
  2. D0
  3. D1
  4. D2
  5. D3
  6. D4
  7. D5
  8. D6
  9. D7
  10. P

The red stop bit is the injected error. The receiver should raise rx_error and leave rx_data alone.

testbench tree

uvm_test
└─ env
   ├─ agent
   │  ├─ driver
   │  ├─ sequencer
   │  └─ monitor ×2  tx and rx
   ├─ scoreboard  reference model
   └─ coverage  uvm_subscriber
alu_cdv2Constrained-randomComplete

4-bit ALU, my first coverage-driven testbench

This was the first time I touched advanced verification methodology. Constrained-random stimulus, coverage-driven verification and interfaces were all new to me, and I used them together in one testbench for a 4-bit ALU.

A randomizer class holds the random fields, a weighted opcode distribution and a covergroup with cross coverage. A reference model inside the testbench checks every result.

Language
SystemVerilog
Design
Add, subtract, AND and OR, with carry, zero and negative flags
Checking
Self-checking, cross coverage
View the repository

first time using, all in one testbench

  • rand
  • constraint
  • dist
  • covergroup
  • cross
  • interface
  • class
  • task

functional coverage

100%

  • randomized transactions5000
  • errors0

The sequel, alu-uvm-style, splits the same testbench into layered classes.

usr_tb3Layered testbenchComplete

Universal shift register testbench

A class-based testbench for a universal shift register. The interesting part was a two-cycle sampling latency caused by clocking-block skew. I fixed it by priming the monitor's edge and adding a two-stage input history buffer.

Language
SystemVerilog
Stimulus
Randomized with $urandom_range
Coverage
85 hand-coded coverage bins
View the repository

modes covered

  • Hold
  • Shift right
  • Shift left
  • Parallel load

85 bins, all covered

  • other signals46
  • p_in values16
  • p_out values16
  • modes4
  • reset, serial in3
  • transactions passed5000
  • failed0

The scoreboard flagged mismatches that weren't real bugs. The design was right and my checking was two cycles out of step.

alarm_clock3Layered testbenchIn progress

Digital alarm clock

A digital alarm clock that I built from a spec sheet with no reference design: seven RTL modules around a controller FSM. The main branch is fully runnable.

The testbench is UVM-style without the UVM library, with a generator, driver, monitor, scoreboard and coverage collector connected by mailboxes. I'm doing it this way so I understand what UVM does underneath. The last two features are being built on a separate branch.

Language
SystemVerilog
Design
Seven RTL modules, 256 Hz clock with a fast-watch mode
Verification
Class-based, mailbox-connected
View the repository

branches

  • mainDesign runs end to end
  • feature branchThe last two features

coverage bins on main

  • Hit: reset
  • Hit: fast watch
  • Not hit yet: time button
  • Not hit yet: alarm button

The red bins are not hit yet. They are the next thing I'm closing.

  • transactions passed1500
  • failed0
  • total coverage50%
i2c-building-blocks5UVM across a protocolIn progress

I2C, built block by block

I'm building the whole I2C protocol one block at a time, one block a week. Each block gets its own self-checking testbench for now.

The main attraction is still ahead: a UVM verification environment that verifies the complete protocol, growing as the blocks do.

Language
SystemVerilog
Control
FSM with IDLE, LOAD, SHIFT and DONE states in the shift register
View the repository

roadmap

  1. Done: Week 1 Open-drain bus pad, all 4 input combinations pass
  2. Done: Week 2 Shift register, 116 checks, 0 errors
  3. Left: Week 3 Protocol FSM
  4. Left: Week 4 Address matcher
  5. Left: The main attraction The UVM verification environment for the whole protocol

i2c_shift_register

i2c_shift_ register clk rst_n load shift_en direction p_data_in s_data_in p_data_out s_data_out byte_done

More testbenches, including a priority encoder, a decoder and a FIFO buffer, are in SystemVerilog-Workspace.