简体   繁体   English

Specman UVM:write_reg { .field == 2;} 和有什么区别; 和 write_reg_fields?

[英]Specman UVM: What is the difference between write_reg { .field == 2;}; and write_reg_fields?

I'm working with vr_ad package for e.我正在为 e 使用vr_ad包。 My question is: What is the difference between 2 following macros for modifying registers (suppose foo register consists of 2 fields: field1 and field2 ):我的问题是:以下用于修改寄存器的 2 个宏之间有什么区别(假设foo寄存器包含 2 个字段: field1field2 ):

1) 1)

write_reg foo {.field1 == 1;};

2) 2)

write_reg_fields foo {.field1 = 1};

I really appreciate any help我真的很感激任何帮助

There is a very important difference between these forms. 这些形式之间有非常重要的区别。

In the first, the register value will be generated, using all defined constraints, + the constraint you wrote in this action (field1 == 1). 首先,将使用所有定义的约束+您在此操作中编写的约束(field1 == 1)生成寄存器值。 The new generated value will be written to the DUT. 新生成的值将被写入DUT。

In the second code, what you state is that you want to modify only one field of the register - field1. 在第二个代码中,您声明的是只想修改寄存器的一个字段-field1。 What will happen is that vr_ad will get the current value of the register from the e model (the shadow model), change field1 - and will write the new value the the register in the DUT. 将会发生的是,vr_ad将从e模型(影子模型)获取寄存器的当前值,更改field1-并将新值写入DUT中的寄存器。 None of the other register's fields will be changed. 其他寄存器的字段均不会更改。 Also - there is no check that the value you assign to field1 complies with the constraints defined on this register. 另外-不会检查您分配给field1的值是否符合此寄存器上定义的约束。

Lets use it like an example:让我们像例子一样使用它:

foo = 0xA8;
field1 = 0x8;
field2 = 0xA;
  1. will write a totally new value in foo and in RTL, and that value(using your example above where field1 == 1) will be 0x01;将在 foo 和 RTL 中写入一个全新的值,该值(使用上面的示例,其中 field1 == 1)将为 0x01;

  2. will change only that filed you constrained and value of foo in this case will be 0xA1;只会改变你约束的那个文件,在这种情况下 foo 的值将是 0xA1;

But except that I wanted to say that in fist example you could also get the same result by doing following:但除了我想说的是,在第一个示例中,您也可以通过执行以下操作获得相同的结果:

var tem_read_val: uint(bits: 8);
read_reg foo TO tem_read_val;
tem_read_val[3:0] = field1;
write_reg foo read_reg;

=> foo is 0xA1; => foo 是 0xA1;

From the beginning I was not aware of write reg filds, so I had to use something like this.从一开始我就不知道写 reg filds,所以我不得不使用这样的东西。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM