【IC设计】跨时钟异步处理系列——单比特跨时钟

文章目录

建立时间和保持时间

  1. 所谓的建立时间或者保持时间都是在描述一种时钟变化的边沿上的数据状态。
  2. 建立时间:在时钟的有效沿(以上升沿为例)到来之前,数据的输入端信号必须保持稳定的最短时间
  3. 保持时间:在时钟的有效沿(以上升沿为例)到来之后,数据的输入端信号必须保持稳定的最短时间

单比特信号的跨时钟处理

慢时钟域的信号传输到快时钟域

打两拍

快时钟域的信号传输到慢时钟域

如图所示,第一行是脉冲信号,第二行是慢时钟域的时钟。如果从快时钟域要同步一个脉冲信号到慢时钟域,容易出现上升沿没有采样到脉冲信号的情况。

方案一 脉冲展宽+同步 (打拍打拍,进行或)

代码
rust 复制代码
module fast2slow_cdc 
(
    input   i_clk_f     ,
    input   i_pluse_f   ,
    input   i_rst_n     ,
    input   i_clk_s     ,
    output  o_pluse_s  
);
/*
always @(posedge i_clk_f) begin
    r_pluse[0] <= i_pluse_f  ;
    r_pluse[1] <= r_pluse[0] ;
    r_pluse[2] <= r_pluse[1] ;
    r_pluse[3] <= r_pluse[2] ;
    r_pluse[4] <= r_pluse[3] ;
end
*/

reg [2:0]    r_pluse    ;
always @(posedge i_clk_f or negedge i_rst_n) begin
    if(~i_rst_n)    begin
        r_pluse <=  'b0;
    end
    else begin
        r_pluse <= {r_pluse[1:0],i_pluse_f};
    end
end

wire   w_pluse ;
assign  w_pluse = |r_pluse ;


reg   r_pluse_d0  ;
reg   r_pluse_d1  ;
always @(posedge i_clk_s) begin
    r_pluse_d0 <= w_pluse    ;
    r_pluse_d1 <= r_pluse_d0 ;
end

assign  o_pluse_s = r_pluse_d1 ;

endmodule

存在的问题:采用脉冲展宽+同步,在或时可能产生毛刺

原理图

方案二 脉冲电平检测+双触发器同步+边沿检测

优点: 对时序比较友好
缺点: 相邻的脉冲太近时,会检测不到

代码
rust 复制代码
module fast2slow_cdc2(
	input	i_clk_f			,
	input	i_pluse_f		,
	input	i_clk_s			,
	output	o_pluse_s
);
	reg	r_temp	=	0	;
	always@(posedge i_clk_f)	begin
		if(i_pluse_f)
			r_temp	    <=	~r_temp;
		else
			 r_temp	<=	r_temp;
	end
	reg	r_temp_d0;
	reg	r_temp_d1;
	reg	r_temp_d2;
	always@(posedge i_clk_s)	begin
		r_temp_d0	<=	r_temp		;
		r_temp_d1	<=	r_temp_d0	;
		r_temp_d2	<=	r_temp_d1	;
	end
	assign o_pluse_s	=	r_temp_d2	^	r_temp_d1	;
endmodule
原理图
相关推荐
ZPC821011 天前
docker 镜像备份
人工智能·算法·fpga开发·机器人
ZPC821011 天前
docker 使用GUI ROS2
人工智能·算法·fpga开发·机器人
tiantianuser11 天前
RDMA设计53:构建RoCE v2 高速数据传输系统板级测试平台2
fpga开发·rdma·高速传输·cmac·roce v2
博览鸿蒙11 天前
FPGA 和 IC,哪个前景更好?怎么选?
fpga开发
FPGA_小田老师11 天前
xilinx原语:ISERDESE2原语详解(串并转换器)
fpga开发·iserdese2·原语·串并转换
tiantianuser11 天前
RDMA设计50: 如何验证网络嗅探功能?
网络·fpga开发·rdma·高速传输·cmac·roce v2
Lzy金壳bing11 天前
基于Vivado平台对Xilinx-7K325t FPGA芯片进行程序在线更新升级
fpga开发·vivado·xilinx
unicrom_深圳市由你创科技11 天前
医疗设备专用图像处理板卡定制
图像处理·人工智能·fpga开发
tiantianuser11 天前
RDMA设计52:构建RoCE v2 高速数据传输系统板级测试平台
fpga开发·rdma·高速传输·cmac·roce v2
luoganttcc12 天前
Taalas 将人工智能模型蚀刻到晶体管上,以提升推理能力
人工智能·fpga开发