Icarus; 2-dim array help

  • Thread starter Guenter Dannoritzer
  • Start date
G

Guenter Dannoritzer

Guest
Hi,

I try to use a 2-dimensional array in a module and get an error message
when compiling with Icarus Verilog.

Can anybody give me a hint what I am doing wrong?

This is the code:


module test;

integer matrix[0:4][0:1];

initial begin

$display("hello");

end

endmodule



I stripped the module down to this and changing the array to a
1-dimensional works just fine.

I am using Icarus 0.8.1 and compile with the following command:

iverilog -o test.vvp test.v


Thanks for the help


Guenter
 
Berty wrote:

Two points,
First integer doesn't have range they are 32 bit so you probably want
to use reg.
Second change the declaration to be
reg [4:0] matrix [0:1] ;
And this should take you to your next step.

Have fun
Thanks for the information.

Someone else suggested that already to me, but that does not allow me to
store integer values in a 2-dimensional array. I want to use it for a
test bench, so it does not need to synthesize.

Verilog 2001 introduced multidimensional arrays. But doing some more
searching on the web I am not so sure what actually is supported by it.

This paper from synplicity
http://www.synplicity.com/literature/pdf/Verilog_2001_75.pdf

says that Verilog 2001 supports multidimensional wires, with any dimension.


Here is a link to some slides from Anders Nordstrom about Verilog 2001

http://www.ewh.ieee.org/r7/ottawa/comsoc/IEEE_Verilog_Presentation.pdf

and on page 27 (Adobe page 26) it shows that not only wires, but also
registers are supported with multidimensional arrays.


Can anybody shed some light on this issue, what does the Verilog 2001
standard actually support?

Can I do this:

integer matrix[1:200][0:1];

and get a 200x2 array of integers?


And now a question to the Icarus Verilog user, does Icarus support that ?


Thanks for the help.

Guenter
 
Two points,
First integer doesn't have range they are 32 bit so you probably want
to use reg.
Second change the declaration to be
reg [4:0] matrix [0:1] ;
And this should take you to your next step.

Have fun
 
Yes, Verilog-2001 allows declaring multidimensional arrays of
regs/variables. That should include 2-dimensional arrays of integers.

That doesn't necessarily mean that Icarus Verilog supports it. It is
possible that it supports multidimensional arrays of regs, but not
integers. You might want to try an equivalent declaration using regs,
just in case it works (i.e. reg signed [31:0] matrix [1:200][0:1]).
 

Welcome to EDABoard.com

Sponsor

Back
Top