configurable image data caching system based on FPGA and DDR3SDRAM

文档序号:1708677 发布日期:2019-12-13 浏览:10次 中文

阅读说明:本技术 基于fpga和ddr3 sdram的可配置图像数据缓存系统 (configurable image data caching system based on FPGA and DDR3SDRAM ) 是由 黄宏敏 熊晓明 胡恩 张明森 于 2019-07-23 设计创作,主要内容包括:本发明公开了一种基于FPGA和DDR3SDRAM的可配置图像数据缓存系统,包括外部存储模块、存储控制模块、第一缓存模块、第二缓存模块以及缓存控制模块,视频图像数据和时钟信号从缓存控制模块写入到第一缓存模块进行第一级缓存;存储控制模块再控制从第一缓存模块读取数据储存到外部存储模块;然后存储控制模块控制从外部存储模块读出储存的数据,写入到第二缓存模块进行第二级缓存;接着,缓存控制模块控制从第二缓存模块读取出数据到缓存控制模块,缓存控制模块将图像数据进行调整并产生对应的读有效信号,将这些配置数据输出给外界。本发明可以缓存更大的数据传输,达到数据传输的实时性、稳定性的效果;封装后的系统只有少许的端口,配置更加便捷。(The invention discloses a configurable image data caching system based on FPGA and DDR3SDRAM, which comprises an external storage module, a storage control module, a first caching module, a second caching module and a caching control module, wherein video image data and a clock signal are written into the first caching module from the caching control module to perform first-level caching; the storage control module controls the data read from the first cache module to be stored in the external storage module; then the storage control module controls the data read out from the external storage module and writes the data into the second cache module for second-level caching; and then, the cache control module controls the data read from the second cache module to the cache control module, adjusts the image data and generates corresponding effective reading signals, and outputs the configuration data to the outside. The invention can buffer larger data transmission, and achieves the effects of real-time performance and stability of data transmission; the packaged system has only a few ports, and the configuration is more convenient.)

1. Configurable image data caching system based on FPGA and DDR3SDRAM is characterized by comprising an external storage module, a storage control module, a first caching module, a second caching module and a caching control module, wherein:

the external storage module is used for storing image data;

The storage control module is used for receiving image data, clock signals and write enable signals sent from the outside and caching data by utilizing the first cache module, the external storage module and the second cache module;

the first cache module is used for performing first-level cache on the image data;

The second cache module is used for performing secondary cache on the image data;

the cache control module is used for reading the data of the second-level cache from the second cache module, adjusting the data and outputting the adjusted data to the outside;

The working process of the system comprises the following steps:

the storage control module receives image data, a clock signal and a write enable signal from the outside, adjusts the data and writes the data into the first cache module; the first cache module performs first-level caching on data written into the storage control module; after the external storage module is prepared, the storage control module reads data from the first cache module and stores the data into the external storage module;

When the outside needs to read the image data, the storage control module firstly reads the stored data from the external storage module and writes the data into the second cache module for secondary cache; when the cache control module receives an external read enable signal and a clock signal, the cache control module reads data from the second cache module, adjusts image data in the data, generates a read effective signal corresponding to the image data, and outputs the adjusted image data and the read effective signal to the outside.

2. The FPGA and DDR3SDRAM based configurable image data caching system of claim 1 wherein said memory control module receives image data, clock signals and write enable signals from the outside world and conditions them, comprising:

Splicing continuous image data according to the bit width of the written data of the first cache module, so that the bit width of the spliced image data is the same as the bit width of the written data of the first cache module; meanwhile, the same data bit width is adjusted for the clock signal; wherein the write enable signal controls the start of the data processing by the memory control module.

3. The FPGA and DDR3SDRAM based configurable image data caching system of claim 1, wherein the cache control module reads data from the second cache module when receiving an external read enable signal and a clock signal, comprising:

The external input read enabling signal and the clock signal are transmitted to the cache control module, the cache control module writes an enabling command for reading data in the second cache module and the clock signal, and controls the data to be read from the second cache module to the cache control module;

and splitting and adjusting the data read from the second cache module into the required bit width, and generating a read effective signal corresponding to the adjusted image data while outputting the adjusted image data.

4. The FPGA and DDR3SDRAM based configurable image data caching system of claim 1 wherein said external memory module is DDR3SDRAM and said first and second cache modules are asynchronous FIFOs.

Technical Field

The invention relates to the technical field of data storage and image transmission, in particular to a configurable image data caching system based on an FPGA and a DDR3 SDRAM.

