SlideShare ist ein Scribd-Unternehmen logo
1 von 1
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;
USE ieee.numeric_std.ALL;

entity ram is
port (address: in std_logic_vector(7 downto 0);
            data: inout std_logic_vector(7 downto 0);
            WE, CS, OE: in std_logic);
end entity ram;

architecture simple_ram of ram is
type ram_type is array (0 to 255) of std_logic_vector(7 downto 0);
signal ram1: ram_type:= (others => (others => '0'));
begin
process(WE,CS,OE,address)
begin
data <= (others => 'Z');
if (CS = '0') then
      if WE='1' and OE = '1' then
      ram1(conv_integer(address)) <= data;
      end if;
      if WE = '0' and OE = '0' and CS = '0' then
      data <= ram1(conv_integer(address));
      END IF;
      else
      data <= (others => 'Z');
--    end if;
end if;
end process;
end simple_ram;

Weitere ähnliche Inhalte

Was ist angesagt?

Was ist angesagt? (8)

Ssaw08 0624
Ssaw08 0624Ssaw08 0624
Ssaw08 0624
 
Gaztea Tech Robotica 2016
Gaztea Tech Robotica 2016Gaztea Tech Robotica 2016
Gaztea Tech Robotica 2016
 
Linked list without animation
Linked list without animationLinked list without animation
Linked list without animation
 
Javascript: The Important Bits
Javascript: The Important BitsJavascript: The Important Bits
Javascript: The Important Bits
 
Linked list
Linked listLinked list
Linked list
 
Making Mongo realtime - oplog tailing in Meteor
Making Mongo realtime - oplog tailing in MeteorMaking Mongo realtime - oplog tailing in Meteor
Making Mongo realtime - oplog tailing in Meteor
 
3
33
3
 
Os Practical Assignment 1
Os Practical Assignment 1Os Practical Assignment 1
Os Practical Assignment 1
 

Ram sourcecode&testbench

  • 1. library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_arith.all; use ieee.std_logic_unsigned.all; USE ieee.numeric_std.ALL; entity ram is port (address: in std_logic_vector(7 downto 0); data: inout std_logic_vector(7 downto 0); WE, CS, OE: in std_logic); end entity ram; architecture simple_ram of ram is type ram_type is array (0 to 255) of std_logic_vector(7 downto 0); signal ram1: ram_type:= (others => (others => '0')); begin process(WE,CS,OE,address) begin data <= (others => 'Z'); if (CS = '0') then if WE='1' and OE = '1' then ram1(conv_integer(address)) <= data; end if; if WE = '0' and OE = '0' and CS = '0' then data <= ram1(conv_integer(address)); END IF; else data <= (others => 'Z'); -- end if; end if; end process; end simple_ram;