注意,当上升边沿出现但是out已经为1时,信号不发生改变,所以 out <= out|(~in)&a;
module top_module (
input clk,
input reset,
input [31:0] in,
output [31:0] out
);
reg [31:0]a;
always@(posedge clk)begin
a <= in;
case(reset)
1'b0:out <= out|(~in)&a;
1'b1:out <= 0;
endcase
end
endmodule