You are on page 1of 12

Circuitos Lgicos

Combinacionais
Aula 4 - Simulao de Circuito Lgico
Combinacional
Prof. Lzaro Camargo

Programao de TabelaVerdade atravs de fluxo


de dados

Exemplo
ENTRADAS

Implementar em VHDL a TabelaVerdade abaixo atravs de fluxo


de dados
Expresso da tabela na forma
de Soma-de-Produtos
X = ( A.B.C.D) + ( A.B.C.D) + ( A.B.C.D) + ( A.B.C.D)

SAIDA

Exemplo

(continuao)

X = ( A.B.C.D) + ( A.B.C.D) + ( A.B.C.D) + ( A.B.C.D)


library IEEE;
use IEEE.std_logic_1164.all;
entity tabela_verdade is
port (a,b,c,d: in bit;
x: out bit);
end tabela_verdade;
architecture fluxo_dados of tabela_verdade is
begin
x<='1' when(a='0' and b='0' and c='1' and d='0')or
(a='0' and b='1' and c='1' and d='0') or
(a='1' and b='0' and c='1' and d='0') or
(a='1' and b='1' and c='0' and d='0') else '0';
end fluxo_dados;

Tabela Verdade
ENTRADAS

Expresso lgica no formato


de Produto- de-Somas
X = ( A + B + C + D).( A + B + C + D )

SAIDA

Exemplo 1 Resolver a expresso abaixo:


X = ( A + B + C + D).( A + B + C + D)
library IEEE;
use IEEE.std_logic_1164.all;
entity nome_1 is
port (a,b,c,d: in bit;
X: out bit);
end nome_1;
architecture lgica of nome_1 is
begin
X<= (((not a) or (not b) or c or d) and (a or b or (not c) or d));
end lgica;

Exemplo 2
Resolver a expresso abaixo:
X = ( A + B + C + D).( A + B + C + D).( A + B + C + D).( A + B + C + D)
library IEEE;
use IEEE.std_logic_1164.all;
entity nome_1 is
port (a,b,c,d: in bit;
X: out bit);
end nome_1;
architecture lgica of nome_1 is
begin
X<= (not a or not b or c or d) and (a or b or not c or d)
and (a or not b or not c or d) and (a or b or c or not d);
end lgica;

Exerccio
Expresso lgica no formato de Soma-de-Produtos e
tambem no formato de Produto-de-Somas para a
seguinte tabela verdade. Simular e verificar se os
resultados so os mesmos.
A

Programaes de
multiplexadores em VHDL
Exemplo 1a Na figura abaixo se tem um
multiplexador (Mux_4_1) com 4 entradas de dados
(P0, P1, P2 e P3), 2 entradas de seleo (S0 e S1) e
uma sada de dado (F).

library IEEE;
use IEEE.std_logic_1164.all;
entity Mux_4_1 is
port (P0,P1,P2,P3: in bit;
S: in bit_vector (1 downto 0);
F: out bit);
end Mux_4_1;
-- A arquitetura pode ser feita com comandos concorrentes
architecture fluxo_dados of Mux_4_1 is
begin
F<=P0 when (S="00") else
P1 when (S="01") else
P2 when (S="10") else
P3 when (S="11");
End fluxo_dados;

Exemplo 1b Uma forma alternativa de programar o circuito anterior


atravs de uma listagem equivalente usando processo sequencial (process)
library IEEE;
use IEEE.std_logic_1164.all;
entity Mux_4_1 is
port (P0,P1,P2,P3: in bit;
S: in bit_vector (1 downto 0);
F: out bit);
end Mux_4_1;
architecture bsica of Mux_4_1 is
begin
Mux4_para_1: process (P0,P1,P2,P3)
begin
if S = "00" then F<=P0;
end if;
if S="01" then F<=P1;
end if;
if S="10" then F<=P2;
end if;
if S="11" then F<=P3;
end if;
end process Mux4_para_1;
end bsica;

Exerccio
Estender para circuito multiplicador de 8
entradas.

You might also like