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

Subversion Repositories spacewiresystemc

[/] [spacewiresystemc/] [trunk/] [rtl/] [DEBUG_VERILOG/] [debounce.v] - Blame information for rev 40

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 23 redbear
//+FHDR------------------------------------------------------------------------
2
//Copyright (c) 2013 Latin Group American Integhrated Circuit, Inc. All rights reserved
3
//GLADIC Open Source RTL
4
//-----------------------------------------------------------------------------
5
//FILE NAME      :
6
//DEPARTMENT     : IC Design / Verification
7
//AUTHOR         : Felipe Fernandes da Costa
8
//AUTHOR’S EMAIL :
9
//-----------------------------------------------------------------------------
10
//RELEASE HISTORY
11
//VERSION DATE AUTHOR DESCRIPTION
12
//1.0 YYYY-MM-DD name
13
//-----------------------------------------------------------------------------
14
//KEYWORDS : General file searching keywords, leave blank if none.
15
//-----------------------------------------------------------------------------
16
//PURPOSE  : ECSS_E_ST_50_12C_31_july_2008
17
//-----------------------------------------------------------------------------
18
//PARAMETERS
19
//PARAM NAME            RANGE   : DESCRIPTION : DEFAULT : UNITS
20
//e.g.DATA_WIDTH        [32,16] : width of the DATA : 32:
21
//-----------------------------------------------------------------------------
22
//REUSE ISSUES
23
//Reset Strategy        :
24
//Clock Domains         :
25
//Critical Timing       :
26
//Test Features         :
27
//Asynchronous I/F      :
28
//Scan Methodology      :
29
//Instantiations        :
30
//Synthesizable (y/n)   :
31
//Other                 :
32
//-FHDR------------------------------------------------------------------------
33
module debounce_db(
34
                    input CLK,
35
                    input PB,
36
 
37
                    output reg PB_state,
38
                    output reg PB_down
39
                  );
40
 
41 40 redbear
                  reg aux_pb;
42 23 redbear
                  reg [15:0] counter;
43 40 redbear
                  //assign PB_state = (counter >= 400)?PB_state:1'b1;
44
always@(*)
45
begin
46
 
47
        PB_state = 1'b1;
48
 
49
        if(CLK)
50
        begin
51
                if(aux_pb)
52
                        PB_state = 1'b0;
53
        end
54
        else if(!CLK)
55
        begin
56
                if(aux_pb)
57
                        PB_state = 1'b0;
58
        end
59
end
60
 
61 23 redbear
always@(posedge CLK)
62
begin
63
 
64
        if(PB)
65
        begin
66 40 redbear
                aux_pb  <= 1'b0;
67 23 redbear
                counter <= 16'd0;
68
                PB_down <= 1'b0;
69
        end
70
        else
71
        begin
72
 
73
                if(counter >= 400)
74
                begin
75 40 redbear
                        aux_pb  <= 1'b1;
76 23 redbear
                        PB_down <= 1'b1;
77
                end
78
                else
79
                        counter <= counter + 16'd1;
80
 
81
        end
82
 
83
 
84
end
85
 
86
 
87
endmodule

powered by: WebSVN 2.1.0

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