0
1
00:00:01,220 --> 00:00:07,400
Using arbitrary bit-width signals, buses, and data is essential in a hardware design environment. 
1

2
00:00:07,460 --> 00:00:13,520
How does an HLS approach support arbitrary-length data and their required operations?
2

3
00:00:14,030 --> 00:00:17,430
Answering this question is the main motivation behind this lecture. 
3

4
00:00:19,680 --> 00:00:27,150
Hardware circuits usually use accurate bit-width data that is required by design. For example, hardware
4

5
00:00:27,150 --> 00:00:34,230
modules may communicate through different bit-width buses and signals. Alternatively, instruction codes in a CPU
5

6
00:00:34,350 --> 00:00:39,220
usually come in different formats and shapes that may have various 
6

7
00:00:39,240 --> 00:00:40,820
bit-width fields. Decoding 
7

8
00:00:40,830 --> 00:00:47,610
each field requires its own digital circuit with an arbitrary bit-width data type. Or analogue-to-digital 
8

9
00:00:47,610 --> 00:00:51,740
converters commonly provide a variety of bit-width accuracy.
9

10
00:00:52,780 --> 00:01:02,430
The native C data types only come with 1, 8, 16, 32, and 64-bit widths. If a design requires a 19-bit
10

11
00:01:02,440 --> 00:01:03,220
multiplier, 
11

12
00:01:03,400 --> 00:01:10,180
we should not be forced to implement this with a 32-bit multiplier as the resulted design may not be 
12

13
00:01:10,180 --> 00:01:10,830
efficient.
13

14
00:01:11,110 --> 00:01:19,390
On the other hand, if a hardware design uses data values or buses with more than 64 bits (such as 
14

15
00:01:19,390 --> 00:01:26,110
534 bits), then its implementation is not possible using the native C data types.
15

16
00:01:27,650 --> 00:01:33,590
Therefore, to implement optimum hardware, we should be able to define and use bit-accurate data types
16

17
00:01:33,620 --> 00:01:39,820
with an arbitrary size. Vivado HLS provides an arbitrary precision data type library. 
17

18
00:01:40,340 --> 00:01:46,160
This library supports arbitrary precision data type for both simulation and synthesis.
18

19
00:01:46,400 --> 00:01:51,680
This library comes in two flavours: one for C and the other for C++. 
19

20
00:01:51,980 --> 00:01:56,690
In this course, I will talk only about the C++ version of this library.
20

21
00:01:58,140 --> 00:02:04,890
This library supports integer precision and fixed-point precision data types. In this section, we focus 
21

22
00:02:04,890 --> 00:02:12,390
on integer precision data types. The arbitrary precision integer data type in C++ is a template class 
22

23
00:02:12,540 --> 00:02:15,690
that accepts one parameter that defines the data bit-width. 
23

24
00:02:16,110 --> 00:02:23,220
In order to use this library, first, we should include the ap_int.h header file in our 
24

25
00:02:23,220 --> 00:02:23,940
design source file. 
25

26
00:02:23,940 --> 00:02:30,420
They are two separate signed and unsigned classes. signed, and unsigned. This is an example of how to include the 
26

27
00:02:30,420 --> 00:02:36,780
header file and define a 5 bit  signed integer variable and an 11-bit unsigned integer variable
27

28
00:02:38,710 --> 00:02:47,950
The ap_int and ap_uint templates provide all: arithmetic, bitwise, logical, and relational operators.
28

29
00:02:49,330 --> 00:02:55,960
In addition, these classes provide methods to handle some useful hardware operations, such as allowing 
29

30
00:02:55,960 --> 00:03:01,120
initialisation and conversion of variables of widths greater than 64 bits. 
30

31
00:03:02,820 --> 00:03:08,520
This library supports arbitrary bit-widths from 1 up to 1024 bits.
31

32
00:03:09,270 --> 00:03:11,370
This is the default maximum width allowed. 
32

33
00:03:11,820 --> 00:03:14,970
You can override this default by defining the macro 
33

34
00:03:15,000 --> 00:03:22,620
AP_INT_MAX_W with a positive integer value less than or equal to 
34

35
00:03:22,800 --> 00:03:29,210
32768 before inclusion of the ap_int.h header file.
35

36
00:03:29,970 --> 00:03:32,430
This is an example of how to define this macro.
36

37
00:03:38,540 --> 00:03:44,540
After declaring a variable, we should initialise or assign a value or variable to that. The next lecture
37

38
00:03:44,640 --> 00:03:46,000
explains how to do that.
38

39
00:03:48,750 --> 00:03:50,270
These are the takeaway messages.
39

40
00:03:51,740 --> 00:03:57,200
To implement optimum hardware, we should be able to define and use bit-accurate data types with 
40

41
00:03:57,200 --> 00:03:58,370
an arbitrary size.
41

42
00:03:59,470 --> 00:04:05,770
The arbitrary-precision library in HLS supports integer precision and fixed-point precision data types.
42

43
00:04:06,550 --> 00:04:11,080
The associated classes provide methods to handle some useful hardware operations. 
43

44
00:04:13,030 --> 00:04:19,930
Now the quiz question. What is the maximum default bit-width of an arbitrary-precision integer data type in 
44

45
00:04:19,940 --> 00:04:20,640
Vivado-HLS?
