按键去抖/*-------------------------------------------------------- -- Engineer: zhrscut -- Create Date: -- Module Name: -- Tool Versions: Quartus_II 9.1 -- -EEPWFPGA°DIY ------------------------------------------------------*/ module stable_key(clk,key_in,led); input clk; input key_in; output led; reg key_d,key,key_out; reg[31:0] cnt=0; always @(posedge clk) begin if(key!=key_in) begin cnt key_d end else if(cnt==199_9999) //±10ms begin key_out cnt end else cnt key end assign led=key_out; endmodule ……