EmbDev.net

Forum: FPGA, VHDL & Verilog Basic memory unit help


von Omar Rashad (Guest)


Rate this post
useful
not useful
I get the following error when comiling:

The symbol to_int does not have a visible declaration.
1
library ieee;
2
use ieee.std_logic_1164.all;
3
use ieee.numeric_std.all;
4
5
6
entity Mem is
7
generic (N: integer; -- N bits wide (# of columns)
8
         K: integer); -- K bits long (# of rows)
9
port (Din: IN std_logic_vector (N-1 downto 0);
10
      clk,rw_en: IN std_logic;
11
      add_in: IN std_logic_vector (K-1 downto 0);
12
      Dout: OUT std_logic_vector (N-1 downto 0));
13
end Mem;
14
15
architecture behavior of Mem is
16
type mem_array is array (2**K-1 downto 0) of std_logic_vector (N-1 downto 0);
17
signal our_array: mem_array := (others =>(others => '0'));
18
19
begin
20
21
process (clk, Din, rw_en, add_in)
22
--variable address: integer;
23
begin
24
  if (clk = '1' and clk'event) then
25
    if (rw_en = '1') then
26
      our_array (to_int(unsigned(add_in))) <= Din;
27
    else
28
      Dout <= our_array (to_int(unsigned(add_in)));
29
    end if;
30
  end if;
31
end process;
32
end behavior;

von Lothar M. (Company: Titel) (lkmiller) (Moderator)


Rate this post
useful
not useful
The function is called "to_integer()"...

Try this with Google translator, its German: 
http://www.lothar-miller.de/s9y/categories/16-Numeric_Std

: Edited by Moderator
von Omar Rashad (Guest)


Rate this post
useful
not useful
Thank you. My bad....

Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
No account? Register here.