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

Subversion Repositories pss

[/] [pss/] [trunk/] [pss/] [hdl/] [debouncer.v] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 AlexAntono
module debouncer
2
(
3
        input clk_i, rst_i,
4
 
5
        input in_i,
6
 
7
        output out_o
8
);
9
 
10
reg [7:0] state;
11
assign out_o = state[7];
12
 
13
always @(posedge clk_i)
14
        begin
15
        if (rst_i)
16
                begin
17
                state <= 8'h0;
18
                end
19
        else
20
                begin
21
 
22
                if (in_i == 1'b1)
23
                        begin
24
                        if (state != 8'hFF) state <= state + 8'h1;
25
                        end
26
                else
27
                        begin
28
                        if (state != 8'h00) state <= state - 8'h1;
29
                        end
30
                end
31
        end
32
 
33
endmodule

powered by: WebSVN 2.1.0

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