[go: up one dir, main page]

CN118694359A - A digital phase detector and a digital delay locked loop - Google Patents

A digital phase detector and a digital delay locked loop Download PDF

Info

Publication number
CN118694359A
CN118694359A CN202410857384.2A CN202410857384A CN118694359A CN 118694359 A CN118694359 A CN 118694359A CN 202410857384 A CN202410857384 A CN 202410857384A CN 118694359 A CN118694359 A CN 118694359A
Authority
CN
China
Prior art keywords
clk
counting
result
sampl
phase
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.)
Pending
Application number
CN202410857384.2A
Other languages
Chinese (zh)
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.)
Huimang Microelectronics Shenzhen Co ltd
Original Assignee
Huimang Microelectronics Shenzhen 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 Huimang Microelectronics Shenzhen Co ltd filed Critical Huimang Microelectronics Shenzhen Co ltd
Priority to CN202410857384.2A priority Critical patent/CN118694359A/en
Publication of CN118694359A publication Critical patent/CN118694359A/en
Pending legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H03ELECTRONIC CIRCUITRY
    • H03LAUTOMATIC CONTROL, STARTING, SYNCHRONISATION OR STABILISATION OF GENERATORS OF ELECTRONIC OSCILLATIONS OR PULSES
    • H03L7/00Automatic control of frequency or phase; Synchronisation
    • H03L7/06Automatic control of frequency or phase; Synchronisation using a reference signal applied to a frequency- or phase-locked loop
    • H03L7/08Details of the phase-locked loop
    • H03L7/085Details of the phase-locked loop concerning mainly the frequency- or phase-detection arrangement including the filtering or amplification of its output signal
    • HELECTRICITY
    • H03ELECTRONIC CIRCUITRY
    • H03LAUTOMATIC CONTROL, STARTING, SYNCHRONISATION OR STABILISATION OF GENERATORS OF ELECTRONIC OSCILLATIONS OR PULSES
    • H03L7/00Automatic control of frequency or phase; Synchronisation
    • H03L7/06Automatic control of frequency or phase; Synchronisation using a reference signal applied to a frequency- or phase-locked loop
    • H03L7/08Details of the phase-locked loop
    • H03L7/081Details of the phase-locked loop provided with an additional controlled phase shifter
    • HELECTRICITY
    • H03ELECTRONIC CIRCUITRY
    • H03LAUTOMATIC CONTROL, STARTING, SYNCHRONISATION OR STABILISATION OF GENERATORS OF ELECTRONIC OSCILLATIONS OR PULSES
    • H03L7/00Automatic control of frequency or phase; Synchronisation
    • H03L7/06Automatic control of frequency or phase; Synchronisation using a reference signal applied to a frequency- or phase-locked loop
    • H03L7/16Indirect frequency synthesis, i.e. generating a desired one of a number of predetermined frequencies using a frequency- or phase-locked loop
    • H03L7/18Indirect frequency synthesis, i.e. generating a desired one of a number of predetermined frequencies using a frequency- or phase-locked loop using a frequency divider or counter in the loop

Landscapes

  • Stabilization Of Oscillater, Synchronisation, Frequency Synthesizers (AREA)

Abstract

一种数字鉴相器以及数字延迟锁相环,数字鉴相器对输入、输出时钟相互采样,产生两个初始相位关系信号;然后对两个初始相位关系信号独立进行计数,并在计数时间持续了多个计数周期时比较两个计数结果,产生两个相位关系标志信号;再对两个相位关系标志信号进行计数产生两个计数结果,在两个计数结果中的某个率先到达N时确定所需要输出的1比特的全局相位鉴相结果的数值;如此,当处于亚稳态区间时,通过对D触发器决断时间后不确定的值多次统计,输出在概率上较大的结果,可以明显减少传统鉴相器方案存在的器件亚稳态现象导致锁相过早或过晚的现象,此外也避免了输出时钟可能产生的毛刺导致的相位关系不明确问题,增加了鉴相的准确性。

A digital phase detector and a digital delay phase-locked loop. The digital phase detector samples input and output clocks mutually to generate two initial phase relationship signals; then the two initial phase relationship signals are counted independently, and when the counting time lasts for multiple counting cycles, the two counting results are compared to generate two phase relationship flag signals; the two phase relationship flag signals are counted again to generate two counting results, and when one of the two counting results reaches N first, the value of the 1-bit global phase discrimination result to be output is determined; thus, when in a metastable interval, the uncertain values after the decision time of a D flip-flop are counted multiple times, and a result with a greater probability is output, which can significantly reduce the phenomenon of early or late phase locking caused by the metastable phenomenon of the device in the traditional phase detector solution, and also avoid the problem of unclear phase relationship caused by the burrs that may be generated by the output clock, thereby increasing the accuracy of phase discrimination.

Description

一种数字鉴相器以及数字延迟锁相环A digital phase detector and a digital delay locked loop

技术领域Technical Field

本发明涉及锁相环领域,尤其涉及一种数字鉴相器以及数字延迟锁相环。The invention relates to the field of phase-locked loops, and in particular to a digital phase detector and a digital delay phase-locked loop.

背景技术Background Art

锁相环可通过反馈电路对输入信号的频率和相位进行自动跟踪。锁相环技术分为DLL(Delay Locked Loop)和PLL(Phase Locked Loop)。DLL主要将PLL的压控振荡器替代为数字控制的可变延迟线,它可以快速改变延迟路径,明显降低了电路噪声、时钟抖动。PLL主要应用于模拟电路中,可以用于频率综合与相位对齐,DLL主要应用于数字电路中时钟相移。鉴相器是锁相环重要的组成部分,现有的鉴相器有通过异或门实现简单鉴相的方法,但会受到毛刺的影响,误差过大;另一类为D触发器构成的时序鉴相器也称鉴频鉴相器,结构为2个D触发器的输入接高电平,输出接入与门并反馈回D触发器的复位端,产生2个时钟之间的相位关系,在PLL和模拟DLL中可以控制电荷泵对滤波电容充放电,但该结构会受到与门和复位的延迟影响,以及器件工艺和温度等影响不可避免的进入亚稳态窗口,导致结果不能稳定在1或0,进而不能精准锁相,限制了在高频、多相位的应用场景。The phase-locked loop can automatically track the frequency and phase of the input signal through the feedback circuit. Phase-locked loop technology is divided into DLL (Delay Locked Loop) and PLL (Phase Locked Loop). DLL mainly replaces the voltage-controlled oscillator of PLL with a digitally controlled variable delay line, which can quickly change the delay path and significantly reduce circuit noise and clock jitter. PLL is mainly used in analog circuits and can be used for frequency synthesis and phase alignment, while DLL is mainly used for clock phase shift in digital circuits. The phase detector is an important part of the phase-locked loop. The existing phase detector has a method of realizing simple phase detection through an XOR gate, but it will be affected by glitches and the error is too large. Another type of timing phase detector composed of D flip-flops is also called a frequency phase detector. The structure is that the inputs of two D flip-flops are connected to a high level, and the outputs are connected to the AND gate and fed back to the reset end of the D flip-flop to generate a phase relationship between the two clocks. In the PLL and analog DLL, the charge pump can be controlled to charge and discharge the filter capacitor. However, this structure will be affected by the delay of the AND gate and reset, as well as the influence of device process and temperature, and will inevitably enter the metastable window, resulting in the result cannot be stabilized at 1 or 0, and thus cannot be accurately phase-locked, limiting the application scenarios in high-frequency and multi-phase scenarios.

发明内容Summary of the invention

本发明要解决的技术问题在于,针对现有技术的锁相精度不足的缺陷,提供一种数字鉴相器以及数字延迟锁相环。The technical problem to be solved by the present invention is to provide a digital phase detector and a digital delay locked loop to address the defect of insufficient phase locking accuracy in the prior art.

本发明解决其技术问题所采用的技术方案是:The technical solution adopted by the present invention to solve the technical problem is:

一方面,构造一种数字鉴相器,其包括:On the one hand, a digital phase detector is constructed, which includes:

相位关系产生单元,用于接收输入时钟和数字控制延迟链输出的输出时钟,对所述输入时钟和输出时钟相互采样,产生代表所述输出时钟相对所述输入时钟的是否超前的第一初始相位关系信号以及是否滞后的第二初始相位关系信号;A phase relationship generating unit, configured to receive an input clock and an output clock output by a digitally controlled delay chain, sample the input clock and the output clock, and generate a first initial phase relationship signal representing whether the output clock is ahead of the input clock and a second initial phase relationship signal representing whether the output clock is behind the input clock;

相位关系计数单元,用于对所述第一初始相位关系信号进行计数产生第一计数结果,以及对所述第二初始相位关系信号进行计数产生第二计数结果;a phase relationship counting unit, configured to count the first initial phase relationship signal to generate a first counting result, and to count the second initial phase relationship signal to generate a second counting result;

