Issue #475
%Error: Internal Error: ...: ../V3Number.cpp:518: Real conversion on non real number
| Status: | Closed | Start date: | 04/02/2012 | |
|---|---|---|---|---|
| Priority: | Normal | Due date: | ||
| Assignee: | Wilson Snyder | % Done: | 0% |
|
| Category: | TranslationError | |||
| Target version: | - |
Description
Source code:
package functions;
function real get_real_value;
input [8*MAX_STRING_LENGTH:1] time_string;
...
get_real_value = result;
end
endfunction
endpackage
module generic_a
#(
parameter reference_clock_frequency = "0 ps",
);
import functions::*;
localparam reference_clock_period_value_param = get_real_value(reference_clock_frequency);
...
localparam reference_clock_period_value_param line is where the error happens.
History
Updated by Wilson Snyder about 1 year ago
Please try to make a standalone test case that fails; the critical code here is what's in the ...'s. Also, in the end I suspect the package won't be needed to show the bug.
Updated by Alex Solomatnikov about 1 year ago
Test case:
localparam MAX_STRING_LENGTH = 20;
function real get_real_value;
input [8*MAX_STRING_LENGTH:1] time_string;
real result;
begin
result = 0.0;
get_real_value = result;
end
endfunction
module test
#(
parameter reference_clock_frequency = "0 ps"
) (
input wire refclk,
input wire rst,
output wire outclk
);
localparam reference_clock_period_value_param = get_real_value(reference_clock_frequency);
localparam valid_param = (reference_clock_period_value_param > 0);
generate
if ( valid_param == 1 )
begin
assign outclk = refclk;
end
else
begin
assign outclk = 0;
end
endgenerate
endmodule // test
Verilator output:
verilator -sp -Wno-fatal --top-module test test.v %Warning-WIDTH: test.v:21: Operator FUNCREF 'get_real_value' expects 160 bits on the Function Argument, but Function Argument's VARREF 'reference_clock_frequency' generates 32 bits. %Warning-WIDTH: Use "/* verilator lint_off WIDTH */" and lint_on around source to disable this message. %Error: Internal Error: test.v:21: ../V3Number.cpp:518: Real conversion on non real number %Error: Command Failed /tools/verilator/verilator-3.832/bin/verilator_bin -sp -Wno-fatal --top-module test test.v
Updated by Wilson Snyder about 1 year ago
- Category set to TranslationError
- Status changed from New to Resolved
- Assignee set to Wilson Snyder
Conversion of real functions to constants was buggy.
Fixed in git towards 3.833.
Also available in: Atom
![[logo]](/img/veripool_small.png)