I've wrote this piece of code for a frequency divider in VHDL language and I don't understand why my frequency isn't divided when I simulate it. What I am doing wrong?
library IEEE;
use IEEE.std_logic_unsigned.all;
use IEEE.std_logic_1164.all;
entity div is
port(clk : in std_logic;
clk1, clkafisare, clkorg : out std_logic);
end entity;
architecture fct_div of div is
begin
process(clk)
variable c, e, g : integer := 0;
variable d, f, h : std_logic := '0';
begin
if rising_edge(clk) then
e := e+1; c := c+1; g := g+1;
if g = 12000000 and h = '0' then
h := '1'; g := 0;
elsif g = 12000000 and h = '1' then
h := '0'; g := 0;
end if;
if c = 25000000 and d = '0' then
d := '1'; c := 0;
elsif c = 25000000 and d = '1' then
d := '0'; c := 0;
end if;
if e = 100000 and f = '0' then
f := '1'; e := 0;
elsif e = 100000 and f = '1' then
f := '0'; e := 0;
end if;
end if;
clk1 <= d;
clkafisare <= f;
clkorg <= h;
end process;
end fct_div;
