Skip to content
This repository has been archived by the owner on Mar 20, 2024. It is now read-only.

Is a non-power-of-2 vlenb allowed? #864

Closed
palmer-dabbelt opened this issue Mar 2, 2023 · 3 comments
Closed

Is a non-power-of-2 vlenb allowed? #864

palmer-dabbelt opened this issue Mar 2, 2023 · 3 comments

Comments

@palmer-dabbelt
Copy link
Member

This came up in passing on a QEMU review https://lore.kernel.org/r/mhng-348cd335-c03c-481a-b09f-06bb3134650f@palmer-ri-x1c9a/. I'd been assuming that vlenb is a power of two, but I don't see anything in the spec that says so. I'm not sure if I'm missing something?

@nick-knight
Copy link
Contributor

nick-knight commented Mar 2, 2023

It follows from the following:

Each hart supporting a vector extension defines two parameters:

  1. The maximum size in bits of a vector element that any operation can produce or consume, ELEN ≥ 8, which must be a power of 2.
  2. The number of bits in a single vector register, VLEN ≥ ELEN, which must be a power of 2, and must be no greater than 2^16.

[...]

The XLEN-bit-wide read-only CSR vlenb holds the value VLEN/8, i.e., the vector register length in bytes.

@aswaterman
Copy link
Member

IOW, yes, the spec says it must be a power of two.

@palmer-dabbelt
Copy link
Member Author

Thanks, I guess I just wasn't paying attention -- I was only looking for vlenb.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants