c.slli

Shift left logical immediate

This instruction is defined by:

  • anyOf:

    • C, version >= 0

    • Zca, version >= 0

This instruction is included in the following profiles:

Encoding

svg

Assembly format

c.slli rd, shamt

Synopsis

Shift the value in rd left by shamt, and store the result back in rd. C.SLLI expands into slli rd, rd, shamt.

Access

M HS U VS VU

Always

Always

Always

Always

Always

Decode Variables

Bits<6> shamt = {$encoding[12], $encoding[6:2]};
Bits<5> rd = $encoding[11:7];

Execution

  • IDL

  • Sail

X[rd] = X[rd] << shamt;
{
  let rd_val = X(rd);
  /* the decoder guard should ensure that shamt[5] = 0 for RV32 */
  let result : xlenbits = match op {
    RISCV_SLLI => if   sizeof(xlen) == 32
                  then rd_val << shamt[4..0]
                  else rd_val << shamt,
    RISCV_SRLI => if   sizeof(xlen) == 32
                  then rd_val >> shamt[4..0]
                  else rd_val >> shamt,
    RISCV_SRAI => if   sizeof(xlen) == 32
                  then shift_right_arith32(rd_val, shamt[4..0])
                  else shift_right_arith64(rd_val, shamt)
  };
  X(rd) = result;
  RETIRE_SUCCESS
}