background

at present, the development of video image technology is faster and faster, the resolution of images is higher and higher, the use of high frame frequency images is more and more frequent, in order to achieve a real-time effect, collected data needs to be cached, and the cache capacity needed by the collected data is larger and larger. Therefore, the requirements for high-speed, large-capacity, and real-time processing of high-resolution, high-frame-rate image data are increasing. Particularly, in the technology of data caching, under the condition of occupying precious memory, the data caching provides the advantages of being capable of quickly accessing data and accelerating the response speed. However, too little buffering results in additional unprofitable overhead, and too much buffering may result in overflow of data. Therefore, it is also important to select an appropriate buffer data size.

For the requirements of high-speed and real-time video Data acquisition and caching, various DDR (Double Data Rate) caching schemes have appeared, and Double Data access is to sample Data at both the rising edge and the falling edge of a working clock, so that the storage Rate is effectively increased. DDR3SDRAM (DDR 3) is the most common efficient scheme at present, and has the advantages of greatly improved capacity, rate and compatibility compared with DDR and DDR2, and DDR3 has the characteristics of high bandwidth, high reliability, low power consumption and low cost. Because the number of DDR3 pins is too many, the DDR3 pins are too cumbersome to use, and the DDR cannot directly complete the caching of the acquired data by the read-write operation set to the outside like FIFO (First Input First output), and a read-write operation control module needs to be set by the DDR control module to control the data caching of the DDR, so that the development time and cost are greatly increased. The existing scheme cannot meet the real-time requirements of high-resolution and high-frame-frequency videos due to the defects of low data transmission rate, complex operation, long development period, poor portability and the like. Moreover, the existing scheme can only cache one type of data, and the configurability is poor.

disclosure of Invention

The invention aims to provide a configurable image data caching system based on an FPGA and a DDR3SDRAM, so as to overcome the defects of slow data transmission rate, complex operation, long development period, poor configurability and the like in the prior art.

In order to realize the task, the invention adopts the following technical scheme:

configurable image data caching system based on FPGA and DDR3SDRAM includes external memory module, storage control module, first buffer module, second buffer module and buffer control module, wherein:

The external storage module is used for storing image data;

The storage control module is used for receiving image data, clock signals and write enable signals sent from the outside and caching data by utilizing the first cache module, the external storage module and the second cache module;

the first cache module is used for performing first-level cache on the image data;

the second cache module is used for performing secondary cache on the image data;

The cache control module is used for reading the data of the second-level cache from the second cache module, adjusting the data and outputting the adjusted data to the outside;

The working process of the system comprises the following steps:

the storage control module receives image data, a clock signal and a write enable signal from the outside, adjusts the data and writes the data into the first cache module; the first cache module performs first-level caching on data written into the storage control module; after the external storage module is prepared, the storage control module reads data from the first cache module and stores the data into the external storage module;

When the outside needs to read the image data, the storage control module firstly reads the stored data from the external storage module and writes the data into the second cache module for secondary cache; when the cache control module receives an external read enable signal and a clock signal, the cache control module reads data from the second cache module, adjusts image data in the data, generates a read effective signal corresponding to the image data, and outputs the adjusted image data and the read effective signal to the outside.

Further, the memory control module receives image data, a clock signal and a write enable signal from the outside and adjusts the data, including:

splicing continuous image data according to the bit width of the written data of the first cache module, so that the bit width of the spliced image data is the same as the bit width of the written data of the first cache module; meanwhile, the same data bit width is adjusted for the clock signal; wherein the write enable signal controls the start of the data processing by the memory control module.

further, when the cache control module receives an external read enable signal and a clock signal, the cache control module reads data from the second cache module, including:

the external input read enabling signal and the clock signal are transmitted to the cache control module, the cache control module writes an enabling command for reading data in the second cache module and the clock signal, and controls the data to be read from the second cache module to the cache control module;

And splitting and adjusting the data read from the second cache module into the required bit width, and generating a read effective signal corresponding to the adjusted image data while outputting the adjusted image data.

furthermore, the external storage module adopts DDR3SDRAM, and the first cache module and the second cache module both adopt asynchronous FIFO.

the invention has the following technical characteristics:

1. the scheme integrates the advantages of DDR3 and FIFO, the 1GB DDR3 buffer capacity and the 1600MT/s transmission speed can buffer larger data transmission, and the effects of real-time performance and stability of data transmission are achieved; the FIFO is added to finish the buffering of the data by recognizing the read-write enable set by the outside.

2. Because the DDR3 has too many pins and is too complicated to use, the DDR3 is packaged with an FIFO module, an FIFO control module and the like by the scheme, and the research on using numerous pins of the DDR3 is avoided; the packaged system has only a few ports, is more convenient and faster to configure and is configurable, so that more suitable occasions are provided, and the size of the required cache data can be configured.

drawings

FIG. 1 is a block diagram of the system of the present invention;

FIG. 2 is a diagram of a DDR3 controller architecture;

FIG. 3 is a block diagram of an asynchronous FIFO;

FIG. 4 is a flow chart of FPGA design;

FIG. 5 is a schematic diagram of a packaged port of the system of the present invention.

Detailed Description

As shown in fig. 1, the invention discloses a configurable image data caching system based on FPGA and DDR3SDRAM, the system is built on FPGA platform, and includes an external storage module, a storage control module, a first caching module, a second caching module and a caching control module, wherein:

the external storage module is used for storing image data.

In this embodiment, the external storage module adopts DDR3SDRAM, and DDR3 has the characteristics of high bandwidth, high reliability, low power consumption, and low cost, and is composed of 8 128MB granules, and the memory is 1 GB. The data bit width of each memory particle is 8 bits, 8 memory particles are put together to form a memory strip with the data bit width of 64 bits, and the burst length of the memory strip is set to be 8, so that the data bit width of each read-write can reach 512 bits, and the read-write efficiency of DDR3 is improved to a great extent. DDR3 can work at 800MHz interface frequency and has transmission speed up to 1600 MT/s. This patent uses DDR3 as external Memory module, compares the buffering of modules such as RAM (random Access Memory), FIIFO, and cache capacity has obtained very big promotion. As shown in fig. 2, since DDR3 has too many pins, it takes much time and effort if each solution needs to research its pins, so it is another object of the solution to reduce the time and effort. The data reading and writing of the external storage module are controlled by the storage control module, the external storage module caches the data written by the storage control module, and the storage control module controls the cached data to be read out.

the storage control module is used for receiving image data, clock signals and write enabling signals sent from the outside, and caching data by utilizing the first cache module, the external storage module and the second cache module.

the storage control module is used as a bridge for connecting the on-chip data to the external storage module, and generates a command for reading and writing the external storage module and an address for storing the data. The Memory control module (DDR3 controller) utilizes the Xilinx official MIG IP core (Memory Interface Generator) and the internal port structure diagram is shown in fig. 2. User logic is only needed to be written according to the MIG kernel user interface protocol, and read-write commands, addresses and data information are generated according to the requirements of the user logic. The read-write command of the external storage module is controlled and generated by the storage control module, and the storage control module writes a state machine to complete all functions. When the external memory module is initialized successfully, the state machine of the memory control module writes a DDR3 read-write data control command. When the external storage module writes data, the storage control module controls the data read from the reading end of the first cache module to be written into the external storage module for caching; when the external storage module reads out data, the storage control module reads out the data cached in the external storage module and then transmits the data to the second cache module.

The first cache module is used for performing first-level cache on the image data.

The first buffer module WR _ FIFO is implemented using the standard IP of the asynchronous FIFO (as shown in fig. 3) of the Xilinx FPGA. Because the pins of the first cache module are too many, the scheme does not need too many pins and only needs a part of the pins, and therefore the pins are selected and set. Because the bit width of the DDR3 read-write data adopted by the scheme is 512 bits, the scheme adopts an asynchronous FIFO as a first cache module to convert the connection data. If the WR _ FIFO needs to read 512 bits of data for transmission to the external memory module, then data greater than or equal to 64 bits must be written, so the data written into the WR _ FIFO is set to 64 bits, the read bit width is set to 512 bits, and the data depth is set to 512. The WR _ FIFO module can obtain 64bit write-in data and a clock control signal from the buffer control module, and after the WR _ FIFO is temporarily cached and the external storage module is ready (initialization is completed), the storage control module controls the data read out from the WR _ FIFO read-out end by 512bit to be written into the external storage module for caching. The reset signal of WR _ FIFO is the same as the user clock of external memory module, i.e. high level reset, low level work, its write clock is controlled by memory control module, read clock is the same as the user clock of external memory module; the read enable of the buffer is controlled by the memory control module, and the residual memory capacity in the first buffer module is provided by the built-in counter.

