------------------------------------------------------------------------------- -- CSE 471 Project #2 ; Program Counter Design -- Section : 2 -- Designer : Meghan Hoke -- Date : 9/18/2001 -- File : counter.vhd -- Description : 4 bit Program Counter ------------------------------------------------------------------------------- library IEEE; use IEEE.std_logic_1164.all; entity counter is port (b : in std_logic_vector(3 downto 0); r, w : in std_logic); end counter; architecture struc of counter is component mux port (d0, d1 : in std_logic_vector(3 downto 0); s : in std_logic; z : out std_logic_vector(3 downto 0)); end component; component dlatch port (d : in std_logic_vector(3 downto 0); write : in std_logic; q : out std_logic_vector(3 downto 0)); end component; component add4rca port (a, b : in std_logic_vector(3 downto 0); ci : in std_logic; s : out std_logic_vector(3 downto 0); co : out std_logic); end component; for all: mux use entity work.mux(struc); for all: dlatch use entity work.dlatch(struc); for all: add4rca use entity work.add4rca(struc); signal cin, cout : std_logic := '0'; signal sum, mux0, a : std_logic_vector(3 downto 0); signal mux1 : std_logic_vector(3 downto 0) := "0000"; begin -- struc a1: add4rca port map (a, b, cin, sum, cout); m1: mux port map (sum, mux1, r, mux0); l1: dlatch port map (mux0, w, a); end struc;