我想学习如何在FPGA中实现图像处理算法,并执行此操作我正在处理包含bmp图像(使用MATLAB转换)的txt文件。VHDL textio,从文件中读取图像
我有使用textio包的问题,所以到目前为止,我只能够读取第一列数据(但不是整行数据)。
TXT文件有该方面:
1,1,0,0,0
0,1,1,1,1
1,0,0,0,0
0,0,1,1,0
1,1,1,1,1
由逗号分隔的5x5矩阵。 实体的输出我现在在我的模拟是
1 0 1 0 1
对应于第一列。 我不明白为什么代码不会读取所有行,并且它何时结束跳转到下一行。
下面是过程读取文件(我已经添加了一个名为逗号,所以我可以检测到逗号并跳过它可变的,但仍然无法正常工作):
reading : process
constant filename : string := "C:\DOCUMENTACION\PROYECTOS\Envio_salida_VGA_atraves_FPGA\MatLab\Procesado de imagen con Toolbox\prueba.txt";
file f : text open read_mode is filename;
variable L : line;
variable data_read : integer;
variable comma : character;
begin
while not endfile(f) loop
wait until rising_edge(clk);
readline(f, L);
read(L, data_read);
while L = ',' loop
read(L, comma);
end loop;
d_out <= data_read;
end loop;
什么是错我的代码?
你有没有考虑过直接从软件驱动刺激模拟而不是通过文件?这个基于Python的示例处理位图,jpegs,tiff等,并自动比较输出的相似性:https://github.com/chiggs/oc_jpegencode – Chiggs