相位结果产生单元,用于比较在计数时间持续了多个计数周期时的所述第一计数结果和所述第二计数结果,产生代表所述输出时钟相对所述输入时钟的是否超前的第一相位关系标志信号以及是否滞后的第二相位关系标志信号;a phase result generating unit, configured to compare the first counting result and the second counting result when the counting time lasts for a plurality of counting cycles, and generate a first phase relationship flag signal representing whether the output clock is ahead of the input clock and a second phase relationship flag signal representing whether the output clock is behind the input clock;

相位结果计数单元,用于对所述第一相位关系标志信号进行计数产生第三计数结果,以及对所述第二相位关系标志信号进行计数产生第四计数结果;a phase result counting unit, configured to count the first phase relationship flag signal to generate a third counting result, and to count the second phase relationship flag signal to generate a fourth counting result;

相位结果输出单元,用于根据率先到达N的是第三计数结果或是第四计数结果来确定所需要输出的1比特的全局相位鉴相结果的数值,N为正整数。The phase result output unit is used to determine the value of the 1-bit global phase discrimination result to be output according to whether the third counting result or the fourth counting result reaches N first, where N is a positive integer.

进一步地,在本发明所述的数字鉴相器中,所述相位关系产生单元是基于触发器实现,所述N的取值需满足:所述数字控制延迟链中的N个延迟单元的延时大于触发器的亚稳态时长。Furthermore, in the digital phase detector described in the present invention, the phase relationship generating unit is implemented based on a trigger, and the value of N must satisfy: the delay of the N delay units in the digitally controlled delay chain is greater than the metastable duration of the trigger.

进一步地,在本发明所述的数字鉴相器中,所述输入时钟是经过固定延时的系统时钟,所述输出时钟是经过数字控制延迟链的系统时钟。Furthermore, in the digital phase detector described in the present invention, the input clock is a system clock that has passed through a fixed delay, and the output clock is a system clock that has passed through a digitally controlled delay chain.

进一步地,在本发明所述的数字鉴相器中,所述的相位结果输出单元具体是在第三计数结果率先达到N时将所述全局相位鉴相结果置第一电平,在第四计数结果率先达到N时将所述全局相位鉴相结果置第二电平,所述第一电平与所述第二电平相反。Furthermore, in the digital phase detector described in the present invention, the phase result output unit specifically sets the global phase detection result to a first level when the third counting result reaches N first, and sets the global phase detection result to a second level when the fourth counting result reaches N first, and the first level is opposite to the second level.

进一步地,在本发明所述的数字鉴相器中,所述相位关系计数单元具体包括:Furthermore, in the digital phase detector of the present invention, the phase relationship counting unit specifically includes:

超前计数模块,用于对所述第一初始相位关系信号进行计数产生第一计数结果,以及在接收到的第一采样标志信号有效时保持所述第一计数结果,在接收到的采样复位信号有效时将第一计数结果清零;An advance counting module, configured to count the first initial phase relationship signal to generate a first counting result, and to maintain the first counting result when the received first sampling flag signal is valid, and to clear the first counting result to zero when the received sampling reset signal is valid;

滞后计数模块,用于对所述第二初始相位关系信号进行计数产生第二计数结果,以及在接收到第二采样标志信号时保持所述第二计数结果,在接收到的所述采样复位信号有效时将第二计数结果清零;a hysteresis counting module, configured to count the second initial phase relationship signal to generate a second counting result, and to maintain the second counting result when a second sampling flag signal is received, and to clear the second counting result to zero when the received sampling reset signal is valid;

同步模块,用于将所述第一采样标志信号同步到所述输出时钟的时域下作为所述第二采样标志信号,以及将所述滞后计数模块输出的所述第二计数结果同步到所述输入时钟的时域后输出。The synchronization module is used to synchronize the first sampling mark signal to the time domain of the output clock as the second sampling mark signal, and synchronize the second counting result output by the hysteresis counting module to the time domain of the input clock and then output it.

进一步地,在本发明所述的数字鉴相器中,Furthermore, in the digital phase detector of the present invention,

所述同步模块具体用于在响应信号无效时将接入的所述第一采样标志信号通过所述输出时钟下的M个D触发器产生所述第二采样标志信号,并将所述第二采样标志信号通过所述输入时钟下的M个D触发器同步至所述输入时钟的时钟域作为数据请求信号;所述滞后计数模块仅在所述请求信号有效时才将所保持的所述第二计数结果同步到所述同步模块进行输出;The synchronization module is specifically used to generate the second sampling flag signal by the first sampling flag signal connected to the M D flip-flops under the output clock when the response signal is invalid, and synchronize the second sampling flag signal to the clock domain of the input clock through the M D flip-flops under the input clock as a data request signal; the hysteresis counting module synchronizes the maintained second counting result to the synchronization module for output only when the request signal is valid;

所述同步模块还用于将所述数据请求信号通过所述输出时钟下的M个D触发器后产生响应信号,当所述响应信号有效时将所述第二采样标志信号置位无效,否则接入所述第一采样标志信号。The synchronization module is also used to generate a response signal after the data request signal passes through the M D flip-flops under the output clock, and when the response signal is valid, the second sampling flag signal is set to invalid, otherwise the first sampling flag signal is connected.

进一步地,在本发明所述的数字鉴相器中,还包括:Furthermore, the digital phase detector of the present invention further comprises:

采样控制单元,用于接收所述输入时钟的计数值,当所述计数值到达Y时将所述第一采样标志信号以及所述采样复位信号先后置有效。The sampling control unit is used to receive the count value of the input clock, and when the count value reaches Y, the first sampling flag signal and the sampling reset signal are successively enabled.

进一步地,在本发明所述的数字鉴相器中,所述相位关系产生单元包括第一触发器和第二触发器;所述第一触发器的时钟端接入所述输入时钟,所述第一触发器的D端接入所述输出时钟,所述第一触发器的Q端输出所述第一初始相位关系信号;所述第二触发器的时钟端接入所述输出时钟,所述第二触发器的D端接入所述输入时钟,所述第二触发器的Q端输出所述第二初始相位关系信号。Furthermore, in the digital phase detector described in the present invention, the phase relationship generating unit includes a first trigger and a second trigger; the clock end of the first trigger is connected to the input clock, the D end of the first trigger is connected to the output clock, and the Q end of the first trigger outputs the first initial phase relationship signal; the clock end of the second trigger is connected to the output clock, the D end of the second trigger is connected to the input clock, and the Q end of the second trigger outputs the second initial phase relationship signal.

二方面,构造一种数字延迟锁相环,其包括如前任一项所述的数字鉴相器、控制器和数字控制延迟链;所述控制器用于接收所述全局相位鉴相结果,根据所述全局相位鉴相结果调整所述数字控制延迟链中启用的延迟单元的数量。In the second aspect, a digital delay locked loop is constructed, which includes a digital phase detector, a controller and a digitally controlled delay chain as described in any of the preceding items; the controller is used to receive the global phase detection result and adjust the number of delay units enabled in the digitally controlled delay chain according to the global phase detection result.

进一步地,在本发明所述的数字延迟锁相环中,所述控制器包括:Furthermore, in the digital delay locked loop of the present invention, the controller comprises:

分频计数电路,用于对所述输入时钟进行Y分频产生分频时钟信号,将所述分频时钟信号输出至状态机模块驱动状态的转移,同时对所述输入时钟进行计数并将计数值输出到所述数字鉴相器以便产生第一采样标志信号以及采样复位信号;A frequency division counting circuit is used for performing Y-frequency division on the input clock to generate a frequency division clock signal, outputting the frequency division clock signal to the state machine module to drive the state transfer, and at the same time counting the input clock and outputting the count value to the digital phase detector to generate a first sampling flag signal and a sampling reset signal;

状态机模块,包含IDLE、LF1、INC、DEC 4个状态,IDLE为空闲状态,LF1状态为输出时钟相对于输入时钟相位差0°—180°,INC状态为输出时钟相对于输入时钟相位差180°—360°,DEC状态代表锁相完成,其中:当开启所述分频计数后进入LF1状态,目标计数值自加;LF1状态跳转INC状态的条件是所述全局相位鉴相结果为第一电平;INC状态跳到DEC状态的条件是所述全局相位鉴相结果变到第二电平;当进入DEC状态时,所述目标计数值减N作为所述数字控制延迟链中需要启用的延迟单元的数量,同时锁相完成标志位会置位以代表锁相完成。The state machine module includes four states: IDLE, LF1, INC, and DEC. IDLE is an idle state. The LF1 state is an output clock with a phase difference of 0°-180° relative to the input clock. The INC state is an output clock with a phase difference of 180°-360° relative to the input clock. The DEC state represents phase lock completion, wherein: when the frequency division count is turned on and the LF1 state is entered, the target count value is self-incremented; the condition for the LF1 state to jump to the INC state is that the global phase detection result is a first level; the condition for the INC state to jump to the DEC state is that the global phase detection result changes to a second level; when entering the DEC state, the target count value minus N is used as the number of delay units that need to be enabled in the digital control delay chain, and the phase lock completion flag bit is set to represent the completion of phase lock.

