时序仿真结果
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/0304eadb37cf77f04050593e722f0901.png)
设计文件程序
`timescale 1ns/1ns
module led_flash(
input Clk,
input Reset_n,
output reg Led
);
reg [25:0]counter;
always@(posedge Clk or negedge Reset_n)begin
if (!Reset_n)
counter <= 0;
else if(counter == 25000000 - 1)
counter <= 0;
else
counter <= counter +1'd1;
end
always@(posedge Clk or negedge Reset_n)begin
if (!Reset_n)
Led <= 0;
else if(counter == 25000000 - 1)
Led <= !Led;
end
endmodule
仿真文件程序
`timescale 1ns/1ns
module led_flash_tb();
reg Clk;
reg Reset_n;
wire Led;
led_flash led_flash_test(
.Clk(Clk),
.Reset_n(Reset_n),
.Led(Led)
);
initial Clk = 1;
always #10 Clk = !Clk;
initial begin
Reset_n = 0;
#200;
Reset_n = 1;
#200000000;
end
endmodule