Bitwise logical operators apply logical operations on a set of bits denoted by an arbitrary precision 1
data. 2
The goal of this lecture is to introduce these operators. 3
Bitwise logical operators all return a value with a width 4
that is the maximum of the widths of the two operands. They are treated as unsigned if and only if both 5
operands are unsigned. 6
Otherwise, it is of a signed type. 7
Sign-extension (or zero-padding) may occur, based on the signedness of the expression, not the destination 8
variable. 9
The main bitwise logical operators are bitwise OR, AND, XOR, and Inverse. 10
If we assume, the two a and b variables and c represents their bitwise OR then the value of the c is 11
as shown in this figure. 12
Reduced functions apply a given operator to all bits of an arbitrary precision value and return a one-bit 13
result. 14
These functions include : 15
AND reduce, OR reduce, XOR reduce, NAND reduce, NOR reduce, and XNOR reduce. 16
If we assume the 7-bit variable a contains the value of 0101111, then its 17
reduced XOR would be 1. 18
The bit reverse member function is another bit manipulation operator in Vivado HLS that reveres the bits’ positions 19
of its object value. 20
For example, if the 7-bit variable a holds 0101111. Then after calling the 21
reverse function, its value would be 1111010. 22
The three-member-functions, test, set, and clear work on a single bit. The test member function checks 23
whether a specified bit is 1 or 0, and returns true if Yes and false if No. 24
The set(i, v) sets the specified bit denoted by I to v. 25
The set(i) sets the specified bit denoted by i to 1. The clear(i) sets the specified bit denoted by i to 26
0. 27
Bit Shif and rotate operators are other groups of operations used in hardware design. The next lecture 28
addresses these concepts. 29
These are our takeaway messages. The bitwise logical operators all return a value with a width that 30
is the maximum of the widths of the two operands. Reduced functions apply a given operator to all bits 31
of an arbitrary precision value and return a one-bit result. 32
The bit-reverse member function reveres the bit position of its object value. 33
Now the quiz question. What is the output of this code snippet running by Vivado-HLS in C-Simulation mode?