Você está na página 1de 1

entity logicacomponentes is

port(a,b,c,d: in bit; x: out bit);


end logicacomponentes;
architecture estrutura of logicacomponentes is
--DEFINE A PORTA AND DE DUAS ENTRADAS COMO UM COMPONENTE
component and_2
port(a1,a2: in bit; a:out bit);
end component;
--DEFINE A PORTA OR DE DUAS ENTRADAS COMO UM COMPONENTE
component ou_2
port (a1,a2: in bit; a:out bit);
end component;
--DECLARA OS SINAIS INTERNOS AO M�DULO
signal x1,x2:bit;
--O MAPEAMENTO DAS PORTAS ESPECIFICA A CONEX�O INTERNA
Begin
G1: and_2 port map (a,b,x1);
G2: and_2 port map (c,d,x2);
G3: ou_2 port map (x1,x2,x);
End estrutura;
--OS COMPONENTES T�M QUE SER DECLARADOS COMO ENTITY E SUA ARChitecture
entity and_2 is
port (a1,a2: in bit;
a: out bit);
end and_2;
architecture logica of and_2 is
begin
a<= a1 and a2;
end logica;
--DEFINE A PORTA OR DE DUAS ENTRADAS
entity ou_2 is
port (a1,a2: in bit; a: out bit);
end ou_2;
architecture logica of ou_2 is
begin
a<=a1 or a2;
end logica;

Você também pode gostar