How to detect an edge on a given signal.
This lecture will propose a straightforward coding style to detect rising and falling edges on an input
signal.
There are several times in logic controller designs that we should detect and age on an input signal.
Here I will describe a simple sequential circuit to detect a rising or falling edge on a given signal.
The second receives an input signal and generates two outputs rising and falling at.
A single cycle pulse is assigned to each output if rising or falling edge is detected on the input signal.
Let's write the code to logic levels should be distinguished to detect and act one before the edge and
the other after, these two levels should not be the same.
To keep the logical level before the edge, we need a static variable.
Let's call it previous input signal.
Now, using an if else statement, we can detect the edges on the signal.
Whereas the first condition detects the rising edge, the second one detects the following edge.
After detecting the edge, we should update the previous input signal, preparing for detecting the
next stage.
Now, let's see the code behavior invited suchness.
Create a new project and add the edge detector is code attached to this lecture, if you would like
to change the font size right, click somewhere inside or then select preferences, then click on the
text Ed link and then click on the colors and fonts link.
Finally, click on the edit button and change the font size.
Check the design, Sourcefire.
As explained earlier, it contains a static variable and a set of false statements.
Now, let's check the test benchmark.
The follow up applying 13 keeps the input signal at low level for ten clock cycles.
The second look at line 19 changes the input signals voltage level to high and maintains that 14 clock
cycles.
The third group outlined 26 changes, the input signals voltage level to low and maintains that for
10 cycles.
Now we can perform the simulation and check it out.
As we can see, the design description can detect the rising and falling edges on the input signal.
After performing a high level sentences, let's check the analysis perspective and ensure that the design
description is synthesized into a single cycle article code.
To check the cycle, accurate signals in a way form viewer performed the artillery simulation and don't
forget to select All in the dump race, which.
Click on the open waveform viewer, the viewer will appear.
The design signals, as well as the clock signal and check the output signals.
This video is the last lecture explaining how to design a fuel utility logic circuits.
Therefore, the next lecture will give you some exercises to review and master the techniques and coding
styles you have learned throughout this section.
To detect an edge on a given signal, you can save the signal level in a register and then compare the
current signal level with the previous one.
If they do not match, then there is an edge on the signal.
Now, the quiz question, describe a logic circuit that detects two simultaneous rising edge on two
different input signals.