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

Subversion Repositories spacewiresystemc

[/] [spacewiresystemc/] [trunk/] [rtl/] [DEBUG_VERILOG/] [debounce.v] - Diff between revs 23 and 40

Only display areas with differences | Details | Blame | View Log

Rev 23 Rev 40
//+FHDR------------------------------------------------------------------------
//+FHDR------------------------------------------------------------------------
//Copyright (c) 2013 Latin Group American Integhrated Circuit, Inc. All rights reserved
//Copyright (c) 2013 Latin Group American Integhrated Circuit, Inc. All rights reserved
//GLADIC Open Source RTL
//GLADIC Open Source RTL
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
//FILE NAME      :
//FILE NAME      :
//DEPARTMENT     : IC Design / Verification
//DEPARTMENT     : IC Design / Verification
//AUTHOR         : Felipe Fernandes da Costa
//AUTHOR         : Felipe Fernandes da Costa
//AUTHOR’S EMAIL :
//AUTHOR’S EMAIL :
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
//RELEASE HISTORY
//RELEASE HISTORY
//VERSION DATE AUTHOR DESCRIPTION
//VERSION DATE AUTHOR DESCRIPTION
//1.0 YYYY-MM-DD name
//1.0 YYYY-MM-DD name
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
//KEYWORDS : General file searching keywords, leave blank if none.
//KEYWORDS : General file searching keywords, leave blank if none.
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
//PURPOSE  : ECSS_E_ST_50_12C_31_july_2008
//PURPOSE  : ECSS_E_ST_50_12C_31_july_2008
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
//PARAMETERS
//PARAMETERS
//PARAM NAME            RANGE   : DESCRIPTION : DEFAULT : UNITS
//PARAM NAME            RANGE   : DESCRIPTION : DEFAULT : UNITS
//e.g.DATA_WIDTH        [32,16] : width of the DATA : 32:
//e.g.DATA_WIDTH        [32,16] : width of the DATA : 32:
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
//REUSE ISSUES
//REUSE ISSUES
//Reset Strategy        :
//Reset Strategy        :
//Clock Domains         :
//Clock Domains         :
//Critical Timing       :
//Critical Timing       :
//Test Features         :
//Test Features         :
//Asynchronous I/F      :
//Asynchronous I/F      :
//Scan Methodology      :
//Scan Methodology      :
//Instantiations        :
//Instantiations        :
//Synthesizable (y/n)   :
//Synthesizable (y/n)   :
//Other                 :
//Other                 :
//-FHDR------------------------------------------------------------------------
//-FHDR------------------------------------------------------------------------
module debounce_db(
module debounce_db(
                    input CLK,
                    input CLK,
                    input PB,
                    input PB,
 
 
                    output reg PB_state,
                    output reg PB_state,
                    output reg PB_down
                    output reg PB_down
                  );
                  );
 
 
 
                  reg aux_pb;
                  reg [15:0] counter;
                  reg [15:0] counter;
 
                  //assign PB_state = (counter >= 400)?PB_state:1'b1;
 
always@(*)
 
begin
 
 
 
        PB_state = 1'b1;
 
 
 
        if(CLK)
 
        begin
 
                if(aux_pb)
 
                        PB_state = 1'b0;
 
        end
 
        else if(!CLK)
 
        begin
 
                if(aux_pb)
 
                        PB_state = 1'b0;
 
        end
 
end
 
 
always@(posedge CLK)
always@(posedge CLK)
begin
begin
 
 
        if(PB)
        if(PB)
        begin
        begin
                PB_state<= 1'b1;
                aux_pb  <= 1'b0;
                counter <= 16'd0;
                counter <= 16'd0;
                PB_down <= 1'b0;
                PB_down <= 1'b0;
        end
        end
        else
        else
        begin
        begin
 
 
                if(counter >= 400)
                if(counter >= 400)
                begin
                begin
                        PB_state<= 1'b0;
                        aux_pb  <= 1'b1;
                        PB_down <= 1'b1;
                        PB_down <= 1'b1;
                end
                end
                else
                else
                        counter <= counter + 16'd1;
                        counter <= counter + 16'd1;
 
 
        end
        end
 
 
 
 
end
end
 
 
 
 
endmodule
endmodule
 
 

powered by: WebSVN 2.1.0

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