I am trying an example in SV language on edaplayground. I am putting some transactions into the mailbox using the put() method while taking the same transactions using get() method I am not receiving anything. Can someone please help me where I am getting wrong?
class transactions;
randc bit[3:0] i1;
randc bit[1:0] sel;
bit out;
endclass
class generator;
integer i;
transactions trans;
mailbox mbx;
event done;
function new(mailbox mbx);
this.mbx = mbx;
//this.done = done;
endfunction
task gen_task();
trans = new();
for(i=0;i<15;i++) begin//{
assert(trans.randomize()) begin //{
$display("Randomization successful");
end//}
mbx.put(trans);
$display("Stimuli generation completes");
$display("[GEN]The value of inputs are as follows = %b and select line = %b",trans.i1, trans.sel);
end//}
->done;
#1;
endtask
endclass
class driver;
transactions trans;
mailbox mbx;
function new(mailbox mbx);
this.mbx = mbx;
endfunction
task drv_task();
forever begin
trans = new();
mbx.get(trans);
$display("[DRV] The value of outputs are as follows = %b and select line = %b",trans.i1, trans.sel);
end
#1;
endtask
endclass
module tb;
generator gen;
driver drv;
mailbox mbx;
initial begin
gen = new(mbx);
drv = new(mbx);
mbx = new();
fork
gen.gen_task();
#1
drv.drv_task();
join
end
endmodule