uvm中寄存器模型访问方法的源代码函数
UVM中RAL相关的一些函数
0. 引言
在UVM支持的寄存器操作中,有get、update、mirror、write等等一些方法,在这里整理一下他们的用法。
寄存器模型中的寄存器值应该与DUT保持同步,但是由于DUT的值是实时更新的,所以寄存器模型并不能实时知道这种更新,在寄存器模型中专门有个值来尽可能与DUT中寄存器的值保持一致,叫镜像值(mirrorred value)。寄存器模型中还有一个值叫期望值(respected value),这个值保存我们希望写入寄存器的值。比如希望向DUT某个寄存器写入'h1,用set函数设置期望值,然后用update任务(update会比较镜像值和期望值,如果不一样,将期望值写入DUT,并更新镜像值)。、
read/write/peek/poke/set/get/update/predict/mirror/reset/get_reset/get_mirrored_value/randomize;
1.read
task uvm_reg_field::read(output uvm_status_e status,
output uvm_reg_data_t value,
input uvm_path_e path = UVM_DEFAULT_PATH,
input uvm_reg_map map = null,
input uvm_sequence_base parent = null,
input int prior = -1,
input uvm_object extension = null,
input string fname = "",
input int lineno = 0);
2.write
extern virtual task write (output uvm_status_e status,
input uvm_reg_data_t value,
input uvm_path_e path = UVM_DEFAULT_PATH,
input uvm_reg_map map = null,
input uvm_sequence_base parent = null,
input int prior = -1,
input uvm_object extension = null,
input string fname = "",
input int lineno = 0);
3.peek
extern virtual task peek(output uvm_status_e status,
output uvm_reg_data_t value,
input string kind = "",
input uvm_sequence_base parent = null,
input uvm_object extension = null,
input string fname = "",
input int lineno = 0);
4.poke
task uvm_reg::poke(output uvm_status_e status,
input uvm_reg_data_t value,
input string kind = "",
input uvm_sequence_base parent = null,
input uvm_object extension = null,
input string fname = "",
input int lineno = 0);
5.set
extern virtual function void set(uvm_reg_data_t value,
string fname = "",
int lineno = 0);
6.get
extern virtual function uvm_reg_data_t get(string fname = "",
int lineno = 0);
7.update
extern virtual task update(output uvm_status_e status,
input uvm_path_e path = UVM_DEFAULT_PATH,
input uvm_reg_map map = null,
input uvm_sequence_base parent = null,
input int prior = -1,
input uvm_object extension = null,
input string fname = "",
input int lineno = 0);
8.predict
extern virtual function bit predict (uvm_reg_data_t value,
uvm_reg_byte_en_t be = -1,
uvm_predict_e kind = UVM_PREDICT_DIRECT,
uvm_path_e path = UVM_FRONTDOOR,
uvm_reg_map map = null,
string fname = "",
int lineno = 0);
9.mirror
extern virtual task mirror(output uvm_status_e status,
input uvm_check_e check = UVM_NO_CHECK,
input uvm_path_e path = UVM_DEFAULT_PATH,
input uvm_reg_map map = null,
input uvm_sequence_base parent = null,
input int prior = -1,
input uvm_object extension = null,
input string fname = "",
input int lineno = 0);
10.reset
// Function: reset
//
// Reset the desired/mirrored value for this register.
//
// Sets the desired and mirror value of the fields in this register
// to the reset value for the specified reset ~kind~.
// See <uvm_reg_field.reset()> for more details.
//
// Also resets the semaphore that prevents concurrent access
// to the register.
// This semaphore must be explicitly reset if a thread accessing
// this register array was killed in before the access
// was completed
//
extern virtual function void reset(string kind = "HARD");
11.get_reset
// Function: get_reset
//
// Get the specified reset value for this register
//
// Return the reset value for this register
// for the specified reset ~kind~.
//
extern virtual function uvm_reg_data_t
get_reset(string kind = "HARD");
12.get_mirrored_value
// Function: get_mirrored_value
//
// Return the mirrored value of the fields in the register.
//
// Does not actually read the value
// of the register in the design
//
// If the register contains write-only fields, the desired/mirrored
// value for those fields are the value last written and assumed
// to reside in the bits implementing these fields.
// Although a physical read operation would something different
// for these fields, the returned value is the actual content.
//
extern virtual function uvm_reg_data_t get_mirrored_value(string fname = "",
int lineno = 0);
浙公网安备 33010602011771号