0
1
00:00:01,080 --> 00:00:06,870
In the previous lecture, we designed the traffic light controller in HLS. In this lecture, we use the 
1

2
00:00:06,990 --> 00:00:11,250
Vivado-Hlx toolset to map our controller on the Basys3 board.  
2

3
00:00:13,810 --> 00:00:21,740
Firstly, create a new Vivado-HLS project and name it traffic_light-vhls. Then, choose 
3

4
00:00:21,760 --> 00:00:24,830
a proper path for the new project. After that.
4

5
00:00:25,000 --> 00:00:28,150
choose the traffic_light as the design top function name.
5

6
00:00:29,140 --> 00:00:33,100
Don’t forget to choose the Basys3 board as the target FPGA platform.
6

7
00:00:35,370 --> 00:00:40,800
Download the design files attached to this lecture and save it inside the created Vivado-HLS project
7

8
00:00:40,800 --> 00:00:43,470
folder (or any other desired folder).
8

9
00:00:45,160 --> 00:00:51,970
Right-click on the source folder in the Explorer View in the Vivado-HLS IDE and select the “Add Files…” option. 
9

10
00:00:52,360 --> 00:00:58,750
Then go to the folder where you saved the traffic-light files and select the two “traffic_light.cpp”
10

11
00:00:58,750 --> 00:01:03,910
and “traffic_light.h” files and add them to the project.
11

12
00:01:04,360 --> 00:01:05,950
Open the files and examine them. 
12

13
00:01:06,730 --> 00:01:08,320
The traffic_light.h
13

14
00:01:08,320 --> 00:01:09,990
is almost empty. 
14

15
00:01:10,120 --> 00:01:12,520
I have considered that just for future usage.  
15

16
00:01:13,270 --> 00:01:19,180
The traffic_light.cpp file contains five subfunctions describing the five rules 
16

17
00:01:19,180 --> 00:01:23,680
that I explained in the previous lecture. And also the design top function.
17

18
00:01:24,130 --> 00:01:28,390
The design top function invokes the subfunctions and generates the outputs. 
18

19
00:01:29,420 --> 00:01:31,730
It also has the function argument interfaces. 
19

20
00:01:46,100 --> 00:01:52,700
Now we can perform the HLS synthesis process. The synthesis report shows that the circuit delay is about  
20

21
00:01:52,700 --> 00:01:59,570
2.934 ns. And the generated hardware is combinational as it uses only LUTs 
21

22
00:01:59,570 --> 00:02:01,610
without any memory cells.
22

23
00:02:02,300 --> 00:02:05,960
In addition, the top function arguments are the only hardware ports. 
23

24
00:02:08,100 --> 00:02:14,640
After successfully synthesising the code, we can generate the corresponding RTL-IP. Now we should 
24

25
00:02:14,640 --> 00:02:19,220
instantiate the IP inside a Vivado project to generate the final FPGA bitstream.
25

26
00:02:23,830 --> 00:02:28,560
Create a new vivado project with the name of “traffic_light-vivado”.
26

27
00:02:37,840 --> 00:02:41,740
Don’t forget to choose the Basys3 board as the target FPGA platform.
27

28
00:02:46,020 --> 00:02:52,460
Create a new block design by clicking on the “Create Block Design” under IP Integrator in the Flow Navigator 
28

29
00:02:52,470 --> 00:02:52,710
view.
29

30
00:03:01,670 --> 00:03:05,600
Right-click somewhere inside the Diagram area and select the “IP setting…” option.
30

31
00:03:06,940 --> 00:03:11,920
Then select the Repository option under IP in the list of project setting options on the left.
31

32
00:03:12,160 --> 00:03:16,330
press the plus side and go to the traffic light, all do this project folder.
32

33
00:03:16,990 --> 00:03:22,040
This process makes our traffic light controller RTL-IP available to the vivado design.
33

34
00:03:22,420 --> 00:03:25,900
Now we should instantiate the controller IP. For this purpose,
34

35
00:03:26,020 --> 00:03:26,380
right-click 
35

36
00:03:26,380 --> 00:03:31,900
somewhere inside the Diagram area and select the Add  IP … option. Search for the traffic_light 
36

37
00:03:31,900 --> 00:03:34,090
IP and add that to the design.
37

38
00:03:35,830 --> 00:03:42,890
The design should have four 1-bit input ports and two 1-bit output ports.  Make all the ports external. 
38

39
00:03:43,480 --> 00:03:46,690
Then you can rename the ports to have more suitable names. 
39

40
00:04:26,960 --> 00:04:32,530
Now we should connect them to the FPGA pins. For this purpose, we need to define a set of constraints. 
40

41
00:04:33,290 --> 00:04:38,690
You can do that by pressing the right-click on the design_1 under the “Design Sources”
41

42
00:04:38,870 --> 00:04:44,470
in the Sources view and select the “Add Sources” option. 
In the “Add Sources” dialog, 
42

43
00:04:45,260 --> 00:04:52,220
make sure that the “Add or create constraints” option is selected then press next. Then create 
43

44
00:04:52,220 --> 00:04:54,500
a constraint file with the name of 
44

45
00:04:54,500 --> 00:04:55,400
traffic_light.
45

46
00:05:01,470 --> 00:05:07,800
Double click on the created file under the Constraints folder in the Source view.  Now copy the commented 
46

47
00:05:07,800 --> 00:05:14,370
constraints provided by the Board vendor and uncomment the required ones. As the design has four 1-bit 
47

48
00:05:14,370 --> 00:05:17,120
inputs and two 1-bit outputs, 
48

49
00:05:17,280 --> 00:05:23,690
we need constraints for four switches and two LEDs.  Modify the ports name in the constraints according to 
49

50
00:05:23,690 --> 00:05:24,990
the ports name in the design. 
50

51
00:06:23,870 --> 00:06:29,840
Now before generating the FPGA bitstream, First we should generate the output products and then create 
51

52
00:06:29,840 --> 00:06:30,730
the HDL wrapper. 
52

53
00:06:31,220 --> 00:06:33,790
After that, we can generate the FPGA bitstream.
53

54
00:07:07,690 --> 00:07:14,110
To program the board, connect that to your computer and turn that on. You should see the red power light 
54

55
00:07:14,110 --> 00:07:14,890
illuminates.
55

56
00:07:17,270 --> 00:07:23,560
Now in the Vivado-IDE click on the Open Hardware option under the Program and Debug in the Flow Navigator 
56

57
00:07:23,570 --> 00:07:23,840
View.
57

58
00:07:25,680 --> 00:07:31,980
Then click on the Open Target link and select the Auto Connect option. The Vivado IDE automatically detects 
58

59
00:07:31,980 --> 00:07:34,380
the board and shows that in the hardware list. 
59

60
00:07:37,170 --> 00:07:42,540
If you cannot see the board and the FPGA, check the board connected to your computer or turn on the board 
60

61
00:07:42,540 --> 00:07:43,560
if you have forgotten. 
61

62
00:07:44,700 --> 00:07:50,250
Now click on the Program device link to configure the FPGA. After programming the board successfully, 
62

63
00:07:50,250 --> 00:07:52,620
the DONE green light should illuminate. 
63

64
00:08:06,170 --> 00:08:08,210
Now we are ready to examine our controller. 
64

65
00:08:09,540 --> 00:08:15,360
Each switch corresponds to a sensor, and each led represents a traffic light.  Play with sensors and 
65

66
00:08:15,360 --> 00:08:18,660
check the lights and make sure your design responds correctly.  
66

67
00:09:10,930 --> 00:09:16,210
This lecture is the last in this section that explained the design concepts and techniques. So the 
67

68
00:09:16,210 --> 00:09:22,210
next lecture will give you a couple of hardware designs as exercises to be implemented by HLS design 
68

69
00:09:22,210 --> 00:09:22,480
flow.
69

70
00:09:24,750 --> 00:09:26,260
These are our takeaway messages.
70

71
00:09:26,550 --> 00:09:31,740
The name of ports in constraints should be exactly the same as the name of the corresponding port 
71

72
00:09:31,890 --> 00:09:32,640
in the design.
72

73
00:09:34,720 --> 00:09:40,270
In the current Vivado-HLS description of a design, only arguments in the top-function require attached 
73

74
00:09:40,270 --> 00:09:47,140
interfaces. So, the Sub-function arguments don’t need any interfaces as they won’t be synthesised into hardware 
74

75
00:09:47,140 --> 00:09:47,680
parts.
75

76
00:09:49,780 --> 00:09:50,920
Now the quiz question.
76

77
00:09:52,390 --> 00:09:59,170
Find the resource utilization of the final design in Vivado. For this purpose, in the Flow Navigator, click 
77

78
00:09:59,170 --> 00:10:04,300
on “ImplementationOpen Implemented DesignReport Utilization” 
