Está en la página 1de 9

INSTITUTO POLITÉCNICO NACIONAL

ESCUELA SUPERIOR DE INGENIERÍA


MECÁNICA Y ELÉCTRICA
UNIDAD CULHUACÁN

Circuitos Lógicos II

Grupo: 4CM23

Tarea 3 VHDL

Alumno: Avilés Martínez Mariana

Boleta: 2018350712

04/10/2019
1. Mediante with – select, elaborar en VHDL el siguiente multiplexor, que
cumpla la siguiente tabla.

E selección salida_f

0 00 N1

0 01 N2

0 10 N3

0 11 N4

1 xx 0

Código en VHDL
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity mux_e is
Port ( N1 : in STD_LOGIC_VECTOR (7 downto 0);
N2 : in STD_LOGIC_VECTOR (7 downto 0);
N3 : in STD_LOGIC_VECTOR (7 downto 0);
N4 : in STD_LOGIC_VECTOR (7 downto 0);
seleccion : in STD_LOGIC_VECTOR (1 downto 0);
E : in STD_LOGIC;
salida_f : out STD_LOGIC_VECTOR(7 downto 0));
end mux_e;

architecture Behavioral of mux_e is

signal salida_E : STD_LOGIC_VECTOR(7 downto 0);

begin
with seleccion select
salida_E <= N1 when "00",
N2 when "01",
N3 when "10",
N4 when others;
with E select
salida_f <= salida_E when'0',
"00000000" when others;

end Behavioral;
Simulación:
2. Mediante la instrucción “Lista sensible” (Sensitivity list) realizar en VHDL un
código que cumpla con la siguiente tabla (donde Q = estado anterior).

N1 N2 F
XX 00 Q

XX 01 Q

XX 10 Q

XX 11 Q
00 XX N1 and N2
01 XX N1 and N2
10 XX N1 and N2
11 XX N1 and N2

Observando la tabla podemos deducir que sólo cambiando N2 se realizara la


operación nand, en dado caso que sólo se cambie N1 dará como resultado la
operación antes hecha, es decir, el estado anterior.

Código en VHDL
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;

entity Ejercicio_process is
Port ( N1 : in STD_LOGIC_VECTOR (1 downto 0);
N2 : in STD_LOGIC_VECTOR (1 downto 0);
F : out STD_LOGIC_VECTOR (1 downto 0));
end Ejercicio_process;

architecture Behavioral of Ejercicio_process is


begin
process(N2)
begin
F <= N1 nand N2;
end process;

end Behavioral;
Simulación:
3. Usando la sentencia if-else realizar en VHDL un código que cumpla con la
siguiente tabla de verdad:

sel f
00 N3
01 N1
10 N4
11 N2

Código VHDL
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;

entity if_mux is
Port ( N1 : in STD_LOGIC_VECTOR (7 downto 0);
N2 : in STD_LOGIC_VECTOR (7 downto 0);
N3 : in STD_LOGIC_VECTOR (7 downto 0);
N4 : in STD_LOGIC_VECTOR (7 downto 0);
sel : in STD_LOGIC_VECTOR (1 downto 0);
f : out STD_LOGIC_VECTOR(7 downto 0));
end if_mux;

architecture Behavioral of if_mux is


begin
process (N1,N2,N3,N4,sel)
begin
if sel = "00" then
f <= N3;
elsif sel = "01" then
f <= N1;
elsif sel = "10" then
f <= N4;
elsif sel = "11" then
f <= N2;
end if;
end process;

end Behavioral;
Simulación:
4. Usando la sentencia case realizar en VHDL un código que cumpla con la
siguiente tabla de verdad:

sel f
00 N4
01 N3
10 N2
11 N1

Código VHDL

library IEEE;
use IEEE.STD_LOGIC_1164.ALL;

entity mux_case is
Port ( N1 : in STD_LOGIC_VECTOR (7 downto 0);
N2 : in STD_LOGIC_VECTOR (7 downto 0);
N3 : in STD_LOGIC_VECTOR (7 downto 0);
N4 : in STD_LOGIC_VECTOR (7 downto 0);
sel : in STD_LOGIC_VECTOR (1 downto 0);
f : out STD_LOGIC_VECTOR(7 downto 0));

end mux_case;

architecture Behavioral of mux_case is


begin
process (N1,N2,N3,N4,sel)
begin
case sel is
when "00" =>
f <= N4;
when "01" =>
f <= N3;
when "10" =>
f <= N2;
when others =>
f <= N1;
end case;
end process;
end Behavioral;
Simulación:

También podría gustarte