Register Guide
RISC-V vlenb / vlenb Register: Vector Register Length in Bytes CSR
vlenb is the Vector Register Byte Length register (read-only CSR 0xC22), holding VLEN/8 — the byte width of a single vector register.
ABI name: vlenb; physical register: vlenb.
Save rule: Saved by software when context requires.
Read it through its psABI role first, then inspect how each instruction reads or writes it.
Physical Name vlenbABI Name vlenbSave Rule Saved by software when context requires
Role
Vector Register Length in Bytes CSR
Convention
Architectural state / CSR semantics
Remember This First
t* registers are caller-saved, so callees may overwrite them.
psABI Reference
ABI register
vlenb is the Vector Register Byte Length register (read-only CSR 0xC22), holding VLEN/8 — the byte width of a single vector register.
Preserved across calls: Saved by software when context requires
RISC-V psABI integer register conventionWhen It Fits Best
- - Hold short-lived temporary computation results.
- - Use them for local computations that do not need to survive calls.
- - Use them as caller-managed scratch registers.
When Not To Use It This Way
- - Do not keep values in t* across a call unless you save them yourself first.
- - Do not expect callees to restore t* for you.
What Happens Around A Call
1
t* registers are caller-saved, so callees may overwrite them.
2
If the caller still needs a t* value after a call, it must save it in advance.
Protect Temporary Values Before A Call
Examples explain the rule, not a complete programaddi t0, a0, 1
# If t0 is needed after the call, save it to an ABI-valid location first
call foo
# restore t0 from that saved location after the call returns