The second cache module is used for performing secondary cache on the image data.

The working principle of the second cache module RD _ FIFO is similar to that of the first cache module, and asynchronous FIFO is adopted; since the read data bit width of the external memory module in this embodiment is 512 bits, the write data bit width of the RD _ FIFO is also set to be 512 bits correspondingly. When 512-bit data is written into the RD _ FIFO, the bit width of read data is greater than or equal to 64 bits, so that the bit width of the read data of the RD _ FIFO is set to 64 bits, and the data depth is set to 512. The RD _ FIFO write clock is the same as the user clock of the external storage module, the write enable of the RD _ FIFO is also controlled by the storage control module in the same way, the read clock is controlled by the cache control module, and when the state machine of the storage control module jumps to the read, the write enable of the RD _ FIFO is pulled high. The RD _ FIFO buffers 512 bits written in by data, then the buffer control module controls the RD _ FIFO to read out 64-bit data, then different data bit width parameters are set according to external requirements, the 64-bit data are converted into the required bit width data, and the required bit width data are read out to be processed externally. Meanwhile, the clock signal corresponding to the read data is also adjusted correspondingly to the read data.

The cache control module is used for reading the data of the second-level cache from the second cache module, adjusting the data and outputting the adjusted data to the outside.

The cache control module is used as a data writing and reading module, receives external data writing, adjusts the written data, and completes required functions through a programming state machine. When the cache control module receives writing of image data, the image data is converted into 64-bit data, for example, the written image pixel data is 16-bit or 24-bit data, and the like, and several continuous data are combined into 64-bit data in a conversion and splicing manner at the cache control module. Meanwhile, after a plurality of data are spliced, in order to avoid confusion of data transmission, clock signals of the data are changed correspondingly, and the clock signals are adjusted by the cache control module to correspondingly recombine 64-bit data. And finally, transmitting the recombined image data and the corresponding clock signal to the WR _ FIFO module at the same time. When the cache control module reads out the image data, the generated read-out data signal controls the RD _ FIFO module to read out 64bit of image data to the cache control module, the required data with different bit widths are obtained through operations such as data splitting, recombination and the like, and finally the data are read and written to the outside. Meanwhile, the cache control module also correspondingly adjusts the read clock. In order to adapt to writing and reading of image data with different bit widths, the data bit width parameter is set to be adjustable after encapsulation, and the data bit width parameter can be set to adapt to writing and reading of the image data, for example, image data with 16 bits or 24 bits needs to be written, and the parameter can be adjusted to achieve the purpose.

On the basis of the above technical solution, as shown in fig. 5, the working process of the configurable image data caching system based on the FPGA and the DDR3SDRAM of the present invention is as follows:

Step 1, the storage control module receives image data, clock signals and write enable signals from the outside, adjusts the data and writes the data into the first cache module.

in this step, the buffer control module receives the image data input _ data, the write clock signal WR _ clk, and the write enable signal WR _ en transmitted from the outside, but the written image data may have different bit widths, for example, the bit width of RGB24 data is 24 bits, the bit width of RGB565 is 16 bits, RGB555, RGB32, and the like, so that they need to be adjusted to be suitable for the bit width of the data written by the first buffer module WR _ FIFO.

In the scheme, the configurable data bit width is needed, so that the needed data bit width can be set to meet the requirement of writing data. In this embodiment, the bit width of the written data of the WR _ FIFO is 64 bits, but the image data written from the outside is not so large, so that several consecutive image data are spliced to form 64-bit data, and the written WR _ FIFO clock also needs to be adjusted by corresponding multiples. For example, 24-bit image data is written from the outside, the image data is converted into 32-bit data, two adjacent image data are spliced into 64-bit data, and meanwhile, a data writing clock is expanded to be twice of the original data writing clock. The write enable signal wr _ en controls the start of the processing of the image data by the buffer control module. The buffer control module controls the transmission of the recombined data, the clock signal and the enable signal to the WR _ FIFO, and controls the buffer in the WR _ FIFO so as to read data by a later asynchronous clock. Meanwhile, the full signal full 1 reminds the outside, at this time, the WR _ FIFO is full, and data writing into the cache system is stopped; the empty signal empty 1 indicates that the cache system can write data.

step 2, the first cache module performs first-level cache on the data written into the storage control module; after the external storage module is prepared, the storage control module reads data from the first cache module and stores the data into the external storage module.

