A method and apparatus for cross-clock domain signal synchronization
By combining a counter and a pulse regeneration module, the problem of pulse signal loss in cross-clock domain signal synchronization is solved, and low-cost signal synchronization is achieved.
Patent Information
- Application Number
- CN202310181895.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-27
- Publication Date
- 2026-11-17
- Estimated Expiration
- 2043-02-27
AI Technical Summary
In cross-clock domain processing, pulse signals are prone to synchronization loss, and existing technologies that solve this problem by introducing asynchronous FIFOs are costly.
A counter and a pulse regeneration module are used to temporarily store the pulse signal and construct a new pulse input signal when the pulse output signal changes, thereby achieving pulse signal synchronization.
It reduces the cost of pulse signal synchronization, avoids pulse signal loss, and achieves simple and efficient signal synchronization.
Smart Images

Figure CN116107388B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of signal synchronization technology, and in particular to a method and apparatus for cross-clock domain signal synchronization. Background Technology
[0002] Modern chips (such as system-on-chips, SOCs) are becoming increasingly integrated and complex. Typically, a single chip or FPGA will have many different signals operating at different clock frequencies. In order to reduce the probability of metastability, cross-clock domain processing is required.
[0003] However, when crossing clock domains, pulse signal synchronization loss can occur. When the interval between the first and second pulse signals in the source clock domain is too short, the first pulse signal fails to complete synchronization, and the second pulse signal clears the state, resulting in pulse signal synchronization loss.
[0004] Currently, to solve the problem of pulse signal synchronization loss, an asynchronous FIFO can be introduced to store the pulse signal as a single bit signal. However, introducing an asynchronous FIFO requires complex management logic and consumes storage, resulting in a high cost of the solution. Summary of the Invention
[0005] In view of this, embodiments of this application provide a cross-clock domain signal synchronization method and apparatus, aiming to reduce the cost of implementing the cross-clock domain signal synchronization method.
[0006] In a first aspect, embodiments of this application provide a method for cross-clock domain signal synchronization, the method comprising:
[0007] When the pulse output signal of the source clock domain is zero and the counter is zero, the first pulse input signal is used for signal synchronization.
[0008] When the pulse output signal of the source clock domain is not zero, the counter increments by one when the second pulse input signal is received;
[0009] When the pulse output signal of the source clock domain is zero and the counter is not zero, a third pulse input signal is constructed, the counter is decremented by one, and the third pulse input signal is used for signal synchronization.
[0010] Optionally, the step of synchronizing the first pulse input signal when the pulse output signal of the source clock domain is zero and the counter is zero includes:
[0011] When the pulse output signal of the source clock domain is zero and the counter is zero, the first pulse input signal is not counted and no pulse input signal is constructed, and the first pulse input signal is synchronized.
[0012] Optionally, when the pulse output signal of the source clock domain is not zero, after the counter is incremented by one upon receiving the second pulse input signal, the method further includes:
[0013] The third pulse input signal is constructed by configuring the interval between the two pulse input signals, the counter is decremented by one, and the third pulse input signal is synchronized.
[0014] Optionally, the step of constructing the third pulse input signal by configuring the interval between the two pulse input signals, decrementing the counter by one, and synchronizing the third pulse input signal includes:
[0015] The interval between two pulse input signals is configured by sending an interval counter, and the third pulse input signal is constructed. The counter is decremented by one, and the third pulse input signal is synchronized.
[0016] Optionally, the method further includes:
[0017] The counter remains unchanged when the second pulse input signal is received and the third pulse input signal is constructed simultaneously.
[0018] Secondly, embodiments of this application provide a cross-clock domain signal synchronization device, the device comprising:
[0019] The signal synchronization module is used to synchronize the first pulse input signal when the pulse output signal of the source clock domain is zero and the counter is zero.
[0020] The receiving module is configured to increment the counter by one when it receives the second pulse input signal, provided that the pulse output signal of the source clock domain is not zero.
[0021] The module is configured to construct a third pulse input signal when the pulse output signal of the source clock domain is zero and the counter is not zero, decrement the counter by one, and synchronize the third pulse input signal.
[0022] Optionally, the signal synchronization module includes:
[0023] The signal synchronization unit is used to synchronize the first pulse input signal when the pulse output signal of the source clock domain is zero and the counter is zero, without counting or constructing a pulse input signal.
[0024] Optionally, the receiving module further includes:
[0025] A configuration unit is used to construct the third pulse input signal by configuring the interval between two pulse input signals, decrement the counter by one, and synchronize the third pulse input signal.
[0026] Optionally, the configuration unit is specifically used to configure the interval between two pulse input signals by sending an interval counter, construct the third pulse input signal, decrement the counter by one, and synchronize the third pulse input signal.
[0027] Optionally, the device further includes:
[0028] A holding unit is provided to keep the counter unchanged when the second pulse input signal is received and the third pulse input signal is constructed simultaneously.
[0029] Thirdly, embodiments of this application provide a cross-clock domain signal synchronization circuit, which is used to implement the cross-clock domain signal synchronization method described in the first aspect above.
[0030] Compared with the prior art, the embodiments of this application have the following beneficial effects:
[0031] This application provides a method and apparatus for cross-clock domain signal synchronization. First, when the pulse output signal of the source clock domain is zero and the counter is zero, a first pulse input signal is synchronized. Then, when the pulse output signal of the source clock domain is not zero, the counter is incremented upon receiving a second pulse input signal. Finally, when the pulse output signal of the source clock domain is zero and the counter is not zero, a third pulse input signal is constructed, the counter is decremented, and the third pulse input signal is synchronized. It is evident that when the first pulse input signal is not synchronized, the second pulse input signal can be temporarily stored by counting with a counter. After the previous pulse input signal is synchronized, a new pulse input signal can be constructed to achieve synchronization, preventing pulse signal loss. Synchronization is ensured solely through a counter and pulse signal construction, making implementation simpler and less costly. Attached Figure Description
[0032] To more clearly illustrate the technical solutions in this embodiment or the prior art, the drawings used in the description of the embodiment or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0033] Figure 1 A flowchart illustrating a cross-clock domain signal synchronization method provided in this application embodiment;
[0034] Figure 2 A schematic diagram of a cross-clock domain signal synchronization circuit provided in an embodiment of this application;
[0035] Figure 3 A flowchart illustrating another cross-clock domain signal synchronization method provided in this application embodiment;
[0036] Figure 4 A schematic diagram of another cross-clock domain signal synchronization circuit provided in an embodiment of this application;
[0037] Figure 5 This is a schematic diagram of the pulse regeneration module provided in an embodiment of this application;
[0038] Figure 6 This is a schematic diagram of a cross-clock domain signal synchronization device provided in an embodiment of this application. Detailed Implementation
[0039] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of the present application.
[0040] When crossing clock domains, pulse signal synchronization loss can occur. When the interval between the first and second pulse signals in the source clock domain is too short, the first pulse signal fails to complete synchronization, and the second pulse signal clears the state, resulting in pulse signal synchronization loss.
[0041] Currently, to solve the problem of pulse signal synchronization loss, an asynchronous FIFO can be introduced to store the pulse signal as a single bit signal. However, introducing an asynchronous FIFO requires complex management logic and consumes storage, resulting in a high cost of the solution.
[0042] Based on this, to solve the above problems, in this embodiment, firstly, when the pulse output signal of the source clock domain is zero and the counter is zero, the first pulse input signal is synchronized. Then, when the pulse output signal of the source clock domain is not zero, the counter is incremented by one when the second pulse input signal is received. Finally, when the pulse output signal of the source clock domain is zero and the counter is not zero, a third pulse input signal is constructed, the counter is decremented by one, and the third pulse input signal is synchronized. It can be seen that when the first pulse input signal is not synchronized, the second pulse input signal can be temporarily stored by counting with a counter. After the previous pulse input signal is synchronized, a new pulse input signal can be constructed to achieve synchronization, preventing pulse signal loss. Synchronization is ensured solely through a counter and pulse signal construction, making it simpler and less costly to implement.
[0043] The following detailed description, in conjunction with the accompanying drawings, illustrates the specific implementation of the cross-clock domain signal synchronization method and apparatus in this application through embodiments.
[0044] See Figure 1 The figure is a flowchart of a cross-clock domain signal synchronization method provided in an embodiment of this application, combined with... Figure 1 As shown, it can specifically include:
[0045] S101: When the pulse output signal of the source clock domain is zero and the counter is zero, the first pulse input signal is synchronized.
[0046] In one possible implementation, specifically, when the pulse output signal of the source clock domain is zero and the counter is zero, the first pulse input signal is not counted and a pulse input signal is not constructed, and the first pulse input signal is synchronized.
[0047] See Figure 2 , Figure 2This diagram illustrates a cross-clock domain signal synchronization circuit provided in an embodiment of this application. Input Pulse is the input signal, Output Pulse is the output signal, Regenerated Pulse is the constructed pulse signal, SRC_CLK is the time in the source clock domain, SRC_CLK is the time in the destination clock domain, Q of the register is the output, and D is the input. When the pulse output signal of register FF1 is zero and the counter is zero, the first pulse input signal is output to the cross-clock domain processing module via the counter and pulse regeneration module for signal synchronization, thereby reducing latency. The cross-clock domain processing module refers to the part following the pulse regeneration module, consisting of NOT gates, AND gates, OR gates, and registers FF1-FF6. Signal synchronization is achieved through this module. Specifically, in the initial state, the Q value of register FF1 is 0, its output is 0 after passing through the AND gate, and then 0 after passing through the OR gate. The Q value of register FF6 is 0, and its value is 1 after passing through the NOT gate. When the Input Pulse signal is input with a value of 1, the output of the OR gate becomes 1. After one SRC_CLK clock cycle, the Q value of FF1 becomes 1. At this point, both inputs of the AND gate are 1, so its output becomes 1. Even if the Input Pulse signal is 1, the output will still be 1. The input value of Pulse is 0, and the output of OR gate is also 1. Since the Q output of FF1 remains 1, it can be guaranteed that the Q output value of FF1 can be sampled during the DST_CLK clock, and the values of registers FF2-FF6 all become 1. After passing through the NOT gate, the value becomes 0. After one input of the AND gate becomes 0, the output also becomes 0. Both inputs of the OR gate are 0, and its output value becomes 0. After one SRC_CLK clock cycle, the Q value of FF1 becomes 0, and registers FF2-FF6 become 0 in sequence, returning to the initial state and completing the pulse signal synchronization.
[0048] S102: When the pulse output signal of the source clock domain is not zero, the counter increments by one when the second pulse input signal is received.
[0049] When the pulse output signal of the source clock domain register FF1 is not zero, it indicates that the cross-clock domain processing module is performing signal synchronization. Therefore, when the second pulse input signal is received, the counter is incremented by one. This can be temporarily stored by counting to avoid the situation where the interval between the first and second pulse signals in the source clock domain is too short, the first pulse signal has not completed synchronization, and the second pulse signal clears the state, resulting in the loss of pulse signal synchronization. The bit width of the counter can be set at the chip SOC system level according to the number of possible sudden pulses. Of course, this application does not specifically limit how the bit width of the counter is set, and it does not affect the implementation of the embodiments of this application.
[0050] S103: When the pulse output signal of the source clock domain is zero and the counter is not zero, a third pulse input signal is constructed, the counter is decremented by one, and the third pulse input signal is used for signal synchronization.
[0051] When the pulse output signal of the source clock domain register FF1 is zero, it indicates that the signal synchronization of the cross-clock domain processing module has ended. If the counter is not zero, it means that there was a pulse input signal during signal synchronization in the cross-clock domain processing module. Therefore, a third pulse input signal can be constructed through the pulse regeneration module, simultaneously providing pulse support for decrementing the counter. This third pulse input signal is then synchronized through the cross-clock domain processing module. A new pulse input signal is constructed through the pulse regeneration module and simultaneously supplied to both the preceding counter and the subsequent cross-clock domain processing module. The former is used for counter maintenance, while the latter performs the actual cross-clock domain processing. By judging the state of the cross-clock domain processing module, sudden pulses with excessively short intervals can be smoothed out, giving this method great flexibility and adaptability. Furthermore, the flexible bypass mode can reduce processing latency.
[0052] In addition, the counter remains unchanged when the second pulse input signal is received and the third pulse input signal is constructed simultaneously.
[0053] The above describes a cross-clock domain signal synchronization method provided in this application. First, when the pulse output signal of the source clock domain is zero and the counter is zero, the first pulse input signal is synchronized. Then, when the pulse output signal of the source clock domain is not zero, the counter increments by one upon receiving the second pulse input signal. Finally, when the pulse output signal of the source clock domain is zero and the counter is not zero, a third pulse input signal is constructed, the counter decrements by one, and the third pulse input signal is synchronized. It can be seen that when the first pulse input signal has not completed signal synchronization, the second pulse input signal can be temporarily stored by counting with a counter. After the previous pulse input signal has completed signal synchronization, a new pulse input signal can be constructed to ensure complete synchronization of the pulse signals, preventing pulse signal loss. Synchronization of the pulse signals is guaranteed solely through a counter and pulse signal construction, making it simpler to implement and lower in cost.
[0054] See Figure 3 The figure is a flowchart of a cross-clock domain signal synchronization method provided in an embodiment of this application, combined with... Figure 3 As shown, it can specifically include:
[0055] S301: When the pulse output signal of the source clock domain is zero and the counter is zero, the first pulse input signal is synchronized.
[0056] S302: When the pulse output signal of the source clock domain is not zero, the counter increments by one when the second pulse input signal is received.
[0057] S303: By configuring the interval between two pulse input signals, a third pulse input signal is constructed, the counter is decremented by one, and the third pulse input signal is used for signal synchronization.
[0058] In one possible implementation, specifically, the interval between two pulse input signals can be configured by sending an interval counter to construct a third pulse input signal. The counter is then decremented, and the third pulse input signal is used for signal synchronization. See also... Figure 4 , Figure 4 This is a schematic diagram of another cross-clock domain signal synchronization circuit provided in an embodiment of this application. Figure 4 The pulse regeneration module can construct new pulse input signals by selecting configuration modes, as can be found in [reference needed]. Figure 5 , Figure 5 This is a schematic diagram of the pulse regeneration module. When the mode is configured as 0 (interval configuration mode), the interval can be configured by sending an interval counter. A third pulse input signal is constructed using a pulse generation enable signal. The counter decrements while the third pulse input signal is synchronized through the cross-clock domain processing module. When the mode is configured as 1 (adaptive mode), the state of the cross-time domain processing module can be determined. When the pulse output signal of the source clock domain is zero and the counter is not zero, a third pulse input signal is constructed using a pulse generation enable signal. The counter decrements while the third pulse input signal is synchronized through the cross-clock domain processing module, i.e., S103 in the previous embodiment. The interval between the two regenerated pulse signals is set by a register according to the relationship between the frequencies of the two clock domains. Specifically, the interval can be configured by sending an interval counter, without needing to determine the state of the cross-time domain processing module, making implementation simpler and easier.
[0059] The above describes a cross-clock domain signal synchronization method provided in this application. First, when the pulse output signal of the source clock domain is zero and the counter is zero, the first pulse input signal is synchronized. Then, when the pulse output signal of the source clock domain is not zero, the counter increments by one when a second pulse input signal is received. Finally, by configuring the interval between the two pulse input signals, a third pulse input signal is constructed, the counter decrements by one, and the third pulse input signal is synchronized. It can be seen that when the first pulse input signal is not synchronized, the second pulse input signal can be temporarily stored by counting with a counter. After the previous pulse input signal is synchronized, a new pulse input signal can be constructed by configuring the interval between the two pulse input signals, ensuring that the pulse signals are synchronized without loss. Pulse signal synchronization is guaranteed solely by using a counter and constructing the pulse signal. Configuring the interval does not require checking the state of the cross-clock processing module, making implementation simpler and less costly.
[0060] The above are some specific implementations of the cross-clock domain signal synchronization method provided in the embodiments of this application. Based on this, this application also provides a corresponding apparatus. The apparatus provided in the embodiments of this application will be described below from the perspective of functional modularity.
[0061] See Figure 6 The figure is a schematic diagram of a cross-clock domain signal synchronization device 600 provided in an embodiment of this application. The device 600 may include:
[0062] The signal synchronization module 601 is used to synchronize the first pulse input signal when the pulse output signal of the source clock domain is zero and the counter is zero.
[0063] The receiving module 602 is used to increment the counter by one when it receives the second pulse input signal, provided that the pulse output signal of the source clock domain is not zero.
[0064] The construction module 603 is used to construct a third pulse input signal when the pulse output signal of the source clock domain is zero and the counter is not zero, decrement the counter by one, and perform signal synchronization on the third pulse input signal.
[0065] In this embodiment, through the cooperation of the signal synchronization module 601, the receiving module 602, and the constructing module 603, when the first pulse input signal has not completed signal synchronization, the second pulse input signal can be temporarily stored by counting with a counter. After the previous pulse input signal has completed signal synchronization, a new pulse input signal can be constructed to make the pulse signal synchronized, and there will be no pulse signal loss. The synchronization of the pulse signal is guaranteed by only using a counter and constructing the pulse signal, which is simpler to implement and has a lower cost.
[0066] In one implementation, the signal synchronization module 601 includes:
[0067] The signal synchronization unit is used to synchronize the first pulse input signal when the pulse output signal of the source clock domain is zero and the counter is zero, without counting or constructing a pulse input signal.
[0068] In one implementation, the receiving module 602 further includes:
[0069] The configuration unit is used to construct a third pulse input signal by configuring the interval between two pulse input signals, decrement the counter by one, and synchronize the third pulse input signal.
[0070] In one implementation, the configuration unit is specifically used to configure the interval between two pulse input signals by sending an interval counter, construct a third pulse input signal, decrement the counter by one, and synchronize the third pulse input signal.
[0071] As one implementation, the cross-clock domain signal synchronization device 600 further includes:
[0072] A holding unit is used to keep the counter unchanged when the second pulse input signal and the third pulse input signal are received simultaneously.
[0073] This application also provides a cross-clock domain signal synchronization circuit for implementing the cross-clock domain signal synchronization method described in any embodiment of this application.
[0074] In the embodiments of this application, the terms "first" and "second" (if they exist) are used only as name identifiers and do not represent the order of first and second.
[0075] As can be seen from the above description of the embodiments, those skilled in the art can clearly understand that all or part of the steps in the above embodiments can be implemented by means of software plus a general-purpose hardware platform.
[0076] It should be noted that the various embodiments in this specification are described in a progressive manner, and the same or similar parts between the various embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, for the device embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the description of the method embodiments. The device embodiments described above are merely illustrative, and the units described as separate components may or may not be physically separate. The components indicated as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment solution according to actual needs. Those skilled in the art can understand and implement this without creative effort.
[0077] The above description is merely one specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A method of cross-clock domain signal synchronization, the method comprising: The method includes: When the pulse output signal of the source clock domain is zero and the counter is zero, the first pulse input signal is used for signal synchronization. When the pulse output signal of the source clock domain is not zero, the counter increments by one when the second pulse input signal is received; When the pulse output signal of the source clock domain is zero and the counter is not zero, a third pulse input signal is constructed, the counter is decremented by one, and the third pulse input signal is used for signal synchronization. The method further includes: The counter remains unchanged when the second pulse input signal is received and the third pulse input signal is constructed simultaneously.
2. The method of claim 1, wherein, When the pulse output signal of the source clock domain is zero and the counter is zero, the first pulse input signal is synchronized, including: When the pulse output signal of the source clock domain is zero and the counter is zero, the first pulse input signal is not counted and no pulse input signal is constructed, and the first pulse input signal is synchronized.
3. The method of claim 1, wherein, When the pulse output signal of the source clock domain is not zero, after the counter is incremented by one upon receiving the second pulse input signal, the method further includes: The third pulse input signal is constructed by configuring the interval between the two pulse input signals, the counter is decremented by one, and the third pulse input signal is synchronized.
4. The method of claim 3, wherein, The process of constructing the third pulse input signal by configuring the interval between two pulse input signals, decrementing the counter by one, and synchronizing the third pulse input signal includes: The interval between two pulse input signals is configured by sending an interval counter, and the third pulse input signal is constructed. The counter is decremented by one, and the third pulse input signal is synchronized.
5. A cross-clock domain signal synchronization apparatus, characterized by, The device includes: The signal synchronization module is used to synchronize the first pulse input signal when the pulse output signal of the source clock domain is zero and the counter is zero. The receiving module is configured to increment the counter by one when it receives the second pulse input signal, provided that the pulse output signal of the source clock domain is not zero. The module is configured to construct a third pulse input signal when the pulse output signal of the source clock domain is zero and the counter is not zero, decrement the counter by one, and perform signal synchronization on the third pulse input signal; The device further includes: A holding unit is provided to keep the counter unchanged when the second pulse input signal is received and the third pulse input signal is constructed simultaneously.
6. The apparatus of claim 5, wherein, The signal synchronization module includes: The signal synchronization unit is used to synchronize the first pulse input signal when the pulse output signal of the source clock domain is zero and the counter is zero, without counting or constructing a pulse input signal.
7. The apparatus of claim 5, wherein, The receiving module is followed by: A configuration unit is used to construct the third pulse input signal by configuring the interval between two pulse input signals, decrement the counter by one, and synchronize the third pulse input signal.
8. A clock domain crossing signal synchronization circuit, characterized by, This includes the cross-clock domain signal synchronization method as described in any one of claims 1-4.
Citation Information
Patent Citations
Apparatus for synchronizing a data handover between a first clock domain and a second clock domain
CN103563285A
