www.pudn.com > traffic_control2.rar > count26.vhd, change:2013-03-31,size:511b


LIBRARY IEEE; 
	 USE IEEE.STD_LOGIC_1164.ALL; 
	 ENTITY count26 IS 
	 PORT( 
			clk		:IN STD_LOGIC; 
			enable  :IN STD_LOGIC; 
			c		:OUT STD_LOGIC); 
	 END count26; 
	 ARCHITECTURE a OF count26 IS  
	 BEGIN 
		 PROCESS(clk) 
			VARIABLE cnt:INTEGER RANGE 26 DOWNTO 0; 
		 BEGIN 
			IF (clk 'EVENT AND clk='1')THEN  
				IF enable='1' AND cnt<26 THEN 
					cnt:=cnt+1; 
				ELSE 
					cnt:=0; 
				END IF; 
			END IF; 
		 IF cnt=26 THEN 
				c<='1'; 
		 ELSE  
				c<='0'; 
		 END IF; 
		END PROCESS; 
	 END a;