Friday, April 20, 2018

SPI UVM Adapter

class spi_reg_adapter extends uvm_reg_adapter;
   const string REPORT_TAG = "SPI_REG_ADAPTER";
function new (string name = "spi_reg_adapter");;
    `uvm_info(REPORT_TAG, $sformatf("%m", UVM_NONE)
      provides_responses =1;

virtual function uvm_sequence_item reg2bus (cont ref uvm_reg_bus_op rw);
spi_seq_item spi_req;
spi_req = spi_seq_item::type_id::create("spi_reg");;
spi_req.data_size = 1;
spi_req.address = rw.addr;
if(rw.kind == UVM_READ) begin
    spi_req.cmd_val = 0;
else begin
 spi_req.cmd_val = 1;
 spi_req.data_wr[0] =;
return spi_req;



virtual function void bus2reg (uvm_sequence_item bus_item, cont ref uvm_reg_bus_op rw);
spi_seq_item spi_req;
spi_req = spi_seq_item::type_id::create("spi_reg");

if(!$cast(spi_req, bus_item)) begin

 rw.addr = spi_req.address ;
rw.kind = spi_req.cmd_val? UVM_WRITE: UVM_READ;

if(rw.kind == UVM_READ) begin = spi_req.data_rd[0];

if(rw.kind == UVM_WRITE) begin = spi_req.data_wr[0];
rw.status = UVM_IS_OK;



Tuesday, December 20, 2016


Callback is a method that is executed every time a known event occurs

  •  Testbench notification
  • Access occurs to the memory
  • Packet/Transaction is processed
  • No polling required
Example uses of Callbacks
  • End to end checking of data from testbench to DUT to testbench
  • Error injection
  • Check for spurious or unnecessary transactions
  • Collect functional coverage statistics 

Thursday, August 18, 2016

Verification goal

The goal of verification is complete testing the design according to specification with the highest quality in the shortest period of time.

Environment creation and testcase development
Finding bugs in early stage
Mixedsignal, Clock and reset

Functional Coverage

  • FC is watchdog and extra check 
  •  Checks both Design and its Verification Qualities 
  • helps develop new testcases for verification completeness 
To implement Functional Coverage we need to understand Design Spec 

Sunday, April 24, 2016

SV constraint example

Constraint c_valid_rate;

constraint phyFrameRandFullSeq::c_valid_rate {
    Solve mPktType before mBaseRate;
if (mPktType == WIFIDOT) {
 mBaseRate inside {1, 2, 5, 11};
} else if(mPktType == WIFIDOT1) {
mBaseRate inside { 6,12, 18} ;