EmbDev.net

Forum: FPGA, VHDL & Verilog Can anyone explain "cannot currently create a parameter of type" compilation error message?


von Kevin S. (kvnsmnsn)


Rate this post
useful
not useful
I've written a piece of code with inputs (left) and (right) and output 
(result), each of which operand is a single bit, which returns a logical 
one in (result) if (left) has the same value as (right), and returns a 
logical zero otherwise. My code is:
1
module ModGc ( result, left, right);
2
output result;
3
input  left, right;
4
5
typedef enum { L_NOT, L_NAND, L_NOR } GateType;
6
7
typedef struct packed
8
{ GateType gateTp;
9
   integer out;
10
   integer inLow;
11
   integer inHigh;
12
} LogGate;
13
14
localparam integer nmGates  = 4;
15
localparam integer poolSize = 6;
16
localparam LogGate specs [ nmGates:1]
17
wire               pool  [ poolSize:1];
18
genvar             ix;
19
20
initial
21
begin
22
  specs[ 1].gateTp = L_NOR ; specs[ 1].out = 4; specs[ 1].inLow = 2; specs[ 1].inHigh = 3;
23
  specs[ 2].gateTp = L_NOT ; specs[ 2].out = 5; specs[ 2].inLow = 4; specs[ 2].inHigh = 0;
24
  specs[ 3].gateTp = L_NAND; specs[ 3].out = 6; specs[ 3].inLow = 2; specs[ 3].inHigh = 3;
25
  specs[ 4].gateTp = L_NOR ; specs[ 4].out = 1; specs[ 4].inLow = 5; specs[ 4].inHigh = 6;
26
end
27
  
28
assign pool[ 2] = left;
29
assign pool[ 3] = right;
30
for (ix = 1; ix <= nmGates; ix = ix + 1)
31
  case (specs[ ix].gateTp)
32
    L_NOT
33
  : not ntx( pool[ specs[ ix].out], pool[ specs[ ix].inLow]);
34
    L_NAND
35
  : nand nax( pool[ specs[ ix].out], pool[ specs[ ix].inLow], pool[ specs[ ix].inHigh]);
36
    L_NOR
37
  : nor nox( pool[ specs[ ix].out], pool[ specs[ ix].inLow], pool[ specs[ ix].inHigh]);
38
  endcase
39
assign result = pool[ 1];
40
41
endmodule
Once again, I'm fully aware that there's a much simpler way to design an 
Equals circuit than this; again this is a simplification of a problem 
I'm having in more complex code. Anyhow, I run the Icarus simulator on 
this and get:
1
D:\Hf\Verilog\Unpacked\Common>\Icarus\bin\iverilog -g2009 -o ModGc.out ModGc.sv
2
ModGc.sv:16: sorry: cannot currently create a parameter of type 'LogGate' which was defined at: ModGc.sv:7.
3
ModGc.sv:16: syntax error
4
ModGc.sv:16: error: syntax error localparam list.
5
6
D:\Hf\Verilog\Unpacked\Common>
Can anyone tell me why the simulator is balking at line 16, where local 
parameter (specs) is declared? Any information anyone can give me on 
these compilation errors would be greatly appreciated.

Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
No account? Register here.