-- -- Patrick Wagstrom -- CS471-001 -- progctr.vhd -- variable size program counter -- now with support for reset! WOW MOM! -- LIBRARY ieee; USE ieee.std_logic_1164.all; LIBRARY lpm; USE lpm.lpm_components.all; ENTITY progctr IS GENERIC (ctrWidth : integer := 5); PORT (clock, clockEnable, load, reset: IN STD_LOGIC; data : IN STD_LOGIC_VECTOR (ctrWidth - 1 DOWNTO 0); q : OUT STD_LOGIC_VECTOR (ctrWidth - 1 DOWNTO 0)); END progctr; ARCHITECTURE noniterative OF progctr IS -- SIGNAL dataSig : STD_LOGIC_VECTOR (ctrWidth-1 DOWNTO 0); -- SIGNAL loadSig : STD_LOGIC; BEGIN -- WITH reset SELECT -- dataSig <= "11111" WHEN '1', -- data WHEN OTHERS; -- WITH reset SELECT -- loadSig <= '1' WHEN '1', -- load WHEN OTHERS; g: lpm_counter GENERIC MAP (LPM_WIDTH=>ctrWidth) PORT MAP (DATA=>data, CLOCK=>clock, Q=>q, CNT_EN=>clockEnable, SLOAD=>load, ACLR=>reset); END noniterative;