本发明的数字鉴相器以及数字延迟锁相环,具有以下有益效果:本发明对输入时钟和输出时钟相互采样,产生代表所述输出时钟相对所述输入时钟的是否超前的第一初始相位关系信号以及是否滞后的第二初始相位关系信号;然后对所述第一初始相位关系信号进行计数产生第一计数结果,以及对所述第二初始相位关系信号进行计数产生第二计数结果;比较在计数时间持续了多个计数周期时的所述第一计数结果和所述第二计数结果,产生代表所述输出时钟相对所述输入时钟的是否超前的第一相位关系标志信号以及是否滞后的第二相位关系标志信号;再对所述第一相位关系标志信号进行计数产生第三计数结果,以及对所述第二相位关系标志信号进行计数产生第四计数结果,在第三计数结果或是第四计数结果率先到达N时确定所需要输出的1比特的全局相位鉴相结果的数值;如此,当处于亚稳态区间时,通过对D触发器决断时间后不确定的值多次统计,输出在概率上较大的结果,可以明显减少传统鉴相器方案存在的器件亚稳态现象导致锁相过早或过晚的现象,此外也避免了输出时钟可能产生的毛刺导致的相位关系不明确问题,保证了时序的安全,增加了鉴相的准确性,利于数字集成,可满足不同温度下对高精度相位选择的需求。The digital phase detector and the digital delay locked loop of the present invention have the following beneficial effects: the present invention samples the input clock and the output clock mutually, generates a first initial phase relationship signal representing whether the output clock is ahead of the input clock and a second initial phase relationship signal representing whether the output clock is behind; then counts the first initial phase relationship signal to generate a first counting result, and counts the second initial phase relationship signal to generate a second counting result; compares the first counting result and the second counting result when the counting time lasts for a plurality of counting cycles, generates a first phase relationship flag signal representing whether the output clock is ahead of the input clock and a second phase relationship flag signal representing whether the output clock is behind; then compares the first phase The relationship flag signal is counted to generate a third counting result, and the second phase relationship flag signal is counted to generate a fourth counting result, and when the third counting result or the fourth counting result reaches N first, the value of the 1-bit global phase detection result to be output is determined; in this way, when in the metastable interval, by repeatedly counting the uncertain values after the D flip-flop decision time, a result with a larger probability is output, which can significantly reduce the phenomenon of device metastable phenomenon in traditional phase detector schemes causing premature or late phase locking. In addition, it also avoids the problem of unclear phase relationship caused by glitches that may be generated by the output clock, ensures the safety of timing, increases the accuracy of phase detection, is conducive to digital integration, and can meet the needs of high-precision phase selection at different temperatures.

附图说明BRIEF DESCRIPTION OF THE DRAWINGS

为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据提供的附图获得其他的附图:In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art are briefly introduced below. Obviously, the drawings in the following description are only embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained based on the provided drawings without creative work:

图1是本发明数字延迟锁相环的结构示意图;FIG1 is a schematic diagram of the structure of a digital delay locked loop according to the present invention;

图2是本发明数字鉴相器的结构示意图;FIG2 is a schematic diagram of the structure of a digital phase detector of the present invention;

图3是相位关系产生单元的结构示意图;FIG3 is a schematic diagram of the structure of a phase relationship generating unit;

图4是控制器的结构示意图。FIG4 is a schematic diagram of the structure of the controller.

具体实施方式DETAILED DESCRIPTION

为了便于理解本发明,下面将参照相关附图对本发明进行更全面的描述。附图中给出了本发明的典型实施例。但是,本发明可以以许多不同的形式来实现,并不限于本文所描述的实施例。相反地,提供这些实施例的目的是使对本发明的公开内容更加透彻全面。应当理解本发明实施例以及实施例中的具体特征是对本申请技术方案的详细的说明,而不是对本申请技术方案的限定,在不冲突的情况下,本发明实施例以及实施例中的技术特征可以相互组合。In order to facilitate the understanding of the present invention, the present invention will be described more fully below with reference to the relevant drawings. Typical embodiments of the present invention are shown in the drawings. However, the present invention can be implemented in many different forms and is not limited to the embodiments described herein. On the contrary, the purpose of providing these embodiments is to make the disclosure of the present invention more thorough and comprehensive. It should be understood that the embodiments of the present invention and the specific features in the embodiments are detailed descriptions of the technical solutions of the present application, rather than limitations on the technical solutions of the present application. In the absence of conflict, the embodiments of the present invention and the technical features in the embodiments can be combined with each other.

参考图1,本发明的数字延迟锁相环(DLL),包括数字鉴相器、控制器和数字控制延迟链(DCDL)。1 , the digital delay locked loop (DLL) of the present invention includes a digital phase detector, a controller and a digital controlled delay chain (DCDL).

控制器用于接收数字鉴相器输出的全局相位鉴相结果pd_out并根据所述全局相位鉴相结果pd_out调整所述数字控制延迟链中启用的延迟单元的数量。The controller is used for receiving a global phase detection result pd_out output by the digital phase detector and adjusting the number of enabled delay units in the digital controlled delay chain according to the global phase detection result pd_out.

本实施例中数字控制延迟链采用256级延迟单元可选,每级135ps左右(受温度影响),根据不同输入时钟clk_in频率可输出锁相时对应的延迟单元个数,输入时钟clk_in不低于30Mhz。In this embodiment, the digital control delay chain uses 256 levels of delay units to be selected, each level is about 135ps (affected by temperature), and the number of delay units corresponding to phase locking can be output according to different input clock clk_in frequencies, and the input clock clk_in is not less than 30Mhz.

数字鉴相器的输入有两个,分别是输入时钟clk_in、输出时钟clk_out。输出时钟clk_out是系统时钟经过数字控制延迟链后输出的,如图1中的Clk_in(system)表示系统时钟。输入时钟clk_in可以直接选取系统时钟Clk_in(system),但是本实施例中,考虑到输出时钟clk_out经过数字控制延迟链会产生延时(数字控制延迟链的多路选择器导致的延时),所以输入时钟clk_in也是经过了同样长度的延迟链的,比如将系统时钟Clk_in(system)经过一条延迟链进行固定延时后才输出所述输入时钟clk_in给到数字鉴相器。如此,数字鉴相器的两个输入(输入时钟clk_in、输出时钟clk_out)都是经过了延迟链结构,所以延迟链结构中的多路选择器所导致的误差对数字鉴相器的两个输入都会产生作用,从而达到抵消延时误差的效果。数字鉴相器输出的是全局相位鉴相结果pd_out,全局相位鉴相结果pd_out输出到控制器。The digital phase detector has two inputs, namely, input clock clk_in and output clock clk_out. The output clock clk_out is the output of the system clock after passing through the digital control delay chain, as shown in FIG1 , where Clk_in(system) represents the system clock. The input clock clk_in can directly select the system clock Clk_in(system), but in this embodiment, considering that the output clock clk_out will be delayed after passing through the digital control delay chain (the delay caused by the multiplexer of the digital control delay chain), the input clock clk_in also passes through a delay chain of the same length, for example, the system clock Clk_in(system) is passed through a delay chain for a fixed delay before the input clock clk_in is output to the digital phase detector. In this way, both inputs of the digital phase detector (input clock clk_in and output clock clk_out) pass through the delay chain structure, so the error caused by the multiplexer in the delay chain structure will have an effect on both inputs of the digital phase detector, thereby achieving the effect of offsetting the delay error. The digital phase detector outputs a global phase detection result pd_out, and the global phase detection result pd_out is output to the controller.

下面对数字鉴相器进行详细阐述。The digital phase detector is explained in detail below.

参考图2,本发明的数字鉴相器输入为clk_in(经过固定延迟的输入时钟)和clk_out(经过可控延迟链延迟后的输出时钟),输出为1bit的全局相位鉴相结果pd_out。数字鉴相器内部主要包括:相位关系产生单元1、相位关系计数单元2、相位结果产生单元3、相位结果计数单元4、相位结果输出单元5、采样控制单元6。Referring to FIG2 , the digital phase detector of the present invention has inputs of clk_in (input clock after fixed delay) and clk_out (output clock after controllable delay chain delay), and outputs a 1-bit global phase detection result pd_out. The digital phase detector mainly includes: a phase relationship generating unit 1, a phase relationship counting unit 2, a phase result generating unit 3, a phase result counting unit 4, a phase result output unit 5, and a sampling control unit 6.

