# Forum: FPGA, VHDL & Verilog real in vhdl

Rate this post
 0 ▲ useful ▼ not useful
hi all
i want to ask a question and i don't know if it possible in vhdl or how
to make it.
if i have an eqution such as

x= m(a)+a*max(a)+b*sd_d(a)
and the values of a and b is as
a=1
b=1.5
--------
a=1
b=1.75
--------
a=1.5
b=0
---------
and i want to substitue the values of a,b every time and check the x
value with comparator
how i make it in vhdl.any idea please

Rate this post
 0 ▲ useful ▼ not useful
Something with an array, and a pointer which increment at the pace you
want (prescale Clk). Each (2 i your case)array have the different values
for a and b, and a common pointer gets incremented.

what are you going to check x for?

Rate this post
 0 ▲ useful ▼ not useful
Forget about real numbers and use fixed point arithmetic, i.e. convert
your numbers to integer values, scaled by an appropriate factor.

Rate this post
 0 ▲ useful ▼ not useful
John Mayer wrote:
> Something with an array, and a pointer which increment at the pace
> you
> want (prescale Clk). Each (2 i your case)array have the different values
> for a and b, and a common pointer gets incremented.
>
> what are you going to check x for?

i didn't understand your sugestion , could you clear plz.
i want to multiply constant a1=1 & b2=1.5
with integer values ,should i convert real constant to real first or how
too enter that real constant to vhdl

Rate this post
 0 ▲ useful ▼ not useful
medahat wrote:
> i didn't understand your sugestion

> i want to multiply constant a1=1 & b2=1.5 with integer values
Ok, thats absolutely no problem.

> ,should i convert real constant to real first
That is not neccessary. A real constant is a real number, which can
multiplies with another real value instantly.

> or how too enter that real constant to vhdl
Real numbers are entered in a way like 1.23 or 23.4 or 0.9999 or some
other numbers with a dot in between...

And now lets try it another way. Answer ALL of the following questions:
Where do the numbers come from (a file, the keyboard, your brain,...)?
Must this be implemented in hardware, or is it for simulation only?
Can you show vhdl code causing problems to you?

: Edited by Moderator

• $formula (LaTeX syntax)$