verilog $readmemh对于50x50像素的RGB图像来说需要太多的时间。[英] verilog $readmemh takes too much time for 50x50 pixel rgb image

本文是小编为大家收集整理的关于verilog $readmemh对于50x50像素的RGB图像来说需要太多的时间。的处理/解决方法,可以参考本文帮助大家快速定位并解决问题,中文翻译不准确的可切换到English标签页查看源文。

问题描述

我正在尝试编译用于​​FPGA编程的Verilog代码,我将在其中实施VGA应用程序.我使用Quartusii和Altera.我正在尝试正确使用readmemh用像素来获取图片像素.

目前,我已经使用MATLAB将图片转换为RGB文本.每个都有以下格式,没有其他格式(示例): 03 A0 15 B7 ...

目前我还没有得到任何语法错误,但是我必须定义三个寄存器,每个寄存器每个具有50x50 = 2500位,并且编译速度较慢,并且我收到的"未达到时间要求"警告.

当我想使用具有更好分辨率的文件时(640x480会很棒,但似乎是不限制的),情况差得多.获得200x200像素图像和.sof文件的时间约为6MB,花了15分钟.

没有一种方法可以将readmemh用于大型输入吗?

那是我阅读的

...
reg [7:0] mem_R[0:2499];
reg [7:0] mem_G[0:2499];
reg [7:0] mem_B[0:2499];

initial begin

...

$readmemh("menuR.txt", mem_R);
$readmemh("menuG.txt", mem_G);
$readmemh("menuB.txt", mem_B);

end

我访问如下

if( mem_R[total_current-127510] > 0)
begin
menu_red   = 1;
end

 50x50像素的编译报告

推荐答案

首先,一些背景:

由于图像的大小,您可能会得到"未达到的时序要求" -50x50x8x3是相当数量的存储位,如果试图将它们存储到逻辑中而不是芯片上的car上,则莫雷索.

640x480图像为900 kb,因此,最大的FPGA将能够存储它们,即使在芯片上的RAM中 - 例如,最大的旋风静脉IV仅具有810 KB的嵌入式内存.如果您打算使用此尺寸的图像,请考虑连接外芯片公羊.

您在启动上看到的图像很可能存储在EPCS -2MB至16MB闪存中,用于在启动上加载默认配置.它加载配置(就像通过USB编程)和任何芯片内存.如果您使用的是Altera de系列板之一,则启动图像不会存储为640x480 - 它已通过硬件扩展到该分辨率.

另外,您提到的15分钟是指编译时间还是将.sof加载到芯片的时间?请注意,如果您是指的话,HDL汇编不是不合理的. Quartus不仅需要编译您的HDL,还需要确定其需要的逻辑元素,将它们放在芯片上以及如何连接它们.大型设计可能需要数小时或更长时间才能建造.

最后,就您的问题而言,您可能还需要查看.mif(内存iNalation File)和/或.hex文件与ON/OFF-CHIP RAM IP核心组合,因为它们可能更适合您需要.请参阅: MERGEDPROJECTS/REFESSIR/词汇/def_mif.htm

本文地址:https://www.itbaoku.cn/post/2090974.html

问题描述

I am trying to compile a verilog code for FPGA programming where I will implement a VGA application. I use QuartusII and Altera. I am trying to use readmemh properly for acquiring a picture pixel by pixel.

For now, I have converted a picture into rgb texts using matlab. Each has the following format and nothing else (example): 03 A0 15 B7 ...

At the moment I am not getting any syntax errors however I had to define three registers each having 50x50 = 2500 bits and it is compiling quite slower, and I am getting "Timing requirements are not met" warning.

When I want to use a file with better resolution (640x480 would be great but its off limits, it seems) it is significantly lot worse. It took 15 minutes to get 200x200 pixel image and .sof file is around 6MB.

Isn't there a way to use readmemh for large inputs?

that is what I did to read

...
reg [7:0] mem_R[0:2499];
reg [7:0] mem_G[0:2499];
reg [7:0] mem_B[0:2499];

initial begin

...

$readmemh("menuR.txt", mem_R);
$readmemh("menuG.txt", mem_G);
$readmemh("menuB.txt", mem_B);

end

and I access it as follows

if( mem_R[total_current-127510] > 0)
begin
menu_red   = 1;
end

compilation report for 50x50 pixels

推荐答案

First, some background:

It's likely you're getting "Timing requirements not met" because of the size of the image - 50x50x8x3 is a fair number of storage bits, moreso if it's attempting to store them into logic instead of on-chip RAM.

A 640x480 image is 900 kB, so only the biggest FPGAs will be able to store them, even in on-chip RAM - for example, the largest Cyclone IV only has 810 kB of embedded memory. Consider connecting an off-chip RAM if you intend to use an image of this size.

The image you're seeing on startup is likely one stored in the EPCS - a 2MB to 16MB flash memory used to load a default configuration on startup. It loads the configuration (just like programming it via USB) and any on-chip memory. If you're using one of the Altera DE-Series boards, the startup image isn't stored as a 640x480 - it's scaled up to that resolution by the hardware.

Also, does the 15 minutes you mention refer to compilation time or the time require to load the .sof to the chip? Note that an HDL compilation isn't unreasonable, if that's what you're referring to. Quartus needs to not only compile your HDL, but than determine what logic elements it needs, where to place them on the chip, and how to connect them. Large designs can take hours or more to build.

Finally, as for your problem, you may also want to look into .mif (Memory Initalization File) and/or .hex files combined with a on/off-chip RAM IP Core, as they might be better suited to your needs. See: http://quartushelp.altera.com/14.1/master.htm#mergedProjects/reference/glossary/def_mif.htm