0% found this document useful (0 votes)
261 views1 page

Synchronous Up Counter VHDL

This document contains VHDL code for a 4-bit synchronous up counter and down counter. Both counters use a clock input C and reset input S to increment or decrement an internal signal tmp on each rising edge of the clock. If reset is asserted, tmp is set to either 0000 or 1111 for up and down counting respectively. The current value of tmp is output on port Q.

Uploaded by

sindhura
Copyright
© © All Rights Reserved
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
0% found this document useful (0 votes)
261 views1 page

Synchronous Up Counter VHDL

This document contains VHDL code for a 4-bit synchronous up counter and down counter. Both counters use a clock input C and reset input S to increment or decrement an internal signal tmp on each rising edge of the clock. If reset is asserted, tmp is set to either 0000 or 1111 for up and down counting respectively. The current value of tmp is output on port Q.

Uploaded by

sindhura
Copyright
© © All Rights Reserved
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/ 1

synchronous up counter vhdl:

library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;

entity counter is
port(C, S : in std_logic;
Q : out std_logic_vector(3 downto 0));
end counter;
architecture archi of counter is
signal tmp: std_logic_vector(3 downto 0);
begin
process (C)
begin
if (C'event and C='1') then
if (S='1') then
tmp <= "0000";
else
tmp <= tmp + 1;
end if;
end if;
end process;
Q <= tmp;
end archi;

synchronous down counter vhdl:


library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;

entity counter is
port(C, S : in std_logic;
Q : out std_logic_vector(3 downto 0));
end counter;
architecture archi of counter is
signal tmp: std_logic_vector(3 downto 0);
begin
process (C)
begin
if (C'event and C='1') then
if (S='1') then
tmp <= "1111";
else
tmp <= tmp - 1;
end if;
end if;
end process;
Q <= tmp;
end archi;

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