OpenCores
URL https://opencores.org/ocsvn/sgmii/sgmii/trunk

Subversion Repositories sgmii

[/] [sgmii/] [trunk/] [build/] [mPshBtnDbnce.v] - Blame information for rev 25

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 25 jefflieu
/*
2
Copyright © 2012 JeffLieu-lieumychuong@gmail.com
3
 
4
        This file is part of SGMII-IP-Core.
5
    SGMII-IP-Core is free software: you can redistribute it and/or modify
6
    it under the terms of the GNU General Public License as published by
7
    the Free Software Foundation, either version 3 of the License, or
8
    (at your option) any later version.
9
 
10
    SGMII-IP-Core is distributed in the hope that it will be useful,
11
    but WITHOUT ANY WARRANTY; without even the implied warranty of
12
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
    GNU General Public License for more details.
14
 
15
    You should have received a copy of the GNU General Public License
16
    along with SGMII-IP-Core.  If not, see <http://www.gnu.org/licenses/>.
17
 
18
File            :       sgmii_demo.v
19
Description     :       This file implements top-level file to test SGMII core
20
 
21
Remarks         :
22
 
23
Revision        :
24
        Date    Author  Description
25
 
26
*/
27
 
28
module mPshBtnDbnce #(parameter pDbncePeriod=8191,pDbncerWidth=13)(
29
        input i_Clk,
30
        input i_PshBtn,
31
        output reg o_Dbnced);
32
 
33
 
34
        reg r_PshBtnIn_D1;
35
        reg r_PshBtnIn_D2;
36
        reg r_PshBtnIn_D3;
37
        reg [pDbncerWidth-1:0] rv_Dbncer;
38
 
39
        always@(posedge i_Clk)
40
                begin
41
                        r_PshBtnIn_D1 <= i_PshBtn;
42
                        r_PshBtnIn_D2 <= r_PshBtnIn_D1;
43
                    r_PshBtnIn_D3 <= r_PshBtnIn_D2;
44
 
45
                        if(r_PshBtnIn_D3^r_PshBtnIn_D2) rv_Dbncer <= pDbncePeriod;
46
                        else begin
47
                                if(~(|rv_Dbncer)) rv_Dbncer<=rv_Dbncer-1;
48
                                else o_Dbnced <= r_PshBtnIn_D3;
49
                                end
50
                end
51
endmodule
52
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.