vhdl
--Especificación comportamental
--Puede comprobarse su simplicidad (aunque requiere conversión de tipos)
Library ieee;
use ieee.std_logic_1164.ALL;
useieee.std_logic_unsigned.ALL;
use ieee.std_logic_arith.ALL;
--Definición de la entidad
Entity mux_bhr is port
(a: in std_logic_vector(15 downto 0);
sel: in std_logic_vector(3 downto 0);
z: out std_logic);
endmux_bhr;
--Arquitectura
Architecture bhr of mux_bhr is
begin
z <= a(conv_integer (sel));
end bhr;
-- Decodificador
--Especificación comportamental
--Puede comprobarse su simplicidad (aunquerequiere conversión de tipos)
Library ieee;
use ieee.std_logic_1164.ALL;
use ieee.std_logic_unsigned.ALL;
use ieee.std_logic_arith.ALL;
--Definición de la entidad
Entity dec_bhr is port(x: in std_logic_vector(3 downto 0);
sel: in std_logic;
z: out std_logic_vector(15 downto 0));
end dec_bhr;
--Arquitectura
Architecture bhr of dec_bhr is
begin
process (x)
beginz<=(others=>'0'); -- Se colocan todas las salidas a cero
if sel='1' then z(conv_integer(x)) <= '1'; --Entonces se activa la salida correcta
end if;
end process;
end bhr;
-- Bus tri-state--Especificación comportamental
Library ieee;
use ieee.std_logic_1164.ALL;
--Definición de la entidad
Entity tris is port
(a, b: in std_logic_vector(1 downto 0);
ae, be: in std_logic;
y: inoutstd_logic_vector(1 downto 0));
end tris;
--Arquitectura
Architecture func of tris is
begin
process (a, ae)
begin
if (ae='1') then y <= a;
else y <= (others => 'Z');
end if;
endprocess;
process(b, be)
begin
if (be='1') then y <= b;
else y <= (others => 'Z');
end if;
end process;
end func;
-- Sumador/Restador
--Especificación comportamental
Libraryieee;
use ieee.std_logic_1164.ALL;
use ieee.std_logic_unsigned.ALL;
Entity SumaDif is
generic (n:integer:=4);
port (
a, b:in std_logic_vector(n-1 downto 0);
cin, sel:in std_logic;
s_d:out...
Regístrate para leer el documento completo.