Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
14 years ago

need help: frequency div

hello everyone, i am trying to do a frequency divider which convert 33.333Mhz to 1hz frequency, the code don't show any error after compilation, but my result is all zero after simulation. can anyone please help me

the following is the code:

library IEEE;

use IEEE.STD_LOGIC_1164.ALL;

use IEEE.NUMERIC_STD.ALL;

entity clk_gen is

port( Clk : in std_logic;

Clk_mod : out std_logic

);

end clk_gen;

architecture Behavioral of clk_gen is

signal clkdiv : unsigned(24 downto 0);

signal clk1hz : std_logic;

begin

process(Clk)

begin

if rising_edge (Clk) then

clkdiv <= clkdiv + 1;

end if;

end process;

clk1hz <= clkdiv(24);

Clk_mod <= clk1hz;

end Behavioral;

11 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    Its up to you to write the testbench. Use this as an opportunity to learn. Look, lots of people are helping you already!

    Try and create a testbench, and post the code, along with questions, when you have trouble.

    Start with the example I posted here:

    http://www.alteraforum.com/forum/showthread.php?t=32386

    Cheers,

    Dave

    --- Quote End ---

    ok..then i try my best....thanks for helping me...