forked from CompArchFA17/HW2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdecoder.t.v
More file actions
37 lines (32 loc) · 1.66 KB
/
Copy pathdecoder.t.v
File metadata and controls
37 lines (32 loc) · 1.66 KB
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
// Decoder testbench
//Kimberly Winter 9/23/17
`timescale 1 ns / 1 ps
`include "decoder.v"
module testDecoder ();
reg addr0, addr1;
reg enable;
wire out0,out1,out2,out3;
//behavioralDecoder decoder (out0,out1,out2,out3,addr0,addr1,enable);
structuralDecoder decoder (out0,out1,out2,out3,addr0,addr1,enable); // Swap after testing
initial begin
$dumpfile("decoder.vcd");
$dumpvars(out0,out1,out2,out3,addr0,addr1,enable);
$display("En A0 A1| O0 O1 O2 O3 | Expected Output");
enable=0;addr0=0;addr1=0; #1000
$display("%b %b %b | %b %b %b %b | All false", enable, addr0, addr1, out0, out1, out2, out3);
enable=0;addr0=1;addr1=0; #1000
$display("%b %b %b | %b %b %b %b | All false", enable, addr0, addr1, out0, out1, out2, out3);
enable=0;addr0=0;addr1=1; #1000
$display("%b %b %b | %b %b %b %b | All false", enable, addr0, addr1, out0, out1, out2, out3);
enable=0;addr0=1;addr1=1; #1000
$display("%b %b %b | %b %b %b %b | All false", enable, addr0, addr1, out0, out1, out2, out3);
enable=1;addr0=0;addr1=0; #1000
$display("%b %b %b | %b %b %b %b | O0 Only", enable, addr0, addr1, out0, out1, out2, out3);
enable=1;addr0=1;addr1=0; #1000
$display("%b %b %b | %b %b %b %b | O1 Only", enable, addr0, addr1, out0, out1, out2, out3);
enable=1;addr0=0;addr1=1; #1000
$display("%b %b %b | %b %b %b %b | O2 Only", enable, addr0, addr1, out0, out1, out2, out3);
enable=1;addr0=1;addr1=1; #1000
$display("%b %b %b | %b %b %b %b | O3 Only", enable, addr0, addr1, out0, out1, out2, out3);
end
endmodule