vhdl_reference_93:shift_operators

Shift Operators

The Shift Operators are defined for any one-dimensional arrays with elements of type BIT or BOOLEAN .

The operators are defined as follows, where L is the left operand and R the right operand:

  • L sll R : Shift L logically left (R≥0) respective right (R<0) by R index positions. The foremost (R≥0) respective the last (R<0) elements drop out and T'LEFT is inserted. T is the type of the elements of the array.
  • L srl R : Shift L logically right (R≥0) respective left (R<0) by R index positions. The last (R≥0) respective the foremost (R<0) elements drop out and T'LEFT is inserted. T is the type of the elements of the array.
  • L sla R : Shift L arithmetically left (R≥0) respective right (R<0) by R index positions. The foremost (R≥0) respective the last (R<0) elements drop out and L'RIGHT (R≥0) respective L'LEFT (R<0) is inserted. It is the last (R≥0) respective the foremost (R<0) value of L is inserted.
  • L sra R : Shift L arithmetically right (R≥0) respective left (R<0) by R index positions. The last (R≥0) respective the foremost (R<0) elements drop out and L'LEFT (R≥0) respective L'RIGHT (R<0) is inserted. It is the foremost (R≥0) respective the last (R<0) value of L is inserted.
  • L rol R : Rotate L logically left (R≥0) respective right (R<0) by R index positions. The foremost (R≥0) respective the last (R<0) values are inserted in the front (R≥0) respective behind (R<0).
  • L ror R : Rotate L logically right (R≥0) respective left (R<0) by R index positions. The last (R≥0) respective the foremost (R<0) values are inserted behind (R≥0) respective in the front (R<0).
Operator Operation Type of the left operand Type of the right operand result type
sll Shift Left Logical Any one-dimensional array type with elements of the type BIT or BOOLEAN INTEGER Type of the left operand
srl Shift Right Logical Any one-dimensional array type with elements of the type BIT or BOOLEAN INTEGER Type of the left operand
sla Shift Left Arithmetic Any one-dimensional array type with elements of the type BIT or BOOLEAN INTEGER Type of the left operand
sra Shift Right Arithmetic Any one-dimensional array type with elements of the type BIT or BOOLEAN INTEGER Type of the left operand
rol Rotate Left Logical Any one-dimensional array type with elements of the type BIT or BOOLEAN INTEGER Type of the left operand
ror Rotate Right Logical Any one-dimensional array type with elements of the type BIT or BOOLEAN INTEGER Type of the left operand