[go: up one dir, main page]

CN1585312A - A method for converting an asynchronous clock domain into a synchronous clock domain - Google Patents

A method for converting an asynchronous clock domain into a synchronous clock domain Download PDF

Info

Publication number
CN1585312A
CN1585312A CN 03153668 CN03153668A CN1585312A CN 1585312 A CN1585312 A CN 1585312A CN 03153668 CN03153668 CN 03153668 CN 03153668 A CN03153668 A CN 03153668A CN 1585312 A CN1585312 A CN 1585312A
Authority
CN
China
Prior art keywords
address
asynchronous
read address
signal
clock domain
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 03153668
Other languages
Chinese (zh)
Other versions
CN100499420C (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 CNB031536689A priority Critical patent/CN100499420C/en
Publication of CN1585312A publication Critical patent/CN1585312A/en
Application granted granted Critical
Publication of CN100499420C publication Critical patent/CN100499420C/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Images

Landscapes

  • Synchronisation In Digital Transmission Systems (AREA)
  • Time-Division Multiplex Systems (AREA)

Abstract

本发明提供了一种将异步时钟域转换成同步时钟域的方法,直接使用同步时钟对异步时钟域中的异步写地址状态信号进行采样,并应用预先设定的规则,在特定的读地址位置对同步时钟域中的读地址进行调整,使得在实现异步信号时钟域转换的同时,实现了不同异步数据帧之间的帧头对齐的处理。应用本发明,实现结构简单,容易理解,避免了格雷码变换等复杂处理,使得设计流程大大简化,节约了实现的逻辑资源。

Figure 03153668

The present invention provides a method for converting an asynchronous clock domain into a synchronous clock domain, directly using the synchronous clock to sample the asynchronous write address status signal in the asynchronous clock domain, and applying preset rules, at a specific read address position The read address in the synchronous clock domain is adjusted, so that the frame header alignment processing between different asynchronous data frames is realized while realizing the conversion of the asynchronous signal clock domain. The application of the present invention realizes simple structure and is easy to understand, avoids complex processing such as Gray code transformation, greatly simplifies the design process, and saves logic resources for realization.

Figure 03153668

Description

一种将异步时钟域转换成同步时钟域的方法A method for converting an asynchronous clock domain into a synchronous clock domain

技术领域technical field

本发明涉及时钟域转换技术领域,特别是指一种将异步时钟域转换成同步时钟域的方法。The present invention relates to the technical field of clock domain conversion, in particular to a method for converting an asynchronous clock domain into a synchronous clock domain.

背景技术Background technique

在接口芯片逻辑设计中,从接口进入芯片内部处理的信号均是以数据帧的形式传送,且相对于芯片的主处理时钟而言均为异步信号。由于不同的时钟之间会存在一定的相差或短时频率抖动,为了使芯片能够稳定工作,需要将异步信号从异步时钟域转换到同步时钟域中,以获得稳定的同步信号,之后,再进行后续处理。In the logical design of the interface chip, the signals that enter the internal processing of the chip from the interface are transmitted in the form of data frames, and are asynchronous signals relative to the main processing clock of the chip. Since there will be a certain phase difference or short-term frequency jitter between different clocks, in order to make the chip work stably, it is necessary to convert the asynchronous signal from the asynchronous clock domain to the synchronous clock domain to obtain a stable synchronous signal, and then perform Subsequent processing.

由于异步信号之间的帧头通常是不对齐的,而接口芯片内部需要处理帧头完全对齐的信号,因此,在该异步信号完成时钟域的转换后,还要再做帧头对齐的处理。Because the frame headers between asynchronous signals are usually not aligned, and the interface chip needs to process signals with completely aligned frame headers, therefore, after the asynchronous signal completes the clock domain conversion, frame header alignment processing is required.

下面以宽带码多分址(WCDMA)系统中的上行主、分集信号为例,具体说明将该异步信号从异步时钟域转换到同步时钟域,并实现帧头对齐的方法。Taking the uplink primary and diversity signals in the Wideband Code Multiple Access (WCDMA) system as an example, the method for converting the asynchronous signal from the asynchronous clock domain to the synchronous clock domain and realizing frame header alignment is described in detail below.

一般将异步时钟域转为同步时钟域通常采用双口RAM缓存数据的方法来实现。图1所示为现有技术中异步信号时钟域转换的实现结构图。用异步时钟信号产生双口RAM写地址,用同步时钟产生双口RAM的读地址,该双口RAM深度是根据需要容忍的短时频差范围来确定。分别将读写地址转换成对应的格雷码,再用同步时钟采样并进行比较,以判断读写地址之间的距离是否小于可能发生读、写冲突的最小距离,即“危险距离”,如果是,则将读地址跳转180度,即将读地址跳转到离当前位置最远的地址后,再执行读操作;否则不必调整读地址,直接执行读操作。这样读出来的数据是稳定且正确的,且屏蔽了异步时钟与本地同步时钟之间的相位差以及短暂的频率抖动。Generally, the conversion of the asynchronous clock domain to the synchronous clock domain is usually realized by a method of caching data in a dual-port RAM. FIG. 1 is a structural diagram for realizing clock domain conversion of an asynchronous signal in the prior art. The asynchronous clock signal is used to generate the write address of the dual-port RAM, and the synchronous clock is used to generate the read address of the dual-port RAM. The depth of the dual-port RAM is determined according to the short-term frequency difference range that needs to be tolerated. Convert the read and write addresses into corresponding Gray codes, and then use the synchronous clock to sample and compare to determine whether the distance between the read and write addresses is less than the minimum distance that may cause read and write conflicts, that is, the "dangerous distance". , then jump the read address by 180 degrees, that is, jump the read address to the address farthest from the current position, and then execute the read operation; otherwise, do not need to adjust the read address, and directly execute the read operation. The data read out in this way is stable and correct, and the phase difference between the asynchronous clock and the local synchronous clock and the short-term frequency jitter are shielded.

上述读地址跳转180度的方法为:设读地址为r_add,RAM深度为a,当r_add>=a/2,且读写地址之间小于危险距离时,读地址跳转到r_add-a/2处;当r_add<a/2,且读写地址之间小于危险距离时,读地址跳转到r_add+a/2处。例如,假设写地址为13,读地址为11,“危险距离”定为3,RAM深度为16,由于|13-11|<3,且11>16/2=8,因此读地址需要调整到11-16/2=3。The method of jumping 180 degrees of the above read address is: set the read address as r_add, and the RAM depth is a, when r_add>=a/2, and when the read and write addresses are less than the dangerous distance, the read address jumps to r_add-a/ 2; when r_add<a/2, and the read-write address is less than the dangerous distance, the read address jumps to r_add+a/2. For example, suppose the write address is 13, the read address is 11, the "dangerous distance" is set to 3, and the RAM depth is 16, since |13-11|<3, and 11>16/2=8, the read address needs to be adjusted to 11-16/2=3.

一般实现两路数据帧头对齐处理是采用2级双口RAM的方法。图2所示为现有技术的以上行主、分集帧头为例实现帧头对齐的结构图。为了说明方便,假定帧长为8,双口RAM深度为16。由于要满足帧头对齐的要求,因此必须确知帧头在双口RAM中的具体位置,为方便帧头对齐的处理,双口RAM深度通常取帧长的整数倍。对于主、分集数据,此时已被转换到同步时钟域中,因此,对主、分集帧头分别进行模2计数,根据帧头计数结果对相应的地址发生计数器进行置位,其具体置位规则如下:帧头计数值为0且相应帧头到来时,将相应地址发生计数器置为8;帧头计数值为1且相应帧头到来时,将相应地址发生计数器置为0,该经过置位的地址发生计数器的值作为对应双口RAM的写地址,这样每一帧的第一个数据都是在地址0或者地址8上;双口RAM的读地址只用一个模16的计数器产生,同样地,对本地同步帧头信号进行模2计数,根据帧头计数结果对读地址计数器进行置位,其置位规则同上,这样本地同步帧头的第一个数据也总是从地址0或者地址8读出;将写地址计数器的初始值置为0,将读地址计数器的初始状态置为8,从而保证了读写地址距离在开始就相差最大,而且实现了帧头对齐的处理。Generally, the alignment processing of two-way data frame headers is achieved by using a 2-level dual-port RAM. FIG. 2 is a structural diagram for realizing alignment of frame headers in the prior art taking the above row-master and diversity frame headers as an example. For the convenience of illustration, it is assumed that the frame length is 8, and the dual-port RAM depth is 16. To meet the requirements of frame header alignment, it is necessary to know the specific position of the frame header in the dual-port RAM. In order to facilitate the processing of frame header alignment, the depth of the dual-port RAM is usually an integer multiple of the frame length. For the main and diversity data, it has been converted to the synchronous clock domain at this time. Therefore, the main and diversity frame headers are respectively counted by modulo 2, and the corresponding address generation counter is set according to the frame header counting results. The specific setting The rules are as follows: when the frame header count value is 0 and the corresponding frame header arrives, set the corresponding address occurrence counter to 8; when the frame header count value is 1 and the corresponding frame header arrives, set the corresponding address occurrence counter to 0, and the process is set The value of the bit address generation counter is used as the write address of the corresponding dual-port RAM, so that the first data of each frame is at address 0 or address 8; the read address of the dual-port RAM is only generated by a modulo 16 counter. Similarly, the local synchronous frame header signal is counted modulo 2, and the read address counter is set according to the frame header counting result. The setting rule is the same as above, so that the first data of the local synchronous frame header is always from address 0 or Address 8 is read; the initial value of the write address counter is set to 0, and the initial state of the read address counter is set to 8, thereby ensuring that the read and write address distances have the largest difference at the beginning, and realize the processing of frame header alignment.

上述方法的缺陷在于:时钟域转换与帧头对齐处理需要分两个步骤完成,不能在完成时钟域转换的同时实现数据帧头对齐处理。而且实现较为复杂,不易理解且造成资源浪费。The disadvantage of the above method is that the clock domain conversion and frame header alignment processing need to be completed in two steps, and the data frame header alignment processing cannot be implemented at the same time as the clock domain conversion is completed. Moreover, the implementation is relatively complicated, difficult to understand and causes waste of resources.

发明内容Contents of the invention

有鉴于此,本发明的目的在于提供一种将异步时钟域转换成同步时钟域的方法,在完成时钟域转换的同时,实现帧头对齐的处理。In view of this, the object of the present invention is to provide a method for converting an asynchronous clock domain into a synchronous clock domain, and realize frame header alignment processing while completing the clock domain conversion.

为达到上述目的本发明的技术方案是这样实现的:For achieving the above object, technical scheme of the present invention is achieved in that way:

一种将异步时钟域转换成同步时钟域的方法,该方法包括以下步骤:A method for converting an asynchronous clock domain into a synchronous clock domain, the method comprising the steps of:

a、设置异步时钟域中的每个异步信号对应一个地址发生计数器,且每个异步信号的帧头信号对其所对应的地址发生计数器进行周期置位,将该经过置位的地址发生计数器的值作为每个异步信号所对应双口RAM的写地址,并根据双口RAM的写地址设置该双口RAM的写地址状态指示信号;a. Set each asynchronous signal in the asynchronous clock domain to correspond to an address generation counter, and the frame header signal of each asynchronous signal periodically sets the address generation counter corresponding to it, and the address generation counter that has been set is set The value is used as the write address of the dual-port RAM corresponding to each asynchronous signal, and the write address status indication signal of the dual-port RAM is set according to the write address of the dual-port RAM;

b、用同步时钟对异步写地址状态指示信号进行采样,得到同步写地址状态指示信号;b. Sampling the asynchronous write address status indication signal with a synchronous clock to obtain a synchronous write address status indication signal;

c、同步时钟域中设置与异步时钟域中相同数量的地址发生计数器,每个同步信号的帧头信号对其所对应的地址发生计数器进行周期置位,且该地址发生计数器的值作为每个同步信号所对应双口RAM的读地址,根据同步写地址状态指示信号,按照预先设定的规则确定读地址的判断位置,并对读地址做相应调整。c. The same number of address generation counters as in the asynchronous clock domain are set in the synchronous clock domain, and the frame header signal of each synchronous signal is periodically set to the address generation counter corresponding to it, and the value of the address generation counter is used as each The read address of the dual-port RAM corresponding to the synchronous signal determines the judging position of the read address according to the pre-set rules according to the synchronous write address state indication signal, and adjusts the read address accordingly.

较佳地,所述周期置位进一步包括以下步骤:Preferably, the periodic setting further includes the following steps:

设置双口RAM深度为a为帧长为K的正整数倍t,对帧头进行模t计数;Set the depth of the dual-port RAM as a to be a positive integer multiple t of the frame length K, and count the frame header modulo t;

当帧头计数值小于t减1的值,且遇到帧头时,将地址发生计数器的值置为帧头计数值加1的值乘以帧长K;当帧头计数值为t减1,且遇到帧头时,将地址发生计数器的值置为0。When the frame header count value is less than the value of t minus 1, and when the frame header is encountered, the value of the address generation counter is set to the value of the frame header count value plus 1 multiplied by the frame length K; when the frame header count value is t minus 1 , and when a frame header is encountered, the value of the address generation counter is set to 0.

较佳地,所述根据双口RAM的写地址设置该双口RAM的写地址状态指示信号为:设置写地址帧头信号对应的写地址状态指示信号为高电平,且写地址状态指示信号的长度大于所对应的写地址帧头信号的长度。Preferably, setting the write address state indication signal of the dual-port RAM according to the write address of the dual-port RAM is: setting the write address state indication signal corresponding to the write address frame header signal to a high level, and the write address state indication signal The length of is greater than the length of the corresponding write address frame header signal.

较佳地,异步信号的帧长大于等于4时,步骤c所述按照预先设定的规则确定读地址的判断位置的方法为:读地址的判断位置等于n乘以帧长K再减1,且n为小于等于双口RAM深度a除以帧长K的自然数;Preferably, when the frame length of the asynchronous signal is greater than or equal to 4, the method for determining the judging position of the read address according to the preset rules described in step c is: the judging position of the read address is equal to n multiplied by the frame length K and then minus 1, And n is a natural number less than or equal to the dual-port RAM depth a divided by the frame length K;

步骤c所述对读地址的相应调整方法为:在读地址的判断位置上判断读地址r_add与写地址w_add之间的距离是否小于等于预先设定的危险距离L,如果是,则令与该异步信号相对应的读地址等于读地址减去帧长K再加1,否则对读地址不做调整。The corresponding adjustment method for the read address described in step c is: judge whether the distance between the read address r_add and the write address w_add is less than or equal to the preset dangerous distance L at the judging position of the read address, and if so, make the asynchronous The read address corresponding to the signal is equal to the read address minus the frame length K plus 1, otherwise the read address will not be adjusted.

较佳地,所述预先设定的危险距离L小于帧长的一半。Preferably, the preset danger distance L is less than half of the frame length.

较佳地,异步信号的帧长小于4时,Preferably, when the frame length of the asynchronous signal is less than 4,

步骤c所述按照预先设定的规则确定读地址的判断位置的方法为:读地址的判断位置在n乘以帧长K再减1中以等间隔cK抽取,且n为小于等于双口RAM深度a除以帧长K的自然数;The method for determining the judging position of the read address according to the preset rules described in step c is: the judging position of the read address is extracted with equal interval cK in n multiplied by the frame length K and then minus 1, and n is less than or equal to the dual-port RAM Depth a is divided by the natural number of frame length K;

步骤c所述对读地址的相应调整方法为:在读地址的判断位置上判断读地址r_add与写地址w_add之间的距离是否小于等于预先设定的危险距离L,如果是,则令与该异步信号相对应的读地址等于读地址减去抽取间隔cK再加1,否则对读地址不做调整。The corresponding adjustment method for the read address described in step c is: judge whether the distance between the read address r_add and the write address w_add is less than or equal to the preset dangerous distance L at the judging position of the read address, and if so, make the asynchronous The read address corresponding to the signal is equal to the read address minus the extraction interval cK plus 1, otherwise the read address is not adjusted.

较佳地,所述预先设定的危险距离L小于抽取间隔值的一半。Preferably, the preset risk distance L is less than half of the extraction interval value.

较佳地,所述异步时钟域中的异步信号为两个或两个以上。Preferably, there are two or more asynchronous signals in the asynchronous clock domain.

应用本发明,直接使用同步时钟采样异步时钟域中的异步写地址状态信号,并应用预先设定的规则,在特定的读地址位置对同步时钟域中的读地址进行调整,使得在实现异步信号时钟域转换的同时,实现了不同异步数据帧之间的帧头对齐的处理。应用本发明,实现结构简单,容易理解,避免了格雷码变换等复杂处理,使得设计流程大大简化,节约了实现的逻辑资源。Applying the present invention directly uses the synchronous clock to sample the asynchronous write address state signal in the asynchronous clock domain, and applies preset rules to adjust the read address in the synchronous clock domain at a specific read address position, so that when the asynchronous signal is realized At the same time as the clock domain conversion, the frame header alignment processing between different asynchronous data frames is realized. The application of the present invention realizes simple structure and is easy to understand, avoids complex processing such as Gray code transformation, greatly simplifies the design process, and saves logic resources for realization.

附图说明Description of drawings

图1为现有技术中异步信号时钟域转换的实现结构图;FIG. 1 is a structural diagram for realizing clock domain conversion of asynchronous signals in the prior art;

图2为现有技术的以WCDMA系统上行主、分集帧头为例实现帧头对齐的结构图;Fig. 2 is the structural diagram of realizing frame header alignment by taking WCDMA system uplink master and diversity frame headers as an example in the prior art;

图3为应用本发明的以WCDMA系统上行主、分集帧头为例同时实现时钟域转换及帧头对齐的结构图;Fig. 3 is the structural diagram of simultaneously realizing clock domain conversion and frame header alignment by taking WCDMA system uplink main and diversity frame headers as an example for applying the present invention;

图4为应用本发明写地址判断时序关系图;Fig. 4 is a sequence relationship diagram for applying the present invention to write address judgment;

图5为应用本发明的同步时钟对异步写地址状态指示信号采样的示意图;Fig. 5 is a schematic diagram of applying the synchronous clock of the present invention to the sampling of the asynchronous write address state indication signal;

图6为应用本发明的读地址调整后的时序图;Fig. 6 is the timing diagram after applying the read address adjustment of the present invention;

具体实施方式Detailed ways

下面结合附图及具体实施例对本发明再作进一步详细的说明。The present invention will be further described in detail below in conjunction with the accompanying drawings and specific embodiments.

本发明的思路是:异步时钟域中的每个异步时钟信号对应一个地址发生计数器,且每个异步信号的帧头信号对其所对应的地址发生计数器进行周期置位,将该经过置位的计数器的值作为每个异步信号所对应双口RAM的写地址,并根据双口RAM的写地址设置该双口RAM的异步写地址状态指示信号;用同步时钟对异步写地址状态指示信号进行采样,得到同步写地址状态指示信号;同步时钟域中设置与异步时钟域中相同数量的地址发生计数器,每个同步信号的帧头信号对其所对应的地址发生计数器进行周期置位,该计数器的值作为其所对应双口RAM的读地址,根据同步写地址状态指示信号,按照预先设定的规则确定读地址的判断位置,并对读地址做相应调整。The idea of the present invention is: each asynchronous clock signal in the asynchronous clock domain corresponds to an address generation counter, and the frame header signal of each asynchronous signal performs periodic setting to its corresponding address generation counter, and the set The value of the counter is used as the write address of the dual-port RAM corresponding to each asynchronous signal, and the asynchronous write address status indication signal of the dual-port RAM is set according to the write address of the dual-port RAM; the asynchronous write address status indication signal is sampled with a synchronous clock , to obtain the synchronous write address status indication signal; the same number of address generation counters as in the asynchronous clock domain are set in the synchronous clock domain, and the frame header signal of each synchronous signal is periodically set to its corresponding address generation counter. The value is used as the read address of the corresponding dual-port RAM. According to the synchronous write address status indication signal, the judgment position of the read address is determined according to the preset rules, and the read address is adjusted accordingly.

根据帧头信号对计数器进行周期置位的规则为:设RAM深度为a,帧长为K,且a=tK,t为正整数,对帧头进行模t的计数,当帧头计数值为m,m<t-1且遇到帧头时,将地址发生计数器的值置为(m+1)K;当帧头计数值m为t-1,且遇到帧头时,由于计数值循环计数,因此将地址发生计数器的值置为0。The rule that the counter is periodically set according to the frame header signal is: set the RAM depth as a, the frame length as K, and a=tK, t is a positive integer, and the frame header is counted modulo t, when the frame header count value is m, m<t-1 and when a frame header is encountered, the value of the address generation counter is set to (m+1)K; when the frame header count value m is t-1 and a frame header is encountered, the count value The cycle counts, so the value of the address generation counter is set to 0.

下面以WCDMA系统中的上行主、分集信号为例,具体说明其实现方式。在本实施例中,还是设定帧长为8,双口RAM的深度为16,可能发生读写冲突的最小“危险距离”为3,则t=16/8=2,由于每个RAM中只可能有两帧,因此,帧头计数值m只能为0和1。The following takes the uplink main and diversity signals in the WCDMA system as an example to describe its implementation in detail. In the present embodiment, it is still set that the frame length is 8, the depth of the dual-port RAM is 16, and the minimum "dangerous distance" that read-write conflicts may occur is 3, then t=16/8=2, because in each RAM Only two frames are possible, therefore, the frame header count value m can only be 0 and 1.

图3所示为本实施例的实现时钟域转换及帧头对齐的结构图。在异步时钟域利用异步时钟启动两个模16的地址发生计数器(cnt16 301和cnt16302),并对主、分集帧头分别进行模2计数,根据帧头计数结果对相应的地址发生计数器进行周期置位,该经过置位的计数器的值作为与之相连的双口RAM的写地址;同时对两个双口RAM的写地址状态分别进行状态判断,以分别获取两个双口RAM的写地址状态指示信号;同步时钟对异步写地址状态指示信号分别进行采样,从而得到同步写地址状态指示信号;在同步时钟域中同步时钟驱动两个模16的地址发生计数器(cnt16 303和cnt16 304),同时对本地同步帧头进行模2计数,根据帧头计数结果对相应的地址发生计数器进行置位,该经过置位的计数器的值作为与之相连的双口RAM的读地址,根据同步写地址状态指示信号,并按照预先设定的规则对与之相对应的双口RAM读地址进行调整。下面就每一步骤具体说明:FIG. 3 is a structural diagram for implementing clock domain conversion and frame header alignment in this embodiment. In the asynchronous clock domain, use the asynchronous clock to start two modulo 16 address generation counters (cnt16 301 and cnt16302), and perform modulo 2 counting on the main and diversity frame headers respectively, and periodically reset the corresponding address generation counters according to the frame header counting results Bit, the value of the set counter is used as the write address of the dual-port RAM connected to it; at the same time, the status of the write address status of the two dual-port RAMs is judged separately to obtain the write address status of the two dual-port RAMs respectively Indication signal; the synchronous clock samples the asynchronous write address status indication signal respectively, thus obtains the synchronous write address status indication signal; in the synchronous clock domain, the synchronous clock drives two modulo 16 address generation counters (cnt16 303 and cnt16 304), simultaneously Carry out modulo 2 counting on the local synchronous frame header, and set the corresponding address generation counter according to the frame header counting result. Indicates the signal, and adjusts the corresponding dual-port RAM read address according to the preset rules. The following is a detailed description of each step:

首先,异步时钟域利用异步时钟启动两个模16的地址发生计数器cnt16301和cnt16 302,同时对主、分集帧头信号分别进行模2计数,根据帧头计数结果分别对对应的模16的地址发生计数器进行周期置位,即当帧头计数值m为0(m<t-1)且帧头到来时,将对应的模16计数器置为(0+1)×8=8,当帧头计数值m为1(m=n-1)且帧头到来时,将对应的模16计数器置为0。该经过周期置位操作后计数器的值作为两个双口RAM的写地址,同时对两个RAM的写地址状态分别进行判断,分别获得两个双口RAM的写地址状态指示信号。如图4所示,由于进来的两路异步信号帧长为8,且地址发生计数器的模为16,因此,帧头写入的位置只能是在双口RAM的地址0或者地址8上,由于每个异步信号写入两次,用两个写地址状态指示信号即写地址状态指示信号1(state_ind1)和写地址状态指示信号2(state_ind2)来分别表示这两个写入的状态,state_ind1表示写地址在第二帧的异步数据帧头附近的状态,state_ind2表示写地址在第一帧的异步数据帧头附近的状态,在本实施例中,写地址为{6,7,8,9,10}时,state_ind1为高电平,写地址为{14,15,0,1,2}时,state_ind2为高电平。Firstly, the asynchronous clock domain uses the asynchronous clock to start two modulo 16 address generation counters cnt16301 and cnt16 302, and simultaneously performs modulo 2 counting on the main and diversity frame header signals, and generates the corresponding modulo 16 address respectively according to the frame header counting results The counter is periodically set, that is, when the frame header count value m is 0 (m<t-1) and the frame header arrives, the corresponding modulo 16 counter is set to (0+1)×8=8, when the frame header counts When the value m is 1 (m=n-1) and the frame header arrives, the corresponding modulo 16 counter is set to 0. The value of the counter after the period setting operation is used as the write address of the two dual-port RAMs, and the write address states of the two RAMs are respectively judged to obtain the write address state indication signals of the two dual-port RAMs respectively. As shown in Figure 4, since the frame length of the incoming two-way asynchronous signal is 8, and the modulus of the address generation counter is 16, the position where the frame header is written can only be at address 0 or address 8 of the dual-port RAM. Since each asynchronous signal is written twice, two write address state indication signals, namely write address state indication signal 1 (state_ind1) and write address state indication signal 2 (state_ind2) are used to represent the states of these two writes, state_ind1 Indicates that the write address is near the asynchronous data frame head of the second frame, and state_ind2 represents the state of the write address near the asynchronous data frame head of the first frame. In this embodiment, the write address is {6, 7, 8, 9 , 10}, state_ind1 is high level, and when the write address is {14, 15, 0, 1, 2}, state_ind2 is high level.

其次,用同步时钟对异步写地址状态指示信号进行采样,获取同步写地址状态指示信号。图5所示为应用本发明的同步时钟对异步写地址状态指示信号采样的示意图。由于表示异步写地址状态的帧头信号有1比特,且持续时间较长,所以可由同步时钟对该异步写地址状态指示信号直接采样,同时,由于是用同步时钟对异步时钟域中的信号采样,因此在所采集信号的边沿处会存在一定的模糊状态,即图5中的阴影部分,但由于该模糊部分只影响读地址是在这一次还是在下一次进行调整而已,而读地址一旦进行调整,则该模糊部分对于数据的正确转换没有任何影响。Secondly, the synchronous clock is used to sample the asynchronous write address status indication signal to obtain the synchronous write address status indication signal. FIG. 5 is a schematic diagram of sampling the asynchronous write address status indication signal by applying the synchronous clock of the present invention. Since the frame header signal representing the state of the asynchronous write address has 1 bit and lasts for a long time, the asynchronous write address state indication signal can be directly sampled by the synchronous clock. At the same time, since the signal in the asynchronous clock domain is sampled by the synchronous clock , so there will be a certain fuzzy state at the edge of the collected signal, that is, the shaded part in Figure 5, but because the fuzzy part only affects whether the read address is adjusted this time or the next time, and once the read address is adjusted , then this fuzzy part has no effect on the correct transformation of the data.

最后,用同步时钟驱动两个模16的地址发生计数器cnt16 303和cnt16304,同时对本地同步帧头信号进行模2计数,根据对本地同步帧头的计数结果对其所对应的两个模16的地址发生计数器进行周期置位处理,即当帧头计数值m为0(m<n-1)且帧头到来时,将对应的模16计数器置为8((m+1)×8),当帧头计数值m为1(m=n-1)且帧头到来时,将对应的模16计数器置为0。该经置位操作后的计数器的值作为双口RAM的读地址,根据同步写地址状态指示信号对双口RAM的读地址进行调整。图6所示为应用本发明的读地址调整后的时序图。由于同步时钟域中的每个地址发生计数器与异步时钟域中的一个地址发生计数器相对应,也就是说,同步时钟域的每个地址发生计数器对应一个异步信号,其具体调整方案为:Finally, drive two modulo 16 address generation counters cnt16 303 and cnt16304 with a synchronous clock, and carry out modulo 2 counting to the local synchronous frame header signal at the same time, according to the counting result of the local synchronous frame header to its corresponding two modulo 16 The address generation counter performs periodic setting processing, that is, when the frame header count value m is 0 (m<n-1) and the frame header arrives, the corresponding modulo 16 counter is set to 8 ((m+1)×8), When the frame header count value m is 1 (m=n-1) and the frame header arrives, the corresponding modulo 16 counter is set to 0. The value of the counter after the setting operation is used as the read address of the dual-port RAM, and the read address of the dual-port RAM is adjusted according to the synchronous write address status indication signal. FIG. 6 is a timing diagram after the read address adjustment of the present invention is applied. Since each address generation counter in the synchronous clock domain corresponds to an address generation counter in the asynchronous clock domain, that is, each address generation counter in the synchronous clock domain corresponds to an asynchronous signal, the specific adjustment scheme is as follows:

确定读地址的判断位置,具体的确定方法是设置n为小于等于RAM深度a除以帧长K的自然数,其中,RAM深度为帧长的整数倍;读地址的判断位置为n乘以帧长再减1,即读地址的判断位置为nK-1,且n<=a/K,n为自然数。Determine the judgment position of the read address. The specific determination method is to set n as a natural number less than or equal to the RAM depth a divided by the frame length K, where the RAM depth is an integer multiple of the frame length; the judgment position of the read address is n multiplied by the frame length Then subtract 1, that is, the judgment position of the read address is nK-1, and n<=a/K, n is a natural number.

在读地址的判断位置上判断读地址r_add与写地址w_add之间的距离是否小于等于预先设定的危险距离L,该预先设定的危险距离L需满足2L<K,如果|r_add-w_add|<=L,则令读地址等于读地址减去帧长K再加1,即令r_add=r_add-K+1,否则对该读地址不做调整。At the judging position of the read address, judge whether the distance between the read address r_add and the write address w_add is less than or equal to the preset dangerous distance L. The preset dangerous distance L needs to satisfy 2L<K, if |r_add-w_add|< =L, then make the read address equal to the read address minus the frame length K plus 1, that is, make r_add=r_add-K+1, otherwise the read address will not be adjusted.

在本实施例中,a=16,K=8,L=3,则n=2;In this embodiment, a=16, K=8, L=3, then n=2;

读地址的判断位置为8-1=7,2×8-1=15;The judging position of the read address is 8-1=7, 2×8-1=15;

当读地址为7,且|w_add-7|<=3时,判断同步写地址状态指示信号1(sync_state_ind1)是否为高电平,如果是,则将与该异步信号相对应的读地址调整为r_add=7-8+1=0,否则对该读地址不做调整;When the read address is 7, and |w_add-7|<=3, judge whether the synchronous write address state indicator signal 1 (sync_state_ind1) is high level, if yes, then adjust the read address corresponding to the asynchronous signal to r_add=7-8+1=0, otherwise the read address will not be adjusted;

当读地址为15,且|w_add-15|<=3时,判断同步写地址状态指示信号2(sync_state_ind2)是否为高电平,如果是,则将读地址调整为r_add=15-8+1=8,否则对该读地址不做调整。When the read address is 15, and |w_add-15|<=3, judge whether the synchronous write address state indication signal 2 (sync_state_ind2) is high level, if so, adjust the read address to r_add=15-8+1 =8, otherwise the read address will not be adjusted.

经过这样的调整后,使得从存储主、分集数据的RAM中读出的数据在完成时钟域转换的同时,实现了主、分集数据帧头对齐的处理。After such adjustment, the data read from the RAM storing the main and diversity data realizes the process of aligning the frame headers of the main and diversity data while completing the clock domain conversion.

上述的调整方案中的公式只适用于帧长大于等于4的情况,如果帧长小于4,则应用下面的方法确定读地址的判断位置以及读地址的调整位置。The formula in the above adjustment scheme is only applicable when the frame length is greater than or equal to 4. If the frame length is less than 4, the following methods are used to determine the judgment position of the read address and the adjustment position of the read address.

确定读地址的判断位置时,设置n为小于等于RAM深度a除以帧长K的自然数,其中,RAM深度为帧长的整数倍,读地址的判断位置为n乘以帧长再减1,即读地址的判断位置为nK-1,且n<=a/K,n为自然数。由于帧长较短,因此,读地址的判断位置可以从K-1、2K-1、3K-1……nK-1中以等间隔cK抽取,则读地址判断的位置为cK-1、2cK-1……rcK-1,(r<n)。When determining the judgment position of the read address, set n to be a natural number less than or equal to the RAM depth a divided by the frame length K, wherein the RAM depth is an integer multiple of the frame length, and the judgment position of the read address is n multiplied by the frame length and then minus 1, That is, the judging position of the read address is nK-1, and n<=a/K, where n is a natural number. Since the frame length is short, the judgment position of the read address can be extracted from K-1, 2K-1, 3K-1...nK-1 at equal intervals cK, then the judgment position of the read address is cK-1, 2cK -1...rcK-1, (r<n).

在读地址的判断位置上判断读地址r_add与写地址w_add之间的距离是否小于等于预先设定的危险距离L,该预先设定的危险距离L要满足2L<ck,如果|w_add-r_add|<=L,则令与该异步信号相对应的读地址等于读地址减去抽取间隔cK的值再加1,即令r_add=r_add-cK+1,否则对读地址不做调整。At the judging position of the read address, judge whether the distance between the read address r_add and the write address w_add is less than or equal to the preset dangerous distance L, and the preset dangerous distance L must satisfy 2L<ck, if |w_add-r_add|< =L, then make the read address corresponding to the asynchronous signal equal to the read address minus the value of the extraction interval cK plus 1, that is, make r_add=r_add-cK+1, otherwise the read address will not be adjusted.

例如,设置a=16,K=2,则n=2,并设L=1,ck=4,For example, set a=16, K=2, then n=2, and set L=1, ck=4,

读地址的判断位置可为3,7,11,15;The judgment position of the read address can be 3, 7, 11, 15;

读地址可能调整的位置为:The positions where the read address may be adjusted are:

当|w_add-3|<=1时,r_add=3-4+1=0;When |w_add-3|<=1, r_add=3-4+1=0;

当|w_add-7|<=1时,r_add=7-4+1=4;When |w_add-7|<=1, r_add=7-4+1=4;

当|w_add-11|<=1时,r_add=11-4+1=8;When |w_add-11|<=1, r_add=11-4+1=8;

当|w_add-15|<=1时,r_add=15-4+1=12;When |w_add-15|<=1, r_add=15-4+1=12;

本发明不仅适用于异步信号为两个的情况,对于将两个以上的异步信号转换为同一时钟域并使其帧头对齐的情况同样适用。The present invention is not only applicable to the case of two asynchronous signals, but also applicable to the case of converting more than two asynchronous signals into the same clock domain and aligning their frame headers.

以上所述仅为本发明的较佳实施例而已,并不用以限制本发明,凡在本发明的精神和原则之内,所作的任何修改、等同替换、改进等,均应包含在本发明的保护范围之内。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 (8)

1、一种将异步时钟域转换成同步时钟域的方法,其特征在于,该方法包括以下步骤:1. A method for converting an asynchronous clock domain into a synchronous clock domain, characterized in that the method comprises the following steps: a、设置异步时钟域中的每个异步信号对应一个地址发生计数器,且每个异步信号的帧头信号对其所对应的地址发生计数器进行周期置位,将该经过置位的地址发生计数器的值作为每个异步信号所对应双口RAM的写地址,并根据双口RAM的写地址设置该双口RAM的写地址状态指示信号;a. Set each asynchronous signal in the asynchronous clock domain to correspond to an address generation counter, and the frame header signal of each asynchronous signal periodically sets the address generation counter corresponding to it, and the address generation counter that has been set is set The value is used as the write address of the dual-port RAM corresponding to each asynchronous signal, and the write address status indication signal of the dual-port RAM is set according to the write address of the dual-port RAM; b、用同步时钟对异步写地址状态指示信号进行采样,得到同步写地址状态指示信号;b. Sampling the asynchronous write address status indication signal with a synchronous clock to obtain a synchronous write address status indication signal; c、同步时钟域中设置与异步时钟域中相同数量的地址发生计数器,每个同步信号的帧头信号对其所对应的地址发生计数器进行周期置位,且该地址发生计数器的值作为每个同步信号所对应双口RAM的读地址,根据同步写地址状态指示信号,按照预先设定的规则确定读地址的判断位置,并对读地址做相应调整。c. The same number of address generation counters as in the asynchronous clock domain are set in the synchronous clock domain, and the frame header signal of each synchronous signal is periodically set to the address generation counter corresponding to it, and the value of the address generation counter is used as each The read address of the dual-port RAM corresponding to the synchronous signal determines the judging position of the read address according to the pre-set rules according to the synchronous write address state indication signal, and adjusts the read address accordingly. 2、根据权利要求1所述的方法,其特征在于,所述周期置位进一步包括以下步骤:2. The method according to claim 1, wherein the periodic setting further comprises the following steps: 设置双口RAM深度为a为帧长为K的正整数倍t,对帧头进行模t计数;Set the depth of the dual-port RAM as a to be a positive integer multiple t of the frame length K, and count the frame header modulo t; 当帧头计数值小于t减1的值,且遇到帧头时,将地址发生计数器的值置为帧头计数值加1的值乘以帧长K;当帧头计数值为t减1,且遇到帧头时,将地址发生计数器的值置为0。When the frame header count value is less than the value of t minus 1, and when the frame header is encountered, the value of the address generation counter is set to the value of the frame header count value plus 1 multiplied by the frame length K; when the frame header count value is t minus 1 , and when a frame header is encountered, the value of the address generation counter is set to 0. 3、根据权利要求1所述的方法,其特征在于,所述根据双口RAM的写地址设置该双口RAM的写地址状态指示信号为:设置写地址帧头信号对应的写地址状态指示信号为高电平,且写地址状态指示信号的长度大于所对应的写地址帧头信号的长度。3. The method according to claim 1, characterized in that, setting the write address state indication signal of the dual-port RAM according to the write address of the dual-port RAM is: setting the write address state indication signal corresponding to the write address frame header signal is high level, and the length of the write address status indication signal is greater than the length of the corresponding write address frame header signal. 4、根据权利要求1所述的方法,其特征在于,异步信号的帧长大于等于4时,步骤c所述按照预先设定的规则确定读地址的判断位置的方法为:读地址的判断位置等于n乘以帧长K再减1,且n为小于等于双口RAM深度a除以帧长K的自然数;4. The method according to claim 1, wherein when the frame length of the asynchronous signal is greater than or equal to 4, the method for determining the judgment position of the read address according to the preset rules in step c is: the judgment position of the read address It is equal to n multiplied by the frame length K and then minus 1, and n is a natural number less than or equal to the dual-port RAM depth a divided by the frame length K; 步骤c所述对读地址的相应调整方法为:在读地址的判断位置上判断读地址r_add与写地址w_add之间的距离是否小于等于预先设定的危险距离L,如果是,则令与该异步信号相对应的读地址等于读地址减去帧长K再加1,否则对读地址不做调整。The corresponding adjustment method for the read address described in step c is: judge whether the distance between the read address r_add and the write address w_add is less than or equal to the preset dangerous distance L at the judging position of the read address, and if so, make the asynchronous The read address corresponding to the signal is equal to the read address minus the frame length K plus 1, otherwise the read address will not be adjusted. 5、根据权利要求4所述的方法,其特征在于,所述预先设定的危险距离L小于帧长的一半。5. The method according to claim 4, characterized in that the preset danger distance L is less than half of the frame length. 6、根据权利要求1所述的方法,其特征在于,异步信号的帧长小于4时,6. The method according to claim 1, wherein when the frame length of the asynchronous signal is less than 4, 步骤c所述按照预先设定的规则确定读地址的判断位置的方法为:读地址的判断位置在n乘以帧长K再减1中以等间隔cK抽取,且n为小于等于双口RAM深度a除以帧长K的自然数;The method for determining the judging position of the read address according to the preset rules described in step c is: the judging position of the read address is extracted with equal interval cK in n multiplied by the frame length K and then minus 1, and n is less than or equal to the dual-port RAM Depth a is divided by the natural number of frame length K; 步骤c所述对读地址的相应调整方法为:在读地址的判断位置上判断读地址r_add与写地址w_add之间的距离是否小于等于预先设定的危险距离L,如果是,则令与该异步信号相对应的读地址等于读地址减去抽取间隔cK再加1,否则对读地址不做调整。The corresponding adjustment method for the read address described in step c is: judge whether the distance between the read address r_add and the write address w_add is less than or equal to the preset dangerous distance L at the judging position of the read address, and if so, make the asynchronous The read address corresponding to the signal is equal to the read address minus the extraction interval cK plus 1, otherwise the read address is not adjusted. 7、根据权利要求6所述的方法,其特征在于,所述预先设定的危险距离L小于抽取间隔值的一半。7. The method according to claim 6, characterized in that the preset risk distance L is less than half of the extraction interval value. 8、根据权利要求1所述的方法,其特征在于,所述异步时钟域中的异步信号为两个或两个以上。8. The method according to claim 1, wherein there are two or more asynchronous signals in the asynchronous clock domain.
CNB031536689A 2003-08-19 2003-08-19 Method for converting asynchronous clock zone into synchronous one Expired - Fee Related CN100499420C (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CNB031536689A CN100499420C (en) 2003-08-19 2003-08-19 Method for converting asynchronous clock zone into synchronous one

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CNB031536689A CN100499420C (en) 2003-08-19 2003-08-19 Method for converting asynchronous clock zone into synchronous one

Publications (2)

Publication Number Publication Date
CN1585312A true CN1585312A (en) 2005-02-23
CN100499420C CN100499420C (en) 2009-06-10

Family

ID=34597804

Family Applications (1)

Application Number Title Priority Date Filing Date
CNB031536689A Expired - Fee Related CN100499420C (en) 2003-08-19 2003-08-19 Method for converting asynchronous clock zone into synchronous one

Country Status (1)

Country Link
CN (1) CN100499420C (en)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1829129B (en) * 2005-03-04 2010-12-22 Ut斯达康通讯有限公司 Method and apparatus for eliminating transmission delay difference in multipath synchronous data transmission
CN101056164B (en) * 2007-05-31 2011-04-27 北京中星微电子有限公司 A synchronization device across asynchronization clock domain signals
CN1859052B (en) * 2005-12-29 2011-06-15 华为技术有限公司 Asynchronous clock domain signal processing method and system
CN101253724B (en) * 2005-08-01 2011-08-31 Ati科技公司 Bit-deskewing IO method and system
CN102708086A (en) * 2012-05-10 2012-10-03 无锡华大国奇科技有限公司 Elastic buffer structure and method applied to universal serial bus 3.0 (USB 3.0)
CN103576738A (en) * 2012-08-01 2014-02-12 中兴通讯股份有限公司 Method and device for clock domain crossing processing of asynchronous signals
CN105225533A (en) * 2015-09-29 2016-01-06 成都川睿科技有限公司 A kind of intelligent transportation communication system based on data first in first out

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1829129B (en) * 2005-03-04 2010-12-22 Ut斯达康通讯有限公司 Method and apparatus for eliminating transmission delay difference in multipath synchronous data transmission
CN101253724B (en) * 2005-08-01 2011-08-31 Ati科技公司 Bit-deskewing IO method and system
CN1859052B (en) * 2005-12-29 2011-06-15 华为技术有限公司 Asynchronous clock domain signal processing method and system
CN101056164B (en) * 2007-05-31 2011-04-27 北京中星微电子有限公司 A synchronization device across asynchronization clock domain signals
CN102708086A (en) * 2012-05-10 2012-10-03 无锡华大国奇科技有限公司 Elastic buffer structure and method applied to universal serial bus 3.0 (USB 3.0)
CN102708086B (en) * 2012-05-10 2015-05-20 无锡华大国奇科技有限公司 Elastic buffer structure and method applied to universal serial bus 3.0 (USB 3.0)
CN103576738A (en) * 2012-08-01 2014-02-12 中兴通讯股份有限公司 Method and device for clock domain crossing processing of asynchronous signals
CN105225533A (en) * 2015-09-29 2016-01-06 成都川睿科技有限公司 A kind of intelligent transportation communication system based on data first in first out

Also Published As

Publication number Publication date
CN100499420C (en) 2009-06-10

Similar Documents

Publication Publication Date Title
CN1449119A (en) Serializer-deserializer circuit possessing enlarged building-up and retention time tolerance
CN1299215C (en) Method and apparatus for improving time constraints and extending limited length cables in a multiple-speed bus
CN1585312A (en) A method for converting an asynchronous clock domain into a synchronous clock domain
CN1551237A (en) Semiconductor memory device having advanced data strobe circuit
CN1081860C (en) Synchronization device for digital communications
CN1194429A (en) Data decoder
CN1692597A (en) Transition detection, validation and storage circuitry
CN1188980C (en) Data transmission method and system
CN1741188A (en) Asynchronous data clock domain conversion
CN111797137B (en) Method for inquiring sampling data by compressing time mark
CN1385972A (en) Up high-speed data synchronous receiving method and circuit in optical communication system
CN1514974A (en) Multi-phase encoding protocol and bus synchronization
CN1832351A (en) Universal clock synchronizer and universal clock synchronization method
CN101056164A (en) A synchronization device across asynchronization clock domain signals
CN108932208A (en) A kind of method and apparatus of data processing
CN204790677U (en) Anti-interference clock and data recovery integrated circuit design
CN1893388A (en) Asynchronous FIFO realizing system and realizing method
CN1167989C (en) Synchronizer for converting asynchronous pulse signals to synchronous ones
CN1312652A (en) Data-rate changing device
CN104637540B (en) Receiving circuit, the implementation method of receiving circuit and IC-card
CN1315018C (en) Clock pulse switching system and clock pulse switching method thereof
CN1201521C (en) TDMA voice information reading apparatus
CN1825794A (en) Network device and method for prediction of an optimal sampling phase
CN1921372A (en) Method for data synchronous communication in digital communication system
CN1591373A (en) Device and method for oversampling data recovery

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: 20090610

Termination date: 20200819

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