在直接实例化参数化模块 (LPM) 功能的第一次输入 (FIFO) 库时,您可能会出现此错误。如果实例化的 FIFO 缓冲区使用该单元并记录两个算法函数,则无法通过 defparam
参数传递参数。即使已正确编码,下面的示例也无法工作。
. . . module fifo256x8 (data, rreq, wreq, clock, clockx2, aclr, threshlevel, threshold, empty, full, usedw, q); input [7:0] data; input [7:0] threshlevel; input rreq, wreq, clock, clockx2, aclr; output [7:0] q; output [7:0] usedw; output threshold, empty, full; sfifo inst_1 (.data (data), .rreq (rreq), .wreq (wreq), .clock (clock), .clockx2 (clockx2), .aclr (aclr), .q (q), .usedw (usedw), .threshold (threshold), .empty (empty), .threshlevel (threshlevel), .full (full)); defparam inst_1.lpm_width = 8; defparam inst_1.lpm_numwords = 256; endmodule . . .
变通方法是在虚拟化图形设计文件(.gdf)文件中使用其所有参数集实例化 FIFO 函数,并为其提供特定名称(例如 ,my_fifo.gdf)。为 GDF 创建默认 Include 文件(.inc)。在顶级 Verilog HDL 代码中实例化 GDF,而无需指定任何参数。下面的示例将起作用(与上面的示例对应)。
. . . module fifo256x8 (data, rreq, wreq, clock, clockx2, aclr, threshlevel, threshold, empty, full, usedw, q); input [7:0] data; input [7:0] threshlevel; input rreq, wreq, clock, clockx2, aclr; output [7:0] q; output [7:0] usedw; output threshold, empty, full; my_fifo inst_1 (.data (data), .rreq (rreq), .wreq (wreq), .clock (clock), .clockx2 (clockx2), .aclr (aclr), .q (q), .usedw (usedw), .threshold (threshold), .empty (empty), .threshlevel (threshlevel), .full (full)); endmodule . . .
my_fifo.gdf 包含 SFIFO
关于 lpm_width = 8
和 。 lpm_numwords = 256
上面的端口映射是指 my_fifo.gdf,与 SFIFO
超级功能无关。