------------------------------------------------------------------------------- -- 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;