Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

unconstrained array in verilog

Status
Not open for further replies.

harian

Junior Member level 1
Joined
Jan 13, 2015
Messages
16
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
137
i have came to know that verilog doesnot support uncontrined array type. i need memory to store inputs before writing to txt file. the number of inputs are unknown. it is obviously not for synthesis purposes.is there way to do declare an array of unknown size .. i am thinking about this
Code:
integer length;
reg [5:0] mem [length:0];
.....
@(initial_step)
lenth = 0;

@(signal)
mem[0]= var1;
length = lenght +1;
 

Hi,

I don't know if verilog supports that. I think not (don't know if system verilog is better in this way)...but...
What would I do in this case is to create simulation script which is doing following:

1: to go through input file and calculate nr. of inputs
2: to create verilog include file with declaration of your array
3: to start simulation

Maybe quite complicated, but should be functional
 

Hi,

I don't think it is possible to change the array size during runtime.

the number of inputs are unknown
The number of inputs must be known.
But the number of samples (data sets) may be unknown. I recommend you should limit it to a fixed count.
"Unlimited" isn't possibke either.

Klaus
 

SystemVerilog supports dynamic arrays or queues that can be sized at run time. ModeslSim and most other simulators support this just by using a *.sv file extension.

Code:
reg [5:0] mem[]; // dynamic array

initial begin
     mem = new[length];
or
Code:
reg [5:0] mem[$]; // queue

initial begin
     mem.push_pack(var1); // adds one element to the queue.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top