-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patharbiter_2to1_tb.sv
54 lines (45 loc) · 1.06 KB
/
arbiter_2to1_tb.sv
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
`timescale 1ns/1ps
import SystemVerilogCSP::*;
module arbiter_2to1_tb (
);
parameter WIDTH_packet = 57;
parameter FL = 2, BL = 1;
Channel #(.hsProtocol(P4PhaseBD), .WIDTH(WIDTH_packet)) in [1:0] ();
Channel #(.hsProtocol(P4PhaseBD), .WIDTH(WIDTH_packet)) out ();
arbiter_2to1 DUT(
in[0],
in[1],
out
);
logic [WIDTH_packet-1:0] out_data;
integer i,count;
always begin
i = $random();
#FL;
/*
if(i%1 == 0) begin
in[0].Send(count);
count = count + 1;
end
if(i%2 == 1) begin
in[1].Send(count);
count = count + 1;
end
*/
fork
in[0].Send(count);
in[1].Send(count+1);
join
count = count + 2;
end
always begin
out.Receive(out_data);
$display("out data: %d",out_data);
#BL;
end
initial begin
count = 0;
#100;
$stop();
end
endmodule