PACK

Pack two words into a register

PACK rd, rs1, rs2

Packs the lower halves of rs1 and rs2 into rd.

Details

Pack two words into a register: Packs the lower halves of rs1 and rs2 into rd. Operation: R[rd] = (R[rs2] << XLEN/2) | (R[rs1] & ((1 << XLEN/2)-1));.

Pseudocode Operation

R[rd] = (R[rs2] << XLEN/2) | (R[rs1] & ((1 << XLEN/2)-1));

Example

PACK t0, a0, a1

Encoding

Binary Layout
0000100
31:25
rs2
24:20
rs1
19:15
100
14:12
rd
11:7
0110011
6:0
 
Format R-Type
Opcode 0x33
Extension Zbkb

Operands

  • rd
    Destination register (integer)
  • rs1
    Lower Half
  • rs2
    Upper Half