-- Model Name : Concurrent - Program Counter -- Author : Armita Peymandoust -- Last Updated : 09 / 15 / 1996 -- This document is © copyrighted by the Author.

----------*************************************************************


 -- NOTE : THE PC DOES NOT GET FAT!!!


----------*************************************************************
LIBRARY IEEE;
USE IEEE.std_logic_1164.ALL;
--
LIBRARY EXEMPLAR;
USE EXEMPLAR.exemplar_1164.ALL;
USE EXEMPLAR.exemplar.ALL;
--
LIBRARY WORK;
USE WORK.synthesis_utilities.ALL;
USE WORK.synthesis_parameters.ALL;
USE WORK.global_environment.ALL;
--
ENTITY program_counter_unit IS
  PORT (increment, load_page, load_offset, reset : IN std_logic);
END program_counter_unit;
--
ARCHITECTURE Concurrent OF program_counter_unit IS
BEGIN
  PROCESS (reset, increment, load_page, load_offset)
  BEGIN
    IF reset'EVENT THEN
      IF (pc_out/=NULL AND pc_out/=zero_12) THEN DEALLOCATE(pc_out); END IF;
      pc_out := zero_12;
    ELSIF increment'EVENT THEN
      IF (pc_out=NULL OR pc_out=zero_12) THEN
        pc_out := NEW twelve_node;
        pc_out.val:="000000000000";
        pc_out.link:=NULL;
      END IF;
      pc_out.val := pc_out.val + "01";
    END IF;
    IF load_offset'EVENT THEN
      IF (pc_out=NULL OR pc_out=zero_12) THEN
        pc_out := NEW twelve_node;
        pc_out.val:="000000000000";
        pc_out.link:=NULL;
      END IF;

      pc_out.val (7 DOWNTO 0) := mar_offset_out.val;
    END IF;
    IF load_page'EVENT THEN
      IF (pc_out=NULL OR pc_out=zero_12) THEN
        pc_out := NEW twelve_node;
        pc_out.val:="000000000000";
        pc_out.link:=NULL;
      END IF;
      pc_out.val (11 DOWNTO 8) := mar_page_out.val;
    END IF;
    test;
  END PROCESS;
END Concurrent;