Home/Instructions/SHA-512 Sum0 Word
SHA512SUM0R

RISC-V SHA512SUM0R Instruction Details

Instruction ManualR-type

SHA-512 Sum0: two RV32 source words produce one 32-bit result word

Instruction Syntax

sha512sum0r rd, rs1, rs2

Syntax is sha512sum0r rd, rs1, rs2; operands select integer x0–x31 or ABI names, with no assembly immediate.

32-bit OP: funct7=0101000, funct3=000, opcode=0110011.

RV32 Zknh only (also in Zkn/Zk); each instruction computes one 32-bit result word. Preserve the original inputs and reverse source order for the second instruction of the full Sum transform.

An x0 source is zero and writes to x0 are discarded; overlap reads values before writeback and equal sources share one value. Execution latency must be data-independent.

ZknhCrypto & Security

Instruction Behavior

sha512sum0r is defined only for RV32. It applies the official formula to the 32-bit X(rs1) and X(rs2) values to compute one SHA2-512 Sum0 result word; the documented two-instruction sequence reverses the source-register order for its second instruction.

SHA512SUM0R Decode And Execute Animation

Applies the official RV32 formula for one SHA-512 Sum result word.

rd
rs1
rs2
sha512sum0r
,
,
Execution Context

XLEN is fixed at 32. This instruction reads rs1 and rs2 exactly as shown; the official two-instruction sequence reverses the source-register order for its second instruction. Initially rd shares an overlapping source value, otherwise it starts at 0. An x0 source must be 0; identical sources must share one value.

fixed
source
source
fixed
destination
OP
31..25
0101000
24..20
rs2=x12
19..15
rs1=x11
14..12
000
11..7
rd=x10
6..0
0110011
Execution Data Path
X(rs1)[31:0]
0x89ABCDEF
X(rs2)[31:0]
0x01234567
rs1 << 25
0xDE000000
rs1 << 30
0xC0000000
rs1 >> 28
0x00000008
rs2 >> 7
0x0002468A
rs2 >> 2
0x0048D159
rs2 << 4
0x12345670
result
0x0C7EC1AB
Architectural Result
a0(x10) = 0x00000000

This animation shows only official ISA fields and architectural state; it does not model a complete hash algorithm or microarchitecture.

Quick Understanding & Search Notes

sha512sum0r computes SHA-512 Sum0 as one RV32 result word; reverse the source registers for the other word.

All operands are integer X registers; this instruction must have data-independent execution latency.

Common Usage Scenarios

Crypto & Security

RV32 Zknh, a0=1 and a1=0; preserve both sources and reverse their order in the second instruction. t0=0x42000000, t1=0x00000010.

Hash Algorithms

RV32 Zknh, a0=1 and a1=0; preserve both sources and reverse their order in the second instruction. t0=0x42000000, t1=0x00000010.

Pre-Use Checklist

Syntax Check
  • Syntax is sha512sum0r rd, rs1, rs2; operands select integer x0–x31 or ABI names, with no assembly immediate.
  • 32-bit OP: funct7=0101000, funct3=000, opcode=0110011.
Semantic Check
  • RV32 Zknh only (also in Zkn/Zk); each instruction computes one 32-bit result word. Preserve the original inputs and reverse source order for the second instruction of the full Sum transform.
  • An x0 source is zero and writes to x0 are discarded; overlap reads values before writeback and equal sources share one value. Execution latency must be data-independent.

Pitfalls / Common Confusions

RV32 only; sha512sum0r produces only one half of the split 64-bit Σ0 result.
The full result requires the official sequence that executes again with rs1/rs2 reversed; it is not a single-register alias of RV64 sha512sum0.

FAQ

Does SHA512SUM0R use floating-point or vector registers?

No. These scalar crypto extension instructions use integer X registers.

Is SHA512SUM0R a complete algorithm implementation?

No. It computes one RV32 result word of SHA2-512 Sum0; the manual's second instruction reverses the source-register order.