DATA READING/WRITING CIRCUIT, METHOD, AND DEVICE
A data reading/writing circuit includes a controller and a memory. The memory is configured to decode an instruction based on a first clock signal from the controller and to sample data based on a second clock signal from the controller. The memory includes first and second storage modules, and a mode register that stores a second synchronization parameter, and a second delay circuit is disposed in the second storage module. In reading/writing data on the first storage module, the controller is configured to synchronize the first and second clock signals using a first synchronization parameter. In reading/writing data on the second storage module, the controller is configured to perform first synchronization on the first and second clock signals using the first synchronization parameter, and the memory is configured to perform second synchronization on the first and second clock signals using the second delay circuit and the second synchronization parameter.
This application is a continuation application of International Patent Application No. PCT/CN2022/092536, filed on May 12, 2022, which claims priority to Chinese Patent Application No. 202210311931.8, filed with the China National Intellectual Property Administration on Mar. 28, 2022 and entitled “DATA READING/WRITING CIRCUIT, METHOD, AND DEVICE.” The above-referenced applications are incorporated herein by reference in their entirety.
TECHNICAL FIELDThis invention relates to but is not limited to a data reading/writing circuit, method, and device.
BACKGROUNDIn the semiconductor field, data is stored in a memory, as data may be written into the memory or read from the memory. The data reading/writing process needs to be controlled by a controller. The controller is usually implemented as a system on chip (SOC). When performing reading/writing, the controller needs to rely on a write clock signal (WCK). Correspondingly, when performing an instruction reading/writing process, the memory needs to rely on another clock signal (CK). If the time deviation between the two clock signals is relatively large, a reading/writing error may occur. To ensure correct reading/writing, the two clock signals need to be synchronized.
In the conventional technology, the controller performs clock synchronization on the two clock signals in real time by using one synchronization parameter. The synchronization parameter may be preset, and is used to indicate the time deviation between the two clock signals. For example, if the clock signal WCK is five nanoseconds earlier than the clock signal CK, 5 nanoseconds may be used as the synchronization parameter to delay the WCK by 5 nanoseconds or advance the CK by 5 nanoseconds.
SUMMARYAn embodiment of this invention provides a data reading/writing circuit, including a controller and a memory that are connected to each other. The memory is configured to receive a first clock signal and a second clock signal that are sent by the controller, and the memory is configured to decode an instruction based on the first clock signal and sample data based on the second clock signal.
The controller stores a first synchronization parameter, the memory includes a first storage module, a second storage module, and a mode register, the mode register stores a second synchronization parameter, a second delay circuit is disposed in the second storage module, and the second delay circuit is connected to the mode register.
In a reading/writing process performed on the first storage module, the controller is configured to synchronize the first clock signal and the second clock signal by using the first synchronization parameter.
In a reading/writing process performed on the second storage module, the controller is configured to perform first synchronization on the first clock signal and the second clock signal by using the first synchronization parameter, and the memory is configured to perform, by using the second delay circuit and the second synchronization parameter, second synchronization on the first clock signal and the second clock signal that are sent by the controller.
In some embodiments, another second delay circuit is disposed in the first storage module, and is configured to synchronize, by using the second synchronization parameter corresponding to the first storage module, the first clock signal and the second clock signal that are sent by the controller.
In some embodiments, the second delay circuit is located on a transmission path of the first clock signal, and is configured to receive the first clock signal sent by the controller, and perform delay processing on the received first clock signal based on the second synchronization parameter.
In some embodiments, the memory further includes a deviation measurement circuit respectively connected to the second delay circuit and the mode register, and the deviation measurement circuit is configured to determine a time deviation between the first clock signal and the second clock signal, and adjust the second synchronization parameter in the mode register based on the time deviation.
In some embodiments, the second delay circuit is located on a transmission path of the second clock signal, and is configured to receive the second clock signal sent by the controller, and perform delay processing on the received second clock signal by using the second synchronization parameter.
In some embodiments, the memory further includes a deviation measurement circuit respectively connected to the second delay circuit and the mode register, and the deviation measurement circuit is configured to determine a time deviation between the first clock signal and the second clock signal, and adjust the second synchronization parameter in the mode register based on the time deviation.
In some embodiments, the controller further includes a first delay circuit, configured to synchronize the first clock signal and the second clock signal by using the first synchronization parameter, and the first delay circuit is located on a transmission path of the first clock signal or a transmission path of the second clock signal.
In some embodiments, the second delay circuit includes a decoder circuit, a delay processing circuit, and an output circuit, the decoder circuit is configured to decode the second synchronization parameter to obtain N delay processing signals, where one of the delay processing signals is in a valid state, the delay processing circuit is configured to perform delay processing on a target clock signal input to the second delay circuit by using the delay processing signal in the valid state, and the output circuit is configured to use a target clock signal obtained after the delay processing as an output target clock signal, where the target clock signal is the first clock signal or the second clock signal.
In some embodiments, the delay processing circuit includes N AND gates, each of the AND gates corresponds to one delay processing signal, input of each of the AND gates is the target clock signal and a corresponding delay processing signal, (N-1) AND gates are respectively connected to delayers with different delays, the delayer is configured to perform delay processing on an output signal of the AND gate, the delay processing signal in the valid state corresponds to a target AND gate, and an output signal of the target AND gate or an output signal of a delayer connected to the target AND gate is used as the target clock signal output by the delay processing circuit.
An embodiment of this invention further provides a data reading/writing method, applicable to the foregoing data reading/writing circuit. The method includes: in a reading/writing process performed on the first storage module, synchronizing the first clock signal and the second clock signal by using the first synchronization parameter; and in a reading/writing process performed on the second storage module, synchronizing the first clock signal and the second clock signal by using the first synchronization parameter, and then synchronizing the first clock signal and the second clock signal by using the second synchronization parameter.
In some embodiments, the synchronizing the first clock signal and the second clock signal by using the second synchronization parameter includes: delaying the first clock signal by using the second synchronization parameter, where the second synchronization parameter is a difference between a time deviation corresponding to the second storage module and a time deviation corresponding to the first storage module, the time deviation corresponding to the first storage module is a time deviation between the first clock signal and the second clock signal in the reading/writing process performed on the first storage module, and the time deviation corresponding to the second storage module is a time deviation between the first clock signal and the second clock signal in the reading/writing process performed on the second storage module.
In some embodiments, the synchronizing the first clock signal and the second clock signal by using the second synchronization parameter includes: delaying the second clock signal by using the second synchronization parameter, where the second synchronization parameter is an opposite number of a difference between a time deviation of the second storage module and a time deviation corresponding to the first storage module, the time deviation corresponding to the first storage module is a time deviation between the first clock signal and the second clock signal in the reading/writing process performed on the first storage module, and the time deviation corresponding to the second storage module is a time deviation between the first clock signal and the second clock signal in the reading/writing process performed on the second storage module.
In some embodiments, the synchronizing the first clock signal and the second clock signal by using the first synchronization parameter includes: delaying the first clock signal by using the first synchronization parameter, where the first synchronization parameter is the time deviation of the first storage module.
In some embodiments, the synchronizing the first clock signal and the second clock signal by using the first synchronization parameter includes: delaying the second clock signal by using the first synchronization parameter, where the first synchronization parameter is an opposite number of the time deviation of the first storage module.
An embodiment of this invention further provides a data reading/writing method, applicable to the foregoing data reading/writing circuit. The method includes: in a reading/writing process performed on a target storage module, performing first synchronization on the first clock signal and the second clock signal by using the first synchronization parameter, the target storage module being the first storage module or the second storage module; and after the first synchronization, performing second synchronization on the first clock signal and the second clock signal by using a second synchronization parameter corresponding to the target storage module.
In some embodiments, the performing second synchronization on the first clock signal and the second clock signal by using a second synchronization parameter corresponding to the target storage module includes: delaying the first clock signal by using the second synchronization parameter corresponding to the target storage module, where if the target storage module is a storage module with a largest time deviation, the second synchronization parameter of the target storage module is an absolute difference between a time deviation corresponding to the first storage module and a time deviation of the second storage module; or if the target storage module is a storage module with a smallest time deviation, the second synchronization parameter of the target storage module is 0; and a time deviation of the storage module is a time deviation between the first clock signal and the second clock signal in a reading/writing process performed on the storage module.
In some embodiments, the performing second synchronization on the first clock signal and the second clock signal by using a second synchronization parameter corresponding to the target storage module includes: delaying the second clock signal by using the second synchronization parameter corresponding to the target storage module, where if the target storage module is a storage module with a largest time deviation, the second synchronization parameter of the target storage module is an opposite number of an absolute difference between a time deviation corresponding to the first storage module and a time deviation of the second storage module; or if the target storage module is a storage module with a smallest time deviation, the second synchronization parameter of the target storage module is 0; and a time deviation of the storage module is a time deviation between the first clock signal and the second clock signal in a reading/writing process performed on the storage module.
In some embodiments, the performing first synchronization on the first clock signal and the second clock signal by using the first synchronization parameter includes: delaying the first clock signal by using the first synchronization parameter, where the first synchronization parameter is the smaller value of the time deviation corresponding to the first storage module and the time deviation corresponding to the second storage module.
In some embodiments, the performing first synchronization on the first clock signal and the second clock signal by using the first synchronization parameter includes: delaying the second clock signal by using the first synchronization parameter, where the first synchronization parameter is an opposite number of the smaller value of the time deviation corresponding to the first storage module and the time deviation corresponding to the second storage module.
An embodiment of this invention further provides an electronic device, including the foregoing data reading/writing circuit.
According to the data reading/writing circuit, method, and device provided in the embodiments of this invention, clock synchronization can be implemented by using the first synchronization parameter when reading/writing is performed on the first storage module, and clock synchronization can be implemented through superposition of the first synchronization parameter and the second synchronization parameter when reading/writing is performed on the second storage module. In other words, a synchronization parameter used when reading/writing is performed on the first storage module is the first synchronization parameter, and a synchronization parameter used when reading/writing is performed on the second storage module is a superposed parameter of the first synchronization parameter and the second synchronization parameter. As such, the synchronization parameters of the two storage modules are different. As such, clock synchronization is respectively performed on the first storage module and the second storage module by using different synchronization parameters. Therefore, after the first synchronization parameter and the second synchronization parameter are initially set respectively based on the first storage module and the second storage module, the synchronization parameters do not need to be modified when reading/writing operations are switched among storage modules, so that the complexity of clock synchronization is reduced.
The following clearly describes the technical solutions in the embodiments of this invention with reference to the accompanying drawings in the embodiments of this invention. Clearly, the described embodiments are merely some but not all of the embodiments of this invention. All other embodiments obtained by persons of ordinary skill in the art based on the embodiments of this invention without creative efforts shall fall within the protection scope of this invention.
In the specification, claims, and accompanying drawings of this invention, the terms “first”, “second”, and so on are intended to distinguish between similar objects but do not necessarily indicate a specific order. It should be understood that the data termed in such a way is interchangeable in proper circumstances so that the embodiments of this invention described herein can be implemented in an order other than the order illustrated or described herein.
Moreover, the terms “include”, “contain”, and any other variants mean to cover the non-exclusive inclusion. For example, a process, method, system, product, or device that includes a list of steps or units is not necessarily limited to those steps or units expressly listed, but may include other steps or units not expressly listed or inherent to such a process, method, product, or device.
The inventor of this invention finds that a problem of relatively high clock synchronization complexity exists in the conventional technology when a memory includes two storage modules. After analyzing the conventional technology, the inventor finds that one of the reasons of the technical problem is as follows: Lengths of bounding wires of different storage modules are different. Therefore, time deviations between two clock signals corresponding to different storage modules are different. In this case, different synchronization parameters are used when clock synchronization is performed on different storage modules.
In the clock synchronization scenario shown in
To resolve the foregoing problem, different synchronization processes need to be set for two storage modules in embodiments of this invention. To implement different synchronization processes, clock synchronization of the two storage modules may be implemented by using two synchronization parameters. Specifically, clock synchronization is performed by using a first synchronization parameter in a reading/writing process performed on a first storage module, and clock synchronization is performed by using the first synchronization parameter and a second synchronization parameter in a reading/writing process performed on a second storage module. As such, different synchronization parameters are used for clock synchronization of the first storage module and clock synchronization of the second storage module, and the first synchronization parameter and the second synchronization parameter are to be initially set, so that when reading/writing operations are switched among storage modules, the first synchronization parameter and the second synchronization parameter do not need to be modified, thereby effectively reducing clock synchronization complexity.
The controller 101 stores a first synchronization parameter, and the first synchronization parameter is used to perform clock synchronization on the first clock signal and the second clock signal in a reading/writing process performed on any storage module. It may be understood that the first clock signal and the second clock signal are generated by the controller 101. Because of a transmission line and a technical problem, a time deviation usually exists between the first clock signal and the second clock signal. Therefore, the first clock signal and the second clock signal need to be synchronized, to minimize the time deviation, so that the time deviation falls within an allowable range.
The memory 102 includes a first storage module 1021 and a second storage module 1022. The second storage module 1022 includes a second delay circuit 10221 and a mode register 10222, the second delay circuit 10221 is connected to the mode register 10222, and the mode register 10222 stores a second synchronization parameter. The second delay circuit 10221 is configured to perform clock synchronization on the first clock signal and the second clock signal by using the second synchronization parameter.
Based on the data reading/writing circuit shown in
In a reading/writing process performed on the second storage module 1022, the controller 101 is configured to perform first synchronization on the first clock signal and the second clock signal by using the first synchronization parameter, and the memory 102 is configured to perform, by using the second delay circuit 10221 and the second synchronization parameter, second synchronization on the first clock signal and the second clock signal that are sent by the controller 101. Reading/writing performed on the second storage module 1022 is reading/writing performed on a storage array 10224 of the second storage module 1022.
It can be seen that the controller 101 performs clock synchronization once in the reading/writing process performed on the first storage module 1021. In the reading/writing process performed on the second storage module 1022, the controller 101 performs clock synchronization once, and in addition, the memory 102 further needs to perform clock synchronization once by using the second delay circuit 10221. In the reading/writing process performed on the first storage module 1021 or the second storage module 1022, the controller 101 uses the same first synchronization parameter to perform synchronization.
In some embodiments, as shown in
It can be seen that based on the data reading/writing circuit shown in
It is worthwhile to note that because the circuit structures shown in
Both the second delay circuit 10211 corresponding to the first storage module 1021 and the second delay circuit 10221 corresponding to the second storage module 1022 are configured to perform clock synchronization on the first clock signal and the second clock signal, and delay principles of the two delay circuits are the same.
Specifically, in the reading/writing process performed on the first storage module 1021, the second delay circuit 10211 corresponding to the first storage module 1021 may be configured to delay the first clock signal or the second clock signal. When the second delay circuit 10211 corresponding to the first storage module 1021 is located on a transmission path of the first clock signal, the second delay circuit 10211 corresponding to the first storage module 1021 is configured to receive the first clock signal sent by the controller 101, and perform delay processing on the received first clock signal based on the second synchronization parameter. When the second delay circuit 10211 corresponding to the first storage module 1021 is located on a transmission path of the second clock signal, the second delay circuit 10211 corresponding to the first storage module 1021 is configured to receive the second clock signal sent by the controller 101, and perform delay processing on the received second clock signal based on the second synchronization parameter.
Similarly, in the reading/writing process performed on the second storage module 1022, the second delay circuit 10221 corresponding to the second storage module 1022 may be configured to delay the first clock signal or the second clock signal. When the second delay circuit 10221 corresponding to the second storage module 1022 is located on a transmission path of the first clock signal, the second delay circuit 10221 corresponding to the second storage module 1022 is configured to receive the first clock signal sent by the controller 101, and perform delay processing on the received first clock signal based on the second synchronization parameter. When the second delay circuit 10221 corresponding to the second storage module 1022 is located on a transmission path of the second clock signal, the second delay circuit 10221 corresponding to the second storage module 1022 is configured to receive the second clock signal sent by the controller 101, and perform delay processing on the received second clock signal based on the second synchronization parameter.
It can be seen that the second delay circuit in this embodiment of the present disclosure may be flexibly disposed. As such, the second delay circuit may be disposed on the transmission path of the first clock signal or the transmission path of the second clock signal based on an actual application scenario. For example, the second delay circuit 10211 corresponding to the first storage module 1021 may be disposed on the transmission path of the first clock signal, and the second delay circuit 10221 corresponding to the second storage module 1022 may be disposed on the transmission path of the second clock signal.
Based on the data reading/writing circuit shown in
Based on the circuit shown in
Based on the circuit shown in
Based on the data reading/writing circuit shown in
Based on the circuit shown in
Based on the circuit shown in
In addition, based on the circuit shown in
Based on the data reading/writing circuit shown in
Based on the circuit shown in
Based on the circuit shown in
Based on the circuit shown in
Based on the circuit shown in
Based on the data reading/writing circuit shown in
Based on the circuit shown in
Based on the circuit shown in
Based on the circuit shown in
Based on the circuit shown in
Based on the data reading/writing circuit shown in
Based on the circuit shown in
Based on the circuit shown in
Based on the circuit shown in
Based on the circuit shown in
Based on the data reading/writing circuit shown in
Based on the circuit shown in
Based on the circuit shown in
Based on the circuit shown in
Based on the circuit shown in
It is worthwhile to note that in the foregoing data reading/writing circuits shown in
Certainly, a corresponding mode register may be alternatively empty, in other words, no second synchronization parameter exists, which represents a scenario where the second synchronization parameter is 0. In this scenario, a corresponding second delay circuit does not delay the first clock signal by default.
In the running processes of the foregoing circuits shown in
As shown in
As shown in
For the circuit shown in
For the circuit shown in
For the circuit shown in
For the circuit shown in
For the circuit shown in
For the circuit shown in
For the circuit shown in
In addition, for any one of the circuits shown in
It can be seen that the foregoing second delay circuit is configured to perform delay processing on an input target clock signal, and the target clock signal may be the foregoing first clock signal or the foregoing second clock signal.
Different delayers correspond to different delay degrees, and different delay degrees may be implemented in two manners.
In Manner 1, different delayers may include one delay unit, and the delay unit included in the different delayers corresponds to different delay durations.
In Manner 2, different delayers may include different quantities of delay units, and delay durations of the delay units are the same. In other words, different delayers implement different delay degrees by using different quantities of delay units.
It can be seen that the foregoing process describes in detail a connection relationship between the second delay circuit in the memory 102 and another circuit in the memory 102. In actual applications, the controller 101 may further include a first delay circuit, configured to synchronize the first clock signal and the second clock signal by using the foregoing first synchronization parameter.
Certainly, the first delay circuit may be alternatively disposed before the frequency divider, so that delay processing is performed before the frequency divider performs frequency division processing to obtain the second clock signal.
In addition, as shown in
Corresponding to the foregoing circuit embodiments,
S201: In a reading/writing process performed on a first storage module, synchronize a first clock signal and a second clock signal by using a first synchronization parameter.
Specifically, a first delay circuit may synchronize the first clock signal and the second clock signal by using the first synchronization parameter. Synchronization performed on the first clock signal and the second clock signal may include two types of processing: delay processing performed on the first clock signal by using a first synchronization parameter and delay processing performed on the second clock signal by using the first synchronization parameter .
Certainly, the first synchronization parameter for performing delay processing on the first clock signal is different from the first synchronization parameter for performing delay processing on the second clock signal.
When delay processing is performed on the first clock signal, the first synchronization parameter may be a time deviation corresponding to the first storage module. The time deviation corresponding to the first storage module is a time deviation between the first clock signal and the second clock signal in the reading/writing process performed on the first storage module. When delay processing is performed on the second clock signal, the first synchronization parameter may be an opposite number of the time deviation corresponding to the first storage module.
S202: In a reading/writing process performed on a second storage module, synchronize the first clock signal and the second clock signal by using the first synchronization parameter, and then synchronize the first clock signal and the second clock signal by using a second synchronization parameter.
Specifically, in the reading/writing process performed on the second storage module, first, the first delay circuit in the controller performs delay processing on the first clock signal or the second clock signal by using the same process as in S201. Then the controller sends the first clock signal and a delayed second clock signal to a memory, or sends the second clock signal and a delayed first clock signal to the memory. Finally, a second delay circuit in the memory may delay the first clock signal or the second clock signal by using the second synchronization parameter.
Certainly, a second synchronization parameter for performing delay processing on the first clock signal is different from a second synchronization parameter for performing delay processing on the second clock signal.
When the first clock signal is delayed by using the second synchronization parameter, the second synchronization parameter is a difference between a time deviation corresponding to the second storage module and a time deviation corresponding to the first storage module. When the second clock signal is delayed by using the second synchronization parameter, the second synchronization parameter is an opposite number of the difference between the time deviation of the second storage module and the time deviation corresponding to the first storage module. The time deviation corresponding to the second storage module is a time deviation between the first clock signal and the second clock signal in the reading/writing process performed on the second storage module. The time deviation here may be measured by the foregoing deviation measurement circuit in
In this embodiment of this invention, clock synchronization can be implemented by using one first synchronization parameter and one second synchronization parameter. The following uses examples for description. A time difference by which the first clock signal is earlier than the second clock signal may be defined as the time deviation between the first clock signal and the second clock signal. That is, if the first clock signal is earlier than the second clock signal, the time deviation is greater than 0. If the first clock signal is later than the second clock signal, the time deviation is less than 0. If the first clock signal and the second clock signal are synchronized, the time deviation is 0.
For example, when the time deviation corresponding to the first storage module is 4 nanoseconds, and the time deviation corresponding to the second storage module is 5 nanoseconds, the first synchronization parameter may be set to 4 nanoseconds, and the second synchronization parameter may be set to 5−4=1 nanosecond.
In the reading/writing process performed on the first storage module, the first delay circuit delays the first clock signal by 4 nanoseconds by using the first synchronization parameter. Before the clock synchronization, the first clock signal is 4 nanoseconds earlier than the second clock signal. Therefore, after the synchronization, the first clock signal and the second clock signal are in a synchronized state.
In the reading/writing process performed on the second storage module, first, the first delay circuit delays the first clock signal by 4 nanoseconds by using the first synchronization parameter, and then the second delay circuit delays the first clock signal by 1 nanosecond by using the second synchronization parameter. In other words, the first clock signal is delayed by a total of 5 nanoseconds. Before the clock synchronization, the first clock signal is 5 nanoseconds earlier than the second clock signal. Therefore, after the synchronization, the first clock signal and the second clock signal are in a synchronized state.
For example, when the time deviation corresponding to the first storage module is 5 nanoseconds, and the time deviation corresponding to the second storage module is 4 nanoseconds, the first synchronization parameter may be set to −5 nanoseconds, and the second synchronization parameter may be set to an opposite number, 1 nanosecond, of 4-5.
In the reading/writing process performed on the first storage module, the first delay circuit advances the second clock signal by 5 nanoseconds by using the first synchronization parameter. Before the clock synchronization, the first clock signal is 5 nanoseconds earlier than the second clock signal. Therefore, after the synchronization, the first clock signal and the second clock signal are in a synchronized state.
In the reading/writing process performed on the second storage module, first, the first delay circuit advances the second clock signal by 5 nanoseconds by using the first synchronization parameter, and then the second delay circuit delays the second clock signal by 1 nanosecond by using the second synchronization parameter. In other words, the second clock signal is advanced by 5 nanoseconds and then delayed by 1 nanosecond, and therefore, the second clock signal is advanced by a total of 4 nanoseconds. Before the clock synchronization, the first clock signal is 4 nanoseconds earlier than the second clock signal. Therefore, after the synchronization, the first clock signal and the second clock signal are in a synchronized state.
In conclusion, in the reading/writing process performed on the first storage module, the time deviation between the first clock signal and the second clock signal is eliminated by using the first synchronization parameter and the first delay circuit, to ensure that the first clock signal and the second clock signal are in the synchronized state, thereby improving reading/writing accuracy of the first storage module. In the reading/writing process performed on the second storage module, the time deviation between the first clock signal and the second clock signal is eliminated by using the first synchronization parameter, the first delay circuit, the second synchronization parameter, and the second delay circuit, to ensure that the first clock signal and the second clock signal are in the synchronized state, thereby improving reading/writing accuracy of the second storage module.
It can be seen that through the foregoing process, after the first synchronization parameter and the second synchronization parameter are set, the first synchronization parameter and the second synchronization parameter may not be modified, regardless of whether reading/writing is performed on the first storage module or the second storage module, so that clock synchronization complexity is reduced.
Corresponding to the foregoing circuit embodiments,
S301: In a reading/writing process performed on a target storage module, perform first synchronization on a first clock signal and a second clock signal by using a first synchronization parameter, where the target storage module is a first storage module or a second storage module.
S302: After the first synchronization, perform second synchronization on the first clock signal and the second clock signal by using a second synchronization parameter corresponding to the target storage module.
It is worthwhile to note that a controller uses the same first synchronization parameter in a reading/writing process performed on the first storage module or the second storage module. The first storage module corresponds to a second synchronization parameter, so that synchronization is performed by using the second synchronization parameter in a reading/writing process performed on the first storage module. The second storage module corresponds to another second synchronization parameter, so that synchronization is performed by using the another second synchronization parameter in a reading/writing process performed on the second storage module. It can be seen that in this embodiment of this invention, when both the first synchronization parameter and the second synchronization parameter exist and are not 0, clock synchronization needs to be performed twice regardless of whether reading/writing is performed on the first storage module or the second storage module. The first synchronization is performed by a first delay circuit by using the first synchronization parameter, and the second synchronization is performed by a second delay circuit by using the second synchronization parameter.
The first synchronization performed by the first delay circuit by using the first synchronization parameter includes two types of processing: delay processing performed on the first clock signal by using a first synchronization parameter and delay processing performed on the second clock signal by using the first synchronization parameter. Similarly, the second synchronization performed by the second delay circuit by using the second synchronization parameter includes two types of processing: delay processing performed on the first clock signal by using a second synchronization parameter and delay processing performed on the second clock signal by using a second synchronization parameter.
Certainly, the first synchronization parameter for performing delay processing on the first clock signal is different from the first synchronization parameter for performing delay processing on the second clock signal. Similarly, the second synchronization parameter for performing delay processing on the first clock signal is different from the second synchronization parameter for performing delay processing on the second clock signal.
When the first clock signal is delayed by using the first synchronization parameter, the first synchronization parameter is the smaller value of a time deviation corresponding to the first storage module and a time deviation corresponding to the second storage module. When the second clock signal is delayed by using the first synchronization parameter, the first synchronization parameter is an opposite number of the smaller value of the time deviation corresponding to the first storage module and the time deviation corresponding to the second storage module.
When the first clock signal is delayed by using the second synchronization parameter, a second synchronization parameter corresponding to each storage module needs to be set based on values of the time deviations corresponding to the two storage modules. A second synchronization parameter of a storage module with the larger time deviation in the first storage module and the second storage module is an absolute difference between the time deviations of the two storage modules, namely, an absolute value of a difference between the time deviations of the two storage modules. A second synchronization parameter of a storage module with the smaller time deviation in the first storage module and the second storage module is 0. For the target storage module, if the target storage module is the storage module with the larger time deviation, a second synchronization parameter of the target storage module is the absolute difference between the time deviation corresponding to the first storage module and the time deviation of the second storage module. If the target storage module is the storage module with the smaller time deviation, a second synchronization parameter of the target storage module is 0.
When the second clock signal is delayed by using the second synchronization parameter, a second synchronization parameter corresponding to each storage module also needs to be set based on values of the time deviations corresponding to the two storage modules. A second synchronization parameter of a storage module with the larger time deviation in the first storage module and the second storage module is an opposite number of an absolute difference between the time deviations of the two storage modules. A second synchronization parameter of a storage module with the smaller time deviation in the first storage module and the second storage module is 0. For the target storage module, if the target storage module is the storage module with the larger time deviation, a second synchronization parameter of the target storage module is the opposite number of the absolute difference between the time deviation corresponding to the first storage module and the time deviation of the second storage module. If the target storage module is the storage module with the smaller time deviation, a second synchronization parameter of the target storage module is 0. The time deviation here may be measured by the foregoing deviation measurement circuit in
In this embodiment of this invention, clock synchronization can be implemented by using one first synchronization parameter and two second synchronization parameters. The following uses examples for description. Similarly, a time difference by which the first clock signal is earlier than the second clock signal may be defined as the time deviation between the first clock signal and the second clock signal. That is, if the first clock signal is earlier than the second clock signal, the time deviation is greater than 0. If the first clock signal is later than the second clock signal, the time deviation is less than 0. If the first clock signal and the second clock signal are synchronized, the time deviation is 0.
For example, when the time deviation corresponding to the first storage module is 4 nanoseconds, and the time deviation corresponding to the second storage module is 5 nanoseconds, the first synchronization parameter may be set to the smaller value, 4 nanoseconds, of 4 and 5, the second synchronization parameter of the second storage module with the larger time deviation may be set to an absolute difference, 1 nanosecond, between 4 and 5, and the second synchronization parameter of the first storage module with the smaller time deviation may be set to 0.
In the reading/writing process performed on the first storage module, the first delay circuit delays the first clock signal by 4 nanoseconds by using the first synchronization parameter. Because the second synchronization parameter of the first storage module is 0, the second delay circuit does not delay the first storage module, which may also mean that the first storage module is delayed by 0 nanoseconds. Therefore, in this process, the first clock signal is delayed by a total of 4 nanoseconds. Before the clock synchronization, the first clock signal is 4 nanoseconds earlier than the second clock signal. Therefore, after the synchronization, the first clock signal and the second clock signal are in a synchronized state.
In the reading/writing process performed on the second storage module, the first delay circuit delays the first clock signal by 4 nanoseconds by using the first synchronization parameter, and then the second delay circuit delays the first clock signal by 1 nanosecond by using the second synchronization parameter of the second storage module. Therefore, the first clock signal is delayed by a total of 5 nanoseconds. Before the clock synchronization, the first clock signal is 5 nanoseconds earlier than the second clock signal. Therefore, after the synchronization, the first clock signal and the second clock signal are in a synchronized state.
For another example, when the time deviation corresponding to the first storage module is 5 nanoseconds, and the time deviation corresponding to the second storage module is 4 nanoseconds, the first synchronization parameter may be set to an opposite number, −4 nanoseconds, of the smaller value, 4 nanoseconds, of 4 and 5, the second synchronization parameter of the first storage module with the larger time deviation may be set to an opposite number, −1 nanosecond, of an absolute difference, 1 nanosecond, between 4 and 5, and the second synchronization parameter of the second storage module with the smaller time deviation may be set to 0.
In the reading/writing process performed on the first storage module, the first delay circuit advances the second clock signal by 4 nanoseconds by using the first synchronization parameter, −4 nanoseconds, and then the second delay circuit advances the second clock signal by 1 nanosecond by using the second synchronization parameter, −1 nanosecond, of the second storage module. Therefore, in this process, the second clock signal is advanced by a total of 5 nanoseconds. Before the clock synchronization, the first clock signal is 5 nanoseconds earlier than the second clock signal. Therefore, after the synchronization, the first clock signal and the second clock signal are in a synchronized state.
In the reading/writing process performed on the second storage module, the first delay circuit advances the second clock signal by 4 nanoseconds by using the first synchronization parameter, −4 nanoseconds. Because the second synchronization parameter of the second storage module is 0, the second delay circuit does not delay the second storage module, which may also mean that the second storage module is delayed by 0 nanoseconds. Therefore, in this process, the second clock signal is advanced by a total of 4 nanoseconds. Before the clock synchronization, the first clock signal is 4 nanoseconds earlier than the second clock signal. Therefore, after the synchronization, the first clock signal and the second clock signal are in a synchronized state.
It is worthwhile to note that the foregoing examples are merely examples. In actual applications, both the first synchronization parameter and the second synchronization parameter may be positive numbers, or both may be negative numbers, or one of them is a positive number and the other is a negative number, which is not limited in this embodiment of this invention.
The foregoing two method embodiments correspond to the foregoing circuit embodiments, and have the same technical effects as the circuit embodiments. For detailed descriptions of the apparatus embodiments, references can be made to detailed descriptions in the foregoing method embodiments. Details are omitted here for simplicity.
An embodiment of this invention further provides an electronic device, including the foregoing data reading/writing circuit.
Finally, it is worthwhile to note that the foregoing embodiments are merely intended for describing the technical solutions of this invention other than limiting this invention. Although this invention is described in detail with reference to the foregoing embodiments, persons of ordinary skill in the art should understand that they may still make modifications to the technical solutions described in the foregoing embodiments or make equivalent replacements to some or all technical features thereof, without departing from the scope of the technical solutions of the embodiments of this invention.
For ease of explanation, the foregoing descriptions are provided with reference to specific implementations. However, the foregoing example discussion is not intended to be exhaustive or limit implementations to the foregoing specific form disclosed. According to the foregoing teachings, various modifications and variations may be obtained. The foregoing embodiments are selected and described for the better explanation of the principle and actual application, so that persons skilled in the art better use the implementations and various variations that are considered for specific use.
Claims
1. A data reading/writing circuit, comprising a controller and a memory that are connected to each other, wherein the memory is configured to receive a first clock signal and a second clock signal that are sent by the controller, and the memory is configured to decode an instruction based on the first clock signal and to sample data based on the second clock signal;
- wherein the controller stores a first synchronization parameter, the memory comprises a first storage module, a second storage module, and a mode register, the mode register stores a second synchronization parameter, a second delay circuit is disposed in the second storage module, and the second delay circuit is connected to the mode register;
- wherein, in a reading/writing process performed on the first storage module, the controller is configured to synchronize the first clock signal and the second clock signal by using the first synchronization parameter; and
- in a reading/writing process performed on the second storage module, the controller is configured to perform first synchronization on the first clock signal and the second clock signal by using the first synchronization parameter, and the memory is configured to perform, by using the second delay circuit and the second synchronization parameter, second synchronization on the first clock signal and the second clock signal that are sent by the controller.
2. The data reading/writing circuit according to claim 1, wherein another second delay circuit is disposed in the first storage module, and is configured to synchronize, by using a second synchronization parameter corresponding to the first storage module, the first clock signal and the second clock signal that are sent by the controller.
3. The data reading/writing circuit according to claim 1, wherein the second delay circuit is located on a transmission path of the first clock signal, and is configured to receive the first clock signal sent by the controller, and perform delay processing on the received first clock signal based on the second synchronization parameter.
4. The data reading/writing circuit according to claim 3, wherein the memory further comprises a deviation measurement circuit connected to the second delay circuit and the mode register, and the deviation measurement circuit is configured to determine a time deviation between the first clock signal and the second clock signal, and adjust the second synchronization parameter in the mode register based on the time deviation.
5. The data reading/writing circuit according to claim 1, wherein the second delay circuit is located on a transmission path of the second clock signal, and is configured to receive the second clock signal sent by the controller, and perform delay processing on the received second clock signal by using the second synchronization parameter.
6. The data reading/writing circuit according to claim 5, wherein the memory further comprises a deviation measurement circuit connected to the second delay circuit and the mode register, and the deviation measurement circuit is configured to determine a time deviation between the first clock signal and the second clock signal, and adjust the second synchronization parameter in the mode register based on the time deviation.
7. The data reading/writing circuit according to claim 1, wherein the controller further comprises a first delay circuit, configured to synchronize the first clock signal and the second clock signal by using the first synchronization parameter, and the first delay circuit is located on a transmission path of the first clock signal or a transmission path of the second clock signal.
8. The data reading/writing circuit according to claim 1, wherein the second delay circuit comprises a decoder circuit, a delay processing circuit, and an output circuit, the decoder circuit is configured to decode the second synchronization parameter to obtain N delay processing signals, wherein one of the delay processing signals is in a valid state, the delay processing circuit is configured to perform delay processing on a target clock signal input to the second delay circuit by using the delay processing signal in the valid state, and the output circuit is configured to use a target clock signal obtained after the delay processing as an output target clock signal, wherein the output target clock signal is the first clock signal or the second clock signal.
9. The data reading/writing circuit according to claim 8, wherein the delay processing circuit comprises N AND gates, each of the AND gates corresponds to one delay processing signal, input of each of the AND gates is the target clock signal and a corresponding delay processing signal, (N-1) AND gates are respectively connected to delayers with different delays, each of the delayers is configured to perform delay processing on an output signal of a corresponding AND gate, the delay processing signal in the valid state corresponds to a target AND gate, and an output signal of the target AND gate or an output signal of a delayer connected to the target AND gate is used as the target clock signal output by the delay processing circuit.
10. A data reading/writing method, applicable to the data reading/writing circuit according to claim 1, comprising:
- in the reading/writing process performed on the first storage module, synchronizing the first clock signal and the second clock signal by using the first synchronization parameter; and
- in the reading/writing process performed on the second storage module, synchronizing the first clock signal and the second clock signal by using the first synchronization parameter, and then synchronizing the first clock signal and the second clock signal by using the second synchronization parameter.
11. The method according to claim 10, wherein the synchronizing the first clock signal and the second clock signal by using the second synchronization parameter comprises:
- delaying the first clock signal by using the second synchronization parameter, wherein the second synchronization parameter is a difference between a time deviation corresponding to the second storage module and a time deviation corresponding to the first storage module, the time deviation corresponding to the first storage module is a time deviation between the first clock signal and the second clock signal in the reading/writing process performed on the first storage module, and the time deviation corresponding to the second storage module is a time deviation between the first clock signal and the second clock signal in the reading/writing process performed on the second storage module.
12. The method according to claim 10, wherein the synchronizing the first clock signal and the second clock signal by using the second synchronization parameter comprises:
- delaying the second clock signal by using the second synchronization parameter, wherein the second synchronization parameter is an opposite number of a difference between a time deviation corresponding to the second storage module and a time deviation corresponding to the first storage module, the time deviation corresponding to the first storage module is a time deviation between the first clock signal and the second clock signal in the reading/writing process performed on the first storage module, and the time deviation corresponding to the second storage module is a time deviation between the first clock signal and the second clock signal in the reading/writing process performed on the second storage module.
13. The method according to claim 11, wherein the synchronizing the first clock signal and the second clock signal by using the first synchronization parameter comprises:
- delaying the first clock signal by using the first synchronization parameter, wherein the first synchronization parameter is the time deviation corresponding to the first storage module.
14. The method according to claim 11, wherein the synchronizing the first clock signal and the second clock signal by using the first synchronization parameter comprises:
- delaying the second clock signal by using the first synchronization parameter, wherein the first synchronization parameter is an opposite number of the time deviation corresponding to the first storage module.
15. A data reading/writing method, applicable to the data reading/writing circuit according to claim 2, comprising:
- in a reading/writing process performed on a target storage module, performing first synchronization on the first clock signal and the second clock signal by using the first synchronization parameter, the target storage module being the first storage module or the second storage module; and
- after the first synchronization, performing second synchronization on the first clock signal and the second clock signal by using a second synchronization parameter corresponding to the target storage module.
16. The method according to claim 15, wherein the performing second synchronization on the first clock signal and the second clock signal by using a second synchronization parameter corresponding to the target storage module comprises:
- delaying the first clock signal by using the second synchronization parameter corresponding to the target storage module, wherein if the target storage module is a storage module with a largest time deviation, the second synchronization parameter of the target storage module is an absolute difference between a time deviation corresponding to the first storage module and a time deviation corresponding to the second storage module; or if the target storage module is a storage module with a smallest time deviation, the second synchronization parameter of the target storage module is 0; and a time deviation corresponding to a respective storage module is a time deviation between the first clock signal and the second clock signal in a reading/writing process performed on the respective storage module.
17. The method according to claim 15, wherein the performing second synchronization on the first clock signal and the second clock signal by using a second synchronization parameter corresponding to the target storage module comprises:
- delaying the second clock signal by using the second synchronization parameter corresponding to the target storage module, wherein if the target storage module is a storage module with a largest time deviation, the second synchronization parameter of the target storage module is an opposite number of an absolute difference between a time deviation corresponding to the first storage module and a time deviation corresponding to the second storage module; or if the target storage module is a storage module with a smallest time deviation, the second synchronization parameter of the target storage module is 0; and a time deviation corresponding to a respective storage module is a time deviation between the first clock signal and the second clock signal in a reading/writing process performed on the respective storage module.
18. The method according to claim 16, wherein the performing first synchronization on the first clock signal and the second clock signal by using the first synchronization parameter comprises:
- delaying the first clock signal by using the first synchronization parameter, wherein the first synchronization parameter is the smaller value of the time deviation corresponding to the first storage module and the time deviation corresponding to the second storage module.
19. The method according to claim 16, wherein the performing first synchronization on the first clock signal and the second clock signal by using the first synchronization parameter comprises:
- delaying the second clock signal by using the first synchronization parameter, wherein the first synchronization parameter is an opposite number of the smaller value of the time deviation corresponding to the first storage module and the time deviation corresponding to the second storage module.
20. An electronic device, comprising the data reading/writing circuit according to claim 1.
Type: Application
Filed: Jul 1, 2022
Publication Date: Sep 28, 2023
Inventor: Enpeng GAO (HEFEI)
Application Number: 17/856,272