CDC | 您所在的位置:网站首页 › dest › CDC |
参考文件:《ug974-vivado-ultrascale-libraries.pdf》 前言: 所有的快时钟到慢时钟的跨时钟处理,都需要设法使得 src 的数据能被 dst 的时钟采样2次以上,除此之外没有任何捷径能实现该情况下的跨时钟处理。 一、单、多bit信号直接跨时钟处理 xpm_cdc_array_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(0), // DECIMAL; 0=do not register input, 1=register input .WIDTH(2) // DECIMAL; range: 1-1024 ) xpm_cdc_array_single_inst ( .dest_out(dest_out), // WIDTH-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(0), // 1-bit input: optional; required when SRC_INPUT_REG = 1 .src_in(src_in) // WIDTH-bit input: Input single-bit array to be synchronized to destination clock // domain. It is assumed that each bit of the array is unrelated to the others. This // is reflected in the constraints applied to this macro. To transfer a binary value // losslessly across the two clock domains, use the XPM_CDC_GRAY macro instead. ); 注意:xpm_cdc_array_single 的作用相当于点对点的 set_fulse; 多bit的时候,各个bit之间是独立的; 综上,xpm_cdc_array_single 的使用需要自己考虑:1)慢时钟到快时钟可以直接使用;2)快时钟到慢时钟需要增加源端数据稳定的时长(确保大于慢时钟的一个周期); 二、单、多bit信号握手跨时钟处理 // start module bus_data_sync #( parameter DATA_WIDTH = 16 )( //src input src_clk , //源时钟 input src_data_valid , //源数据有效 input [DATA_WIDTH-1:0] src_data , //源数据 //dest input dest_clk , //目的时钟 output dest_data_valid , //目的数据有效 output [DATA_WIDTH-1:0] dest_data //目的数据 ); wire src_rcv; reg src_send=0; always @(posedge src_clk) begin if(src_data_valid) src_send |
CopyRight 2018-2019 实验室设备网 版权所有 |