vstart
Vector start position
- Address
0x008- Group
- Unprivileged and user-level CSRs
- Privilege
URW(privileged spec CSR listing, Unprivileged Vector CSRs)- Access
- read/write; lowest privilege U (user/unprivileged)
- Address range
- Standard read/write
- Name in riscv-unified-db
- Vector Start Index
Privileged spec: Vector start position
Description
Specifies the index of the first element to be executed by a vector instruction.
From riscv-unified-db, reformatted.
Fields
| Field | Bits | Type | Description |
|---|---|---|---|
VALUE | RV32 31-0 / RV64 63-0 | RW-RH | Normally, vstart is only written by hardware on a trap on a vector instruction, with the vstart value representing the element on which the trap was taken (either a synchronous exception or an asynchronous interrupt), and at which execution should resume after a resumable trap is handled. All vector instructions are defined to begin execution with the element number given in the vstart CSR, leaving earlier elements in the destination vector undisturbed, and to reset the vstart CSR to zero at the end of execution. Note: All vector instructions, including vset{i}vl{i}, reset the vstart CSR to zero. vstart is not modified by vector instructions that raise illegal-instruction exceptions. The vstart CSR is defined to have only enough writable bits to hold the largest element index (one less than the maximum VLMAX). Note: The maximum vector length is obtained with the largest LMUL setting (8) and the smallest SEW setting (8), so VLMAX_max = 8*VLEN/8 = VLEN. For example, for VLEN=256, vstart would have 8 bits to represent indices from 0 through 255. The use of vstart values greater than the largest element index for the current vtype setting is reserved. Note: It is recommended that implementations trap if vstart is out of bounds. It is not required to trap, as a possible future use of upper vstart bits is to store imprecise trap information. The vstart CSR is writable by unprivileged code, but non-zero vstart values may cause vector instructions to run substantially slower on some implementations, so vstart should not be used by application programmers. A few vector instructions cannot be executed with a non-zero vstart value and will raise an illegal instruction exception as defined below. Note: Making vstart visible to unprivileged code supports user-level threading libraries. Implementations are permitted to raise illegal instruction exceptions when attempting to execute a vector instruction with a value of vstart that the implementation can never produce when executing that same instruction with the same vtype setting. Note: For example, some implementations will never take interrupts during execution of a vector arithmetic instruction, instead waiting until the instruction completes to take the interrupt. Such implementations are permitted to raise an illegal instruction exception when attempting to execute a vector arithmetic instruction when vstart is nonzero. Note: When migrating a software thread between two harts with different microarchitectures, the vstart value might not be supported by the new hart microarchitecture. The runtime on the receiving hart might then have to emulate instruction execution up to the next supported vstart element position. Alternatively, migration events can be constrained to only occur at mutually supported vstart locations. |
Fields from riscv-unified-db; field types computed by IDL functions there are not shown.
Specification and related pages
- The RISC-V Instruction Set Manual, Volume II: CSR listing (src/priv/csrs.adoc)
- riscv-opcodes csrs.csv
- riscv-unified-db: spec/std/isa/csr/V/vstart.yaml
- csrrw, csrrs, csrrc (Zicsr instructions that access CSRs)