EmbDev.net

Forum: FPGA, VHDL & Verilog the Quotient is floating point


von ddden (Guest)


Rate this post
useful
not useful
hi
i want to divide two numbers and i know the Quotient will be float point 
such as (0.3456)  how can i describe the Quotient in vhdl code.sorry but 
i am new in vhdl

von Lothar M. (Company: Titel) (lkmiller) (Moderator)


Rate this post
useful
not useful
Is this 0.3456 a constant number?

ddden wrote:
> the Quotient will be float point
Why? Where does this quotient come from?

: Edited by Moderator
von ddden (Guest)


Rate this post
useful
not useful
Lothar Miller wrote:
> Is this 0.3456 a constant number?
no it is variable .
> Why? Where does this quotient come from?
when i try to divide 8/12=0.666666
the two inputs are integer and the quotient is being float
is there a way to define this floating result such as make the output 
define is float or including floating library first.

von Lothar M. (Company: Titel) (lkmiller) (Moderator)


Rate this post
useful
not useful
ddden wrote:
> including floating library first.
You must keep in mind, that floating point numbers are not 
synthesizeable up to now.
Maybe you can work with fixed point arithmetics.

You did not answer my question! Be sure, that I know, that 8/12 results 
in a number which cannot be packed into an integer.
But I wanted to know from where those numbers come and what you want to 
achieve with this calculation in the end...

von ddden (Guest)


Rate this post
useful
not useful
Lothar Miller wrote:

> You must keep in mind, that floating point numbers are not
> synthesizeable up to now.
> Maybe you can work with fixed point arithmetics.
ok, then how i can convert float to fixed point,that is easy


> But I wanted to know from where those numbers come and what you want to
> achieve with this calculation in the end...

if i understand correct the two numbers come from another operation and 
i want to divide them and also the result from the division i will use 
it in another operation such as add it with another floating value.

von Lothar M. (Company: Titel) (lkmiller) (Moderator)


Rate this post
useful
not useful
ddden wrote:
> i will use it in another operation such as add it with another floating
> value.
Just to repeat my statement: you will not be able to get float 
operations synthesized. Don't spend one more thought on floating point 
arithmetics in VHDL.

ddden wrote:
> if i understand correct the two numbers come from another operation
For sure.
> and i want to divide them and also the result from the division
This one we know already.
> i will use it in another operation
Which is a incredibly secret one!
> such as add it with another floating value.
To keep it short: I'm pretty sure that you don't need floating point 
arithmetics at all. You just didin't figure that out because all of your 
thoughts are "float"-ing in the wrong direction.

Just to clearify my question:
WHAT kind higly secret of apparatus or machine do you build? What data 
rates are inside this machine? What part of work inside this machine is 
yours?

: Edited by Moderator
von ddden (Guest)


Rate this post
useful
not useful
Lothar Miller wrote:

> Just to clearify my question:
> WHAT kind higly secret of apparatus or machine do you build? What data
> rates are inside this machine? What part of work inside this machine is
> yours?
really i found this code in another forum (
i want to divide two numbers(16-bit binary) in VHDL Numerator is an 
integer. Denominator is a float. Result should be float. What algorithm 
do i use to perform the division)
and the suggestion solution is
1
library ieee;
2
use ieee.numeric_std.all;
3
use ieee.float_pkg.all;
4
5
entity integer_by_float_division is
6
    port (
7
        numerator: in signed(15 downto 0);
8
        denominator: in signed(15 downto 0);
9
        result: out float(6 downto -9)
10
   );
11
end;
12
13
architecture rtl of integer_by_float_division is
14
    subtype float16 is float(6 downto -9);
15
    signal numerator_float: float16;
16
    signal denominator_float: float16;
17
begin
18
    numerator_float <= to_float(numerator, numerator_float);
19
    denominator_float <= to_float(denominator, denominator_float);
20
    result <= numerator_float / denominator_float;
21
end;
this solution is to convert the numerator and denominator into float 
value before division operation.
should i did it too if the numerator and denominator are integer and the 
out put is float ??
and sorry for any mistakes .
thanks a lot

von PittyJ (Guest)


Rate this post
useful
not useful
I have the feeling, that you does not like the previous answers and 
ignores them.

Again:
Forget float operations in VHDL, if you want to generate code for FPGA.
Even forget the division.
Think about your goal, and try another solution.

If you realy need heavy mathematics, do it on an microprocessor ( either 
hard or softcore).

Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
No account? Register here.