我正在学习UVM教程的基础知识.我读到的任何地方总是从事务对象扩展uvm_sequence_item而不是uvm_transaction因为uvm_sequence_item有事务ID等其他功能.如果是这样的话,为什么uvm_transaction类甚至在UVM类层次结构中呢?
uvm_transaction除了uvm_sequence_item延伸之外,谁在使用?
是因为遗产吗?
我正在努力通过约束检查我对多态性的理解.我写了一个示例代码
class parent;
rand int unsigned a;
constraint a_c { a < 1000;}
function print();
$display("The randomized data is %d\n", a);
endfunction
endclass
class child extends parent;
constraint a_c { a > 50;}
endclass
module m;
child c = new();
initial begin
c.randomize();
c.print;
end
endmodule
Run Code Online (Sandbox Code Playgroud)
输出是
The randomized data is 2567677
Run Code Online (Sandbox Code Playgroud)
这里出了什么问题?
我参加了一个代码编写的面试,我不得不预测代码的输出.
int foo() {
int a;
a = 5;
return a;
}
void main() {
int b;
b = foo();
printf ("The returned value is %d\n", b);
}
Run Code Online (Sandbox Code Playgroud)
答案对我来说是如此明显,我回答了5.但是面试官说答案是不可预测的,因为函数会在返回后从堆栈中弹出.有人可以在此澄清我吗?