pub enum Rv32ZkneInstruction<Reg> {
Aes32Esi {
rd: Reg,
rs1: Reg,
rs2: Reg,
bs: Rv32AesBs,
},
Aes32Esmi {
rd: Reg,
rs1: Reg,
rs2: Reg,
bs: Rv32AesBs,
},
}Expand description
RISC-V RV32 Zkne instructions (AES encryption)
Variants§
Aes32Esi
AES final round encryption step: SubBytes on one byte of rs2, rotated to the byte lane selected by bs, XOR’d into rs1.
rd = rs1 ^ rol32(SBOX[(rs2 >> (bs*8)) & 0xff] as u32, bs*8)
Aes32Esmi
AES middle round encryption step: SubBytes + partial MixColumns on one byte of rs2, rotated to the byte lane selected by bs, XOR’d into rs1.
rd = rs1 ^ rol32(MixColByte(SBOX[(rs2 >> (bs*8)) & 0xff]), bs*8)
Trait Implementations§
Source§impl<Reg: Clone> Clone for Rv32ZkneInstruction<Reg>
impl<Reg: Clone> Clone for Rv32ZkneInstruction<Reg>
Source§fn clone(&self) -> Rv32ZkneInstruction<Reg>
fn clone(&self) -> Rv32ZkneInstruction<Reg>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<Reg: Debug> Debug for Rv32ZkneInstruction<Reg>
impl<Reg: Debug> Debug for Rv32ZkneInstruction<Reg>
Source§impl<Reg> Display for Rv32ZkneInstruction<Reg>where
Reg: Display,
impl<Reg> Display for Rv32ZkneInstruction<Reg>where
Reg: Display,
§impl<Reg> Instruction for Rv32ZkneInstruction<Reg>
Encoding layout (R-type, opcode 0x33, funct3 0x0):
impl<Reg> Instruction for Rv32ZkneInstruction<Reg>
Encoding layout (R-type, opcode 0x33, funct3 0x0):
[31:30] bs - 2-bit byte select
[29:25] funct5 - 0b10001 (aes32esi) / 0b10011 (aes32esmi)
[24:20] rs2
[19:15] rs1
[14:12] funct3 - 0b000
[11:7] rd
[6:0] opcode - 0b0110011 (OP)Ratified match/mask values (from riscv-opcodes): MATCH_AES32ESI = 0x22000033, MASK_AES32ESI = 0x3e00707f MATCH_AES32ESMI = 0x26000033, MASK_AES32ESMI = 0x3e00707f
rd and rs1 are independent fields. The assembler convention places
the accumulator in both rd and rs1 (the rt pattern), but the hardware
does not require rd == rs1 and the decoder must not enforce it.