I'm trying to design a fifo that accepts a maximum of N=4 words and has a M=2 bit width of each word. I first designed a 1 bit width word fifo and I'm trying to use it for the wider one. I'm having an issue debugging the line
single_fifo fArr[M-1:0]({M*{clk}},{M*{reset}},in,{M*{push}},{M*{pop}},out,full_string);
While getting the following error:
ncelab: *E,PCAVDM (./fifo.v,85|27): Vector length of port connection expression (32) in array of instances does not match product of number of instances (2) and port length (1). single_fifo fArrM-1:0;
My code has nothing that's 32 bits long so I'm quite confused by this error.
My code:
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
I'll also add the list of ports for single_fifo in case it's required:
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;
Sorry if my question seems noobish, I'm still new to verilog. Help will be appriciated!
{M*{clk}means multiplication of M by clk and the 32-bit wide result. you probably meant this{M{clk}}which is the replication operator with a 2-bit result.