Need to delay a signal a great number of clk cycles

Joined
Mar 29, 2007
Messages
14
Reaction score
0
Hi

Do someone have any tricks on how to delay a signal without using shift registers? Need to delay an enable signal (one bit) approx. 1024 clock cycles, and an shift register implementation will be quite big. The implementation is to be synthesises so 'after' commands are not possible.

Thanks
Martin
 
Joined
May 4, 2007
Messages
49
Reaction score
0
Use a 10-bit counter to delay something 1024 clock cycles. Use this 2-state state machine.

Code:
Count_grab : process(clk, reset)
begin
  if (reset = '1') then
    counter               <= (others => '0'); -- Counts from 0 to 1023
    YOUR_END_PULSE <= '0';  
    s_pulse_grab <= s_idle;
  elsif elsif rising_edge(clk) then
       counter              <= (others => '0'); -- defualt wherever it's not defined
       YOUR_END_PULSE <= '0';   -- defualt wherever it's not defined
    when s_idle => 
      if (incoming_pulse = '1') then  -- Latch in the incoming pulse 
        counter        <= counter + '1'; -- Start counting
        s_pulse_grab <= s_enabling;
      else
        s_pulse_grab <= s_idle;
      end if;
    when s_enabling => 
      if (counter = 1022) then  -- Find one sample before the end 
        YOUR_END_PULSE <= '1';   -- This is your 1024 delayed pulse
        s_pulse_grab       <= s_idle;
      else
        counter              <= counter + '1'; 
        s_pulse_grab       <= s_enabling;
      end if;
    when others =>
  end if;
end process;

Enjoy,
Scott
 
Last edited:

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top