A data cache transmission method and system with adaptive data bandwidth

By using an adaptive data bandwidth data buffering transmission method and employing a channel arbitration module and status register for flow control, the problems of data loss and resource waste in the transmission of different types of data on the same bus are solved, thus achieving reliable and real-time data transmission.

CN118626293BActive Publication Date: 2024-11-12CHENGDU LINGMU TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411090004.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-09
Publication Date
2024-11-12
Estimated Expiration
2044-08-09

AI Technical Summary

Technical Problem

Existing technologies lack flow control mechanisms when transmitting different types of data in real time on the same bus, leading to data loss, waste of hardware resources and CPU performance consumption. They also cannot effectively utilize DDR as a buffer and cannot promptly alert to data transmission reliability issues.

Method used

An adaptive data bandwidth data buffering transmission method is adopted. The DDR channel is cyclically judged by the channel arbitration module, and the flow control is performed by the status register to record the amount of data transmitted by the FPGA and retrieved by the CPU, so as to ensure the correctness of data transmission.

Benefits of technology

It ensures no data loss during multi-channel data transmission at different rates, avoids wasting hardware resources, improves the reliability and real-time performance of data transmission, and reduces CPU performance consumption.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118626293B_ABST
    Figure CN118626293B_ABST
Patent Text Reader

Abstract

The invention provides a data cache transmission method and system with adaptive data bandwidth, which relates to the field of data transmission and comprises the following steps: S1: FPGA judges in sequence whether the data amount of data to be currently transmitted in a DDR channel is greater than a threshold data amount according to the sorting order of a DDR channel; S2: judges whether the data amount of data to be currently transmitted is greater than the remaining memory space of a corresponding DMA memory space, if so, turns to step S1, if not, turns to step S3; S3: obtains the current FPGA transmitted data amount from a status register, and calculates the write start address of the current data amount to be transmitted into the corresponding DMA memory space according to the current FPGA transmitted data amount, the current data amount to be transmitted and the threshold data amount; S4: updates the status register; thereby, the data transmission process is flow controlled through the status register, so as to facilitate recording of the FPGA transmitted data amount and the CPU taken data amount, avoid data loss, and ensure the correctness of data transmission.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data transmission, and in particular to a data cache transmission method and system for adaptive data bandwidth. Background Art

[0002] In the field of signal acquisition and processing, there are many different types of data with very different data rates. For example, the data rate of the fast channel is 2GB / s, and the data rate of the slow channel is 20KB / s. For the real-time transmission of two different types of data on the same bus, the commonly used mechanism is to use the CPU to periodically query how much data each channel of the DEVICE (FPGA) has transmitted to the computer, and then the computer takes the data away. However, this mechanism currently has the following problems:

[0003] 1. Without flow control, a slight downward fluctuation in CPU performance may cause data to be overwritten by the device, resulting in data loss;

[0004] 2. Without flow control, there is no alarm for data loss, and users cannot know whether data transmission is reliable;

[0005] 3. Without flow control, the DDR in the device cannot be used as a buffer, resulting in a waste of hardware resources;

[0006] 4. Although polling improves the real-time performance of data transmission, it also consumes CPU performance. It basically occupies one core specifically for polling data transmission tags, wasting hardware resources. Summary of the invention

[0007] The purpose of the present invention is to provide a data cache transmission method and system with adaptive data bandwidth. The method mainly allows data of different rates to enter a channel arbitration module through corresponding DDR channels, and the channel arbitration module performs cyclic judgment and output on the data to be transmitted in each channel, and in the output process, flow control is performed through a status register, so as to facilitate recording of the amount of data transmitted by FPGA and the amount of data taken away by CPU, avoid data loss, and ensure the correctness of data transmission.

[0008] In order to solve the above technical problems, the present invention adopts the following solutions:

[0009] A data cache transmission method with adaptive data bandwidth, the method specifically comprising the following steps:

[0010] S0: FPGA obtains the current data to be transmitted in all DDR channels, and each DDR channel has its own channel number. All DDR channels are sorted in sequence according to the channel number.

[0011] S1: FPGA obtains the current data to be transmitted in the DDR channel in sequence according to the sorting order of the DDR channel, and determines whether the data volume of the current data to be transmitted is greater than the threshold data volume. If so, the current data to be transmitted is recorded and the process goes to step S2;

[0012] S2: Obtain the remaining memory space of the corresponding DMA memory space according to the DDR channel where the current data to be transmitted is located, and determine whether the amount of the current data to be transmitted is greater than the remaining memory space of the corresponding DMA memory space. If so, go to step S1 and obtain the current data to be transmitted in the next DDR channel. If not, go to step S3;

[0013] S3: FPGA obtains the current FPGA transmitted data amount from the corresponding status register, and calculates the write start address of the current data amount to be transmitted and writes it into the corresponding DMA memory space according to the current FPGA transmitted data amount, the current data amount to be transmitted and the threshold data amount;

[0014] S4: FPGA transmits the current data to be transmitted to the CPU through the high-speed bus for data writing, and at the same time, updates the current FPGA transmitted data amount recorded in the corresponding status register.

[0015] Furthermore, the DMA memory space corresponds one-to-one to DDR channels with different channel numbers. The DMA memory space is a DMA memory space with a total address length of CNT*L, where CNT represents the number of cache blocks and L represents the address length of the cache block, so that the DMA memory space is composed of CNT cache blocks with the same address length in sequence, and each cache block has a base address.

[0016] Further, in S3, the specific process of calculating the write start address of the current amount of data to be transmitted and writing it into the corresponding DMA memory space according to the current amount of data transmitted by the FPGA, the current amount of data to be transmitted and the threshold amount of data includes the following steps:

[0017] SA1: Obtain the number of cache blocks in the DMA memory space corresponding to the DDR channel where the data to be transmitted is located, the address length of the cache block, and the base address of each cache block;

[0018] SA2: According to the multiple relationship between the address length of the cache block and the threshold data volume, the address length of each cache block is converted into K area blocks with the threshold data volume as the memory space size;

[0019] SA3: obtaining a preset FPGA transmitted data amount according to the current data amount to be transmitted and the corresponding current FPGA transmitted data amount, converting the preset FPGA transmitted data amount into N transmission data amounts transmitted at the threshold data amount according to the multiple relationship between the preset FPGA transmitted data amount and the threshold data amount, and sorting the N transmission data amounts in sequence;

[0020] SA4: Calculate the transmission data in sequence according to the number of cache blocks, the number of region blocks in each cache block, the base address of the cache block, and the sorting order of the transmission data to obtain the write start address in the DMA memory space corresponding to the transmission data.

[0021] Further, in SA3, the specific process of obtaining the preset FPGA transmitted data amount according to the current amount of data to be transmitted and the corresponding current FPGA transmitted data amount is:

[0022] Assuming that the FPGA transmits the current amount of data to be transmitted to the CPU through a high-speed bus for data writing, the current FPGA transmitted data amount recorded in the corresponding status register is updated, that is, the updated FPGA transmitted data amount is the recorded current FPGA transmitted data amount plus the current amount of data to be transmitted, and then the updated FPGA transmitted data amount is used as the preset FPGA transmitted data amount.

[0023] Further, the status register corresponds one-to-one to DDR channels with different channel numbers, and the status register consists of a pair of transmitted data amount register and taken data amount register;

[0024] When the FPGA transmits the current data to be transmitted to the CPU through the high-speed bus for data writing, the FPGA transmitted data amount recorded in the transmitted data amount register is synchronously updated, and the CPU removed data amount recorded in the removed data amount register is synchronously updated.

[0025] Furthermore, the transmitted data amount register is used to record data transmitted by the FPGA to the CPU. The FPGA updates the current FPGA transmitted data amount in the transmitted data amount register, so that the CPU can read the current FPGA transmitted data amount in the transmitted data amount register.

[0026] Furthermore, the data amount register taken away is used to record data written by the CPU, and the CPU updates the data amount taken away by the current CPU in the data amount register taken away, so that the FPGA can read the data amount taken away by the current CPU in the data amount register taken away.

[0027] Furthermore, the method further includes step S5, wherein step S5 is: after the FPGA sends all the data to be transmitted to the DMA space via the high-speed bus, a completion interrupt signal is issued.

[0028] A data cache transmission system with adaptive data bandwidth, comprising:

[0029] Data acquisition module: FPGA obtains the current data to be transmitted in all DDR channels, and each DDR channel has its own channel number. All DDR channels are sorted in sequence according to the channel number.

[0030] Channel arbitration module: FPGA obtains the current data to be transmitted in the DDR channel in sequence according to the sorting order of the DDR channel, and determines whether the amount of the current data to be transmitted is greater than the threshold data amount. If so, the current data to be transmitted is transmitted;

[0031] DMA memory space judgment module: obtains the remaining memory space of the corresponding DMA memory space according to the DDR channel where the current data to be transmitted is located, and judges whether the data volume of the current data to be transmitted is greater than the remaining memory space of the corresponding DMA memory space;

[0032] Write start address calculation module: FPGA obtains the current FPGA transmitted data amount from the corresponding status register, and calculates the write start address of the current data amount to be transmitted into the corresponding DMA memory space according to the current FPGA transmitted data amount, the current data amount to be transmitted and the threshold data amount;

[0033] Data transmission update module: FPGA transmits the current data to be transmitted to the CPU through the high-speed bus for data writing, and at the same time, updates the current FPGA transmitted data amount recorded in the corresponding status register.

[0034] Beneficial effects of the present invention:

[0035] The present invention provides a data cache transmission method and system with adaptive data bandwidth. The method mainly allows data of different rates to enter a channel cycle arbitration module through corresponding DDR channels. The channel cycle arbitration module performs cycle judgment on all DDR channels to ensure data transmission on a single channel. A flow control mechanism can also be used for each channel so that a single channel can cache data. In addition, flow control is performed through a status register during the output process, which is convenient for recording the amount of data transmitted by the FPGA and the amount of data taken away by the CPU, avoiding data loss, so as to ensure the correctness of data transmission. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] Figure 1The figure is a flow chart of a data cache transmission method with adaptive data bandwidth in Embodiment 1 of the present invention.

[0037] Figure 2 This is a schematic diagram of the interaction between the FPGA and the CPU in Example 1 of the present invention.

[0038] Figure 3 This is a schematic diagram of two cache blocks with discontinuous addresses in Embodiment 1 of the present invention. DETAILED DESCRIPTION

[0039] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments. The following description of at least one exemplary embodiment is actually only illustrative and is by no means intended to limit the present invention and its application or use. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0040] The relative arrangement of components and steps, the numerical expressions and numerical values ​​set forth in these embodiments do not limit the scope of the present invention unless specifically stated otherwise.

[0041] At the same time, it should be understood that for the convenience of description, the sizes of the various parts shown in the drawings are not drawn according to the actual proportional relationship.

[0042] Additionally, descriptions of well-known structures, functions, and configurations may be omitted for clarity and conciseness.One of ordinary skill in the art will recognize that various changes and modifications may be made to the examples described herein without departing from the spirit and scope of the present disclosure.

[0043] Technologies, methods, and apparatus known to ordinary technicians in the relevant field may not be discussed in detail, but where appropriate, such technologies, methods, and apparatus should be considered part of the authorization specification.

[0044] In all examples shown and discussed herein, any specific values ​​should be interpreted as merely exemplary and not as limiting. Therefore, other examples of the exemplary embodiments may have different values.

[0045] The present invention will be described in detail below with reference to the accompanying drawings and in conjunction with embodiments:

[0046] Example 1

[0047] like Figure 1 As shown, a data cache transmission method with adaptive data bandwidth includes the following steps:

[0048] S0: FPGA obtains the current data to be transmitted in all DDR channels, and each DDR channel has its own channel number. All DDR channels are sorted in sequence according to the channel number.

[0049] S1: FPGA obtains the current data to be transmitted in the DDR channel in sequence according to the sorting order of the DDR channel, and determines whether the data volume of the current data to be transmitted is greater than the threshold data volume. If so, the current data to be transmitted is recorded and the process goes to step S2;

[0050] S2: Obtain the remaining memory space of the corresponding DMA memory space according to the DDR channel where the current data to be transmitted is located, and determine whether the amount of the current data to be transmitted is greater than the remaining memory space of the corresponding DMA memory space. If so, go to step S1 and obtain the current data to be transmitted in the next DDR channel. If not, go to step S3;

[0051] S3: FPGA obtains the current FPGA transmitted data amount from the corresponding status register, and calculates the write start address of the current data amount to be transmitted and writes it into the corresponding DMA memory space according to the current FPGA transmitted data amount, the current data amount to be transmitted and the threshold data amount;

