File size: 614 Bytes
d8ff16a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
`timescale 1ns/1ps

module tb_decoder2x4;

reg a;
reg b;
wire y0;
wire y1;
wire y2;
wire y3;

decoder2x4 uut (
    .a(a),
    .b(b),
    .y0(y0),
    .y1(y1),
    .y2(y2),
    .y3(y3)
);

initial begin
    $display("a b | y3 y2 y1 y0");
    $display("-----------------");

    a=0; b=0; #10; $display("%b %b |  %b  %b  %b  %b", a, b, y3, y2, y1, y0);
    a=0; b=1; #10; $display("%b %b |  %b  %b  %b  %b", a, b, y3, y2, y1, y0);
    a=1; b=0; #10; $display("%b %b |  %b  %b  %b  %b", a, b, y3, y2, y1, y0);
    a=1; b=1; #10; $display("%b %b |  %b  %b  %b  %b", a, b, y3, y2, y1, y0);

    $finish;
end

endmodule