RTL Studio Open IDE

Wiki UVM Sequence-item constraints

Sequence-item constraints

Legal, mixed FIFO (or bus) traffic from rand fields.

UVM stimulus is a uvm_sequence_item with rand fields. Constraints keep traffic legal (no write when full, mix of reads and writes).

flowchart LR
  item[seq_item] --> cz[constraint]
  cz --> seq[sequence]
  seq --> drv[driver]
class fifo_item extends uvm_sequence_item;
  rand bit        we;
  rand bit [7:0]  data;
  constraint c_mix { we dist { 1 := 60, 0 := 40 }; }
  `uvm_object_utils_begin(fifo_item)
    `uvm_field_int(we, UVM_ALL_ON)
    `uvm_field_int(data, UVM_ALL_ON)
  `uvm_object_utils_end
endclass

Layer constraints: item-level legality, sequence-level scenarios (randomize() with {}).

Wrong vs right

Wrong — unconstrained random that never fills the FIFO, then wonder why full coverage is 0.

Right — a flood sequence we == 1 until full, plus a mixed dist for typical traffic.

See also