Mathematical Operations in VHDL

M

MtnSurf8

Guest
Hey there, I'm new to VHDL and was wondering how to use mathematical
operators. I want to be able to multiply and divide large numbers and
real numbers (2^20 and Pi for example). I keep getting errors and
incompatability. Thanks
 
Use the package nath_real (not synthesisable).
Here an example

library ieee;
use ieee.std_logic_1164.all;
use ieee.math_real.all;
entity math is
end math;

architecture demo of math is
signal s, c, is_this_one : real := 0.0;
begin
stimuli:process
constant delta : real := 10.0E-4;
variable x : real := 0.0;
begin
x:=0.0;
while x < 4.0*MATH_PI loop
s <= sin(x);
c <= cos(x);
wait for 1 ns;
x:=x+delta;
end loop;
report "finished";
wait;
end process;

is_this_one <= s**2 + c**2;
end demo;

Egbert Molenkamp

"MtnSurf8" <nathan717@comcast.net> schreef in bericht
news:f862bd51eecee63f0182d957f6856828@localhost.talkaboutprogramming.com...
Hey there, I'm new to VHDL and was wondering how to use mathematical
operators. I want to be able to multiply and divide large numbers and
real numbers (2^20 and Pi for example). I keep getting errors and
incompatability. Thanks
 

Welcome to EDABoard.com

Sponsor

Back
Top