其中,相位关系产生单元1用于接收输入时钟clk_in和数字控制延迟链输出的输出时钟clk_out,对所述输入时钟clk_in和输出时钟clk_out相互采样,产生代表所述输出时钟clk_out相对所述输入时钟clk_in的是否超前的第一初始相位关系信号clk_out_leading以及是否滞后的第二初始相位关系信号clk_out_lagging。具体参考图3,所述相位关系产生单元1是基于触发器实现,包括第一触发器和第二触发器,2个D触发器产生2个信号,代表clk_in和clk_out的相位关系。所述第一触发器的时钟端接入所述输入时钟clk_in,所述第一触发器的D端接入所述输出时钟clk_out,所述第一触发器的Q端输出所述第一初始相位关系信号clk_out_leading,Q端clk_out_leading为高表示clk_ou超前clk_in。所述第二触发器的时钟端接入所述输出时钟clk_out,所述第二触发器的D端接入所述输入时钟clk_in,所述第二触发器的Q端输出所述第二初始相位关系信号clk_out_lagging,Q端clk_out_lagging为高表示clk_out滞后clk_in。The phase relationship generating unit 1 is used to receive the input clock clk_in and the output clock clk_out output by the digital control delay chain, sample the input clock clk_in and the output clock clk_out, and generate a first initial phase relationship signal clk_out_leading representing whether the output clock clk_out is ahead of the input clock clk_in and a second initial phase relationship signal clk_out_lagging representing whether the output clock clk_out is lagging. With reference to FIG3 , the phase relationship generating unit 1 is implemented based on a trigger, including a first trigger and a second trigger, and two D triggers generate two signals representing the phase relationship between clk_in and clk_out. The clock end of the first trigger is connected to the input clock clk_in, the D end of the first trigger is connected to the output clock clk_out, and the Q end of the first trigger outputs the first initial phase relationship signal clk_out_leading. The high value of the Q end clk_out_leading indicates that clk_out is ahead of clk_in. The clock terminal of the second flip-flop is connected to the output clock clk_out, the D terminal of the second flip-flop is connected to the input clock clk_in, the Q terminal of the second flip-flop outputs the second initial phase relationship signal clk_out_lagging, and the Q terminal clk_out_lagging is high, indicating that clk_out lags clk_in.

其中,相位关系计数单元2用于对所述第一初始相位关系信号clk_out_leading进行计数产生第一计数结果cnt_sampl_lead,以及对所述第二初始相位关系信号clk_out_lagging进行计数产生第二计数结果cnt_sampl_lagg。The phase relationship counting unit 2 is used for counting the first initial phase relationship signal clk_out_leading to generate a first counting result cnt_sampl_lead, and for counting the second initial phase relationship signal clk_out_lagging to generate a second counting result cnt_sampl_lagg.

具体来说,所述相位关系计数单元2具体包括超前计数模块21、滞后计数模块22和同步模块23。超前计数模块21用于对所述第一初始相位关系信号clk_out_leading进行计数产生第一计数结果cnt_sampl_lead,以及在接收到的第一采样标志信号sampl_flag有效时保持所述第一计数结果cnt_sampl_lead,在接收到的采样复位信号reset_sampl有效时将第一计数结果cnt_sampl_lead清零。同步模块23用于接收所述第一采样标志信号sampl_flag并将其转换到所述输出时钟clk_out的时域下作为第二采样标志信号sampl_flag_clkout。滞后计数模块22用于对所述第二初始相位关系信号clk_out_lagging进行计数产生第二计数结果cnt_sampl_lagg,以及在接收到的第二采样标志信号sampl_flag_clkout有效时保持所述第二计数结果cnt_sampl_lagg,在接收到的所述采样复位信号reset_sampl有效时将第二计数结果cnt_sampl_lagg清零。同步模块23还用于将所述第一采样标志信号sampl_flag同步到所述输出时钟clk_out的时域下作为所述第二采样标志信号sampl_flag_clkout,以及将所述滞后计数模块22输出的所述第二计数结果cnt_sampl_lagg同步到所述输入时钟clk_in的时域后输出。Specifically, the phase relationship counting unit 2 specifically includes an advance counting module 21, a lag counting module 22 and a synchronization module 23. The advance counting module 21 is used to count the first initial phase relationship signal clk_out_leading to generate a first counting result cnt_sampl_lead, and to maintain the first counting result cnt_sampl_lead when the received first sampling flag signal sampl_flag is valid, and to clear the first counting result cnt_sampl_lead when the received sampling reset signal reset_sampl is valid. The synchronization module 23 is used to receive the first sampling flag signal sampl_flag and convert it to the time domain of the output clock clk_out as the second sampling flag signal sampl_flag_clkout. The hysteresis counting module 22 is used to count the second initial phase relationship signal clk_out_lagging to generate a second counting result cnt_sampl_lagg, and to maintain the second counting result cnt_sampl_lagg when the received second sampling flag signal sampl_flag_clkout is valid, and to clear the second counting result cnt_sampl_lagg when the received sampling reset signal reset_sampl is valid. The synchronization module 23 is also used to synchronize the first sampling flag signal sampl_flag to the time domain of the output clock clk_out as the second sampling flag signal sampl_flag_clkout, and to synchronize the second counting result cnt_sampl_lagg output by the hysteresis counting module 22 to the time domain of the input clock clk_in and then output it.

即超前计数模块21、滞后计数模块22是两个时钟域分别对图2中的两个Q端电平独立进行周期性的计数。假定计数周期为Y个clk_in的周期,在Y个clk_in周期内保持clk_in和clk_out相位关系不变(是指的延时链的延时单元的个数保持不变),每一个clk_in周期对clk_out_leading、clk_out_lagging进行计数,如果clk_out_leading为高则cnt_sampl_lead加1,否则cnt_sampl_lead不变,同理,如果clk_out_lagging为高则clk_out_lagging加1,否则clk_out_lagging不变。当Y个clk_in的周期到达时,采样标志sampl_flag有效,此时保持计数结果不变,以便数据稳定并采样比较。在sampl_flag置有效后的reset_sampl也紧接着置有效,reset_sampl有效对2个计数单元计数值(cnt_sampl_lead、cnt_sampl_lagg)置0复位,使超前计数模块21、滞后计数模块22在下一次移相后重新计数。That is, the leading counting module 21 and the lagging counting module 22 are two clock domains that independently and periodically count the two Q-end levels in FIG2. Assuming that the counting cycle is Y clk_in cycles, the phase relationship between clk_in and clk_out is kept unchanged within Y clk_in cycles (that is, the number of delay units in the delay chain remains unchanged), and clk_out_leading and clk_out_lagging are counted in each clk_in cycle. If clk_out_leading is high, cnt_sampl_lead is increased by 1, otherwise cnt_sampl_lead remains unchanged. Similarly, if clk_out_lagging is high, clk_out_lagging is increased by 1, otherwise clk_out_lagging remains unchanged. When Y clk_in cycles arrive, the sampling flag sampl_flag is valid, and the counting result is kept unchanged at this time, so that the data is stable and sampled and compared. After sampl_flag is set valid, reset_sampl is also set valid immediately. The validity of reset_sampl resets the count values of the two counting units (cnt_sampl_lead, cnt_sampl_lagg) to 0, so that the leading counting module 21 and the lagging counting module 22 restart counting after the next phase shift.

此外,因为clk_out与clk_in属于异步关系,为了保持同步时序设计,即将clk_out时钟域的信号同步至clk_in的时钟域,所以需要同步模块23将clk_out时钟域的计数结果cnt_sampl_lagg同步到输入时钟clk_in域,本实施例采用握手处理来同步计数结果:In addition, because clk_out and clk_in are in an asynchronous relationship, in order to maintain synchronous timing design, the signal in the clk_out clock domain is synchronized to the clk_in clock domain, so the synchronization module 23 is required to synchronize the counting result cnt_sampl_lagg in the clk_out clock domain to the input clock clk_in domain. This embodiment uses handshake processing to synchronize the counting result:

1)所述同步模块23具体在响应信号(ack,图未示意,在后续3)部分会解释ack的产生)无效时将接入的所述第一采样标志信号sampl_flag通过所述输出时钟clk_out下的M个D触发器(比如2个D触发器)产生所述第二采样标志信号sampl_flag_clkout,滞后计数模块22在接收到的第二采样标志信号sampl_flag_clkout有效(本实施例中sampl_flag_clkout是1有效)时会保持所述第二计数结果cnt_sampl_lagg;1) When the response signal (ack, not shown in the figure, the generation of ack will be explained in the subsequent part 3)) is invalid, the synchronization module 23 generates the second sampling flag signal sampl_flag_clkout by using the M D flip-flops (such as 2 D flip-flops) under the output clock clk_out, and the hysteresis counting module 22 maintains the second counting result cnt_sampl_lagg when the received second sampling flag signal sampl_flag_clkout is valid (in this embodiment, sampl_flag_clkout is 1 valid);

