Forum Discussion

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

Generate a pulse?

Anyone can help me?

I need to generate a pulse for data load control in VHDL, which function I can use to generate a pulse?

Thanks!

Cliff

2 Replies

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

    you will need a counter, and then generate the pulse when the counter is within a specified range.

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

    Hi Cliffchen,

    here is a classic pulse generator for one clock period in vhdl:

    edge_detect: process ( reset_n, clk )

    begin

    if (reset_n = '0') then

    ff0 <= '0';

    ff1 <= '0';

    elsif (clk'event and clk = '1') then

    ff0 <= in;

    ff1 <= ff0;

    end if;

    end process edge_detect;

    pulse = '1' when (ff0 = '1' and ff1 = '0') else '0';

    Now, if the "in" signal changes from '0' to '1' the output "pulse" is '1' for one clock cycle.