Magna Concursos
58517 Ano: 2009
Disciplina: Engenharia Eletrônica
Banca: CESGRANRIO
Orgão: DECEA

entity CONTADOR is

port (CLK, EN, CLR, LOAD, UP: in std_logic;

D: in std_logic_vector (3 downto 0);

Q: out std_logic_vector (3 downto 0));

end CONTADOR;

architecture comportamento of CONTADOR is

signal CONT: std_logic_vector (3 downto 0);

begin

process (CLK)

begin

— — linha L1

if (CLK’event and CLK = ‘1’) then

— — linha L2

if (LOAD = ‘1’) then CONT <= D;

— — linha L3

elsif (EN = ‘1’ and UP = ‘1’) then

CONT <= CONT + “0001”;

elsif (EN = ‘1’ and UP = ‘0’) then

CONT <= CONT - “0001”;

end if;

end if;

end process;

Q <= CONT;

end comportamento;

A arquitetura implementada refere-se a um contador crescente ou decrescente com clear síncrono. No código em VHDL, a linha

if (CLR = ‘1’) then CONT <= “0000”; end if;

deve ser inserida no lugar da linha

 

Provas

Questão presente nas seguintes provas