Truth Table/Functionality
The lpm_clshift Intel® FPGA IP acts like a barrel shifter. It contains entirely combinational logic.
Overflow occurs when the shifted result exceeds the precision of the result bus. For "LOGICAL" values, overflow occurs when any 1 has been shifted out. For "ARITHMETIC" values, overflow occurs when a significant digit is shifted into or past the sign bit. Underflow occurs when the shifted result contains no significant digits.
Operation of the LOGICAL shifter is illustrated in the following example, in which LPM_WIDTH = 4:
Inputs |
Output |
||||
---|---|---|---|---|---|
direction |
distance[1..0] |
data[3..0] |
overflow |
result[3..0] |
underflow |
X |
0 |
dcba |
0 |
dcba |
0 |
0 |
1 |
dcba |
d |
cba0 |
0 |
0 |
2 |
dcba |
d # c |
ba00 |
0 |
0 |
3 |
dcba |
d # c # b |
a000 |
0 |
1 |
1 |
dcba |
0 |
0dcb |
!d & !c & !b & a |
1 |
2 |
dcba |
0 |
00dc |
!d & !c & (b # a) |
1 |
3 |
dcba |
0 |
000d |
!d & (c # b # a) |
Operation of the ARITHMETIC shifter is illustrated in the following example, in which LPM_WIDTH = 4:
Inputs |
Output |
||||
---|---|---|---|---|---|
direction |
distance[1..0] |
data[3..0] |
overflow |
result[3..0] |
underflow |
X |
0 |
dcba |
0 |
dcba |
0 |
0 |
1 |
0cba |
c |
cba0 |
0 |
0 |
1 |
1cba |
!c |
cba0 |
0 |
0 |
2 |
0cba |
c # b |
ba00 |
0 |
0 |
2 |
1cba |
c! # b! |
ba00 |
0 |
0 |
3 |
0cba |
c # b # a |
a000 |
0 |
0 |
3 |
1cba |
!c # !b # !a |
a000 |
0 |
1 |
1 |
0cba |
0 |
00cb |
!c & !b & a |
1 |
1 |
1cba |
0 |
11cb |
c & b & !a |
1 |
2 |
0cba |
0 |
000c |
!c & (b # a) |
1 |
2 |
1cba |
0 |
111c |
c & (!b # !a) |
1 |
3 |
0cba |
0 |
0000 |
(c # b # a) |
1 |
3 |
1cba |
0 |
1111 |
(!c # !b # !a) |
Operation of the ROTATE shifter is illustrated in the following example, in which LPM_WIDTH = 4:
Inputs |
Output |
||
---|---|---|---|
direction |
distance[1..0] |
data[3..0] |
result[3..0] |
X |
0 |
dcba |
dcba |
0 |
1 |
dcba |
cbad |
0 |
2 |
dcba |
badc |
0 |
3 |
dcba |
adcb |
1 |
1 |
dcba |
adcb |
1 |
2 |
dcba |
badc |
1 |
3 |
dcba |
cbad |