A cross-clock-domain data transmission method, device, apparatus and medium

By expanding the application range of Gray code through filtering and mapping relationships, the problem of encoding non-integer power natural numbers in cross-clock domain data transmission is solved, and reliable transmission of natural numbers in any range is achieved.

CN119892301BActive Publication Date: 2025-12-12SHANDONG YUNHAI GUOCHUANG CLOUD COMPUTING EQUIP IND INNOVATION CENT CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510122721.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-01-24
Publication Date
2025-12-12
Estimated Expiration
2045-01-24

AI Technical Summary

Technical Problem

In the existing technology, Gray code can only be used effectively when the range of natural numbers is an integer power of 2. This results in the inability to cover natural numbers that are not in the range of integer powers in cross-clock domain data transmission, leading to circuit state errors.

Method used

By determining whether the numerical range is even or odd, the minimum number of binary bits or twice the number of bits required to cover the numerical range is determined. A corresponding number of Gray code combinations are then selected, a mapping relationship is established for encoding, and the application range of Gray codes is expanded.

Benefits of technology

It enables the use of Gray code for data transmission of natural numbers in any range across clock domains, avoiding circuit state errors and improving the reliability of data transmission.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119892301B_ABST
    Figure CN119892301B_ABST
Patent Text Reader

Abstract

The application discloses a cross-clock-domain data transmission method and device, equipment and medium, and relates to the technical field of computers, which is applied to a data sending end and comprises the following steps: determining a corresponding numerical range after converting to-be-transmitted data into a target natural number; if the numerical range is a non-integer power of 2, determining whether the numerical range is an even value; if the numerical range is an even value, determining the minimum number of binary bits capable of covering the numerical range, and screening a corresponding number of Golay codes corresponding to the even value from binary codes represented by the minimum number of binary bits to obtain a target Golay code combination; if the numerical range is an odd value, determining the minimum number of binary bits capable of covering twice the numerical range, and screening a corresponding number of Golay codes corresponding to twice the odd value from binary codes represented by the minimum number of binary bits to obtain the target Golay code combination; and encoding the target natural number based on the target Golay code combination to convert the target natural number into a corresponding Golay code and then transmit the Golay code to a data receiving end.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of computer, in particular to a cross-clock-domain data transmission method, device, equipment and medium. BACKGROUND

[0002] In the coding of a group of numbers, if any two adjacent codes only differ in one binary number, then this coding is called Gray code. In addition, since the maximum number and the minimum number also differ in only one number, that is, "end-to-end", it is also called cyclic code or reflection code. In a digital system, natural numbers are often required to change in a certain order. For example, when counting by natural numbers in ascending order, if 8421 code is used, when the number 0111 changes to 1000, all four bits will change. In actual circuits, the change of 4 bits cannot occur absolutely simultaneously, so other codes such as 1100 and 1111 may appear in the counting. In a cross-clock-domain system, it may cause circuit state errors or input errors, and the use of Gray code can avoid such errors.

[0003] However, normal Gray code conversion requires that the range of natural numbers must be an integer power of 2 to meet the use requirements of Gray code. When the natural number does not meet the integer power of 2, due to the lack of range, the Gray code cannot be connected at the beginning and end and cannot be used.

[0004] In summary, how to improve the use range of Gray code in cross-clock-domain data transmission so that natural numbers of any range can be converted using Gray code is a problem to be solved at present. SUMMARY

[0005] Therefore, the purpose of the present application is to provide a cross-clock-domain data transmission method, device, equipment and medium, which can improve the use range of Gray code in cross-clock-domain data transmission, so that natural numbers of any range can be converted using Gray code. The specific scheme is as follows:

[0006] In a first aspect, the present application discloses a cross-clock-domain data transmission method, comprising:

[0007] determining the corresponding value range after converting the data to be transmitted into a target natural number;

[0008] if the value range is not an integer power of 2, determining whether the value range is an even value;

[0009] if the value range is an even value, determining the minimum binary bit number that can cover the value range, and selecting a corresponding number of Gray codes corresponding to the even value from the binary code represented by the minimum binary bit number to obtain a target Gray code combination;

[0010] If the numerical range is an odd number, the minimum number of binary bits covering twice the numerical range is determined, and the corresponding number of Gray codes corresponding to twice the odd number is screened from the binary code represented by the minimum number of binary bits to obtain the target Gray code combination;

[0011] The target natural number is encoded based on the target Gray code combination to convert the target natural number into a corresponding Gray code and transmit the Gray code to a data receiving end.

[0012] Optionally, the encoding of the target natural number based on the target Gray code combination comprises:

[0013] If the numerical range of the target natural number is an even number, a first mapping relationship is established between each target number in the target natural number and each Gray code in the target Gray code combination;

[0014] Each target number in the target natural number is encoded based on the first mapping relationship and each Gray code in the target Gray code combination.

[0015] Optionally, the encoding of the target natural number based on the target Gray code combination comprises:

[0016] If the numerical range of the target natural number is an odd number, each Gray code in the target Gray code combination is sequentially obtained, and each Gray code is evenly divided into a first Gray code combination and a second Gray code combination according to a front-to-back arrangement;

[0017] In the multi-round transmission process of the target natural number, a first use round corresponding to the first Gray code combination and a second use round corresponding to the second Gray code combination are determined based on a cyclic alternation mode; wherein the first Gray code combination is used in the first round of data transmission;

[0018] A current Gray code combination corresponding to the current transmission round is determined based on the first use round and the second use round; wherein the current Gray code combination is any one of the first Gray code combination and the second Gray code combination;

[0019] A second mapping relationship is established between each target number in the target natural number and each Gray code in the current Gray code combination;

[0020] Each target number in the target natural number is encoded based on the second mapping relationship and each Gray code in the current Gray code combination.

[0021] Optionally, the cross-clock-domain data transmission method further comprises:

[0022] If the numerical range is an integer power of 2, a target number of binary bits corresponding to the numerical range is determined, and each target binary code corresponding to the target number of binary bits is obtained in ascending order of the numerical value;

[0023] According to the preset binary code conversion method, each target binary code is converted into a corresponding Gray code in sequence to obtain a target Gray code combination, and then jumping to the step of encoding the target natural number based on the target Gray code combination.

[0024] Optionally, according to the preset binary code conversion method, each target binary code is converted into a corresponding Gray code in sequence, comprising:

[0025] For any target binary code, from the lowest bit of the target binary code, each target bit is subjected to an exclusive OR operation with the left adjacent bit, and the exclusive OR operation result is taken as the value of the corresponding target bit of the Gray code, and the highest bit of the target binary code remains unchanged.

[0026] Optionally, the cross-clock-domain data transmission method further comprises:

[0027] A Gray code lookup table is established in advance, wherein the Gray code lookup table records at least one Gray code combination corresponding to each numerical value range covered by different binary bit numbers;

[0028] Correspondingly, a corresponding number of Gray codes corresponding to even values are screened out from the binary code represented by the smallest binary bit number to obtain a target Gray code combination, comprising:

[0029] The target Gray code combination corresponding to the even values is screened out from the Gray code lookup table;

[0030] Correspondingly, a corresponding number of Gray codes corresponding to twice of odd values are screened out from the binary code represented by the smallest binary bit number to obtain a target Gray code combination, comprising:

[0031] The target Gray code combination corresponding to twice of the odd values is screened out from the Gray code lookup table.

[0032] Optionally, after the target natural number is converted into a corresponding Gray code and transmitted to the data receiving end, the method further comprises:

[0033] The target Gray code combination is obtained based on the received Gray code by the data receiving end, and the target numerical value range corresponding to the target Gray code combination is obtained from the Gray code lookup table, so as to recover the target natural number based on the target numerical value range.

[0034] In a second aspect, the application discloses a cross-clock-domain data transmission device applied to a data sending end, comprising:

[0035] A numerical value range determination module is configured to determine a corresponding numerical value range after converting the data to be transmitted into a target natural number;

[0036] A judgment module is configured to judge whether the numerical value range is an even value if the numerical value range is a non-integer power of 2.

[0037] The first determining module is configured to, if the numerical range is an even value, determine the minimum number of binary bits capable of covering the numerical range, and screen a corresponding number of Golay codes corresponding to the even value from binary codes represented by the minimum number of binary bits to obtain the target Golay code combination.

[0038] The second determining module is configured to, if the numerical range is an odd value, determine the minimum number of binary bits capable of covering twice the numerical range, and screen a corresponding number of Golay codes corresponding to twice the odd value from binary codes represented by the minimum number of binary bits to obtain the target Golay code combination.

[0039] The encoding module is configured to encode the target natural number based on the target Golay code combination, so as to convert the target natural number into a corresponding Golay code and then transmit the Golay code to a data receiving end.

[0040] In a third aspect, the present application discloses an electronic device, comprising:

[0041] The memory is configured to save the computer program.

[0042] The processor is configured to execute the computer program to implement the steps of the cross-clock-domain data transmission method disclosed above.

[0043] In a fourth aspect, the present application discloses a computer readable storage medium configured to store a computer program; wherein the computer program is executed by a processor to implement the steps of the cross-clock-domain data transmission method disclosed above.

[0044] It can be seen that, by determining the corresponding numerical range of the target natural number converted from the data to be transmitted by the data sending end, if the numerical range is a non-integer power of 2, it is determined whether the numerical range is an even value; if the numerical range is an even value, the minimum number of binary bits capable of covering the numerical range is determined, and a corresponding number of Golay codes corresponding to the even value are screened from binary codes represented by the minimum number of binary bits to obtain the target Golay code combination; if the numerical range is an odd value, the minimum number of binary bits capable of covering twice the numerical range is determined, and a corresponding number of Golay codes corresponding to twice the odd value are screened from binary codes represented by the minimum number of binary bits to obtain the target Golay code combination; and the target natural number is encoded based on the target Golay code combination, so as to convert the target natural number into a corresponding Golay code and then transmit the Golay code to a data receiving end.

[0045] Beneficial effects: Firstly, the application converts the data to be transmitted into a target natural number, and determines a corresponding numerical range. If the numerical range is a non-integer power of 2, it is further determined whether the numerical range is an even value or an odd value. If the numerical range is an even value, the minimum binary bit number capable of covering the numerical range is determined, and then a corresponding number of Golay codes corresponding to the even value are screened from the binary code represented by the minimum binary bit number, so as to obtain a target Golay code combination. If the numerical range is an odd value, the minimum binary bit number capable of covering twice the numerical range is determined, and then a corresponding number of Golay codes corresponding to twice the odd value are screened from the binary code represented by the minimum binary bit number, so as to obtain a target Golay code combination. That is, when the range of the target natural number is an odd value, the double of the numerical range is used to find the Golay code. Finally, after the target Golay code combination is determined, the target natural number is encoded based on the target Golay code combination, so as to convert the target natural number into a corresponding Golay code and then transmit it to the data receiving end. In this way, for any range of natural numbers, Golay codes can be used for transformation to perform cross-clock domain conversion and processing, thereby breaking the limitation of normal Golay code transformation. BRIEF DESCRIPTION OF DRAWINGS

[0046] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the drawings needed to be used in the embodiments or the prior art description will be briefly introduced. Obviously, the drawings in the following description are only embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor on the basis of the provided drawings.

[0047] Figure 1 A flow chart of a cross-clock domain data transmission method disclosed by the present application;

[0048] Figure 2 A first specific Golay code and natural number mapping relationship diagram disclosed by the present application;

[0049] Figure 3 A second specific Golay code and natural number mapping relationship diagram disclosed by the present application;

[0050] Figure 4 A third specific Golay code and natural number mapping relationship diagram disclosed by the present application;

[0051] Figure 5 A structure schematic diagram of a cross-clock domain data transmission device disclosed by the present application;

[0052] Figure 6 A structure diagram of an electronic device disclosed by the present application. DETAILED DESCRIPTION

[0053] The technical solutions in the embodiments of the present application will be clearly and completely described with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by a person of ordinary skill in the art without creative effort belong to the scope of the present application.

[0054] The current Gray code conversion requires that the range of natural numbers must be an integer power of 2 to meet the use requirements of the Gray code. When the natural number does not meet the integer power of 2, the Gray code cannot be used because the range is missing and the Gray code cannot be connected at the beginning and the end. Therefore, the embodiments of the present application disclose a cross-clock domain data transmission method, device, equipment and medium, which can improve the use range of the Gray code in cross-clock domain data transmission, so that any range of natural numbers can be converted using the Gray code.

[0055] Referring to Figure 1 The embodiments of the present application disclose a cross-clock domain data transmission method applied to a data sending end, and the method comprises the following steps:

[0056] Step S11: determining the corresponding value range after converting the to-be-transmitted data into a target natural number.

[0057] In the embodiments, it can be understood that in a digital communication system, data often needs to be transmitted between different clock domains. Assuming that there is a sensor network, the data collected by the sensor, such as the values of environmental temperature and humidity, needs to be transmitted to a central processing unit for analysis and processing, and the sensor and the central processing unit can be in different clock domains.

[0058] During transmission, the to-be-transmitted data needs to be converted into a target natural number first, and the corresponding value range is determined. For example, in a temperature monitoring system, if the measurement range of the temperature sensor used is -20℃ to 50℃, after quantization and conversion into a natural number, the value range corresponding to the temperature is the range of the to-be-processed natural number. Assuming that the quantization accuracy is 1℃, the value range corresponding to the converted natural number can be 0 to 70.

[0059] Step S12: if the value range is not an integer power of 2, determining whether the value range is an even value.

[0060] In the embodiments, it is further determined whether the value range is an integer power of 2, that is, whether the value range is 2, 4, 8, 16, 32, 64 or the like. If the value range is not an integer power of 2, it is further determined whether the value range is an even value or an odd value.

[0061] Further, the cross-clock-domain data transmission method further comprises: if the numerical range is an integer power of 2, determining a target binary bit number corresponding to the numerical range, and obtaining each target binary code corresponding to the target binary bit number in ascending order of the numerical value; converting each target binary code into a corresponding Gray code in sequence according to a preset binary code conversion method to obtain a target Gray code combination, and then jumping to the step of encoding the target natural number based on the target Gray code combination.

[0062] In the embodiment, if the numerical range is an integer power of 2, the target binary bit number corresponding to the numerical range is directly determined, for example, assuming that the numerical range is 8, the corresponding target binary bit number is 3, that is, three binary numbers are needed to represent, then each target binary code corresponding to the target binary bit number in ascending order of the numerical value is obtained, that is, 000, 001, 010, 011, 100, 101, 110, 111, and each target binary code is converted into a corresponding Gray code in sequence according to a preset binary code conversion method, so as to obtain a target Gray code combination, and then the step of encoding the target natural number based on the target Gray code combination is performed.

[0063] In the specific embodiment, converting each target binary code into a corresponding Gray code in sequence according to the preset binary code conversion method comprises: for any target binary code, from the lowest bit of the target binary code, each target bit is sequentially XORed with the left adjacent bit, and the XOR operation result is taken as the value of the corresponding target bit of the Gray code, and the highest bit of the target binary code remains unchanged. That is, the conversion method is to sequentially XOR each bit with the left adjacent bit from the lowest bit (i.e., the rightmost bit) of the binary code, and take the operation result as the value of the corresponding bit of the Gray code, while keeping the leftmost high bit unchanged. For example, for 000, from the right side, the first bit is XORed with the second bit to obtain 0, the second bit is XORed with the third bit to obtain 0, and the third bit remains unchanged, so 000 is obtained; for 001, the right first bit is XORed with the second bit to obtain 1, the second bit is XORed with the third bit to obtain 0, and the third bit remains unchanged, so 001 is obtained; and so on. For a three-bit binary number, the corresponding target Gray code combination is 000, 001, 011, 010, 110, 111, 101, and 100.

[0064] Step S13: if the numerical range is an even value, determining the minimum binary bit number capable of covering the numerical range, and screening a corresponding number of Gray codes corresponding to the even value from the binary code represented by the minimum binary bit number to obtain a target Gray code combination.

[0065] In the embodiment, in the case of the non-integer power of the numerical range of 2, if the numerical range is an even value, the minimum number of binary bits covering the numerical range is determined first, and then the corresponding number of Gray codes corresponding to the even value is screened from the binary code represented by the minimum number of binary bits, so as to obtain the target Gray code combination. For example, assuming that the numerical range is 6, corresponding to natural numbers 0 to 5, since 4 < 6 < 8, at least 3 binary numbers are needed to represent, that is, the minimum number of binary bits covering the numerical range 6 is 3. Then the corresponding number of Gray codes corresponding to the even value is screened from the binary code represented by the minimum number of binary bits to obtain the target Gray code combination. Specifically, the selected Gray codes can be 000, 001, 011, 010, 110, and 100 in turn, but the required Gray codes are not unique, and can also be 000, 001, 101, 111, 110, and 100.

[0066] In addition, assuming that the corresponding natural numbers are 0 to 9, the numerical range is 10, and the minimum number of binary bits covering the numerical range is 4, in this case, the selected Gray codes can be 0000, 0010, 0110, 0111, 0101, 1101, 1111, 1110, 1010, and 1000 in turn, and similarly, the required Gray codes are not unique, and can also be 0000, 0001, 0011, 0111, 0101, 1101, 1111, 1110, 1010, and 1000.

[0067] Therefore, the above method further comprises: establishing a Gray code lookup table in advance; wherein the Gray code lookup table records at least one Gray code combination corresponding to each numerical range covered by different numbers of binary bits; and correspondingly, screening the target Gray code combination corresponding to the even value from the Gray code lookup table to obtain the target Gray code combination from the corresponding number of Gray codes corresponding to the even value in the binary code represented by the minimum number of binary bits. It can be understood that, since the corresponding manner of Gray codes and binary codes does not conform to the normal conversion of natural numbers and Gray codes, and has no fixed rule, the normal conversion mode cannot be used for conversion coding, and then in order to more quickly determine the target Gray code combination corresponding to the numerical range, the Gray code lookup table can be established in advance, and at least one Gray code combination corresponding to each numerical range covered by different numbers of binary bits is recorded in the Gray code lookup table. In this way, after the numerical range is determined, if the numerical range is an even value, the target Gray code combination corresponding to the even value can be screened from the Gray code lookup table.

[0068] In addition, in addition to using the Gray code lookup table to record the Gray code combination corresponding to different value ranges, the Gray code value corresponding to the natural number can also be directly recorded in the lookup table, that is, the mapping relationship between the Gray code and the natural number is directly obtained. For example, if the natural number range is 0 to 15, the Gray code corresponding to each natural number is calculated according to the Gray code generation rule, such as 0 corresponding to 0000, 1 corresponding to 0001, 2 corresponding to 0011, and the like, and these corresponding relationships are stored in the lookup table. The lookup table can be implemented by using an array, a hash table or the like, so as to facilitate fast query. In hardware implementation, the ROM (read only memory) can be used to store the content of the lookup table, so as to ensure the stability and fast reading of the data during system operation. In addition, a series of conditional judgments or simple mapping rules can also be used in the program or hardware logic to achieve the mapping. For example, for a smaller and more regular natural number range, such as 0 to 7, the mapping can be achieved by using a simple if-else statement or a combination circuit in the hardware logic. When the input is 0, 000 is directly output; when the input is 1, 001 is output, and the like. In some specific simple scenarios, the code or circuit implementation is relatively simple.

[0069] Step S14: If the value range is an odd value, determining the minimum binary bit number capable of covering twice the value range, and screening the corresponding number of Gray codes corresponding to twice the odd value from the binary code represented by the minimum binary bit number to obtain the target Gray code combination.

[0070] In this embodiment, due to the characteristics of the Gray code, the value range of the natural number can only find the required Gray code value when it is even. When the value range of the natural number is odd, the required Gray code value cannot be found. Therefore, when the value range of the natural number is odd, the value range is doubled to find the Gray code value. Assuming that the corresponding natural number is 0 to 4, the Gray code value is found according to 0 to 9. Therefore, in the case of a non-integer power of 2 of the value range of 2, if the value range is an odd value, the minimum binary bit number capable of covering twice the value range needs to be determined, and the corresponding number of Gray codes corresponding to twice the odd value is screened from the binary code represented by the minimum binary bit number to obtain the target Gray code combination. That is, when the range of the target natural number is an odd value, the value range is doubled to find the Gray code.

[0071] Correspondingly, the corresponding number of Gray codes corresponding to twice the odd value is screened from the binary code represented by the minimum binary bit number to obtain the target Gray code combination, including screening the target Gray code combination corresponding to twice the odd value from the Gray code lookup table. Similarly, after the value range is determined, if the value range is an odd value, the target Gray code combination corresponding to twice the odd value can be screened from the Gray code lookup table.

[0072] Step S15: Encode the target natural number based on the target Gray code combination, so as to convert the target natural number into the corresponding Gray code and transmit it to the data receiving end.

[0073] In this embodiment, after determining the target Gray code combination, the target natural number is encoded based on the target Gray code combination to convert the target natural number into the corresponding Gray code before transmitting it to the data receiving end. In this way, Gray code can be used to transform natural numbers of any range to perform cross-clock domain conversion and processing, thereby breaking the limitations of normal Gray code transformation.

[0074] In one specific implementation, encoding a target natural number based on a target Gray code combination includes: if the target natural number has an even value range, establishing a first mapping relationship between each target value in the target natural number and each Gray code in the target Gray code combination; and encoding each target value in the target natural number using each Gray code in the target Gray code combination based on the first mapping relationship. That is, when the target natural number has an even value range, establishing a first mapping relationship between each target value in the target natural number and each Gray code in the target Gray code combination, such as... Figure 2 and Figure 3 As shown, Gray codes 000, 001, 011, 010, 110, and 100 sequentially map to natural numbers 0 to 5, and Gray codes 0000, 0010, 0110, 0111, 0101, 1101, 1111, 1110, 1010, and 1000 sequentially map to natural numbers 0 to 9. Thus, based on the first mapping relationship, each target value in the target natural number is encoded using each Gray code in the target Gray code combination.

[0075] In another specific implementation, encoding the target natural number based on the target Gray code combination includes: if the target natural number has an odd value range, sequentially acquiring each Gray code in the target Gray code combination, and dividing each Gray code into a first Gray code combination and a second Gray code combination in a front-to-back arrangement; during multiple rounds of transmission of the target natural number, determining the first usage round corresponding to the first Gray code combination and the second usage round corresponding to the second Gray code combination in a cyclical alternation manner; wherein, the first Gray code combination is used in the first round of data transmission; determining the current Gray code combination corresponding to the current transmission round based on the first usage round and the second usage round; wherein, the current Gray code combination is either the first Gray code combination or the second Gray code combination; establishing a second mapping relationship between each target value in the target natural number and each Gray code in the current Gray code combination; and encoding each target value in the target natural number using each Gray code in the current Gray code combination based on the second mapping relationship.

[0076] That is, in the case of the value range of the target natural number is an odd value, then the target gray code combination is obtained in turn, and each gray code is evenly divided into a first gray code combination and a second gray code combination according to the front-to-back arrangement. Taking the value range of the target natural number as 5 as an example, the corresponding target gray code combination is searched according to 10 (i.e. natural number 0 to 9), which is assumed to be 0000, 0010, 0110, 0111, 0101, 1101, 1111, 1110, 1010, 1000. Then the first five gray code values are taken as the first gray code combination, and the last five gray code values are taken as the second gray code combination. Then in the multi-round transmission process of the target natural number, the first use round corresponding to the first gray code combination and the second use round corresponding to the second gray code combination are determined based on the cyclic alternation; wherein it is stipulated that the first gray code combination is used in the first round of data transmission, and the first use round corresponding to the first gray code combination is 1, 3, 5, …; the second use round corresponding to the second gray code combination is 2, 4, 6, …; then the current gray code combination corresponding to the current transmission round is determined based on the first use round and the second use round. And each target value in the target natural number and each gray code in the current gray code combination establish a second mapping relationship, so that each target value in the target natural number is encoded based on the second mapping relationship using each gray code in the current gray code combination. That is, when the natural number changes, 0 to 4 in the first round is mapped to the first gray code combination, 0 to 4 in the second round is mapped to the second gray code combination, 0 to 4 in the third round is mapped to the first gray code combination, 0 to 4 in the fourth round is mapped to the second gray code combination, and so on. As shown in Figure 4

