Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Inside the memory

Status
Not open for further replies.

user4637

Technical User
Dec 6, 2009
5
CA
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.std_logic_arith.all;
use IEEE.std_logic_unsigned.all;

entity memory is
port (
rst : in std_logic; -- signal global
clock : in std_logic; -- signal global
read : in std_logic; -- Signal qui indique la lecture ou ecriture a la
-- memoire: 0 ecrit dans la memoire
-- 1 lit la memoire
address : in std_logic_vector(7 downto 0); -- Addresse de memoire (ecriture ou lecture)
dataIn : in std_logic_vector(7 downto 0); -- Donne d'entree
dataOut : out std_logic_vector(7 downto 0) -- Donne de sortie
);


end memory;

Architecture behavioural of memory is
--
-- Partie declarative de l'architecture
--

type MEMORY is array (Natural range <>) of std_logic_vector(7 downto 0);
constant RAM_SIZE : integer := 255;
--signal sysRAM : MEMORY(0 to RAM_SIZE) ;
--
--Addr Mnemonic INSTRUCTION
signal sysRAM : MEMORY(0 to RAM_SIZE) := (
('0', '1', '1', '0', '0', '0', '0', '0'), -- compléter selon programme.txt
('0', '0', '0', '0', '0', '0', '1', '1'),
('0', '1', '1', '1', '0', '0', '0', '0'),
('0', '0', '0', '0', '0', '0', '1', '0'),
('0', '0', '0', '0', '0', '1', '1', '0'),
('0', '0', '0', '1', '0', '0', '0', '0'),
('0', '0', '0', '0', '0', '1', '1', '1'),
('1', '1', '0', '0', '0', '0', '0', '0'),
('0', '0', '0', '1', '0', '1', '0', '0'),
('1', '0', '1', '0', '0', '0', '0', '0'),
('0', '0', '0', '0', '1', '1', '0', '1'),
('0', '1', '1', '0', '0', '0', '0', '0'),
('1', '0', '1', '0', '0', '0', '0', '0'),
('1', '1', '1', '0', '0', '0', '0', '0'),
('0', '1', '1', '0', '0', '0', '0', '0'),
('0', '0', '1', '0', '1', '1', '1', '1'),
('0', '1', '1', '1', '0', '0', '0', '0'),
--('0', '1', '0', '1', '1', '0', '0', '1'),
("01011001"),
("01000000"),
("00100000"),
("10000000"),
("00000000"),
("00000000"),
("00000000"),
("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),
("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),
("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),
("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),
("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),
("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),
("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),
("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),
("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),
("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),
("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),
("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),
("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),
("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),
("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),
("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),
("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),
("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),
("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),
("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),
("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),
("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),
("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),
("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),
("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),
("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),
("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),
("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),
("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),("00000000"),("00000000"));


begin


RAM: process (rst,clock,read,address)
begin
if (clock'event and clock = '0') then
if rst = '0' then
dataOut <= sysRAM(CONV_INTEGER(address));
elsif read = '1' then
dataOut <= sysRAM(CONV_INTEGER(address));

else
sysRAM(CONV_INTEGER(address)) <= dataIn;
end if;
end if;


end process;

end architecture behavioural;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top