In this section, we are going to work on our first project. The goal of this project is using HLS 1
approach to design a combinational circuit that controls a simple home alarm system. 2
Before delving into the coding process, firstly we should define the system. This lecture will define 3
our simple home alarm system. 4
This picture shows the floor plan of our considered home. 5
There is a sensor attached to each window in a bedroom. 6
The sensor detects whether the window is open or closed. 7
If the window is open, it generates a high voltage level corresponding to logic value 1. Otherwise, 8
its output is 0. 9
Therefore, there are three window sensors in the system. 10
Also, there are two motion sensors in the living area and kitchen. 11
In the case of any motion detected by a motion sensor, it generates the logic value 1. The alarm 12
system also has a control panel that is used for monitoring and turning on/off the system. An 13
on/off switch (denoted by SW) receives a specific patter of four bits to switch on the system. 14
The pattern that turns on the switch is the binary value of 1011. Seven segments are used 15
to show the status of sensors when the system is activated. 16
We are going to implement this alarm system on the Basys3 board using its features. Three slide 17
switches on the Basys3 board are used to model the window sensors. SW0, 18
SW1 and SW2 model the window sensors W1, W2 and W3, respectively. 19
Two slide switches SW6 and SW7 on the Basys3 board are used to represent the motion 20
sensors. 21
3- The four slide switches on the Basys3 board, SW12, SW13, SW14, SW15 are used to represent 22
the pattern for turning on the alarm system. 23
Notice that SW12 represents the LSB and SW15 denotes the MSB of the pattern. 24
We use a 16-bit variable in the code to read the status of slide switches. 25
We use seven-segments on the Basys3 board to display the status of the system. When the system is OFF, 26
all seven segments show the letter 0. When the system is ON, and everything is OK, 27
all seven segments show the letter A. 28
If a sensor detects a malfunction, then all seven segments show the letter E. In the case of detecting a malfunction 29
by a window sensor, then the sensor number is shown on the first seven-segment 30
if we press a push-button, as shown in this figure. In the case of detecting a malfunction by a motion 31
sensor, then the sensor number is shown on the second seven-segment if we press a push-button, as shown 32
in this figure. 33
We use a 5-bit arbitrary precision variable in the code to get the push-button states. 34
Now we should describe our system using HLS C/C++ language. The next lecture will explain the structure 35
of the design code, as well as the test bench code.