VHDL code for Counterlibrary IEEE;use IEEE.std_logic_1164.all;use IEEE.numeric_std.all; -- for the unsigned typeentity counter_example isgeneric ( WIDTH : integer := 32);port (CLK, RESET, LOAD : in std_logic;DATA : in unsigned(WIDTH-1 downto 0);Q : out unsigned(WIDTH-1 downto 0));end entity counter_example;architecture counter_example_a of counter_example issignal cnt : unsigned(WIDTH-1 downto 0);beginprocess(RESET, CLK)beginif RESET = '1' thencnt <= (others => '0');elsif rising_edge(CLK) thenif LOAD = '1' thencnt <= DATA;elsecnt <= cnt + 1;end if;end if;end process;Q <= cnt;end architecture counter_example_a;
This blog contains all the information, latest technologies in VLSI and interview questions for freshers
Friday, October 30, 2009
VHDL code for Counter
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment