2012年10月18日 星期四

PushButton_Debouncer

源自

module PushButton_Debouncer (Do, Di, clk, rst);
output  Do;
input   Di;  
input   clk,rst;   

reg   [24:0] buff;   

reg     Do;   
    
always @ (posedge clk or posedge rst)    
begin  
if(rst)
begin
buff=0;
end
else
begin
if(Di)
begin

if (buff>25'd10_000_000)
  buff=buff;
else
buff=buff+25'd1;
end
else
 begin
    buff=0;
end
end
end



always @ (posedge clk)
begin
if (buff>25'd5_000_000)
Do=1;
else
Do=0;
end

endmodule

沒有留言:

張貼留言

8-QAM Signal 4 Phases 2 Amplitudes + 8PSK

 8-QAM Signal 4 Phases 2 Amplitudes + 8PSK import tkinter as tk from tkinter import messagebox import math import cmath # --- 8-QAM 參數設定 ---...