This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module mbox(); | |
import types::*; | |
mailbox exp_mb = new(); | |
mailbox act_mb = new(); | |
task stimulus(); | |
packet stim_pkt; | |
packet falsePacket; | |
for (int i = 0; i < 256; i++) begin | |
stim_pkt.pid = i; | |
falsePacket.pid = i; | |
if(i == 250) | |
falsePacket.pid = stim_pkt.pid + 1; | |
exp_mb.put(stim_pkt); | |
act_mb.put(falsePacket); | |
$display("Sending pkt: %0d",i); | |
end | |
endtask | |
task checker1(); | |
packet a,b; | |
bit x; | |
while(1) begin | |
exp_mb.get(a); | |
act_mb.get(b); | |
//$display(a); | |
//$display(b); | |
x = fComp(a,b); | |
//$display(x); | |
if(!x) | |
$display("Packets %0d and %0d not matching!!", a.pid, b.pid); | |
end | |
endtask | |
function bit fComp(input packet s,y); | |
if(s == y) | |
return 1; | |
else | |
return 0; | |
endfunction | |
initial begin | |
fork | |
stimulus(); | |
checker1(); | |
join_none | |
end | |
endmodule |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package types; | |
typedef struct{ | |
int pid; | |
}packet; | |
endpackage |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment