zoukankan      html  css  js  c++  java
  • 对单脉冲跨时钟域的处理方法

    在FPGA开发设计中,经常是多个时钟同时工作于同一模块中,不同时钟域的信号间要保证稳定通信,必须要处理好时序问题,也就是要充分考虑信号的建立和保持时间,以下是在设计中常用的单脉冲信号的处理方法:

      r_PULSE_O <= { r_PULSE_O[1:0] , r_PULSE_I} ;   

      理论上,相当于对单bit信号在目标时钟域下进行了打拍操作;但个别语法检测工具如:questa CDC会认为没有进行CDC处理,可以忽略EDA的警报。

     assign  PULSE_O = (r_PULSE_O[2] != r_PULSE_O[1])  ;      

      会对输入的单拍脉冲扩展为目标时钟域下的两拍脉冲;

     reference: http://www.eetop.cn/blog/html/17/743817-24614.html

    `timescale 1 ps / 1 ps
    module PULSE_GEN (
    XRST , // (i) Reset Input ( Asynchronous )
    CLK_I , // (i) Clock At Input Side
    CLK_O , // (i) Clock At Output Side
    PULSE_I , // (i) Pulse Input
    PULSE_O // (o) Pulse Output
    ) ;

    parameter P_TYPE = 8'd0 ;

    //==========================================================
    // Declare the port directions
    //==========================================================

    input XRST ; // (i) Reset Input ( Asynchronous )
    input CLK_I ; // (i) Clock At Input Side
    input CLK_O ; // (i) Clock At Output Side
    input PULSE_I ; // (i) Pulse Input
    output PULSE_O ; // (o) Pulse Output

    //==========================================================
    // Internal signals define
    //==========================================================

    reg r_PULSE_I ;
    (*ASYNC_REG="true"*) reg [2:0] r_PULSE_O ; // r_PULSE_O[0], r_pluse_o[1] Should Not Be Duplicated
                                               // Synthesis Attribute MAX_FANOUT of r_PULSE_O is 9999;

    //==========================================================
    // RTL Body
    //==========================================================

    generate
    if(P_TYPE == 0) begin :TYPE_0_PULSEGEN

    //==========================================================
    // Input Pulse Keep ( CLK_I domain )
    //==========================================================
    always @( posedge CLK_I or negedge XRST ) begin
    if( !XRST ) begin
    r_PULSE_I <= 1'b0 ;
    end else begin
    if ( PULSE_I == 1'b1 ) begin
    r_PULSE_I <= ~r_PULSE_I ;
    end
    end
    end

    //==========================================================
    // Output Pulse Sync. And Generate ( CLK_O Domain )
    //==========================================================
    always @( posedge CLK_O or negedge XRST ) begin
    if( !XRST ) begin
    r_PULSE_O <= 3'b000 ;
    end else begin
    r_PULSE_O <= { r_PULSE_O[1:0] , r_PULSE_I } ;
    end
    end

    assign PULSE_O = (r_PULSE_O[2] != r_PULSE_O[1] ) ; // 0 -> 1

    end
    endgenerate

    endmodule


  • 相关阅读:
    生涯路
    事件与window的基本操作
    js操作
    c# 函数
    布局页面CSS
    网页填写的基本操作
    框架集
    网页的基本操作1
    存储与触发器
    常用的函数
  • 原文地址:https://www.cnblogs.com/limanjihe/p/9772357.html
Copyright © 2011-2022 走看看