C.FSWSP

RISC-V C.FSWSP Instruction Details

Instruction ManualCSS-format

RV32FC 16-bit CSS floating-point store, transferring 32 bits; base is x2/sp.

Instruction Syntax

c.fswsp fs2, offset(sp)

The 5-bit fs2 field selects f0–f31; the base is fixed x2/sp. f0 is not integer zero.

offset is already an unsigned byte offset: 0–252, in multiples of 4, with 2 implied zero low bits. Do not scale it again.

RV32FC, floating-point state enabled, access permitted; store the low 32 source bits, preserving NaN payloads and leaving source and base unchanged.

Address is base plus offset, wrapping at XLEN. Natural alignment raises no address-misaligned exception; misaligned outcomes are EEI-defined and an exception is not shown as a completed access.

CFCompressed Instruction

Instruction Behavior

RV32FC: add an unsigned byte offset (0–252, multiples of 4) to x2/sp. On completion, store the low 32 bits of fs2; source and base stay unchanged.

C.FSWSP Decode & Execute Animation

Shows only manual-defined 16-bit fields, operands, and ISA-visible results; it does not model a pipeline, cache, timing, or an implementation's memory-fault handling.

c.fswsp,(sp)
Execution context

RV32FC; floating-point state enabled, ordinary address calculation (no address-transforming extensions), and memory bits already assembled using the environment's byte order.

The store transfers 32 bits; with a wider FLEN, FSW transfers the low 32 bits and ignores upper bits, while FSD transfers the low 64 bits. Transfers do not modify NaN payloads.

Naturally aligned accesses do not raise an address-misaligned exception; whether a misaligned access completes or raises an address-misaligned/access-fault exception is EEI-defined. This control displays only the selected outcome branch.

x2/sp = 0x00001000; low 32 bits of f0 = 0x3F800000. -> 0x00001010 -> M[0x00001010] = 0x3F800000.
16-bit encoding fields

base = x2/sp; fs2=00000 -> f0; uimm=4 × 4 = 16 bytes (assembly offset)

15..13
funct3
111
12..9
uimm[5:2]
0100
8..7
uimm[7:6]
00
6..2
fs2
00000
1..0
op
10
Execution data path
x2/sp = 0x00001000; low 32 bits of f0 = 0x3F800000.
0x00001010 = (0x00001000 + 16) mod 2^32
M[0x00001010] <- 0x3F800000
Architectural state has not been committed.

Quick Understanding & Search Notes

RV32FC: add an unsigned byte offset (0–252, multiples of 4) to x2/sp. On completion, store the low 32 bits of fs2; source and base stay unchanged.

C.FSWSP is a real 16-bit CSS encoding with FSW semantics.
The 5-bit fs2 field selects f0–f31. The base is fixed x2/sp.
Assembly offset is 0–252 bytes in multiples of 4; reconstruction implies 2 zero low bits. Do not rescale the assembly value.

Common Usage Scenarios

Floating-Point Memory Access

RV32FC, floating-point state enabled, sp=0x1000, low 32 bits of f0=0x3f800000, access completes: c.fswsp f0, 16(sp) writes this pattern to mem32[0x1010], leaving f0 and sp unchanged.

Pre-Use Checklist

Syntax Check
  • The 5-bit fs2 field selects f0–f31; the base is fixed x2/sp. f0 is not integer zero.
  • offset is already an unsigned byte offset: 0–252, in multiples of 4, with 2 implied zero low bits. Do not scale it again.
Semantic Check
  • RV32FC, floating-point state enabled, access permitted; store the low 32 source bits, preserving NaN payloads and leaving source and base unchanged.
  • Address is base plus offset, wrapping at XLEN. Natural alignment raises no address-misaligned exception; misaligned outcomes are EEI-defined and an exception is not shown as a completed access.

Pitfalls / Common Confusions

C.FSWSP is RV32FC-only; RV64C uses the same encoding space for C.SDSP.
Assembly offset is already 0–252 bytes in multiples of 4; do not scale it again.
Natural alignment raises no address-misaligned exception; the EEI defines whether misaligned accesses complete or raise an exception.
The transfer preserves NaN payloads; when FLEN exceeds 32, the store ignores upper bits and transfers only the low 32 bits.

FAQ

How is the offset written for c.fswsp?

Use a byte offset from 0 through 252 in multiples of 4. offset=16 adds 16 bytes without modifying the base.

When is c.fswsp available?

This page uses RV32FC, with floating-point state enabled and memory access permitted. C+F implies Zcf on RV32; Zcf depends on Zca and F.