[0077] Further, after the target natural number is converted into the corresponding gray code and transmitted to the data receiving end, it further includes: obtaining the target gray code combination based on the received gray code by the data receiving end, and obtaining the target value range corresponding to the target gray code combination from the gray code lookup table, so as to recover the target natural number based on the target value range. That is, in this application, after the data receiving end obtains the target gray code combination based on the received gray code, the target value range corresponding to the target gray code combination is obtained from the gray code lookup table, and the target natural number is recovered based on the target value range.

[0078] ​It can be seen that the application firstly converts the to-be-transmitted data into a target natural number and determines a corresponding numerical range. If the numerical range is a non-integer power of 2, it is further determined whether the numerical range is an even value or an odd value. If the numerical range is an even value, the minimum binary bit number capable of covering the numerical range is determined, and then a corresponding number of Golay codes corresponding to the even value are screened from the binary code represented by the minimum binary bit number, so as to obtain a target Golay code combination. If the numerical range is an odd value, the minimum binary bit number capable of covering twice the numerical range is determined, and then a corresponding number of Golay codes corresponding to twice the odd value are screened from the binary code represented by the minimum binary bit number, so as to obtain the target Golay code combination. That is, when the range of the target natural number is an odd value, the double of the numerical range is used to find the Golay code. Finally, after the target Golay code combination is determined, the target natural number is encoded based on the target Golay code combination, so as to be converted into a corresponding Golay code and then transmitted to the data receiving end. In this way, for any range of natural number, Golay code can be used for transformation, so as to break the limitation of normal Golay code transformation.

[0079] Referring to Figure 5 The embodiment of the application discloses a cross-clock-domain data transmission device applied to a data sending end, which comprises:

[0080] A numerical range determination module 11 is configured to determine a corresponding numerical range after converting to-be-transmitted data into a target natural number.

[0081] A determination module 12 is configured to determine whether the numerical range is an even value if the numerical range is a non-integer power of 2.

[0082] A first determination module 13 is configured to determine the minimum binary bit number capable of covering the numerical range and screen a corresponding number of Golay codes corresponding to the even value from the binary code represented by the minimum binary bit number to obtain a target Golay code combination if the numerical range is an even value.

[0083] A second determination module 14 is configured to determine the minimum binary bit number capable of covering twice the numerical range and screen a corresponding number of Golay codes corresponding to twice the odd value from the binary code represented by the minimum binary bit number to obtain a target Golay code combination if the numerical range is an odd value.

[0084] An encoding module 15 is configured to encode the target natural number based on the target Golay code combination, so as to convert the target natural number into a corresponding Golay code and then transmit the Golay code to the data receiving end.

[0085] It can be seen that the application first converts the to-be-transmitted data into a target natural number, and determines a corresponding numerical range. If the numerical range is a non-integer power of 2, it is further determined whether the numerical range is an even value or an odd value. If the numerical range is an even value, the minimum binary bit number capable of covering the numerical range is first determined, and then a corresponding number of Golay codes corresponding to the even value are screened from the binary code represented by the minimum binary bit number, so as to obtain the target Golay code combination. If the numerical range is an odd value, the minimum binary bit number capable of covering twice the numerical range is determined, and then a corresponding number of Golay codes corresponding to twice the odd value are screened from the binary code represented by the minimum binary bit number, so as to obtain the target Golay code combination. That is, when the range of the target natural number is an odd value, twice the numerical range is used to find the Golay code. Finally, after the target Golay code combination is determined, the target natural number is encoded based on the target Golay code combination, so as to convert the target natural number into a corresponding Golay code and then transmit it to the data receiving end. In this way, for any range of natural numbers, Golay codes can be used for transformation to perform cross-clock domain conversion and processing, thereby breaking the limitation of normal Golay code transformation.

[0086] Since the embodiments of the device part correspond to the embodiments of the method part, the embodiments of the device part are described with reference to the embodiments of the method part, which are not described here. Moreover, the device has the same beneficial effects as the cross-clock domain data transmission method mentioned above.

[0087] Figure 6 A structural schematic diagram of an electronic device provided in the embodiments of the application is shown. Specifically, it can include at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. The memory 22 is used to store a computer program, which is loaded and executed by the processor 21 to implement the related steps in the cross-clock domain data transmission method performed by the electronic device disclosed in any of the preceding embodiments.

[0088] In the embodiment, the power supply 23 is used to provide working voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and external devices, and the communication protocol followed by the communication interface 24 can be any communication protocol applicable to the technical solution of the application, which is not limited here; the input / output interface 25 is used to obtain external input data or output data to the outside, and the specific interface type can be selected according to the specific application needs, which is not limited here.

[0089] The processor 21 can include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 21 can be implemented in at least one of a hardware form of a DSP (Digital Signal Processing), an FPGA (Field-Programmable Gate Array), a PLA (Programmable Logic Array). The processor 21 can also include a main processor and a coprocessor. The main processor is a processor for processing data in an awake state, also referred to as a CPU (Central Processing Unit). The coprocessor is a low-power processor for processing data in a standby state. In some embodiments, the processor 21 can be integrated with a GPU (Graphics Processing Unit) that is responsible for rendering and drawing the content required to be displayed by the display screen. In some embodiments, the processor 21 can further include an AI (Artificial Intelligence) processor for processing machine learning-related computing operations.

[0090] In addition, the memory 22, as a carrier for storing resources, can be a read-only memory, a random access memory, a magnetic disk, or an optical disk, etc. The resources stored thereon include an operating system 221, a computer program 222, and data 223, etc. The storage mode can be temporary storage or permanent storage.

[0091] The operating system 221 is used to manage and control each hardware device on the electronic device 20 and the computer program 222, so as to realize the operation and processing of the processor 21 on the mass data 223 in the memory 22. The operating system 221 can be Windows, Unix, Linux, etc. The computer program 222 can further include computer programs for completing other specific work in addition to the computer program for completing the cross-clock domain data transmission method disclosed by the electronic device 20 in any of the preceding embodiments. The data 223 can include data received by the electronic device from an external device, data collected by the input and output interface 25, etc.

[0092] Further, the embodiments of the present application also disclose a computer readable storage medium, the storage medium stores a computer program, and the computer program is loaded and executed by the processor to realize the method steps executed in the cross-clock domain data transmission process disclosed in any of the preceding embodiments.

[0093] Further, the embodiment of the present application further discloses a computer program product, comprising computer programs / instructions, which, when executed by a processor, implement the steps of the cross-clock-domain data transmission method disclosed in any of the foregoing embodiments.

[0094] The various embodiments are described in the present specification in progressive order, each embodiment highlighting a difference from the other embodiments. The same or similar parts between the various embodiments are referred to each other for clear and consistent description.

[0095] Those skilled in the art will further appreciate that the units and algorithm steps of the examples described in connection with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or any combination thereof. To clearly illustrate the interchangeability of hardware and software, various components have been described above generally in terms of their functionality, without limitation. The hardware and software claimed herein can be substituted for one another, as appropriate, so as to yield essentially the same result. The particular methods of implementation described above will vary depending on the specific application.

