P
Paul Urbanus
Guest
I have inherited a project to which I need to add some functionality.
Most of the modules are written in verilog, and the remainder in vhdl.
When I try and compile the verilog files in ModelSim Designer (in PE
mode), version 6.1f, the compiler gives me errors related to forward
references.
Consider the following two lines in a verilog file:
129: localparam kAddressMax = kAddressMin+7;
130: localparam kAddressMin = 0;
Notices that kAddressMin is referenced before it is defined (forward
reference). ModelSim doesn't like this and generates the following error
message:
** Error: C:/projects/foo/foo.v(129): Undefined variable: kAddressMin.
** Error: C:/projects/foo/foo.v(130): 'kAddressMin' already declared in
this scope.
The odd thing is that the above synthesize fine in Altera Quartus 8.1.
Are forward references such as the above illegal in verilog? Does
ModelSim flag this as a valid error, but the Quartus synthesis tool is
more forgiving?
BTW, there are many other similar definitions across several files. I am
primarily a vhdl coder, with just a bit of verilog hacking, so I don't
know if this is 'legal' verilog code. If not, I need to feed this back
to my customer so these files can be cleaned up and further coding is
restricted to legal constructs.
TIA
Urb
Most of the modules are written in verilog, and the remainder in vhdl.
When I try and compile the verilog files in ModelSim Designer (in PE
mode), version 6.1f, the compiler gives me errors related to forward
references.
Consider the following two lines in a verilog file:
129: localparam kAddressMax = kAddressMin+7;
130: localparam kAddressMin = 0;
Notices that kAddressMin is referenced before it is defined (forward
reference). ModelSim doesn't like this and generates the following error
message:
** Error: C:/projects/foo/foo.v(129): Undefined variable: kAddressMin.
** Error: C:/projects/foo/foo.v(130): 'kAddressMin' already declared in
this scope.
The odd thing is that the above synthesize fine in Altera Quartus 8.1.
Are forward references such as the above illegal in verilog? Does
ModelSim flag this as a valid error, but the Quartus synthesis tool is
more forgiving?
BTW, there are many other similar definitions across several files. I am
primarily a vhdl coder, with just a bit of verilog hacking, so I don't
know if this is 'legal' verilog code. If not, I need to feed this back
to my customer so these files can be cleaned up and further coding is
restricted to legal constructs.
TIA
Urb