4.2.9 LPM_CLSHIFT

 

Copyright © 1998 University of Manchester

Combinatorial Logic shifter. Barrel Shifter.

Ports
Port Name
Type
Usage
DescriptionComments
Data
I
Required
Data to be shifted. Vector, LPM_Width wide
Distance
I
Required
Number of positions to shift Data. Vector, LPM_WidthDist wide
Direction
I
Optional
Direction of shift.

Low = Left (toward MSB)

High = Right (toward LSB)

Default value is 0 (Low) = Left (toward the MSB)
Result
O
Required
Shifted Data Vector, LPM_Width wide
Overflow
O
Optional
Logical or Arithmetic Overflow Note 1
Underflow
O
Optional
Logical or Arithmetic Underflow Note 1

Note 1: If the LPM_ShiftType is ROTATE and Overflow or Underflow are connected, the output of those ports will be undefined.

Properties
Property
Usage
ValueComments
LPM_Width
Required
LPM Value > 0Width of input vector
LPM_WidthDist
Optional
LPM Value > 0Width of the Distance Port Note 1
LPM_ShiftType
Optional
LOGICAL | ROTATE |

ARITHMETIC

Default is LOGICAL

Note 2

Note 1: LPM_WidthDist specifies the width of the Distance port. The values on the Distance port would normally range from 0 which would mean "no shift" to (LPM_Width-1) which would be the maximum meaningful shift. The typical value assigned to LPM_WidthDist would be "the smallest integer not less than log2(LPM_Width)" or log2LPM_Width. Any value on the Distance port greater than LPM_Width-1 results in an UNDEFINED output.

Note 2: The sign bit is extended for ARITHMETIC. For a LOGICAL right shift 0's are always shifted into the MSB.

Functions
The LPM_CLSHIFT module acts like a barrel-shifter. It is entirely combinational logic.

Overflow occurs when the shifted result exceeds the precision of the Result bus. For LOGICAL values, overflow occurs when all ones have been shifted out. For ARITHMETIC value, overflow occurs a significant digit is shifted into or past the sign bit.

Underflow occurs when the shifted result contains no significant digits.
LPM_ShiftType
Direction
Function
LOGICAL
0 = Left
Result = Data << Distance
LOGICAL
1 = Right
Result = Data >> Distance
ROTATE
0 = Left
Resulti = Datax where x is ((Distance + i ) mod LPM_Width)
ROTATE
1 = Right
Resulti = Datax where x is ((Distance - i ) mod LPM_Width)
ARITHMETIC
0 = Left
Result = DATA * 2LPM_Distance
ARITHMETIC
1 = Right
Result = DATA 2LPM_Distance (integer divide)

Values larger than (LPM_Width - 1) result in an UNDEFINED output.