sfence.w.inval
Order writes before sfence
- Extension
- Svinval
- XLEN
- RV32 and RV64
- Assembly (riscv-unified-db)
sfence.w.inval- Length
- 32-bit
Encoding
| 3125 | 2420 | 1915 | 1412 | 117 | 62 | 10 | |||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0001100 | 00000 | 00000 | 000 | 00000 | 11100 | 11 | |||||||||||||||||||||||||
Match 0x18000073, mask 0xffffffff. Source: sfence.w.inval 11..7=0 19..15=0x0 24..20=0x0 31..25=0x0c 14..12=0 6..2=0x1C 1..0=3 in riscv-opcodes/extensions/rv_svinval.
Description
The sfence.w.inval instruction guarantees that any previous stores already visible to the
current RISC-V hart are ordered before subsequent sinval.vma instructions executed by the
same hart.
Description from riscv-unified-db, reformatted.
Operation
if (mode() == PrivilegeMode::U) {
raise (ExceptionCode::IllegalInstruction, mode(), $encoding);
}
if (CSR[misa].H == 1 && mode() == PrivilegeMode::VU) {
raise (ExceptionCode::VirtualInstruction, mode(), $encoding);
}
# order all prior stores already visible to the current hart
# before any following sfence
# Unlike SFENCE.VMA/HFENCE.[GV]VMA, SFENCE.W.INVAL is indiscriminate;
# it orders all writes before all page tables
VmaOrderType vma_type;
vma_type.global = true;
vma_type.smode = true;
if (CSR[misa].H == 1) {
vma_type.vsmode = true;
vma_type.gstage = true;
}
order_pgtbl_writes_before_vmafence(vma_type);Pseudocode in riscv-unified-db’s IDL, quoted unchanged.