Foro de elhacker.net

Informática => Electrónica => Mensaje iniciado por: Nicolau en 29 Octubre 2022, 11:57 am



Título: Contador 59 segundos en VHDL
Publicado por: Nicolau en 29 Octubre 2022, 11:57 am
Hola,
He hecho este contador de 59 segundos, lo comprobé en la placa y me funciona.
El problema es que al profesor no le ha gustado como he hecho el process y me ha dicho que no puedo usar ni if ni else.  Alguien me puede dar una pista de como podría hacerlo sin los ifs y elses? Gracias de antemano!

entity counter is
    Port ( Clk: in  bit;
           reset: in bit;
           interuptor:in bit;
           sortida_Segons:out bit;
           Qout : out  std_logic_vector (5 downto 0));
          
end counter;

architecture Behavioral of counter is

signal actual, seguent:   unsigned (5 downto 0);
begin
    Qout <= std_logic_vector (actual);
    process(Clk, reset)
    begin
       if (reset='1') then
                actual <= "000000";
            elsif (Clk'event and Clk='1') then
      actual <= seguent;
        end if;
    end process;                   

    process(actual,interuptor)
    begin
    if (interuptor ='1') then
      if (actual < 59 ) then
      sortida_Segons<='0';
      seguent <= actual + 1;
    else if (actual > 59) then
      seguent <= "000000";
      sortida_Segons<='1';
    end if;
         end if;
    else
    seguent <= actual;
   
   end if;
   end process;

end Behavioral;


Título: Re: Contador 59 segundos en VHDL
Publicado por: Meta en 21 Enero 2023, 19:58 pm
Hola:

igHCBFJZ_LA

Saludos.