Skip to main content

Rv32ZknhInstruction

Enum Rv32ZknhInstruction 

Source
pub enum Rv32ZknhInstruction<Reg> {
    Sha256Sig0 {
        rd: Reg,
        rs1: Reg,
    },
    Sha256Sig1 {
        rd: Reg,
        rs1: Reg,
    },
    Sha256Sum0 {
        rd: Reg,
        rs1: Reg,
    },
    Sha256Sum1 {
        rd: Reg,
        rs1: Reg,
    },
    Sha512Sig0h {
        rd: Reg,
        rs1: Reg,
        rs2: Reg,
    },
    Sha512Sig0l {
        rd: Reg,
        rs1: Reg,
        rs2: Reg,
    },
    Sha512Sig1h {
        rd: Reg,
        rs1: Reg,
        rs2: Reg,
    },
    Sha512Sig1l {
        rd: Reg,
        rs1: Reg,
        rs2: Reg,
    },
    Sha512Sum0r {
        rd: Reg,
        rs1: Reg,
        rs2: Reg,
    },
    Sha512Sum1r {
        rd: Reg,
        rs1: Reg,
        rs2: Reg,
    },
}
Expand description

RISC-V RV32 Zknh instruction (SHA-256 and SHA-512 sigma/sum functions).

SHA-256 instructions take a single source register. SHA-512 instructions take two source registers because 64-bit operands must be split across two 32-bit registers on RV32. The register conventions differ by instruction and follow the RISC-V scalar crypto Sail model exactly:

  • sha512sig0l, sha512sig1l: rs1 = LOW word, rs2 = HIGH word
  • sha512sig0h, sha512sig1h: rs1 = HIGH word, rs2 = LOW word
  • sha512sum0r, sha512sum1r: rs1 = LOW word, rs2 = HIGH word

For sha512sum0r and sha512sum1r the Sail pseudocode builds the 64-bit operand as x[63:32] = X(rs2), x[31:0] = X(rs1) (rs2 is the HIGH half) and writes the low 32 bits of the result to rd.

Variants§

§

Sha256Sig0

Fields

§rd: Reg
§rs1: Reg
§

Sha256Sig1

Fields

§rd: Reg
§rs1: Reg
§

Sha256Sum0

Fields

§rd: Reg
§rs1: Reg
§

Sha256Sum1

Fields

§rd: Reg
§rs1: Reg
§

Sha512Sig0h

Fields

§rd: Reg
§rs1: Reg
§rs2: Reg
§

Sha512Sig0l

Fields

§rd: Reg
§rs1: Reg
§rs2: Reg
§

Sha512Sig1h

Fields

§rd: Reg
§rs1: Reg
§rs2: Reg
§

Sha512Sig1l

Fields

§rd: Reg
§rs1: Reg
§rs2: Reg
§

Sha512Sum0r

Fields

§rd: Reg
§rs1: Reg
§rs2: Reg
§

Sha512Sum1r

Fields

§rd: Reg
§rs1: Reg
§rs2: Reg

Trait Implementations§

Source§

impl<Reg: Clone> Clone for Rv32ZknhInstruction<Reg>

Source§

fn clone(&self) -> Rv32ZknhInstruction<Reg>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<Reg: Debug> Debug for Rv32ZknhInstruction<Reg>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<Reg> Display for Rv32ZknhInstruction<Reg>
where Reg: Display,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
§

impl<Reg> Instruction for Rv32ZknhInstruction<Reg>
where Reg: Register<Type = u32>,

§

type Reg = Reg

A register type used by the instruction
§

fn try_decode(instruction: u32) -> Option<Self>

Try to decode a single valid instruction
§

fn alignment() -> u8

Instruction alignment in bytes
§

fn size(&self) -> u8

Instruction size in bytes
Source§

impl<Reg: PartialEq> PartialEq for Rv32ZknhInstruction<Reg>

Source§

fn eq(&self, other: &Rv32ZknhInstruction<Reg>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<Reg: Copy> Copy for Rv32ZknhInstruction<Reg>

Source§

impl<Reg: Eq> Eq for Rv32ZknhInstruction<Reg>

Source§

impl<Reg> StructuralPartialEq for Rv32ZknhInstruction<Reg>

Auto Trait Implementations§

§

impl<Reg> Freeze for Rv32ZknhInstruction<Reg>
where Reg: Freeze,

§

impl<Reg> RefUnwindSafe for Rv32ZknhInstruction<Reg>
where Reg: RefUnwindSafe,

§

impl<Reg> Send for Rv32ZknhInstruction<Reg>
where Reg: Send,

§

impl<Reg> Sync for Rv32ZknhInstruction<Reg>
where Reg: Sync,

§

impl<Reg> Unpin for Rv32ZknhInstruction<Reg>
where Reg: Unpin,

§

impl<Reg> UnsafeUnpin for Rv32ZknhInstruction<Reg>
where Reg: UnsafeUnpin,

§

impl<Reg> UnwindSafe for Rv32ZknhInstruction<Reg>
where Reg: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.