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

Problens with Sfixed

Altera_Forum
Honored Contributor II
1,354 Views

Firstly sorry for my English, I used a translator. 

 

 

 

 

I'm using the library sfixed used to do mathematical calculations, and because it synthesizes. I'm in trouble and perform the following calculation: 

 

 

2 ^ 2.22 = 4.6589; 

 

 

 

 

sfixed: 

 

 

s <= to_sfixed (2 ** (2.22), 20, -20) -- worked! 

 

 

I wanted to put a variable in place of 2:22, thus: 

 

 

x <=to_fixed (2.22,20, -20); 

 

 

s <= to_sfixed (2 **(x), 20, -20); 

 

 

returns me the following error: 

# ** Error: C:/altera/Projetos/expoente/expoente.vhdl(112): No feasible entries for infix operator "**".# ** Error: C:/altera/Projetos/expoente/expoente.vhdl(112): No feasible entries for subprogram "to_sfixed".# ** Error: C:/altera/Projetos/expoente/expoente.vhdl(115): VHDL Compiler exiting 

 

 

 

 

 

att, 

 

 

João Pedro
0 Kudos
1 Reply
Altera_Forum
Honored Contributor II
577 Views

There is no function to do integer ** sfixed. So you will have to either create one yourself, or I suggest using a look up table, as a power of function will be extreamly expensive in terms of logic. 

 

2.22 is a real type, and integer**real is a valid function, and it works at first because it is a constant value so never changes. Using a variable as the exponent is not a good idea.
0 Kudos
Reply