Wow, that was incredibly sloppy! Not only did I forget to log in prior
to posting (causing me to be identified as a guest), but I also
included a variable in both source codes that was never declared. So I'm
repeating that post with all those problems fixed.
Okay, I isolated the problem in a little piece of code I wrote:
1 | module sid ();
|
2 |
|
3 | function integer execOp;
|
4 | input integer left;
|
5 | input integer right;
|
6 | input boolean add;
|
7 | begin
|
8 | execOp = add ? left + right : left * right;
|
9 | end
|
10 | endfunction
|
11 |
|
12 | endmodule
|
Then when I use Icarus to simulate it I get:
1 | D:\Hf\Verilog\Unpacked\Common>\Icarus\bin\iverilog -g2009 -o sid.out sid.sv
|
2 | sid.sv:6: syntax error
|
3 | sid.sv:3: error: Syntax error defining function.
|
4 |
|
5 | D:\Hf\Verilog\Unpacked\Common>
|
And switching the order of arguments gives:
1 | module sid_sw ();
|
2 |
|
3 | function integer execOp;
|
4 | input boolean add;
|
5 | input integer left;
|
6 | input integer right;
|
7 | begin
|
8 | execOp = add ? left + right : left * right;
|
9 | end
|
10 | endfunction
|
11 |
|
12 | endmodule
|
When I execute Icarus I get:
1 | D:\Hf\Verilog\Unpacked\Common>\Icarus\bin\iverilog -g2009 -o sid_sw.out sid_sw.sv
|
2 | D:\Hf\Verilog\Unpacked\Common>\Icarus\bin\iverilog -g2009 -o sid_sw.out sid_sw.sv
|
3 | sid_sw.sv:4: syntax error
|
4 | sid_sw.sv:3: error: Syntax error defining function.
|
5 |
|
6 | D:\Hf\Verilog\Unpacked\Common>
|
Note that the syntax error is now on line 4, so declaring a boolean
input causes the syntax error both times. Any ideas why, anyone?