Date
1 - 2 of 2

#### Constant XLEN in the SBI specification

Heinrich Schuchardt

The SBI specification uses a constant XLEN multiple times in the text

without defining it.

I assume XLEN is the bitness of the RISC-V implementation (32, 64, or 128).

Furthermore reference is made to the type 'unsigned long'. The C

specification does not define how many bits this type has. It is only

known to have at least as many bits as int and no more than unsigned

long long. The width differs between compilers. An unsigned long might

have 72 bit on a 128 bit system and 48 bit on a 64bit system.

I assume the authors thought of unsigned long being uint32_t on RV32,

uint64_t on RV64, and uint128_t on RV128.

A specification should not be open to guesswork. Both XLEN and unsigned

long need a definition in the spec before being used.

Could anybody on the list, please, confirm that my assumptions are right?

Best regards

Heinrich

without defining it.

I assume XLEN is the bitness of the RISC-V implementation (32, 64, or 128).

Furthermore reference is made to the type 'unsigned long'. The C

specification does not define how many bits this type has. It is only

known to have at least as many bits as int and no more than unsigned

long long. The width differs between compilers. An unsigned long might

have 72 bit on a 128 bit system and 48 bit on a 64bit system.

I assume the authors thought of unsigned long being uint32_t on RV32,

uint64_t on RV64, and uint128_t on RV128.

A specification should not be open to guesswork. Both XLEN and unsigned

long need a definition in the spec before being used.

Could anybody on the list, please, confirm that my assumptions are right?

Best regards

Heinrich

Allen Baum

For what its worth, The Risc-V Privileged Architecture Spec Table 3.1 defines XLEN pretty clearly:

MXL XLEN

1 32

2 64

3 128

Table 3.1: Encoding of MXL field in misa

On Thu, Mar 11, 2021 at 1:07 PM Heinrich Schuchardt <xypron.glpk@...> wrote:

The SBI specification uses a constant XLEN multiple times in the text

without defining it.

I assume XLEN is the bitness of the RISC-V implementation (32, 64, or 128).

Furthermore reference is made to the type 'unsigned long'. The C

specification does not define how many bits this type has. It is only

known to have at least as many bits as int and no more than unsigned

long long. The width differs between compilers. An unsigned long might

have 72 bit on a 128 bit system and 48 bit on a 64bit system.

I assume the authors thought of unsigned long being uint32_t on RV32,

uint64_t on RV64, and uint128_t on RV128.

A specification should not be open to guesswork. Both XLEN and unsigned

long need a definition in the spec before being used.

Could anybody on the list, please, confirm that my assumptions are right?

Best regards

Heinrich