When to use it
Loads of logic wants to fire once when something happens: a button goes down, a flag is raised, a strobe arrives. An edge detector converts a level into a single one-clock-wide pulse, perfect for enabling a counter, kicking off a state machine, or generating a handshake.
How it works
Delay the signal by one flip-flop and compare. A rising edge is "high now AND low
last cycle" (level & ~prev); a falling edge is the mirror image. That's it, one
flop and two gates.
Gotchas
- The input must be in your clock domain already. If it's asynchronous, synchronize it first, or you'll detect glitches.
- The pulse is exactly one clock wide, if a downstream block can miss a single-cycle strobe, latch it.