Skip to content

Latest commit

 

History

History
98 lines (56 loc) · 2.54 KB

RISCV_Instructions_RVZbc.rst

File metadata and controls

98 lines (56 loc) · 2.54 KB

Applicability of this chapter to configurations:

Configuration Implementation
CV32A60AX Implemented extension
CV32A60X Implemented extension

RVZbc: Carry-less multiplication

Carry-less multiplication is the multiplication in the polynomial ring over GF(2).

clmul produces the lower half of the carry-less product and clmulh produces the upper half of the 2✕XLEN carry-less product.

clmulr produces bits 2✕XLEN−2:XLEN-1 of the 2✕XLEN carry-less product.

The following instructions (and pseudoinstructions) comprise the Zbc extension:

RV32 RV64 Mnemonic
clmul rd, rs1, rs2
clmulh rd, rs1, rs2
clmulr rd, rs1, rs2

RV32 and RV64 Instructions

  • CLMUL: Carry-less multiply (low-part)

    Format: clmul rd, rs1, rs2

    Description: clmul produces the lower half of the 2.XLEN carry-less product.

    Pseudocode: foreach (i from 1 to xlen by 1) { output = if ((rs2 >> i) & 1) then output ^ (rs1 << i); else output; }

    Invalid values: NONE

    Exception raised: NONE

  • CLMULH: Carry-less multiply (high-part)

    Format: clmulh rd, rs1, rs2

    Description: clmulh produces the upper half of the 2.XLEN carry-less product.

    Pseudocode: foreach (i from 1 to xlen by 1) { output = if ((rs2_val >> i) & 1) then output ^ (rs1_val >> (xlen - i)) else output }

    Invalid values: NONE

    Exception raised: NONE

  • CLMULR: Carry-less multiply (reversed)

    Format: clmulr rd, rs1, rs2

    Description: clmulr produces bits 2.XLEN-2:XLEN-1 of the 2.XLEN carry-less product.

    Pseudocode: foreach (i from 0 to (xlen - 1) by 1) { output = if ((rs2_val >> i) & 1) then output ^ (rs1_val >> (xlen - i - 1)) else output}

    Invalid values: NONE

    Exception raised: NONE