2)在产生第二采样标志信号sampl_flag_clkout后,所述同步模块23还接着将所述第二采样标志信号sampl_flag_clkout通过所述输入时钟clk_in下的M个D触发器(比如2个D触发器)同步至所述输入时钟clk_in的时钟域作为数据请求信号(req_d,图未示意);所述滞后计数模块22仅在所述请求信号req_d有效时才将所保持的所述第二计数结果cnt_sampl_lagg同步到所述同步模块23进行输出,该同步输出记为cnt_sampl_lagg_clkin;此时完成了数据的同步。可以理解的是,当所述请求信号req_d无效时,所述第二计数结果cnt_sampl_lagg仅是保持住,但是并不会同步到同步模块23进行输出。2) After generating the second sampling flag signal sampl_flag_clkout, the synchronization module 23 also synchronizes the second sampling flag signal sampl_flag_clkout to the clock domain of the input clock clk_in through M D flip-flops (such as 2 D flip-flops) under the input clock clk_in as a data request signal (req_d, not shown in the figure); the hysteresis counting module 22 synchronizes the maintained second counting result cnt_sampl_lagg to the synchronization module 23 for output only when the request signal req_d is valid, and the synchronization output is recorded as cnt_sampl_lagg_clkin; at this time, the data synchronization is completed. It can be understood that when the request signal req_d is invalid, the second counting result cnt_sampl_lagg is only maintained, but will not be synchronized to the synchronization module 23 for output.

3)在产生数据请求信号req_d后,所述同步模块23还接着将所述数据请求信号req_d通过所述输出时钟clk_out下的M个D触发器(比如2个D触发器)后产生响应信号ack。当所述响应信号ack有效时将所述第二采样标志信号sampl_flag_clkout置位无效(本实施例即将sampl_flag_clkout置0),否则接入所述第一采样标志信号sampl_flag。3) After generating the data request signal req_d, the synchronization module 23 further generates a response signal ack after passing the data request signal req_d through M D flip-flops (for example, 2 D flip-flops) under the output clock clk_out. When the response signal ack is valid, the second sampling flag signal sampl_flag_clkout is set to invalid (in this embodiment, sampl_flag_clkout is set to 0), otherwise the first sampling flag signal sampl_flag is connected.

以上可以看出,整个相位关系产生单元1的采样和复位依赖于外部的第一采样标志信号sampl_flag以及采样复位信号reset_sampl,这两个信号是由采样控制单元6输出。具体来说,采样控制单元6用于接收所述输入时钟clk_in的计数值cnt_div,计数值cnt_div具体在后面的控制器部分会详细阐述。当所述计数值cnt_div到达Y时将所述第一采样标志信号sampl_flag以及所述采样复位信号reset_sampl先后置有效。Y的选取可根据需求自定义,但必须保证Y减去相位关系计数单元2中必要的同步和复位所需的周期后还有若干个周期用来对cnt_sampl_lead和cnt_sampl_lagg计数。比如说本实施例中Y具体取值是16,第一采样标志信号sampl_flag置有效具体是置1,所述采样复位信号reset_sampl置有效具体是置0,则意味着当cnt_div记到16时拉高sampl_flag,拉低reset_sampl。It can be seen from the above that the sampling and resetting of the entire phase relationship generating unit 1 depends on the external first sampling flag signal sampl_flag and the sampling reset signal reset_sampl, which are output by the sampling control unit 6. Specifically, the sampling control unit 6 is used to receive the count value cnt_div of the input clock clk_in, and the count value cnt_div will be described in detail in the controller part later. When the count value cnt_div reaches Y, the first sampling flag signal sampl_flag and the sampling reset signal reset_sampl are successively set to be valid. The selection of Y can be customized according to the needs, but it must be ensured that after Y subtracts the necessary synchronization and reset cycles in the phase relationship counting unit 2, there are still several cycles for counting cnt_sampl_lead and cnt_sampl_lagg. For example, in this embodiment, the specific value of Y is 16, the first sampling flag signal sampl_flag is set to be valid specifically to 1, and the sampling reset signal reset_sampl is set to be valid specifically to 0, which means that when cnt_div is recorded to 16, sampl_flag is pulled high and reset_sampl is pulled low.

其中,相位结果产生单元3用于对相位关系产生单元1产生的计数结果在第一采样标志信号sampl_flag到来后时、采样复位信号reset_sampl之前进行比较,即用于比较在计数时间持续了Y个计数周期(一个计数周期具体是一个clk_in的周期)时的所述第一计数结果cnt_sampl_lead和所述第二计数结果cnt_sampl_lagg,根据比较结果产生代表所述输出时钟clk_out相对所述输入时钟clk_in的是否超前的第一相位关系标志信号result_lead以及是否滞后的第二相位关系标志信号result_lagg。具体来说,当cnt_sampl_lead小于cnt_sampl_lagg_clkin时,判定当前DCDL产生的clk_out滞后于clk_in(相位差在0—180°),此时拉高result_lagg;当cnt_sampl_lead大于cnt_sampl_lagg_clkin时,判定当前DCDL产生的clk_out超前于clk_in(相位差在180—360°),此时拉高result_lead。Among them, the phase result generating unit 3 is used to compare the counting result generated by the phase relationship generating unit 1 after the first sampling flag signal sampl_flag arrives and before the sampling reset signal reset_sampl, that is, to compare the first counting result cnt_sampl_lead and the second counting result cnt_sampl_lagg when the counting time lasts for Y counting cycles (one counting cycle is specifically a clk_in cycle), and generate the first phase relationship flag signal result_lead representing whether the output clock clk_out is ahead of the input clock clk_in and the second phase relationship flag signal result_lagg representing whether it is lagging behind according to the comparison result. Specifically, when cnt_sampl_lead is less than cnt_sampl_lagg_clkin, it is determined that the clk_out generated by the current DCDL lags behind clk_in (the phase difference is between 0 and 180°), and result_lagg is pulled high at this time; when cnt_sampl_lead is greater than cnt_sampl_lagg_clkin, it is determined that the clk_out generated by the current DCDL leads clk_in (the phase difference is between 180 and 360°), and result_lead is pulled high at this time.

其中,相位结果计数单元4用于对所述第一相位关系标志信号result_lead进行计数产生第三计数结果cnt_result_lead,以及对所述第二相位关系标志信号result_lagg进行计数产生第四计数结果cnt_result_lagg。因为前级的相位结果产生单元3的计数周期是Y=16,即意味着result_lead和result_lagg是每隔16个clk_in它们其中之一会有效一次,代表的是在此时延迟单元个数下clk_out和clk_in的相位关系,所以对result_lead、result_lagg进行计数其实就是16个clk_in计数一次。The phase result counting unit 4 is used to count the first phase relationship flag signal result_lead to generate a third counting result cnt_result_lead, and to count the second phase relationship flag signal result_lagg to generate a fourth counting result cnt_result_lagg. Because the counting cycle of the phase result generating unit 3 of the previous stage is Y=16, it means that one of result_lead and result_lagg will be valid once every 16 clk_in, representing the phase relationship between clk_out and clk_in under the number of delay units at this time, so counting result_lead and result_lagg is actually counting once every 16 clk_in.

其中,相位结果输出单元5用于根据率先到达N的是第三计数结果cnt_result_lead或是第四计数结果cnt_result_lagg来确定所需要输出的1比特的全局相位鉴相结果pd_out的数值。The phase result output unit 5 is used to determine the value of the 1-bit global phase discrimination result pd_out to be output according to whether the third counting result cnt_result_lead or the fourth counting result cnt_result_lagg reaches N first.

即全局相位鉴相结果pd_out的电平的变化取决于相位结果计数单元4的计数结果,具体来说:当第三计数结果cnt_result_lead率先达到N时将所述全局相位鉴相结果pd_out置第一电平;当第四计数结果cnt_result_lagg率先达到N时将所述全局相位鉴相结果pd_out置第二电平。所述第一电平与所述第二电平相反,比如第一电平为1,第二电平为0。That is, the level change of the global phase detection result pd_out depends on the counting result of the phase result counting unit 4. Specifically, when the third counting result cnt_result_lead reaches N first, the global phase detection result pd_out is set to the first level; when the fourth counting result cnt_result_lagg reaches N first, the global phase detection result pd_out is set to the second level. The first level is opposite to the second level, for example, the first level is 1 and the second level is 0.

