问题描述:现在需要这样一个信号,需要在硬件复位后得到一段低电平,用于作为程序的开始信号,之后始终保持为高电平
需要写一个计时器
reg [6:0] cnt;
reg soft_rst;
always@(posedge clk or negedge rst)
begin
if(!rst)
cnt<=7’d0;
else
if(cnt<7’d70)
cnt<=cnt+1;
else
cnt<=cnt;
end
always@(posedge clk)
begin
if(!rst)
soft_rst<=1’b1;
else
if((cnt>7’d30)&&(cnt<7’d60))
soft_rst<=1’b0;
else
soft_rst<=1’b1;
end
这样将得到一个在cnt=31至60为低电平,其他为高电平,并在60后始终保持为高电平的信号soft_rst。