Compuerta and Library Ieee
Compuerta and Library Ieee
Compuerta and Library Ieee
library ieee;
use ieee.std_logic_1164.all;
entity GAND is
port(
A: in std_logic ;
B: in std_logic ;
X: out std_logic );
end GAND;
architecture BEH of GAND is
begin
X <= A AND B;
end BEH;
COMPUERTA OR
library ieee;
use ieee.std_logic_1164.all;
entity GOR is
port(
A: in std_logic ;
B: in std_logic ;
X: out std_logic );
end GOR;
architecture BEH of GXOR is
begin
X <= A OR B;
end BEH;
COMPUERTA XOR
library ieee;
use ieee.std_logic_1164.all;
entity GXOR is
port(
A: in std_logic ;
B: in std_logic ;
X: out std_logic );
end GXOR;
architecture BEH of GXOR is
begin
X <= A XOR B;
end BEH;
MEDIO SUMADOR
library ieee;
use ieee.std_logic_1164.all;
entity MEDS is
port(
A: in std_logic ;
B: in std_logic ;
S: out std_logic ;
COUT: out std_logic );
end MEDS;
architecture STRL of MEDS is
component GAND
port(
A: in std_logic ;
B: in std_logic ;
X: out std_logic );
end component;
component GXOR
port(
A: in std_logic ;
B: in std_logic ;
X: out std_logic );
end component;
Begin
U1:GXOR port map(A,B,S);
U2:GAND port map(A,B,Cout);
end Strl;
SUMADOR COMPLETO
library ieee;
use ieee.std_logic_1164.all;
entity FULLS is
port(
A: in std_logic ;
B,CIN: in std_logic ;
S: out std_logic ;
COUT: out std_logic );
end FULLS;
architecture STRL of FULLS is
component GOR
port(
A: in std_logic ;
B: in std_logic ;
X: out std_logic );
end component;
component MEDS
port(
A: in std_logic ;
B: in std_logic ;
S: out std_logic ;
COUT: out std_logic );
end component;
Signal N,P,O: std_logic;
Begin
U1: MEDS port map(A,B,N,P);
U2: MEDS port map(N,CIN,S,O);
U3: GOR port map(P,O,X);
end Strl;
COMPUERTA NOT A
library ieee;
use ieee.std_logic_1164.all;
entity GNA is
port(
A: in std_logic ;
B: in std_logic ;
X: out std_logic );
end GNA;
architecture BEH of GNA is
begin
X <= NOT B;
end BEH;
COMPUERTA NOT B
library ieee;
use ieee.std_logic_1164.all;
entity GNB is
port(
A: in std_logic ;
B: in std_logic ;
X: out std_logic );
end GNB;
architecture BEH of GNB is
begin
X <= NOT B;
end BEH;
MULTIPLEXOR
library ieee;
use ieee.std_logic_1164.all;
entity MUX4 is
port( c: in std_logic_vector( 3 dowto 0);
s: in std_logic_vector( 1 dowto 0);
z: in std_logic);
end mux4;
architecture BEH of mux4 is
begin
process(s,c)
begin
case s is
when 00 => z <= C(0);
when 01 => z <= C(1);
when 10 => z <= C(2);
when 11 => z <= C(3);
when others => z <= C(0);
end case;
end process;
end BEH;
ALU
library ieee;
use ieee.std_logic_1164.all;
entity ALU is
port( A,B,C: in std_logic;
S: in std_logic_vector( 1 dowto 0);
X,COUT: OUT std_logic);
end ALU;
architecture STRL of ALU is
component GXOR
port(
A: in std_logic ;
B: in std_logic ;
X: out std_logic );
end component;
component FULLS
port(
A: in std_logic ;
B: in std_logic ;
S: out std_logic ;
COUT: out std_logic );
end component;
component GNA
port(
A: in std_logic ;
B: in std_logic ;
X: out std_logic );
end component;
component GNB
port(
A: in std_logic ;
B: in std_logic ;
X: out std_logic );
end component;
component MUX4 is