全局相位鉴相结果pd_out的默认初始值是第二电平,pd_out由第二电平变为第一电平,再由第一电平变为第二电平,则代表此时锁相成功,此时延迟单元的个数减去N即为锁相成功时延迟单元的个数,DLL可以输出此数值作为其他相关电路的输入。The default initial value of the global phase detection result pd_out is the second level. When pd_out changes from the second level to the first level and then from the first level to the second level, it means that the phase lock is successful. At this time, the number of delay units minus N is the number of delay units when the phase lock is successful. The DLL can output this value as the input of other related circuits.

这里N为正整数,所述N的取值需满足:所述数字控制延迟链中的N个延迟单元的延时大于触发器的亚稳态时长,比如本实施例中根据触发器的亚稳态窗口大小(取决于器件工艺)结合单个延迟单元的延迟时间确定N取3。此设计可保证当锁相时不会因亚稳态导致相位关系被提前错误的改变,提高了延迟单元选择的准确度。Here, N is a positive integer, and the value of N must satisfy: the delay of the N delay units in the digital control delay chain is greater than the metastable duration of the trigger. For example, in this embodiment, N is determined to be 3 based on the metastable window size of the trigger (depending on the device process) combined with the delay time of a single delay unit. This design can ensure that the phase relationship will not be erroneously changed in advance due to the metastable state when phase locking is performed, thereby improving the accuracy of delay unit selection.

由于采用全数字电路设计,相比传统鉴相器,该设计通过对输入时钟clk_in(经过固定延时的系统时钟)和输出时钟clk_out(经过数字控制延迟链的系统时钟)相互采样,独立计数,比较计数结果的方法产生唯一的相位关系,即输出时钟clk_out较输入时钟clk_in的超前或滞后。当处于亚稳态区间时,本发明的鉴相器可以通过对D触发器决断时间后不确定的值多次统计,输出在概率上较大的结果,可以明显减少传统D触发器存在的亚稳态现象导致锁相过早或过晚的现象,此外也避免了输出时钟clk_out可能产生的毛刺导致的相位关系不明确问题。该发明保证了时序的安全,增加了鉴相的准确性,利于数字集成,可满足不同温度下对高精度相位选择的需求。Due to the adoption of a fully digital circuit design, compared to the traditional phase detector, this design generates a unique phase relationship by sampling the input clock clk_in (system clock after a fixed delay) and the output clock clk_out (system clock after a digitally controlled delay chain), counting independently, and comparing the counting results, that is, the output clock clk_out is ahead of or behind the input clock clk_in. When in the metastable interval, the phase detector of the present invention can output a result with a greater probability by repeatedly counting the uncertain values after the D flip-flop decision time, which can significantly reduce the phenomenon of premature or late phase locking caused by the metastable phenomenon of the traditional D flip-flop, and also avoid the problem of unclear phase relationship caused by the burrs that may be generated by the output clock clk_out. The invention ensures the safety of the timing, increases the accuracy of the phase detector, is conducive to digital integration, and can meet the needs of high-precision phase selection at different temperatures.

下面对所述控制器进行简单介绍,参考图4,控制器主要包括状态机模块、分频计数电路。状态机有4种状态转移逻辑,分别是前180度、后180度、锁相完成以及空闲状态,它输出8位的相位选择信号以及锁相完成标志信号。相位选择信号为0到255递增的值,输出至DCDL来选择延迟单元个数。DCDL是由缓冲器组成的延迟单元并串联为延迟链,延迟单元个数的选择是由255个多路选择器来完成,同时DCDL集成了固定延时链来接入系统时钟、输出输入时钟clk_in,从而匹配输出时钟clk_out经过多路选择器产生的额外延时。The controller is briefly introduced below. Referring to Figure 4, the controller mainly includes a state machine module and a frequency division counting circuit. The state machine has four state transfer logics, namely the front 180 degrees, the back 180 degrees, the phase lock completion and the idle state. It outputs an 8-bit phase selection signal and a phase lock completion flag signal. The phase selection signal is an increasing value from 0 to 255, which is output to DCDL to select the number of delay units. DCDL is a delay unit composed of buffers and connected in series as a delay chain. The selection of the number of delay units is completed by 255 multiplexers. At the same time, DCDL integrates a fixed delay chain to access the system clock and output the input clock clk_in, thereby matching the additional delay generated by the output clock clk_out through the multiplexer.

分频计数电路,用于对所述输入时钟clk_in进行Y分频产生分频时钟信号clk_div(产生clk_div时需要cnt_div来计数),将所述分频时钟信号clk_div输出至状态机模块驱动状态的转移,同时对所述输入时钟clk_in进行计数并将计数值cnt_div输出到所述数字鉴相器以便产生第一采样标志信号sampl_flag以及采样复位信号reset_sampl。The frequency division counting circuit is used to perform Y-division on the input clock clk_in to generate a divided clock signal clk_div (cnt_div is required to count when generating clk_div), output the divided clock signal clk_div to the state machine module to drive the state transfer, and at the same time count the input clock clk_in and output the count value cnt_div to the digital phase detector to generate a first sampling flag signal sampl_flag and a sampling reset signal reset_sampl.

状态机模块,包含IDLE、LF1、INC、DEC 4个状态,IDLE为空闲状态,LF1状态为输出时钟clk_out相对于输入时钟clk_in相位差0°—180°,INC状态为输出时钟clk_out相对于输入时钟clk_in相位差180°—360°,DEC状态代表锁相完成,其中:当开启所述分频计数后(即每一次cnt_div=1时)进入LF1状态,目标计数值cnt_inc自加;LF1状态跳转INC状态的条件是所述全局相位鉴相结果pd_out为第一电平,本实施例即为1;INC状态跳到DEC状态的条件是所述全局相位鉴相结果pd_out变到为第二电平,本实施例即为0。当进入DEC状态时,cnt_inc此时已经按照鉴相器的逻辑自加到超出锁相需要的延迟单元3个,所以目标计数值cnt_inc减N作为所述数字控制延迟链中需要启用的延迟单元的数量,同时锁相完成标志位Result_valid会置位以代表锁相完成。这里需要注意的是,需要启用的延迟单元的数量是十进制数值,需要转换为8位的二进制数,该8位的二进制数即相位选择信号Cnt_inc[7:0],信号Cnt_inc[7:0]对应控制255个多路选择器间接选出256级不同的延时。The state machine module includes four states: IDLE, LF1, INC, and DEC. IDLE is an idle state. The LF1 state is a state in which the phase difference between the output clock clk_out and the input clock clk_in is 0°-180°. The INC state is a state in which the phase difference between the output clock clk_out and the input clock clk_in is 180°-360°. The DEC state represents phase lock completion, wherein: when the frequency division count is turned on (i.e., each time cnt_div=1), the LF1 state is entered, and the target count value cnt_inc is self-incremented; the condition for the LF1 state to jump to the INC state is that the global phase detection result pd_out is the first level, which is 1 in this embodiment; the condition for the INC state to jump to the DEC state is that the global phase detection result pd_out changes to the second level, which is 0 in this embodiment. When entering the DEC state, cnt_inc has been added to the three delay units that exceed the phase lock requirement according to the logic of the phase detector, so the target count value cnt_inc minus N is used as the number of delay units that need to be enabled in the digital control delay chain, and the phase lock completion flag Result_valid will be set to represent the completion of the phase lock. It should be noted here that the number of delay units that need to be enabled is a decimal value and needs to be converted into an 8-bit binary number, which is the phase selection signal Cnt_inc[7:0]. The signal Cnt_inc[7:0] corresponds to controlling 255 multiplexers to indirectly select 256 different delays.

通过上述设计,本实施例极大的保证了数字电路时序的安全,消除了DLL中异步电路造成的毛刺、显著降低了亚稳态对相位结果的影响,对有高精度、多相位需求的DLL设计有重要的意义。Through the above design, this embodiment greatly ensures the safety of digital circuit timing, eliminates the glitches caused by asynchronous circuits in the DLL, and significantly reduces the impact of metastable states on phase results, which is of great significance for the design of DLLs with high precision and multi-phase requirements.

除非另有定义,本文所使用的所有的技术和科学术语与属于本发明的技术领域的技术人员通常理解的含义相同。本文中在本发明的说明书中所使用的术语只是为了描述具体的实施例的目的,不是旨在于限制本发明。Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art of the present invention. The terms used in the specification of the present invention herein are only for the purpose of describing specific embodiments and are not intended to limit the present invention.

