Design of Counters using VHDL VHDL Lab by Ravinder Nath Rajotiya - August 12, 2019May 10, 20210 Share on Facebook Share Send email Mail Print Print Table of Contents Toggle AIMObjective:Theory:Types of CountersApplications of Counters: Synthesis of Counters using VHDLBinary Up CounterBinary up counter in VHDLSimulation of Binary Up CounterBinary Up-Down CounterSimulation of Binary Up-Down Counter AIM Write a VHDL program for a counter and check the wave forms and the hardware generated Objective: Objective of this lab is to: Revise the theoretical work Learn the VHDL Coding Synthesize counters using VHDL Verify the functionality using ISIM simulator Theory: A digital counter is a sequential circuit consisting of a number of flip-flops connected in some suitable manner to count the sequence of pulses / events applied to it. The counter like a register is a sequential circuit. Types of Counters Synchronous and Asynchronous counters Single and Multi-Mode Counters (Up counter, Down Counter, Up-Down Counter) Modulus Counter: Modulus-3, Modulus-6, Modulus-10 etc. Shift register counters:- Ring Counter, Johnson Counter etc. The single and multimode counters are used for single mode that is either up or down counter or multi-mode counter as up/down counter. The modulus counter on the other hand are the counters that count upto a certain count, a counter that counts 0 through 9 is Modulus-10 counter, Its name come from the number of states that it counts. So we have different modlulus counters as mudulus-3, modulus-6, modulus-10. Ring counters: these are applications of the shift registers and are of various types such as Ring Counter, Johnson Counter etc. Applications of Counters: in counting applications. To measure the time interval between two unknown time instants To measure the frequency of a given signal Counters are useful for digital clocks and timers Used in oven timers, VCR clocks, etc The registers and the counters are found as a very important building block of sequential logic. Synthesis of Counters using VHDL Binary Up Counter Binary up counter in VHDL library IEEE; use IEEE.STD_LOGIC_1164.ALL; entity binary_counter is Port ( clk : in STD_LOGIC; reset : in STD_LOGIC; count : out STD_LOGIC_VECTOR (3 downto 0) ); end binary_counter; architecture Behavioral of binary_counter is signal tmp : std_logic_vector(3 downto 0); begin process (reset, clk) begin if(reset=’1′ )then tmp<= “0000”; elsif (clk’event and clk=’1′) then tmp<= tmp + 1; end if; end process; count<= tmp; end Behavioral; Simulation of Binary Up Counter Figure: Simulation of Binary Up Counter Binary Up-Down Counter Binary Up-Down Counter library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_unsigned.ALL; entity up_down_counter is port ( DIR, CLK: in std_logic; count_out: out std_logic_vector(7 downto 0) ); end up_down_counter; architecture Behavioral of up_down_counter is signal count : STD_LOGIC_VECTOR (7 downto 0) := X”00″; begin process (CLK) begin if (clk’Event and clk = ‘1’) then if (DIR = ‘1’) then count<= count + ‘1’; — counting up elsif (DIR = ‘0’) then count<= count – ‘1’; — counting down end if; end if; end process; count_out<= not count; end Behavioral; Simulation of Binary Up-Down Counter Figure: Simulation of Binary Up-Down Counter Share on Facebook Share Send email Mail Print Print Ravinder Nath Rajotiya https://www.care4you.in Post navigation Previous articleDesign of Flip-Flops in VHDLNext articleDesign of Register using VHDL Leave a Reply Cancel reply