Need help figuring out how to control this.. edge triggering.

Discussion in 'VHDL' started by BlackHelicopter, Jun 3, 2010.

  1. BlackHelicopter


    Jun 3, 2010
    Likes Received:
    Hi, I'm trying to generate this signal in VHDL(signal out). I have a signal coming in (signal in) that I want to trigger off of on the rising edge, then start a counter with a 20MHz clock (I want some sort of delay that I can control) and then bring it low after the counter/delay is finished.

    It's hard for me to figure this out because there are two rising edges I need to trigger off of (clk and signal in, which aren't synced up) and VHDL doesn't agree with anything I've tried. How would you implement this? Its not just the rising edges though, I'm not sure how to control the falling edge then either.

    I'm having a lot of trouble coding and understanding VHDL and get stuck on problems like this often, anyone have any good advise?

    Attached Files:

    BlackHelicopter, Jun 3, 2010
    1. Advertisements

  2. BlackHelicopter


    Jan 30, 2009
    Likes Received:
    Clocked Delay Started by Input Signal

    Since the input signal is not synchronized with the counter clock you will need to use a "synchronizer" on that signal. A common synchronizer is 2 D flip-flops clocked by, in this case, the counter clock. The D input of the first flilp-flop is connected to the input signal and its Q output is connected to the D input of the second flip-flop. Let's call the output of the second D flip-flop sig_synch. sig_synch will be used to start (enable) the counter. If the counter is a down counter, it can be loaded with a number representing the number of clock periods of delay that you need. You can use a signal delay_done to indicate when the counter has reached the count of zero. delay_done stops the counter. You will then reload the counter and wait for the next sig_synch. I have left out a few details. For example, you want to ensure that sig_synch has gone low before the counter is enabled again or you will start a new delay cycle too soon soon.

    I hope this helps. It should get you started anyway. If you get stuck again, come back and I am sure someone here will help you.

    eliascm, Jun 3, 2010
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.