本说明书中使用的“第一”、“第二”等包含序数的术语可用于说明各种构成要素,但是这些构成要素不受这些术语的限定。使用这些术语的目的仅在于将一个构成要素区别于其他构成要素。例如,在不脱离本发明的权利范围的前提下,第一构成要素可被命名为第二构成要素,类似地,第二构成要素也可以被命名为第一构成要素。Terms including ordinal numbers such as "first" and "second" used in this specification may be used to describe various components, but these components are not limited by these terms. The purpose of using these terms is only to distinguish one component from other components. For example, without departing from the scope of the present invention, the first component may be named as the second component, and similarly, the second component may also be named as the first component.

上面结合附图对本发明的实施例进行了描述,但是本发明并不局限于上述的具体实施方式,上述的具体实施方式仅仅是示意性的,而不是限制性的,本领域的普通技术人员在本发明的启示下,在不脱离本发明宗旨和权利要求所保护的范围情况下,还可做出很多形式,这些均属于本发明的保护之内。The embodiments of the present invention are described above in conjunction with the accompanying drawings, but the present invention is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the enlightenment of the present invention, ordinary technicians in this field can also make many forms without departing from the scope of protection of the purpose of the present invention and the claims, which all fall within the protection of the present invention.

Claims (10)

1.一种数字鉴相器,其特征在于,包括:1. A digital phase detector, comprising: 相位关系产生单元(1),用于接收输入时钟(clk_in)和数字控制延迟链输出的输出时钟(clk_out),对所述输入时钟(clk_in)和输出时钟(clk_out)相互采样,产生代表所述输出时钟(clk_out)相对所述输入时钟(clk_in)的是否超前的第一初始相位关系信号(clk_out_leading)以及是否滞后的第二初始相位关系信号(clk_out_lagging);A phase relationship generating unit (1) is used for receiving an input clock (clk_in) and an output clock (clk_out) output by a digitally controlled delay chain, sampling the input clock (clk_in) and the output clock (clk_out) to generate a first initial phase relationship signal (clk_out_leading) indicating whether the output clock (clk_out) is leading relative to the input clock (clk_in) and a second initial phase relationship signal (clk_out_lagging) indicating whether the output clock (clk_out) is lagging relative to the input clock (clk_in); 相位关系计数单元(2),用于对所述第一初始相位关系信号(clk_out_leading)进行计数产生第一计数结果(cnt_sampl_lead),以及对所述第二初始相位关系信号(clk_out_lagging)进行计数产生第二计数结果(cnt_sampl_lagg);A phase relationship counting unit (2), used for counting the first initial phase relationship signal (clk_out_leading) to generate a first counting result (cnt_sampl_lead), and for counting the second initial phase relationship signal (clk_out_lagging) to generate a second counting result (cnt_sampl_lagg); 相位结果产生单元(3),用于比较在计数时间持续了多个计数周期时的所述第一计数结果(cnt_sampl_lead)和所述第二计数结果(cnt_sampl_lagg),产生代表所述输出时钟(clk_out)相对所述输入时钟(clk_in)的是否超前的第一相位关系标志信号(result_lead)以及是否滞后的第二相位关系标志信号(result_lagg);A phase result generating unit (3) is used to compare the first counting result (cnt_sampl_lead) and the second counting result (cnt_sampl_lagg) when the counting time lasts for a plurality of counting cycles, and to generate a first phase relationship flag signal (result_lead) indicating whether the output clock (clk_out) is ahead of the input clock (clk_in) and a second phase relationship flag signal (result_lagg) indicating whether the output clock (clk_out) is behind; 相位结果计数单元(4),用于对所述第一相位关系标志信号(result_lead)进行计数产生第三计数结果(cnt_result_lead),以及对所述第二相位关系标志信号(result_lagg)进行计数产生第四计数结果(cnt_result_lagg);A phase result counting unit (4), used for counting the first phase relationship flag signal (result_lead) to generate a third counting result (cnt_result_lead), and for counting the second phase relationship flag signal (result_lagg) to generate a fourth counting result (cnt_result_lagg); 相位结果输出单元(5),用于根据率先到达N的是第三计数结果(cnt_result_lead)或是第四计数结果(cnt_result_lagg)来确定所需要输出的1比特的全局相位鉴相结果(pd_out)的数值,N为正整数。The phase result output unit (5) is used to determine the value of the 1-bit global phase discrimination result (pd_out) to be output according to whether the third counting result (cnt_result_lead) or the fourth counting result (cnt_result_lagg) reaches N first, where N is a positive integer. 2.根据权利要求1所述的数字鉴相器,其特征在于,所述相位关系产生单元(1)是基于触发器实现,所述N的取值需满足:所述数字控制延迟链中的N个延迟单元的延时大于触发器的亚稳态时长。2. The digital phase detector according to claim 1 is characterized in that the phase relationship generating unit (1) is implemented based on a trigger, and the value of N must satisfy: the delay of the N delay units in the digitally controlled delay chain is greater than the metastable duration of the trigger. 3.根据权利要求1所述的数字鉴相器,其特征在于,所述输入时钟(clk_in)是经过固定延时的系统时钟,所述输出时钟(clk_out)是经过数字控制延迟链的系统时钟。3. The digital phase detector according to claim 1, characterized in that the input clock (clk_in) is a system clock that has passed a fixed delay, and the output clock (clk_out) is a system clock that has passed a digitally controlled delay chain. 4.根据权利要求1所述的数字鉴相器,其特征在于,所述的相位结果输出单元(5)具体是在第三计数结果(cnt_result_lead)率先达到N时将所述全局相位鉴相结果(pd_out)置第一电平,在第四计数结果(cnt_result_lagg)率先达到N时将所述全局相位鉴相结果(pd_out)置第二电平,所述第一电平与所述第二电平相反。4. The digital phase detector according to claim 1 is characterized in that the phase result output unit (5) specifically sets the global phase detection result (pd_out) to a first level when the third counting result (cnt_result_lead) first reaches N, and sets the global phase detection result (pd_out) to a second level when the fourth counting result (cnt_result_lagg) first reaches N, and the first level is opposite to the second level. 5.根据权利要求1所述的数字鉴相器,其特征在于,所述相位关系计数单元(2)具体包括:5. The digital phase detector according to claim 1, characterized in that the phase relationship counting unit (2) specifically comprises: 超前计数模块(21),用于对所述第一初始相位关系信号(clk_out_leading)进行计数产生第一计数结果(cnt_sampl_lead),以及在接收到的第一采样标志信号(sampl_flag)有效时保持所述第一计数结果(cnt_sampl_lead),在接收到的采样复位信号(reset_sampl)有效时将第一计数结果(cnt_sampl_lead)清零;A leading counting module (21) is used for counting the first initial phase relationship signal (clk_out_leading) to generate a first counting result (cnt_sampl_lead), and maintaining the first counting result (cnt_sampl_lead) when the received first sampling flag signal (sampl_flag) is valid, and clearing the first counting result (cnt_sampl_lead) to zero when the received sampling reset signal (reset_sampl) is valid; 滞后计数模块(22),用于对所述第二初始相位关系信号(clk_out_lagging)进行计数产生第二计数结果(cnt_sampl_lagg),以及在接收到第二采样标志信号(sampl_flag_clkout)时保持所述第二计数结果(cnt_sampl_lagg),在接收到的所述采样复位信号(reset_sampl)有效时将第二计数结果(cnt_sampl_lagg)清零;A hysteresis counting module (22), configured to count the second initial phase relationship signal (clk_out_lagging) to generate a second counting result (cnt_sampl_lagg), maintain the second counting result (cnt_sampl_lagg) when a second sampling flag signal (sampl_flag_clkout) is received, and clear the second counting result (cnt_sampl_lagg) when the received sampling reset signal (reset_sampl) is valid; 同步模块(23),用于将所述第一采样标志信号(sampl_flag)同步到所述输出时钟(clk_out)的时域下作为所述第二采样标志信号(sampl_flag_clkout),以及将所述滞后计数模块(22)输出的所述第二计数结果(cnt_sampl_lagg)同步到所述输入时钟(clk_in)的时域后输出。The synchronization module (23) is used to synchronize the first sampling flag signal (sampl_flag) to the time domain of the output clock (clk_out) as the second sampling flag signal (sampl_flag_clkout), and synchronize the second counting result (cnt_sampl_lagg) output by the lag counting module (22) to the time domain of the input clock (clk_in) and then output it. 6.根据权利要求5所述的数字鉴相器,其特征在于,6. The digital phase detector according to claim 5, characterized in that: 所述同步模块(23)具体用于在响应信号无效时将接入的所述第一采样标志信号(sampl_flag)通过所述输出时钟(clk_out)下的M个D触发器产生所述第二采样标志信号(sampl_flag_clkout),并将所述第二采样标志信号(sampl_flag_clkout)通过所述输入时钟(clk_in)下的M个D触发器同步至所述输入时钟(clk_in)的时钟域作为数据请求信号;所述滞后计数模块(22)仅在所述请求信号有效时才将所保持的所述第二计数结果(cnt_sampl_lagg)同步到所述同步模块(23)进行输出;The synchronization module (23) is specifically used for generating the second sampling flag signal (sampl_flag_clkout) from the first sampling flag signal (sampl_flag) received through the M D flip-flops under the output clock (clk_out) when the response signal is invalid, and synchronizing the second sampling flag signal (sampl_flag_clkout) to the clock domain of the input clock (clk_in) as a data request signal through the M D flip-flops under the input clock (clk_in); the lag counting module (22) synchronizes the maintained second counting result (cnt_sampl_lagg) to the synchronization module (23) for output only when the request signal is valid; 所述同步模块(23)还用于将所述数据请求信号通过所述输出时钟(clk_out)下的M个D触发器后产生响应信号,当所述响应信号有效时将所述第二采样标志信号(sampl_flag_clkout)置位无效,否则接入所述第一采样标志信号(sampl_flag)。The synchronization module (23) is also used for generating a response signal after the data request signal passes through the M D flip-flops under the output clock (clk_out); when the response signal is valid, the second sampling flag signal (sampl_flag_clkout) is set to be invalid; otherwise, the first sampling flag signal (sampl_flag) is connected. 7.根据权利要求5所述的数字鉴相器,其特征在于,还包括:7. The digital phase detector according to claim 5, further comprising: 采样控制单元(6),用于接收所述输入时钟(clk_in)的计数值(cnt_div),当所述计数值(cnt_div)到达Y时将所述第一采样标志信号(sampl_flag)以及所述采样复位信号(reset_sampl)先后置有效。The sampling control unit (6) is used to receive the count value (cnt_div) of the input clock (clk_in), and when the count value (cnt_div) reaches Y, the first sampling flag signal (sampl_flag) and the sampling reset signal (reset_sampl) are successively enabled. 8.根据权利要求1所述的数字鉴相器,其特征在于,所述相位关系产生单元(1)包括第一触发器和第二触发器;所述第一触发器的时钟端接入所述输入时钟(clk_in),所述第一触发器的D端接入所述输出时钟(clk_out),所述第一触发器的Q端输出所述第一初始相位关系信号(clk_out_leading);所述第二触发器的时钟端接入所述输出时钟(clk_out),所述第二触发器的D端接入所述输入时钟(clk_in),所述第二触发器的Q端输出所述第二初始相位关系信号(clk_out_lagging)。8. The digital phase detector according to claim 1 is characterized in that the phase relationship generating unit (1) comprises a first trigger and a second trigger; the clock end of the first trigger is connected to the input clock (clk_in), the D end of the first trigger is connected to the output clock (clk_out), and the Q end of the first trigger outputs the first initial phase relationship signal (clk_out_leading); the clock end of the second trigger is connected to the output clock (clk_out), the D end of the second trigger is connected to the input clock (clk_in), and the Q end of the second trigger outputs the second initial phase relationship signal (clk_out_lagging). 9.一种数字延迟锁相环,其特征在于,包括如权利要求1-8任一项所述的数字鉴相器、控制器和数字控制延迟链;所述控制器用于接收所述全局相位鉴相结果(pd_out),根据所述全局相位鉴相结果(pd_out)调整所述数字控制延迟链中启用的延迟单元的数量。9. A digital delay locked loop, characterized in that it comprises a digital phase detector, a controller and a digital controlled delay chain as described in any one of claims 1 to 8; the controller is used to receive the global phase detection result (pd_out) and adjust the number of delay units enabled in the digital controlled delay chain according to the global phase detection result (pd_out). 10.根据权利要求9所述的数字延迟锁相环,其特征在于,所述控制器包括:10. The digital delay locked loop according to claim 9, wherein the controller comprises: 分频计数电路,用于对所述输入时钟(clk_in)进行Y分频产生分频时钟信号(clk_div),将所述分频时钟信号(clk_div)输出至状态机模块驱动状态的转移,同时对所述输入时钟(clk_in)进行计数并将计数值(cnt_div)输出到所述数字鉴相器以便产生第一采样标志信号(sampl_flag)以及采样复位信号(reset_sampl);A frequency division counting circuit, used for performing Y-frequency division on the input clock (clk_in) to generate a frequency division clock signal (clk_div), outputting the frequency division clock signal (clk_div) to the state machine module to drive the state transfer, and at the same time counting the input clock (clk_in) and outputting the count value (cnt_div) to the digital phase detector to generate a first sampling flag signal (sampl_flag) and a sampling reset signal (reset_sampl); 状态机模块,包含IDLE、LF1、INC、DEC4个状态,IDLE为空闲状态,LF1状态为输出时钟(clk_out)相对于输入时钟(clk_in)相位差0°—180°,INC状态为输出时钟(clk_out)相对于输入时钟(clk_in)相位差180°—360°,DEC状态代表锁相完成,其中:当开启所述分频计数后进入LF1状态,目标计数值(cnt_inc)自加;LF1状态跳转INC状态的条件是所述全局相位鉴相结果(pd_out)为第一电平;INC状态跳到DEC状态的条件是所述全局相位鉴相结果(pd_out)变到第二电平;当进入DEC状态时,所述目标计数值(cnt_inc)减N作为所述数字控制延迟链中需要启用的延迟单元的数量,同时锁相完成标志位(Result_valid)会置位以代表锁相完成。The state machine module includes four states: IDLE, LF1, INC, and DEC. IDLE is an idle state. The LF1 state is a phase difference of 0°-180° between the output clock (clk_out) and the input clock (clk_in). The INC state is a phase difference of 180°-360° between the output clock (clk_out) and the input clock (clk_in). The DEC state represents phase lock completion, wherein: when the frequency division count is turned on and the LF1 state is entered, the target count value (cnt_inc) is self-incremented; the condition for the LF1 state to jump to the INC state is that the global phase detection result (pd_out) is the first level; the condition for the INC state to jump to the DEC state is that the global phase detection result (pd_out) changes to the second level; when entering the DEC state, the target count value (cnt_inc) minus N is used as the number of delay units that need to be enabled in the digital control delay chain, and the phase lock completion flag (Result_valid) is set to represent the completion of phase lock.
CN202410857384.2A 2024-06-28 2024-06-28 A digital phase detector and a digital delay locked loop Pending CN118694359A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202410857384.2A CN118694359A (en) 2024-06-28 2024-06-28 A digital phase detector and a digital delay locked loop

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202410857384.2A CN118694359A (en) 2024-06-28 2024-06-28 A digital phase detector and a digital delay locked loop

