请问大神,下面两个程序的效果是一样的吧?
一:
module debounce(clk,key_in,key_out);
input clk;input [KEY_WIDTH-1:0]key_in;
output [KEY_WIDTH-1:0]key_out;
parameter KEY_WIDTH=8;
reg [7:0]dout1,dout2,dout3;
assign key_out=dout1; //❤
always@(posedge clk)begin
dout1<=key_in;
dout2<=dout1;
dout3<=dout2;
end
endmodule
二:
module debounce(clk,key_in,key_out);
input clk;
input [KEY_WIDTH-1:0]key_in;
output [KEY_WIDTH-1:0]key_out;
parameter KEY_WIDTH=8;
reg [7:0]dout1,dout2,dout3;
assign key_out=(dout1|dout2|dout3);//❤
always@(posedge clk)
begin
dout1<=key_in;
dout2<=dout1;
dout3<=dout2;
end
endmodule