Descarga la aplicación para disfrutar aún más
Vista previa del material en texto
Hector Campos Serna Código: 215646659 Arquitectura de computadoras Fecha de entrega: 01/11/2020 Sección: D11 Actividad #4 Códigos VHDL Siguiendo los ejemplos expuestos en clase, realiza cada uno de los códigos en VHDL para describir el comportamiento de los diferentes circuitos. En algunos de ellos solo tendrás que concluir con alguno de sus elementos y otros realizarlos desde 0. 1. Realice un programa de un multiplexor de 1 bit de salida y 8 entradas, como el que se muestra en la figura. Desarrolle su código de programación con base a la tabla de verdad. Diagrama de bloques: Tabla de verdad, expresiones lógicas y/o diagrama lógico de ser necesario: Código: library IEEE; use IEEE.STD_LOGIC_1164.ALL; entity test is Port ( E : in STD_LOGIC_VECTOR (7 downto 0); EN : in STD_LOGIC; CBA : in STD_LOGIC_VECTOR (2 downto 0); Y : out STD_LOGIC_VECTOR (1 downto 0)); end test; architecture Behavioral of test is begin process(EN,CBA) begin if EN ='0' then if CBA="000" then Y(0)<=E(0); Y(1)<=not E(0); elsif CBA ="001" then Y(0)<=E(1); Y(1)<=not E(1); elsif CBA ="010" then Y(0)<=E(2); Y(1)<=not E(2); elsif CBA ="011" then Y(0)<=E(3); Y(1)<=not E(3); elsif CBA ="100" then Y(0)<=E(4); Y(1)<=not E(4); elsif CBA ="101" then Y(0)<=E(5); Y(1)<=not E(5); elsif CBA ="110" then Y(0)<=E(6); Y(1)<=not E(6); elsif CBA ="111" then Y(0)<=E(7); Y(1)<=not E(7); end if; else Y(0)<='0'; Y(1)<='1'; end if; end process; end Behavioral; Cronograma: 2. Diseñe y programe un contador que realice la secuencia 1, 2, 3, 4, 5, 6,7 y repita el ciclo. El circuito debe contar con una señal de reset activo en bajo, que coloca la salida Q en estado bajo. Diagrama de bloques: Tabla de verdad, expresiones lógicas y/o diagrama lógico de ser necesario: Codigo: library IEEE; use IEEE.STD_LOGIC_1164.ALL; entity contador is Port ( RST : in STD_LOGIC; CLK : in STD_LOGIC; Q : inout integer range 0 to 7); end contador; architecture Behavioral of contador is begin process(CLK,RST) begin if (CLK' event and CLK='1') then if RST='1' or Q=7 then Q<=0; else Q<=Q+1; end if; end if; end process; end Behavioral; Presente Futuro 0 1 1 2 2 3 3 4 4 5 5 6 6 7 Cronograma: 3. Describe en código VHDL integrando el funcionamiento de un contador del 0 al 9 y decodificador BCD para un display de 7 segmentos. Diagrama de bloques: Tabla de verdad, expresiones lógicas y/o diagrama lógico de ser necesario: Entradas Display Q3 Q2 Q1 Q0 . g f e d c b a 0 0 0 0 0 0 1 1 1 1 1 1 0 0 0 0 1 0 0 0 0 0 1 1 0 1 0 0 1 0 0 1 0 1 1 0 1 1 2 0 0 1 1 0 1 0 0 1 1 1 1 3 0 1 0 0 0 1 1 0 1 1 0 1 4 0 1 0 1 0 1 1 1 1 1 0 1 5 0 1 1 0 0 1 1 1 1 1 0 1 6 0 1 1 1 0 0 0 0 0 1 1 1 7 1 0 0 0 0 1 1 1 1 1 1 1 8 1 0 0 1 0 1 1 0 0 1 1 1 9 Código: library IEEE; use IEEE.STD_LOGIC_1164.ALL; entity CONTADOR09 is PORT( CLK : IN STD_LOGIC; INI : IN STD_LOGIC; RESET : IN STD_LOGIC; DISPLAY : OUT STD_LOGIC_VECTOR(6 DOWNTO 0) end CONTADOR09; architecture Behavioral of CONTADOR09 is CONSTANT RETRASO_FIN : INTEGER := 49_999_999; SIGNAL RETRASO : INTEGER RANGE 0 TO RETRASO_FIN := 0; SIGNAL CONTADOR: INTEGER RANGE 0 TO 9 := 0; begin PROCESS(CLK) BEGIN IF RISING_EDGE(CLK) THEN IF RESET = '1' THEN RETRASO <= 0; CONTADOR <= 0; ELSE IF INI = '1' THEN RETRASO <= RETRASO +1; IF RETRASO = RETRASO_FIN THEN RETRASO <= 0; CONTADOR <= CONTADOR +1; IF CONTADOR = 9 THEN CONTADOR <= 0; END IF; END IF; END IF; END IF; END IF; END PROCESS; -------------DECODIFICADOR-------------------- --ABCDEFG DISPLAY <= "1111110" WHEN CONTADOR = 0 ELSE "0110000" WHEN CONTADOR = 1 ELSE "1101101" WHEN CONTADOR = 2 ELSE "1111001" WHEN CONTADOR = 3 ELSE "0110011" WHEN CONTADOR = 4 ELSE "1011011" WHEN CONTADOR = 5 ELSE "1011111" WHEN CONTADOR = 6 ELSE "1110000" WHEN CONTADOR = 7 ELSE "1111111" WHEN CONTADOR = 8 ELSE "1111011"; end Behavioral; Cronograma: 4. El siguiente circuito muestra el control de encendido de un motor a pasos en secuencia de medio tiempo. • Tiene una señal de reset que permite restablecer la secuencia de conteo inicial. • Independiente a su control de fases, cuenta con señales de monitoreo que indican en que paso se encuentra el proceso. Diagrama de bloques: Tabla de verdad, expresiones lógicas y/o diagrama lógico de ser necesario: Codigo: library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; entity MotorPasos is Port ( CLK,control : in STD_LOGIC; F : out STD_LOGIC_VECTOR (0 to 3); Q : inout STD_LOGIC_VECTOR (1 downto 0)); end MotorPasos; architecture Behavioral of MotorPasos is begin contador: process(CLK,control) begin if (CLK' event and CLK='1') then if(control='1') then Q<=Q+1; else Q<=Q-1; end if; end if; end process contador; deco: process(Q) begin case Q is when "00" =>F<="1000"; when "01" =>F<="0100"; when "10" =>F<="0010"; when others=>F<="0001"; end case; end process deco; end Behavioral; 5. Describe en código VHDL el siguiente circuito implementando cada uno de los módulos descritos por el diagrama a bloques. El circuito permite capturar la entrada de un teclado matricial de 3X3. Diagrama de bloques: Código: LIBRARY IEEE; USE IEEE.std_logic_1164.ALL; use IEEE.std_logic_arith.all; use IEEE.std_logic_unsigned.all; ENTITY ini_lcd IS PORT( RELOJ, RESET, DEBOUNCE: in STD_LOGIC; DIN: in STD_LOGIC_VECTOR (3 downto 0); PASSCLK: out STD_LOGIC; lcd: out STD_LOGIC_VECTOR (8 downto 0)); END ini_lcd; ARCHITECTURE Behavioral OF ini_lcd IS signal CLK, hab: STD_LOGIC; signal COUNT: STD_LOGIC_VECTOR (3 downto 0); signal ESCRIBE: STD_LOGIC_VECTOR (3 downto 0); signal COUNTT: STD_LOGIC_VECTOR (4 downto 0); begin contador: process (CLK, RESET) begin if RESET='1' then COUNT <= "0000"; elsif CLK='1' and CLK'event then if COUNT /= "1010" then COUNT <= COUNT + 1; else COUNT <= COUNT; end if; end if; end process contador; mux: process (COUNT, RELOJ, CLK, DEBOUNCE, DIN) begin -- Este MULTIPLEXOR permite deshabilitar el RELOJ para pasar a modo de espera de dato del teclado if COUNT /= "1010" then CLK <= RELOJ; hab <= '0'; ESCRIBE <= COUNT; else CLK <= DEBOUNCE; hab <= '1'; ESCRIBE <= DIN; end if; PASSCLK <= CLK; end process mux; ------------DECODIFICADOR-------------------- --ABCDEFG lcd <= "1111110" WHEN COUNT = 0 ELSE "0110000" WHEN COUNT = 1 ELSE "1101101" WHEN COUNT = 2 ELSE "1111001" WHEN COUNT = 3 ELSE "0110011" WHEN COUNT = 4 ELSE "1011011" WHEN COUNT = 5 ELSE "1011111" WHEN COUNT = 6 ELSE "1110000" WHEN COUNT = 7 ELSE "1111111" WHEN COUNT = 8 ELSE "1111011"; end Behavioral; Cronograma:
Compartir