sh1add
Shift left by 1 and add
This instruction is defined by:
-
Zba, version >= Zba@1.0.0
This instruction is included in the following profiles:
-
RVA22S64 (Mandatory)
-
RVA22U64 (Mandatory)
-
RVA23M64 (Mandatory)
-
RVA23S64 (Mandatory)
-
RVA23U64 (Mandatory)
-
RVB23M64 (Mandatory)
-
RVB23S64 (Mandatory)
-
RVB23U64 (Mandatory)
Decode Variables
Bits<5> rs2 = $encoding[24:20];
Bits<5> rs1 = $encoding[19:15];
Bits<5> rd = $encoding[11:7];
Execution
-
IDL
-
Sail
if (%%LINK%func;implemented?;implemented?%%(ExtensionName::B) && (%%LINK%csr_field;misa.B;CSR[misa].B%% == 1'b0)) {
%%LINK%func;raise;raise%%(ExceptionCode::IllegalInstruction, %%LINK%func;mode;mode%%(), $encoding);
}
X[rd] = X[rs2] + (X[rs1] << 1);
{
let rs1_val = X(rs1);
let rs2_val = X(rs2);
let shamt : bits(2) = match op {
RISCV_SH1ADD => 0b01,
RISCV_SH2ADD => 0b10,
RISCV_SH3ADD => 0b11
};
let result : xlenbits = (rs1_val << shamt) + rs2_val;
X(rd) = result;
RETIRE_SUCCESS
}