FPGA跨時鐘檢測上升沿簡單處理方法

    FPGA跨時鐘檢測上升沿有很多方法,這裏給大家介紹一個非常簡單的方法,就是用xilinx帶參數宏解決。

This macro synchronizes a pulse in the source clock domain to the destination clock domain. A
pulse of any size in the source clock domain, if initiated correctly, will generate a pulse the size of
a single destination clock period。(不管源端脈寬多寬,都將產生脈衝信號,這個脈衝信號只有一個目的時鐘節寬度)

xpm_cdc_pulse是從源信號src_pulse的脈衝裏面檢測出上升沿,從dest_pulse輸出(只維持一個時鐘節拍)。

使用方法如下:

源代碼:

// xpm_cdc_single: Single-bit Synchronizer
// Xilinx Parameterized Macro, version 2019.1
xpm_cdc_single #(
 .DEST_SYNC_FF(4), // DECIMAL; range: 2-10
 .INIT_SYNC_FF(0), // DECIMAL; 0=disable simulation init values, 1=enable simulation init values
 .SIM_ASSERT_CHK(0), // DECIMAL; 0=disable simulation messages, 1=enable simulation messages
 .SRC_INPUT_REG(1) // DECIMAL; 0=do not register input, 1=register input
)
xpm_cdc_single_inst (
 .dest_out(dest_out), // 1-bit output: src_in synchronized to the destination clock domain. This output is
 // registered.
 .dest_clk(dest_clk), // 1-bit input: Clock signal for the destination clock domain.
 .src_clk(src_clk), // 1-bit input: optional; required when SRC_INPUT_REG = 1
 .src_in(src_in) // 1-bit input: Input signal to be synchronized to dest_clk domain.
);
// End of xpm_cdc_single_inst instantiation

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章