-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathencoder_tb.v
57 lines (37 loc) · 1.4 KB
/
encoder_tb.v
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
55
56
57
`timescale 1ns/1ps
module encoder_tb;
//inputs and outputs
reg r0out, r1out, r2out, r3out, r4out, r5out, r6out, r7out, r8out, r9out, r10out, r11out, r12out, r13out, r14out, r15out, HIout, LOout, Zhighout, Zlowout, PCout, MDRout, In_Portout, Cout;
wire [4:0] s;
integer i;
//instantiate module for testing
//module encoder (r0out, r1out, r2out, r3out, r4out, r5out, r6out, r7out, r8out, r9out, r10out, r11out, r12out, r13out, r14out, r15out, HIout, LOout, Zhighout, Zlowout, PCout, MDRout, In_Portout, Cout, S);
encoder encoder_test(.r0out(r0out), .r1out(r1out), .r2out(r2out), .r3out(r3out), .r4out(r4out), .r5out(r5out), .r6out(r6out), .r7out(r7out), .r8out(r8out), .r9out(r9out), .r10out(r10out), .r11out(r11out), .r12out(r12out), .r13out(r13out), .r14out(r14out), .r15out(r15out), .HIout(HIout), .LOout(LOout), .Zhighout(Zhighout), .Zlowout(Zlowout), .PCout(PCout), .MDRout(MDRout), .In_Portout(In_Portout), .Cout(Cout), .S(s));
//init beg block
initial begin
for (i = 0; i <= 5; i = i+1) begin
r0out <= 0;
r1out <= 0;
r2out <= 0;
r3out <= 0;
r4out <= 0;
r5out <= 0;
case (i)
0:
r0out = 1;
1:
r1out = 1;
2:
r2out = 1;
3:
r3out = 1;
4:
r4out = 1;
5:
r5out = 1;
endcase
#10
$display ("Testing Rin = %d: Expecting: %d \n Recieved: %d", i, i, s);
end
end
endmodule