Go Back   Velocity Reviews > Newsgroups > VHDL
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

VHDL - Microprocessor memory

 
Thread Tools Search this Thread
Old 01-06-2005, 04:13 PM   #1
Default Microprocessor memory


Hello

I have implemented a very easy memory with a few registers, where i can
store and also read values for and from my ALU:

I have got 2 questions:

1) The conv_integer procedure does not work here, I always get the
errormessage: no feasable subprogram entry for conv_integer
2) Finally this memory should be synthizeable for a Xilinx ML300 board. What
do I have to change that this will be alright?
Is there a documention available? I wasnt able to find one online

Thanks for your help and time!

Cheers

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

entity memory is
generic (width : integer := 32);
port (clk : in std_ulogic;
rst : in std_ulogic;
inp : in std_ulogic_vector((2*width-1) downto 0);
addr: in std_ulogic_vector(3 downto 0);
wr : in std_ulogic;
rd : in std_ulogic;
outp: out std_ulogic_vector((2*width-1) downto 0)
);
end memory;

architecture rtl of memory is

type reg_type is array (0 to 3) of std_ulogic_vector((2*width-1) downto
0);
signal reg_file : reg_type;

begin

write : process(clk,rst,inp,addr,wr)
variable x_int : integer;
begin
if rst = '1' then
reg_file(0) <= (others => '0');
else
if clk'event and clk = '1' then
if wr = '1' then
reg_file(conv_integer(addr)) <= inp;
end if;
end if;
end if;
end process;

read : process(clk,rst,addr,rd)
begin
if rst = '1' then
outp <= (others => '0');
else
if clk'event and clk = '1' then
if rd = '1' then
outp <= reg_file(conv_integer(addr));
end if;
end if;
end if;
end process;

end rtl;





Stefan Duenser
  Reply With Quote
Old 01-06-2005, 06:17 PM   #2
Stefan Duenser
 
Posts: n/a
Default Re: Microprocessor memory
> 1) The conv_integer procedure does not work here, I always get the
> errormessage: no feasable subprogram entry for conv_integer. Any ideas
> whats wrong here?


I really dont understand why this is not working, because this functions are
declared in the ieee.std_logic_arith.all header...

FUNCTION to_integer ( arg1 : STD_ULOGIC_VECTOR; x : INTEGER := 0 ) RETURN
INTEGER;
FUNCTION to_integer ( arg1 : STD_LOGIC_VECTOR; x : INTEGER := 0 ) RETURN
INTEGER;
FUNCTION to_integer ( arg1 : STD_LOGIC; x : INTEGER := 0 ) RETURN
NATURAL;
FUNCTION to_integer ( arg1 : UNSIGNED; x : INTEGER := 0 ) RETURN NATURAL;
FUNCTION to_integer ( arg1 : SIGNED; x : INTEGER := 0 ) RETURN INTEGER;

FUNCTION conv_integer ( arg1 : STD_ULOGIC_VECTOR; x : INTEGER := 0 )
RETURN INTEGER;
FUNCTION conv_integer ( arg1 : STD_LOGIC_VECTOR; x : INTEGER := 0 )
RETURN INTEGER;
FUNCTION conv_integer ( arg1 : STD_LOGIC; x : INTEGER := 0 ) RETURN
NATURAL;
FUNCTION conv_integer ( arg1 : UNSIGNED; x : INTEGER := 0 ) RETURN
NATURAL;
FUNCTION conv_integer ( arg1 : SIGNED; x : INTEGER := 0 ) RETURN INTEGER

any useful tips?




Stefan Duenser
  Reply With Quote
Old 01-06-2005, 06:29 PM   #3
Egbert Molenkamp
 
Posts: n/a
Default Re: Microprocessor memory

"Stefan Duenser" <> schreef in bericht
news:...
>> 1) The conv_integer procedure does not work here, I always get the
>> errormessage: no feasable subprogram entry for conv_integer. Any ideas
>> whats wrong here?

>
> I really dont understand why this is not working, because this functions
> are declared in the ieee.std_logic_arith.all header...
>
> FUNCTION to_integer ( arg1 : STD_ULOGIC_VECTOR; x : INTEGER := 0 )
> RETURN INTEGER;
> FUNCTION to_integer ( arg1 : STD_LOGIC_VECTOR; x : INTEGER := 0 ) RETURN
> INTEGER;
> FUNCTION to_integer ( arg1 : STD_LOGIC; x : INTEGER := 0 ) RETURN
> NATURAL;
> FUNCTION to_integer ( arg1 : UNSIGNED; x : INTEGER := 0 ) RETURN
> NATURAL;
> FUNCTION to_integer ( arg1 : SIGNED; x : INTEGER := 0 ) RETURN INTEGER;
>
> FUNCTION conv_integer ( arg1 : STD_ULOGIC_VECTOR; x : INTEGER := 0 )
> RETURN INTEGER;
> FUNCTION conv_integer ( arg1 : STD_LOGIC_VECTOR; x : INTEGER := 0 )
> RETURN INTEGER;
> FUNCTION conv_integer ( arg1 : STD_LOGIC; x : INTEGER := 0 ) RETURN
> NATURAL;
> FUNCTION conv_integer ( arg1 : UNSIGNED; x : INTEGER := 0 ) RETURN
> NATURAL;
> FUNCTION conv_integer ( arg1 : SIGNED; x : INTEGER := 0 ) RETURN INTEGER
>
> any useful tips?
>


If I have a look at the functions that are in your package std_logic_arith I
think that you are not using the Synopsys package std_logic_arith.
I can imagine you created your own package compiled it into library work and
use unintentionally the package that is in de library IEEE.

For the synopsys package you have to write: (notice the type conversion)
reg_file(conv_integer(std_logic_vector(addr))) <= inp;

Egbert Molenkamp




Egbert Molenkamp
  Reply With Quote
Old 01-06-2005, 06:36 PM   #4
Mike Treseler
 
Posts: n/a
Default Re: Microprocessor memory
Try this.
-- Mike Treseler
------------------------------------------------------
-- Thu Jan 6 10:21:41 2005 register memory example
-- by Stefan Duenser cleaned up by Mike Treseler
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity memory is
generic (width : integer := 32);
port (clk : in std_ulogic;
rst : in std_ulogic;
inp : in std_ulogic_vector((2*width-1) downto 0);
addr : in std_ulogic_vector(3 downto 0);
wr : in std_ulogic;
rd : in std_ulogic;
outp : out std_ulogic_vector((2*width-1) downto 0)
);
end memory;

architecture rtl of memory is
type reg_type is array (0 to 3)
of std_ulogic_vector((2*width-1) downto 0);
signal reg_file : reg_type;
begin
one : process(clk, rst)
variable x_int : integer;
begin
if rst = '1' then
x_int := 0;
else
if clk'event and clk = '1' then
x_int := to_integer(unsigned(addr));
if wr = '1' then
reg_file(x_int) <= inp;
elsif rd = '1' then
outp <= reg_file(x_int);
end if;
end if;
end if;
end process one;
end rtl;



Mike Treseler
  Reply With Quote
Old 01-06-2005, 06:57 PM   #5
Stefan Duenser
 
Posts: n/a
Default Re: Microprocessor memory

"Mike Treseler" <> wrote in message
news: ups.com...
> Try this.


Thanks a lot Mike, it worked!! Also thanks for your hint Egbert!

Bye




Stefan Duenser
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46