What alternatives can be used instead of dynamic arrays in Verilog and Quartus?

  • Thread starter Thread starter nadersb
  • Start date Start date
  • Tags Tags
    Array Dynamic
AI Thread Summary
Dynamic arrays are not supported in Verilog and Quartus, leading to discussions on alternatives for handling variable-sized inputs in hardware design. The primary suggestion is to use a large enough array to accommodate the maximum expected size, although this can waste logic resources. Dynamic reconfiguration is another option, allowing for flexibility in design without excessive resource consumption. The conversation highlights the challenges of synthesizing hardware with variable sizes, emphasizing the need for careful planning and resource management. Ultimately, the consensus is that while dynamic arrays are not feasible, strategies like zeroing out unused coefficients in a fixed-size array can be practical solutions.
nadersb
Messages
28
Reaction score
0
hello everyone
I know that dynamic array is not supported in Verilog and Quartus. I want to know does anybody has an idea or algorithm to use instead of dynamic array. I mean I am searching for something that works instead of a dynamic array.
thanks
 
Engineering news on Phys.org
nadersb,
Dynamic arrays is a verification feature, i.e. for use in test bench. It is not generally synthesizable.

Think of what Quartus would have to do to synthesize int dyn_array[];. How much memory, or how many logic elements should it assign? How would it know if the logic fit in a the target device?

Perhaps explain why you think you need a synthesizable dynamic array.
 
Last edited:
yes I know it is not synthesizable because the problems you have mentioned and that's why I need something else.
let me explain more, I have a module that its input is not fixed size. it can be 16,32,64... bits. the easiest solution is to use a large enough array for input, but it wastes too much logic cells. so I am thinking and searching for an algorithm that help me in this case.
 
When is the size determined, during instantiation of the module or after download?
 
size itself is an input. it is a filter that number of its coefficient is changeable.and size depends on how accurate filter should be.
 
Is it an input to the module during instantiation or an input to the FPGA itself (say from software) after it has been downloaded?
 
it is an input to FPGA itself
 
Sounds like your options are either dynamic reconfiguration, or design to accommodate the largest possible size.

If this is a transversal (FIR) filter of max length, say, 128 coefficients than you need enough RAM to store these coefficients anyway. If you want to scale back the accuracy then just zero out the unused coefficients. Filter will work normally except with some non-optimal delay.

Of course I am speculating without having any idea about your architecture.
 
yes I think so. I think there is no way instead of using large size array unfortunately
 
  • #10
hmmm

are string variables dimensionable on the fly?

ignore suggestion if it's silly - I'm still living in the age of interpreted Basic.


old jim
 
  • #11
Hey Jim,

In an ordinary programming language the programmer often has the luxury of assuming that there is limitless memory available. When the program is run and it decides it needs a certain amount of memory, say for a string variable, it makes the request to the operating system. The operating system keeps track of how much memory is available, and who is using what, and will allocate a block to this program. Later, the program can notify the operating system that it no longer needs this memory, and it gets returned to "the heap".

Synthesizable Verilog kind of looks like a programming language but is actually a "hardware description language". It is really just a text way of doing what we did years ago with pencil, stencil, and D-size schematic sheet to design digital logic. If I needed a register big enough to hold a 32-bit word, I drew in 32 flip-flops on my schematic, then build my board. Today in verilog we "instantiate a 32 bit register" and program the FPGA. In both cases a piece of hardware has been created. And, just like there was limited real estate on my digital logic board, there are limited logic resources available within an FPGA, so we try to be very conservative (the point of the OPs post). If I change my mind and decide I needed it to be a 64-bit register, I have to change the verilog code, and reprogram the FPGA and hope that it can "fit" the design. If it needs to be 32-bit most of the time, and 64-bit occasionally, I need to build it with 64-bits.

Of course, this is somewhat simplified for clarity's sake. It is actually pretty unlikely that bumping a single register up in size by 32 bits would cause a fitting issue. Even modest FPGAs today provide tens of thousands of flip-flops.
 
Last edited:
  • #12
Thanks EMIguy for that neat introduction. What amazing tools you have these days!

If I needed a register big enough to hold a 32-bit word, I drew in 32 flip-flops on my schematic...

i remember an old Honeywell DDP15 with discrete transistor flip-flops and drum memory about a foot diameter
it replaced the old 12AU7 based machine for an airline reservation system...
but in my heyday we had 4 bit MSI registers...

anyhow , thanks again. I'll probably never use such a thing but it is comforting to have a rudimentary idea of its existence.

old jim
 
Back
Top