Marcador En Vhdl
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.std_logic_arith.all;
use IEEE.std_logic_unsigned.all;
entity Practica10 is
Port ( tdC, patC, conC, kickC, tdV, patV, conV, kickV : in STD_LOGIC:='0';
clk50mhz, selector, timeout : in STD_LOGIC:= '0';
habilitador : outSTD_LOGIC_VECTOR (3 downto 0):= "0000";
salida : out STD_LOGIC_VECTOR (7 downto 0):= "00000000");
end Practica10;
architecture Behavioral of Practica10 is
Signal contador: STD_LOGIC_VECTOR (10 downto 0):="00000000000";
signal contador2: std_logic_vector (24 downto 0):="0000000000000000000000000";
signal clk20khz: STD_LOGIC:='1';
signal clk1hz: std_logic:='1';
signal r: std_logic_vector (1downto 0):= "00";
signal auxtdC, auxpatC, auxconC, auxkickC, auxtdV, auxpatV, auxconV, auxkickV, C, V, A: STD_LOGIC_vector (7 downto 0):="00000000";
signal O: STD_LOGIC_vector (3 downto 0):="0000";
signal relojmd: std_logic_vector (3 downto 0):="0001";
signal relojms: std_logic_vector (3 downto 0):="0101";
signal relojsd: std_logic_vector (3 downto 0):="0000";
signal relojss: std_logic_vector(3 downto 0):="0000";
signal dec,cen: std_logic_vector (3 downto 0):="0000";
begin
-----------------------------------------------------------------------------------------
--Marcador
Process(tdC, patC, conC, kickC,C)
begin
if (tdC'event and tdC = '1') then
auxtdC <= auxtdC + 6;
end if;
if (conC'event and conC = '1') then
auxconC <= auxconC + 2;end if;
if (kickC'event and kickC = '1') then
auxkickC <= auxkickC + 3;
end if;
if (patC'event and patC = '1') then
auxpatC <= auxpatC + 1;
end if;
if(C > 99)then
C <= C - 99;
end if;
C <= auxtdC + auxpatC + auxconC + auxkickC;
end process;
Process(tdV, patV, conV, kickV)
begin
if (tdV'event and tdV = '1') then
auxtdV<= auxtdV + 6;
end if;
if (conV'event and conV = '1') then
auxconV <= auxconV + 2;
end if;
if (kickV'event and kickV = '1') then
auxkickV <= auxkickV + 3;
end if;
if (patV'event and patV = '1') then
auxpatV <= auxpatV + 1;
end if;
if(V > 99)then
V <= V - 99;
end if;
V <= auxtdV + auxpatV + auxconV + auxkickV;
end process;-----------------------------------------------------------------------------------------
--RELOJ 20khz
Process (clk50mhz)
begin
if (clk50mhz'event and clk50mhz = '1') then
contador <= contador + 1 ;
contador2 <= contador2 + 1 ;
end if;
if (contador = "10011100010") then
contador <= "00000000000";
clk20khz <= not clk20khz;
end if;
if (contador2 ="1011111010111100001000000") then
contador2 <= "0000000000000000000000000";
clk1hz <= not clk1hz;
end if;
end process;
process(clk20khz)
begin
if (clk20khz'event and clk20khz = '1') then
if (r = "11") then
r <= "00";
end if;
r <= r + '1';
end if;
end process;-----------------------------------------------------------------------------------------
--Cronometro 15min
process(clk1hz)
begin
if(timeout = '0') then
if(clk1hz'event and clk1hz = '1') then
if(relojmd = "0000" and relojms = "0000" and relojsd = "0000" and relojss = "0000") then
relojmd <= "0001"; relojms <= "0101"; relojsd <= "0000"; relojss <= "0000";
elsif(relojss = "0000") then
relojss <="1001";
if(relojsd = "0000")then
relojsd <="0101";
if(relojms = "0000") then
relojms <= "1001";
relojmd <= "0000";
else relojms <= relojms -1;
end if;
else relojsd <= relojsd - 1;
end if;
else relojss <= relojss - 1;
end if;
end if;
end if;
end process;...
Regístrate para leer el documento completo.