[0052] S4: FPGA transmits the current data to be transmitted to the CPU through the high-speed bus for data writing, and at the same time, updates the current FPGA transmitted data amount recorded in the corresponding status register.

[0053] Preferably, the DMA memory space corresponds one-to-one to DDR channels with different channel numbers, and the DMA memory space is a DMA memory space with a total address length of CNT*L, CNT represents the number of cache blocks, and L represents the address length of the cache block, so that the DMA memory space is composed of CNT cache blocks with the same address length in sequence, and each cache block has a base address.

[0054] Preferably, in S3, the specific process of calculating the write start address of the current amount of data to be transmitted and writing it into the corresponding DMA memory space according to the current amount of data transmitted by the FPGA, the current amount of data to be transmitted and the threshold amount of data includes the following steps:

[0055] SA1: Obtain the number of cache blocks in the DMA memory space corresponding to the DDR channel where the data to be transmitted is located, the address length of the cache block, and the base address of each cache block;

[0056] SA2: According to the multiple relationship between the address length of the cache block and the threshold data volume, the address length of each cache block is converted into K area blocks with the threshold data volume as the memory space size;

[0057] SA3: obtaining a preset FPGA transmitted data amount according to the current data amount to be transmitted and the corresponding current FPGA transmitted data amount, converting the preset FPGA transmitted data amount into N transmission data amounts transmitted at the threshold data amount according to the multiple relationship between the preset FPGA transmitted data amount and the threshold data amount, and sorting the N transmission data amounts in sequence;

[0058] SA4: Calculate the transmission data in sequence according to the number of cache blocks, the number of region blocks in each cache block, the base address of the cache block, and the sorting order of the transmission data to obtain the write start address in the DMA memory space corresponding to the transmission data.

[0059] Preferably, in SA3, the specific process of obtaining the preset FPGA transmitted data amount according to the current amount of data to be transmitted and the corresponding current FPGA transmitted data amount is:

[0060] Assuming that the FPGA transmits the current amount of data to be transmitted to the CPU through a high-speed bus for data writing, the current FPGA transmitted data amount recorded in the corresponding status register is updated, that is, the updated FPGA transmitted data amount is the recorded current FPGA transmitted data amount plus the current amount of data to be transmitted, and then the updated FPGA transmitted data amount is used as the preset FPGA transmitted data amount.

[0061] Preferably, the status register corresponds one-to-one to DDR channels with different channel numbers, and the status register consists of a pair of transmitted data amount register and taken data amount register;

[0062] When the FPGA transmits the current data to be transmitted to the CPU through the high-speed bus for data writing, the FPGA transmitted data amount recorded in the transmitted data amount register is synchronously updated, and the CPU removed data amount recorded in the removed data amount register is synchronously updated.

[0063] Preferably, the transmitted data amount register is used to record data transmitted by the FPGA to the CPU, and the FPGA updates the current FPGA transmitted data amount in the transmitted data amount register, so that the CPU can read the current FPGA transmitted data amount in the transmitted data amount register.

[0064] Preferably, the data amount register taken away is used to record data written by the CPU, and the CPU updates the data amount taken away by the current CPU in the data amount register taken away, so that the FPGA can read the data amount taken away by the current CPU in the data amount register taken away.

[0065] Preferably, the method further includes step S5, wherein the step S5 is: after the FPGA sends all the data to be transmitted to the DMA space via the high-speed bus, a completion interrupt signal is issued.

[0066] Based on the above principles, the present invention is further described:

[0067] In the field of signal acquisition and processing, there are many different types of data with very different data rates. For example, the data rate of the fast channel is 2GB / s, and the data rate of the slow channel is 20KB / s. For the real-time transmission of two different types of data on the same bus, the commonly used mechanism is to use the CPU to periodically query how much data each channel of the DEVICE (FPGA) has transmitted to the computer, and then the computer takes the data away. However, this mechanism currently has the following problems:

[0068] 1. Without flow control, a slight downward fluctuation in CPU performance may cause data to be overwritten by the device, resulting in data loss;

[0069] 2. Without flow control, there is no alarm for data loss, and users cannot know whether data transmission is reliable;

[0070] 3. Without flow control, the DDR in the device cannot be used as a buffer, resulting in a waste of hardware resources;

[0071] 4. Although polling improves the real-time performance of data transmission, it also consumes CPU performance. It basically occupies one core specifically for polling data transmission tags, wasting hardware resources.

[0072] Therefore, the present invention provides a data cache transmission method and system with adaptive data bandwidth for real-time transmission of two different types of data on the same bus. The method mainly allows data of different rates to enter a channel arbitration module through corresponding DDR channels. The channel arbitration module performs cyclic judgment on the data to be transmitted in all DDR channels. Specifically, it mainly judges in sequence whether the data amount of the current data to be transmitted in the DDR channel is greater than the threshold data amount and whether it is greater than the remaining memory space of the corresponding DMA memory space. The threshold data amount refers to the preset channel arbitration data amount, and the remaining memory space of the DMA memory space refers to the amount of data that can be written in the current DMA memory space. If the data amount of the current data to be transmitted is greater than the threshold data amount and will not be in the remaining memory space of the corresponding DMA memory space, it means that the data amount of the current data to be transmitted in the DDR channel can be transmitted through the channel arbitration module. Otherwise, it will be circulated to the next DDR channel for judgment to ensure data transmission on a single channel. In addition, in the process of data transmission in each single channel, a flow control mechanism is adopted for the data transmission process through the status register corresponding to the DDR channel to avoid the above technical problems.

[0073] In this embodiment, the present invention is mainly used for data transmission between FPGA and CPU, and is applicable to any type of CPU and FPGA. Figure 2 As shown, data of different rates enter the channel arbitration module through their respective DDR channels, and then the channel arbitration module performs channel cycle judgment on all DDR channels, selects and outputs the current amount of data to be transmitted in a single channel, so that the current amount of data to be transmitted enters the CPU through the packet sending module under the flow control of the status register, and when the CPU receives a new amount of transmission data, it will pull up an interrupt signal to notify the CPU that new data has entered, and then transmit the data to the packet receiving module for the host computer to read the data.

[0074] In addition, a status register corresponding to the DDR channel is provided in the FPGA, and the status register is composed of a pair of transmitted data amount registers and removed data amount registers. When the FPGA transmits the current data to be transmitted to the CPU through the high-speed bus for data writing, the FPGA transmitted data amount recorded in the transmitted data amount register is synchronously updated, and the CPU removed data amount recorded in the removed data amount register is synchronously updated, so that the FPGA transmission data is recorded in the transmitted data amount register, and the CPU removed data is recorded in the removed data amount register.

[0075] When the FPGA transmits the current data to be transmitted to the CPU through the high-speed bus for data writing, it is necessary to write the data according to the write start address of the current data to be transmitted. Therefore, before writing the data, first, it is necessary to obtain the write start address of the current data to be transmitted and write it into the corresponding DMA memory space. In this embodiment, the DMA memory space corresponds one-to-one to the DDR channels with different channel numbers. The DMA memory space is a DMA memory space with a total address length of CNT*L, CNT represents the number of cache blocks, and L represents the address length of the cache block, so that the DMA memory space is composed of CNT cache blocks with the same address length in sequence, and each cache block has a base address.

[0076] Specifically, Figure 3 As shown, there are 2 cache blocks in the DMA memory space, and the address length of each cache block is 2M. It can be seen from the figure that the addresses between the two cache blocks are not continuous, so it is necessary to calculate which cache block the current amount of data to be transmitted should be written into, and then get the specific address of the current amount of data to be transmitted in the cache block, so as to write the current amount of data to be transmitted.

[0077] Since the data to be transmitted by the FPGA is transmitted through the channel arbitration module, the data to be transmitted by the FPGA is usually transmitted in data packets in sequence according to a certain data amount determined by the channel arbitration module. Figure 3 On the basis of, it is assumed that this time 3M of current data to be transmitted is to be written starting from the base address 0x0000_0000 of the first cache block, and the threshold data amount is 4KB.

[0078] Based on the above, the calculation and writing process of the write start address of the current amount of data to be transmitted written into the corresponding DMA memory space is calculated according to the current amount of data transmitted by the FPGA, the current amount of data to be transmitted and the threshold amount of data as follows:

[0079] The first step is to obtain the number of cache blocks in the DMA memory space corresponding to the DDR channel where the current data to be transmitted is located, which is 2, the address length of the cache block is 2M, the base address of the first cache block is 0x0000_0000, and the base address of the second cache block is 0x8000_0000;

[0080] Step 2: According to the multiple relationship between the address length of the cache block and the threshold data volume, the address length of each cache block is converted into K area blocks with the threshold data volume as the memory space size. The conversion formula is as follows: K=2M / 4KB=512;

[0081] Step 3: According to the current amount of data to be transmitted and the corresponding amount of data transmitted by the current FPGA, the preset amount of data transmitted by the FPGA is obtained; according to the multiple relationship between the preset amount of data transmitted by the FPGA and the threshold data amount, the preset amount of data transmitted by the FPGA is converted into N amounts of transmission data transmitted at the threshold data amount, and the N amounts of transmission data are sorted in sequence;

[0082] Specifically, assuming that the FPGA transmits the current amount of data to be transmitted to the CPU through the high-speed bus for data writing, the current amount of data transmitted by the FPGA recorded in the corresponding status register is updated, that is, the updated amount of data transmitted by the FPGA is the recorded amount of data transmitted by the current FPGA plus the current amount of data to be transmitted, and then the updated amount of data transmitted by the FPGA is used as the preset amount of data transmitted by the FPGA;

[0083] In this embodiment, assuming that the current FPGA transmitted data amount recorded in the status register is 0, and the current data amount to be transmitted is 4KB, the current FPGA transmitted data amount recorded in the status register is updated, and the preset FPGA transmitted data amount is obtained to be 4KB, then the number of 4KB of data converted to arbitration transmission is: N = 4KB / 4KB=1;

[0084] The fourth step is to calculate the transmission data in turn according to the number of cache blocks, the number of regional blocks in each cache block, the base address of the cache block and the sorting order of the transmission data, and obtain the write start address in the DMA memory space corresponding to the transmission data. Specifically, first, it is necessary to calculate the cache block number to which the transmission data should be written after the arbitration transmission, and the cache block number and the base address are stored in a mapping table, so the corresponding base address can be obtained through the cache block number. Then, according to the base address of the cache block to which the transmission data should be written, the write start address to which the transmission data should be written in the cache block can be obtained. The specific calculation formula is as follows:

[0085] idx=((N-1) / K)%CNT=((1-1) / 512)%2=0;

[0086] Address=f(idx)+((N-1)%K)*4KB

[0087] =0x0000_0000+((1-1)%512)*4KB

[0088] =0x0000_0000+0x0000_0000;

[0089] Through the above formula, it can be obtained that when the current FPGA transmitted data amount recorded in the status register is 0, when the FPGA transfers the current data amount to be transmitted of 4KB to the CPU for data writing, the current data amount to be transmitted should be written into the first cache block in the corresponding DMA memory space, and the writing starts from 0x0000_0000 as the starting address, and the current FPGA transmitted data amount recorded in the corresponding status register is updated to 4KB.

[0090] Next, when the current FPGA has transmitted 4KB of data, the second 4KB of data is transmitted. The write start address of the transmission data is:

[0091] idx=((N-1) / K)%CNT=((2-1) / 512)%2, substitute idx into the mapping table to get the base address 0x0000_0000;

[0092] Address=f(idx)+((N-1)%K)*4KB

[0093] =0x0000_0000+((2-1)%512)*4KB

[0094] =0x0000_0000+0x0000_1000;

[0095] By analogy, the write starting address of N transmission data amounts can be obtained, and the N transmission data amounts are transmitted to the CPU through the high-speed bus in turn for data writing. When the N transmission data amounts are transmitted successfully, it means that the current data amount to be transmitted this time is all sent to the corresponding DMA memory space for storage. At this time, a completion interrupt signal can also be sent to remind the CPU that new data has entered to avoid data loss.

[0096] In summary, the present invention provides a data cache transmission method with adaptive data bandwidth, which adopts a technical means with a flow control mechanism. When the CPU software processing performance fluctuates, the CPU DDR may be full on the high-speed channel. Through the flow control mechanism, the data is temporarily cached in the FPGA DDR. In addition, the method has the following advantages:

[0097] 1. When multiple unrelated large-bandwidth data and small-bandwidth data are transmitted simultaneously, it can ensure the real-time performance of small-bandwidth data and prevent the loss of large-bandwidth data;

[0098] 2. You can use software interrupts or hardware interrupts;

[0099] 3. The CPU uses discrete physical continuous addresses to perform DMA transmission with the FPGA to solve the problem that the operating system cannot apply for large segments of continuous physical addresses;

[0100] 4. When the processor interrupt capability is far lower than the theoretical number of interrupts generated by the data (i.e., there are lost interrupts), the correct transmission of data can still be guaranteed (solved by designing a reasonable interaction mechanism);

[0101] 5. The transmission architecture is not picky about CPU and FPGA (it only needs an architecture with DMA, interrupt, and DDR).

[0102] Example 2

[0103] A data cache transmission system with adaptive data bandwidth, comprising:

[0104] Data acquisition module: FPGA obtains the current data to be transmitted in all DDR channels, and each DDR channel has its own channel number. All DDR channels are sorted in sequence according to the channel number.

[0105] Channel arbitration module: FPGA obtains the current data to be transmitted in the DDR channel in sequence according to the sorting order of the DDR channel, and determines whether the amount of the current data to be transmitted is greater than the threshold data amount. If so, the current data to be transmitted is transmitted;

[0106] DMA memory space judgment module: obtains the remaining memory space of the corresponding DMA memory space according to the DDR channel where the current data to be transmitted is located, and judges whether the data volume of the current data to be transmitted is greater than the remaining memory space of the corresponding DMA memory space;

[0107] Write start address calculation module: FPGA obtains the current FPGA transmitted data amount from the corresponding status register, and calculates the write start address of the current data amount to be transmitted into the corresponding DMA memory space according to the current FPGA transmitted data amount, the current data amount to be transmitted and the threshold data amount;

[0108] Data transmission update module: FPGA transmits the current data to be transmitted to the CPU through the high-speed bus for data writing, and at the same time, updates the current FPGA transmitted data amount recorded in the corresponding status register.

[0109] The above description is only a preferred embodiment of the present invention and does not limit the present invention in any form. According to the technical essence of the present invention, within the spirit and principles of the present invention, any simple modification, equivalent replacement and improvement made to the above embodiment still falls within the protection scope of the technical solution of the present invention.

Claims

1. A data cache transmission method with adaptive data bandwidth, characterized in that: The method specifically comprises the following steps: S0: FPGA obtains the current data to be transmitted in all DDR channels, and each DDR channel has its own channel number. All DDR channels are sorted in sequence according to the channel number. S1: FPGA obtains the current data to be transmitted in the DDR channel in sequence according to the sorting order of the DDR channel, and determines whether the data volume of the current data to be transmitted is greater than the threshold data volume. If so, the current data to be transmitted is recorded and the process goes to step S2; S2: according to the DDR channel where the current data to be transmitted is located, the remaining memory space of the corresponding DMA memory space is obtained, and the DMA memory space corresponds to the DDR channels with different channel numbers one by one, and it is determined whether the amount of the current data to be transmitted is greater than the remaining memory space of the corresponding DMA memory space. If so, go to step S1 and obtain the current data to be transmitted in the next DDR channel. If not, go to step S3; S3: FPGA obtains the current FPGA transmitted data amount from the corresponding status register, and calculates the write start address of the current data amount to be transmitted into the corresponding DMA memory space according to the current FPGA transmitted data amount, the current data amount to be transmitted and the threshold data amount. The status register corresponds to the DDR channels with different channel numbers one by one. S4: FPGA transmits the current data to be transmitted to the CPU through the high-speed bus for data writing, and at the same time, updates the current FPGA transmitted data amount recorded in the corresponding status register.

2. The data cache transmission method with adaptive data bandwidth according to claim 1, characterized in that: The DMA memory space is a DMA memory space with a total address length of CNT*L, where CNT represents the number of cache blocks and L represents the address length of the cache block, so that the DMA memory space is composed of CNT cache blocks with the same address length in sequence, and each cache block has a base address.

3. The data cache transmission method with adaptive data bandwidth according to claim 2, characterized in that: In S3, the specific process of calculating the write start address of the current amount of data to be transmitted and writing it into the corresponding DMA memory space according to the current amount of data transmitted by the FPGA, the current amount of data to be transmitted and the threshold amount of data includes the following steps: SA1: Obtain the number of cache blocks in the DMA memory space corresponding to the DDR channel where the data to be transmitted is located, the address length of the cache block, and the base address of each cache block; SA2: According to the multiple relationship between the address length of the cache block and the threshold data volume, the address length of each cache block is converted into K area blocks with the threshold data volume as the memory space size; SA3: obtaining a preset FPGA transmitted data amount according to the current data amount to be transmitted and the corresponding current FPGA transmitted data amount, converting the preset FPGA transmitted data amount into N transmission data amounts transmitted at the threshold data amount according to the multiple relationship between the preset FPGA transmitted data amount and the threshold data amount, and sorting the N transmission data amounts in sequence; SA4: Calculate the amount of data to be transferred according to the number of cache blocks, the number of region blocks in each cache block, the base address of the cache block, and the sorting order of the transferred data, and obtain the write start address in the DMA memory space corresponding to the amount of data to be transferred.

4. The data cache transmission method with adaptive data bandwidth according to claim 2, characterized in that: In SA3, the specific process of obtaining the preset FPGA transmitted data amount according to the current amount of data to be transmitted and the corresponding current FPGA transmitted data amount is: Assuming that the FPGA transmits the current amount of data to be transmitted to the CPU through a high-speed bus for data writing, the current FPGA transmitted data amount recorded in the corresponding status register is updated, that is, the updated FPGA transmitted data amount is the recorded current FPGA transmitted data amount plus the current amount of data to be transmitted, and then the updated FPGA transmitted data amount is used as the preset FPGA transmitted data amount.

5. The data cache transmission method with adaptive data bandwidth according to claim 1, characterized in that: The status register is composed of a pair of transmitted data amount register and taken data amount register; When the FPGA transmits the current data to be transmitted to the CPU through the high-speed bus for data writing, the FPGA transmitted data amount recorded in the transmitted data amount register is synchronously updated, and the CPU removed data amount recorded in the removed data amount register is synchronously updated.

6. The data cache transmission method with adaptive data bandwidth according to claim 5, characterized in that: The transmitted data amount register is used to record data transmitted by the FPGA to the CPU. The FPGA updates the current FPGA transmitted data amount in the transmitted data amount register, so that the CPU can read the current FPGA transmitted data amount in the transmitted data amount register.

7. The data cache transmission method with adaptive data bandwidth according to claim 5, characterized in that: The taken data amount register is used to record the data written by the CPU. The CPU updates the amount of data taken by the current CPU in the taken data amount register, so that the FPGA can read the amount of data taken by the current CPU in the taken data amount register.

8. The data cache transmission method with adaptive data bandwidth according to claim 1, characterized in that: The step S5 is also included. The step S5 is: after the FPGA sends all the data to be transmitted to the DMA memory space via the high-speed bus, a completion interrupt signal is sent.

9. A data cache transmission system with adaptive data bandwidth, characterized in that: include: Data acquisition module: FPGA obtains the current data to be transmitted in all DDR channels, and each DDR channel has its own channel number. All DDR channels are sorted in sequence according to the channel number. Channel arbitration module: FPGA obtains the current data to be transmitted in the DDR channel in sequence according to the sorting order of the DDR channel, and determines whether the amount of the current data to be transmitted is greater than the threshold data amount. If so, the current data to be transmitted is transmitted; DMA memory space judgment module: obtains the remaining memory space of the corresponding DMA memory space according to the DDR channel where the current data to be transmitted is located, and judges whether the amount of the current data to be transmitted is greater than the remaining memory space of the corresponding DMA memory space. The DMA memory space corresponds to the DDR channels with different channel numbers one by one; Write start address calculation module: FPGA obtains the current FPGA transmitted data amount from the corresponding status register, and calculates the write start address of the current data amount to be transmitted into the corresponding DMA memory space according to the current FPGA transmitted data amount, the current data amount to be transmitted and the threshold data amount. The status register corresponds one-to-one with the DDR channels with different channel numbers. Data transmission update module: FPGA transmits the current data to be transmitted to the CPU through the high-speed bus for data writing, and at the same time, updates the current FPGA transmitted data amount recorded in the corresponding status register.