library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity programcounter is port(clock:in std_logic; pc_enable:in std_logic; pc_reset:in std_logic; input:in std_logic_vector(3 downto 0); opcode:in std_logic_vector(3 downto 0); output:out std_logic_vector(3 downto 0); a_zero_status:in std_logic ); end programcounter; architecture pc_arch of programcounter is begin process(clock,pc_enable,pc_reset,opcode,a_zero_status) variable pc_int:std_logic_vector(3 downto 0):="0000"; begin if pc_enable='1' then if clock'event and clock='1' then if opcode="1000" then pc_int:=input; elsif opcode="1001" then if a_zero_status='0' then pc_int:=input; else pc_int:=(pc_int+1); end if; elsif opcode="1010" then if a_zero_status='1' then pc_int:=input; else pc_int:=(pc_int+1); end if; else pc_int:=(pc_int+1); end if; end if; if pc_reset='1' then pc_int:="0000"; end if; end if; output<=pc_int; end process; end pc_arch;