0
1
00:00:01,540 --> 00:00:07,450
In this video, I will show you how to use the Xilinx Vivado–HLS toolset to implement the simple
1

2
00:00:07,460 --> 00:00:10,240
LED controller explained in the previous lectures.
2

3
00:00:11,460 --> 00:00:16,260
Here, I'll walk you through the basic steps of developing a hardware design with Vivado-HLS.
3

4
00:00:17,100 --> 00:00:23,010
Therefore, by the end of this lecture, you will practically learn how to use Vivado-HLS to describe 
4

5
00:00:23,010 --> 00:00:25,110
a hardware module in C/C++.
5

6
00:00:26,840 --> 00:00:35,300
These are the steps that we are going to follow
In Vivado-HLS, we Create a project,  Add a source file, Perform 
6

7
00:00:35,300 --> 00:00:38,420
High-Level Synthesis, Generate IP.
7

8
00:00:41,020 --> 00:00:47,800
Let's get started. First, run the Vivado-HLS IDE which can be done by double-clicking on the related 
8

9
00:00:47,800 --> 00:00:53,620
icon on your desktop or click on the program link in the "Start Menu" in Windows OS. 
9

10
00:00:55,190 --> 00:01:01,250
If you are using a Linux based system, run vivado_hls command to start the Vivado-HLS IDE.
10

11
00:01:03,040 --> 00:01:09,430
After starting the Vivado-HLS, it shows you the welcome screen where you can see the options to create 
11

12
00:01:09,610 --> 00:01:15,850
or open a project. If you don't see the welcome screen for any possible reason, you can open that
12

13
00:01:15,860 --> 00:01:18,690
by going to Help menu and select the Welcome… option.
13

14
00:01:19,330 --> 00:01:23,520
You can also find your previous projects in the "Resent Projects" area. 
14

15
00:01:24,460 --> 00:01:27,700
If this is the first time you run the vivado-hls, the welcome
15

16
00:01:27,700 --> 00:01:29,380
screen doesn't show this part.
16

17
00:01:29,890 --> 00:01:34,000
A few links to the related documents are also shown in the welcome screen.
17

18
00:01:38,750 --> 00:01:42,710
Here, we start by creating a new project. For this purpose, 
18

19
00:01:42,890 --> 00:01:50,060
click on the "Create a New Project" icon. Then the create new project wizard starts. The first step
19

20
00:01:50,060 --> 00:01:54,200
asks you to choose a name for the project and modify the project location.
20

21
00:01:55,340 --> 00:02:00,830
The name of the project will also be the name of the folder that contains the entire project files.
21

22
00:02:14,930 --> 00:02:19,480
The next step asks you to add design files if they already exist.
22

23
00:02:20,530 --> 00:02:26,260
This page also asks you the name of the "top function" which would be the name of the hardware module
23

24
00:02:26,260 --> 00:02:27,190
entry function. 
24

25
00:02:29,120 --> 00:02:33,020
Notice that each hardware module can only have one top function.
25

26
00:02:33,680 --> 00:02:39,770
All other functions in the design should be called through this top function using a possible hierarchy 
26

27
00:02:39,770 --> 00:02:40,970
of function calls.
27

28
00:02:41,360 --> 00:02:48,080
If you don't know the top-function name or you haven't prepared the design files, just click next, as 
28

29
00:02:48,080 --> 00:02:49,040
we can define that later.
29

30
00:02:50,120 --> 00:02:52,420
The next step asks you to add the testbench files. 
30

31
00:02:53,540 --> 00:03:00,560
As for the sake of simplicity we don’t have the testbench file in this first lab, click next to get to 
31

32
00:03:00,560 --> 00:03:02,150
the "Solution Configuration" page. 
32

33
00:03:02,450 --> 00:03:07,390
In this page, you can configure the design clock and define the target FPGA. 
33

34
00:03:07,820 --> 00:03:14,000
Here you can choose a solution name which would be the name of the subfolder inside the project folder 
34

35
00:03:14,000 --> 00:03:16,640
that keeps all the files generated by the HLS flow.
35

36
00:03:16,640 --> 00:03:22,880
As we only consider the combinational circuits in this section of the course, you can ignore the 
36

37
00:03:22,880 --> 00:03:25,160
clock-related parameters in this page.
37

38
00:03:25,730 --> 00:03:27,920
Choosing the target FPGA is necessary. 
38

39
00:03:28,280 --> 00:03:30,380
Click on the ellipsis icon. 
39

40
00:03:30,380 --> 00:03:33,680
Here you can select a specific FPGA or a particular board. 
40

41
00:03:34,460 --> 00:03:41,630
Click on the board, from the vendor menu, choose the digilentinc.com and find the Basys3 in 
41

42
00:03:41,630 --> 00:03:44,470
the list of boards. Pressing the Finish button opens 
42

43
00:03:44,480 --> 00:03:50,690
the Vivado-HLS graphical User interface or GUI. The Vivado-HLS GUI consists of four panes 
43

44
00:03:50,690 --> 00:03:51,350
as default.
44

45
00:03:51,860 --> 00:03:53,810
We will explain them as we use them.
45

46
00:03:54,350 --> 00:03:57,620
We start with the project explorer view on the left. 
46

47
00:03:58,370 --> 00:04:03,590
If you cannot see this pane, go to Window menu and select 
Window->Show View->Explorer
47

48
00:04:03,750 --> 00:04:06,410
In the Explorer view, 
48

49
00:04:06,530 --> 00:04:10,040
you can see the list of objects associated with our project. 
49

50
00:04:10,550 --> 00:04:13,790
It contains, the default included hearer files, 
50

51
00:04:14,750 --> 00:04:22,520
source folder which is empty at this point, Test bench folder which is also empty, and the Solution
51

52
00:04:22,520 --> 00:04:29,450
directory Which only contains the constraints files at this step. We'll explain that later. To add a design 
52

53
00:04:29,450 --> 00:04:29,810
file
53

54
00:04:29,930 --> 00:04:30,320
right 
54

55
00:04:30,320 --> 00:04:37,050
click on the source folder and select the "New file …" option. Choose a file name, for example, "basic_output.cpp"
55

56
00:04:37,050 --> 00:04:40,190
And press the Save button.
56

57
00:04:41,420 --> 00:04:48,800
A proper editor opens the file which is empty at this stage.
Start and add the basic_output C function. The
57

58
00:04:48,800 --> 00:04:53,310
function has an output argument, so it should be defined as a pointer. 
58

59
00:04:53,420 --> 00:04:56,730
We are using the 8-bit unsigned char as its data type. 
59

60
00:04:59,920 --> 00:05:06,460
The function body has just one line which put the constant binary value of 11110000 
60

61
00:05:06,460 --> 00:05:08,590
to the output argument.
61

62
00:05:09,160 --> 00:05:13,570
Now, we should add HLS pragmas for the output port and function block.
62

63
00:05:14,110 --> 00:05:16,500
There are two ways to add pragmas to the code
63

64
00:05:17,420 --> 00:05:21,330
The first is adding manually to the source code
64

65
00:05:21,650 --> 00:05:26,990
The second approach is using the Directive view on the right-hand side pane.
65

66
00:05:27,680 --> 00:05:34,140
If you cannot see this View, select Window->Show View->Directives from the menu bar.
66

67
00:05:34,490 --> 00:05:40,670
There are two groups of pragmas.  The top-level function pragma which adds some control signals to the 
67

68
00:05:40,820 --> 00:05:42,170
synthesised hardware
68

69
00:05:43,270 --> 00:05:49,570
And the port-related pragmas. As our design is a simple combinational circuit, these two groups 
69

70
00:05:49,570 --> 00:05:55,630
of pragmas do not define a specific interface. To add the function level pragma, right-click 
70

71
00:05:55,630 --> 00:05:57,640
on the function name in the Directive View. 
71

72
00:05:57,640 --> 00:06:02,020
Then select "Insert Directive" from the drop-down menu. 
72

73
00:06:06,160 --> 00:06:14,200
Then select the INTERFACE directive. In the options part, choose ap_ctrl_none as the mode.Choose
73

74
00:06:14,200 --> 00:06:21,940
the source file in the destination section. Then press the OK button. A new pragma should be added to 
74

75
00:06:21,940 --> 00:06:25,330
the source file under the function definition. Then right-click 
75

76
00:06:25,330 --> 00:06:30,370
on the argument name in the Directive view and select the "Insert Directive…" option.
76

77
00:06:30,850 --> 00:06:32,980
Then select the INTERFACE directive, 
77

78
00:06:34,190 --> 00:06:41,870
In the options part, choose ap_none as the mode. Make sure that the "Source File" is selected as the Destination.
78

79
00:06:42,170 --> 00:06:46,910
Then press the OK button. Another pragma should be added to the source file.
79

80
00:06:47,340 --> 00:06:48,980
Now you can save the file.
80

81
00:06:50,290 --> 00:06:56,680
After saving the file, we are ready for performing the synthesis. Click on the synthesis icon.
81

82
00:06:58,450 --> 00:07:02,260
You can follow the report messages in the Console view in the lower pane. 
82

83
00:07:03,140 --> 00:07:05,120
It takes a couple of seconds to finish.
83

84
00:07:12,960 --> 00:07:18,510
At the end of the synthesis report, you can see a summary of the hardware interfaces which should 
84

85
00:07:18,510 --> 00:07:25,980
contain only one port with ap_none protocol. After synthesis, we can wrap up our design into a package 
85

86
00:07:25,980 --> 00:07:30,300
by pressing on the "Export RTL" icon on the toolbar. 
86

87
00:07:30,720 --> 00:07:33,300
The Export RTL page is opened. 
87

88
00:07:34,110 --> 00:07:37,350
Accept the default values and click on the OK button.
88

89
00:07:37,980 --> 00:07:41,640
The RTL package or IP will be generated after a couple of seconds.
89

90
00:07:41,940 --> 00:07:47,150
Now we are ready to use this IP in the Vivado IDE to generate the final bitstream.
90

91
00:07:58,610 --> 00:08:03,830
Now that we have transformed our HLS design into an RTL IP, the question is
91

92
00:08:05,570 --> 00:08:12,110
How can we integrate the IP into the final design to program our target FPGA? The next lecture will
92

93
00:08:12,200 --> 00:08:13,130
cope with this question.
93

94
00:08:15,480 --> 00:08:17,460
The takeaway message from this lecture is
94

95
00:08:18,580 --> 00:08:25,780
Main tasks for developing a design in Vivado-HLS are Creating a project, Writing the design functionality 
95

96
00:08:25,780 --> 00:08:31,420
in C/C++, Synthesising the design,  Generating the corresponding RTL IP.
96

97
00:08:34,100 --> 00:08:40,280
Now the quiz question
Use the following C function as the LED controller that returns the LED values, 
97

98
00:08:40,820 --> 00:08:43,580
then generate the corresponding IP using the Vivado-HLS.
