misa

Machine ISA Control

Reports the XLEN and "major" extensions supported by the ISA.

Attributes

Defining Extension

  • Sm, version >= Sm@1.11.0

CSR Address

0x301

Length

32 when CSR[misa].MXL == 0 64 when CSR[misa].MXL == 1

Privilege Mode

M

Format

This CSR format changes dynamically.

misa Format when CSR[misa].MXL == 0
Figure 1. misa Format when CSR[misa].MXL == 0
misa Format when CSR[misa].MXL == 1
Figure 2. misa Format when CSR[misa].MXL == 1

Field Summary

Name Location Type Reset Value

misa.MXL

* 31:30 when CSR[misa].MXL == 0 * 63:62 when CSR[misa].MXL == 1

RO

UNDEFINED_LEGAL

misa.A

0

UNDEFINED_LEGAL

misa.B

1

UNDEFINED_LEGAL

misa.C

2

UNDEFINED_LEGAL

misa.D

3

UNDEFINED_LEGAL

misa.F

5

UNDEFINED_LEGAL

misa.G

6

UNDEFINED_LEGAL

misa.H

7

UNDEFINED_LEGAL

misa.I

8

RO

1

misa.M

12

UNDEFINED_LEGAL

misa.S

18

UNDEFINED_LEGAL

misa.U

20

UNDEFINED_LEGAL

misa.V

21

UNDEFINED_LEGAL

Fields

MXL

Location
  • 31:30 when CSR[misa].MXL == 0

  • 63:62 when CSR[misa].MXL == 1

Description

XLEN in M-mode.

Type

RO

Reset value

UNDEFINED_LEGAL

A

Location

0

Description

Indicates support for the A (atomic) extension.

Writing 0 to this field will cause all atomic instructions to raise an IllegalInstruction exception.
Type
Reset value

UNDEFINED_LEGAL

B

Location

1

Description

Indicates support for the B (bitmanip) extension.

Writing 0 to this field will cause all bitmanip instructions to raise an IllegalInstruction exception.
Type
Reset value

UNDEFINED_LEGAL

C

Location

2

Description

Indicates support for the C (compressed) extension.

Writing 0 to this field will cause all compressed instructions to raise an IllegalInstruction exception. Additionally, IALIGN becomes 32.
Type
Reset value

UNDEFINED_LEGAL

D

Location

3

Description

Indicates support for the D (double precision float) extension.

Writing 0 to this field will cause all double-precision floating point instructions to raise an IllegalInstruction exception.

Additionally, the upper 32-bits of the f registers will read as zero.

Type
Reset value

UNDEFINED_LEGAL

F

Location

5

Description

Indicates support for the F (single precision float) extension.

Writing 0 to this field will cause all floating point (single and double precision) instructions to raise an IllegalInstruction exception.

Writing 0 to this field with misa.D set will result in UNDEFINED behavior.

Type
Reset value

UNDEFINED_LEGAL

G

Location

6

Description

Indicates support for all of the following extensions: I, A, M, F, D.

Type
Reset value

UNDEFINED_LEGAL

H

Location

7

Description

Indicates support for the H (hypervisor) extension.

Writing 0 to this field will cause all attempts to enter VS- or VU- mode, execute a hypervisor instruction, or access a hypervisor CSR to raise an IllegalInstruction fault.
Type
Reset value

UNDEFINED_LEGAL

I

Location

8

Description

Indicates support for the I (base) extension.

Type

RO

Reset value

1

M

Location

12

Description

Indicates support for the M (integer multiply/divide) extension.

Writing 0 to this field will cause all attempts to execute an integer multiply or divide instruction to raise an IllegalInstruction exception.
Type
Reset value

UNDEFINED_LEGAL

S

Location

18

Description

Indicates support for the S (supervisor mode) extension.

Writing 0 to this field will cause all attempts to enter S-mode or access S-mode state to raise an exception.
Type
Reset value

UNDEFINED_LEGAL

U

Location

20

Description

Indicates support for the U (user mode) extension.

Writing 0 to this field will cause all attempts to enter U-mode to raise an exception.
Type
Reset value

UNDEFINED_LEGAL

V

Location

21

Description

Indicates support for the V (vector) extension.

Writing 0 to this field will cause all attempts to execute a vector instruction to raise an IllegalInstruction trap.
Type
Reset value

UNDEFINED_LEGAL

Software write

This CSR may store a value that is different from what software attempts to write.

When a software write occurs (e.g., through csrrw), the following determines the written value:

MXL = csr_value.MXL
A = csr_value.A
B = csr_value.B
C = csr_value.C
D = csr_value.D
F = if (csr_value.F == 0 && csr_value.D == 1) {
  return UNDEFINED_LEGAL_DETERMINISTIC;
}

# fall-through; write the intended value
return csr_value.F;

G = csr_value.G
H = csr_value.H
I = csr_value.I
M = csr_value.M
S = csr_value.S
U = csr_value.U
V = csr_value.V

Software read

This CSR may return a value that is different from what is stored in hardware.

return %%LINK%csr_field;misa.MXL;CSR[misa].MXL%% << (%%LINK%func;xlen;xlen%%() - 2 | (%%LINK%csr_field;misa.V;CSR[misa].V%% << 21) | (%%LINK%csr_field;misa.U;CSR[misa].U%% << 20) | (%%LINK%csr_field;misa.S;CSR[misa].S%% << 18) | (%%LINK%csr_field;misa.M;CSR[misa].M%% << 12) | (%%LINK%csr_field;misa.I;CSR[misa].I%% << 7) | (%%LINK%csr_field;misa.H;CSR[misa].H%% << 6) | ((%%LINK%csr_field;misa.A;CSR[misa].A%% & %%LINK%csr_field;misa.M;CSR[misa].M%% & %%LINK%csr_field;misa.F;CSR[misa].F%% & %%LINK%csr_field;misa.D;CSR[misa].D%%) << 5) | (%%LINK%csr_field;misa.F;CSR[misa].F%% << 4) | (%%LINK%csr_field;misa.D;CSR[misa].D%% << 3) | (%%LINK%csr_field;misa.C;CSR[misa].C%% << 2) | (%%LINK%csr_field;misa.B;CSR[misa].B%% << 1) | %%LINK%csr_field;misa.A;CSR[misa].A%%);