bsli - 2024.2 English

MicroBlaze Processor Reference Guide (UG984)

Document ID
UG984
Release Date
2024-11-27
Version
2024.2 English
Figure 1. bsli

Description

The first three instructions shift the contents of register rAL by the amount specified by IMM and put the result in register rDL.

Barrel Shift Extract Field extracts a bit field from register rAL and puts the result in register rDL. The bit field width is specified by IMMW and the shift amount is specified by IMMS. The bit field width must be in the range 1 - 63, and the condition IMMW + IMMS ≤ 64 must apply.

Barrel Shift Insert Field inserts a bit field from register rAL into register rDL, modifying the existing value in register rDL. The bit field width is defined by IMMW - IMMS + 1, and the shift amount is specified by IMMS. The condition IMMW ≥ IMMS must apply.

The mnemonic bsllli sets the S bit (Side bit). If the S bit is set, the barrel shift is done to the left. The mnemonics bslrli and bslrai clear the S bit and the shift is done to the right.

The mnemonic bslrai sets the T bit (Type bit). If the T bit is set, the barrel shift performed is Arithmetical. The mnemonics bslrli and bsllli clear the T bit and the shift performed is Logical.

The mnemonic bslefi sets the E bit (Extract bit). In this case the S and T bits are not used.

The mnemonic bslifi sets the I bit (Insert bit). In this case the S and T bits are not used.

Pseudocode

if E = 1 then
   (rDL)[0:63-IMMW] ← 0
   (rDL)[64-IMMW:63] ← (rAL) >> IMMS
else if I = 1 then
   mask ← (0xffffffffffffffff << (IMMW + 1)) ⊕ (0xffffffffffffffff << IMMS)
   (rDL) ← ((rAL) << IMMS) ˄ mask) ˅ ((rDL) ˄ mask)
else if S = 1 then
   (rDL) ← (rAL) << IMM
else if T = 1 then
   if IMM ≠ 0 then
      (rDL)[0:IMM-1] ← (rAL)[0]
      (rDL)[IMM:31] ← (rAL) >> IMM
   else
      (rDL) ← (rAL)
else
   (rDL) ← (rAL) >> IMM

Registers Altered

  • rDL

Latency

  • 1 cycle with C_AREA_OPTIMIZED=0 or 2
  • 2 cycles with C_AREA_OPTIMIZED=1

Notes

  • These are not Type B Instructions. There is no effect from a preceding imm or imml instruction.
  • These instructions are optional. To use them, MicroBlaze has to be configured to use barrel shift instructions (C_USE_BARREL=1).
  • The assembler code “bslifi rD, rA, width, shift” denotes the actual bit field width, not the IMMW field, which is computed by IMMW = shift + width - 1.