EmbDev.net

Forum: FPGA, VHDL & Verilog real in vhdl


Author: medahat (Guest)
Posted on:

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

Author: John Mayer (215)
Posted on:

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?

Author: Mr. Tom (Guest)
Posted on:

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.

Author: medahat (Guest)
Posted on:

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

Author: Lothar Miller (lkmiller) (Moderator)
Posted on:

Rate this post
0 useful
not useful
medahat wrote:
> i didn't understand your sugestion
I didn't understand your question.

> 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:
What is your actual problem?
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

Reply

Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [avrasm]AVR assembler code[/avrasm]
  • [vhdl]VHDL code[/vhdl]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]




Bild automatisch verkleinern, falls nötig
Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.