Shifting and moving bits in place are the common operators in hardware design. In this lecture, 1
I will explain how to describe these operations in Vivado-HLS. 2
The builtin shift operators in C/C++ are overloaded to be used for the HLS arbitrary-precision 3
data types. There are two bitwise shift operators: 4
Right shift (>>), 5
Left shift (<<). 6
There are two versions of each shift operator: unsigned and signed. A negative value applied to the 7
RHS of the signed version reverses the shift direction. 8
These are four examples of different shift operators. 9
The first one is a 3-bit positive shift right. The second one is a 3-bit negative shift 10
right which is equal to 3-bit shift left. 11
The third one is a 3-bit positive shift left. And the last one is a 3-bit negative shift left 12
which is equal to 3-bit shift right. 13
Vivado HLS provides two member functions to perform rotate operations on arbitrary-precision 14
data types. The rrotate member function performs the rotate right. And the lrotate member function 15
performs the rotate left 16
This lecture is the last in this section that explained the design concepts and techniques. So the 17
next lecture will give you a couple of hardware designs as exercises through which you review and master 18
the proposed techniques in this section. 19
These are our takeaway messages. 20
Vivado-HLS has overloaded the native C/C++ shift operators. 21
Rotate operations are provided through member functions. 22
Now the quiz question. Find the values of r1, r2 and r3 after running this code snippet in 23
Vivado-HLS.