Edge Detection
Edge detection is the process of detecting when a signal changes state. There are three types of edge detection:
Rising Edge: when a signal goes from OFF to ON.
Falling Edge: when a signal goes from ON to OFF.
Either Edge: when a signal goes from either OFF or ON.
Construction


You can detect a rising edge by checking whether the input signal was off some number of ticks ago but is now on.
This can be done using an AND Gate and an Inverter. Connect one input of the AND gate directly to your signal, and connect the other input through the inverter.
When the input signal turns on, the direct input to the AND gate is immediately on. The inverter output, however, is delayed by 1 tick, so it remains on for one more tick. Since both inputs of the AND gate are on, it becomes marked for activation in the next tick.
On the next tick, the AND gate turns on while the inverter output turns off. At this point, not all AND gate inputs are on, so it will be marked to turn off on the following tick.
The pulse length is determined by the delay between the direct and inverted inputs of the AND gate. You can extend the pulse to 2 ticks using a Buffer, or make it 2 ticks or longer with a Delayer.
Example Signal Diagram
Below is an example timing diagram showing how a rising edge detector behaves:
| 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | ||
| Input | |||||||||||||||||
| Output | |||||||||||||||||