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

how to create a multiplier or adder for floating point

Altera_Forum
Honored Contributor II
2,963 Views

when i create a multiplier, adder or comparator using megawizard in quartus do these blocks also valid when i use floating point input  

such that if the 2 input to the adder are 10 bits length and the last 3 bits represent fraction and the first bit is sign bit and the rest represent integer, in this case could i create a normal adder block or multiplier block using mega function wizard????????
0 Kudos
7 Replies
Altera_Forum
Honored Contributor II
1,189 Views

For add/substract floating point numbers use altfp_add_sub megafuntion, for multiply altfp_mult megafuntion. All megafunctions whose names begin with "altfp" operate with floating point numbers (single precision 32 bits and double precision 64 bits). Be carefull, because floating point arithmetic is expensive, check this first.

0 Kudos
Altera_Forum
Honored Contributor II
1,189 Views

what if I want to use 10 bits only as in my case

0 Kudos
Altera_Forum
Honored Contributor II
1,189 Views

10 bits is a very low resolution for floating point representation, anyway, in that case you must describe your own arithmetic cores. Instead, i think you should use a fixed-point representation with, say, 18 bits of resolution. 

 

Are you going to use theese arithmetic operators on your turbo decoder? what is the more frequent arithmetic operation? what are the maximum values of domain and range?
0 Kudos
Altera_Forum
Honored Contributor II
1,189 Views

yes i am going to use this arithematics in my turbo decoder. 

in my first trial to write the code i used 32 bit but i found that i will be using a lot of memory in registers so i am trying to minimize the memory used because i have been told that if i use more than 64k i should switch to ram and addressing issues.Ofcourse if 32 bits is used this will be alot easier for me right now could i use 32 bits resolution with this huge memory and still use registers? 

One thing i need a little help here because i am feeling that i am totaly lost i have written a matlab code to simulate this decoder which i can't convert to VHDL so please can you help me please because it seems that u r familiar with the turbo code i am really running out of time
0 Kudos
Altera_Forum
Honored Contributor II
1,189 Views

The term floating point in the thread title is misleading as you clearly referred to fixed point in your initial post. To answer the original question, there's no difference between integer and fixed point in add/sub, but the result scaling is different in multiply. I suggest, that you try by pencil and paper method first. Generally, when multiplying two 10 bit signed numbers, you get a 20 bit result. It has to be scaled to a 10 bit number to keep the original format. At the MSB side, you may want to apply saturation to handle possible overflows, at LSB side, some bits are simply cut off. Altera has no MegaFunctions for this operation, you must provide it in your code. If you run short of FPGA resources, it can be meaningful to reduce the precision to 9 bit, which is the size of an elementary hardware multiplier.

0 Kudos
Altera_Forum
Honored Contributor II
1,189 Views

there are some Megafunctions that will give you access to the hardware saturation/rounding in the Stratix devices, altmult_add for example.

0 Kudos
Altera_Forum
Honored Contributor II
1,189 Views

ok thank u so much i have tried what you told me you were realy helpful but anyway i will try not to use floating point in this code to simplify it i will normalize the input to insure that it's all fraction and use normal adder and multiplier

0 Kudos
Reply