Bin To BCD
Bin To BCD
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity CodBinBCD is
Port(Bin : in STD_LOGIC_VECTOR (6 downto 0); -- Numero a ser convertido
Uni : out STD_LOGIC_VECTOR (3 downto 0); -- Unidades del BCD
Dec : out STD_LOGIC_VECTOR (3 downto 0) -- Decenas del BCD
);
end CodBinBCD;
begin
process (Bin)
begin
R <= "0000000";
if (Bin >= "0000001" and Bin <= "0001001") then R <= (Bin - "0000000");
end Behavioral;
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity Bin2BCD is
Port ( Bin : in STD_LOGIC_VECTOR (6 downto 0);
D : out STD_LOGIC_VECTOR (3 downto 0);
U : out STD_LOGIC_VECTOR (3 downto 0));
end Bin2BCD;
begin
process (Bin)
begin
case Bin is
end case;
end process;
end Behavioral;