decoder_encoder
This commit is contained in:
38
decoder_encoder/decoder_encoder_tb.v
Normal file
38
decoder_encoder/decoder_encoder_tb.v
Normal file
@@ -0,0 +1,38 @@
|
||||
`include "./decoder_encoder/decoder_encoder.v"
|
||||
|
||||
module decoder_3bit_tb;
|
||||
reg [2:0] in;
|
||||
wire [7:0] out;
|
||||
wire [2:0] encoded;
|
||||
|
||||
decoder_3bit dec(
|
||||
.in(in),
|
||||
.out(out)
|
||||
);
|
||||
|
||||
encoder_3bit enc(
|
||||
.in(out),
|
||||
.out(encoded)
|
||||
);
|
||||
|
||||
initial begin
|
||||
$dumpfile("./decoder_encoder/decoder_encoder.vcd");
|
||||
$dumpvars(0, decoder_3bit_tb);
|
||||
|
||||
in = 3'b000;
|
||||
#1
|
||||
$display("in=%d, out=%b, enc=%d", in, out, encoded);
|
||||
in = 3'b001;
|
||||
#1
|
||||
$display("in=%d, out=%b, enc=%d", in, out, encoded);
|
||||
in = 3'b010;
|
||||
#1
|
||||
$display("in=%d, out=%b, enc=%d", in, out, encoded);
|
||||
in = 3'b100;
|
||||
#1
|
||||
$display("in=%d, out=%b, enc=%d", in, out, encoded);
|
||||
in = 3'b111;
|
||||
#1
|
||||
$display("in=%d, out=%b, enc=%d", in, out, encoded);
|
||||
end
|
||||
endmodule
|
||||
Reference in New Issue
Block a user