cant interrupt sub program call ERROR!!!! for conversion.

P

prabhu

Guest
A part for the fullfilment of my B.E degree i am supposed to do a
project.My current project involves the correlation of very high
frequencu data using MAX PLUS II 10.2(2) version. While compilation i
came across an error that is hindering us to proceed us further. The
program goes like this for conversion of std_logic_vetor to integer.
This is part of my program.

library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;

entity bv_to_natural is
generic(n:natural :=8);--number of bits of data
port (alw: std_logic_vector(n-1 downto 0));--input to be converted to
integer.
end entity;

architecture bv of bv_to_natural is
begin
process
variable int_alw : integer:=0;
begin
for index in 0 to n-1 loop
int_alw:= ((int_alw )+((2**(index))*(alw(index))));
--performing the operation for conversion.
end loop ;
end process;
end architecture bv;



ur suggestion will be of immense help to me.please reply.....
 
prabhu wrote:


While compilation i
came across an error that is hindering us to proceed us further. The
program goes like this for conversion of std_logic_vetor to integer.

This is part of my program.

library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;

entity bv_to_natural is
generic(n:natural :=8);--number of bits of data
port (alw: std_logic_vector(n-1 downto 0));--input to be converted to
integer.
end entity;
You want to have "alw" converted to type integer, won't you?

I use the following package:
use IEEE.numeric_std.all;

(Package ieee.std_logic_arith.all is not recommended, because, it's not
standardisized.)

With this package the conversion is easy:

alw_int<=to_integer(unsigned(alw));

or, if "alw" is a signed value

alw_int<=to_integer(signed(alw));



With Package ieee.std_logic_arith.all there is a similar way, but I
don't remember the correct names of the conversion functions. Look into
the package.

Ralf
 

Welcome to EDABoard.com

Sponsor

Back
Top