大概意思是,当检测到上升沿后续的时钟周期内,输出保持为1,直到触发异步复位信号。这里的out在下一个时钟周期才能检测到同步reset信号时,而在两个时钟周期后才检测到边缘跳转。
module top_module (
input clk,
input reset,
input [31:0] in,
output [31:0] out
);
reg [31:0] in_old;
always @(posedge clk) begin
in_old <= in;
if(reset)
out <= 0;
else begin
out <= out|~in&in_old;
end
end
endmodule
和之前的题目唯一的区别就是in变化后,out变为1直到有reset,out变为0(这里out不仅与in的状态有关也与out有关)。直接真值表列出来(只列出了out为1的情况),卡诺图化简。
in_old | in | out_old | out | |
1 | 0 | 1,0 | 1 | |
1 | 1 | 1 | 1 | |
0 | 1 | 1 | 1 | |
0 | 0 | 1 | 1 |