FPGA设计中的跨时钟域问题
2014-04-18俞帆张伟欣
俞帆+张伟欣
摘 要: 随着FPGA设计中的时钟频率越来越高,时钟方案越来越复杂,跨时钟域问题变成了设计和验证中的关键点。为了解决跨时钟域问题对FPGA设计造成功能错误,对跨时钟域信号采用两级寄存器或多级寄存器同步、握手协议和异步FIFO等同步方法;同时还提出了不检查时序、修改SDF文件和添加约束文件三种仿真中的技术,解决了跨时钟域产生的亚稳态现象对FPGA仿真验证造成的影响。
关键词: CDC; 亚稳态; 同步; 仿真
中图分类号: TN710?34 文献标识码: A 文章编号: 1004?373X(2014)07?0151?03
Problem of clock domain crossing in FPGA design
YU Fan, ZHANG Wei?xin
(Shanghai Aerospace Electronic Technology Institute, Shanghai 201109, China)
Abstract: With the increasing clock frequency in the FPGA design, the clock scheme is more and more complex, and the issue of crossing the clock domain becomes a key point in design and verification. In order to correct the function error in FPGA design generated by crossing clock domain, two?stage register or multi?stage register synchronization, hand?shake protocol and asynchronous FIFO are used for the signal crossing the clock domain. At the same time, some technologies of no?timing check, SDF file modification and constraint file addition are proposed, which overcome influence of metastable state phenomennon produced by clock domain crossing on FPGA simulation and verification.
Keywords: CDC; metastability; synchronization; simulation
0 引 言
在FPGA(Field Programmable Gate Array,现场可编程门阵列)设计中往往存在多个时钟域,这就会带来跨时钟域(Clock Domain Crossing,CDC)问题。如果对跨时钟域产生的亚稳态等问题解决不当,就有可能造成设计功能错误。本文就跨时钟域问题产生的原因、在设计中的解决方法和仿真验证中的相关技术进行阐述和讨论,这对提高FPGA设计的可靠性有着重要的意义。
1 亚稳态
在数字集成电路中,寄存器要满足建立时间(setup time)和保持时间(hold time)的时序要求。建立时间是指在时钟沿到来之前,寄存器输入数据信号必须保持稳定的时间。保持时间是指在时钟沿之后,数据信号必须保持稳定的时间。亚稳态(Metastability)现象就是如果寄存器数据端的变化与时钟的有效沿很近(不能满足建立时间或保持时间要求),其输出信号就会在一段不可预知长度的时间内处于一个非“0”非“1”的中间状态(这段时间称为亚稳态恢复时间),之后可能稳定在“1”状态,也可能稳定在“0” 状态。而且这种亚稳态可能向后传播,造成后级出现逻辑错误。……
