我收到此错误,以下错误,据我所知,根据此错误消息,我将访问一个空对象。
Error-[NOA] Null object access
generator.sv, 23
The object at dereference depth 1 is being used before it was
constructed/allocated.
Please make sure that the object is allocated before using it.
class generator;
transaction trans;
mailbox gen2driv;
// event ended;
function new(mailbox gen2driv);
this.gen2driv = gen2driv;
endfunction
task main();
repeat(4) begin
trans = new();
trans.randomize();
if(!trans.randomize()) $display("generator ransomize failed");
trans.display("[generator]");
gen2driv.put(trans);
// -> ended;
end
endtask
endclass
您正在向生成器的构造函数传递一个来自环境的空对象:
class environment;
// transaction trans;
generator gen;
driver driv;
monitor mon;
scoreboard scb;
mailbox gen2driv;
mailbox mon2scb;
virtual intf vif;
function new(virtual intf vif);
this.vif = vif;
gen = new(gen2driv);
driv = new(vif,gen2driv);
mon = new(vif,mon2scb);
scb = new(mon2scb);
endfunction
^^^ 来自您的代码:https://www.edaplayground.com/x/Qv9e