Initial commit
This commit is contained in:
56
Exp3-2/Exp3-2.srcs/sim_1/new/tb_prior_encoder.v
Normal file
56
Exp3-2/Exp3-2.srcs/sim_1/new/tb_prior_encoder.v
Normal file
@@ -0,0 +1,56 @@
|
||||
`timescale 1ns / 1ps
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
// Company:
|
||||
// Engineer:
|
||||
//
|
||||
// Create Date: 2024/10/31 10:32:45
|
||||
// Design Name:
|
||||
// Module Name: tb_prior_encoder
|
||||
// Project Name:
|
||||
// Target Devices:
|
||||
// Tool Versions:
|
||||
// Description:
|
||||
//
|
||||
// Dependencies:
|
||||
//
|
||||
// Revision:
|
||||
// Revision 0.01 - File Created
|
||||
// Additional Comments:
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
module tb_prior_encoder;
|
||||
reg en;
|
||||
reg [7:0] i;
|
||||
wire [7:0] i_sig;
|
||||
wire [6:0] seg1;
|
||||
wire [7:0] seg2;
|
||||
wire [3:0] seg_cs1;
|
||||
wire [3:0] seg_cs2;
|
||||
prior_encoder uut (
|
||||
.en(en),
|
||||
.i(i),
|
||||
.i_sig(i_sig),
|
||||
.seg1(seg1),
|
||||
.seg2(seg2),
|
||||
.seg_cs1(seg_cs1),
|
||||
.seg_cs2(seg_cs2)
|
||||
);
|
||||
initial begin
|
||||
en = 0;
|
||||
i = 8'b11111110;
|
||||
#10;
|
||||
en = 1;
|
||||
i = 8'b11111110; #10; // Expected: Y = 3'b000, i_sig = 8'b00000001
|
||||
i = 8'b11111100; #10; // Expected: Y = 3'b001, i_sig = 8'b00000010
|
||||
i = 8'b11111000; #10; // Expected: Y = 3'b010, i_sig = 8'b00000100
|
||||
i = 8'b11110000; #10; // Expected: Y = 3'b011, i_sig = 8'b00001000
|
||||
i = 8'b11100000; #10; // Expected: Y = 3'b100, i_sig = 8'b00010000
|
||||
i = 8'b11000000; #10; // Expected: Y = 3'b101, i_sig = 8'b00100000
|
||||
i = 8'b10000000; #10; // Expected: Y = 3'b110, i_sig = 8'b01000000
|
||||
i = 8'b00000000; #10; // Expected: Y = 3'b111, i_sig = 8'b10000000
|
||||
en = 0; #10; // Expected: out = 0, i_sig = undefined
|
||||
$finish;
|
||||
end
|
||||
endmodule
|
||||
Reference in New Issue
Block a user