Práctica#4 Decodificador

 


----------------------------------------------------------------------------------
-- Company: 
-- Engineer: 
-- 
-- Create Date:    21:39:32 10/16/2021 
-- Design Name: 
-- Module Name:    DECODIFICADOR_BDC - Behavioral 
-- Project Name: 
-- Target Devices: 
-- Tool versions: 
-- Description: 
--
-- Dependencies: 
--
-- Revision: 
-- Revision 0.01 - File Created
-- Additional Comments: 
--
----------------------------------------------------------------------------------
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;

-- Uncomment the following library declaration if using
-- arithmetic functions with Signed or Unsigned values
--use IEEE.NUMERIC_STD.ALL;

-- Uncomment the following library declaration if instantiating
-- any Xilinx primitives in this code.
--library UNISIM;
--use UNISIM.VComponents.all;


entity DECODIFICADOR_BCD is
PORT( DISPLAY : OUT STD_LOGIC_VECTOR(6 DOWNTO 0);
      SElECTOR : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
      DATO_BIN : IN STD_LOGIC_VECTOR(3 DOWNTO 0)
    );
end DECODIFICADOR_BCD;
architecture Behavioral of DECODIFICADOR_BCD is
TYPE NOMBRE IS (a,b,C,d,E,F,O,L,U,CERO);
SIGNAL LETRA : NOMBRE := CERO;
SIGNAL DATO_ENTERO : INTEGER RANGE 0 TO 9 := 0;
begin
DATO_ENTERO <= CONV_INTEGER(DATO_BIN);
WITH DATO_ENTERO SELECT
           --ABCDEFG
DISPLAY <=  "0001000" WHEN 1,--A
            "1100000" WHEN 2,--b
            "0110001" WHEN 3,--C
            "1000010" WHEN 4,--d
            "0110000" WHEN 5,--E
            "0111000" WHEN 6,--F
            "0000001" WHEN 7,--O
            "1110001" WHEN 8,--L
            "1000001" WHEN 9,--U
            "0000001" WHEN OTHERS;
        
WITH DATO_ENTERO SELECT
LETRA <= a    WHEN 1,
         b    WHEN 2,
C   WHEN 3,
d WHEN 4,
E  WHEN 5,
F    WHEN 6,
O  WHEN 7,
L    WHEN 8,
U  WHEN 9,
    CERO    WHEN OTHERS;
SELECTOR <= "0111";          
end Behavioral;









Comentarios