01
Paged and Alternate View registers in UVM Kirti SrivastavaHarshit Kumar Baghel © Accellera Systems Initiative 1<br>
02
Agenda Introduction
Usage of Paged Register
Example
Usage of Alternate View Register
Example
UVM Model of Paged Register
UVM Model of Alternate View Register
HDL_PATH in UVM RAL © Accellera Systems Initiative 2<br>
03
Introduction Paged registers and alternate views of registers are often used in embedded systems.
Paged registers are important for maintaining context in systems.
Alternate View registers are also called Modal registers where the definition of the register changes based on a mode bit.
To ensure correct RTL implementation, a corresponding correct UVM register model implementation is also required. © Accellera Systems Initiative 3<br>
04
Introduction Contd. Such a UVM implementation is not readily available in the industry publications.
Approach to deal with these types of registers has been discussed. © Accellera Systems Initiative 4<br>
05
Usage of Page Register Main usage of Paged register is for context switching.
Paged register is a set of registers sharing same physical address and another selector register which is used to decide which out of them is actually accessed
Embedded systems also have paged blocks.
These are a set of registers which are paged -that is, each page has a set of registers. © Accellera Systems Initiative 5<br>
06
Logical Diagram of Page Register © Accellera Systems Initiative 6<br>
07
Usage of Alternate View Register A single register at a particular physical address with two or more views
Based on an execution mode, one of several view is selected. © Accellera Systems Initiative 7<br>
08
Example of Alternate View Register A 32 bit register is interpreted as 4 8-bit field in ModeA, whereas in ModeB the same register is interpreted as 2 16-bit field. © Accellera Systems Initiative 8<br>
09
UVM Model of Paged register Register Abstraction Layer(RAL) in UVM is an efficient way of properly verifying the registers.
UVM gives enough flexibility to implement these types of registers
An extra attribute for no. of context register (i.e. page_count in our case) is passed in the object to provide the information for the bus transaction.
We define a function in the block class, which takes the argument count. This argument is used as data to write in the select register. After writing it in the select register, this argument is used as the index of the paged register. © Accellera Systems Initiative 9<br>
10
UVM Model of Paged registercont…. © Accellera Systems Initiative 10 task pagereg_pagedWrite(uvm_reg_data_t count,uvm_reg_sequence parent_seq);
uvm_status_e status;
select.Fld.write(status, count, .path(UVM_FRONTDOOR), .map(default_map), .parent(parent_seq));
pagereg[count].write(status, 32'ha, .path(UVM_FRONTDOOR), .map(default_map), .parent(parent_seq));
pagereg[count].mirror(status, UVM_CHECK, .path(UVM_FRONTDOOR), .map(default_map), .parent(parent_seq));
endtask<br>
11
UVM Model of Paged registercontd….. This function is called in the simulation environment for all the index of the paged register. © Accellera Systems Initiative 11 foreach (block.pagereg[pagereg_i])
begin
uvm_reg_map default_map;
uvm_status_e status;
uvm_reg_data_t wrdata, rddata;
…
block.pagereg_pagedWrite(pagereg_i,this);
config_pkg::uvm_global_current_seq = "";
end<br>
12
HDL_PATH in UVM RAL Hdl path of paged register is simply a reg which stores the value of all instances depending on which instance is selected. © Accellera Systems Initiative 12 foreach (pagereg[pagereg_i])
begin
pagereg[pagereg_i].clear_hdl_path();
pagereg[pagereg_i].add_hdl_path_slice("pagereg_Fld_q", 0, 32);
end<br>
13
UVM Model of Alternate View register © Accellera Systems Initiative 13 The solution of Alternate view register is based on virtual registers and modelling the physical register as a memory, because in UVM virtual registers are used to define a memory layout.
We have mapped two virtual registers with single physical memory based on a mode variable. The mode variable can be set and read from the config_db.<br>
14
UVM Model of Alternate View registercontd…. Counter is a regmodel of register in execution modeA and col_row is a register of modeB © Accellera Systems Initiative 14 //Function : build
virtual function void build();
//create
counter = block1_vreg1::type_id::create(“counter”);
col_row = block1_vreg1::type_id::create(“Col_row”);
mem = block1_mem::type_id::create(“mem”);
//config
mem.configure(this,”inst.Stack”);
counter.configure(this,null,1);
col_row.configure(this,null,1);<br>
15
UVM Model of Alternate View registercontd…. While in the simulation, based on the execution mode, the virtual register is implemented.
In all the case, the transactions in the virtual register is basically on the memory. © Accellera Systems Initiative 15 if (mem != null) begin
if (mode==A) begin
vregs=blk.get_vreg_by_name(“counter”);
end
else
begin
vregs=blk.get_vreg_by_name(“col_row”);
end
vregs.implement(1,mem);
end<br>
16
Result Based on the above approach, we were able to build these special registers in UVM.
Issue with HDL_PATH for Alternate register :
Backdoor access is not working currently © Accellera Systems Initiative 16<br>
17
Conclusion UVM model is flexible enough to describe any quirky registers.
We can change the model and the Register abstraction layer according to verification needs.
The inclusion of the Extension Object for register methods provides a flexible way to communicate any type of data across the UVM RAL.
We have shown how to create UVM reg model for Paged registers and alternate view registers. © Accellera Systems Initiative 17<br>
18
References Comprehensive Register dictionary by Agnisys:
http://agnisys.com/crd
K. Shimizu, “UVM Tutorial for Candy Lovers – 9. Register Abstraction”. 2010.
http://cluelogic.com/2012/10/uvm-tutorial-for-candy-lovers-register-abstraction.
Verification Academy.
https://verificationacademy.com/cookbook/registers
Universal Verification Methodology (UVM) 1.1 User’s Guide © Accellera Systems Initiative 18<br>
19
QuestionsWhat quirky registers have you seen? © Accellera Systems Initiative 19<br>
Show all 19 slides