SM4ED

SM4 Encryption/Decryption

SM4ED rd, rs1, rs2, bs

Accelerates the SM4 block cipher (encryption/decryption round).

Details

SM4ED performs one round of the SM4 block cipher encryption/decryption by applying the S-box and linear transformation to four bytes from rs2, XORing with rs1, and accumulating into rd.

Pseudocode Operation

rd = SM4_Round(rs1, rs2, bs);

Example

SM4ED t0, a0, a1, bs

Encoding

Binary Layout
bs
31:30
11000
29:25
rs2
24:20
rs1
19:15
000
14:12
rd
11:7
0110011
6:0
 
Format R-Type
Opcode 0x30000033
Extension Zksh

Operands

  • rd
    Destination register (integer)
  • rs1
    Source register 1 (integer)
  • rs2
    Source register 2 (integer)
  • bs
    Byte Select