Steve-Mowbray-ENL
Occasional Contributor
2 years agoQuartus compiler parameter expression evaluation with power operator (A**) faulty?
Hi I have encountered a discrepancy between Quartus and ModelSim compilation of parameter expressions containing a power operator (A**B): module quartus_pow_op_test #(
parameter F_S_HZ = 1000...
- 2 years ago
Hi,
Verilog LRM says
"Implementations may limit the maximum size of integer variables, but it shall be at least 32 bits."You see that Quartus apparently uses 32 bit integer but Modelsim most likely 64 bit. That's completely legal but must be considered.
Quartus gives an overflow warning for line 10, by the way.
The rest shouldn't happen according to Verilog language reference, I think. Looks a bug in parameter calculation, ignoring type proagation rules for real parameters.
This worked for me in Quartus 19.1localparam PHASE_RATE_5 = real'(F_C_HZ)/real'(F_S_HZ) * real'(2.0**N_BITS);