Clock cycle detection method, device, electronic device and storage medium
By using clock cycle detection circuits in high-speed large-scale application-specific integrated circuits, including phase interpolator, frequency phase detector and delay chain, to detect input clock cycles, the detection difficulties in the prior art are solved and efficient Clock cycle detection enhances chip compatibility and flexibility.
Patent Information
- Application Number
- CN202411148066.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-21
- Publication Date
- 2024-11-08
- Estimated Expiration
- 2044-08-21
AI Technical Summary
In high-speed large-scale application-specific integrated circuit design, the prior art is difficult to accurately detect the cycle of the input clock when the host power-on process is solidified and cannot be modified, resulting in an increase in chip area, an increase in startup time and a decrease in compatibility.
The clock cycle detection circuit is adopted, including a phase interpolator, frequency phase detector and delay chain. By outputting control code and delay code, the phase clock and delay clock are adjusted until the alignment signal is received, and the period of the input clock is determined. Multiplex the multiple phase clocks output by the phase-locked loop and independently control the clock frequency.
It realizes that when the host power-on process is solidified, the input clock cycle is accurately detected, the chip absolute delay requirements are met, the chip compatibility is enhanced, the area overhead is reduced, and the clock adjustment flexibility is improved.
Smart Images

Figure CN118677453B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of integrated circuit technology, and in particular to a clock cycle detection method, device, electronic equipment and storage medium. Background Art
[0002] In the design of high-speed large-scale application specific integrated circuits (ASIC), a phase-locked loop (PLL) is usually used to re-lock the input clock to improve the signal quality of the input clock. In a chip containing a phase-locked loop, the clock output by the phase-locked loop is usually used as the input clock for subsequent data processing. After the data processing is completed, the chip outputs the target data and the corresponding target clock. If the target data and target clock output by the chip are required to have an absolute delay relative to the input data, it is necessary to achieve the absolute delay of the input data and input clock through circuit design under the premise of knowing the input clock cycle.
[0003] In order to obtain the cycle of the input clock, the prior art usually adds a register and a configuration interface inside the chip. The external host configures the register inside the chip through the configuration interface to send the period or frequency of the current input clock to the chip. However, this method increases the area of the chip due to the addition of a register inside the chip. In addition, when the host configures the register through the configuration interface, it will consume a certain amount of time, which may result in failure to meet the host's requirements for the chip startup time. In addition, the host directly sends the input clock cycle information to the chip, which requires additional host startup procedures, which may cause incompatibility with other host chips and reduce the versatility of the chip.
[0004] Based on this, a clock cycle detection method is urgently needed to ensure that the cycle of the chip input clock is detected under the premise that the host power-on process is fixed and cannot be modified, so as to meet the situation where there is an absolute delay requirement for the chip. Summary of the invention
[0005] The object of the present invention is to provide a clock cycle detection method, device, electronic device and storage medium to ensure that the cycle of the input clock is obtained under the premise that the power-on process of the host is solidified and cannot be modified.
[0006] To achieve the above purpose, the technical solution adopted by the present invention is as follows:
[0007] In a first aspect, the present invention provides a clock cycle detection method, which is applied to a controller in a clock cycle detection circuit, wherein the clock cycle detection circuit further comprises: a delay chain, a phase interpolator and a phase frequency detector; the controller is connected to the phase interpolator, the phase frequency detector and the delay chain respectively, the delay chain is also connected to the phase frequency detector and the phase locked loop, and the phase interpolator is also connected to the phase frequency detector and the phase locked loop; wherein the phase locked loop is used to output a multi-channel phase clock with the same frequency as the input clock;
[0008] The clock cycle detection method comprises the following steps:
[0009] Output a first control code and a first delay code, so that the phase interpolator outputs a first phase clock according to the first control code, and the delay chain outputs a first delayed clock according to the first delay code; wherein the input clock of the delay chain multiplexes the 0° phase clock in the multi-channel phase clock;
[0010] If the first edge-to-edge alignment signal is not received, the first control code is subjected to an accumulation adjustment code operation until the second edge-to-edge alignment signal is received, and a second control code is output; wherein the phase interpolator outputs a second phase clock according to the second control code; the first edge-to-edge alignment signal indicates that the rising edge of the first phase clock is aligned with the rising edge of the first delayed clock, or the falling edge of the first phase clock is aligned with the rising edge of the first delayed clock; the second edge-to-edge alignment signal indicates that the rising edge of the second phase clock is aligned with the rising edge of the first delayed clock, or the falling edge of the second phase clock is aligned with the rising edge of the first delayed clock;
[0011] Adjust the second control code and the first delay code, or only adjust the first delay code, until a third edge-to-edge alignment signal is received, and a second delay code is output;
[0012] A period of the input clock is determined based on the second delay code.
[0013] Optionally, the adjustment code is a code corresponding to a preset accuracy threshold; wherein the preset accuracy threshold is determined by the number of phases of the multi-channel phase clock and the bit width of the control code.
[0014] Optionally, the step of adjusting only the first delay code until a third edge-to-edge alignment signal is received and outputting a second delay code includes:
[0015] The first delay code is subjected to an operation of accumulating the adjustment code until a fourth edge-to-edge alignment signal is received, and a third delay code is output; wherein the delay chain outputs a third delayed clock according to the third delay code, and the fourth edge-to-edge alignment signal indicates that a rising edge of the second phase clock is aligned with a rising edge of the third delayed clock, or a falling edge of the second phase clock is aligned with a rising edge of the third delayed clock;
[0016] The third delay code is accumulated with the adjustment code operation until the third edge-to-edge alignment signal is received, and the second delay code is output; wherein the delay chain outputs a second delay clock according to the second delay code, and the third edge-to-edge alignment signal indicates that the rising edge of the second phase clock is aligned with the rising edge of the second delay clock, or the falling edge of the second phase clock is aligned with the rising edge of the second delay clock.
[0017] Optionally, the second delay code includes a second coarse adjustment delay code and a second fine adjustment delay code, and the step of determining the period of the input clock based on the second delay code includes:
[0018] The period of the input clock = the second coarse adjustment delay code*x+the second fine adjustment delay code*y;
[0019] Wherein, x is the delay time of a single coarse adjustment unit in the delay chain, and y is the delay time of a single fine adjustment unit in the delay chain.
[0020] Optionally, the step of adjusting the second control code and the first delay code until a third edge-to-edge alignment signal is received and outputting the second delay code further includes:
[0021] Determine a third control code=second control code+adjustment code, so that the phase interpolator outputs a third phase clock according to the third control code;
[0022] The adjustment code operation is accumulated on the first delay code until the third edge-to-edge alignment signal is received, and the second delay code is output; wherein the delay chain outputs a second delay clock according to the second delay code, and the third edge-to-edge alignment signal indicates that the rising edge of the third phase clock is aligned with the rising edge of the second delay clock, or the falling edge of the third phase clock is aligned with the rising edge of the second delay clock.
[0023] Optionally, the second delay code includes a second coarse adjustment delay code and a second fine adjustment delay code, and the step of determining the period of the input clock based on the second delay code includes:
[0024] The period of the input clock = (the second coarse adjustment delay code * x + the second fine adjustment delay code * y) * (360° / preset accuracy threshold);
[0025] Wherein, x is the delay time of a single coarse adjustment unit in the delay chain, and y is the delay time of a single fine adjustment unit in the delay chain.
[0026] Optionally, the clock cycle detection method further includes:
[0027] If the first edge-to-edge alignment signal is received, a second control code is output; wherein the second control code is a code representing a 0° phase.
[0028] In a second aspect, the present invention further provides a clock cycle detection device, which is used to execute the clock cycle detection method as described in any one of the first aspects above, and the clock cycle detection device includes:
[0029] A sending module, used for outputting a first control code and a first delay code, so that the phase interpolator outputs a first phase clock according to the first control code, and the delay chain outputs a first delayed clock according to the first delay code; wherein the input clock of the delay chain multiplexes the 0° phase clock in the multi-channel phase clock;
[0030] A first adjustment module is used for performing an accumulation adjustment code operation on the first control code when the first edge-to-edge alignment signal is not received, until the second edge-to-edge alignment signal is received, and outputting a second control code; wherein the phase interpolator outputs a second phase clock according to the second control code; the first edge-to-edge alignment signal indicates that the rising edge of the first phase clock is aligned with the rising edge of the first delayed clock, or the falling edge of the first phase clock is aligned with the rising edge of the first delayed clock; the second edge-to-edge alignment signal indicates that the rising edge of the second phase clock is aligned with the rising edge of the first delayed clock, or the falling edge of the second phase clock is aligned with the rising edge of the first delayed clock;
[0031] A second adjustment module, used for adjusting the second control code and the first delay code, or only adjusting the first delay code, until a third edge-to-edge alignment signal is received, and outputting a second delay code;
[0032] A determination module is used to determine the period of the input clock based on the second delay code.
[0033] In a third aspect, the present invention further provides an electronic device, comprising a processor and a memory, wherein the memory stores a program executable by the processor, and the processor can execute the program to implement the clock cycle detection method as described in any one of the first aspects above.
[0034] In a fourth aspect, the present invention further provides a storage medium storing a computer program, wherein the computer program, when executed by a processor, implements the clock cycle detection method as described in any one of the first aspects above.
[0035] Compared with the prior art, the present invention has the following beneficial effects:
[0036] The present invention provides a clock cycle detection method, which is applied to a controller in a clock cycle detection circuit. The controller outputs a first control code and a first delay code, so that a phase interpolator outputs a first phase clock according to the first control code, and a delay chain outputs a first delayed clock according to the first delay code; wherein the input clock of the delay chain multiplexes the 0° phase clock in multiple phase clocks. If the controller does not receive the first edge-to-edge alignment signal, the first control code is cumulatively adjusted until the second edge-to-edge alignment signal is received, and the second control code is output. The controller adjusts the second control code and the first delay code, or only adjusts the first delay code, until the third edge-to-edge alignment signal is received, and the second delay code is output; the period of the input clock is determined based on the second delay code.
[0037] The clock cycle detection method provided by the present invention can meet the situation where there is an absolute delay requirement for the chip. The period of the input clock is obtained through the clock cycle detection circuit, and there is no need to increase the startup process of the host, so that the chip compatibility is enhanced. Since the phase interpolator and the delay chain in the clock cycle detection circuit can be controlled independently, the range of available clock frequencies is increased and the flexibility of clock adjustment is improved. In addition, since the clock cycle detection circuit reuses the multi-channel phase clock output by the phase-locked loop inside the chip, and when the input clock cycle detection is completed, the subsequent absolute delay of the chip can reuse the phase interpolator and the frequency detector in the clock cycle detection circuit, which greatly reduces the area overhead of the chip. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] In order to more clearly illustrate the technical solution of the present invention, the following is a brief introduction to the drawings required for use in the present invention. It should be understood that the following drawings only show certain technical solutions of the present invention and should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0039] Figure 1 A timing diagram of absolute delay for a chip provided by the present invention;
[0040] Figure 2 A schematic diagram of the structure of a clock cycle detection circuit provided by the present invention;
[0041] Figure 3 A schematic diagram of a phase interpolator provided by the present invention;
[0042] Figure 4 A schematic diagram of a first edge-to-edge alignment type provided by the present invention;
[0043] Figure 5 A schematic diagram of a second edge-to-edge alignment type provided by the present invention;
[0044] Figure 6 A flowchart of a clock cycle detection method provided by the present invention;
[0045] Figure 7 One of the schematic diagrams of the phase relationship between a phase clock and a delayed clock provided by the present invention;
[0046] Figure 8 It is one of the sub-step schematic diagrams of step 300 in the present invention;
[0047] Fig. 9 This is the second schematic diagram of the sub-steps of step 300 in the present invention;
[0048] Fig.10 A second schematic diagram of the phase relationship between a phase clock and a delay clock provided by the present invention;
[0049] Fig.11 A schematic structural diagram of a clock cycle detection device provided by the present invention.
[0050] Figure numerals: 10 - clock cycle detection circuit; 20 - phase-locked loop; 110 - phase interpolator; 120 - frequency detector and phase detector; 130 - controller; 140 - delay chain; 201 - sending module; 202 - first regulating module; 203 - second regulating module; 204 - determination module. DETAILED DESCRIPTION
[0051] In order to make the purpose, technical solutions and advantages of the present invention clearer, the technical solutions of the present invention will be clearly and completely described below in conjunction with the drawings in the present invention. Obviously, the described technical solutions are part of the technical solutions of the present invention, but not all of the technical solutions. Generally, the components of the technical solutions of the present invention described and shown in the drawings here can be arranged and designed in various different configurations.
[0052] Therefore, the following detailed description of the technical solutions of the present invention provided in the accompanying drawings is not intended to limit the scope of the invention claimed for protection, but merely represents the selected technical solutions of the present invention. Based on the technical solutions in the present invention, all other technical solutions obtained by ordinary technicians in the field without creative work are within the scope of protection of the present invention.
[0053] In the description of the present invention, terms such as “first”, “second”, etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.
[0054] It should be noted that, in the absence of conflict, the features of the present invention can be combined with each other.
[0055] See also Figure 1 As described in the background technology, in chip design, the target data and target clock output by the chip are required to have an absolute delay Ta relative to the input data. The absolute delay Ta can be a known delay time specified externally. The absolute delay Ta has no direct relationship with the frequency of the input clock, so the delayed output cannot be simply based on the clock beat.
[0056] The following is an explanation of the entire absolute delay process of the chip:
[0057] First, the input data needs to be converted into internal data after a certain inherent delay Td inside the chip to prepare for the subsequent data delay. Then, the internal data is converted into the target data output after a second absolute delay Ts.
[0058] For a better understanding, combine Figure 1 , assuming that the input data, internal data and target data all include first data data_a, second data data_b, third data data_c and fourth data data_d, then data_a in the internal data lags behind data_a in the input data by Td, data_a in the target data lags behind data_a in the internal data by Ts, and data_a in the target data lags behind data_a in the input data by Ta.
[0059] It should be noted that in circuit design and actual electrical characteristics requirements, Td is often much smaller than Ta. Moreover, when the circuit design is completed, the value of Td is generally equal to the period Tc of x input clocks, and x does not change with the change of the input clock period Tc or the absolute delay Ta. In addition, Td can obtain a relatively accurate value through simulation or circuit design, and the embodiment of the present invention assumes that Td is a known time.
[0060] The second absolute delay Ts can be divided into the delay of n Tc plus the remainder delay Tr, that is, Ta=Td+Ts=Td+nTc+Tr. Among them, the delay of n Tc can be processed by digital circuits, and the value of Tr [0, Tc). Since the absolute delay Ta and the inherent delay Td are both known, the value of the remainder delay Tr can be calculated as long as the period Tc of the input clock is known. Finally, the absolute delay of the chip to the input data and input clock can be realized through circuit design.
[0061] It can be seen that the key to satisfying the absolute delay requirement of the target data and target clock output by the chip relative to the input data is to obtain the period of the input clock.
[0062] In the prior art, in order to obtain the cycle of the input clock, a register and a configuration interface are usually added inside the chip. The host directly transmits the configuration data and the configuration clock related to the input clock cycle information to the register through the configuration interface, and the register then sends the input clock cycle to the absolute delay circuit. The absolute delay circuit can realize the absolute delay of the input data and the input clock according to the cycle of the input clock.
[0063] However, the prior art has the following disadvantages:
[0064] (1) An additional register is required inside the chip to store the frequency or period of the current input clock, which increases the chip area.
[0065] (2) The host configures the registers through the configuration interface, which consumes a certain amount of time and may result in failure to meet the host's requirements for chip startup time.
[0066] (3) The need to add an additional host startup process may cause incompatibility with other host chips, reducing the versatility of the chip.
[0067] In summary, how to obtain the period of the input clock under the premise that the power-on process of the host is fixed and cannot be modified is a technical problem that needs to be solved urgently by those skilled in the art.
[0068] In order to solve the problems existing in the prior art, please refer to Figure 2 The embodiments of the present invention provide a clock cycle detection method, device, electronic device and storage medium, which are applied to the controller 130 in the clock cycle detection circuit 10.
[0069] The clock cycle detection method provided by the present invention reuses the existing phase-locked loop 20 in the chip, and the cycle of the input clock can be detected by adding a clock cycle detection circuit 10 inside the chip. Since the present invention does not need to obtain the cycle information of the current input clock through the host and the register, the problems existing in the prior art are solved.
[0070] As a possible implementation, the clock cycle detection circuit 10 further includes: a delay chain 140, a phase interpolator (PI) 110 and a phase frequency detector (PFD) 120. The controller 130 is respectively connected to the phase interpolator 110, the phase frequency detector 120 and the delay chain 140. The delay chain 140 is also connected to the phase frequency detector 120 and the phase locked loop 20, and the phase interpolator 110 is also connected to the phase frequency detector 120 and the phase locked loop 20.
[0071] The phase-locked loop 20 can output multiple phase clocks according to the input clock, for example, common 4-phase clocks or 8-phase clocks, wherein the frequency of each phase clock is the same as the frequency of the input clock, and the phase differences of the multiple phase clocks are fixed.
[0072] In order to better understand the principle of the present invention, the following description is made by taking the phase-locked loop 20 outputting 8 phase clocks as an example.
[0073] The phase interpolator 110 receives 8 phase clocks as input clocks, and the delay chain 140 multiplexes the 0° phase clock (ie, clk0°) among the 8 phase clocks as input clock. Among them, clk0° has the same period as the input clock of the chip.
[0074] The controller 130 is used to output a control code to the phase interpolator 110 so that the phase interpolator 110 outputs a corresponding phase clock according to the control code. The controller 130 is also used to output a delay code to the delay chain 140 so that the delay chain 140 outputs a corresponding delay clock according to the delay code.
[0075] The phase clock and the delayed clock are used as two input clocks of the phase frequency detector 120. The phase frequency detector 120 is used to detect the phase difference between the phase clock and the delayed clock, and convert the phase difference signal into an edge-to-edge alignment signal and feed it back to the controller 130. The controller 130 adjusts the control code or the delay code according to the edge-to-edge alignment signal until the cycle of the input clock is output, and the entire clock cycle detection circuit 10 stops working.
[0076] Since the present invention relates to the delay chain 140 , in order to better understand the technical solution of the embodiment of the present invention, the working principle of the delay chain 140 is explained below.
[0077] In a possible implementation, the delay chain is composed of a coarse adjustment chain and a fine adjustment chain. The coarse adjustment chain includes a coarse adjustment controller and a plurality of coarse adjustment units, wherein the delay time of each coarse adjustment unit is the same. The coarse adjustment controller receives a coarse adjustment delay code and controls the plurality of coarse adjustment units to perform coarse adjustment delay on the input clock according to the coarse adjustment delay code.
[0078] Accordingly, the fine tuning chain includes a fine tuning controller and a plurality of fine tuning units, wherein the delay time of each fine tuning unit is the same. The fine tuning controller receives a fine tuning delay code and controls the plurality of fine tuning units to perform fine tuning delay on the input clock according to the fine tuning delay code.
[0079] The delay chain can adjust the delay of the received input clock according to the coarse delay code and the fine delay code, thereby outputting a corresponding delayed clock.
[0080] In the embodiment of the present invention, the input clock of the delay chain 140 multiplexes clk0° output by the phase-locked loop 20. The delay code output by the controller 130 includes a coarse adjustment delay code and a fine adjustment delay code. Optionally, the bit width of the coarse adjustment delay code and the fine adjustment delay code are both 3 bits.
[0081] The control code output by the controller 130 includes a high-order control code and a low-order control code, and the high-order control code and the low-order control code together represent the phase of the phase clock output by the phase interpolator 110 .
[0082] The bit width of the high-order control code is determined by the number of phases of the multi-phase clocks. For example, if the phase-locked loop 20 outputs 8-phase clocks, the bit width of the high-order control code is 3 bits. If the phase-locked loop 20 outputs 4-phase clocks, the bit width of the high-order control code is 2 bits.
[0083] It should be noted that the embodiment of the present invention does not limit the number of phases of the multi-channel phase clock and the bit width of the low-bit control code.
[0084] In order to better understand the principle of the phase interpolator 110 outputting the phase clock according to the control code, the following is an example in which the phase-locked loop 20 outputs 8 phase clocks and the controller 130 outputs a 6-bit control code (that is, the width of the high-order control code and the low-order control code are both 3 bits).
[0085] like Figure 3 As shown in the figure, the principle of the phase interpolator can be understood as dividing a circle equally and selecting the clock output of different areas according to the control code. PI_code is the control code, which is a 6-bit binary code. The upper 3 bits of PI_code[5:3] divide the circle equally into 8 first areas, each of which is 45°. The lower 3 bits of PI_code[2:0] divide each first area equally into 8 second areas, each of which is 5.625°. One first area is composed of 8 second areas.
[0086] If the control code PI_code[5:0] is determined, the phase interpolator can output a unique phase clock. For example, if the control code PI_code[5:0]=001001, it means that the high-order control code PI_code[5:3]=001 (i.e. 45°), the low-order control code PI_code[2:0]=001 (i.e. 5.625°), and the phase interpolator 110 outputs a phase clock with a phase of 50.625°.
[0087] It should be noted that 5.625° corresponding to the second region is a preset accuracy threshold of the phase interpolator, that is, the preset accuracy threshold is determined by the number of phases of the multi-channel phase clock and the bit width of the low-bit control code.
[0088] Based on the above explanation, the phase frequency detector 120 outputs an edge-to-edge alignment signal according to the phase clock and the delayed clock.
[0089] As a possible implementation, each time the controller 130 changes the coarse adjustment delay code or the fine adjustment delay code, the rising edge of the phase clock needs to sample the delay clock N times.
[0090] In N sampling times, if the number of high levels (M, N], the rising edge of the phase clock is considered to be a high level for the sampling value of the delayed clock. If the number of high levels is [0, B), then the rising edge of the phase clock is considered to be a low level for the sampling value of the delay clock. If the number of high levels [B, M], it is considered that the phase clock and the delayed clock are edge-to-edge aligned, and the frequency detector 120 outputs an edge-to-edge aligned signal. Wherein, B, M, and N are all positive integers, and 0 B M N.
[0091] It should be noted that there are two types of edge-to-edge alignment. The first type is Figure 4 As shown, the rising edge of the phase clock is aligned with the rising edge of the delay clock. Figure 5 As shown, the rising edge of the phase clock is aligned with the falling edge of the delay clock.
[0092] It can be understood that if the controller 130 receives the edge-to-edge alignment signal, it means that the rising edge of the phase clock is aligned with the rising edge of the delayed clock, or the falling edge of the phase clock is aligned with the rising edge of the delayed clock. If the controller 130 does not receive the edge-to-edge alignment signal, it means that the phase clock and the delayed clock are not edge-to-edge aligned.
[0093] Based on the above description of the principles of each device in the clock cycle detection circuit, please refer to Figure 6The clock cycle detection method provided by the embodiment of the present invention is introduced below. The method is applied to a controller in a clock cycle detection circuit, and the method comprises the following steps:
[0094] Step 100: output a first control code and a first delay code, so that the phase interpolator outputs a first phase clock according to the first control code, and the delay chain outputs a first delayed clock according to the first delay code.
[0095] The input clock of the phase interpolator is a multi-channel phase clock, and the input clock of the delay chain multiplexes the 0° phase clock in the multi-channel phase clock.
[0096] As an optional implementation, the controller determines that both the first control code and the first delay code are codes indicating a 0° phase. Figure 7 As shown, since the input clock of the delay chain multiplexes clk0° in the multi-phase clock, and the first control code and the first delay code are both codes representing the 0° phase, in theory, the first phase clock output by the phase interpolator and the first delay clock output by the delay chain are both at the same frequency and in the same phase as clk0° output by the phase-locked loop.
[0097] However, since the phase interpolator and the delay chain device itself have a fixed delay, it is found in actual operation that the first phase clock and the first delayed clock lag behind clk0°. In addition, the phase difference between the first phase clock and the first delayed clock is uncertain. That is, the first phase clock and the first delayed clock may be aligned along the edge or may not be aligned along the edge.
[0098] In order to determine whether the first phase clock and the first delayed clock are edge-to-edge aligned, it is necessary to judge whether the controller receives a first edge-to-edge alignment signal sent by the phase and frequency detector.
[0099] Step 200: If the first edge-to-edge alignment signal is not received, perform an accumulation adjustment code operation on the first control code until the second edge-to-edge alignment signal is received, and output a second control code.
[0100] As a possible implementation, if the controller does not receive the first edge-to-edge alignment signal sent by the phase frequency detector, it means that the first phase clock and the first delayed clock are not edge-to-edge aligned.
[0101] In order to align the first phase clock with the first delayed clock edge to edge, the first phase clock needs to be continuously moved backward according to the preset accuracy threshold of the phase interpolator until the adjusted first phase clock is aligned with the first delayed clock edge to edge.
[0102] The specific adjustment process is: the controller performs an accumulation adjustment code operation on the first control code to make the first phase clock continuously move backward according to the preset accuracy threshold until the controller receives the second edge-to-edge alignment signal and outputs the second control code.
[0103] It should be noted that the adjustment code is the code corresponding to the preset accuracy threshold, and the preset accuracy threshold is determined by the number of phases of the multi-phase clock and the bit width of the control code, that is, the preset accuracy threshold can be adjusted arbitrarily. Since this embodiment uses 8-phase clocks and 6-bit control codes, the high-order control code is 3 bits, the low-order control code is 3 bits, and the preset accuracy threshold = (360° / 2^3) / 2^3 = 5.625°.
[0104] The phase interpolator 110 outputs the second phase clock according to the second control code. The second edge-to-edge alignment signal indicates that the rising edge of the second phase clock is aligned with the rising edge of the first delayed clock, or the falling edge of the second phase clock is aligned with the rising edge of the first delayed clock.
[0105] It can be understood that the second phase clock is the clock obtained when the first phase clock is moved backward according to the preset accuracy threshold until it is aligned with the edge of the first delayed clock.
[0106] As another possible implementation, if the controller receives the first edge-to-edge alignment signal, it indicates that the first phase clock and the first delayed clock are edge-to-edge aligned. The controller outputs a second control code, and the second control code is a code representing a 0° phase.
[0107] It should be noted that the second control code output by the controller after receiving the first edge-to-edge alignment signal is actually the same as the first control code, both of which are codes representing the 0° phase. This is equivalent to the controller not adjusting the first phase clock, and the first phase clock at this time is equivalent to the second phase clock.
[0108] Step 300: Adjust the second control code and the first delay code, or only adjust the first delay code, until a third edge-to-edge alignment signal is received, and output a second delay code.
[0109] Step 400: Determine the period of the input clock based on the second delay code.
[0110] In order to obtain the period of the input clock, the embodiment of the present invention provides two solutions. Figure 7 and Figure 8 , in step 300, only the first delay code is adjusted until the third edge-to-edge alignment signal is received and the second delay code is output, and the following is explained:
[0111] Step 311: perform a cumulative adjustment code operation on the first delay code until a fourth edge-to-edge alignment signal is received, and output a third delay code.
[0112] Among them, the phase interpolator outputs a third delayed clock according to the third delay code, and the fourth edge-to-edge alignment signal indicates that the rising edge of the second phase clock is aligned with the rising edge of the third delayed clock, or the falling edge of the second phase clock is aligned with the rising edge of the third delayed clock.
[0113] like Figure 7 As shown, when the second phase clock and the first delayed clock are edge-to-edge aligned, the controller performs an accumulation adjustment code operation on the first delay code. When the controller receives the fourth edge-to-edge alignment signal and outputs the third delay code, it indicates that the third delayed clock output by the delay chain according to the third delay code is edge-to-edge aligned with the second phase clock. And, at this time, the phase difference between the third delayed clock and the first delayed clock is 180°.
[0114] Step 312: perform a cumulative adjustment code operation on the third delay code until a third edge-to-edge alignment signal is received, and output a second delay code.
[0115] Among them, the phase interpolator outputs a second delayed clock according to the second delay code, and the third edge-to-edge alignment signal indicates that the rising edge of the second phase clock is aligned with the rising edge of the second delayed clock, or the falling edge of the second phase clock is aligned with the rising edge of the second delayed clock.
[0116] When the second phase clock and the third delayed clock are aligned edge to edge, the controller performs an accumulation adjustment code operation on the third delay code. When the controller receives the third edge to edge alignment signal and outputs the second delay code, it indicates that the second delayed clock output by the delay chain according to the second delay code is aligned edge to edge with the second phase clock. And, at this time, the phase difference between the second delayed clock and the first delayed clock is 360°.
[0117] The second delay code is obtained by the above method, wherein the second delay code includes a second coarse adjustment delay code and a second fine adjustment delay code. The method of determining the period of the input clock based on the second delay code in step 400 includes:
[0118] The period of the input clock = the second coarse adjustment delay code*x+the second fine adjustment delay code*y.
[0119] Wherein, x is the delay time of a single coarse adjustment unit in the delay chain, and y is the delay time of a single fine adjustment unit in the delay chain.
[0120] It can be seen that the second delayed clock obtained by the above method is equivalent to delaying the first delayed clock by a complete input clock cycle, thereby calculating the input clock cycle. However, if the input clock cycle is large, a longer delay chain is required, and its accuracy will decrease.
[0121] In order to improve the accuracy of the delay chain and ensure that the input clock cycle value finally obtained is more accurate, the embodiment of the present invention also provides another solution. Fig. 9 The second control code and the first delay code are adjusted in step 300 until the third edge-to-edge alignment signal is received and the second delay code is output. The following is described:
[0122] Step 321: Determine that the third control code=the second control code+the adjustment code, so that the phase interpolator 110 outputs a third phase clock according to the third control code.
[0123] See also Fig.10 In the embodiment of the present invention, the controller adds an adjustment code to the second control code as the third control code output, so that the phase interpolator outputs a third phase clock according to the third control code. The third phase clock is equivalent to the clock after the second phase clock is moved back by a preset accuracy threshold (i.e., 5.625°).
[0124] Step 322: perform a cumulative adjustment code operation on the first delay code until a third edge-to-edge alignment signal is received, and output a second delay code.
[0125] Among them, the phase interpolator outputs a second delayed clock according to the second delay code, and the third edge-to-edge alignment signal indicates that the rising edge of the third phase clock is aligned with the rising edge of the second delayed clock, or the falling edge of the third phase clock is aligned with the rising edge of the second delayed clock.
[0126] The third phase clock and the first delay clock obtained after step 321 are no longer aligned edge to edge. At this time, the controller performs a cumulative adjustment code operation on the first delay code. When the controller receives the third edge to edge alignment signal and outputs the second delay code, it means that the second delay clock output by the delay chain according to the second delay code is aligned edge to edge with the third phase clock. And, at this time, the phase difference between the second delay clock and the first delay clock is a preset accuracy threshold (i.e., 5.625°).
[0127] The second delay code is obtained by the above method, wherein the second delay code includes a second coarse adjustment delay code and a second fine adjustment delay code. The method of determining the period of the input clock based on the second delay code in step 400 also includes:
[0128] The period of the input clock = (the second coarse adjustment delay code * x + the second fine adjustment delay code * y) * (360° / preset accuracy threshold);
[0129] Wherein, x is the delay time of a single coarse adjustment unit in the delay chain, and y is the delay time of a single fine adjustment unit in the delay chain.
[0130] It can be seen that the second delayed clock obtained by the above method is equivalent to delaying the first delayed clock by a preset accuracy threshold. While obtaining the input clock cycle, the adjustment range of the delay chain is greatly reduced and the accuracy of the delay chain is improved.
[0131] In summary, an embodiment of the present invention provides a clock cycle detection method, which is applied to a controller in a clock cycle detection circuit. The controller first outputs a first control code and a first delay code, so that the phase interpolator outputs a first phase clock according to the first control code, and the delay chain outputs a first delay clock according to the first delay code. Wherein, the frequencies of the first phase clock and the first delay clock are the same as the frequency of the input clock. If the controller does not receive the first edge-to-edge alignment signal, the first control code is cumulatively adjusted until the second edge-to-edge alignment signal is received, and the second control code is output. The controller adjusts the second control code and the first delay code, or only adjusts the first delay code, until the third edge-to-edge alignment signal is received, and the second delay code is output. The period of the input clock is determined based on the second delay code.
[0132] The clock cycle detection method provided by the embodiment of the present invention can meet the situation where there is an absolute delay requirement for the chip. The period of the input clock is obtained through the clock cycle detection circuit, and there is no need to increase the startup process of the host, so that the chip compatibility is enhanced. Since the phase interpolator and the delay chain in the clock cycle detection circuit can be controlled independently, the range of available clock frequencies is increased and the flexibility of clock adjustment is improved. In addition, since the clock cycle detection circuit reuses the multi-channel phase clock output by the phase-locked loop inside the chip, and when the input clock cycle detection is completed, the subsequent absolute delay of the chip can reuse the phase interpolator and the frequency detector in the clock cycle detection circuit, which greatly reduces the area overhead of the chip.
[0133] Based on the concept of the above-mentioned clock cycle detection method, a clock cycle detection device corresponding to the clock cycle detection method is also provided in an embodiment of the present invention. Since the principle of solving the problem by the device in the embodiment of the present invention is similar to that of the above-mentioned clock cycle detection method, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be repeated.
[0134] See also Fig.11 The clock cycle detection device provided by the embodiment of the present invention includes: a sending module 201, a first adjusting module 202, a second adjusting module 203 and a determining module 204.
[0135] The sending module 201 is used to output a first control code and a first delay code, so that the phase interpolator outputs a first phase clock according to the first control code, and the delay chain outputs a first delay clock according to the first delay code; wherein the input clock of the delay chain multiplexes the 0° phase clock in multiple phase clocks.
[0136] The first adjustment module 202 is used to perform an accumulation adjustment code operation on the first control code when the first edge-to-edge alignment signal is not received, until the second edge-to-edge alignment signal is received, and output the second control code; wherein the phase interpolator outputs the second phase clock according to the second control code; the first edge-to-edge alignment signal indicates that the rising edge of the first phase clock is aligned with the rising edge of the first delayed clock, or the falling edge of the first phase clock is aligned with the rising edge of the first delayed clock; the second edge-to-edge alignment signal indicates that the rising edge of the second phase clock is aligned with the rising edge of the first delayed clock, or the falling edge of the second phase clock is aligned with the rising edge of the first delayed clock.
[0137] The second adjustment module 203 is used to adjust the second control code and the first delay code, or only adjust the first delay code, until a third edge-to-edge alignment signal is received, and output a second delay code.
[0138] The determination module 204 is configured to determine a period of the input clock based on the second delay code.
[0139] An embodiment of the present invention further provides an electronic device, including a processor and a memory, wherein the memory stores a program that can be executed by the processor, and the processor can execute the program to implement the above-mentioned clock cycle detection method.
[0140] An embodiment of the present invention further provides a storage medium, on which a computer program is stored. When the computer program is executed by a processor, the above-mentioned clock cycle detection method is implemented.
[0141] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
[0142] It will be apparent to those skilled in the art that the invention is not limited to the details of the exemplary embodiments described above and that the invention can be implemented in other specific forms without departing from the spirit or essential features of the invention. Therefore, the embodiments should be considered exemplary and non-limiting in all respects, and the scope of the invention is defined by the appended claims rather than the foregoing description, and it is intended that all variations falling within the meaning and scope of the equivalent elements of the claims be included in the invention. Any reference numeral in a claim should not be considered as limiting the claim to which it relates.
Claims
1. A clock cycle detection method, characterized in that: A controller applied to a clock cycle detection circuit, the clock cycle detection circuit further comprising: a delay chain, a phase interpolator and a phase frequency detector; the controller is connected to the phase interpolator, the phase frequency detector and the delay chain respectively, the delay chain is also connected to the phase frequency detector and the phase locked loop, the phase interpolator is also connected to the phase frequency detector and the phase locked loop; wherein the phase locked loop is used to output a multi-channel phase clock with the same frequency as the input clock; The clock cycle detection method comprises the following steps: Output a first control code and a first delay code, so that the phase interpolator outputs a first phase clock according to the first control code, and the delay chain outputs a first delayed clock according to the first delay code; wherein the input clock of the delay chain multiplexes the 0° phase clock in the multi-channel phase clock; If the first edge-to-edge alignment signal is not received, the first control code is subjected to an accumulation adjustment code operation until the second edge-to-edge alignment signal is received, and a second control code is output; wherein the phase interpolator outputs a second phase clock according to the second control code; the first edge-to-edge alignment signal indicates that the rising edge of the first phase clock is aligned with the rising edge of the first delayed clock, or the falling edge of the first phase clock is aligned with the rising edge of the first delayed clock; the second edge-to-edge alignment signal indicates that the rising edge of the second phase clock is aligned with the rising edge of the first delayed clock, or the falling edge of the second phase clock is aligned with the rising edge of the first delayed clock; Adjust the second control code and the first delay code, or only adjust the first delay code, until a third edge-to-edge alignment signal is received, and a second delay code is output; A period of the input clock is determined based on the second delay code.
2. The clock cycle detection method according to claim 1, characterized in that: The adjustment code is a code corresponding to a preset accuracy threshold; wherein the preset accuracy threshold is determined by the number of phases of the multi-channel phase clock and the bit width of the control code.
3. The clock cycle detection method according to claim 2, characterized in that: The step of adjusting only the first delay code until a third edge-to-edge alignment signal is received and outputting a second delay code includes: The first delay code is subjected to an operation of accumulating the adjustment code until a fourth edge-to-edge alignment signal is received, and a third delay code is output; wherein the delay chain outputs a third delayed clock according to the third delay code, and the fourth edge-to-edge alignment signal indicates that a rising edge of the second phase clock is aligned with a rising edge of the third delayed clock, or a falling edge of the second phase clock is aligned with a rising edge of the third delayed clock; The third delay code is accumulated with the adjustment code operation until the third edge-to-edge alignment signal is received, and the second delay code is output; wherein the delay chain outputs a second delay clock according to the second delay code, and the third edge-to-edge alignment signal indicates that the rising edge of the second phase clock is aligned with the rising edge of the second delay clock, or the falling edge of the second phase clock is aligned with the rising edge of the second delay clock.
4. The clock cycle detection method according to claim 3, characterized in that: The second delay code includes a second coarse adjustment delay code and a second fine adjustment delay code, and the step of determining the period of the input clock based on the second delay code includes: The period of the input clock = the second coarse adjustment delay code*x+the second fine adjustment delay code*y; Wherein, x is the delay time of a single coarse adjustment unit in the delay chain, and y is the delay time of a single fine adjustment unit in the delay chain.
5. The clock cycle detection method according to claim 2, characterized in that: The step of adjusting the second control code and the first delay code until a third edge-to-edge alignment signal is received and outputting a second delay code also includes: Determine a third control code=second control code+adjustment code, so that the phase interpolator outputs a third phase clock according to the third control code; The adjustment code operation is accumulated on the first delay code until the third edge-to-edge alignment signal is received, and the second delay code is output; wherein the delay chain outputs a second delay clock according to the second delay code, and the third edge-to-edge alignment signal indicates that the rising edge of the third phase clock is aligned with the rising edge of the second delay clock, or the falling edge of the third phase clock is aligned with the rising edge of the second delay clock.
6. The clock cycle detection method according to claim 5, characterized in that: The second delay code includes a second coarse adjustment delay code and a second fine adjustment delay code, and the step of determining the period of the input clock based on the second delay code includes: The period of the input clock = (the second coarse adjustment delay code * x + the second fine adjustment delay code * y) * (360° / preset accuracy threshold); Wherein, x is the delay time of a single coarse adjustment unit in the delay chain, and y is the delay time of a single fine adjustment unit in the delay chain.
7. The clock cycle detection method according to claim 1, characterized in that: The clock cycle detection method also includes: If the first edge-to-edge alignment signal is received, a second control code is output; wherein the second control code is a code representing a 0° phase.
8. A clock cycle detection device, characterized in that: Used to execute the clock cycle detection method according to any one of claims 1 to 7, the clock cycle detection device comprises: A sending module, used for outputting a first control code and a first delay code, so that the phase interpolator outputs a first phase clock according to the first control code, and the delay chain outputs a first delayed clock according to the first delay code; wherein the input clock of the delay chain multiplexes the 0° phase clock in the multi-channel phase clock; A first adjustment module is used for performing an accumulation adjustment code operation on the first control code when the first edge-to-edge alignment signal is not received, until the second edge-to-edge alignment signal is received, and outputting a second control code; wherein the phase interpolator outputs a second phase clock according to the second control code; the first edge-to-edge alignment signal indicates that the rising edge of the first phase clock is aligned with the rising edge of the first delayed clock, or the falling edge of the first phase clock is aligned with the rising edge of the first delayed clock; the second edge-to-edge alignment signal indicates that the rising edge of the second phase clock is aligned with the rising edge of the first delayed clock, or the falling edge of the second phase clock is aligned with the rising edge of the first delayed clock; A second adjustment module, used for adjusting the second control code and the first delay code, or only adjusting the first delay code, until a third edge-to-edge alignment signal is received, and outputting a second delay code; A determination module is used to determine the period of the input clock based on the second delay code.
9. An electronic device, characterized in that: The invention comprises a processor and a memory, wherein the memory stores a program executable by the processor, and the processor can execute the program to implement the clock cycle detection method according to any one of claims 1 to 7.
10. A storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed by a processor, the clock cycle detection method according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Circuit for and method of receiving a signal in an integrated circuit device
CN112075025A
INL detection and calibration for phase-interpolator
US11569804B1
Phase locked loop including a sampling circuit for reducing spurious side bands
US5920233A
Digital controller for a phase-locked loop
US9698798B1
