Re: Pulse stretching

The decision on what works "better" is dependent on why you need to stretch the pulse.

If you need a signal that's big enough to be sensed in a different clock domain, an "acknowledge" can be brought back to the first time domain to shut the pulse back off. This assumes that two pulses won't be close enough to interfere.

If we stick with your original approach, rather than using the |stretcher in your construct below, I'd turn longer_pulse into a set/reset flop that's started with the single_clock_pulse and ended with the stretcher_sr[2], i.e.

longer_pulse What are the best techniques for stretching single-clock pulses? Here

"best" defined as either faster or smaller logic. > > I've been using the following technique with great success, the idea is to > add a few clock cycles to a pulse prior to having it cross a clock domain

or

send it somewhere where it would be safer to have it be active longer: > > reg [3:0] counter; > reg single_clock_pulse; > reg [3:0] strecher_sr; > reg longer_pulse; > > // Generate a test pulse > always @(posedge clock)begin > counter single_clock_pulse end > > // Stretch the pulse > always @(posedge clock)begin > stretcher_sr longer_pulse end > > By changing the length of the shift register I can control the new pulse > duration. This is obviously not a good technique for very long durations. > What are some of the other techniques? Anything more "elegant" than this? > > Thanks, > > > -- > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > Martin Euredjian > > To send private email: > 0_0_0_0 snipped-for-privacy@pacbell.net > where > "0_0_0_0_" = "martineu" > >
Reply to
John_H
Loading thread data ...

enough

Right. I've used this approach in some modules, like both sides of a FIFO operating across clock-domain boundaries. I had to resort to stretching when the signal in question had to go to multiple desitinations and it didn't seem practical to generate and maintain different pulse ack channels. My personal bias is that it made everything seems a bit messy.

My general approach to clock domain crossing has been to stretch the pulse (if necessary) to guarantee that it will span several of the receiver's clock cycles; re-sample with at least four F/F's and edge-detect. So far, so good.

reason

A single SRL sounds good to me.

Thanks,

--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Martin Euredjian
 Click to see the full signature
Reply to
Martin Euredjian

Reply to
Peter Alfke

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.