Friday, April 20, 2018

SPI UVM Adapter


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

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.inc=0;
spi_req.data_size = 1;
spi_req.address = rw.addr;
if(rw.kind == UVM_READ) begin
    spi_req.cmd_val = 0;
 end
else begin
 spi_req.cmd_val = 1;
 spi_req.data_wr[0] = rw.data;
end
return spi_req;

endfunction

   

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
 `uvm_fatal()

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

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

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

endfunction


endclass

Tuesday, December 20, 2016

Callbacks

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
Coverage
Finding bugs in early stage
Mixedsignal, Clock and reset
GLS


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} ;
  }
}