Data transmission method, device, equipment and medium

By using two transmission channels to alternately transmit data in the asynchronous FIFO, combined with the internal buffer and external dual-port memory, the problem of large-capacity storage and low transmission delay is solved, and efficient data transmission in the asynchronous FIFO is achieved.

CN118708151APending Publication Date: 2024-09-27SHANDONG YUNHAI GUOCHUANG CLOUD COMPUTING EQUIP IND INNOVATION CENT CO LTD
View PDF 0 Cites 3 Cited by

Patent Information

Application Number
CN202410939154.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-12
Publication Date
2024-09-27

AI Technical Summary

Technical Problem

In asynchronous FIFO, how to be compatible with large-capacity storage and low transmission delay is a challenge. When large-capacity cache is required, the existing technology uses a register set, which causes the chip area to be too large. Although TPRAM can achieve large-capacity storage, it cannot read and write data. There is a large delay.

Method used

Two transmission channels are used to alternately transmit data. The first transmission channel uses the buffer inside the asynchronous FIFO, which has low transmission delay but limited storage space. The second transmission channel uses an external dual-port memory, which can support larger storage capacity requirements. . When the first transmission channel buffer is full, it switches to the second transmission channel, and counts the number of readable data in real time after the switch. If it is lower than the preset water level, it switches back to the first transmission channel.

Benefits of technology

By using two transmission channels alternately, the compatibility of large-capacity storage and low transmission delay in asynchronous FIFO is achieved, saving chip area and reducing overall delay.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118708151A
    Figure CN118708151A
Patent Text Reader

Abstract

The invention discloses a data transmission method and device, equipment and a medium, relates to the technical field of communication, and is applied to a preset asynchronous FIFO (First In First Out), the asynchronous FIFO comprises a first transmission channel using a buffer in the asynchronous FIFO as a data storage space and a second transmission channel using a dual-port memory outside the asynchronous FIFO as a data storage space. After the asynchronous FIFO is powered on, the first transmission channel is used as a current data transmission channel; after it is monitored that the buffer in the first transmission channel is in a data full-writing state, the second transmission channel serves as a current data transmission channel; and for the first transmission channel, counting the number of current readable data synchronized from the read clock domain to the write clock domain in real time, if the number of the current readable data is lower than a preset lowest water level, taking the first transmission channel as a current data transmission channel, otherwise, continuously taking the second transmission channel as the current data transmission channel. And high-capacity storage and low transmission delay can be compatible.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of communication technology, and in particular to a data transmission method, device, equipment and medium. Background Art

[0002] In computer systems, asynchronous FIFO (First-In-First-Out) is a common data buffer used for asynchronous transmission between data input and output. Asynchronous FIFO plays an important role in data communication and control systems. It often acts as a buffer medium between ends. The function of asynchronous FIFO is to solve the frequency mismatch problem in the data transmission process. Asynchronous FIFO uses register groups to achieve data caching. However, when large-capacity caching is required, if register groups are still used, the chip area will be too large, so RAM (Random Access Memory) will be selected to cache data.

[0003] In IC (Integrated circuit design) design, TPRAM (Two-Port RAM) is usually used in scenarios where simultaneous read and write operations are required. The parallel read and write characteristics of TPRAM make it suitable for applications that require high concurrent data access, such as cache, data exchange, etc. When the storage space size requirement is greater than 2KB, compared to the cache, TPRAM can store more data in the same physical space, so it has a higher storage capacity. However, although TPRAM can achieve large-capacity storage, it has a delay in reading and writing data, and there will be a large delay when the data is output from the FIFO and then read in.

[0004] In summary, how to provide an asynchronous FIFO design solution that is compatible with large-capacity storage and low transmission delay is a problem that needs to be solved at present. Summary of the invention

[0005] In view of this, the purpose of the present invention is to provide a data transmission method, device, equipment and medium, which can be compatible with large-capacity storage and low transmission delay in asynchronous FIFO. The specific scheme is as follows:

[0006] In a first aspect, the present application discloses a data transmission method, which is applied to a preset asynchronous FIFO, wherein the asynchronous FIFO is connected to a data writing end and a data reading end respectively, and the asynchronous FIFO includes a first transmission channel and a second transmission channel, wherein the first transmission channel uses a buffer inside the asynchronous FIFO as a data storage space, and the second transmission channel uses a dual-port memory outside the asynchronous FIFO as a data storage space, including:

[0007] After the asynchronous FIFO is powered on, the first transmission channel is used as a current data transmission channel to transmit the data written by the data writing end to the data reading end;

[0008] monitoring the empty or full state of the buffer in the first transmission channel, and after monitoring that the buffer is in a data-written state, using the second transmission channel as the current data transmission channel to transmit the data written by the data writing end to the data reading end by using the second transmission channel;

[0009] For the first transmission channel, the current number of readable data synchronized from the read clock domain to the write clock domain is counted in real time. If the current number of readable data is lower than the preset minimum watermark, the first transmission channel is used as the current data transmission channel. If the current number of readable data is not lower than the preset minimum watermark, the second transmission channel continues to be used as the current data transmission channel.

[0010] Optionally, if the current number of readable data is not lower than a preset minimum watermark, after continuing to use the second transmission channel as the current data transmission channel, the method further includes:

[0011] Monitoring the empty and full status of the dual-port memory in the second transmission channel;

[0012] If it is monitored that the dual-port memory is in a data full state and the current number of readable data in the first transmission channel is not lower than the lowest watermark, it is determined that the asynchronous FIFO is in a data full state and the data writing operation of the data writing end is stopped.

[0013] Optionally, the data transmission method further includes:

[0014] Determining a first storage depth corresponding to a buffer in the first transmission channel;

[0015] Determine the lowest water level based on the first storage depth; the lowest water level does not exceed the first storage depth;

[0016] The process of determining the first storage depth includes:

[0017] Determine the first data number that can be read within two write clocks;

[0018] Determine the number of second data that can be read within the total duration of two write clocks and two read clocks;

[0019] The first storage depth is determined based on the first data number and the second data number.

[0020] Optionally, the calculation process of the head pointer and the tail pointer of the dual-port memory includes:

[0021] Determine a second storage depth corresponding to the asynchronous FIFO according to the target demand information, so as to determine a third storage depth corresponding to the dual-port memory in the second transmission channel based on the second storage depth;

[0022] Calculating a head pointer and a tail pointer of the dual-port memory based on the third storage depth by using the first calculation formula and the second calculation formula;

[0023] Wherein, the first calculation formula is:

[0024] Head pointer = 2 × pointer width of dual-port memory – third memory depth;

[0025] The second calculation formula is:

[0026] Tail pointer = pointer width of dual-port memory + third storage depth.

[0027] Optionally, the second transmission channel includes a write data cache space connected to the input port, the dual-port memory connected to the write data cache space, and a read data cache space connected to the dual-port memory and to the output port; wherein the input port and the output port are connected to the data write end and the data read end, respectively;

[0028] Correspondingly, the process of transmitting the data written by the data writing end to the data reading end by using the second transmission channel includes:

[0029] storing the data written by the data writing end through the input port into the write data cache space at the current write clock, and writing the data into the dual-port memory at the next write clock;

[0030] When it is detected that the dual-port memory is in a data non-empty state, reading data from the dual-port memory based on a current read clock, and storing the read data into the read data cache space;

[0031] The data in the read data buffer space is read to the output port at the next read clock.

[0032] Optionally, the data transmission method further includes:

[0033] When a preset condition is met, reading data from the dual-port memory;

[0034] The preset condition is any one of the first target condition, the second target condition and the third target condition; wherein, the first target condition is that the dual-port memory changes from an empty state to a data non-empty state, the second target condition is that there is a read enable for the asynchronous FIFO and the read data cache space is in a data non-empty state, and the third target condition is that there is no read enable for the asynchronous FIFO and there is readable data on the output port.

[0035] Optionally, the calculation process of the readable data amount and the writable data amount in the first transmission channel is:

[0036] Performing a difference operation on a write pointer and a read pointer synchronized from a write clock domain to a read clock domain to obtain a first operation result, and using the first operation result as the amount of readable data in the first transmission channel;

[0037] Performing a difference operation on a read pointer and a write pointer synchronized from a read clock domain to a write clock domain to obtain a second operation result, and using the second operation result as the amount of writable data in the first transmission channel;

[0038] The calculation process of the readable data volume and the writable data volume in the second transmission channel is:

[0039] Converting a write pointer from a binary coded address to a Gray code coded address in the write clock domain, synchronizing the converted write pointer to the read clock domain, and restoring the converted write pointer to a binary coded address in the read clock domain, performing a difference operation with the read pointer to obtain a third operation result;

[0040] Modifying the third operation result based on the read enable of the asynchronous FIFO to obtain a modified result, and using the modified result as the readable data amount in the second transmission channel;

[0041] Converting a read pointer from a binary coded address to a Gray code coded address in the read clock domain, synchronizing the converted read pointer to the write clock domain, and restoring the converted read pointer to a binary coded address in the write clock domain, performing a difference operation with the write pointer to obtain a fourth operation result;

[0042] The fourth operation result is used as the writable data amount in the second transmission channel.

[0043] In a second aspect, the present application discloses a data transmission device, which is applied to a preset asynchronous FIFO, wherein the asynchronous FIFO is connected to a data writing end and a data reading end respectively, and the asynchronous FIFO includes a first transmission channel and a second transmission channel, wherein the first transmission channel uses a buffer inside the asynchronous FIFO as a data storage space, and the second transmission channel uses a dual-port memory outside the asynchronous FIFO as a data storage space, and the method includes:

[0044] A first transmission module, configured to use the first transmission channel as a current data transmission channel to transmit the data written by the data writing end to the data reading end after the asynchronous FIFO is powered on;

[0045] a second transmission module, configured to monitor the empty or full state of the buffer in the first transmission channel, and after monitoring that the buffer is in a data-full state, use the second transmission channel as the current data transmission channel to transmit the data written by the data writing end to the data reading end by using the second transmission channel;

[0046] The third transmission module is used to count in real time the number of current readable data synchronized from the read clock domain to the write clock domain for the first transmission channel. If the current number of readable data is lower than the preset minimum watermark, the first transmission channel is used as the current data transmission channel. If the current number of readable data is not lower than the preset minimum watermark, the second transmission channel continues to be used as the current data transmission channel.

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

[0048] Memory, used to store computer programs;

[0049] The processor is used to execute the computer program to implement the steps of the aforementioned disclosed data transmission method.

[0050] In a fourth aspect, the present application discloses a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, the steps of the aforementioned disclosed data transmission method are implemented.

[0051] It can be seen that the data transmission method in the present application is applied to a preset asynchronous FIFO, the asynchronous FIFO is connected to the data writing end and the data reading end respectively, the asynchronous FIFO includes a first transmission channel and a second transmission channel, the first transmission channel uses the buffer inside the asynchronous FIFO as the data storage space, and the second transmission channel uses the dual-port memory outside the asynchronous FIFO as the data storage space, specifically including: after the asynchronous FIFO is powered on, the first transmission channel is used as the current data transmission channel to transmit the data written by the data writing end to the data reading end; the empty and full status of the buffer in the first transmission channel is monitored, and after monitoring that the buffer is in the data writing state, the second transmission channel is used as the current data transmission channel to use the second transmission channel to transmit the data written by the data writing end to the data reading end; for the first transmission channel, the number of current readable data synchronized from the read clock domain to the write clock domain is counted in real time, if the current number of readable data is lower than the preset lowest watermark, the first transmission channel is used as the current data transmission channel, if the current number of readable data is not lower than the preset lowest watermark, the second transmission channel continues to be used as the current data transmission channel.

[0052] Beneficial effect: The asynchronous FIFO in the present application includes two transmission channels, namely, a first transmission channel using the internal buffer of the asynchronous FIFO as the data storage space and a second transmission channel using the dual-port memory outside the asynchronous FIFO as the data storage space. At the beginning of power-on, the first transmission channel is selected by default for transmission. When it is detected that the buffer of the first transmission channel is in a data-full state, it is switched to the second transmission channel for transmission. After switching to the second transmission channel, if there is continuous data writing, the number of current readable data synchronized from the read clock domain to the write clock domain is counted in real time. If the current number of readable data is lower than the preset minimum watermark, it is switched to the first transmission channel, otherwise the second transmission channel is continued to be used for data transmission. That is, the present application transmits data alternately by using two transmission channels, wherein the first transmission channel uses an internal buffer, and its transmission delay is low, but its storage space is limited. The second transmission channel can support a larger storage capacity requirement, and can save more chip area when the FIFO capacity requirement is large, but its read and write data has a large transmission delay. Therefore, the present application transmits data by switching two transmission channels when the corresponding conditions are met, and achieves the purpose of large-capacity storage and low transmission delay through the mutual cooperation and assistance of the two. BRIEF DESCRIPTION OF THE DRAWINGS

[0053] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.

[0054] Figure 1 A flow chart of a data transmission method disclosed in this application;

[0055] Figure 2 The overall block diagram of an asynchronous FIFO with a TPRAM interface disclosed in this application;

[0056] Figure 3 A schematic diagram of a dual-channel structure disclosed in this application;

[0057] Figure 4 A TPRAM read and write enable control logic flow chart disclosed in this application;

[0058] Figure 5 A schematic diagram of a current range of actual readable data number variation disclosed in this application;

[0059] Figure 6 A schematic diagram of a non-power-of-2 depth pointer implementation disclosed in this application;

[0060] Figure 7 A timing diagram of key signals of an asynchronous FIFO disclosed in this application;

[0061] Figure 8 A specific calculation flow chart of the readable data volume disclosed in this application;

[0062] Fig. 9 This is a schematic diagram of the structure of a data transmission device disclosed in this application;

[0063] Fig.10 This is a structural diagram of an electronic device disclosed in this application. DETAILED DESCRIPTION

[0064] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.

[0065] Asynchronous FIFO is a common data buffer used for asynchronous transmission between data input and output, and is used to solve the frequency mismatch problem in the data transmission process. Asynchronous FIFO uses a register group to implement data caching. However, when a large-capacity cache is required, if the register group is still used, the chip area will be too large, so RAM will be selected to cache data. TPRAM is usually used in scenarios where read and write operations are required at the same time. The parallel read and write characteristics of TPRAM make it suitable for applications that require high concurrent data access, such as cache, data exchange, etc. When the storage space size requirement is greater than 2KB, compared with the cache, TPRAM can store more data in the same physical space, so it has a higher storage capacity. However, although TPRAM can achieve large-capacity storage, it has a delay in reading and writing data, and there will be a large delay if the data is output from the FIFO and then read in. To this end, the embodiment of the present application discloses a data transmission method, device, equipment and medium, which can be compatible with large-capacity storage and low transmission delay in asynchronous FIFO.

[0066] First, the principle and basic functions of asynchronous FIFO are explained:

[0067] FIFO is a "first-in, first-out queue". Data is written from one end and read from the other end. The reading order is exactly the same as the writing order. For the queue, the most important thing is not to read when the FIFO is empty and not to write when the FIFO is full. Generally, the "empty" and "full" information is obtained by comparing the read and write pointers. In addition, in actual use, the next external operation is often predicted in advance based on the "almost empty" or "almost full" of the FIFO, and the actual use of the current FIFO is understood based on the size of the readable and writable space of the FIFO. However, in an asynchronous FIFO, this signal does not fully reflect the internal situation of the FIFO. This is because it involves crossing clock domains, and the beat method is required to pass the information to the opposite clock domain. The synchronization of information is not an immediate result, so there will be certain errors, but as long as the empty and full / almost empty and full states are guaranteed, and the size of the readable and writable space does not exceed the current actual state, it is sufficient to meet the actual needs. The basic concepts used in FIFO are as follows:

[0068] 1. FIFO data width: the data bit width that FIFO reads and writes at one time (the same as the RAM data bit width).

[0069] 2. FIFO storage depth: the number of fixed-bit-width data that FIFO can store (the same as RAM storage depth).

[0070] 3. Read clock: Read data at each read clock edge.

[0071] 4. Write clock: Write data at each write clock edge.

[0072] 5. Read pointer: points to the next address to be read, and automatically increases by 1 after reading.

[0073] 6. Write pointer: points to the next address to be written, and automatically increases by 1 after writing.

[0074] 7. Empty / full flag: In order to ensure the correct reading and writing of FIFO without write overflow or read empty, it is necessary to provide write full and read empty flags to remind the external controller that write / read operations can no longer be performed in this state.

[0075] Based on the above important concepts, the basic external interface of asynchronous FIFO can be defined: write clock, read clock, write enable, read enable, write full flag, read empty flag, write data bus, read data bus and read / write reset. This application designs an asynchronous FIFO, whose read and write parts do not work in the same clock domain, so they can be divided into a write clock domain and a read clock domain, and the signals in the two clock domains are controlled respectively, and some related signals in the two clock domains are processed across clock domains to jointly determine the FIFO status.

[0076] About Gray code: Asynchronous FIFO determines whether the FIFO is full or empty by comparing the positions of the read pointer and the write pointer. However, the two pointers cannot be compared directly because they belong to different clock domains. Direct comparison may produce metastable states and cause misjudgments. This requires the two pointers to be processed across clock domains separately before judgment. However, there is a problem. The address of the natural binary code changes in multiple bits when the state is flipped. This may cause competition and may be sampled by a trigger in another clock domain, causing misjudgments. The easiest solution is to convert the address of the natural binary code into the address of the Gray code. If the Gray code is every 2 n The first and last two Gray codes still have only one bit change. If it is not 2 n If there are only a few bits, then the first and last data will not change by just one bit, and it is not a true Gray code. This is why the storage depth of the asynchronous FIFO can only be 2. n Since the characteristic of Gray code is that there is only one bit difference between each two adjacent binary values, the simplest way to synchronize a single-bit signal across clock domains is to synchronize it by double-beating the register to eliminate the influence of metastable state on clock domain crossing.

[0077] In addition, in actual projects, it is often necessary to check the next available word in the FIFO without issuing a read operation. The FWFT (First-Word Fall-Through) feature can support this function. When there is available data in the FIFO, the first word passes directly through the FIFO and automatically appears on the output bus. Once the first word appears on the output bus, the empty flag becomes invalid, indicating that there is at least one readable word in the FIFO; in addition, the FWFT feature increases the effective read depth of the FIFO. Therefore, the FWFT feature is very useful in applications that require low-latency access to data and in applications that need to throttle based on the content of the read data. The FWFT feature can also be called the prefetch feature of the FIFO.

[0078] See also Figure 1 As shown, an embodiment of the present application discloses a data transmission method, which is applied to a preset asynchronous FIFO, wherein the asynchronous FIFO is connected to a data writing end and a data reading end respectively, and the asynchronous FIFO includes a first transmission channel and a second transmission channel, wherein the first transmission channel uses a buffer inside the asynchronous FIFO as a data storage space, and the second transmission channel uses a dual-port memory outside the asynchronous FIFO as a data storage space, and the method includes:

[0079] Step S11: after the asynchronous FIFO is powered on, the first transmission channel is used as the current data transmission channel to transmit the data written by the data writing end to the data reading end.

[0080] In this embodiment, the asynchronous FIFO includes two transmission channels, namely, a first transmission channel using the buffer inside the asynchronous FIFO as data storage space and a second transmission channel using the dual-port memory outside the asynchronous FIFO as data storage space. The first transmission channel is selected by default for transmission at the initial power-on stage.

[0081] First of all, it should be made clear that there are certain differences between using dual-port memory as FIFO storage space and using buffer as FIFO storage space. The first point is that dual-port memory saves chip area more than register only when the storage space is greater than about 2KB. The second point is that there is a difference in timing. The buffer is embedded in the FIFO and can act as a cache medium itself, while the dual-port memory is an external storage unit of the FIFO, and there is a one-beat delay in reading and writing data. For example, data will be read out only in the next beat with read enable, and in actual layout and routing, the dual-port memory is often not near the FIFO use logic, and there is a high probability that there will be a long transmission path delay problem, so the input and output signal storage of the FIFO must be guaranteed.

[0082] That is, the present application has two data transmission channels. The first transmission channel is an internal path, which uses the buffer in the FIFO as the data storage space. After synchronizing the write enable from the write clock to the read clock domain, the data can be directly read out. The second transmission channel is an external path, which stores data by writing to the dual-port memory, and then reads it from the dual-port memory, and caches it in the asynchronous FIFO to the pre-fetch data buffer. It takes three write clocks and four read clocks for the data of channel 2 to be written to the FIFO and appear on the read data port. There is a large transmission delay, and there may be performance risks. However, the use of dual-port memory as a storage medium can save more chip area when the FIFO capacity demand is large. The first transmission channel can just make up for the defects of the second transmission channel and reduce the overall delay of the FIFO.

[0083] The data transmission delay of the first transmission channel is only one write clock plus two read clocks, which has a smaller delay than the second transmission channel. In the scenario where there is continuous data writing and reading, the addition of the first transmission channel reduces the transmission delay of two write clocks and two read clocks. The written data will be stored in the cache in the first transmission channel first. When the data storage in the first transmission channel is sufficient to support the entire system to maintain low-latency operation, it will switch to the second transmission channel for caching. Each channel has its own set of control logic, which cooperates and assists each other to achieve both low latency and large capacity.

[0084] That is, the two channels are executed in parallel. When the first transmission channel is busy (internal buffer is full), the second transmission channel is opened to write data into the dual-port memory and read it out. While the first transmission channel is reading data, the second transmission channel is also preparing data. When the data of the first transmission channel is read, the data of the second transmission channel is ready to be read out at the port. This parallel execution process can offset the delay difference between the two channels, and the two channels transmit alternately.

[0085] like Figure 2As shown, the asynchronous FIFO in this application is mainly composed of a write data cache space, a buffer inside the asynchronous FIFO (referred to as an internal buffer), a state FIFO, a cross-clock synchronization unit, a pointer control unit, an empty and full judgment module, a dual-port RAM port control module, a read data cache space and an output data selector. Among them, the pointer control unit controls a total of three pointers, the FIFO read-write pointer, the internal buffer pointer and the dual-port memory read-write pointer. The FIFO read-write pointer is used to judge its own empty and full status and calculate the size of the readable and writable space. The TPRAM and internal buffer pointers are used to point to their respective read and write addresses and judge the empty and full status. The pointers are all controlled by read and write enable. There are three parameters that the user needs to provide, the first is the FIFO depth D, the second is the number of data that can be read within two write clocks a, and the third is the data bit width. The channel selection for writing data will be cached using the status FIFO, 0 represents the first transmission channel, and 1 represents the second transmission channel; when reading data, the data will be read out in the write order based on the records stored in the status FIFO. The write enable of the status FIFO is shared with the FIFO write enable, and the read enable is equal to the OR of the read enable signals of the two channels.

[0086] Step S12: monitor the empty and full status of the buffer in the first transmission channel. After monitoring that the buffer is in a data-full state, use the second transmission channel as the current data transmission channel to transmit the data written by the data writing end to the data reading end using the second transmission channel.

[0087] In this embodiment, the empty or full state of the buffer in the first transmission channel is monitored. When it is detected that the buffer in the first transmission channel is full of data, the transmission is switched to the second transmission channel to transmit the data written by the data writing end to the data reading end using the second transmission channel.

[0088] Specifically, the second transmission channel includes a write data cache space connected to the input port, the dual-port memory connected to the write data cache space, and a read data cache space connected to the dual-port memory and to the output port; wherein the input port and the output port are respectively connected to the data write end and the data read end; accordingly, the process of using the second transmission channel to transmit the data written by the data write end to the data read end includes: storing the data written by the data write end through the input port to the write data cache space at the current write clock, and writing the data to the dual-port memory at the next write clock; when it is detected that the dual-port memory is in a data non-empty state, reading data from the dual-port memory based on the current read clock, and storing the read data in the read data cache space; reading the data in the read data cache space to the output port at the next read clock.

[0089] like Figure 3 As shown, when there is data written to the FIFO and the second transmission channel is selected, the written data first passes through the write data cache space, and is written to the dual-port memory at the next write clock. When the dual-port memory is not empty, the data is read. Since there is a read data cache space, the first read number will be stored in the read data cache space first. In this case, the read enable of the second beat is required to place the data on the output port in advance, thereby realizing pipeline reading.

[0090] Furthermore, the above method also includes: reading data from the dual-port memory when a preset condition is met; the preset condition is any one of a first target condition, a second target condition and a third target condition; wherein the first target condition is that the dual-port memory changes from an empty state to a data non-empty state, the second target condition is that there is a read enable for the asynchronous FIFO and the read data cache space is in a data non-empty state, and the third target condition is that there is no read enable for the asynchronous FIFO and there is readable data on the output port.

[0091] It is understandable that the dual-port memory read and write pointers can change in real time according to the enable signal, but how to control the dual-port memory read and write enable is a key point. It is relatively easy to directly use the dual-port memory as the internal storage space of the asynchronous FIFO, but in practice the physical location of the dual-port memory is likely to be far away from the FIFO module, so the difficulty lies in the control of the timing of the dual-port memory read and write enable signal. When there is data written to the FIFO, it will first arrive at the write data cache space for caching, and then be written to the dual-port memory in the next write clock. Therefore, the dual-port memory write enable is valid in the next write clock when the FIFO write enable is valid. The situations where the dual-port memory needs to be read can be divided into the following three types:

[0092] The first is the change from an empty state to a data non-empty state within the dual-port memory.

[0093] The second is when the asynchronous FIFO is read enabled and the read data buffer space is not empty, indicating that there is data available to read in the read data buffer space. At this time, the read data buffer space needs to be supplemented with data to ensure continuous data readout.

[0094] The third situation is when the asynchronous FIFO is not read enabled, there is currently data available to read at the TPRAM read data output port and the read data cache space is arbitrarily empty.

[0095] When any of the above three situations is valid, the dual-port memory needs to read data outward, so that data pre-fetching can be realized and the demand for continuous data reading can be met. The core control logic of the TPRAM port is as follows: Figure 4 as shown in .

[0096] Step S13: For the first transmission channel, count the current number of readable data synchronized from the read clock domain to the write clock domain in real time. If the current number of readable data is lower than the preset minimum watermark, use the first transmission channel as the current data transmission channel. If the current number of readable data is not lower than the preset minimum watermark, continue to use the second transmission channel as the current data transmission channel.

[0097] In this embodiment, after switching to the second transmission channel, if there is continuous data writing, the current number of readable data synchronized from the read clock domain to the write clock domain is counted in real time. If the current number of readable data is lower than the preset lowest watermark, the first transmission channel is switched, otherwise the second transmission channel is continued to be used for data transmission. That is, the present application transmits data alternately by using two transmission channels, wherein the first transmission channel uses an internal buffer, and its transmission delay is low, but its storage space is limited, and the second transmission channel can support a larger storage capacity requirement, and can save more chip area when the FIFO capacity requirement is large, but its reading and writing data has a larger transmission delay. Therefore, the present application transmits data by switching two transmission channels when the corresponding conditions are met, and the two cooperate and assist each other to achieve the purpose of large-capacity storage and low transmission delay.

[0098] Furthermore, if the current number of readable data is not lower than the preset minimum watermark, the above-mentioned method of continuing to use the second transmission channel as the current data transmission channel also includes: monitoring the empty and full state of the dual-port memory in the second transmission channel; if it is detected that the dual-port memory is in a data full state, and the current number of readable data in the first transmission channel is not lower than the minimum watermark, it is determined that the asynchronous FIFO is in a data full state, and the data writing operation of the data writing end is stopped. That is, if it is detected that the dual-port memory is in a data full state, it means that the second transmission channel is full, and if the current number of readable data in the first transmission channel is not lower than the minimum watermark, it is determined that the asynchronous FIFO is in a data full state, and the data writing operation of the data writing end is stopped.

[0099] In addition, the above method also includes: determining a first storage depth corresponding to a buffer in the first transmission channel; determining the lowest water level based on the first storage depth; the lowest water level does not exceed the first storage depth; wherein the process of determining the first storage depth includes: determining the number of first data that can be read within two write clocks; determining the number of second data that can be read within the total duration of two write clocks and two read clocks; determining the first storage depth based on the first data number and the second data number.

[0100] It should be pointed out that the depth of the asynchronous FIFO internal buffer is determined by the asynchronous FIFO read and write clock multiples, and is mainly composed of two parts:

[0101] The first part is the number of first data that can be read within two write clocks (rounded up). Assuming the write clock period is f1 and the read clock period is f2, the data that can be read within one write clock is (2f1) / f2. For the convenience of description, the first data number is uniformly defined as a in the following text.

[0102] The second part is the total amount of data that can be read within the duration of two write clocks plus the sum of two read clocks, recorded as the second data number: a+2+1 (rounded up).

[0103] It is understandable that in the synchronization process, in order to prevent the data of the first transmission channel from being read empty or written full, it is necessary to ensure when the control data can be switched from the second transmission channel to the first transmission channel, so the switch is performed when the total time length of the current margin of data read out in the first transmission channel is less than the transmission delay difference between the two channels to ensure the reduction of transmission delay. However, since the current readable margin is calculated in the read clock domain, if you want to use it to control the writing of that channel, you need to leave a certain amount of data space margin.

[0104] Although the channel can only be judged by the current number of readable data after synchronization, there is actually a range of changes. The actual number of readable data is defined as load_0 (that is, what the reader sees), and the number of readable data in the synchronous write-back clock domain is load_1. Then the range satisfies greater than or equal to load_1 - a (read only, not write), and less than or equal to load_1 + 2 (write only, not read), such as Figure 5 shown. Figure 5 A schematic diagram of the current range of actual readable data number variation provided by this application.

[0105] Therefore, it is only necessary to ensure that the minimum value of load_0 is ≥ (a+2)-1, so that the data written subsequently can be supplemented to the output port in time regardless of whether it goes through the first transmission channel or the second transmission channel, and there will be no interruption. The reason why a+2 needs to be reduced by 1 here is that the corresponding judgment is only made when the previous write is the second transmission channel, and at this time there is at least one data in the second transmission channel, so only a+1 data is currently present in the first transmission channel to meet the requirement of reducing synchronization delay. The maximum value of Load_0 cannot exceed the depth of the first transmission channel, so the first storage depth corresponding to the buffer in the first transmission channel should not be less than a+(a+1)+2, that is, 2a+3.

[0106] In summary, the value of the lowest watermark is defined as 2a+1. After load_1 is lower than the lowest watermark, the subsequent written data should be transmitted through the first transmission channel. If the second transmission channel is continued to be selected at this time, it cannot be guaranteed that the second transmission channel has been pre-fetched before the data transmission of the first transmission channel is completed.

[0107] After the FIFO reset is canceled and power is turned on, in order to ensure the minimum transmission delay, the first batch of written data will be transmitted from the first transmission channel by default. There is an internal data buffer in the first transmission channel, and its function can be compared to an asynchronous FIFO with a smaller depth. Since the buffer itself is built by registers, there is no need to additionally store the input and output data of the first transmission channel. The empty and full status of the internal data buffer can be calculated by the read pointer and the synchronized write pointer. When it is detected that the internal data buffer is not empty, the read data is completed to realize prefetching. When the internal buffer is full, it switches to the second transmission channel. If the second transmission channel is also full, the FIFO is full.

[0108] Furthermore, the calculation process of the head pointer and the tail pointer of the dual-port memory includes: determining the second storage depth corresponding to the asynchronous FIFO according to the target demand information, and determining the third storage depth corresponding to the dual-port memory in the second transmission channel based on the second storage depth; calculating the head pointer and the tail pointer of the dual-port memory based on the third storage depth by using the first calculation formula and the second calculation formula;

[0109] Wherein, the first calculation formula is:

[0110] Head pointer = 2 × pointer width of dual-port memory – third memory depth;

[0111] The second calculation formula is:

[0112] Tail pointer = pointer width of dual-port memory + third storage depth.

[0113] It should be pointed out that in practical applications, if only a FIFO with a depth of 20 is needed, choosing a depth of 32 is a waste. The depth of a traditional asynchronous FIFO must maintain a power depth, otherwise the pointer change is only 1 bit when using Gray code, so when a non-power depth cache is needed, it is necessary to take the power depth upwards. When the depth is large and far from the power, it will cause a waste of asynchronous FIFO bit width, thereby causing a waste of the area of ​​the corresponding cache area in the memory chip, and the increase of this area in the memory chip will also affect power consumption and timing.

[0114] This application belongs to a large-capacity pre-fetch FIFO, so it is necessary to consider how to control the read and write pointers of the dual-port memory in the second transmission channel to achieve a non-power-of-2 depth. The specific implementation method is as follows: using the symmetry of the Gray code, using the first and last virtual pointers to control the selected symmetric area, and then converting the virtual pointer to the actual read and write pointer after completing the Gray code synchronization, thereby realizing an asynchronous FIFO of arbitrary depth.

[0115] The calculation method of the head and tail pointers for controlling the second transmission channel to achieve non-power-of-2 depth is as follows:

[0116] Dual-port memory head pointer = 2 × dual-port memory pointer width – third memory depth;

[0117] Dual-port memory tail pointer = dual-port memory pointer width + third memory depth.

[0118] The third storage depth is the depth of the dual-port memory in the second transmission channel. Specifically, after determining the second storage depth corresponding to the asynchronous FIFO according to the target requirement information, the depth of the dual-port memory in the second transmission channel is the required depth of the asynchronous FIFO minus 2.

[0119] The implementation principle of non-power-of-2 depth pointer is as follows Figure 6 As shown in the figure, in traditional designs, due to the symmetry and particularity of Gray code, only quadratic depth asynchronous FIFOs can be implemented. The pointer changes during the reading and writing process are as follows: Figure 6 The values ​​shown in the figure are all the values ​​contained in the gray and non-gray areas. The pointer will gradually increase from 0000 to 1111 and then return to 0000. In this design, when data is written, the pointer will start to change from the head pointer 0001, and increase by one for each data written. When the write pointer increases to the tail pointer 1110, it can no longer increase, but will return to the write pointer. This ensures the symmetry of the Gray code, can also achieve single-bit jumps, and also achieves the control of the depth of the dual-port memory to be non-power of 2.

[0120] Generally, the cross-clock domain operation in the asynchronous FIFO only needs to be completed by tapping the data pointer in the form of Gray code after Gray code conversion. However, when using an external dual-port memory as a storage space, the dual-port memory cannot store data as soon as it is written like a buffer. Only the next beat of data after the write enable is valid will be stored in the dual-port memory. Therefore, if you continue to tap the read clock to cross the clock domain, in the scenario of slow writing and fast reading (the read clock frequency is greater than or equal to twice the write clock), if there is data written at this time, then when the write pointer is synchronized to the read clock domain, the written data has not yet been fully stored in the dual-port memory. At this time, if a pre-fetch operation is performed, an X-state or erroneous data will be read, and an error will occur. Therefore, considering the occurrence of this situation in advance, you can choose to tap the write clock domain during cross-clock synchronization to reserve time for the dual-port memory to complete data writing. Therefore, the clock synchronization unit needs to perform four beat operations on the FIFO write pointer. The first two times, two beats are synchronized on the write clock to ensure that the data can be completely written into the dual-port memory before the read operation is performed, and then two beats are synchronized on the read clock for cross-clocking.

[0121] The key signal timing diagram of the asynchronous FIFO in the second transmission channel in the scenario of fast reading and full writing is as follows Figure 7 As shown, it can be seen that the empty signal has intermittent increases and decreases. This is because the write clock frequency is lower than the read clock frequency. When the data is read out from the output data buffer, it takes time for the write pointer to synchronize to the read clock. From the read clock end, it looks like the next data has not been added to the dual-port memory in time. At this time, the output data buffer will be temporarily empty. At this time, although there is data in the FIFO, it cannot be read out. In order to prevent misunderstandings to external modules using the FIFO, when there is no data in the read data cache space, it needs to be presented as "empty" to the outside.

[0122] The empty space of FIFO can be judged by the pre-fetched data buffer area of ​​the two transmission channels. When there is no data in the internal buffer port of the first transmission channel and there is no data in the read data buffer space of the second transmission channel, the FIFO is empty. When there is data in the read data port of any channel, the FIFO is not empty. The actual capacity of FIFO should be the sum of the size of the internal buffer of the first transmission channel, the write data buffer space of the second transmission channel, the dual-port memory and the read data buffer space of the second transmission channel. However, due to the following restrictions when selecting the channel: after switching to the second transmission channel, the first transmission channel cannot be switched again before reaching the lowest water mark, so if the second transmission channel is full and the first transmission channel is not below the lowest water mark, the FIFO is full.

[0123] The present application also provides a method for calculating the amount of readable data and the amount of writable data in two channels, specifically including: the calculation process of the amount of readable data and the amount of writable data in the first transmission channel is: performing a difference operation on a write pointer and a read pointer synchronized from a write clock domain to a read clock domain to obtain a first operation result, and using the first operation result as the amount of readable data in the first transmission channel; performing a difference operation on a read pointer and a write pointer synchronized from a read clock domain to a write clock domain to obtain a second operation result, and using the second operation result as the amount of writable data in the first transmission channel; the calculation process of the amount of readable data and the amount of writable data in the second transmission channel is: converting the write pointer from a binary coded address to a Gray code coded address in the write clock domain, The write pointer after address conversion is synchronized to the read clock domain, and after restoring the write pointer after address conversion to a binary coded address in the read clock domain, a difference operation is performed with the read pointer to obtain a third operation result; the third operation result is corrected based on the read enable of the asynchronous FIFO to obtain a corrected result, and the corrected result is used as the readable data amount in the second transmission channel; the read pointer is converted from a binary coded address to a Gray code coded address in the read clock domain, and the read pointer after address conversion is synchronized to the write clock domain, and after restoring the read pointer after address conversion to a binary coded address in the write clock domain, a difference operation is performed with the write pointer to obtain a fourth operation result; the fourth operation result is used as the writable data amount in the second transmission channel.

[0124] First, the method for calculating the readable and writable data volume of the first transmission channel is as follows: the readable data volume can be directly obtained by subtracting the write pointer synchronized from the write clock domain to the read clock domain from the read pointer, and the writable data volume can be obtained by subtracting the read pointer synchronized from the read clock domain to the write clock domain from the write pointer.

[0125] Since the internal path of FIFO is long, data can be read out only when there is valid data in the read data cache space. Therefore, after writing multiple data to FIFO, it may cause a void because it takes time for the pointer to synchronize across the clock. It may also cause a void because the data prefetching is not completed, that is, the data has not reached the output data cache space. In order to realize the read data storage output of the second transmission channel of the asynchronous FIFO, it is necessary to calculate the amount of readable and writable data in advance, and then use the correction unit to correct the data amount. The specific calculation process of the readable data amount is as follows: Figure 8As shown. First, in the write clock domain, the write pointer is converted from a binary coded address to a Gray code coded address, and the write pointer after the address conversion is synchronized to the read clock domain. After the write pointer after the address conversion is restored to a binary coded address in the read clock domain, a difference operation is performed with the read pointer to obtain the operation result. Further, the correction unit is used to correct it. The modification process is to determine whether there is valid data in the dual-port memory port. If so, it is further determined whether there is valid data in the read data cache space. If not, the corrected result is the read-write pointer difference (i.e., the third operation result) minus the read enable. If it exists, the corrected result is the read-write pointer difference. If there is no valid data in the dual-port memory port, it is determined whether there is a read enable of the asynchronous FIFO. If so, the corrected result is 0. If not, the corrected result is the read-write pointer difference. The method for calculating the amount of writable data is similar to the above, but there is no need for a correction unit to correct it. It can be directly calculated by subtracting the read pointer and the write pointer synchronized to the write clock domain.

[0126] The asynchronous FIFO with TPRAM interface designed in this application is widely used in scenarios that need to process large data across clock domains, such as data communication, image processing, signal processing and other fields. By providing larger storage space and efficient area utilization, this design can improve the performance and efficiency of the system, meet application scenarios with high requirements for data processing speed and storage capacity, and is suitable for situations where the read and write clock frequencies differ greatly. The implementation of arbitrary depth can greatly optimize the chip area. While using TPRAM as storage space, it also takes into account prefetching and low latency. It can be better suitable for applications that access data with low latency and use scenarios that need to throttle according to the content of the read data.

[0127] It can be seen that the data transmission method in the present application is applied to a preset asynchronous FIFO, the asynchronous FIFO is connected to the data writing end and the data reading end respectively, the asynchronous FIFO includes a first transmission channel and a second transmission channel, the first transmission channel uses the buffer inside the asynchronous FIFO as the data storage space, and the second transmission channel uses the dual-port memory outside the asynchronous FIFO as the data storage space, specifically including: after the asynchronous FIFO is powered on, the first transmission channel is used as the current data transmission channel to transmit the data written by the data writing end to the data reading end; the empty and full status of the buffer in the first transmission channel is monitored, and after monitoring that the buffer is in the data writing state, the second transmission channel is used as the current data transmission channel to use the second transmission channel to transmit the data written by the data writing end to the data reading end; for the first transmission channel, the number of current readable data synchronized from the read clock domain to the write clock domain is counted in real time, if the current number of readable data is lower than the preset lowest watermark, the first transmission channel is used as the current data transmission channel, if the current number of readable data is not lower than the preset lowest watermark, the second transmission channel continues to be used as the current data transmission channel.

[0128] Beneficial effect: The asynchronous FIFO in the present application includes two transmission channels, namely, a first transmission channel using the internal buffer of the asynchronous FIFO as the data storage space and a second transmission channel using the dual-port memory outside the asynchronous FIFO as the data storage space. At the beginning of power-on, the first transmission channel is selected by default for transmission. When it is detected that the buffer of the first transmission channel is in a data-full state, it is switched to the second transmission channel for transmission. After switching to the second transmission channel, if there is continuous data writing, the number of current readable data synchronized from the read clock domain to the write clock domain is counted in real time. If the current number of readable data is lower than the preset minimum watermark, it is switched to the first transmission channel, otherwise the second transmission channel is continued to be used for data transmission. That is, the present application transmits data alternately by using two transmission channels, wherein the first transmission channel uses an internal buffer, and its transmission delay is low, but its storage space is limited. The second transmission channel can support a larger storage capacity requirement, and can save more chip area when the FIFO capacity requirement is large, but its read and write data has a large transmission delay. Therefore, the present application transmits data by switching two transmission channels when the corresponding conditions are met, and achieves the purpose of large-capacity storage and low transmission delay through the mutual cooperation and assistance of the two.

[0129] See also Fig. 9As shown, an embodiment of the present application discloses a data transmission device, which is applied to a preset asynchronous FIFO, wherein the asynchronous FIFO is connected to a data writing end and a data reading end respectively, and the asynchronous FIFO includes a first transmission channel and a second transmission channel, wherein the first transmission channel uses a buffer inside the asynchronous FIFO as a data storage space, and the second transmission channel uses a dual-port memory outside the asynchronous FIFO as a data storage space, and the device includes:

[0130] A first transmission module 11 is used to use the first transmission channel as the current data transmission channel to transmit the data written by the data writing end to the data reading end after the asynchronous FIFO is powered on;

[0131] The second transmission module 12 is used to monitor the empty or full state of the buffer in the first transmission channel, and after monitoring that the buffer is in the data writing state, use the second transmission channel as the current data transmission channel to transmit the data written by the data writing end to the data reading end by using the second transmission channel;

[0132] The third transmission module 13 is used to count in real time the number of current readable data synchronized from the read clock domain to the write clock domain for the first transmission channel. If the current number of readable data is lower than the preset minimum watermark, the first transmission channel is used as the current data transmission channel. If the current number of readable data is not lower than the preset minimum watermark, the second transmission channel continues to be used as the current data transmission channel.

[0133] Since the embodiments of the device part correspond to the above embodiments, please refer to the description of the embodiments of the method part for the embodiments of the device part, and will not be repeated here.

[0134] It can be seen that the data transmission device in the present application is applied to a preset asynchronous FIFO, and the asynchronous FIFO is connected to the data writing end and the data reading end respectively. The asynchronous FIFO includes a first transmission channel and a second transmission channel. The first transmission channel uses the buffer inside the asynchronous FIFO as the data storage space, and the second transmission channel uses the dual-port memory outside the asynchronous FIFO as the data storage space. Specifically, it includes: a first transmission module, which is used to use the first transmission channel as the current data transmission channel after the asynchronous FIFO is powered on, so as to transmit the data written by the data writing end to the data reading end; a second transmission module, which is used to monitor The empty or full state of the buffer in the first transmission channel, after monitoring that the buffer is in a data-full state, uses the second transmission channel as the current data transmission channel, so as to use the second transmission channel to transmit the data written by the data writing end to the data reading end; a third transmission module is used to count the current number of readable data synchronized from the reading clock domain to the writing clock domain for the first transmission channel in real time, if the current number of readable data is lower than the preset lowest watermark, use the first transmission channel as the current data transmission channel, if the current number of readable data is not lower than the preset lowest watermark, continue to use the second transmission channel as the current data transmission channel.

[0135] Beneficial effect: The asynchronous FIFO in the present application includes two transmission channels, namely, a first transmission channel using the internal buffer of the asynchronous FIFO as the data storage space and a second transmission channel using the dual-port memory outside the asynchronous FIFO as the data storage space. At the beginning of power-on, the first transmission channel is selected by default for transmission. When it is detected that the buffer of the first transmission channel is in a data-full state, it is switched to the second transmission channel for transmission. After switching to the second transmission channel, if there is continuous data writing, the number of current readable data synchronized from the read clock domain to the write clock domain is counted in real time. If the current number of readable data is lower than the preset minimum watermark, it is switched to the first transmission channel, otherwise the second transmission channel is continued to be used for data transmission. That is, the present application transmits data alternately by using two transmission channels, wherein the first transmission channel uses an internal buffer, and its transmission delay is low, but its storage space is limited. The second transmission channel can support a larger storage capacity requirement, and can save more chip area when the FIFO capacity requirement is large, but its read and write data has a large transmission delay. Therefore, the present application transmits data by switching two transmission channels when the corresponding conditions are met, and achieves the purpose of large-capacity storage and low transmission delay through the mutual cooperation and assistance of the two.

[0136] Fig.10A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Specifically, it may 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 relevant steps in the data transmission method performed by the electronic device disclosed in any of the aforementioned embodiments.

[0137] In this 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 the external device, and the communication protocol it follows is any communication protocol that can be applied to the technical solution of the present application, and is not specifically limited here; the input and output interface 25 is used to obtain external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs and is not specifically limited here.

[0138] Among them, the processor 21 may 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 hardware form of DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array). The processor 21 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the awake state, also known as a CPU (Central Processing Unit); the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 21 may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 21 may also include an AI (Artificial Intelligence) processor, which is used to process computing operations related to machine learning.

[0139] In addition, the memory 22, as a carrier for storing resources, can be a read-only memory, a random access memory, a 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 method can be temporary storage or permanent storage.

[0140] Among them, the operating system 221 is used to manage and control the hardware devices and computer programs 222 on the electronic device 20, so as to realize the operation and processing of the massive data 223 in the memory 22 by the processor 21, which can be Windows, Unix, Linux, etc. In addition to including a computer program that can be used to complete the data transmission method performed by the electronic device 20 disclosed in any of the aforementioned embodiments, the computer program 222 can also further include a computer program that can be used to complete other specific tasks. In addition to data transmitted from an external device received by the electronic device, the data 223 can also include data collected by its own input and output interface 25, etc.

[0141] Furthermore, an embodiment of the present application also discloses a computer-readable storage medium, in which a computer program is stored. When the computer program is loaded and executed by a processor, the steps of the data transmission method disclosed in any of the aforementioned embodiments are implemented.

[0142] Furthermore, an embodiment of the present application also discloses a computer program product, including a computer program / instruction, which, when executed by a processor, implements the steps of the data transmission method disclosed in any of the aforementioned embodiments.

[0143] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.

[0144] Those skilled in the art may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented with electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of function in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0145] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a compact disc read-only memory (CD-ROM), or any other form of storage medium known in the art.

[0146] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.

[0147] The above is a detailed introduction to a data transmission method, device, equipment and storage medium provided by the present invention. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea; at the same time, for a person skilled in the art, according to the idea of ​​the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.

Claims

1. A data transmission method, characterized in that: The method is applied to a preset asynchronous FIFO, wherein the asynchronous FIFO is connected to a data writing end and a data reading end respectively, wherein the asynchronous FIFO comprises a first transmission channel and a second transmission channel, wherein the first transmission channel uses a buffer inside the asynchronous FIFO as a data storage space, and the second transmission channel uses a dual-port memory outside the asynchronous FIFO as a data storage space, and wherein the method comprises: After the asynchronous FIFO is powered on, the first transmission channel is used as a current data transmission channel to transmit the data written by the data writing end to the data reading end; monitoring the empty or full state of the buffer in the first transmission channel, and after monitoring that the buffer is in a data-written state, using the second transmission channel as the current data transmission channel to transmit the data written by the data writing end to the data reading end by using the second transmission channel; For the first transmission channel, the current number of readable data synchronized from the read clock domain to the write clock domain is counted in real time. If the current number of readable data is lower than the preset minimum watermark, the first transmission channel is used as the current data transmission channel. If the current number of readable data is not lower than the preset minimum watermark, the second transmission channel continues to be used as the current data transmission channel.

2. The data transmission method according to claim 1, characterized in that: If the current number of readable data is not lower than the preset lowest watermark, then the second transmission channel is continued to be used as the current data transmission channel, the method further includes: Monitoring the empty and full status of the dual-port memory in the second transmission channel; If it is monitored that the dual-port memory is in a data full state and the current number of readable data in the first transmission channel is not lower than the lowest watermark, it is determined that the asynchronous FIFO is in a data full state and the data writing operation of the data writing end is stopped.

3. The data transmission method according to claim 1, characterized in that: Also includes: Determining a first storage depth corresponding to a buffer in the first transmission channel; determining the lowest water level based on the first storage depth; The lowest water level does not exceed the first storage depth; The process of determining the first storage depth includes: Determine the first data number that can be read within two write clocks; Determine the number of second data that can be read within the total duration of two write clocks and two read clocks; The first storage depth is determined based on the first data number and the second data number.

4. The data transmission method according to claim 1, characterized in that: The calculation process of the head pointer and the tail pointer of the dual-port memory includes: Determine a second storage depth corresponding to the asynchronous FIFO according to the target demand information, so as to determine a third storage depth corresponding to the dual-port memory in the second transmission channel based on the second storage depth; Calculating a head pointer and a tail pointer of the dual-port memory based on the third storage depth by using the first calculation formula and the second calculation formula; Wherein, the first calculation formula is: Head pointer = 2 × pointer width of dual-port memory – third memory depth; The second calculation formula is: Tail pointer = pointer width of dual-port memory + third storage depth.

5. The data transmission method according to claim 1, characterized in that: The second transmission channel includes a write data cache space connected to the input port, the dual-port memory connected to the write data cache space, and a read data cache space connected to the dual-port memory and to the output port; wherein the input port and the output port are connected to the data write end and the data read end respectively; Correspondingly, the process of transmitting the data written by the data writing end to the data reading end by using the second transmission channel includes: storing the data written by the data writing end through the input port into the write data cache space at the current write clock, and writing the data into the dual-port memory at the next write clock; When it is detected that the dual-port memory is in a data non-empty state, reading data from the dual-port memory based on a current read clock, and storing the read data into the read data cache space; The data in the read data buffer space is read to the output port at the next read clock.

6. The data transmission method according to claim 5, characterized in that: Also includes: When a preset condition is met, reading data from the dual-port memory; The preset condition is any one of the first target condition, the second target condition and the third target condition; wherein, the first target condition is that the dual-port memory changes from an empty state to a data non-empty state, the second target condition is that there is a read enable for the asynchronous FIFO and the read data cache space is in a data non-empty state, and the third target condition is that there is no read enable for the asynchronous FIFO and there is readable data on the output port.

7. The data transmission method according to any one of claims 1 to 6, characterized in that: The calculation process of the readable data volume and the writable data volume in the first transmission channel is: Performing a difference operation on a write pointer and a read pointer synchronized from a write clock domain to a read clock domain to obtain a first operation result, and using the first operation result as the amount of readable data in the first transmission channel; Performing a difference operation on a read pointer and a write pointer synchronized from a read clock domain to a write clock domain to obtain a second operation result, and using the second operation result as the amount of writable data in the first transmission channel; The calculation process of the readable data volume and the writable data volume in the second transmission channel is: Converting a write pointer from a binary coded address to a Gray code coded address in the write clock domain, synchronizing the converted write pointer to the read clock domain, and restoring the converted write pointer to a binary coded address in the read clock domain, performing a difference operation with the read pointer to obtain a third operation result; Modifying the third operation result based on the read enable of the asynchronous FIFO to obtain a modified result, and using the modified result as the readable data amount in the second transmission channel; Converting a read pointer from a binary coded address to a Gray code coded address in the read clock domain, synchronizing the converted read pointer to the write clock domain, and restoring the converted read pointer to a binary coded address in the write clock domain, performing a difference operation with the write pointer to obtain a fourth operation result; The fourth operation result is used as the writable data amount in the second transmission channel.

8. A data transmission device, characterized in that: The device is applied to a preset asynchronous FIFO, wherein the asynchronous FIFO is connected to a data writing end and a data reading end respectively, wherein the asynchronous FIFO comprises a first transmission channel and a second transmission channel, wherein the first transmission channel uses a buffer inside the asynchronous FIFO as a data storage space, and the second transmission channel uses a dual-port memory outside the asynchronous FIFO as a data storage space, and wherein the device comprises: A first transmission module, configured to use the first transmission channel as a current data transmission channel to transmit the data written by the data writing end to the data reading end after the asynchronous FIFO is powered on; a second transmission module, configured to monitor the empty or full state of the buffer in the first transmission channel, and after monitoring that the buffer is in a data-full state, use the second transmission channel as the current data transmission channel to transmit the data written by the data writing end to the data reading end by using the second transmission channel; The third transmission module is used to count in real time the number of current readable data synchronized from the read clock domain to the write clock domain for the first transmission channel. If the current number of readable data is lower than the preset minimum watermark, the first transmission channel is used as the current data transmission channel. If the current number of readable data is not lower than the preset minimum watermark, the second transmission channel continues to be used as the current data transmission channel.

9. An electronic device, characterized in that: include: Memory, used to store computer programs; A processor, configured to execute the computer program to implement the steps of the data transmission method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: Used to store computer programs; wherein, when the computer program is executed by a processor, the steps of the data transmission method according to any one of claims 1 to 7 are implemented.

Citation Information

Cited By

  • Real-time data read-write method of on-chip logic analyzer and related device

    CN119849393A

  • Cross-power-domain asynchronous FIFO data transmission circuit, method and device

    CN122633145A

  • A data transmission circuit, method and device of a cross-power-domain asynchronous FIFO

    CN122633145B