Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   VHDL (http://www.velocityreviews.com/forums/f18-vhdl.html)
-   -   DSP simulations (http://www.velocityreviews.com/forums/t21329-dsp-simulations.html)

 Willem Oosthuizen 06-25-2003 12:46 PM

DSP simulations

Hi,

It have coded a block that pops out a value Q of type std_logic_vector(n
downto 0). This value is a function of N, also of type std_logic_vector(m
downto 0) The type of function the block calculates is something like Q =
INT(k x SIN(w x N)+y)

In my test vectors I would like be able to write something like

assert (conv_real(Q) - ( k x SIN(w x conv_real(N))+y ) < 3.0)
severity failure;

My Question: Is there functions like conv_real, and SIN ? How do i do it?

Thanks
Willem

 FE 06-25-2003 03:37 PM

Re: DSP simulations

for simulation purpose only and if it supported by your simulator, you can
use the IEEE Std 1076.2-1996 library,

library ieee;
use ieee.math_real.all;

function sin is in library ieee.math_real
function conv_real (std_logic_vector to real) doesn't exist so you must
write something like real(to_integer(signed(Q))) or
real(to_integer(unsigned(Q)))

to see a draft source of ieee.math_real, do a google search on mathpack.vhd

regards
FE

"Willem Oosthuizen" <willy@asic.co.za> wrote in message
news:bdc5m8\$90k\$1@ctb-nnrp2.saix.net...
> Hi,
>
> It have coded a block that pops out a value Q of type std_logic_vector(n
> downto 0). This value is a function of N, also of type std_logic_vector(m
> downto 0) The type of function the block calculates is something like Q =
> INT(k x SIN(w x N)+y)
>
> In my test vectors I would like be able to write something like
>
> assert (conv_real(Q) - ( k x SIN(w x conv_real(N))+y ) < 3.0)
> severity failure;
>
> My Question: Is there functions like conv_real, and SIN ? How do i do it?
>
> Thanks
> Willem
>
>
>
>

 All times are GMT. The time now is 07:03 PM.