Forum Discussion
BUG: Verilog 1.0*(2.0**N) const expression evaluates to 0 if N is a localparam
Is it fine to report Quartus Prime Lite bugs here?
I'm using Quartus Prime Version 22.1std.0 Build 915 10/25/2022 SC Lite Edition with no patches. I will try a newer version later.
Given this Verilog code:
localparam N = 12.0; initial begin $display("%f %d", 1.0*(2.0*N), 1.0*(2.0*N)); // Two products. $display("%f %d", 1.0*(2.0**12.0), 1.0*(2.0**12.0)); // Product & power. $display("%f %d", 1.0*(2.0**N), 1.0*(2.0**N)); //BUG! Product & power. $display("%f %d", (2.0**N), (2.0**N)); // Power only. end
...at compile-time the log includes these unexpected results:
Info (10648): Verilog HDL Display System Task info at raybox.v(104): 24.000000 24 Info (10648): Verilog HDL Display System Task info at raybox.v(105): 4096.000000 4096 Info (10648): Verilog HDL Display System Task info at raybox.v(106): 0.000000 0 Info (10648): Verilog HDL Display System Task info at raybox.v(107): 4096.000000 4096
Notice that specifically 1.0*(2.0**N) gives an incorrect result (0) while the others work as expected. This problem also happens if assigning this expression to another localparam, or trying to use it in logic.
I tried other definitions of the localparam, too, including:
localparam real N = 12.0; localparam integer N = 12; localparam [3:0] N = 12;
5 Replies
- SyafieqS
Super Contributor
Hello,
Thanks for the update. I will feedback this to developer for fix.
Let me know if there is any other concern on this.
Really appreciate the feedback.
- SyafieqS
Super Contributor
Have you tried this in Pro Edition or latest version as mentioned?
Does the value still reflect wrongly?
- SyafieqS
Super Contributor
Let me know if there is any update from previous reply
- algofoogle
New Contributor
My apologies, I was unable to return to this for a while, but I've now tested in Quartus Prime Version 22.1.std.1 Build 917 02/14/2023 SC Lite Edition. The same issue exists, with exactly the same output.
This is the most recent version I can test, as I do not have a Pro license and version 23.1 hasn't been released as a Lite version yet.
- SyafieqS
Super Contributor
Thanks for your feedback. I will feedback this and request for a fix.
This might be taking sometime as developer is prioritizing critical case.
Let me know if there is any other concern.