Altera_Forum
Honored Contributor
16 years agoCounter.. Having problems adding? Please help!
LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.all; USE IEEE.STD_LOGIC_UNSIGNED.all; USE IEEE.STD_LOGIC_ARITH.all; ENTITY counter IS PORT(enable, clr : IN STD_LOGIC; THECOUNT : OUT STD_LOGIC_VECTOR(5 downto 0)); END counter; ARCHITECTURE a OF counter IS SIGNAL tmp: STD_LOGIC_VECTOR(5 downto 0); BEGIN PROCESS(enable, CLR) BEGIN IF (CLR='1') THEN tmp <= "000000"; ELSIF (enable'event and enable='1') THEN tmp <= tmp + 1; END IF; end process; THECOUNT <= tmp; end a; This is the code I am using to work a counter.. I use the simulator tool to discover that THECOUNT never increases after CLR goes low. THECOUNT is always 0. Is there something I am doing wrong? Thanks in advance for any help!