A multi-channel high-speed data cache system and method based on FPGA

By introducing a multi-level cache architecture and a polling arbitration mechanism into the FPGA system, the problems of insufficient real-time performance and poor flexibility of multi-channel data storage in the existing technology are solved, and a multi-channel data cache with high throughput and low coupling is realized. , avoid data loss and reduce hardware costs.

CN118377730BActive Publication Date: 2024-09-20CHENGDU CAIC ELECTRONICS CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410822821.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-25
Publication Date
2024-09-20
Estimated Expiration
2044-06-25

AI Technical Summary

Technical Problem

Existing FPGA-based multi-channel data caching systems have problems such as insufficient real-time performance, poor flexibility and risk of tail data loss, especially when storing multi-channel, large-bandwidth data.

Method used

A multi-channel high-speed data cache system based on FPGA is used, including the first-level pre-cache, the second-level main cache and the third-level post-cache. Through data sorting and sub-packaging, clock domain conversion and polling arbitration, It realizes flexible storage and reading of data, avoids the involvement of ARM software, and reduces system coupling and cost.

Benefits of technology

It improves the real-time performance and throughput of the system, avoids small amounts of data loss, simplifies the system architecture, reduces development and maintenance costs, and provides flexible configuration options.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118377730B
    Figure CN118377730B
Patent Text Reader

Abstract

The present invention discloses a multi-channel high-speed data cache system and method based on FPGA, the system includes a first-level pre-cache, a second-level main cache and a third-level post-cache connected in sequence; wherein the first-level pre-cache is used to sort and packetize the pre-level data and convert the clock domain, the second-level main cache is used to store the pre-level data packets in different partition address spaces according to different input channels, and the third-level post-cache is used to read data from the partition address space, and convert the read data into the clock domain and interface timing according to the needs of the post-level. The present invention uses FPGA logic code to realize the read and write arbitration of multi-channel data, without the participation of ARM software, the system coupling is low, the real-time performance is better, and the operation of reading the second-level main cache is triggered by three conditions: quantitative, timing and power failure, so as to ensure that the internal data of the cache can be fully read out.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of high-speed data storage management, and in particular relates to a multi-channel high-speed data cache system and method based on FPGA. Background Art

[0002] With the development of modern science and technology, the amount of data that computer systems need to process is increasing, and the real-time requirements are getting higher and higher. At present, data storage devices mostly use embedded software to drive large-capacity storage to achieve data storage management. However, due to the characteristics of software sequential processing, this solution is incapable of realizing multi-channel and large-bandwidth data storage. FPGA (Field Programmable Gate Array) is a flexible and programmable digital logic device with a large number of programmable gate circuits and rich hardware circuit resources inside, which can achieve greater data bandwidth and data parallel processing capabilities. It is very suitable for processing parallel data, and the use of a suitable system solution can realize the parallel processing of multi-channel and large-bandwidth data.

[0003] At present, the multi-channel data caching method based on FPGA still has the problems of complex structure and poor flexibility. For example, Chinese patent publication number CN115033171A discloses a multi-channel data storage method and system based on FPGA. The storage method mentioned in this scheme is to number different channel data, cache them in DDR, set a read threshold for each channel data, read out the cache data in a polling manner, and then store them in a specific area of ​​the hard disk to achieve separate storage of multi-channel data. Although this caching method can realize the multi-channel data partition storage function, the scheme adopts MPSoC (the name of a series of FPGAs launched by Xilinx, which has both a programmable logic part and an ARM processor part) multi-core heterogeneous FPGA architecture. This architecture scheme is complex and costly. The multi-channel cache is controlled and scheduled by ARM, and the real-time performance is insufficient, which affects the data throughput rate; the hardware and software are more coupled, the portability is poor, and there is a disadvantage of insufficient flexibility. On the other hand, this solution adopts a quantitative cache reading method. When the data volume reaches the set read threshold, it will be read from the DDR and written to the hard disk. When the cached data is less than the read threshold of the channel data for a long time, the data will not be read from the DDR cache and stored in the hard disk, and there is a risk of tail data loss. Summary of the invention

[0004] In view of the above-mentioned deficiencies in the prior art, the present invention provides a FPGA-based multi-channel high-speed data cache system and method to solve the problems of insufficient real-time performance and poor flexibility of the existing multi-channel, large-bandwidth data storage architecture.

[0005] In order to achieve the above-mentioned invention object, the technical solution adopted by the present invention is: a multi-channel high-speed data cache system based on FPGA, including a first-level pre-cache, a second-level main cache and a third-level post-cache connected in sequence;

[0006] Among them, the first-level front cache is used to organize, packetize and clock domain convert the previous-level data, the second-level main cache is used to store the previous-level data packets in different partition address spaces according to different input channels, and the third-level post-cache is used to read data from the partition address space and convert the clock domain and interface timing of the read data according to the requirements of the post-level.

[0007] Further: the first-level pre-cache is a simple dual-port RAM, the first-level pre-cache includes a plurality of pre-cache units, the pre-cache units are connected to the input channel through a write port, the pre-cache units are connected to the second-level main cache through a read port, and the unit capacity of each pre-cache unit is set according to the input channel information;

[0008] The input channel information includes the number of data types and data packet size of the input channel, and the read port is an AXI_Stream interface for outputting data and data type identification.

[0009] Further: the second-level main cache includes an input port, an AXI_Interconnect module and an output port connected in sequence, the input port and the output port are both connected to the read-write control module, and the AXI_Interconnect module is also connected to the MIG module;

[0010] Among them, the input port includes several input sub-modules, each input sub-module is connected to the corresponding front-end cache unit, and each input sub-module is provided with an interface conversion sub-unit for converting the interface to an AXI_Full interface. The output port is specifically an output sub-module, and the output sub-module is connected to the third-level post-cache for converting the AXI_Full interface to an AXI_Stream interface.

[0011] Furthermore: the third-level post-buffer is specifically an asynchronous FIFO, and the read port of the asynchronous FIFO adopts an AXI_Stream interface.

[0012] A multi-channel high-speed data caching method based on FPGA, the method comprising the following steps:

[0013] S1, using the pre-cache unit of the first-level pre-cache to sort and packetize the pre-stage data and perform clock domain conversion, and to classify and store each type of pre-stage data;

[0014] S2, reading the previous level data in the front cache unit through the second level main cache, and storing the previous level data in blocks in the partition address space corresponding to the second level main cache;

[0015] S3. Read the previous level data in the second level main cache by polling arbitration, convert the clock domain and interface timing of the previous level data according to the requirements of the next level, and store them in the third level post cache.

[0016] Further: in said S1, the pre-cache unit in the first-level pre-cache is provided with a write port and a read port, the write port is used to write the pre-stage data, the read port is used to read the pre-stage data, the write port and the read port use independent clocks for clock domain conversion of the pre-stage data, and the writing and reading of the pre-stage data adopt a cyclic overwrite method;

[0017] The method of writing and reading the previous data by loop overwriting is as follows:

[0018] If the write address of the corresponding type of data in the input channel reaches the first threshold address, the write address is initialized;

[0019] The specific method of reading the previous stage data by loop overwriting is as follows:

[0020] If the difference between the write address and the read address is greater than the second threshold address, a read operation is performed through the read port to read data corresponding to the second threshold address from the pre-cache unit. If the read address of the corresponding type of data reaches the first threshold address, the read address is initialized.

[0021] Further: In S3, the method of reading the previous level data in the second level main cache by polling arbitration is specifically:

[0022] Set quantitative, timing and power-off readout conditions, and read the previous level data from the second level main cache when the readout conditions are met;

[0023] The method for satisfying the quantitative reading condition is specifically:

[0024] If the amount of data of the corresponding data type reaches the read threshold, the quantitative reading condition is met;

[0025] The method to meet the timing reading conditions is as follows:

[0026] If the corresponding data type does not reach the read threshold within the preset threshold time, the timed read condition is met;

[0027] The method to meet the power-off reading conditions is as follows:

[0028] If a power-off signal is detected, the second-level main cache is stopped from writing the previous-level data, and the partition address spaces of all data types are polled in turn. If they are not empty, the power-off reading condition is met.

[0029] The beneficial effects of the present invention are:

[0030] (1) The present invention provides a multi-channel high-speed data cache system and method based on FPGA, which uses FPGA logic code to implement multi-channel data read and write arbitration without the participation of ARM software. The system has low coupling, better real-time performance, and higher throughput. At the same time, since it does not involve the participation of ARM processors, the entire system architecture is simple, with low coupling and low development and maintenance costs.

[0031] (2) The present invention uses three conditions, namely, quantitative, timing and power-off, to trigger the operation of reading the second-level main cache. When the amount of data in a certain channel is small and the read threshold cannot be reached for a long time, the cache read operation can be triggered in a timing manner to ensure that a small amount of data is not lost.

[0032] (3) The present invention can match the number of front-cache units according to actual engineering requirements. The second-level main cache can be trimmed according to actual application requirements. The second-level cache can be deleted when the actual input data channels and data types are small. The architecture of front-cache plus post-cache can reduce FPGA resource utilization and hardware costs while achieving functional requirements, and has flexible configuration. BRIEF DESCRIPTION OF THE DRAWINGS

[0033] Figure 1 The present invention is a schematic diagram of a multi-channel high-speed data cache system based on FPGA.

[0034] Figure 2 It is a schematic diagram of the structure of the pre-cache module of the present invention.

[0035] Figure 3 Schematic diagram of the second-level primary cache of the present invention.

[0036] Figure 4 The present invention is a flow chart of a multi-channel high-speed data caching method based on FPGA.

[0037] Figure 5 Schematic diagram of the primary cache partition of the present invention. DETAILED DESCRIPTION

[0038] The specific implementation modes of the present invention are described below so that those skilled in the art can understand the present invention. However, it should be clear that the present invention is not limited to the scope of the specific implementation modes. For those of ordinary skill in the art, as long as various changes are within the spirit and scope of the present invention as defined and determined by the attached claims, these changes are obvious, and all inventions and creations utilizing the concept of the present invention are protected.

[0039] like Figure 1 As shown, in one embodiment of the present invention, a multi-channel high-speed data cache system based on FPGA includes a first-level pre-cache, a second-level main cache, and a third-level post-cache connected in sequence;

[0040] Among them, the first-level front cache is used to organize, packetize and convert the front-level data into clock domains, the second-level main cache is used to store the front-level data packets in different partition address spaces according to different input channels, and the third-level post-cache is used to read data from the partition address space and convert the clock domain and interface timing of the read data according to the requirements of the post-stage, so as to ensure the bandwidth balance with the post-stage processing.

[0041] In this embodiment, the first-level pre-cache of the present invention adopts a simple dual-port RAM implemented by the BRAM resources inside the FPGA, the second-level main cache is implemented by external DDR particles, and the DDR driver MIG module inside the FPGA is called to implement the main cache. The third-level post-cache adopts the BRAM resources inside the FPGA to implement asynchronous FIFO as the post-cache.

[0042] The first-level pre-cache is a simple dual-port RAM, the first-level pre-cache includes a plurality of pre-cache units, the pre-cache units are connected to the input channel through a write port, the pre-cache units are connected to the second-level main cache through a read port, and the unit capacity of each pre-cache unit is set according to the input channel information;

[0043] In this embodiment, an independent clock is used between the write port and the read port to realize data crossing the clock domain. The data bit width of the write port can be statically configured through parameters, and the data bit width of the read port can be set according to the clock frequency of the subsequent system and the overall bandwidth requirements, and generally should not exceed 512 bits.

[0044] The input channel information includes the number of data types and data packet size of the input channel. The read port is an AXI_Stream interface, which is used to output data and data type identifiers. For example, the data type identifier of data type 1 can be identified as 0x1, the identifier of data type 2 can be 0x2, and so on.

[0045] In this embodiment, the number of pre-cache units is the same as the number of system data input channels. One data input channel corresponds to an independent pre-cache unit. The capacity of each pre-cache unit is set according to the number of data types and the size of the data packet of the channel. Figure 2As shown, when the number of data types in the channel is 4, the first-level data packet size of each data type is 2kB, and twice the cache space is reserved for each type of data, the cache space for each data type is 4kB, and the size of the pre-cache unit corresponding to the channel is 4kB*4=16kB.

[0046] like Figure 3 As shown, the second-level main cache includes an input port, an AXI_Interconnect module and an output port connected in sequence, the input port and the output port are both connected to the read-write control module, and the AXI_Interconnect module is also connected to the MIG module;

[0047] Among them, the input port includes several input sub-modules, each input sub-module is connected to the corresponding front-end cache unit, and each input sub-module is provided with an interface conversion sub-unit for converting the interface to an AXI_Full interface. The output port is specifically an output sub-module, and the output sub-module is connected to the third-level post-cache for converting the AXI_Full interface to an AXI_Stream interface.

[0048] In this embodiment, the second level is implemented as the main cache using external DDR particles, calling the DDR driver MIG module of XILINX to implement DDR driver, and converting the DDR interface to the internal AXI_Full interface. The DDR particle itself is a half-duplex interface, and reading and writing cannot be performed at the same time, requiring arbitration time-sharing control. Under this architecture, DDR has multiple write data channels and one read data channel. The priority between all write data channels can be configured and selected, and all write channels have the same priority by default. At the same time, all write data priorities should be higher than read channel priorities.

[0049] The third-level post-buffer is specifically an asynchronous FIFO, and the read port of the asynchronous FIFO adopts an AXI_Stream interface.

[0050] like Figure 4 As shown, a multi-channel high-speed data cache method based on FPGA includes the following steps:

[0051] S1, using the pre-cache unit of the first-level pre-cache to sort and packetize the pre-stage data and perform clock domain conversion, and to classify and store each type of pre-stage data;

[0052] S2, reading the previous level data in the front cache unit through the second level main cache, and storing the previous level data in blocks in the partition address space corresponding to the second level main cache;

[0053] S3. Read the previous level data in the second level main cache by polling arbitration, convert the clock domain and interface timing of the previous level data according to the requirements of the next level, and store them in the third level post cache.

[0054] In S1, the pre-cache unit in the first-level pre-cache is provided with a write port and a read port, the write port is used to write the pre-stage data, the read port is used to read the pre-stage data, the write port and the read port use independent clocks to perform clock domain conversion on the pre-stage data, and the writing and reading of the pre-stage data adopt a cyclic overwriting method;

[0055] The method of writing and reading the previous data by loop overwriting is as follows:

[0056] If the write address of the corresponding type of data in the input channel reaches the first threshold address, the write address is initialized;

[0057] The specific method of reading the previous stage data by loop overwriting is as follows:

[0058] If the difference between the write address and the read address is greater than the second threshold address, a read operation is performed through the read port to read data corresponding to the second threshold address from the pre-cache unit. If the read address of the corresponding type of data reaches the first threshold address, the read address is initialized.

[0059] In this embodiment, when the write address of a data type in the pre-cache unit, such as data_type1, reaches 0x1000, the write address will immediately return to the 0x0000 address, and write from the beginning to overwrite the previous data. When the difference between the write address and the read address is greater than 0x800, that is, the amount of data written reaches 2kB, the RAM read operation is triggered, and 2kB of data is read from the RAM at a time. The read address control also adopts a circular overwrite method. When the read address reaches 0x1000, it will immediately return to the 0x0000 address.

[0060] In this embodiment, the second-level main cache includes 8 partition address spaces, and 4 sub-address spaces are set according to the 4 data types stored in each partition address space. The data storage method of each sub-address space is a circular overwrite method. The partition address space of the second-level main cache, the data type stored in the partition address space and the sub-address space can be flexibly set according to actual conditions.

[0061] like Figure 5As shown, in this embodiment, the total capacity of the second-level main cache is 2GB, with a total of 8 partition address spaces, each of which includes 4 sub-address spaces for storing 4 data types, so the cache space allocated to each data type is 2GB / 8 / 4=64MB. Each data type is independently stored in its own partition space, using a circular overwriting storage method. For example, the DDR partition of the first channel and the first type is 0x0000_0000~0x03ff_ffff. When data is written to 0x03ff_ffff, the next byte is written from 0x0000_0000.

[0062] In S3, the method of reading the previous level data in the second level main cache by polling arbitration is specifically as follows:

[0063] Set quantitative, timing and power-off readout conditions, and read the previous level data from the second level main cache when the readout conditions are met;

[0064] The method for satisfying the quantitative reading condition is specifically:

[0065] If the amount of data of the corresponding data type reaches the read threshold, the quantitative reading condition is met;

[0066] The method to meet the timing reading conditions is as follows:

[0067] If the corresponding data type does not reach the read threshold within the preset threshold time, the timed read condition is met;

[0068] The method to meet the power-off reading conditions is as follows:

[0069] If a power-off signal is detected, the second-level main cache is stopped from writing the previous-level data, and the partition address spaces of all data types are polled in turn. If they are not empty, the power-off reading condition is met.

[0070] In S3, the third-level post-cache reads the previous-level data through polling arbitration to complete the multi-channel input and single-channel output function. The read data packet capacity must be greater than the product of all second-level main cache input data packets and the number of all channel types to ensure the balance of input and output bandwidth.

[0071] In this embodiment, the maximum data throughput of the present invention is related to the DDR particle clock frequency. If the DDR3 clock frequency is 800MHz, the DDR3 user layer clock is 1 / 4 of its control rate, that is, 200MHz. Since the particles are double-edge sampled, the data transmission frequency is 800*2=1600MHz, and the data bit width of 4 DDR particles is 64bit in total, so the total DDR read and write bandwidth is 1600*64 / 8=12800MB / s. Since DDR is a half-duplex working mode, it is in a working state of simultaneous reading and writing for a long time in actual work. And considering the continuous read and write efficiency and the control arbitration consumption, the actual working efficiency is about 80%, and finally the entire cache data flow bandwidth is 12800*80%*50% = 5120 MB / s = 5 GB / s.

[0072] The beneficial effects of the present invention are as follows: the present invention provides a multi-channel high-speed data cache system and method based on FPGA, which uses FPGA logic code to implement read and write arbitration of multi-channel data, does not require the participation of ARM software, has low system coupling, better real-time performance, and high throughput. At the same time, since it does not involve the participation of ARM processors, the entire system architecture is simple, has low coupling, and has low development and maintenance costs.

[0073] The present invention uses three conditions, namely quantitative, timing and power-off, to trigger the operation of reading the second-level main cache. When the data volume of a certain channel is small and the read threshold cannot be reached for a long time, the cache read operation can be triggered in a timing manner to ensure that a small amount of data is not lost.

[0074] The present invention can match the number of front-cache units according to actual engineering requirements, the second-level main cache can be cut according to actual application requirements, and the second-level cache can be deleted when the actual input data channels and data types are small. The architecture of front-cache plus post-cache can reduce FPGA resource utilization and hardware costs while achieving functional requirements, and the configuration is flexible.

[0075] In the description of the present invention, it is necessary to understand that the orientation or positional relationship indicated by the terms "center", "thickness", "upper", "lower", "horizontal", "top", "bottom", "inner", "outer", "radial", etc. is based on the orientation or positional relationship shown in the drawings, and is only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation on the present invention. In addition, the terms "first", "second", and "third" are used only for descriptive purposes, and cannot be understood as indicating or implying the relative importance or the number of implicitly specified technical features. Therefore, the features defined by "first", "second", and "third" may explicitly or implicitly include one or more of the features.

Claims

1. A method for a multi-channel high-speed data cache system based on FPGA, applied to a multi-channel high-speed data cache system based on FPGA, the system comprising a first-level pre-cache, a second-level main cache and a third-level post-cache connected in sequence; in, The first-level front cache is used to sort and packetize the front-level data and perform clock domain conversion, the second-level main cache is used to store the front-level data packets in different partition address spaces according to different input channels, and the third-level back cache is used to read data from the partition address space and convert the clock domain and interface timing of the read data according to the requirements of the back-level; The first-level pre-cache is a simple dual-port RAM, the first-level pre-cache includes a plurality of pre-cache units, the pre-cache units are connected to the input channel through a write port, the pre-cache units are connected to the second-level main cache through a read port, and the unit capacity of each pre-cache unit is set according to the input channel information; The input channel information includes the number of data types and data packet size of the input channel, and the read port is an AXI_Stream interface for outputting data and data type identification; The second-level main cache includes an input port, an AXI_Interconnect module and an output port connected in sequence, the input port and the output port are both connected to the read-write control module, and the AXI_Interconnect module is also connected to the MIG module; The input port includes a plurality of input submodules, each of which is connected to a corresponding front-end cache unit, and each of which is provided with an interface conversion subunit for converting the interface to an AXI_Full interface. The output port is specifically an output submodule, which is connected to a third-level back-end cache for converting the AXI_Full interface to an AXI_Stream interface. The third-level post-buffer is specifically an asynchronous FIFO, and the read port of the asynchronous FIFO adopts an AXI_Stream interface; The method comprises the following steps: S1, using the pre-cache unit of the first-level pre-cache to sort and packetize the pre-stage data and perform clock domain conversion, and to classify and store each type of pre-stage data; S2, reading the previous level data in the front cache unit through the second level main cache, and storing the previous level data in blocks in the partition address space corresponding to the second level main cache; S3, reading the previous level data in the second level main cache by polling arbitration, converting the clock domain and interface timing of the previous level data according to the requirements of the next level, and storing it in the third level post cache; In S3, the method of reading the previous level data in the second level main cache by polling arbitration is specifically as follows: Set quantitative, timing and power-off readout conditions, and read the previous level data from the second level main cache when the readout conditions are met; The method for satisfying the quantitative reading condition is specifically: If the amount of data of the corresponding data type reaches the read threshold, the quantitative reading condition is met; The method to meet the timing reading conditions is as follows: If the corresponding data type does not reach the read threshold within the preset threshold time, the timed read condition is met; The method to meet the power-off reading conditions is as follows: If a power-off signal is detected, the second-level main cache is stopped from writing the previous-level data, and the partition address spaces of all data types are polled in turn. If they are not empty, the power-off reading condition is met.

2. The method according to claim 1, It is characterized in that In S1, the pre-cache unit in the first-level pre-cache is provided with a write port and a read port, the write port is used to write the pre-stage data, the read port is used to read the pre-stage data, the write port and the read port use independent clocks to perform clock domain conversion on the pre-stage data, and the writing and reading of the pre-stage data adopt a cyclic overwriting method; The method of writing and reading the previous data by loop overwriting is as follows: If the write address of the corresponding type of data in the input channel reaches the first threshold address, the write address is initialized; The specific method of reading the previous stage data by loop overwriting is as follows: If the difference between the write address and the read address is greater than the second threshold address, a read operation is performed through the read port to read data corresponding to the second threshold address from the pre-cache unit. If the read address of the corresponding type of data reaches the first threshold address, the read address is initialized.