1
00:00:01,300 --> 00:00:03,850
How to detect an edge on a given signal.

2
00:00:04,450 --> 00:00:10,930
This lecture will propose a straightforward coding style to detect rising and falling edges on an input

3
00:00:10,930 --> 00:00:11,290
signal.

4
00:00:14,210 --> 00:00:20,520
There are several times in logic controller designs that we should detect and age on an input signal.

5
00:00:20,860 --> 00:00:27,880
Here I will describe a simple sequential circuit to detect a rising or falling edge on a given signal.

6
00:00:28,800 --> 00:00:35,970
The second receives an input signal and generates two outputs rising and falling at.

7
00:00:38,020 --> 00:00:46,120
A single cycle pulse is assigned to each output if rising or falling edge is detected on the input signal.

8
00:00:48,480 --> 00:00:56,010
Let's write the code to logic levels should be distinguished to detect and act one before the edge and

9
00:00:56,010 --> 00:01:00,450
the other after, these two levels should not be the same.

10
00:01:01,290 --> 00:01:05,180
To keep the logical level before the edge, we need a static variable.

11
00:01:05,700 --> 00:01:08,300
Let's call it previous input signal.

12
00:01:09,180 --> 00:01:13,860
Now, using an if else statement, we can detect the edges on the signal.

13
00:01:17,670 --> 00:01:23,670
Whereas the first condition detects the rising edge, the second one detects the following edge.

14
00:01:26,830 --> 00:01:32,470
After detecting the edge, we should update the previous input signal, preparing for detecting the

15
00:01:32,470 --> 00:01:33,150
next stage.

16
00:01:34,590 --> 00:01:38,310
Now, let's see the code behavior invited suchness.

17
00:01:41,240 --> 00:01:47,660
Create a new project and add the edge detector is code attached to this lecture, if you would like

18
00:01:47,660 --> 00:01:55,880
to change the font size right, click somewhere inside or then select preferences, then click on the

19
00:01:55,880 --> 00:02:00,270
text Ed link and then click on the colors and fonts link.

20
00:02:01,190 --> 00:02:05,090
Finally, click on the edit button and change the font size.

21
00:02:16,560 --> 00:02:17,910
Check the design, Sourcefire.

22
00:02:18,970 --> 00:02:23,980
As explained earlier, it contains a static variable and a set of false statements.

23
00:02:32,080 --> 00:02:34,540
Now, let's check the test benchmark.

24
00:02:35,960 --> 00:02:42,980
The follow up applying 13 keeps the input signal at low level for ten clock cycles.

25
00:02:43,940 --> 00:02:51,730
The second look at line 19 changes the input signals voltage level to high and maintains that 14 clock

26
00:02:51,740 --> 00:02:52,280
cycles.

27
00:02:53,230 --> 00:03:00,070
The third group outlined 26 changes, the input signals voltage level to low and maintains that for

28
00:03:00,070 --> 00:03:01,060
10 cycles.

29
00:03:05,050 --> 00:03:08,200
Now we can perform the simulation and check it out.

30
00:03:30,420 --> 00:03:35,790
As we can see, the design description can detect the rising and falling edges on the input signal.

31
00:03:54,820 --> 00:04:00,190
After performing a high level sentences, let's check the analysis perspective and ensure that the design

32
00:04:00,190 --> 00:04:03,550
description is synthesized into a single cycle article code.

33
00:04:11,060 --> 00:04:18,050
To check the cycle, accurate signals in a way form viewer performed the artillery simulation and don't

34
00:04:18,050 --> 00:04:20,780
forget to select All in the dump race, which.

35
00:04:31,270 --> 00:04:35,770
Click on the open waveform viewer, the viewer will appear.

36
00:04:40,740 --> 00:04:44,790
The design signals, as well as the clock signal and check the output signals.

37
00:05:14,350 --> 00:05:19,870
This video is the last lecture explaining how to design a fuel utility logic circuits.

38
00:05:20,230 --> 00:05:25,840
Therefore, the next lecture will give you some exercises to review and master the techniques and coding

39
00:05:25,840 --> 00:05:28,330
styles you have learned throughout this section.

40
00:05:30,750 --> 00:05:37,050
To detect an edge on a given signal, you can save the signal level in a register and then compare the

41
00:05:37,050 --> 00:05:39,280
current signal level with the previous one.

42
00:05:39,960 --> 00:05:43,620
If they do not match, then there is an edge on the signal.

43
00:05:45,640 --> 00:05:51,760
Now, the quiz question, describe a logic circuit that detects two simultaneous rising edge on two

44
00:05:51,760 --> 00:05:53,020
different input signals.
