Professional Documents
Culture Documents
Problemas VHDL 1 Al 4
Problemas VHDL 1 Al 4
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;
entity sumres is
port( A,B : in std_logic_vector (3 downto 0);
ci : in std_logic;
EN : in std_logic;
S : out std_logic_vector (3 downto 0);
Co : out std_logic);
end sumres;
process (EN,A,B)
begin
if (EN= ‘1’) then S<=A+B;
elsif (EN= ‘0’) then S=<A-B;
end if;
end process;
end solucion;
Problema 2.
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;
entity comparador is
port( A : in std_logic_vector (3 downto 0);
B : in std_logic_vector(3 downto 0);
IGU : out std_logic;
MAY : out std_logic;
MEN : out std_logic;
end comparador;
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;