CSR Bit Fields

RISC-V vlenb CSR Register

Address 0xC22Privilege User/VectorAccess RO / XLENUser vector state CSRs

vlenb at 0xC22 is a Vector register length bytes CSR: read-only byte length of one architectural vector register.

Bit Overview
bit 3 = only bit 3; bits 12..11 = bits 12 down to 11
MSBLSB
Field Map

Understand vlenb By Bit Fields

1 key fields
XLEN-1:0

VLENB

RO

Vector register length in bytes, equal to VLEN/8.

VLENB (bits XLEN-1:0) — Vector register length in bytes, equal to VLEN/8.

What This Field Controls

  • - Vector register length in bytes, equal to VLEN/8.

Common Values

This field is better understood together with surrounding context than as a fixed memorized enumeration.

Official Basis & Search Notes

vlenb is the URO vector CSR at 0xC22. It reports VLEN/8, the byte length of one vector register, and is a design-time constant in an implementation.

vlenb address, lowest access privilege, and access class are checked against the official CSR table: 0xC22, User/Vector, RO.
vlenb is the full XLEN-bit VLEN/8 value and is a design-time constant in an implementation.
This is a read-only CSR; do not write it. Reading it does not require changing the current vl or vtype.

What To Check First When Reading This CSR

  • - With the V extension, mstatus.VS=Off makes vector-CSR access raise an illegal-instruction exception; with V=1, vsstatus.VS=Off or mstatus.VS=Off does so as well.
  • - Use address 0xC22 and the lowest access privilege (User/Vector) to decide whether software may read it directly.
  • - VLENB is a full XLEN-bit read-only value equal to VLEN/8; it is a design-time constant in an implementation.

Risk Checks Before Writing

  • - vlenb is read-only; do not write it with CSR write instructions.

Put It Back Into A Real Flow

1

Read vlenb to obtain VLEN/8, the byte length of one vector register.

2

Interpret the returned value according to the field descriptions and do not attempt to write it back.

3

Do not try to write it back; it is a design-time constant and does not vary with the current vl or vtype.

FAQ

Can vlenb be accessed from any privilege level?

Its CSR number is URO and it can be read from U-mode, but with the V extension mstatus.VS=Off makes access raise an illegal-instruction exception. With V=1, either vsstatus.VS=Off or mstatus.VS=Off also raises that exception.

What is easiest to miss when using vlenb?

vlenb is read-only and its value is a design-time constant in an implementation; it reports VLEN/8 and does not vary with vl or vtype.