在捕获上升沿的时候栽个小跟头,搞了好一会,才发现问题。。。。。
捕获上升沿的时候,切记要初始化位1,仔细想一下你就会明白。。(捕获下降沿时则初始化为0)
捕获上升沿:
input signal;
output P_signal;
reg signal_delay;
always@(posedge clk)
if(rst)
signal_delay <= 1'b1;
else
signal_delay <= signal;
assign P_signal = (~signal_delay && signal);
捕获下降沿:
input signal;
output F_signal;
reg signal_delay;
always@(posedge clk)
if(rst)
signal_delay <= 1'b0;
else
signal_delay <= signal;
assign F_signal = (signal_delay && ~signal);