Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Library ieee;
- use ieee.std_logic_1164.all;
- entity bcd_7seg is
- port(
- bcd : in std_logic_vector(3 downto 0);
- D: out std_logic_vector(6 downto 0)
- );
- attribute pin_numbers of bcd_7seg: entity is
- "D(6):21 D(5):20 D(4):19 "
- & "D(3):18 D(2):17 D(1):16 D(0):15 " -- se deja un espacio despues de g:15 para que al concatenar
- & "BCD(0):11 BCD(1):10 BCD(2):9 BCD(3):8"; -- haya una separacion entre literales
- end bcd_7seg;
- architecture cto of bcd_7seg is
- constant zero : std_logic_vector(6 downto 0) := "0000001";
- constant uno : std_logic_vector(6 downto 0) := "1001111";
- constant dos : std_logic_vector(6 downto 0) := "0010010";
- constant tres : std_logic_vector(6 downto 0) := "0000110";
- constant quat : std_logic_vector(6 downto 0) := "1001100";
- constant qint : std_logic_vector(6 downto 0) := "0100100";
- constant sixt : std_logic_vector(6 downto 0) := "0100000";
- constant sept : std_logic_vector(6 downto 0) := "0001111";
- constant octo : std_logic_vector(6 downto 0) := "0000000";
- constant nono : std_logic_vector(6 downto 0) := "0000100";
- constant OFF : std_logic_vector(6 downto 0) := "-------";
- begin
- Conv_codigo : process(BCD)
- begin
- case bcd is
- when "0000" => D <= zero;
- when "0001" => D <= uno;
- when "0010" => D <= dos;
- when "0011" => D <= tres;
- when "0100" => D <= quat;
- when "0101" => D <= qint;
- when "0110" => D <= sixt;
- when "0111" => D <= sept;
- when "1000" => D <= octo;
- when "1001" => D <= nono;
- when others => D <= OFF;
- end case;
- end process conv_codigo;
- end cto;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement