-------------------------------------------------------------------------------
--  Simple processor from EE126, memory segment
--  By: Frank Bruno
--  for Professor Chang
-------------------------------------------------------------------------------

USE work.alu_pkg.ALL;
USE work.bv_arithmetic.ALL;

ENTITY simple_memory IS
  PORT(instr         : IN bit_vector(7 DOWNTO 0);
       pc            : IN integer range 0 to 15;
       load          : IN bit;
       clock         : IN bit;
       current_mem   : OUT bit_vector(7 DOWNTO 0)
       );
END simple_memory;

ARCHITECTURE behave_simple_mem OF simple_memory IS
  SIGNAL memory : bit_8(15 DOWNTO 0);
  
BEGIN  --  behave_simple_mem 

  PROCESS(pc, load)
    
    BEGIN
      
-------------------------------------------------------------------------------
--  on a load event, load the memory
-------------------------------------------------------------------------------
      IF (load = '1') THEN
        memory(pc) <= instr;
      END IF;

-------------------------------------------------------------------------------
--  let the program know the current memory pointed to by PC
-------------------------------------------------------------------------------
      current_mem <= memory(pc);

  END PROCESS;
  
END behave_simple_mem;

<div align="center"><br /><script type="text/javascript"><!--
google_ad_client = "pub-7293844627074885";
//468x60, Created at 07. 11. 25
google_ad_slot = "8619794253";
google_ad_width = 468;
google_ad_height = 60;
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script><br />&nbsp;</div>