Publications (1)

Publication Number Publication Date
CN118694359A true CN118694359A (en) 2024-09-24

Family

ID=92771801

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202410857384.2A Pending CN118694359A (en) 2024-06-28 2024-06-28 A digital phase detector and a digital delay locked loop

Country Status (1)

Country Link
CN (1) CN118694359A (en)

Similar Documents

Publication Publication Date Title
US5633899A (en) Phase locked loop for high speed data capture of a serial data stream
US8315349B2 (en) Bang-bang phase detector with sub-rate clock
US6239627B1 (en) Clock multiplier using nonoverlapping clock pulses for waveform generation
EP1441443A2 (en) Digital phase locked loop circuitry and methods
US7676014B2 (en) Digital lock detector for phase-locked loop
US6577694B1 (en) Binary self-correcting phase detector for clock and data recovery
US8594264B1 (en) Phase detection and aligned signal selection with multiple phases of clocks
US6795514B2 (en) Integrated data clock extractor
JP4220320B2 (en) Semiconductor integrated circuit device
CN101494457A (en) Delay locked loop circuit and method for eliminating jitter and offset between signals
JP4533715B2 (en) Phase comparator
CN1193847A (en) High-frequency fully digital phase-locked loop
JP2014222872A (en) System and method for tracking received data signal with clock data recovery circuit
JP2000323984A (en) Pll circuit
JP2004120433A (en) Phase-locked loop circuit
US7095259B2 (en) Reducing metastable-induced errors from a frequency detector that is used in a phase-locked loop
CN111446957B (en) Multi-PLL parallel output clock synchronization system and working method thereof
JP3617456B2 (en) PLL circuit and optical communication receiver
CN118694359A (en) A digital phase detector and a digital delay locked loop
US7023944B2 (en) Method and circuit for glitch-free changing of clocks having different phases
US6380776B1 (en) Electrical signal synchronization
JP2008541685A (en) Arrival time synchronization loop
JP2014225874A (en) System and method for obtaining reception data signal with clock data recovery circuit
JP2004128980A (en) Data recovery circuit and method therefor
JP2015100017A (en) Phase comparison circuit and clock data recovery circuit

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination