A ping-pong storage controller based on FPGA and data processing method thereof
By setting up the acquisition data FIFO and the read data FIFO in the FPGA, and using the arbiter for data transmission arbitration, the fast small ping-pong switching of the memory is realized, which solves the problem of data reading lag in the existing technology and improves the system efficiency. real-time.
Patent Information
- Application Number
- CN202410643158.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-23
- Publication Date
- 2024-09-13
- Estimated Expiration
- 2044-05-23
AI Technical Summary
In the existing image acquisition and processing system, the storage method of ping-pong mode causes a large lag in data reading, which cannot meet the requirements of high real-time environment.
Design a ping-pong memory controller based on FPGA. By setting the acquisition data FIFO and the read data FIFO in the FPGA, and using the arbiter for data transmission arbitration, the acquisition data is written into the memory after reaching the threshold, and the data in the memory reaches the threshold. After the threshold, it is quickly read into the read data FIFO and waits for the processor to read, realizing fast small ping-pong switching of the memory.
It greatly reduces the lag time of data reading, improves the real-time performance of the system, and meets the needs of high real-time environment.
Smart Images

Figure CN118227530B
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of data transmission, and in particular relates to a ping-pong storage controller based on FPGA and a data processing method thereof. Background Art
[0002] With the rapid development of modern electronic technology, high-speed image acquisition technology has been widely used in more and more fields, such as image processing, video conferencing, public security monitoring systems, traffic monitoring, industrial control, military, medicine, aerospace, etc. It can be said that image acquisition technology can be involved in all aspects of our lives, and different application fields also bring different requirements for technology. The most common image acquisition device is the image acquisition card, but it needs to be directly connected to the computer and is greatly restricted by the working environment; the other is the onboard image acquisition and processing system.
[0003] The onboard image acquisition and processing system directly stores image data without connecting to a computer. Its obvious advantage is that it is easy to use. In the onboard image acquisition and processing system, the storage module is the core of this high-speed image acquisition and processing system. Storage control is generally implemented using FPGA. FPGA receives the acquired image data, and the storage controller designed by FPGA stores the image data in the memory. After that, the processor in the onboard image system, such as DSP or CPU, reads the data from the memory for processing, and finally uploads or transmits the processing results to other systems.
[0004] In the current image acquisition and processing systems, most storage methods use the ping-pong mode, that is, there are two memories in the system. When the first memory is used to write data (store images), the second memory is used to read data (read images). When writing data to the second memory, the data is read from the first memory, and the process is interactive. This mode is easy to implement and simple to control, but it is not suitable for environments with high real-time requirements. The system processor reads data from the memory one frame later than the current time.
[0005] Therefore, for a high real-time environment, it is necessary to shorten the latency time of reading data, and it is urgent to provide a ping-pong storage controller based on FPGA and a data processing method thereof. Summary of the invention
[0006] In order to solve the above technical problems existing in the prior art, the present invention provides a ping-pong storage controller based on FPGA and a data processing method thereof.
[0007] To achieve the above object, the technical solution of the present invention is as follows:
[0008] A ping-pong storage controller based on FPGA, comprising
[0009] Data acquisition system, used for data collection;
[0010] FPGA, the FPGA is connected to the data acquisition system and is used to transmit data collected by the data acquisition system;
[0011] A memory, connected to the FPGA, and used to store data transmitted by the FPGA;
[0012] A processor, connected to the FPGA, and configured to process data transmitted by the FPGA;
[0013] The FPGA is provided with a data acquisition FIFO, a data read FIFO and an arbitrator, the data receiving end of the data acquisition FIFO is connected to the data acquisition system, and the data output end of the data acquisition FIFO is connected to the memory; the data receiving end of the data read FIFO is connected to the memory, and the data output end of the data read FIFO is connected to the processor;
[0014] The arbiter is connected to the collected data FIFO and the read data FIFO respectively.
[0015] Furthermore, the data acquisition system is a camera system.
[0016] A ping-pong storage controller data processing method based on FPGA is applied to the above-mentioned ping-pong storage controller, specifically comprising:
[0017] The data acquisition FIFO temporarily stores the data collected by the data acquisition system. The arbitrator sends a signal according to the capacity of the collected data, so that all the data in the data acquisition FIFO are written into the memory. After the data is written, the arbiter sends a signal according to the capacity of the written data, so that the memory The row data is read into the read data FIFO; the arbitrator sends a signal according to the data capacity of the read data FIFO read from the memory, so that the processor reads all the data in the read data FIFO.
[0018] Furthermore, set the trigger threshold for data collection , when the data collected by the acquisition data FIFO is larger than When the acquisition data FIFO generates a pulse signal, the arbitrator sets the memory write enable signal flag_clec_write according to the pulse signal, and then all the data in the acquisition data FIFO are written into the memory, and then the arbitrator resets the flag_clec_write signal and waits for the next trigger.
[0019] Furthermore, the acquisition data FIFO length is set to , in bytes, then:
[0020]
[0021] at the same time,
[0022] in, Indicates the trigger threshold for data collection, in bytes; is the memory data width, Indicates the memory data frequency, Indicates the ratio of memory bandwidth occupied by the acquisition data FIFO. Indicates the data width of the receiving data end of the acquisition data FIFO. It indicates the frequency of the data receiving end of the acquisition data FIFO, and b indicates the utilization rate of the memory.
[0023] Furthermore, the memory data width Satisfy the formula:
[0024]
[0025] in, is a constant greater than 4, Indicates the data width of the output data end of the read data FIFO, Indicates the frequency of the output data end of the read data FIFO.
[0026] Furthermore, the memory utilization b takes a value of 60%.
[0027] Furthermore, when the processor needs to read data, the arbitrator sets the flag_proc_read signal, and the data in the memory begins to be read into the read data FIFO; the read data trigger threshold is set , when the data capacity read from the memory by the read data FIFO is greater than When the flag_proc_read signal is triggered, the read data FIFO generates a pulse signal and sends the pulse signal to the processor, the processor reads all the data in the read data FIFO, and then the arbitrator resets the flag_proc_read signal and waits for the next trigger.
[0028] Furthermore, the length of the read data FIFO is set to , in bytes, then:
[0029]
[0030] at the same time,
[0031] in, Indicates the trigger threshold for reading data, in bytes; Indicates the data width of the output data end of the read data FIFO, Indicates the frequency of the output data end of the read data FIFO; is the memory data width, Indicates the memory data frequency, Indicates the ratio of memory bandwidth occupied by the read data FIFO.
[0032] When the flag_clec_write signal and the flag_proc_read signal are valid at the same time, a memory access collision will occur. A state machine is designed inside the arbiter to realize the occupancy ratio of the memory bandwidth occupied by the acquisition data FIFO and the occupancy ratio of the memory bandwidth occupied by the read data FIFO. When the flag_clec_write and flag_proc_read signals are valid at the same time, the output data end of the acquisition data FIFO is first connected to the memory after completing two write operations and then disconnected. Then, the receiving data end of the read data FIFO is connected to the memory after completing a read operation and then disconnected. Then, the output data end of the acquisition data FIFO is connected to the memory again to complete two write operations. This reciprocating process realizes the fast ping-pong switching of the memory read and write operations and solves the memory access collision.
[0033] Furthermore, the memory is SDRAM, and memory data reading and writing adopts 8-burst mode.
[0034] Compared with the prior art, the present invention has the following beneficial effects:
[0035] The FPGA-based ping-pong storage controller and data processing method thereof provided by the present invention set a data acquisition FIFO and a data read FIFO in the FPGA, and set an arbitrator to arbitrate data transmission; in the case of only one storage area, the acquired data is first written into the data acquisition FIFO for temporary storage, and then written into the storage area after the acquired data reaches a designed threshold value, and at the same time, the storage controller quickly reads the data stored in the storage area into the data read FIFO for temporary storage, waiting for the processor to read, so that there is no need to wait until the storage of a frame of image is completed before reading the data, which greatly improves the real-time performance of the system and reduces the data reading lag time. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] Figure 1 This is a connection schematic diagram of the FPGA-based ping-pong storage controller of the present invention. DETAILED DESCRIPTION
[0037] The technical solution of the present invention will be clearly described below in conjunction with the accompanying drawings. Obviously, the described embodiments are not all embodiments of the present invention, and all other embodiments obtained by ordinary technicians in the field without making creative work are within the protection scope of the present invention.
[0038] It should be noted that, unless otherwise specifically stated, the relative arrangements of components and steps, and numerical expressions set forth in these embodiments should not be construed as limiting the scope of the present invention.
[0039] The following description of the exemplary embodiments is merely illustrative and is not intended to limit the present invention and its application or use in any sense. Techniques, methods and devices known to ordinary technicians in the relevant field may not be discussed in detail here, but where applicable, these techniques, methods and devices should be considered as part of this specification.
[0040] Embodiment 1
[0041] The present invention provides a ping-pong storage controller based on FPGA, such as Figure 1 Shown, including
[0042] The data acquisition system is used for data acquisition. In this embodiment, the data acquisition system is a camera system, and the data acquired by the data acquisition system are pictures. In other embodiments, the data acquisition system can also be a system in other data forms.
[0043] FPGA, the FPGA is connected to the data acquisition system and is used to transmit data collected by the data acquisition system;
[0044] A memory, connected to the FPGA, and used to store data transmitted by the FPGA;
[0045] A processor, connected to the FPGA, and configured to process data transmitted by the FPGA;
[0046] The FPGA is provided with a data acquisition FIFO, a data read FIFO and an arbitrator, the data receiving end of the data acquisition FIFO is connected to the data acquisition system, and the data output end of the data acquisition FIFO is connected to the memory; the data receiving end of the data read FIFO is connected to the memory, and the data output end of the data read FIFO is connected to the processor;
[0047] The arbiter is connected to the collected data FIFO and the read data FIFO respectively.
[0048] The ping-pong storage controller provided by the present invention has only one storage area, and data writing and reading are both performed in this storage area. The collected data is first written into the collected data FIFO for temporary storage, and then written into the storage area after the collected data reaches a designed threshold. At the same time, the storage controller quickly reads the data stored in the memory area into the read data FIFO for temporary storage, waiting for the processor to read it, so there is no need to wait until the storage of a frame of image is completed before reading the data.
[0049] Embodiment 2
[0050] The present invention also provides a ping-pong storage controller data processing method based on FPGA, which is applied to the ping-pong storage controller provided in the first embodiment, and specifically includes:
[0051] The data acquisition FIFO temporarily stores the data collected by the data acquisition system. The arbitrator writes all the data in the data acquisition FIFO into the memory according to the capacity of the collected data. After the data is written, the arbiter makes the memory The row data is read into the read data FIFO; the arbitrator enables the processor to read all the data in the read data FIFO according to the data capacity read from the memory by the read data FIFO.
[0052] The method for arbitrating the data flow transmission of the acquisition data FIFO by the arbitrator is as follows: setting the acquisition data trigger threshold , when the data collected by the acquisition data FIFO is larger than When the acquisition data FIFO generates a pulse signal, the arbitrator sets the memory write enable signal flag_clec_write according to the pulse signal, and then all the data in the acquisition data FIFO are written into the memory, and then the arbitrator resets the flag_clec_write signal and waits for the next trigger.
[0053] Set the acquisition data FIFO length to , in bytes, then:
[0054]
[0055] at the same time,
[0056] in, Indicates the trigger threshold for data collection, in bytes; is the memory data width, Indicates the memory data frequency, Indicates the ratio of memory bandwidth occupied by the acquisition data FIFO. Indicates the data width of the receiving data end of the acquisition data FIFO. It indicates the frequency of the data receiving end of the acquisition data FIFO, and b indicates the utilization rate of the memory.
[0057] The memory bandwidth occupancy state machine is designed through the arbitrator, in which the idle occupancy is 10%, and the memory bandwidth occupied by the acquisition data FIFO is 10%. Indicates that the ratio of the memory bandwidth occupied by the read data FIFO is express.
[0058] Among them, the memory data width Satisfy the formula:
[0059]
[0060] in, is a constant greater than 4, Indicates the data width of the output data end of the read data FIFO, Indicates the frequency of the output data end of the read data FIFO.
[0061] The memory in this embodiment is SDRAM, and the memory data is read and written in 8-burst mode, so there is a utilization efficiency problem. The memory utilization b is 60%, and the actual bandwidth of the memory is Typically, the memory bandwidth is much higher than the sum of the acquisition data bandwidth and the read data bandwidth.
[0062] The method for arbitrating the data flow transmission of the read data FIFO by the arbitrator is as follows: when the processor needs to read data, the arbitrator sets the flag_proc_read signal, and the data in the memory begins to be read into the read data FIFO; setting the read data trigger threshold , when the data capacity read from the memory by the read data FIFO is greater than When the flag_proc_read signal is triggered, the read data FIFO generates a pulse signal and sends the pulse signal to the processor, the processor reads all the data in the read data FIFO, and then the arbitrator resets the flag_proc_read signal and waits for the next trigger.
[0063] Set the length of the read data FIFO to , in bytes, then:
[0064]
[0065] at the same time,
[0066] in, Indicates the trigger threshold for reading data, in bytes; Indicates the data width of the output data end of the read data FIFO, Indicates the frequency of the output data end of the read data FIFO; is the memory data width, Indicates the memory data frequency, Indicates the ratio of memory bandwidth occupied by the read data FIFO.
[0067] When the flag_clec_write signal and the flag_proc_read signal are valid at the same time, a memory access collision will occur. A state machine is designed inside the arbiter to realize the occupancy ratio of the memory bandwidth occupied by the acquisition data FIFO and the occupancy ratio of the memory bandwidth occupied by the read data FIFO. When the flag_clec_write and flag_proc_read signals are valid at the same time, the output data end of the acquisition data FIFO is first connected to the memory after completing two write operations and then disconnected. Then, the receiving data end of the read data FIFO is connected to the memory after completing a read operation and then disconnected. Then, the output data end of the acquisition data FIFO is connected to the memory again to complete two write operations. This reciprocating process realizes the fast ping-pong switching of the memory read and write operations and solves the memory access collision.
[0068] In this way, the data acquisition end writes each After the data is read, the processor will read the data from the memory for processing, without having to wait until a frame of data is fully stored before reading it out. The write memory operation at the data acquisition end and the read memory operation at the processor end are always in a fast switching state; the lag time can be Calculated, according to the design The smaller the row, the shorter the lag time and the higher the real-time performance.
[0069] If the data collection end stores After the data is read, the processor starts to read the data, so the lag time between reading data and writing data is close to When the image size is 1920x1080 and the frame rate is 60Hz, the data read delay time in the ping-pong mode of the prior art is 1 / 60 second. By using the ping-pong storage controller and data processing method provided by the present invention, the data read delay time is / (60x1080) seconds, which greatly improves the real-time performance of the system.
[0070] The above specific implementation methods are only used to illustrate the technical solution of the present invention rather than to limit it. Although the present invention has been described in detail with reference to examples, a person skilled in the art should understand that the technical solution of the present invention can be modified or replaced by equivalents without departing from the scope of the technical solution of the present invention, which should be included in the scope of the claims of the present invention.
Claims
1. A ping-pong storage controller data processing method based on FPGA, characterized in that: Specifically include: The data acquisition FIFO temporarily stores the data collected by the data acquisition system. The arbitrator sends a signal according to the capacity of the collected data, so that all the data in the data acquisition FIFO are written into the memory. After the data is written, the arbiter sends a signal according to the capacity of the written data, so that the memory The row data is read into a read data FIFO; the arbiter sends a signal according to the data capacity read from the memory by the read data FIFO, so that the processor reads all the data in the read data FIFO; Set the trigger threshold for data collection , when the data collected by the acquisition data FIFO is larger than When the acquisition data FIFO generates a pulse signal, the arbitrator sets the memory write enable signal flag_clec_write according to the pulse signal, and then all the data in the acquisition data FIFO are written into the memory, and then the arbitrator resets the flag_clec_write signal and waits for the next trigger; Set the acquisition data FIFO length to , in bytes, then: at the same time, in, Indicates the trigger threshold for data collection, in bytes; is the memory data width, Indicates the memory data frequency, Indicates the ratio of memory bandwidth occupied by the acquisition data FIFO. Indicates the data width of the receiving data end of the acquisition data FIFO. It indicates the frequency of the data receiving end of the acquisition data FIFO, and b indicates the utilization rate of the memory.
2. The ping-pong storage controller data processing method according to claim 1, characterized in that: Memory data width Satisfy the formula: in, is a constant greater than 4, Indicates the data width of the output data end of the read data FIFO, Indicates the frequency of the output data end of the read data FIFO.
3. The ping-pong storage controller data processing method according to claim 2, characterized in that: The memory utilization b is set to 60%.
4. The ping-pong storage controller data processing method according to claim 3, characterized in that: When the processor needs to read data, the arbitrator sets the flag_proc_read signal, and the data in the memory begins to be read into the read data FIFO; setting the read data trigger threshold , when the data capacity read from the memory by the read data FIFO is greater than When the flag_proc_read signal is triggered, the read data FIFO generates a pulse signal and sends the pulse signal to the processor, the processor reads all the data in the read data FIFO, and then the arbitrator resets the flag_proc_read signal and waits for the next trigger.
5. The ping-pong storage controller data processing method according to claim 4, characterized in that: Set the length of the read data FIFO to , in bytes, then: at the same time, in, Indicates the trigger threshold for reading data, in bytes; Indicates the data width of the output data end of the read data FIFO, Indicates the frequency of the output data end of the read data FIFO; is the memory data width, Indicates the memory data frequency, Indicates the ratio of memory bandwidth occupied by the read data FIFO.
6. The ping-pong storage controller data processing method according to claim 1, characterized in that: The memory is SDRAM, and the memory data is read and written in 8-burst mode.
7. The ping-pong storage controller data processing method according to claim 5, characterized in that: When the flag_clec_write and flag_proc_read signals are valid at the same time, the output data end of the acquisition data FIFO is first connected to the memory to complete two write operations and then disconnected. Then, the receiving data end of the read data FIFO is connected to the memory to complete a read operation and then disconnected. Then, the output data end of the acquisition data FIFO is connected to the memory again to complete two write operations.
8. A ping-pong storage controller based on FPGA, characterized in that: The ping-pong storage controller data processing method applied to any one of claims 1-7 comprises: Data acquisition system, used for data collection; FPGA, the FPGA is connected to the data acquisition system and is used to transmit data collected by the data acquisition system; A memory, connected to the FPGA, and used to store data transmitted by the FPGA; A processor, connected to the FPGA, and configured to process data transmitted by the FPGA; The FPGA is provided with a data acquisition FIFO, a data read FIFO and an arbitrator, the data receiving end of the data acquisition FIFO is connected to the data acquisition system, and the data output end of the data acquisition FIFO is connected to the memory; the data receiving end of the data read FIFO is connected to the memory, and the data output end of the data read FIFO is connected to the processor; The arbiter is connected to the collected data FIFO and the read data FIFO respectively.
9. The ping-pong storage controller according to claim 8, characterized in that: The data acquisition system is a camera system.
