键消抖module debounce(clk,key_in,key_out);        //按键消抖模块
键消抖
input clk;                                    //系统时钟输入
键消抖
input[KEY_WIDTH-1:0] key_in;                //外部按键输入
键消抖
output[KEY_WIDTH-1:0]key_out;                //按键消抖输出
键消抖
reg[KEY_WIDTH-1:0]dout1,dout2,dout3;        //寄存器        
键消抖
parameter KEY_WIDTH = 8;                    //参数
键消抖

键消抖assign key_out 
= (dout1 | dout2 | dout3);    //按键消抖输出
键消抖

键消抖always @(posedge clk)
键消抖begin
键消抖    dout1 
<= key_in;
键消抖    dout2 
<= dout1;
键消抖    dout3 
<= dout2;    
键消抖end
键消抖endmodule

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-29
  • 2022-12-23
  • 2021-07-25
  • 2021-08-16
猜你喜欢
  • 2021-08-07
  • 2022-12-23
  • 2022-02-05
  • 2022-12-23
  • 2021-12-05
相关资源
相似解决方案