en la actividad de hoy se realiza una maquina de estado donde de utilizara el counter para llegar hasta un cierto numero se realiza lo que es el código donde:
----------------------------------------------------------------------------------
-- Company:
-- Engineer:
--
-- Create Date: 18:24:47 11/04/2020
-- Design Name:
-- Module Name: maquinadeestado - Behavioral
-- Project Name:
-- Target Devices:
-- Tool versions:
-- Description:
--
-- Dependencies:
--
-- Revision:
-- Revision 0.01 - File Created
-- Additional Comments:
--
----------------------------------------------------------------------------------
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
-- Uncomment the following library declaration if using
-- arithmetic functions with Signed or Unsigned values
--use IEEE.NUMERIC_STD.ALL;
-- Uncomment the following library declaration if instantiating
-- any Xilinx primitives in this code.
--library UNISIM;
--use UNISIM.VComponents.all;
entity maquinadeestado is
Port ( clk : in STD_LOGIC;
led : out STD_LOGIC);
end maquinadeestado;
architecture Behavioral of maquinadeestado is
--50,000,000 para un pulso de 1s
--1,000,00
constant lim_cont: integer := 999_999; -- aca se declara hasta que numero llegaremos o el limite que tendremos
signal counter : integer range 0 to lim_cont:=0;
signal en: std_logic :='0';
signal led_int: std_logic:='0';
begin
process (clk)
begin
if rising_edge (clk) then
counter<=counter+1; -- sera lasuma del counter nos sumara mas 1 en cada proceso que lleve
if counter = lim_cont then
counter<=0;
en<='1'; --en caso que el valor sea 1
else
en<='0'; -- en caso que el valor nos de 0
end if;
end if;
end process;
process (clk)
begin
if rising_edge (clk) then
if en = '1' then
led_int<=not(led_int);
end if;
end if;
end process;
led<=led_int;
end Behavioral;
No hay comentarios:
Publicar un comentario