# FPGA too slow for my ripple carry adder?

I wanted to make simple LED counter on my FPGA board (Cyclone IV EP4CE). I've made (from scratch - from NANDs) 4bit counter and 26 bit one. I have 26bit signal that is wired (port map) into 26 bit RIPPLE CARRY ADDER as one input and constant 1 as another input. I also have this with the 4 bit counter (wired to LEDs). Both are simple port maps (see code below).

Then I've got simple process that uses the precomputed value from 26 bit RIPPLE CARRY ADDER (current counter value + 1) and assigns it to counter. Then it check wheter counter has some value. If it does, it uses the precomputed LEDs value and assigns it to LEDs output in the same manner.

Code :

entity bit_register2led is
port(
clk : in BIT;
led : out BIT_VECTOR(3 downto 0)
);
end entity;

architecture leds of bit_register2led is
signal count : BIT_VECTOR(25 downto 0) := "00000000000000000000000000";
signal one : BIT_VECTOR(25 downto 0) := "00000000000000000000000001";
signal leds : BIT_VECTOR(3 downto 0) := "0000";

signal tmpC : BIT_VECTOR(25 downto 0) := "00000000000000000000000000";
signal tmpleds : BIT_VECTOR(3 downto 0) := "0000";
--. . .
begin
adder1 : Ripple_Carry26 port map(A=>count, B=>one, Sum=>tmpC);
adder2 : Ripple_Carry port map(A=>"0001", B=>leds, Sum=>tmpleds);
--  ‭0010111110101111000010000000‬ = 50 million - 50 MHz oscillator
proc : process(clk)
begin
if clk'event and clk = '1' then
count <= tmpC;
if count = "10111110101111000010000000" then
leds <= tmpleds;
end if;
end if;
end process;
led <= not leds;
end architecture;


This should add 1 to leds every second. It doesn't really work tho (it takes more than 1 sec). It's too slow and I'm getting warnings about timing requirements not met. Below are readings from Quartus timing analyzer, showing (I think at least..) my ripple carry adder is somehow too slow. I'm bit lost tho in all that. Not sure where the problem is.

Every help appreciated.

• Why are you using a 1GHz clock for something that should count seconds? – DonFusili Apr 1 at 14:22
• @DonFusili Ummm I don't. The FPGA runs at 50MHz. I did not notice the timer assuming 1GHz.. I'm gonna fix that – ShinobiUltra Apr 1 at 14:43
• UPDATE: Yep, so that turned out to be the issue. It obviously isn't as fast as 1GHz, but when everything set correctly, it's alright – ShinobiUltra Apr 1 at 14:49