100% found this document useful (3 votes)
8K views2 pages

Decade Counter

This document describes a VHDL code for a 4-bit binary counter. The code defines an entity called Counter with a clock, reset, and 4-bit output port. The architecture contains a process that uses a clock edge to increment an internal variable from 0 to 9 before resetting it to 0, with the output assigned from the internal variable.

Uploaded by

kishore981
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
100% found this document useful (3 votes)
8K views2 pages

Decade Counter

This document describes a VHDL code for a 4-bit binary counter. The code defines an entity called Counter with a clock, reset, and 4-bit output port. The architecture contains a process that uses a clock edge to increment an internal variable from 0 to 9 before resetting it to 0, with the output assigned from the internal variable.

Uploaded by

kishore981
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Sample design

--Counter VHDL

library IEEE; --library definition

use IEEE.std_logic_1164.all;

use IEEE.std_logic_unsigned.all;

entity Counter is --entity definition

port (

clk:in std_logic;

reset: in std_logic;

q: out std_logic_vector(3 downto 0)

);

end Counter;

architecture Counter of Counter is -- Architecture definition

begin

process(clk,reset) -- Process definition

variable qtemp: std_logic_vector(3 downto 0); -- temporary variable for output


q[3..0]

begin

if reset='1' then

qtemp:="0000"; -- Reset asychroniously

else

if clk'event and clk='1' then -- Counting state

if qtemp<9 then
qtemp:=qtemp+1; -- Counter increase

else

qtemp:="0000"; -- Return the zero state

end if;

end if;

q<=qtemp; -- Output

end if;

end process; -- End Process

end Counter; -- End Architecture

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy