0
1
00:00:01,160 --> 00:00:07,160
In this section, we are going to work on our first project. The goal of this project is using HLS 
1

2
00:00:07,160 --> 00:00:12,260
approach to design a combinational circuit that controls a simple home alarm system.
2

3
00:00:13,190 --> 00:00:19,880
Before delving into the coding process, firstly we should define the system. This lecture will define 
3

4
00:00:19,880 --> 00:00:21,790
our simple home alarm system. 
4

5
00:00:24,650 --> 00:00:27,900
This picture shows the floor plan of our considered home.
5

6
00:00:28,160 --> 00:00:30,540
There is a sensor attached to each window in a bedroom. 
6

7
00:00:31,100 --> 00:00:34,400
The sensor detects whether the window is open or closed. 
7

8
00:00:34,790 --> 00:00:41,870
If the window is open, it generates a high voltage level corresponding to logic value 1. Otherwise, 
8

9
00:00:42,410 --> 00:00:43,580
its output is 0.
9

10
00:00:43,970 --> 00:00:46,670
Therefore, there are three window sensors in the system. 
10

11
00:00:47,510 --> 00:00:51,470
Also, there are two motion sensors in the living area and kitchen. 
11

12
00:00:52,730 --> 00:00:59,690
In the case of any motion detected by a motion sensor, it generates the logic value 1. The alarm 
12

13
00:00:59,690 --> 00:01:06,980
system also has a control panel that is used for monitoring and turning on/off the system. An
13

14
00:01:06,980 --> 00:01:13,040
on/off switch (denoted by SW) receives a specific patter of four bits to switch on the system. 
14

15
00:01:13,340 --> 00:01:20,180
The pattern that turns on the switch is the binary value of 1011. Seven segments are used 
15

16
00:01:20,180 --> 00:01:23,660
to show the status of sensors when the system is activated.
16

17
00:01:26,810 --> 00:01:32,480
We are going to implement this alarm system on the Basys3 board using its features.  Three slide 
17

18
00:01:32,480 --> 00:01:37,880
switches on the Basys3 board are used to model the window sensors. SW0,
18

19
00:01:37,930 --> 00:01:43,910
SW1 and SW2 model the window sensors W1, W2 and W3, respectively.
19

20
00:01:45,490 --> 00:01:51,820
Two slide switches SW6 and SW7 on the Basys3 board are used to represent the motion 
20

21
00:01:51,820 --> 00:01:52,450
sensors.
21

22
00:01:53,790 --> 00:02:03,090
3-	The four slide switches on the Basys3 board, SW12, SW13, SW14, SW15  are used to represent 
22

23
00:02:03,090 --> 00:02:06,120
the pattern for turning on the alarm system.
23

24
00:02:06,810 --> 00:02:12,990
Notice that SW12 represents the LSB and SW15 denotes the MSB of the pattern.
24

25
00:02:14,390 --> 00:02:18,860
We use a 16-bit variable in the code to read the status of slide switches.
25

26
00:02:23,400 --> 00:02:30,180
We use seven-segments on the Basys3 board to display the status of the system. 	When the system is OFF, 
26

27
00:02:30,210 --> 00:02:35,790
all seven segments show the letter 0. When the system is ON, and everything is OK, 
27

28
00:02:36,000 --> 00:02:38,340
all seven segments show the letter A.
28

29
00:02:40,190 --> 00:02:47,360
If a sensor detects a malfunction, then all seven segments show the letter E. In the case of detecting a malfunction
29

30
00:02:47,360 --> 00:02:51,750
by a window sensor, then the sensor number is shown on the first seven-segment 
30

31
00:02:51,950 --> 00:02:58,610
if we press a push-button, as shown in this figure.  In the case of detecting a malfunction by a motion 
31

32
00:02:58,610 --> 00:03:04,970
sensor, then the sensor number is shown on the second seven-segment if we press a push-button, as shown
32

33
00:03:04,970 --> 00:03:05,630
in this figure.
33

34
00:03:08,090 --> 00:03:13,040
We use a 5-bit arbitrary precision variable in the code to get the push-button states.
34

35
00:03:16,930 --> 00:03:24,100
Now we should describe our system using HLS C/C++ language. The next lecture will explain the structure 
35

36
00:03:24,100 --> 00:03:27,430
of the design code, as well as the test bench code.
