【发布时间】:2013-02-07 06:44:54
【问题描述】:
我正在使用 Lattice Diamond 编写 Verilog 代码进行综合。
我在一个文本文件中有二进制数据,我想将其用作我的代码的输入。
在模拟级别,我们可以使用 $readmemb 函数来做到这一点。这是如何在综合层面完成的?
我想访问文本文件中的数据作为 FPGA 的输入。
按照 Martin Thompson 先生的建议(答案如下),我编写了一个 Verilog 代码来从文件中读取数据。
Verilog 代码如下:-
module rom(clock,reset,o0);
input clock,reset;
output o0;
reg ROM [0:0];
reg o0;
initial
$readmemb("rom.txt",ROM);
always @(negedge clock,negedge reset )
begin
if(reset==0)
begin
o0<=0;
end
else
begin
o0<=ROM[0];
end
end
endmodule
当我在 fpga 上运行此代码时,我遇到了以下问题:-
如果我要读取的文本文件只有一位为“1”,那么我可以将输入输出引脚分配给时钟、复位和 ROM。但是,如果我在文本文件中有一位为“0”或多于一位的数据,我将无法分配输入引脚(即时钟、复位)并显示警告:-
WARNING: IO buffer missing for top level port clock...logic will be discarded.
WARNING: IO buffer missing for top level port reset...logic will be discarded.
我无法理解为什么会收到此警告以及如何解决它。
【问题讨论】:
-
你现在有一个不同的问题,值得一个不同的问题(所以不是讨论板)。请还原您的编辑并提出一个新问题,其中包含新问题
-
@Martin Thompson 感谢您的建议
标签: verilog fpga lattice-diamond