the first buffer module WR _ FIFO buffers data written in by the buffer control module, in order to be suitable for an external storage module to write 512-bit data, the WR _ FIFO module uses an asynchronous FIFO, the scheme directly calls the existing FIFO IP module of the Xilinx FPGA, and the bit width of the written data is set to be 64 bits, and the bit width of the read data is set to be 512 bits. When the initialization of the external storage module is completed, the write-in data begins to be received, the storage control module generates a command of reading WR _ FIFO data, and the read data is directly stored in the external storage module. The storage control module has a vital function as a bridge connecting the first cache module and the external storage module, and controls the reading and writing of data of the external storage module. When the WR _ FIFO module writes data to reach the read requirement, the WR _ FIFO module generates a readable signal to the memory control module, and the memory control module state machine generates an enable signal for reading the WR _ FIFO and a read clock signal, thereby controlling the data read from the WR _ FIFO. Also, the clock signal for writing data by the external memory module and the clock signal for reading data by the WR _ FIFO are the same frequency.

And 3, when the outside needs to read the image data, the storage control module firstly reads the stored data from the external storage module and writes the data into the second cache module for secondary caching.

the second cache module RD _ FIFO also uses an asynchronous FIFO, directly calls the existing FIFO IP module of the Xilinx FPGA, and sets the bit width of the write-in data to be 512 bits and the bit width of the read-out data to be 64 bits. The external storage module stores data and then gives a readable signal to the storage control module, the storage control module generates an enable signal for reading the external storage module and a read clock signal and simultaneously generates an enable signal for writing into the RD _ FIFO, and the read data are 512 bits and are directly written into the RD _ FIFO for caching. The buffer memory RD _ FIFO waits for the buffer control module to read. The clock signal for the external memory module to read data and the clock signal for the RD _ FIFO to write data are the same frequency.

And 4, when the cache control module receives the external read enable signal and the clock signal, the cache control module reads data from the second cache module, adjusts the image data in the data and generates a read effective signal corresponding to the image data, and outputs the adjusted image data and the read effective signal to the outside.

After the data is cached in the second cache module, when a read enable signal RD _ en and a clock signal RD _ clk are input from the outside, the cache control module compiles an enable command and a clock signal for reading the RD _ FIFO data of the second cache module, and controls the RD _ FIFO cache module to read the data to the cache control module.

Since the bit width of the read data of the RD _ FIFO is set to 64 bits in this embodiment, the buffer control module will read the 64-bit data from the RD _ FIFO. Because the data bit width required by the later data processing is different, the 64-bit data read by the degree needs to be split and adjusted, and then the data is converted into the required bit width. The buffer control module adjusts the image data read out by the RD _ FIFO module according to the image data written into the WR _ FIFO module in the step 1, for example, the 64bit written into the WR _ FIFO in the step 1 is formed by splicing two 24-bit image data converted into 32 bits, so the 64-bit image data read out by the RD _ FIFO module also corresponds to the two image data, and the two image data are split or recombined according to the requirements. The clock signal for reading the RD _ FIFO and the clock signal for writing the WR _ FIFO are the same frequency. The buffer control module outputs the adjusted image data and simultaneously generates a read valid signal rd _ valid corresponding to the adjusted data, and the image data and the read valid signal are output to the outside. If the buffer system is empty, the empty output is 1.

In summary, the video image data and the clock signal are written into the WR _ FIFO module from the buffer control module to perform the first-level buffer; the storage control module controls the WR _ FIFO module to read data and store the data into an external storage module; then the storage control module controls the data read out from the external storage module and writes the data into RD _ FIFO for second-level caching; and then, the cache control module controls the data read from the RD _ FIFO cache module to the cache control module, adjusts the image data and generates corresponding effective reading signals, and outputs the configuration data to the outside.

the above implementation is based on the FPGA, and the FPGA is designed by adopting hardware platform tools such as vivado, ise and the like, and the FPGA design flow is shown in FIG. 4. According to the scheme, a hardware platform tool is used for packaging all the functional modules to form a high-capacity cache system. Because the DDR3 chip of 1GB is adopted, the capacity of the packaged system reaches 1GB and is larger than the memory of common FIFO, RAM and the like, and the video data with higher resolution and frame frequency can be cached. The parameters are designed in the packaging module, and the packaged module can set the parameters according to the requirement, so that the configurable effect is achieved. The output ports are shown in fig. 5. And a complex port is not provided, so that the development workload is greatly reduced.

11页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:安全系统单芯片及其操作方法

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!

技术分类