Decade Counter

  • June 2020
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Decade Counter as PDF for free.

More details

  • Words: 106
  • Pages: 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 if qtemp<9 then

-- Counting state

qtemp:=qtemp+1;

-- Counter increase

else qtemp:="0000";

-- Return the zero state

end if; end if; q<=qtemp;

-- Output

end if; end process; end Counter;

-- End Process -- End Architecture

Related Documents

Decade Counter
June 2020 16
Decade Dissectedb
May 2020 17
Counter
November 2019 52
Counter
November 2019 43
Counter
November 2019 48
Counter
October 2019 52