[go: up one dir, main page]

CN1983225A - Device and method for transmitting data in asynchronous clock domain - Google Patents

Device and method for transmitting data in asynchronous clock domain Download PDF

Info

Publication number
CN1983225A
CN1983225A CN 200610078321 CN200610078321A CN1983225A CN 1983225 A CN1983225 A CN 1983225A CN 200610078321 CN200610078321 CN 200610078321 CN 200610078321 A CN200610078321 A CN 200610078321A CN 1983225 A CN1983225 A CN 1983225A
Authority
CN
China
Prior art keywords
data
terminal
counter
phase
input
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN 200610078321
Other languages
Chinese (zh)
Other versions
CN100465934C (en
Inventor
吴奇祥
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Huawei Technologies Co Ltd
Original Assignee
Huawei Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Priority to CNB2006100783219A priority Critical patent/CN100465934C/en
Publication of CN1983225A publication Critical patent/CN1983225A/en
Application granted granted Critical
Publication of CN100465934C publication Critical patent/CN100465934C/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Synchronisation In Digital Transmission Systems (AREA)

Abstract

本发明公开了一种在异步时钟域传输数据的装置以及一种在异步时钟域传输数据的方法。其中发送方位于数据随路时钟域,接收方位于系统工作时钟域,所述方法包括以下步骤:A.发送方在写使能信号有效时,将数据缓存在存储单元中,同时产生一个数据就绪指示信号并发送给接收方;B.接收方在检测到所述数据就绪指示信号边沿时产生数据指示信号;C.根据所述数据指示信号调整第一计数器的相位,并在第一计数器的相位达到预先设定的相位时从存储单元读取数据。本发明实现了数据在异步时钟域之间稳定地传输,并且将传输延迟误差控制在接收方的一个时钟周期内,这样只需要通过提升接收方系统工作时钟的频率就能有效地降低误差的绝对值。

Figure 200610078321

The invention discloses a device for transmitting data in an asynchronous clock domain and a method for transmitting data in an asynchronous clock domain. Wherein the sender is located in the data-associated clock domain, and the receiver is located in the system work clock domain, the method includes the following steps: A. The sender buffers the data in the storage unit when the write enable signal is effective, and simultaneously generates a data-ready The indication signal is sent to the receiver; B. The receiver generates a data indication signal when detecting the edge of the data ready indication signal; C. Adjusts the phase of the first counter according to the data indication signal, and at the phase of the first counter Data is read from the memory cell when a preset phase is reached. The invention realizes the stable transmission of data between asynchronous clock domains, and controls the transmission delay error within one clock cycle of the receiver, so that the absolute error can be effectively reduced only by increasing the frequency of the receiver's system working clock value.

Figure 200610078321

Description

一种在异步时钟域传输数据的装置及其方法A device and method for transmitting data in an asynchronous clock domain

技术领域technical field

本发明涉及数据传输技术领域,特别是一种在异步时钟域传输数据的装置及其方法。The invention relates to the technical field of data transmission, in particular to a device and method for transmitting data in an asynchronous clock domain.

背景技术Background technique

在大多数系统中,数据在不同单板之间的传输采用串行方式,而不同单板之间为异步时钟。但是,即使不同单板的异步时钟是同源的,但由于它们是经过不同的锁相环(PLL)或者不同的途径得到的,各自的时钟信号抖动(Jitter)是不同的,而且在任何一个短时间内它们都会存在频差,只是从长时间的统计结果来看是同步到时钟源上的,因此不同单板的两个时钟在一定时间内会出现相位漂移,相位漂移的最大值取决于时钟源、PLL等部件的质量。In most systems, data is transmitted between different boards in a serial manner, while asynchronous clocks are used between different boards. However, even if the asynchronous clocks of different boards have the same source, because they are obtained through different phase-locked loops (PLL) or different channels, the respective clock signal jitters (Jitter) are different, and in any There will be a frequency difference in a short period of time, but the long-term statistical results show that they are synchronized to the clock source, so two clocks on different boards will have phase drift within a certain period of time, and the maximum value of the phase drift depends on The quality of components such as clock sources and PLLs.

目前绝大多数的系统都是使用先进先出存储器(FIFO)来实现在两个时钟域之间传递数据。典型的FIFO为一个双口访问的存储器,如图1所示,FIFO包括存储单元、写地址计数器、读地址计数器、写地址格雷码发生器、读地址格雷码发生器以及清空检测和溢出检测逻辑。其中存储单元用来缓存数据,可以采用随机存取存储器(RAM)或者寄存器实现,它的深度决定了FIFO能够容忍的最大时钟抖动、相位漂移以及频率波动;写地址计数器和读地址计数器用来产生访问存储单元的地址,它们为循环计数器,即地址计数到存储单元的最大地址后从0开始重新计数;写地址格雷码发生器和读地址格雷码发生器,在每写入一个数据或者读出一个数据时就将写地址格雷码和读地址格雷码增加1,并将写地址格雷码或读地址格雷码输入清空检测和溢出检测逻辑;清空检测和溢出检测逻辑根据写地址格雷码和读地址格雷码以及即将发生的读写操作来判断FIFO是否发生了被清空或者溢出了,发出清空指示或溢出指示的信号,读写控制端则根据这些信号作出相应的操作,如停止写或者停止读。Most systems today use first-in-first-out memory (FIFO) to transfer data between two clock domains. A typical FIFO is a dual-port access memory. As shown in Figure 1, the FIFO includes a storage unit, a write address counter, a read address counter, a write address Gray code generator, a read address Gray code generator, and empty detection and overflow detection logic. . The storage unit is used to cache data, which can be realized by random access memory (RAM) or registers. Its depth determines the maximum clock jitter, phase drift and frequency fluctuation that the FIFO can tolerate; the write address counter and read address counter are used to generate The address of the access storage unit, they are loop counters, that is, the address counts to the maximum address of the storage unit and starts counting again from 0; the write address Gray code generator and the read address Gray code generator, each time a data is written or read When there is one piece of data, the gray code of the write address and the gray code of the read address are increased by 1, and the gray code of the write address or the gray code of the read address is input into the empty detection and overflow detection logic; the empty detection and overflow detection logic is based on the gray code of the write address and the read address Gray code and the upcoming read and write operations are used to determine whether the FIFO has been emptied or overflowed, and a signal for clearing or overflow indication is sent, and the read and write control terminal makes corresponding operations according to these signals, such as stopping writing or stopping reading.

FIFO可以在频率发生偏差或读写时钟的抖动和相位漂移时,将数据稳定地从一个时钟域传到另一个时钟域上。但当FIFO的读、写端口中任一端口发生异常导致读、写地址发生跳变时,FIFO是不能够检测出来的,也不可能调整数据在FIFO的传输延迟,因此FIFO不能满足对传输延迟误差敏感的应用场合。FIFO can stably transmit data from one clock domain to another clock domain when the frequency deviates or the jitter and phase drift of the read and write clocks occur. However, when any of the read and write ports of the FIFO is abnormal and the read and write addresses jump, the FIFO cannot detect it, and it is impossible to adjust the transmission delay of the data in the FIFO, so the FIFO cannot meet the requirements for the transmission delay. error-sensitive applications.

发明内容Contents of the invention

有鉴于此,本发明提出了一种在异步时钟域传输数据的装置,其目的在于,实现数据在异步时钟域之间稳定传输的同时,有效地控制传输延迟误差。本发明的另一个目的在于提供一种在异步时钟域传输数据的方法。In view of this, the present invention proposes a device for transmitting data in asynchronous clock domains, the purpose of which is to effectively control transmission delay errors while realizing stable data transmission between asynchronous clock domains. Another object of the present invention is to provide a method for transmitting data in an asynchronous clock domain.

根据上述目的,本发明提供了一种在异步时钟域传输数据的装置,该装置包括:存储单元,用于缓存数据;写数据端,用于在写使能信号有效时将数据缓存在存储单元中;数据就绪指示信号发生电路,用于在写使能信号有效时产生数据就绪指示信号;沿检测电路,用于检测数据就绪指示信号发生电路产生的数据就绪指示信号的边沿,在检测到所述数据就绪指示信号的边沿时产生数据指示信号;包括第一计数器的相位监测和数据采集相位发生器,用于根据所述数据指示信号调整第一计数器的相位,并在第一计数器的相位达到预先设定的相位时产生数据采集使能信号;读数据端,用于根据相位监测和数据采集相位发生器产生的数据采集使能信号从存储单元读取数据;其中写数据端、数据就绪指示信号发生电路工作在数据随路时钟域,沿检测电路、相位监测和数据采集相位发生器、以及读数据端工作在系统工作时钟域。According to the above purpose, the present invention provides a device for transmitting data in an asynchronous clock domain, the device includes: a storage unit for caching data; a write data terminal for caching data in the storage unit when the write enable signal is valid Middle; the data ready indication signal generation circuit is used to generate the data ready indication signal when the write enable signal is effective; the edge detection circuit is used to detect the edge of the data ready indication signal generated by the data ready indication signal generation circuit, The data indication signal is generated when the edge of the data ready indication signal; the phase monitoring and data acquisition phase generator including the first counter is used to adjust the phase of the first counter according to the data indication signal, and when the phase of the first counter reaches A data acquisition enable signal is generated at a preset phase; the read data terminal is used to read data from the storage unit according to the data acquisition enable signal generated by the phase monitoring and data acquisition phase generator; among them, the write data terminal and the data ready indication The signal generation circuit works in the data follow-up clock domain, and the edge detection circuit, phase monitoring and data acquisition phase generator, and the data read terminal work in the system working clock domain.

该装置进一步包括位于数据就绪指示信号发生电路与沿检测电路之间的信号延迟电路,用于将所述数据就绪指示信号锁存至少两个时钟周期后输入所述沿检测电路。The device further includes a signal delay circuit located between the data-ready indication signal generation circuit and the edge detection circuit, configured to latch the data-ready indication signal for at least two clock cycles and input it to the edge detection circuit.

所述信号延迟电路由多个串连的D触发器组成。The signal delay circuit is composed of a plurality of D flip-flops connected in series.

所述数据就绪指示信号发生电路包括第一选择器、第二选择器、D触发器和延时器。其中,第一选择器的1输入端被输入0,0输入端与所述D触发器的输出端相连,控制端与所述延时器的输出端相连,输出端与第二选择器的0输入端相连;第二选择器的1输入端被输入1,0输入端被与第一选择器的输出端相连,控制端被输入写使能信号,输出端与所述D触发器的D输入端相连;所述D触发器的D输入端与第二选择器的输出端相连,输出端与所述沿检测电路、第一选择器的0输入端以及所述延时器的输入端相连;所述延时器的输入端与所述D触发器的输出端相连,输出端与第一选择器的控制端相连。The data ready indication signal generation circuit includes a first selector, a second selector, a D flip-flop and a delayer. Wherein, the 1 input terminal of the first selector is input into 0, the 0 input terminal is connected with the output terminal of the D flip-flop, the control terminal is connected with the output terminal of the delayer, and the output terminal is connected with the 0 terminal of the second selector. The input terminal is connected; the 1 input terminal of the second selector is input to 1, the 0 input terminal is connected to the output terminal of the first selector, the control terminal is input with a write enable signal, and the output terminal is connected to the D input of the D flip-flop The D input terminal of the D flip-flop is connected with the output terminal of the second selector, and the output terminal is connected with the edge detection circuit, the 0 input terminal of the first selector and the input terminal of the delayer; The input terminal of the delayer is connected with the output terminal of the D flip-flop, and the output terminal is connected with the control terminal of the first selector.

所述延时器由多个串连的D触发器组成,或者为等待多个时钟周期输出信号的计数器。The delayer is composed of a plurality of D flip-flops connected in series, or is a counter that waits for multiple clock cycles to output signals.

所述相位监测和数据采集相位发生器进一步包括第三选择器、第四选择器、第五选择器、第一D触发器、第二D触发器以及第二计数器。其中,第三选择器的1输入端被输入1,0输入端与第一D触发器的输出端相连,控制端被输入所述数据指示信号,输出端与第一D触发器的D输入端相连;第四选择器的1输入端被输入所述数据指示信号,0输入端被输入0,控制端与第一计数器的输出端相连,输出端与第五选择器的输入端相连;第五选择器的1输入端被输入所述数据指示信号,0输入端与第四选择器的输出端相连,控制端与第一D触发器的输出端相连,输出端与第一计数器的清零端相连;第一D触发器的D输入端与第三选择器的输出端相连,输出端与第三选择器的0输入端、第五选择器的控制端以及第一计数器的使能端相连;第二D触发器的D输入端与第一计数器的输出端相连,使能端被输入所述数据指示信号,输出端与第二计数器的清零端相连;第一计数器的清零端与第五选择器的输出端相连,使能端与第一D触发器的输出端相连,输出端与第四选择器的控制端以及第二D触发器的D输入端相连,第一计数器的输出端输出数据采集使能信号;第二计数器的清零端与其输出端以及第二D触发器的输出端相连,使能端被输入所述数据指示信号,输出端与其清零端相连。The phase monitoring and data acquisition phase generator further includes a third selector, a fourth selector, a fifth selector, a first D flip-flop, a second D flip-flop, and a second counter. Wherein, the 1 input terminal of the third selector is input to 1, the 0 input terminal is connected to the output terminal of the first D flip-flop, the control terminal is input to the data indication signal, and the output terminal is connected to the D input terminal of the first D flip-flop connected; the 1 input terminal of the fourth selector is input to the data indication signal, the 0 input terminal is input 0, the control terminal is connected to the output terminal of the first counter, and the output terminal is connected to the input terminal of the fifth selector; the fifth The 1 input terminal of the selector is input with the data indication signal, the 0 input terminal is connected to the output terminal of the fourth selector, the control terminal is connected to the output terminal of the first D flip-flop, and the output terminal is connected to the clearing terminal of the first counter connected; the D input terminal of the first D flip-flop is connected with the output terminal of the third selector, and the output terminal is connected with the 0 input terminal of the third selector, the control terminal of the fifth selector and the enabling terminal of the first counter; The D input end of the second D flip-flop is connected to the output end of the first counter, the enable end is input to the data indication signal, and the output end is connected to the clear end of the second counter; the clear end of the first counter is connected to the first counter. The output terminals of the five selectors are connected, the enabling terminal is connected with the output terminal of the first D flip-flop, the output terminal is connected with the control terminal of the fourth selector and the D input terminal of the second D flip-flop, and the output terminal of the first counter Output data acquisition enabling signal; the clearing terminal of the second counter is connected with its output terminal and the output terminal of the second D flip-flop, the enabling terminal is input with the data indication signal, and the output terminal is connected with its clearing terminal.

所述存储单元为随机存取存储单元或寄存器。The storage unit is a random access storage unit or a register.

本发明还提供了一种在异步时钟域传输数据的方法,其中发送方位于数据随路时钟域,接收方位于系统工作时钟域并包括第一计数器,该方法包括以下步骤:A.发送方在写使能信号有效时,将数据缓存在存储单元中,同时产生一个数据就绪指示信号并发送给接收方;B.接收方在检测到所述数据就绪指示信号边沿时产生数据指示信号;C.根据所述数据指示信号调整第一计数器的相位,并在第一计数器的相位达到设定相位时从存储单元读取数据。The present invention also provides a method for transmitting data in the asynchronous clock domain, wherein the sender is located in the data-associated clock domain, and the receiver is located in the system working clock domain and includes a first counter. The method includes the following steps: A. When the write enable signal is valid, the data is cached in the storage unit, and a data ready indication signal is generated and sent to the receiver; B. The receiver generates a data indication signal when detecting the edge of the data ready indication signal; C. Adjusting the phase of the first counter according to the data indication signal, and reading data from the storage unit when the phase of the first counter reaches the set phase.

步骤B前进一步包括将所述数据就绪指示信号锁存一个以上时钟周期的步骤。The step before step B further includes the step of latching the data ready indication signal for more than one clock cycle.

步骤C中所述根据所述数据指示信号调整第一计数器的相位的步骤包括:判断数据指示信号到达时第一计数器当前相位是否等于其最大相位,在不等于的情况下,判断所述当前相位与最大相位的相差绝对值是否大于1,如果大于1,则在下一个数据指示信号到达时,触发所述第一计数器重新计数,如果小于等于1,则在连续多个数据指示信号到达时所述第一计数器当前相位与其最大相位的差值保持不变的情况下,触发所述第一计数器重新计数。The step of adjusting the phase of the first counter according to the data indication signal in step C includes: judging whether the current phase of the first counter is equal to its maximum phase when the data indication signal arrives, and if not, judging whether the current phase Whether the absolute value of the difference from the maximum phase is greater than 1, if greater than 1, when the next data indication signal arrives, trigger the first counter to count again, if less than or equal to 1, then when multiple consecutive data indication signals arrive When the difference between the current phase of the first counter and its maximum phase remains unchanged, the first counter is triggered to count again.

步骤C中所述在第一计数器的相位达到设定相位时从存储单元读取数据的步骤包括:在第一计数器的相位到达预先设定的相位时产生数据采集使能信号;根据所述数据采集使能信号从存储单元读取数据。The step of reading data from the storage unit when the phase of the first counter reaches the set phase described in step C includes: generating a data acquisition enable signal when the phase of the first counter reaches the preset phase; The acquisition enable signal reads data from the storage unit.

从上述技术方案中可以看出,由于本发明采用传递数据指示信号的方式来实现异步时钟域时间数据相位的锁定,从而实现数据在异步时钟域之间稳定地传输,并且将传输延迟误差控制在接收方的一个时钟周期内,这样只需要通过提升接收方系统工作时钟的频率就能有效地降低误差的绝对值。与现有技术的FIFO相比,不需要复杂的格雷码转换以及溢出清零判断,实现比较简单。It can be seen from the above technical solution that since the present invention adopts the method of transmitting the data indication signal to realize the locking of the time data phase of the asynchronous clock domain, thereby realizing the stable transmission of data between the asynchronous clock domains, and controlling the transmission delay error within Within one clock cycle of the receiving side, the absolute value of the error can be effectively reduced only by increasing the frequency of the working clock of the receiving side system. Compared with the FIFO in the prior art, it does not need complex gray code conversion and judgment of overflow clearing, and the implementation is relatively simple.

附图说明Description of drawings

图1为现有技术中FIFO的结构示意图。FIG. 1 is a schematic structural diagram of a FIFO in the prior art.

图2为本发明实施例中装置的结构示意图。Fig. 2 is a schematic structural diagram of the device in the embodiment of the present invention.

图3为本发明实施例中各信号的时序图。FIG. 3 is a timing diagram of various signals in the embodiment of the present invention.

图4为本发明实施例的装置中相位监测和数据采集相位发生器的结构示意图。Fig. 4 is a schematic structural diagram of a phase generator for phase monitoring and data acquisition in the device of the embodiment of the present invention.

具体实施方式Detailed ways

为使本发明的目的、技术方案和优点更加清楚,以下举实施例对本发明进一步详细说明。In order to make the purpose, technical solution and advantages of the present invention clearer, the following examples are given to further describe the present invention in detail.

参考图2,本发明采用的装置包括写数据端、存储单元、数据就绪指示信号发生电路、信号延迟电路、沿检测电路、相位监测和数据采集相位发生器、以及读数据端。其中,发送方的写数据端和数据就绪指示信号发生电路工作在数据随路时钟域Clk_in,接收方的信号延迟电路、沿检测电路、相位监测和数据采集相位发生器、以及读数据端都工作在系统工作时钟域Clk_sys。下面分别介绍各部分的结构及功能。With reference to Fig. 2, the device that the present invention adopts comprises writing data end, storage unit, data ready indication signal generation circuit, signal delay circuit, edge detection circuit, phase monitoring and data acquisition phase generator, and read data end. Among them, the sender's write data terminal and data ready indication signal generation circuit work in the data follower clock domain Clk_in, and the receiver's signal delay circuit, edge detection circuit, phase monitoring and data acquisition phase generator, and read data terminal all work Work in the system clock domain Clk_sys. The structure and function of each part are introduced respectively below.

写数据端包括一个D触发器,在写使能信号Data_wt_en有效时,写入数据Data_in,即将数据缓存在存储单元中。The write data terminal includes a D flip-flop, and when the write enable signal Data_wt_en is valid, write data Data_in, that is, cache the data in the storage unit.

存储单元为RAM或者寄存器,用来缓存从写数据端输入的数据,并由读数据端读取输出这些数据。The storage unit is a RAM or a register, which is used to cache data input from the write data end, and read and output the data by the read data end.

数据就绪指示信号发生电路,根据写使能信号Data_wt_en产生一个数据就绪指示信号Data_rdy,信号Data_rdy用来通知接收方当前数据已经准备就绪。为了保证在系统工作时钟域采集到Data_rdy信号,Data_rdy信号的高低电平脉冲宽度必须大于系统工作时钟域中一个时钟周期的宽度。参见图3,图3中所示的Data_rdy信号的高低电平脉冲宽度远大于系统工作时钟域Clk_sys的一个时钟周期的宽度,这样能保证系统工作时钟域的模块能够采集到Data_rdy信号。The data ready indication signal generation circuit generates a data ready indication signal Data_rdy according to the write enable signal Data_wt_en, and the signal Data_rdy is used to notify the receiver that the current data is ready. In order to ensure that the Data_rdy signal is collected in the system working clock domain, the high and low level pulse width of the Data_rdy signal must be greater than the width of one clock cycle in the system working clock domain. Referring to Fig. 3, the high and low level pulse width of the Data_rdy signal shown in Fig. 3 is much larger than the width of one clock cycle of the system working clock domain Clk_sys, which ensures that the modules in the system working clock domain can collect the Data_rdy signal.

继续参考图2,该数据就绪指示信号发生电路包括两个二选一的选择器、一个D触发器和一个延时器,所述两个二选一的选择器为第一选择器和第二选择器。其中,第一选择器和第二选择器分别根据自身控制端的控制信号为0或1,相应地输出0输入端或1输入端的信号;D触发器在使能端(En端)的输入信号有效时,输出D端的输入,在En端没有输入信号时,输出上一个时钟周期时的D端输入信号;延时器用于将Data_rdy信号延迟N个时钟周期,它可以由N个串连的D触发器构成,也可以由等待N个时钟周期后输出输入信号的计数器实现。在数据就绪指示信号发生电路中,第一选择器的1输入端被输入0,0输入端与所述D触发器的输出端相连,控制端与所述延时器的输出端相连,输出端与第二选择器的0输入端相连;第二选择器的1输入端被输入1,0输入端被与第一选择器的输出端相连,控制端被输入写使能信号,输出端与所述D触发器的D输入端相连;所述D触发器的D输入端与第二选择器的输出端相连,输出端与所述沿检测电路、第一选择器的0输入端以及所述延时器的输入端相连;所述延时器的输入端与所述D触发器的输出端相连,输出端与第一选择器的控制端相连。Continuing to refer to Fig. 2, this data-ready indication signal generating circuit comprises two alternative selectors, a D flip-flop and a delayer, and the two alternative selectors are the first selector and the second selector. Selector. Among them, the first selector and the second selector respectively output the signal of the 0 input terminal or the 1 input terminal according to the control signal of the control terminal of itself as 0 or 1; the input signal of the D flip-flop at the enable terminal (En terminal) is valid , output the input of the D terminal, when there is no input signal at the En terminal, output the input signal of the D terminal in the previous clock cycle; the delayer is used to delay the Data_rdy signal for N clock cycles, and it can be triggered by N serially connected D It can also be implemented by a counter that outputs an input signal after waiting for N clock cycles. In the data-ready indication signal generating circuit, the 1 input terminal of the first selector is input to 0, the 0 input terminal is connected to the output terminal of the D flip-flop, the control terminal is connected to the output terminal of the delayer, and the output terminal It is connected with the 0 input terminal of the second selector; the 1 input terminal of the second selector is input with 1, the 0 input terminal is connected with the output terminal of the first selector, the control terminal is input with the write enable signal, and the output terminal is connected with all The D input end of the D flip-flop is connected; the D input end of the D flip-flop is connected with the output end of the second selector, and the output end is connected with the edge detection circuit, the 0 input end of the first selector, and the delay The input end of the timer is connected; the input end of the delayer is connected with the output end of the D flip-flop, and the output end is connected with the control end of the first selector.

在工作过程中,第一选择器1输入端被输入0,0输入端被输入Data_rdy信号,并根据被计数器延迟N个时钟周期的Data_rdy信号的控制向第二选择器的0输入端输出信号,第二选择器的1输入端为1,它根据写使能信号Data_wt_en向D触发器输出信号,然后D触发器向信号延迟电路、第一选择器的0输入端以及作为延时器的计数器输出Data_rdy信号。In the working process, the first selector 1 input terminal is input 0, the 0 input terminal is input Data_rdy signal, and according to the control of the Data_rdy signal delayed by the counter for N clock cycles, the signal is output to the 0 input terminal of the second selector, The 1 input of the second selector is 1, it outputs a signal to the D flip-flop according to the write enable signal Data_wt_en, and then the D flip-flop outputs to the signal delay circuit, the 0 input of the first selector, and the counter as a delayer Data_rdy signal.

信号延迟电路,用于将Data_rdy信号锁存至少两个系统工作时钟域时钟周期后再输入沿检测电路,其目的在于尽可能地减少亚稳态出现的概率。这里的信号延迟电路通过串连的多个D触发器实现。图2中所示的信号延迟电路包括3个D触发器,将Data_rdy信号锁存三个时钟周期后,再输入到沿检测电路。The signal delay circuit is used for latching the Data_rdy signal for at least two system working clock domain clock cycles and then inputting it into the edge detection circuit, the purpose of which is to reduce the occurrence probability of metastable states as much as possible. The signal delay circuit here is realized by connecting multiple D flip-flops in series. The signal delay circuit shown in Fig. 2 includes 3 D flip-flops, after latching the Data_rdy signal for three clock cycles, it is input to the edge detection circuit.

沿检测电路用于对Data_rdy信号进行边沿检测,当检测到Data_rdy的上升沿时,产生在系统时钟域的数据指示信号Data_rdy_sync,Data_rdy_sync信号只有一个时钟周期宽度。本实施例采用将当前Data_rdy信号与一个时钟周期之前的Data_rdy信号相比较的方法对Data_rdy信号进行边沿检测,即比较信号延迟电路最后一个D触发器之前的信号(一个时钟周期之前的Data_rdy信号)和之后的信号(当前Data_rdy信号),显然在当前Data_rdy信号为1、一个时钟周期之前的Data_rdy信号为0时,Data_rdy信号有上升沿,然后根据该上升沿产生Data_rdy_sync信号,并将Data_rdy_sync信号输入相位监测和数据采集相位发生器。The edge detection circuit is used to detect the edge of the Data_rdy signal. When the rising edge of Data_rdy is detected, the data indication signal Data_rdy_sync in the system clock domain is generated. The Data_rdy_sync signal has only one clock cycle width. This embodiment adopts the method of comparing the current Data_rdy signal with the Data_rdy signal before one clock cycle to detect the edge of the Data_rdy signal, that is, comparing the signal before the last D flip-flop of the signal delay circuit (the Data_rdy signal before one clock cycle) and The subsequent signal (the current Data_rdy signal), obviously when the current Data_rdy signal is 1 and the Data_rdy signal before one clock cycle is 0, the Data_rdy signal has a rising edge, and then the Data_rdy_sync signal is generated according to the rising edge, and the Data_rdy_sync signal is input to the phase monitor and data acquisition phase generator.

相位监测和数据采集相位发生器,用于将传输迟延控制在一个时钟周期内,以及产生一个数据采集使能信号Data_sample_en,并将Data_sample_en信号输入读数据端。如图3中所示,所产生的Data_sample_en信号刚好在数据缓存寄存器信号Data_tmp前后两个变化点的中间位置,这样使得异步时钟域间的抖动和相位漂移对数据传输的影响达到最小。异步时钟域间的抖动和相位漂移可以等效为Clk_sys相对于稳定不变的Clk_in左右移动,显然在数据前后变化的中间时刻采集数据能得到最稳定的传输效果。The phase monitoring and data acquisition phase generator is used to control the transmission delay within one clock cycle, and generate a data acquisition enable signal Data_sample_en, and input the Data_sample_en signal to the read data terminal. As shown in Figure 3, the generated Data_sample_en signal is just in the middle of the two change points before and after the data buffer register signal Data_tmp, so that the impact of the jitter and phase drift between the asynchronous clock domains on the data transmission is minimized. The jitter and phase drift between asynchronous clock domains can be equivalent to the left and right movement of Clk_sys relative to the stable Clk_in. Obviously, collecting data at the middle moment of the data change can obtain the most stable transmission effect.

如图4所示,相位监测和数据采集相位发生器包括计数器A(第一计数器)、计数器B(第二计数器)、以及辅助它们实现功能的三个二选一的选择器和两个D触发器,所述三个二选一的选择器为第三选择器、第四选择器和第五选择器,所述两个D触发器为第一D触发器和第二D触发器。其中,第三选择器的1输入端被输入1,0输入端与第一D触发器的输出端相连,控制端被输入所述数据指示信号,输出端与第一D触发器的D输入端相连;第四选择器的1输入端被输入所述数据指示信号,0输入端被输入0,控制端与计数器A的输出端相连,输出端与第五选择器的输入端相连;第五选择器的1输入端被输入所述数据指示信号,0输入端与第四选择器的输出端相连,控制端与第一D触发器的输出端相连,输出端与计数器A的清零端相连;第一D触发器的D输入端与第三选择器的输出端相连,输出端与第三选择器的0输入端、第五选择器的控制端以及计数器A的使能端相连;第二D触发器的D输入端与计数器A的输出端相连,使能端被输入所述数据指示信号,输出端与计数器B的清零端相连;计数器A的清零端与第五选择器的输出端相连,使能端与第一D触发器的输出端相连,输出端与第四选择器的控制端以及第二D触发器的D输入端相连,计数器A的输出端输出数据采集使能信号;计数器B的清零端与其输出端以及第二D触发器的输出端相连,使能端被输入所述数据指示信号,输出端与其清零端相连。As shown in Figure 4, the phase generator for phase monitoring and data acquisition includes counter A (the first counter), counter B (the second counter), and three selectors and two D triggers that assist them in realizing their functions. The three alternative selectors are the third selector, the fourth selector and the fifth selector, and the two D flip-flops are the first D flip-flop and the second D flip-flop. Wherein, the 1 input terminal of the third selector is input to 1, the 0 input terminal is connected to the output terminal of the first D flip-flop, the control terminal is input to the data indication signal, and the output terminal is connected to the D input terminal of the first D flip-flop connected; the 1 input terminal of the fourth selector is input to the data indication signal, the 0 input terminal is input 0, the control terminal is connected to the output terminal of the counter A, and the output terminal is connected to the input terminal of the fifth selector; the fifth selector The 1 input terminal of the device is input with the data indication signal, the 0 input terminal is connected with the output terminal of the fourth selector, the control terminal is connected with the output terminal of the first D flip-flop, and the output terminal is connected with the clearing terminal of the counter A; The D input terminal of the first D flip-flop is connected with the output terminal of the third selector, and the output terminal is connected with the 0 input terminal of the third selector, the control terminal of the fifth selector and the enabling terminal of the counter A; the second D The D input terminal of the flip-flop is connected to the output terminal of the counter A, the enabling terminal is input to the data indication signal, and the output terminal is connected to the clearing terminal of the counter B; the clearing terminal of the counter A is connected to the output terminal of the fifth selector connected, the enabling end is connected to the output end of the first D flip-flop, the output end is connected to the control end of the fourth selector and the D input end of the second D flip-flop, and the output end of the counter A outputs a data acquisition enabling signal; The clearing terminal of the counter B is connected to its output terminal and the output terminal of the second D flip-flop, the enable terminal is input with the data indication signal, and the output terminal is connected to its clearing terminal.

计数器A在第一个Data_rdy_sync信号到来时根据指示接收数据开始的Receive_start信号启动计数,即清零开始计数。如图4所示,由第三选择器和第一D触发器根据Data_rdy_sync信号产生上述Receive_start信号,第三选择器1输入端被输入1,0输入端被输入Receive_start信号,根据Data_rdy_sync信号的控制向第一D触发器输入相应信号,第一D触发器输出Receive_start信号,该Receive_start信号分别输入上述第三选择器的0输入端、计数器A的使能端以及第五选择器的控制端。Counter A starts counting according to the Receive_start signal indicating the start of receiving data when the first Data_rdy_sync signal arrives, that is, it is cleared to start counting. As shown in Figure 4, the above-mentioned Receive_start signal is generated by the third selector and the first D flip-flop according to the Data_rdy_sync signal, the input terminal of the third selector 1 is input 1, and the input terminal 0 is input Receive_start signal, according to the control of the Data_rdy_sync signal to The first D flip-flop inputs a corresponding signal, and the first D flip-flop outputs a Receive_start signal, which is respectively input to the 0 input terminal of the third selector, the enable terminal of the counter A, and the control terminal of the fifth selector.

计数器A的计数周期PH_A等于输入数据的周期对应在系统工作时钟域上的时钟周期数。计数器A还在一个固定的相位CON_A产生数据采集使能信号Data_sample_en,其中CON_A是预选设定的,为了满足前面所述的Data_sample_en在Data_tmp前后两个变化点的中间位置的条件,较佳地将CON_A设定为PH_A的一半左右。并且,计数器A还在满足下面逻辑表达式(1)的时候,输出一个Phase_error信号,Phase_error信号用于控制将计数器A清零。The counting cycle PH_A of the counter A is equal to the number of clock cycles corresponding to the cycle of the input data in the system working clock domain. The counter A also generates a data acquisition enabling signal Data_sample_en at a fixed phase CON_A, wherein CON_A is pre-selected and set. In order to meet the aforementioned condition that Data_sample_en is in the middle of the two change points before and after Data_tmp, it is better to set CON_A Set to about half of PH_A. In addition, when the counter A still satisfies the following logic expression (1), it outputs a Phase_error signal, and the Phase_error signal is used to control the clearing of the counter A.

{(|Cnt_A-PH_A|>1)‖(|Cnt_A-PH_A|=1&&Cnt_B>=CON_B)}&&Data_rdy_sync==1    (1){(|Cnt_A-PH_A|>1)‖(|Cnt_A-PH_A|=1&&Cnt_B>=CON_B)}&&Data_rdy_sync==1 (1)

逻辑表达式(1)中,|Cnt_A-PH_A|>1表示在Data_rdy_sync信号到达时如果计数器A的相位Cnt_A与计数器A的计数周期PH_A的相位差的绝对值大于1个时钟周期的情况。|Cnt_A-PH_A|=1&&Cnt_B>=CON_B表示通过计数器B对在Data_rdy_sync信号到达时计数器A的相位Cnt_A与计数器A的计数周期PH_A的相位差的绝对值等于1个时钟周期的连续事件进行计数,并且计数器B的相位Cnt_B大于等于预先设定的CON_B的情况。Data_rdy_sync==1表示当前Data_rdy_sync信号有效,即Data_rdy_sync到达时。综上,逻辑表达式(1)表示满足发生上述两个情况之一并且Data_rdy_sync有效的情形。In the logical expression (1), |Cnt_A-PH_A|>1 means that when the Data_rdy_sync signal arrives, if the absolute value of the phase difference between the phase Cnt_A of the counter A and the counting period PH_A of the counter A is greater than one clock period. |Cnt_A-PH_A|=1&&Cnt_B>=CON_B indicates that the absolute value of the phase difference between the phase Cnt_A of the counter A and the counting period PH_A of the counter A when the Data_rdy_sync signal arrives is counted by the counter B, and the continuous events of which the phase difference is equal to 1 clock period are counted, and The case where the phase Cnt_B of the counter B is greater than or equal to the preset CON_B. Data_rdy_sync==1 indicates that the current Data_rdy_sync signal is valid, that is, when Data_rdy_sync arrives. To sum up, the logical expression (1) represents a situation where one of the above two situations occurs and Data_rdy_sync is valid.

参考图4,Phase_error信号将计数器A清零是通过第四选择器和第五选择器实现的,第四选择器的1输入端被输入Data_rdy_sync、0输入端被输入0,根据Phase_error的控制向第五选择器的1输入端输入相应信号;第五选择器的0输入端被输入Data_rdy_sync信号,它根据上述Receive_start信号的控制向计数器A的清零端输入控制信号,控制计数器A进行清零。计数器A的清零端clr的优先级高于使能端en,且高电平有效。Referring to Figure 4, the Phase_error signal clears the counter A through the fourth selector and the fifth selector. The 1 input of the fourth selector is input to Data_rdy_sync, and the 0 input is input to 0. According to the control of Phase_error, the first The 1 input terminal of the five selectors inputs the corresponding signal; the 0 input terminal of the fifth selector is input with the Data_rdy_sync signal, which inputs a control signal to the clearing terminal of the counter A according to the control of the above Receive_start signal, and controls the counter A to be cleared. The priority of the clear terminal clr of the counter A is higher than that of the enable terminal en, and the high level is effective.

计数器B,用来统计在给定的CON_B个数据样点的时间内是否所有的Data_rdy_sync到来时计数器A的相位Cnt_A与计数器A的计数周期PH_A的相位差都等于1,且每一次计数器A的值都相等。如果是则计数器B不断累加,直到计数器B的值等于预先设置的CON_B后停止并将计数器A清零,这通过上述的Phase_error信号实现;如果不是则计数器B被清零,这通过下面的清零信号实现,即计数器B在满足下面逻辑表达式(2)的时候输出一个清零信号,该清零信号输入计数器B的清零端,用于将计数器B清零。计数器B的清零端clr的优先级高于使能端en,且高电平有效。Counter B is used to count whether the phase difference between the phase Cnt_A of counter A and the counting period PH_A of counter A is equal to 1 when all Data_rdy_sync arrives within a given time of CON_B data samples, and the value of counter A every time all equal. If it is, counter B will continue to accumulate until the value of counter B is equal to the preset CON_B, then stop and clear counter A, which is realized by the above-mentioned Phase_error signal; if not, counter B is cleared, which is cleared by the following Signal realization, that is, the counter B outputs a clear signal when the following logic expression (2) is satisfied, and the clear signal is input to the clear terminal of the counter B to clear the counter B. The priority of the clear terminal clr of the counter B is higher than that of the enable terminal en, and the high level is effective.

Cnt_A!=Cnt_A_back&&|Cnt_A-PH_A|==1&&Data_rdy_sync==1    (2)Cnt_A! =Cnt_A_back&&|Cnt_A-PH_A|==1&&Data_rdy_sync==1 (2)

在逻辑表达式(2)中,Cnt_A!=Cnt_A_back表示当前Data_rdy_sync到达时计数器A的相位Cnt_A_与上次Data_rdy_sync到达时计数器A的相位Cnt_A_back不同的情况;|Cnt_A-PH_A|==1表示Data_rdy_sync到达时计数器A的相位Cnt_A与计数器A的计数周期PH_A的相位差的绝对值为1的情况;Data_rdy_sync==1表示当前Data_rdy_sync信号有效,即Data_rdy_sync到达时。综上,上述逻辑表达式(2)表示同时满足上述两个情况并且Data_rdy_sync有效的情形。In logical expression (2), Cnt_A! =Cnt_A_back indicates that the phase Cnt_A_ of the counter A when the current Data_rdy_sync arrives is different from the phase Cnt_A_back of the counter A when the last Data_rdy_sync arrived; |Cnt_A-PH_A|==1 indicates that the phase Cnt_A of the counter A and the count of the counter A when the Data_rdy_sync arrives The case where the absolute value of the phase difference of the period PH_A is 1; Data_rdy_sync==1 indicates that the current Data_rdy_sync signal is valid, that is, when Data_rdy_sync arrives. To sum up, the above logical expression (2) represents a situation where the above two conditions are satisfied simultaneously and Data_rdy_sync is valid.

相位监测和数据采集相位发生器的工作过程如下:The phase monitoring and data acquisition phase generator works as follows:

步骤10,计数器A在第一个Data_rdy_sync到来时启动计数。Step 10, counter A starts counting when the first Data_rdy_sync arrives.

步骤20,后面每一个Data_rdy_sync信号到来时,计数器A判断自身的相位是否等于计数周期最大值,如果是则表示正常,计数器A继续计数;否则执行步骤30。Step 20, when each subsequent Data_rdy_sync signal arrives, the counter A judges whether its own phase is equal to the maximum value of the counting cycle, if yes, it means normal, and the counter A continues to count; otherwise, execute step 30.

步骤30,计数器A判断自身的相位与计数周期最大值的差的绝对值是否大于一个时钟周期,如果大于一个时钟周期,则表明发生了异常状态使得相位有了较大的跳变,那么在下一个Data_rdy_sync信号到来时立即更新计数器A的相位,即将计数器A清零重新计数,这时的输出数据的Data_out的间隔发生改变。如果两者差的绝对值小于等于一个时钟周期,执行步骤40,此时有两种可能:1、两个时钟域的时钟都处于正常状态,这个误差由于抖动引起的;2、两个时钟域中至少一个时钟的相位发生了偏移。Step 30, the counter A judges whether the absolute value of the difference between its own phase and the maximum value of the counting cycle is greater than one clock cycle, if it is greater than one clock cycle, it indicates that an abnormal state has occurred so that the phase has a large jump, then in the next When the Data_rdy_sync signal arrives, the phase of the counter A is updated immediately, that is, the counter A is cleared and counted again, and the interval of the Data_out of the output data at this time changes. If the absolute value of the difference between the two is less than or equal to one clock period, execute step 40. At this time, there are two possibilities: 1. The clocks of the two clock domains are in a normal state, and this error is caused by jitter; 2. The clock domains of the two clock domains are in a normal state. The phase of at least one of the clocks has shifted.

步骤40,用计数器B统计连续一段时间(即上述CON_B个数据采样点)内Data_rdy_sync到达时对应的计数器A的相位是否都等于相同的值,如果是则表示数据相位已经发生了改变,并在下一个Data_rdy_sync到达时更新计数器A的相位,即清零重新计数;否则,将计数器B清零执行步骤2重新开始判断。Step 40, use the counter B to count whether the phases of the corresponding counter A when Data_rdy_sync arrives in a continuous period of time (that is, the above-mentioned CON_B data sampling points) are all equal to the same value, if so, it means that the data phase has changed, and in the next When Data_rdy_sync arrives, update the phase of counter A, that is, clear and restart counting; otherwise, clear counter B and execute step 2 to restart the judgment.

在上述过程中,当计数器A的相位等于预先设置的CON_A时,产生数据采集使能信号Data_sample_en,并输入读数据端。In the above process, when the phase of the counter A is equal to the preset CON_A, the data acquisition enable signal Data_sample_en is generated and input to the read data terminal.

读数据端在数据采集使能信号Data_sample_en有效时,从存储单元读取数据并输出。The read data terminal reads data from the storage unit and outputs it when the data acquisition enable signal Data_sample_en is valid.

采用本发明上述装置在异步时钟域内传输数据的过程如下:The process of using the above-mentioned device of the present invention to transmit data in the asynchronous clock domain is as follows:

步骤100,在写使能信号Data_wt_en有效时,将数据缓存在存储单元中,同时产生一个数据就绪指示信号Data_rdy并发送给接收方;Step 100, when the write enable signal Data_wt_en is valid, cache the data in the storage unit, and generate a data ready indication signal Data_rdy and send it to the receiver;

步骤200,接收方对所述数据就绪指示信号Data_rdy延迟至少两个时钟周期后,对其进行边沿检测,在检测到所述数据就绪指示信号上升沿时产生数据指示信号Data_rdy_sync;Step 200, the receiver delays the data ready indication signal Data_rdy by at least two clock cycles, then performs edge detection on it, and generates the data indication signal Data_rdy_sync when the rising edge of the data ready indication signal is detected;

步骤300,在所述数据指示信号Data_rdy_sync到达时,判断此时计数器A的相位Cnt_A与计数器A的计数周期PH_A的关系,Step 300, when the data indication signal Data_rdy_sync arrives, judge the relationship between the phase Cnt_A of the counter A and the counting period PH_A of the counter A at this time,

在计数器A相位Cnt_A等于其计数周期PH_A的情况下,即两者差值等于零时,计数器A正常计数,并在计数器A的相位达到预先设定相位CON_A时产生数据采集使能信号Data_sample_en;When the counter A phase Cnt_A is equal to its counting period PH_A, that is, when the difference between the two is equal to zero, the counter A counts normally, and generates a data acquisition enable signal Data_sample_en when the phase of the counter A reaches the preset phase CON_A;

在两者差值的绝对值大于系统工作时钟域一个时钟周期的情况下,在下一个Data_rdy_sync到达时将计数器A清零重新计数。在此期间内,在计数器A的相位达到预先设定相位CON_A时产生数据采集使能信号Data_sample_en;When the absolute value of the difference between the two is greater than one clock cycle of the system working clock domain, the counter A is cleared and counted again when the next Data_rdy_sync arrives. During this period, the data acquisition enable signal Data_sample_en is generated when the phase of the counter A reaches the preset phase CON_A;

在两者差值的绝对值小于等于一个时钟周期的情况下,进一步判断是否在连续CON_B次Data_rdy_sync信号到达时计数器A的相位都等于相同的值,如果是,则在下一个Data_rdy_sync到达时将计数器A清零重新计数;否则将计数器B清零并执行步骤C重新判断。在此期间内,在计数器A的相位达到预先设定相位CON_A时产生数据采集使能信号Data_sample_en。In the case where the absolute value of the difference between the two is less than or equal to one clock cycle, it is further judged whether the phase of counter A is equal to the same value when the CON_B consecutive Data_rdy_sync signal arrives, and if so, counter A is set when the next Data_rdy_sync arrives Clear and re-count; otherwise, clear counter B and perform step C to re-judge. During this period, the data sampling enable signal Data_sample_en is generated when the phase of the counter A reaches the preset phase CON_A.

步骤400,读数据端根据所述数据采集使能信号从存储单元读取数据。In step 400, the data read terminal reads data from the storage unit according to the data acquisition enabling signal.

以上所述仅为本发明的较佳实施例而已,并不用以限制本发明,凡在本发明的精神和原则之内,所作的任何修改、等同替换、改进等,均应包含在本发明的保护范围之内。The above descriptions are only preferred embodiments of the present invention, and are not intended to limit the present invention. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present invention shall be included in the scope of the present invention. within the scope of protection.

Claims (11)

1、一种在异步时钟域传输数据的装置,其特征在于,该装置包括:1. A device for transmitting data in an asynchronous clock domain, characterized in that the device comprises: 存储单元,用于缓存数据;storage unit for caching data; 写数据端,用于在写使能信号有效时将数据缓存在存储单元中;Write data terminal, used to cache data in the storage unit when the write enable signal is valid; 数据就绪指示信号发生电路,用于在写使能信号有效时产生数据就绪指示信号;A data-ready indication signal generating circuit is used to generate a data-ready indication signal when the write enable signal is valid; 沿检测电路,用于检测数据就绪指示信号发生电路产生的数据就绪指示信号的边沿,在检测到所述数据就绪指示信号的边沿时产生数据指示信号;The edge detection circuit is used to detect the edge of the data ready indication signal generated by the data ready indication signal generating circuit, and generates the data indication signal when the edge of the data ready indication signal is detected; 包括第一计数器的相位监测和数据采集相位发生器,用于根据所述数据指示信号调整第一计数器的相位,并在第一计数器的相位达到预先设定的相位时产生数据采集使能信号;A phase monitoring and data acquisition phase generator including a first counter is used to adjust the phase of the first counter according to the data indication signal, and generate a data acquisition enabling signal when the phase of the first counter reaches a preset phase; 读数据端,用于根据相位监测和数据采集相位发生器产生的数据采集使能信号从存储单元读取数据;The read data terminal is used to read data from the storage unit according to the data acquisition enable signal generated by the phase monitoring and data acquisition phase generator; 其中写数据端、数据就绪指示信号发生电路工作在数据随路时钟域,沿检测电路、相位监测和数据采集相位发生器、以及读数据端工作在系统工作时钟域。The writing data terminal and the data ready indication signal generation circuit work in the data follower clock domain, and the edge detection circuit, phase monitoring and data acquisition phase generator, and the reading data terminal work in the system working clock domain. 2、根据权利要求1所述的装置,其特征在于,该装置进一步包括位于数据就绪指示信号发生电路与沿检测电路之间的信号延迟电路,用于将所述数据就绪指示信号锁存至少两个时钟周期后输入所述沿检测电路。2. The device according to claim 1, characterized in that the device further comprises a signal delay circuit located between the data ready indication signal generation circuit and the edge detection circuit, for latching the data ready indication signal for at least two input to the edge detection circuit after clock cycles. 3、根据权利要求2所述的装置,其特征在于,所述信号延迟电路由多个串连的D触发器组成。3. The device according to claim 2, wherein the signal delay circuit is composed of a plurality of D flip-flops connected in series. 4、根据权利要求1所述的装置,其特征在于,所述数据就绪指示信号发生电路包括第一选择器、第二选择器、D触发器和延时器,其中,4. The device according to claim 1, wherein the data ready indication signal generating circuit comprises a first selector, a second selector, a D flip-flop and a delayer, wherein, 第一选择器的1输入端被输入0,0输入端与所述D触发器的输出端相连,控制端与所述延时器的输出端相连,输出端与第二选择器的0输入端相连;The 1 input terminal of the first selector is input to 0, the 0 input terminal is connected to the output terminal of the D flip-flop, the control terminal is connected to the output terminal of the delayer, and the output terminal is connected to the 0 input terminal of the second selector. connected; 第二选择器的1输入端被输入1,0输入端被与第一选择器的输出端相连,控制端被输入写使能信号,输出端与所述D触发器的D输入端相连;The 1 input terminal of the second selector is input with 1, the 0 input terminal is connected with the output terminal of the first selector, the control terminal is input with a write enable signal, and the output terminal is connected with the D input terminal of the D flip-flop; 所述D触发器的D输入端与第二选择器的输出端相连,输出端与所述沿检测电路、第一选择器的0输入端以及所述延时器的输入端相连;The D input terminal of the D flip-flop is connected to the output terminal of the second selector, and the output terminal is connected to the edge detection circuit, the 0 input terminal of the first selector and the input terminal of the delayer; 所述延时器的输入端与所述D触发器的输出端相连,输出端与第一选择器的控制端相连。The input terminal of the delayer is connected with the output terminal of the D flip-flop, and the output terminal is connected with the control terminal of the first selector. 5、根据权利要求4所述的装置,其特征在于,所述延时器由多个串连的D触发器组成,或者为等待多个时钟周期输出信号的计数器。5. The device according to claim 4, wherein the delayer is composed of a plurality of D flip-flops connected in series, or is a counter that waits for multiple clock cycles to output signals. 6、根据权利要求1所述的装置,其特征在于,所述相位监测和数据采集相位发生器进一步包括第三选择器、第四选择器、第五选择器、第一D触发器、第二D触发器以及第二计数器,其中,6. The device according to claim 1, wherein the phase generator for phase monitoring and data acquisition further comprises a third selector, a fourth selector, a fifth selector, a first D flip-flop, a second D flip-flop and the second counter, where, 第三选择器的1输入端被输入1,0输入端与第一D触发器的输出端相连,控制端被输入所述数据指示信号,输出端与第一D触发器的D输入端相连;The 1 input terminal of the third selector is input to 1, the 0 input terminal is connected to the output terminal of the first D flip-flop, the control terminal is input to the data indication signal, and the output terminal is connected to the D input terminal of the first D flip-flop; 第四选择器的1输入端被输入所述数据指示信号,0输入端被输入0,控制端与第一计数器的输出端相连,输出端与第五选择器的输入端相连;The 1 input terminal of the fourth selector is input to the data indication signal, the 0 input terminal is input to 0, the control terminal is connected to the output terminal of the first counter, and the output terminal is connected to the input terminal of the fifth selector; 第五选择器的1输入端被输入所述数据指示信号,0输入端与第四选择器的输出端相连,控制端与第一D触发器的输出端相连,输出端与第一计数器的清零端相连;The 1 input terminal of the fifth selector is input to the data indication signal, the 0 input terminal is connected to the output terminal of the fourth selector, the control terminal is connected to the output terminal of the first D flip-flop, and the output terminal is connected to the clearing terminal of the first counter. Connected at zero end; 第一D触发器的D输入端与第三选择器的输出端相连,输出端与第三选择器的0输入端、第五选择器的控制端以及第一计数器的使能端相连;The D input terminal of the first D flip-flop is connected to the output terminal of the third selector, and the output terminal is connected to the 0 input terminal of the third selector, the control terminal of the fifth selector and the enabling terminal of the first counter; 第二D触发器的D输入端与第一计数器的输出端相连,使能端被输入所述数据指示信号,输出端与第二计数器的清零端相连;The D input terminal of the second D flip-flop is connected to the output terminal of the first counter, the enabling terminal is input with the data indication signal, and the output terminal is connected to the clearing terminal of the second counter; 第一计数器的清零端与第五选择器的输出端相连,使能端与第一D触发器的输出端相连,输出端与第四选择器的控制端以及第二D触发器的D输入端相连,第一计数器的输出端输出数据采集使能信号;The clear terminal of the first counter is connected to the output terminal of the fifth selector, the enable terminal is connected to the output terminal of the first D flip-flop, and the output terminal is connected to the control terminal of the fourth selector and the D input of the second D flip-flop The terminals are connected, and the output terminal of the first counter outputs a data acquisition enabling signal; 第二计数器的清零端与其输出端以及第二D触发器的输出端相连,使能端被输入所述数据指示信号,输出端与其清零端相连。The clear terminal of the second counter is connected with its output terminal and the output terminal of the second D flip-flop, the enable terminal is input with the data indication signal, and the output terminal is connected with the clear terminal. 7、根据权利要求1所述的装置,其特征在于,所述存储单元为随机存取存储单元或寄存器。7. The device according to claim 1, wherein the storage unit is a random access storage unit or a register. 8、一种在异步时钟域传输数据的方法,其中发送方位于数据随路时钟域,接收方位于系统工作时钟域并包括第一计数器,其特征在于,该方法包括以下步骤:8. A method for transmitting data in an asynchronous clock domain, wherein the sender is located in the data-associated clock domain, and the receiver is located in the system operating clock domain and includes a first counter, wherein the method comprises the following steps: A.发送方在写使能信号有效时,将数据缓存在存储单元中,同时产生一个数据就绪指示信号并发送给接收方;A. When the write enable signal is valid, the sender caches the data in the storage unit, and at the same time generates a data ready indication signal and sends it to the receiver; B.接收方在检测到所述数据就绪指示信号边沿时产生数据指示信号;B. The receiver generates a data indication signal when detecting the edge of the data ready indication signal; C.根据所述数据指示信号调整第一计数器的相位,并在第一计数器的相位达到设定相位时从存储单元读取数据。C. Adjusting the phase of the first counter according to the data indication signal, and reading data from the storage unit when the phase of the first counter reaches the set phase. 9、根据权利要求8所述的方法,其特征在于,步骤B前进一步包括将所述数据就绪指示信号锁存一个以上时钟周期的步骤。9. The method according to claim 8, characterized in that before step B, there is a step of latching the data ready indication signal for more than one clock cycle. 10、根据权利要求8所述的方法,其特征在于,步骤C中所述根据所述数据指示信号调整第一计数器的相位的步骤包括:10. The method according to claim 8, wherein the step of adjusting the phase of the first counter according to the data indication signal in step C comprises: 判断数据指示信号到达时第一计数器当前相位是否等于其最大相位,在不等于的情况下,判断所述当前相位与最大相位的相差绝对值是否大于1,如果大于1,则在下一个数据指示信号到达时,触发所述第一计数器重新计数;如果小于等于1,则在连续多个数据指示信号到达时所述第一计数器当前相位与其最大相位的差值保持不变的情况下,触发所述第一计数器重新计数。Judging whether the current phase of the first counter is equal to its maximum phase when the data indication signal arrives, in the case of not equal, judging whether the absolute value of the difference between the current phase and the maximum phase is greater than 1, if greater than 1, then in the next data indication signal When it arrives, trigger the first counter to count again; if it is less than or equal to 1, when the difference between the current phase of the first counter and its maximum phase remains unchanged when multiple consecutive data indication signals arrive, trigger the The first counter counts again. 11、根据权利要求8所述的方法,其特征在于,步骤C中所述在第一计数器的相位达到设定相位时从存储单元读取数据的步骤包括:11. The method according to claim 8, wherein the step of reading data from the storage unit when the phase of the first counter reaches the set phase in step C comprises: 在第一计数器的相位到达预先设定的相位时产生数据采集使能信号;generating a data acquisition enable signal when the phase of the first counter reaches a preset phase; 根据所述数据采集使能信号从存储单元读取数据。Reading data from the storage unit according to the data acquisition enable signal.
CNB2006100783219A 2006-05-09 2006-05-09 A device and method for transmitting data in an asynchronous clock domain Expired - Fee Related CN100465934C (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CNB2006100783219A CN100465934C (en) 2006-05-09 2006-05-09 A device and method for transmitting data in an asynchronous clock domain

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CNB2006100783219A CN100465934C (en) 2006-05-09 2006-05-09 A device and method for transmitting data in an asynchronous clock domain

Publications (2)

Publication Number Publication Date
CN1983225A true CN1983225A (en) 2007-06-20
CN100465934C CN100465934C (en) 2009-03-04

Family

ID=38165776

Family Applications (1)

Application Number Title Priority Date Filing Date
CNB2006100783219A Expired - Fee Related CN100465934C (en) 2006-05-09 2006-05-09 A device and method for transmitting data in an asynchronous clock domain

Country Status (1)

Country Link
CN (1) CN100465934C (en)

Cited By (16)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101166151B (en) * 2007-09-20 2010-07-14 北大方正集团有限公司 Method and device for transmitting data with different bit widths across clock domains
CN101996149B (en) * 2009-08-12 2012-09-26 炬力集成电路设计有限公司 Data acquisition method and device
CN103107877A (en) * 2011-11-14 2013-05-15 富士通半导体股份有限公司 Data transfer system, data transfer method, receiving circuit, and receiving method
WO2016127596A1 (en) * 2015-02-13 2016-08-18 中兴通讯股份有限公司 Asynchronous data transmission method and system
CN107220204A (en) * 2016-03-21 2017-09-29 华为技术有限公司 A kind of data reading circuit
CN108958701A (en) * 2017-05-22 2018-12-07 深圳市中兴微电子技术有限公司 A kind of data transfer control method, device and storage medium
CN109254941A (en) * 2017-07-13 2019-01-22 凌云光技术集团有限责任公司 Serial signal clock synchronizing method, string based on FPGA turn simultaneously method and device
CN110175091A (en) * 2018-12-11 2019-08-27 中国航空工业集团公司西安航空计算技术研究所 Signal synchronizing method, device and circuit between a kind of node under Lockstep framework
CN110647067A (en) * 2019-08-26 2020-01-03 珠海格力电器股份有限公司 Data acquisition system and control method, device, equipment and medium thereof
CN111221378A (en) * 2018-11-27 2020-06-02 成都鼎桥通信技术有限公司 Clock domain conversion method and device of periodic signal and readable storage medium
CN107430578B (en) * 2015-03-30 2020-11-17 索尼半导体解决方案公司 Asynchronous interface
CN112213622A (en) * 2020-09-23 2021-01-12 博流智能科技(南京)有限公司 High-speed peripheral system and control method thereof
CN112866339A (en) * 2020-12-30 2021-05-28 金蝶软件(中国)有限公司 Data transmission method and device, computer equipment and storage medium
CN118173141A (en) * 2024-05-14 2024-06-11 电子科技大学 A low-power nonvolatile memory circuit based on Gray code counter
CN118760350A (en) * 2024-09-06 2024-10-11 浙江大华技术股份有限公司 Heat dissipation control method and related device, equipment and medium
CN119088744A (en) * 2024-11-07 2024-12-06 上海励驰半导体有限公司 Asynchronous first-in first-out structure, chip, parts on transportation equipment and electronic equipment

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1153217C (en) * 2001-06-07 2004-06-09 扬智科技股份有限公司 Asynchronous FIFO Controller
US7668983B2 (en) * 2003-10-24 2010-02-23 Broadcom Corporation System for designing data structures
CN1642010B (en) * 2004-01-01 2010-04-28 华为技术有限公司 Detection device for clock lock and frequency deviation
CN100424663C (en) * 2004-02-10 2008-10-08 中国科学院计算技术研究所 A Method of Realizing Asynchronous FIFO Data Transmission Using Dual-Port Random Access Memory
CN100483541C (en) * 2004-08-29 2009-04-29 华为技术有限公司 Asynchronous data clock domain conversion

Cited By (24)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101166151B (en) * 2007-09-20 2010-07-14 北大方正集团有限公司 Method and device for transmitting data with different bit widths across clock domains
CN101996149B (en) * 2009-08-12 2012-09-26 炬力集成电路设计有限公司 Data acquisition method and device
CN103107877A (en) * 2011-11-14 2013-05-15 富士通半导体股份有限公司 Data transfer system, data transfer method, receiving circuit, and receiving method
CN103107877B (en) * 2011-11-14 2016-01-20 株式会社索思未来 Data transmission system, data transmission method, receiving circuit and method of reseptance
WO2016127596A1 (en) * 2015-02-13 2016-08-18 中兴通讯股份有限公司 Asynchronous data transmission method and system
CN107430578B (en) * 2015-03-30 2020-11-17 索尼半导体解决方案公司 Asynchronous interface
CN107220204B (en) * 2016-03-21 2020-05-08 华为技术有限公司 A data reading circuit
CN107220204A (en) * 2016-03-21 2017-09-29 华为技术有限公司 A kind of data reading circuit
CN108958701A (en) * 2017-05-22 2018-12-07 深圳市中兴微电子技术有限公司 A kind of data transfer control method, device and storage medium
CN109254941A (en) * 2017-07-13 2019-01-22 凌云光技术集团有限责任公司 Serial signal clock synchronizing method, string based on FPGA turn simultaneously method and device
CN109254941B (en) * 2017-07-13 2020-04-24 凌云光技术集团有限责任公司 FPGA-based serial signal clock synchronization method, serial-to-parallel conversion method and device
CN111221378A (en) * 2018-11-27 2020-06-02 成都鼎桥通信技术有限公司 Clock domain conversion method and device of periodic signal and readable storage medium
CN111221378B (en) * 2018-11-27 2021-08-24 成都鼎桥通信技术有限公司 Clock domain conversion method and device of periodic signal and readable storage medium
CN110175091A (en) * 2018-12-11 2019-08-27 中国航空工业集团公司西安航空计算技术研究所 Signal synchronizing method, device and circuit between a kind of node under Lockstep framework
CN110175091B (en) * 2018-12-11 2023-06-23 中国航空工业集团公司西安航空计算技术研究所 Method, device and circuit for synchronizing signals between nodes under Lockstep architecture
CN110647067A (en) * 2019-08-26 2020-01-03 珠海格力电器股份有限公司 Data acquisition system and control method, device, equipment and medium thereof
US11914418B2 (en) 2019-08-26 2024-02-27 Gree Electric Appliances, Inc. Of Zhuhai Systems, methods, and apparatuses for performing high-speed data acquisition and maintaining data integrity
CN112213622A (en) * 2020-09-23 2021-01-12 博流智能科技(南京)有限公司 High-speed peripheral system and control method thereof
CN112866339A (en) * 2020-12-30 2021-05-28 金蝶软件(中国)有限公司 Data transmission method and device, computer equipment and storage medium
CN112866339B (en) * 2020-12-30 2022-12-06 金蝶软件(中国)有限公司 Data transmission method and device, computer equipment and storage medium
CN118173141A (en) * 2024-05-14 2024-06-11 电子科技大学 A low-power nonvolatile memory circuit based on Gray code counter
CN118173141B (en) * 2024-05-14 2024-07-19 电子科技大学 Gray code counter-based low-power consumption nonvolatile memory circuit
CN118760350A (en) * 2024-09-06 2024-10-11 浙江大华技术股份有限公司 Heat dissipation control method and related device, equipment and medium
CN119088744A (en) * 2024-11-07 2024-12-06 上海励驰半导体有限公司 Asynchronous first-in first-out structure, chip, parts on transportation equipment and electronic equipment

Also Published As

Publication number Publication date
CN100465934C (en) 2009-03-04

Similar Documents

Publication Publication Date Title
CN100465934C (en) A device and method for transmitting data in an asynchronous clock domain
US7003059B1 (en) Jabber counter mechanism for elastic buffer operation
US7366267B1 (en) Clock data recovery with double edge clocking based phase detector and serializer/deserializer
US9594396B2 (en) Synchronizing data transfer between a first clock domain and second clock domain
US7003423B1 (en) Programmable logic resource with data transfer synchronization
TWI395425B (en) Method for performing an elastic buffer of virtual depth m, elastic buffer circuit of virtual depth m and integrated circuit
US20080031385A1 (en) Clock data recovery circuitry associated with programmable logic device circuitry
US20210157355A1 (en) Data handoff between two clock domains sharing a fundamental beat
US10038450B1 (en) Circuits for and methods of transmitting data in an integrated circuit
EP3067894B1 (en) Self-stuffing fifo requiring no synchronizers
CN102594741B (en) Telecommunication circuit and method of adjusting sampling
US5539739A (en) Asynchronous interface between parallel processor nodes
US7219250B2 (en) Status indication detection and device and method
US6795514B2 (en) Integrated data clock extractor
JP3813151B2 (en) Transition detection, validation and memory circuit
EP3846380B1 (en) Clock and data recovery circuit
CN120723018B (en) Method and apparatus for cross-clock domain data transmission
US9111042B1 (en) 1588 deterministic latency with gearbox
CN102754407B (en) Providing a feedback loop in a low latency serial interconnect architecture and communication system
US20130294555A1 (en) Method and apparatus for deskewing data transmissions
EP1696600B1 (en) Prediction of an optimal sampling point for clock resynchronization in a source synchronous data channel
US6424189B1 (en) Apparatus and system for multi-stage event synchronization
KR20210141739A (en) Method and apparatus for processing multi-digit data in cross clock domain
US9626317B2 (en) Arbiter for asynchronous state machines
US6956921B1 (en) Clock and data recovery circuit

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20090304

Termination date: 20160509

CF01 Termination of patent right due to non-payment of annual fee