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

Subversion Repositories genesys_ddr2

[/] [genesys_ddr2/] [trunk/] [rtl/] [debounceRst.v] - Diff between revs 2 and 3

Show entire file | Details | Blame | View Log

Rev 2 Rev 3
Line 35... Line 35...
         reg [DELAY_CC-1: 0]             rst_debounce_delay_loop = {1'b0, {(DELAY_CC-1){1'b1}}};
         reg [DELAY_CC-1: 0]             rst_debounce_delay_loop = {1'b0, {(DELAY_CC-1){1'b1}}};
         reg [BITS_DELAY_CC-1: 0]        rst_cnt_delay = 100 + 128;//100 + {1'b1, {(BITS_DELAY_CC-2){1'b0}}};     //keep reset active for DELAY_CC time
         reg [BITS_DELAY_CC-1: 0]        rst_cnt_delay = 100 + 128;//100 + {1'b1, {(BITS_DELAY_CC-2){1'b0}}};     //keep reset active for DELAY_CC time
         wire                                                   async_rst, PLLRst, rst_edge, start_up_rst;
         wire                                                   async_rst, PLLRst, rst_edge, start_up_rst;
 
 
 
 
        // --4-bit Shift Register For resetting the DCM on startup (Xilinx Answer Record: 14425)
        // --4-bit Shift Register For resetting the PLL
        //--Asserts Start_Up_Rst for 4 clock periods
        //--Asserts Start_Up_Rst for 4 clock periods
 
 
        SRL16E #(
        SRL16E #(
      .INIT(16'h000F) // Initial Value of Shift Register
      .INIT(16'h000F) // Initial Value of Shift Register
   ) SRL16E_inst (
   ) SRL16E_inst (
Line 63... Line 63...
         //detect edge
         //detect edge
         assign rst_edge = (rst_samples_and_N_1 && (! rst_samples_and_N))? 1'b1: 1'b0;
         assign rst_edge = (rst_samples_and_N_1 && (! rst_samples_and_N))? 1'b1: 1'b0;
 
 
        //----------------------------------------------------------------------------------
        //----------------------------------------------------------------------------------
        //-- Reset with take-off and landing
        //-- Reset with take-off and landing
        //-- delay 95 cc = RST_SYNC_NUM - 4 reset
        //-- delay 95 cc = DELAY_CC - 4 reset
        //-- then keep it active for 3 cc (as long as one of RstQ(RST_SYNC_NUM-2), RstQ(RST_SYNC_NUM-3) or RstQ(RST_SYNC_NUM-4) is 0)
        //-- then keep it active for 3 cc (as long as one of rst_debounce_delay_loop[DELAY_CC-2], rst_debounce_delay_loop[DELAY_CC-3] or rst_debounce_delay_loop[DELAY_CC-4] is 0)
        //----------------------------------------------------------------------------------    
        //----------------------------------------------------------------------------------    
         always @(posedge clk)
         always @(posedge clk)
         begin
         begin
                if (rst_edge || rst_debounce_delay_loop[DELAY_CC-1])
                if (rst_edge || rst_debounce_delay_loop[DELAY_CC-1])
                                rst_debounce_delay_loop <= {rst_debounce_delay_loop[DELAY_CC-2:0],rst_debounce_delay_loop[DELAY_CC-1]};
                                rst_debounce_delay_loop <= {rst_debounce_delay_loop[DELAY_CC-2:0],rst_debounce_delay_loop[DELAY_CC-1]};
Line 77... Line 77...
        assign PLLRst = ((~rst_debounce_delay_loop[DELAY_CC-2]) || (~rst_debounce_delay_loop[DELAY_CC-3]) ||
        assign PLLRst = ((~rst_debounce_delay_loop[DELAY_CC-2]) || (~rst_debounce_delay_loop[DELAY_CC-3]) ||
                                        (~rst_debounce_delay_loop[DELAY_CC-4]) || start_up_rst)? 1'b1: 1'b0;
                                        (~rst_debounce_delay_loop[DELAY_CC-4]) || start_up_rst)? 1'b1: 1'b0;
 
 
        assign int_rst =  ~PLLLocked;
        assign int_rst =  ~PLLLocked;
 
 
        //decrement counter for 100 cc then RstD(RstD'high) becomes 0
        //decrement counter for 100 cc then rst_cnt_delay[BITS_DELAY_CC-1] becomes 0
        always @(posedge clk)
        always @(posedge clk)
        begin
        begin
                if (int_rst)
                if (int_rst)
                        rst_cnt_delay <= 228;//DELAY_CC + {1'b1, {(BITS_DELAY_CC-2){1'b0}}};//{1'b1, (BITS_DELAY_CC-1)'dDELAY_CC}; 
                        rst_cnt_delay <= 228;//DELAY_CC + {1'b1, {(BITS_DELAY_CC-2){1'b0}}};
                else
                else
                        if (rst_cnt_delay[BITS_DELAY_CC-1])
                        if (rst_cnt_delay[BITS_DELAY_CC-1])
                                rst_cnt_delay <= rst_cnt_delay - 1;
                                rst_cnt_delay <= rst_cnt_delay - 1;
         end
         end
 
 

powered by: WebSVN 2.1.0

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