How do I declare a packed array in Verilog?

OP #6371301
Rate this post
useful
not useful
I've created an (enum) called (color), and included it in a packed 
(struct) called (triple), and then created a ten-element array called 
(group) in the following code:
1
module EnStAr ();
2

3
typedef enum { RED, ORANGE, YELLOW, GREEN, BLUE, VIOLET } color;
4
typedef struct packed
5
{   color clr;
6
  integer xCoo;
7
  integer yCoo;
8
} triple;
9

10
triple [ 9:0] group;
11

12
endmodule
When I execute the following command I get the following single error 
message:
1
D:\Hf\Verilog\Common>\Icarus\bin\iverilog -g2009 -o EnStAr.out EnStAr.sv
2
EnStAr.sv:10: Compound type is not PACKED in this context.
3

4
D:\Hf\Verilog\Common>
Line 10 is where I declare my array. Is this saying my array is not 
packed? If so, how do I fix this so that my array is packed? I guess the 
bottom line is, how do I change this file so that Icarus' simulator will 
compile it without error messages?
Guest #6375077
Rate this post
useful
not useful
Could you solve the Problem? Your code compiles w/o problems in Questa. 
Maybe icarus cannot deal with packed arrays of complex elements. Do you 
really need a packed array here? Otherwise try
triple group [9:0]
Guest #6377153
Rate this post
useful
not useful
To be honest, I dont know. Generally it is supported by SV, but it seems 
Icarus does not.
Anyway, a packed array only makes sense if you want to assign the 
complete array from a large bit vector for example. In this case, the 
array must be "dense", as the bit vector is. If the array elements are 
addressed via array index only, there is no need for using packed 
arrays.

Reply

Please log in before posting.

or

Log in with Google account

Registration is free and takes only a minute.

Register now