[0096] The steps of a method or algorithm described in connection with the embodiments disclosed herein can be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. A software module can reside in random access memory (RAM), flash memory, read-only memory (ROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.

[0097] Finally, it needs to be pointed out that, in the present specification, the relationship terms such as first and second are merely used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or sequence between the entities or operations. Moreover, the terms "comprise", "contain" or any other variants thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device comprising a series of elements not only includes those elements, but also includes other elements not explicitly listed or inherent to such process, method, article or device. Without more limitations, the element defined by the statement "comprising a" does not exclude the presence of other identical elements in the process, method, article or device comprising the element.

[0098] The above describes in detail the cross-clock domain data transmission method, device, equipment and storage medium provided by the present application. The principles and implementation manners of the present application are described by using specific examples. The above description of the embodiments is only used to help understand the method of the present application and its core idea. Meanwhile, for those skilled in the art, according to the idea of the present application, the specific implementation manners and application ranges can be changed. In summary, the content of the specification should not be understood as a limitation of the present application.

Claims

1. A method for cross-clock-domain data transfer, the method comprising: Applied to a data sending end, comprising: determining the corresponding numerical range after converting the to-be-transmitted data into a target natural number; if the numerical range is a non-integer power of 2, determining whether the numerical range is an even value; if the numerical range is an even value, determining the minimum binary bit number capable of covering the numerical range, and screening the corresponding number of Golay codes corresponding to the even value from the binary code represented by the minimum binary bit number to obtain a target Golay code combination; if the numerical range is an odd value, determining the minimum binary bit number capable of covering twice the numerical range, and screening the corresponding number of Golay codes corresponding to twice the odd value from the binary code represented by the minimum binary bit number to obtain a target Golay code combination; encoding the target natural number based on the target Golay code combination to convert the target natural number into a corresponding Golay code and then transmit it to a data receiving end; wherein the encoding of the target natural number based on the target Golay code combination comprises: if the numerical range of the target natural number is an even value, establishing a first mapping relationship between each target value in the target natural number and each Golay code in the target Golay code combination; encoding each target value in the target natural number based on the Golay codes in the target Golay code combination based on the first mapping relationship; the encoding of the target natural number based on the target Golay code combination comprises: if the numerical range of the target natural number is an odd value, sequentially obtaining each Golay code in the target Golay code combination, and dividing each Golay code into a first Golay code combination and a second Golay code combination in a front-to-back arrangement manner; in the multi-round transmission process of the target natural number, the first use round corresponding to the first Golay code combination and the second use round corresponding to the second Golay code combination are determined based on a cyclically alternating manner; wherein the first Golay code combination is used in the first round of data transmission; determining a current Golay code combination corresponding to the current transmission round based on the first use round and the second use round; wherein the current Golay code combination is any one of the first Golay code combination and the second Golay code combination; establishing a second mapping relationship between each target value in the target natural number and each Golay code in the current Golay code combination; encoding each target value in the target natural number based on the Golay codes in the current Golay code combination based on the second mapping relationship.

2. The cross-clock domain data transfer method of claim 1, wherein, further comprising: if the numerical range is an integer power of 2, determining a target binary bit number corresponding to the numerical range, and obtaining each target binary code corresponding to the target binary bit number in ascending order of numerical value; sequentially converting each target binary code into a corresponding Golay code according to a preset binary code conversion method to obtain a target Golay code combination, and then jumping to the step of encoding the target natural number based on the target Golay code combination.

3. The cross-clock domain data transfer method of claim 2, wherein, the sequentially converting each target binary code into a corresponding Golay code according to a preset binary code conversion method comprises: For any target binary code, each target bit is sequentially XORed with the left adjacent bit from the lowest bit of the target binary code, and the XOR operation result is taken as the value of the corresponding target bit of the Gray code, and the highest bit of the target binary code remains unchanged.

4. The method of claim 1 to 3, wherein, Also comprising: A Gray code lookup table is established in advance, wherein the Gray code lookup table records at least one Gray code combination corresponding to each numerical range covered by different binary bit numbers; Correspondingly, the target Gray code combination corresponding to the even value is screened out from the Gray code lookup table. Correspondingly, the target Gray code combination corresponding to the double of the odd value is screened out from the Gray code lookup table. After the target natural number is converted into the corresponding Gray code and transmitted to the data receiving end, the method further comprises: The data receiving end obtains the target Gray code combination based on the received Gray code, and obtains the target numerical range corresponding to the target Gray code combination from the Gray code lookup table, so as to recover the target natural number based on the target numerical range.

5. The cross-clock domain data transfer method of claim 4, wherein, Applied to a data sending end, comprising: A numerical range determination module is configured to determine the corresponding numerical range after converting the data to be transmitted into a target natural number; 6. A cross-clock domain data transfer apparatus, characterized by, A judgment module is configured to judge whether the numerical range is an even value if the numerical range is a non-integer power of 2; A first determination module is configured to determine the minimum binary bit number capable of covering the numerical range and screen out the corresponding number of Gray codes corresponding to the even value from the binary code represented by the minimum binary bit number to obtain a target Gray code combination if the numerical range is an even value. A second determination module is configured to determine the minimum binary bit number capable of covering the double of the numerical range and screen out the corresponding number of Gray codes corresponding to the double of the odd value from the binary code represented by the minimum binary bit number to obtain a target Gray code combination if the numerical range is an odd value. An encoding module is configured to encode the target natural number based on the target Gray code combination to convert the target natural number into the corresponding Gray code and transmit it to the data receiving end. The encoding module is specifically configured to establish a first mapping relationship between each target value in the target natural number and each Gray code in the target Gray code combination if the numerical range of the target natural number is an even value, and encode each target value in the target natural number by using each Gray code in the target Gray code combination based on the first mapping relationship. ​ ​ The encoding module is specifically configured to: if the value range of the target natural number is an odd value, sequentially acquire each Gray code in the target Gray code combination, and evenly divide each Gray code according to a front-to-back arrangement manner into a first Gray code combination and a second Gray code combination; in a multi-round transmission process of the target natural number, determine a first use round corresponding to the first Gray code combination and a second use round corresponding to the second Gray code combination based on a cyclic alternation manner; wherein the first Gray code combination is used in a first round data transmission process; determine a current Gray code combination corresponding to a current transmission round based on the first use round and the second use round; wherein the current Gray code combination is any one of the first Gray code combination and the second Gray code combination; establish a second mapping relationship between each target value in the target natural number and each Gray code in the current Gray code combination; and encode each target value in the target natural number by using each Gray code in the current Gray code combination based on the second mapping relationship.

7. An electronic device, comprising: Comprise: a memory for saving a computer program; a processor for executing the computer program to implement the steps of the cross-clock-domain data transmission method according to any one of claims 1 to 5.

8. A computer-readable storage medium, characterized in that, for storing a computer program; wherein the computer program is executed by a processor to implement the steps of the cross-clock-domain data transmission method according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Method and system for realizing asynchronous first in first out (FIFO) of any depth

    CN102495713A

  • Method and apparatus for generating gray code for any even count value to enable efficient pointer exchange mechanisms in asynchronous FIFO'S

    US20040001014A1