【发布时间】:2020-01-04 19:52:56
【问题描述】:
我正在尝试设计一个最多接受 N=4 个字并且每个字的位宽为 M=2 的 fifo。 我首先设计了一个 1 位宽的字 fifo,我试图将它用于更宽的字。我在调试线路时遇到问题
single_fifo fArr[M-1:0]({M*{clk}},{M*{reset}},in,{M*{push}},{M*{pop}},out,full_string);
在收到以下错误时:
ncelab: *E,PCAVDM (./fifo.v,85|27): 实例数组中端口连接表达式 (32) 的向量长度与实例数 (2) 和端口长度 (1) 的乘积不匹配)。 single_fifo fArrM-1:0;
我的代码没有任何 32 位长,所以我对这个错误感到很困惑。
我的代码:
module fifo(clk, reset, in, push, pop, out, full);
parameter N=4; // determines the maximum number of words in queue.
parameter M=2; // determines the bit-width of each word, stored in the queue.
input clk, reset, push, pop;
input [M-1:0] in;
output [M-1:0] out;
wire [M-1:0] full_string;
output full;
wire full;
single_fifo fArr[M-1:0]({M*{clk}},{M*{reset}},in,{M*{push}},{M*{pop}},out,full_string);
assign full=|full_string;
endmodule
如果需要,我还会添加 single_fifo 的端口列表:
module single_fifo(clk,reset,in_bit,push,pop,out_bit,full);
parameter N=4; // determines the maximum number of words in queue.
input clk, reset, push, pop;
input in_bit;
output out_bit;
reg [N-1:0] bit_list;
reg [N-1:0] n;
reg out_bit;
output full;
reg full;
对不起,如果我的问题看起来很无聊,我还是 verilog 的新手。将获得帮助!
【问题讨论】:
-
{M*{clk}表示 M 乘以 clk 和 32 位宽的结果。您可能指的是{M{clk}},它是具有 2 位结果的复制运算符。 -
你今天第二次帮助我,你是救命稻草!谢谢!
标签: verilog