|
4.2.9 LPM_CLSHIFT |
Copyright © 1998 University of Manchester |
Combinatorial Logic shifter. Barrel Shifter.
Ports
Description | Comments | |||
Data to be shifted. | Vector, LPM_Width wide | |||
Number of positions to shift Data. | Vector, LPM_WidthDist wide | |||
Direction of shift.
Low = Left (toward MSB) High = Right (toward LSB) | Default value is 0 (Low) = Left (toward the MSB) | |||
Shifted Data | Vector, LPM_Width wide | |||
Logical or Arithmetic Overflow | Note 1 | |||
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
Value | Comments | ||
LPM Value > 0 | Width of input vector | ||
LPM Value > 0 | Width of the Distance Port Note 1 | ||
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 | Function | |
LOGICAL | Result = Data << Distance | |
LOGICAL | Result = Data >> Distance | |
ROTATE | Resulti = Datax where x is ((Distance + i ) mod LPM_Width) | |
ROTATE | Resulti = Datax where x is ((Distance - i ) mod LPM_Width) | |
ARITHMETIC | Result = DATA * 2LPM_Distance | |
ARITHMETIC | Result = DATA 2LPM_Distance (integer divide) |
Values larger than (LPM_Width - 1) result in an UNDEFINED output.