测试平台设计
本实验主要对数码管驱动引脚的状态与预期进行比较和分析,通过仿真,验证设计的正确性和合理性。数码管驱动模块的testbench如下所示:
`timescale 1ns/1ns
module DIG_LED_DRIVE_tb;
reg [23:0]data;
reg clk;
reg rst_n;
wire [7:0]seg;
wire [2:0]sel;
DIG_LED_DRIVE DIG_LED_DRIVE_inst1(
.Data(data),
.Clk(clk),
.Rst_n(rst_n),
.Dig_Led_seg(seg),
.Dig_Led_sel(sel)
);
initial begin
data = 0;
clk = 1;
rst_n = 0;
#200;
rst_n = 1;
data = 24'h012345;
#10000;
data = 24'h518918;
#10000;
data = 24'h543210;
#10000;
$stop;
end
always #10 clk = ~clk;
endmodule
每隔一段时间,更换数码管的Data输入数据,观察数码管的输出是否正确。