Uploaded by Vishal Katigar

New Text Document

advertisement
// Code your testbench here
// or browse Examples
class comp1;
mailbox#(int) m_box;
task send();
begin
int i=5;
m_box.put(i);
end
endtask
endclass
class comp2;
mailbox#(int) m_box;
task receive();
begin
int i;
m_box.get(i);
$display("data from comp1 = %d",i);
end
endtask
endclass
module
mailbox#(int) m_box = new();
comp1 comp1_h = new();
comp2comp2_h = new();
initial begin
comp1_h.m_box = m_box;
comp2_h.m_box = m_box;
fork
comp1_h.send();
comp2_h.receive();
join
end
endmodule
Download