I am trying to get a simple blinking LED program working on my FPGA and I am having problems. Instead of blinking the LED stays on the entire time. I tried writing my on but then I just copied an example program so I'm sure the program is fine.
Thi sis the board I am using: http://www.digilentinc.com/Products/Detail.cfm?NavPath=2,400,836&Prod=ATLYS From what I've read you are supposed to use DCMs for all clock needs but in my example I have just attached my clock to the global clock which is supposed to be 100MHz.
Any help for my poor noobie self would be appreciated! Below is my code and my ucf which can be verified with the ucf listed at the above link.
By the way, do any of you know offhand how to import a DCM in ISE? I can figure out how to use it I just can't find an import reference.
library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.std_logic_unsigned.all; use IEEE.numeric_std.all; entity counter is port( clk: in std_logic; rst: in std_logic; led: out std_logic; led2: out std_logic; sw0: in std_logic); end counter; architecture Behavioral of counter is constant CLK_FREQ : integer := 1000000; constant BLINK_FREQ : integer := 1; constant CNT_MAX : integer := CLK_FREQ/BLINK_FREQ/2 - 1; signal cnt : unsigned(24 downto 0); signal blink : std_logic := '1'; begin process(clk) begin if (clk='1' and clk'event) then if cnt = CNT_MAX then cnt <= (others => '0'); blink <= not blink; else cnt <= cnt + 1; end if; end if; end process; process(sw0) begin if sw0 = '1' then led2 <= '1'; else led2 <= '0'; end if; end process; led <= blink; end Behavioral;
# Bank = 1, Pin name = IO_L42P_GCLK7_M1UDM, Type = GCLK, Sch name = GCLK NET "clk" LOC = L15; # Bank = 1, Pin name = IO_L52N_M1DQ15, Sch name = LD0 NET "led" LOC = U18; # PlanAhead Generated physical constraints NET "led2" LOC = M14; NET "rst" LOC = F5; NET "sw0" LOC = A10;