Intel® Quartus® Prime Software
Intel® Quartus® Prime Design Software, Design Entry, Synthesis, Simulation, Verification, Timing Analysis, System Design (Platform Designer, formerly Qsys)
16606 Discussions

Quartus Prime complete lack of real data type support?

Altera_Forum
Honored Contributor II
2,873 Views

Hi, 

 

I have a function (basicaly implements a LUT) something like the following: 

 

function integer gen_lut; input integer addr; localparam SOME_CONSTANT = 418.39; // Gets calculated at runtime. localparam D0 = 0.785398163 * SOME_CONSTANT; localparam D1 = 0.463647609 * SOME_CONSTANT; ... begin case (addr) 0: gen_lut = D0; 1: gen_lut = D1; ... endcase end endfunction 

 

The thing is I need to convert d0, d1, ... from real type to integer at elaboration time to use it later in design. 

 

I've tried using system function $rtoi, $floor but Quartus complains: error (10174): verilog hdl unsupported feature error at top.v(54): system function "$floor" is not supported for synthesis 

 

Then I've tried implementing a constant function, since I already have log2 function implemented and it works, floor that would take real number and output a integer like so: 

function integer floor; input real x; integer int_part; begin int_part = x; if (int_part > x) begin floor = int_part - 1; end else begin floor = int_part; end end endfunction 

 

And the tool complains again: error (10172): verilog hdl unsupported feature error at const_functions.sv(21): real variable data type values are not supported. 

 

IMHO, this is just ridiculous. I am not even trying to synthesise real values I just want to convert them to integer at elaboration time. Does Quartus even have any kind of support for real data types? I mean even Xillinx ISE and Icarus Verilog have these features supported and have no problem synthesizing. 

 

Is there a workaround this problem? I would still like to keep real numbers in the code for easier parametrization. 

 

 

P.S. 

I saw a similar thread that was posted in 2008, so these features havent been implemented for almost 10 years??? Come on, its not like the whole IDE needs to be re-implemented...
0 Kudos
1 Reply
Altera_Forum
Honored Contributor II
1,882 Views

I've found one possible workaround, how to round real data type down to nearest integer: 

 

1) Create a constant function that will convert real to nearest integer (up or down): 

function integer rtoi; input integer x; begin rtoi = x; end endfunction 

 

2) Create a macro that will round real down to integer: 

`define FLOOR(x) ((rtoi(x) > x) ? rtoi(x) - 1 : rtoi(x)) 

 

3) Use the macro: 

localparam real R_TEST = 0.785398163 * SOME_CONSTANT; integer floor_int = `FLOOR(R_TEST);  

 

 

Best regards!
0 Kudos
Reply