LECCION
HELEN GUALOTO MARTINEZ
CURSO:103
1. PARTICION FUNCIONAL
2. Captura de la simulación en Quartus explicación el funcionamiento
BLOQUES A USAR
CODIGO DE LA MSS
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity MSS_System is
Port (
clk : in std_logic;
reset : in std_logic;
key_input : in std_logic_vector(3 downto 0);
valid : in std_logic;
seg1, seg2 : out std_logic_vector(6 downto 0)
);
end MSS_System;
architecture Behavioral of MSS_System is
-- Señales internas
signal num1, num2, num3 : std_logic_vector(3 downto 0);
signal sum : std_logic_vector(5 downto 0);
signal ready : std_logic;
signal is_odd, is_even, greater_than_5 : std_logic;
signal state : integer := 0;
-- Componentes
component TECLADO
Port ( clk, reset, valid : in std_logic;
key_input : in std_logic_vector(3 downto 0);
num1, num2, num3 : out std_logic_vector(3 downto 0);
ready : out std_logic);
end component;
component SUMA
Port ( num1, num2, num3 : in std_logic_vector(3 downto 0);
sum : out std_logic_vector(5 downto 0));
end component;
component DECO_7_SEG
Port ( sum : in std_logic_vector(5 downto 0);
seg1, seg2 : out std_logic_vector(6 downto 0));
end component;
component Odd_Checker
Port ( input_num : in std_logic_vector(3 downto 0);
is_odd : out std_logic);
end component;
component Even_Checker
Port ( input_num : in std_logic_vector(3 downto 0);
is_even : out std_logic);
end component;
component COMPARADOR
Port ( input_num : in std_logic_vector(3 downto 0);
greater_than_5 : out std_logic);
end component;
begin
-- Instancias de los módulos
odd_check : Odd_Checker port map (num1, is_odd);
even_check : Even_Checker port map (num2, is_even);
gt5_check : COMPARADOR port map (num3, greater_than_5);
sum_block : SUMA port map (num1, num2, num3, sum);
display : DECO_7_SEG port map (sum, seg1, seg2);
process(clk, reset)
begin
if reset = '1' then
num1 <= "0000";
num2 <= "0000";
num3 <= "0000";
state <= 0;
elsif rising_edge(clk) then
if valid = '1' then
case state is
when 0 =>
if is_odd = '1' then
num1 <= key_input;
state <= 1;
end if;
when 1 =>
if is_even = '1' then
num2 <= key_input;
state <= 2;
end if;
when 2 =>
if greater_than_5 = '1' then
num3 <= key_input;
state <= 3;
end if;
when 3 =>
ready <= '1';
when others =>
state <= 0;
end case;
end if;
end if;
end process;
end Behavioral;
FUNCIONAMIENTO
• Primero tenemos la entrada de datos, el usuario ingresa tres numero uno a uno a
través de un teclado, cada numero es validado de acuerdo a su condición, el primero
número debe de ser impar, el segundo debe de ser par y el tercero mayor a 5. Si un
numero no cumple con su restricción no se almacena y el sistema espera un nuevo
ingreso.
• Una vez validado cada numero es almacenado en un registro de sostenimiento
asegurando que los valores sean estables para la siguiente etapa.
• Una vez ingresados los tres valores validos un modulo de suma calcula la sumade los
tres números
• La suma obtenida se convierte en formato BCD y se envía< a dos display de 7
segmentos