设为首页 加入收藏

TOP

FPGA内部动态可重置PLL讲解(二)(二)
2017-10-10 12:27:00 】 浏览:3815
Tags:FPGA 内部 动态 重置 PLL 讲解
eset复位信号是高电平复位,和平常使用的rst_n信号正好相反
wire pll_reset = ~delay_done; //pll of ip needs high level to reset

//----------------------------------
//using IP
wire locked;

        sys_pll  U1(
            .areset(pll_reset),
            .inclk0(clk),
            .c0(clk_ref),        //output 100MHz
            .locked(locked)    
            );
            
//----------------------------------------------
//rst_n sync, only controlled by the main clk
reg     rst_nr1, rst_nr2;
always @(posedge clk_ref)
begin
    if(!rst_n)
        begin
        rst_nr1 <= 1'b0;
        rst_nr2 <= 1'b0;
        end
    else
        begin
        rst_nr1 <= 1'b1;
        rst_nr2 <= rst_nr1;
        end
end
assign    sys_rst_n = rst_nr2 & locked;    //active low

endmodule

  无PLL参与的时钟电路

  RTL视图

wpsBDCF.tmp

 

  Verilog 代码

/*********************************************************

//description : this module will complete function of system init delay when power on
//author        : raymon
//address      : GDUT university  of technology 
//e-mail         : 770811496@qq.com
//contact      : 770811496
//time            : 2015-1-31


**********************************************************/
`timescale 1ns/1ns
module system_init_delay
    #(
    parameter    SYS_DELAY_TOP = 24'd2500000        //50ms system init delay
      )
(      
//-------------------------------------------
//global clock

    input    clk,        //50MHz
    input    rst_n,
    
    //system interface
    output    delay_done
);

//------------------------------------------
//Delay 50ms for steady state when power on

reg    [23:0] delay_cnt = 24'd0;
always@(posedge clk or negedge rst_n)
    begin
        if(!rst_n)
            delay_cnt <= 0;
        else if(delay_cnt < SYS_DELAY_TOP - 1'b1)
            delay_cnt <= delay_cnt + 1'b1;
        else
            delay_cnt <= SYS_DELAY_TOP - 1'b1;
    end
assign    delay_done = (delay_cnt == SYS_DELAY_TOP - 1'b1)? 1'b1 : 1'b0;

endmodule

 

  上述是延时部分的代码。

/*********************************************************

//description :this module will complete function of system init delay when power on
//author        : raymon
//address      :  GDUT university  of technology 
//e-mail         : 770811496@qq.com
//contact      : 770811496
//time         :  2015-1-31


**********************************************************/
`timescale 1ns/1ns
module system_ctrl(clk, rst_n,  clk_ref, sys_rst_n);

//----------------------------------------------
//globol clock
    input                clk;
    input                rst_n;

//----------------------------------------------
//synced signal
    output             clk_ref;       //clock output    
    output             sys_rst_n;    //system reset

//----------------------------------------------
//rst_n sync, only controlled by the main clk
reg     rst_nr1, rst_nr2;
always @(posedge clk)
begin
    if(!rst_n)
        begin
        rst_nr1 <= 1'b0;
        rst_nr2 <= 1'b0;
        end
    else
        begin
        rst_nr1 <= 1'b1;
        rst_nr2 <= rst_nr1;
        end
end


//----------------------------------
//component instantiation for system_delay
wire    delay_done;    //system init delay has done
system_init_delay
#(
    .SYS_DELAY_TOP    (24'd2500000)
)
u_system_init_delay
(
    //global clock
    .clk        (clk),
    .rst_n    (1'b1),            //It don't depend on rst_n when power up
    //system interface
    .delay_done    (delay_done)
);

assign    clk_ref = clk;
assign    sys_rst_n = rst_nr2 & delay_done;    //active High

endmodule

 

上述是实现整个模块,可以查看RTL视图。

 

 

上面提到的最大限度降低亚稳态复位电路,在应用时,直接可以调用。目前已在多个工程中使用。

//====

首页 上一页 1 2 3 下一页 尾页 2/3/3
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇《FPGA全程进阶---实战演练》第二.. 下一篇有限状态机HDL模板

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目