0
\$\begingroup\$

Suppose I make a packed array as:

logic [x:0] packed;

As packed arrays guarantee continuous memory allocation, is there any restriction on the maximum value x can take?

toolic
10.8k11 gold badges31 silver badges35 bronze badges
asked Mar 12, 2024 at 13:45
\$\endgroup\$

1 Answer 1

4
\$\begingroup\$

Generally not for simulation, although if you store very large arrays it will eventually bog down the simulation, the OS, or the machine. The limiting factor here will be the amount of memory available on the host running the simulation and its allocation limits.

Here is an example

module tb ();
 // localparam WIDTH = 500000; produces an os seg fault
 localparam WIDTH = 50000;
 logic [WIDTH - 1 :0] temp1;
 logic [WIDTH - 1 :0] temp2;
 
 initial begin
 temp1 = '1;
 assign temp2 = temp1;
 $display("%d",temp2);
 end
endmodule

This code printed a big number for WIDTH = 50000 but seg faulted after about 30 seconds for WIDTH = 500000 in Cadence on EDA Playground.

For synthesis flows, you are limited by the amount of physical memory available in the device that synthesis is targeting. The max size will depend on what you are modeling (constants, registers, memory or combinational logic) and how much of that resource the part has. Vivado synthesis will run, then report at the end that a particular resources in >100% utilized. Place and route (implementation) will fail.

The smallest Xilinx 7-series part has 10 18K-by-1 BRAMs reference Xilinx DS180, page 2. So you could potentially store a single packed vector of 180K bits in that part. Or you could store two 90K packed vectors or..... up to the limit of 180K bits total in that part.

The parts tend to get hard to implement after some percent utilization, usually 85%-95% depending on what else is in the part. Don't expect 100% utilization of physical resources when building in synthesis flows for FPGAs.

answered Mar 12, 2024 at 13:54
\$\endgroup\$

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.