Advertisement
Aethox

Principal

Sep 3rd, 2021
782
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VHDL 1.98 KB | None | 0 0
  1. ----------------------------------------------------------------------------------
  2. -- Company:
  3. -- Engineer:
  4. --
  5. -- Create Date: 03.09.2021 10:45:57
  6. -- Design Name:
  7. -- Module Name: labs - Behavioral
  8. -- Project Name:
  9. -- Target Devices:
  10. -- Tool Versions:
  11. -- Description:
  12. --
  13. -- Dependencies:
  14. --
  15. -- Revision:
  16. -- Revision 0.01 - File Created
  17. -- Additional Comments:
  18. --
  19. ----------------------------------------------------------------------------------
  20.  
  21.  
  22. library IEEE;
  23. use IEEE.STD_LOGIC_1164.ALL;
  24. use IEEE.numeric_std.all;
  25. use IEEE.std_logic_unsigned.all;
  26.  
  27.  
  28. -- Uncomment the following library declaration if using
  29. -- arithmetic functions with Signed or Unsigned values
  30. --use IEEE.NUMERIC_STD.ALL;
  31.  
  32. -- Uncomment the following library declaration if instantiating
  33. -- any Xilinx leaf cells in this code.
  34. --library UNISIM;
  35. --use UNISIM.VComponents.all;
  36.  
  37. entity labs is
  38. --  Port ( );
  39. Port(
  40.     a: in std_logic_vector(3 downto 0);
  41.     b: in std_logic_vector(3 downto 0)
  42. );
  43. end labs;
  44.  
  45.  
  46. architecture Behavioral of labs is
  47. --Componentes:
  48.  
  49. component MUXdos is --Mux 2 a 1 (16bits)
  50. Port(
  51.     a: in std_logic_vector(15 downto 0);
  52.     b: in std_logic_vector(15 downto 0);
  53.     Selector: in std_logic;
  54.     Salida: out std_logic_vector(15 downto 0)
  55. );
  56. end component;
  57.  
  58. -- Señales:
  59. signal Verificacion: std_logic;
  60. signal Comprueba: std_logic_vector(1 downto 0);
  61. signal Error: std_logic_vector(15 downto 0);
  62. signal suma: std_logic_vector(15 downto 0);
  63. signal salidaMuxdos: std_logic_vector(15 downto 0);
  64. signal BCD: std_logic_vector(7 downto 0);
  65. signal BIN: std_logic_vector(7 downto 0);
  66. begin
  67.  
  68. u1: MUXdos port map (a => suma, b =>Error, Selector =>Verificacion , Salida =>salidaMuxdos);
  69.  
  70. process(a,b)
  71. begin
  72. if a > "1010"
  73.     then
  74.      Comprueba(0) <= '1';
  75. elsif b > "1010"
  76.         then  
  77.           Comprueba(1) <= '1';
  78. else
  79.     Verificacion <= '0';
  80. end if;
  81. end process;
  82.  
  83. Verificacion <= Comprueba(0) or Comprueba(1);
  84. BCD <= SalidaMuxdos(7 downto 0);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement