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

Math calculations in VHDL

Altera_Forum
Honored Contributor II
8,965 Views

Hi all, 

I need a little help with my design, there are a few issues that I'm trying to resolve.  

My design flow is as following: A signal is sampled by a 16bit A2D, multiplied by 2 another 16bit signals (which results in 2 32bit signals). After a few manipulations I need to implement a formula that uses those 2 signals with division, multiplication and a few other functions that are calculated using LUTs. The LUTs are designed for a signal normalized to the range of 0 - pi/2. Note that after the formula the signals will be converted to 32bit floating-point signals. 

The formula requires some fractional calculations so I'm trying to use the fixed point package by David Bishop but I'm facing a few issues: 

1. How am I supposed to convert the 32bit signals (integer) to 32 fixed point numbers? 

2. I'm trying to divide the 2 32bit signals - what is the best way to do this? I tried the lpm_divide megafunction but I get a quotient and a remain while I need the whole number (i.e. 5.65 and not only 5). 

3. How exactly am I supposed to use the fixed-point package? I have the following libraries, is that enough? 

Library ieee; 

use ieee.std_logic_1164.all; 

use ieee.std_logic_unsigned.all; 

use ieee.fixed_float_types.all; 

use ieee.fixed_pkg.all;  

 

Thanks in advance, help will be very appreciated.
0 Kudos
21 Replies
Altera_Forum
Honored Contributor II
451 Views

 

--- Quote Start ---  

Got it, thank you. 

--- Quote End ---  

 

 

 

pls publish the code which u hv got
0 Kudos
Reply