prakash_kadri
Member level 2
Hello VHDL Experts,
I am new to VHDL. I want to write a simple VHDL program which allows the LED to light up after 5 sec.I am using Spartan-6. The board contains 50 MHz Clock.That means my clock period should be 20 ns. So the value of delay should be equal to (5000000000 ns / 20 ns) = 250000000.
So, when the counter counts from 0 to 249000000 the led lights up.Below is program. But it is not working as i intended it to work.Can you please help to rectify the issue with the program.
----------------------------------------------------------------------------------------------------
I am new to VHDL. I want to write a simple VHDL program which allows the LED to light up after 5 sec.I am using Spartan-6. The board contains 50 MHz Clock.That means my clock period should be 20 ns. So the value of delay should be equal to (5000000000 ns / 20 ns) = 250000000.
So, when the counter counts from 0 to 249000000 the led lights up.Below is program. But it is not working as i intended it to work.Can you please help to rectify the issue with the program.
----------------------------------------------------------------------------------------------------
Code VHDL - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.NUMERIC_STD.ALL; entity test123 is port (clk,reset : in std_logic; led : out std_logic ); end test123; architecture Behavioral of test123 is signal count : unsigned(27 downto 0) := (others => '0'); begin process(clk,reset) begin if(reset = '0') then led <= '0'; count <= (others => '0'); elsif(rising_edge(clk)) then if(count = 250000000-1) then count <= (others => '0'); led <= '1'; else led <= '0'; count <= count +1; --increment counter otherwise. end if; end if; end process; end Behavioral;