HSV.H

RISC-V HSV.H Instruction Details

Instruction ManualSYSTEM R-type fields

Hypervisor virtual-machine store of a halfword using VS/VU effective privilege and two-stage translation.

Instruction Syntax

hsv.h rs2, (rs1)
Operand Breakdown
H 1.0; RV32/RV64; 32-bit SYSTEM R-type fields, funct7=0110011, funct3=100, opcode=1110011.
rs2=[24:20] supplies the low 16 data bits, rs1=[19:15] directly supplies the address, and rd=[11:7] is fixed to 00000. No offset immediate.
M/HS or V=0 U-mode with HU=1 may execute; V=1 raises virtual-instruction, and V=0 U-mode with HU=0 raises illegal-instruction. SPVP=0/1 selects VU/VS access; HS SUM is ignored and MPRV does not alter the access.
rs2=x0 stores zero. If rs1=rs2, source data is the low bits of that same address register. The example does not update memory outside the access width.
Examples assume H is available, relevant modes use the same XLEN, pointer masking is disabled, and translation/protection succeeds. Misaligned completion depends on the execution environment.
HSystem & Privilege

Instruction Behavior

HSV.H is the H-extension virtual-machine store. It may execute in M-mode or HS-mode, or in U-mode when hstatus.HU=1. The explicit memory access uses effective privilege VU when hstatus.SPVP=0 and VS when hstatus.SPVP=1, with two-stage address translation.

HSV.H Decode And Execute Animation

Shows HSV.H SYSTEM decoding, privilege checks, two-stage translation, and 16-bit store commitment without modeling page walks or TLB implementation.

rs2
rs1
hsv.h
,(
)

Assumes H is implemented, relevant privilege modes use the same XLEN, and pointer masking is disabled. Input represents low source bits; the selector supplies the access outcome without validating page tables. rs1=x0 fixes address zero. Steps are teaching stages, not processor cycles.

rs2=x0 fixes the source to zero. With rs1=rs2, source low bits derive from the same address register and cannot be edited independently. Both use pre-execution values. The stored number represents the full access width; byte endianness is not simulated.

31..25
24..20
19..15
14..12
11..7
6..0
0110011
funct7
01100
rs2/source
01011
rs1/address
100
PRIVM
00000
rd=00000
1110011
SYSTEM
Architectural Data Path
instruction
0x66C5C073
decode
funct7=0110011, rs2=01100, funct3=100, rd=00000 -> HSV.H
address
a1(x11) -> 0x0000000040001000 (no immediate offset)
privilege
HS: execution permitted
translation
VU effective privilege -> VS-stage -> G-stage; HS SUM ignored; MPRV is not used
store
a2(x12) low 16 bits = 0x8001 -> memory[0x0000000040001000]
state
Architectural state is not committed; the final memory state is shown only at writeback.
Architectural state is not committed; the final memory state is shown only at writeback.

This animation shows only official architectural conditions and outcomes; page walks, TLBs, caches, and platform exception handling are not modeled.

Quick Understanding & Search Notes

HSV.H is the H-extension virtual-machine halfword store, storing through VS-stage and G-stage translation using the memory access's VS/VU effective privilege.

H 1.0, RV32/RV64: rs1 is the address; rs2 supplies low 16 bits; no offset; rd=x0.
SPVP=0/1 selects VU/VS; HS SUM is ignored; MPRV has no effect.
V=1 raises virtual-instruction. V=0 U-mode requires HU=1; HU=0 raises illegal-instruction.

Common Usage Scenarios

Hypervisor Device Emulation

Assume RV64 H, HS-mode, SPVP=0, pointer masking off, and successful translation/protection; a0=0x1000 and a1=0x123456789ABCDEF0. hsv.h a1, (a0) stores the low 16 bits 0xDEF0 (2 bytes) at that address without register writeback.

Guest Memory Access

Assume RV64 H, HS-mode, SPVP=0, pointer masking off, and successful translation/protection; a0=0x1000 and a1=0x123456789ABCDEF0. hsv.h a1, (a0) stores the low 16 bits 0xDEF0 (2 bytes) at that address without register writeback.

Virtualized Instruction Simulation

Assume RV64 H, HS-mode, SPVP=0, pointer masking off, and successful translation/protection; a0=0x1000 and a1=0x123456789ABCDEF0. hsv.h a1, (a0) stores the low 16 bits 0xDEF0 (2 bytes) at that address without register writeback.

Pre-Use Checklist

Syntax Check
  • H 1.0; RV32/RV64; 32-bit SYSTEM R-type fields, funct7=0110011, funct3=100, opcode=1110011.
  • rs2=[24:20] supplies the low 16 data bits, rs1=[19:15] directly supplies the address, and rd=[11:7] is fixed to 00000. No offset immediate.
Semantic Check
  • M/HS or V=0 U-mode with HU=1 may execute; V=1 raises virtual-instruction, and V=0 U-mode with HU=0 raises illegal-instruction. SPVP=0/1 selects VU/VS access; HS SUM is ignored and MPRV does not alter the access.
  • rs2=x0 stores zero. If rs1=rs2, source data is the low bits of that same address register. The example does not update memory outside the access width.
  • Examples assume H is available, relevant modes use the same XLEN, pointer masking is disabled, and translation/protection succeeds. Misaligned completion depends on the execution environment.

Pitfalls / Common Confusions

Executing HLV/HLVX/HSV when virtualization mode V=1 raises a virtual-instruction exception.
U-mode execution is legal only when hstatus.HU=1; otherwise it raises illegal-instruction.
Access faults, guest-page faults, and page faults are still possible under the VS/G-stage translations.

FAQ

What is stored with rs2=x0 or rs1=rs2?

rs2=x0 stores 16 zero bits. With rs1=rs2, the old register value supplies the address and its low 16 data bits.