Contributors to all versions of the spec in alphabetical order

  • Allen Baum

  • Jordan Carlin

  • James Kaden Cassidy

  • David Harris

  • Georgia Tai

  • Mike Thompson

This document is released under a Creative Commons Attribution 4.0 International License.

This Certification Test Plan (CTP) is a work in progress. It describes the coverpoints and tests being developed by the RISC-V Certification Steering Committee. It is intended to be read in conjunction with the Certification Requirements Documents (CRDs) defining the features in each certificate, and the riscv-arch-test repository that contains information about how to use and contribute to the tests.

1. Introduction

This Certification Test Plan describes the coverpoints and tests to certify RISC-V profiles. It summarizes the profiles intended to be supported and the test suites that need to run on each profile. It also summarizes the contents of each test suite. This CTP will also include coverpoints and tests for features that are not part of a certified profile.

1.1. Certificates and Certification

A RISC-V Certificate is a named set of requirements for a RISC-V implementation, typically defined by a ratified profile and a set of additional requirements. For example, the RVA23 Certificate requires meeting the RVA23S64 profile and having a conforming machine mode implementation.

Certification is the process of testing that a RISC-V implementation meets the requirements of a RISC-V certificate. The goal of certification is to deliver software interoperability across implementations.

There is a fuzzy line between certification and verification. Certification involves testing that an implementation meets all of the normative rules in ratified specifications relevant to the certificate, but does not involve testing that requires detailed knowledge of the microarchitecture. Specifically, certification does not check timing (such as the arrival of interrupts relative to the start, middle, or end of multicycle instructions), pipeline hazards, power management features, etc.

Certification assumes the ratified specification is read and interpreted with knowledge of computer architecture and reasonable judgement, because not every detail is spelled out in normative rules. For example, certification that "ADD performs the addition of rs1 and rs2" involves testing ADD with a reasonable set of values. The test plan author exercises judgement selecting these values because they are not spelled out. For example, the values might involve every combination of {0, 1, -1, maximum positive integer, maximum negative integer, intermediate value} for the two source register values. The intermediate value involves an arbitrary choice. A reasonable author might pick some other sensible edge values, such as some values one more or less than those in the set above. However, certification does not attempt to prove every bit of a carry chain works for every possible input, or that all stuck-at faults would be detected. Similarly, the test plan author may exercise all 32 registers as sources or destinations for each instruction, which is implicitly required but not spelled out in a normative rule.

When in doubt, it is better to test slightly more than strictly necessary for normative rules, rather than slightly less. Over-testing is acceptable, as long as it does not cause false failures or excessive test time. It is often easier to test cross-products of all relevant inputs, even if not all combinations are explicitly named by normative rules. It also reduces the risk of human error missing a required combination.

An implementation that passes certification tests is said to be certified for the relevant certificate. The process of certification is described in TODO CSC page.

1.2. Normative Rules, Coverpoints, and Tests

Normative rules are the key to certification. They are the features of the RISC-V architecture that need to be tested in order to certify a profile. However, normative rules are human-readable portions of a specification and cannot be checked in an automated manner.

Instead, certification relies on coverpoints, which are machine-readable descriptions of the features to be tested. Every normative rule is tied to one or more coverpoints, such that if the coverpoints are hit, the normative rule is considered to be certified.

Each coverpoint has a set of tests that exercise it, and each test has a set of coverpoints that it hits.

This test plan defines the normative rules that must be hit for each profile, specifies the coverpoints that measure those rules, and outlines the tests that hit those coverpoints. The tests are self-checking, and report pass/fail results. The coverage report confirms that the tests hit all the coverpoints and thus all the normative rules.

Coverpoints are written in SystemVerilog, and are designed to be used with the Extended RISC-V Verification Interface (RVVI). They are written to be independent of the DUT (Device Under Test), so that they can be used with any RISC-V implementation. [1] Functional coverage is collected using SystemVerilog infrastructure adapted from riscvISACOV [2].

Coverpoints are organized into .svh SystemVerilog coverage files, each of which contain one or more covergroups, each of which contain one or more coverpoints. Coverage files apply to a DUT with a particular set of extensions. For example, the I_coverage.svh coverage file is used for any 32 or 64-bit DUT that supports the I extension. The ZicsrF_coverage.svh coverage file applies to a DUT that supports both the Zicsr and F extensions. Some covergroups in a coverage file apply only when another extension is also supported; for example, the half-double conversion covergroups in Zfh_coverage.svh are compiled only when D is supported.

Tests are written in assembly language .S files. Tests are organized into directories for each extension, and into a privileged directory. The coverpoints are hit by running all of the applicable tests in a directory. For example, RV32I coverage involves running add.S, addi.S, sub.S, etc. RV64I coverage also involves running addw.S, which is unique to RV64.

1.3. Glossary

The following terms are used in this test plan:

  • Extensions: named and ratified RISC-V extensions, such as RV32I, M, Zbb, Zicsr, or Svadu. Many extensions define instructions or CSRs, but some only define parameters (e.g. Sstvecd requires that STVEC_MODES includes 0).

  • Parameters: options describing the behavior of extensions. All parameters will be named by the Parameters Working Group (started February 2026) and will appear in UDB. For example, the PMP_GRANULARITY parameter defines the minimum size of a PMP region.

  • Configuration: A set of extensions and parameters partially or fully describing the behavior of a RISC-V hart. A full configuration is sufficient for a reference model to exactly match the behavior of a DUT except with regard to non-deterministic behaviors. Configurations are described in machine-readable YAML format that are read by UDB and used to generate configuration files for various tools.

  • Constrained Non-Deterministic Behaviors: behaviors that cannot be predicted based on either architectural configuration or defined parameters, but whose result are constrained to be a small number of possible values. The example of a tail-agnostic vector instruction is one of those, where the number of legal results is limited to just two: either the previous value, or all ones. Either behavior is correct, and the hart might change behaviors from one instruction to the next, so the DUT and reference model cannot be guaranteed to exactly match. Self-checking tests must accept all legal outcomes for non-deterministic behaviors.

  • Unconstrained Non-Deterministic Behaviors: behaviors that cannot be predicted based on either architectural configuration or defined parameters, and whose result is not constrained to a small number of possible values. For example, the value of an integer register after reset is an unconstrained non-deterministic behavior. Tests must not make any assumptions about the value of such behaviors, and must not check them against the reference model.

  • Profile: A named collection of required and optional extensions, such as RVI20 or RVA23S64. Profiles may be ratified by RISC-V or developed by the Certification Steering Committee to meet certification market needs, such as a simple microcontroller. A profile is a partial configuration. The test plan must allow the DUT configuration to indicate which optional extensions and other parameters are used, and fully test all optional profile extensions provided by the DUT.

  • UDB: Unified Database, a standardized way to describe the configuration and generate config files for various tools from a single point of truth.

  • Normative rule: Description of a single certifiable feature, preferably a direct quotation from a ratified specification.

  • Coverage files: a SystemVerilog .svh file containing all of the covergroups for an extension or combination of extensions, such as I_coverage.svh or ZfaD_coverage.svh.

  • Covergroup: A SystemVerilog construct that contains one or more coverpoints. Covergroups are used to collect functional coverage of a particular feature or set of features in the RISC-V architecture. For example, the I_coverage.svh file contains a covergroup for each instruction in the I extension, such as add, addi, sub, etc. The InterruptsSm_coverage.svh contains a single InterruptsSm_cg covergroup with all the coverpoints for machine-mode interrupts.

  • Coverpoint: A SystemVerilog construct describing a set of conditions to test. For example, the cp_rd coverpoint checks that all 32 destination registers x0-x31 are exercised by instructions that don’t trap. Each coverpoint has one or more bins; for example, cp_rd has 32 bins for the different registers.

  • Bin: One target value for a coverpoint. Each bin may be covered or not by a test suite.

  • Test files: A file containing one or more tests, typically written in assembly language. For example, rv32/I/add.S contains all of the RV32 tests to exercise the add_cg covergroup in I_coverage.svh.

  • Test: A snippet of code, typically a sequence of assembly language instructions, that exercises at least one bin of a coverpoint.

  • Test Suite: A collection of coverage and test files to test a particular extension, combination of extensions, or group of extensions. For example, the RV32I test suite contains the I_coverage.svh coverage file and the rv32/I/add.S, addi.S, sub.S, and other tests files with tests that hit the coverpoints in that coverage file. The RV64Zfa test suite contains the Zfa_coverage.svh coverage file and the rv64/Zfa/fround.s.S, fround.d.S, and other tests files with tests that hit the coverpoints in that coverage file. The RVA23S64 test suite contains all of the required and selected optional test suites for the profile, including RV64I, RV64Zfa, ExceptionsS, etc.

  • RVMODEL DUT-Specific Macros: A set of macros that perform semihosting/trick box functions such as booting the DUT, sending interrupts, and logging results. The macros are defined in RVMODEL DUT-Specific Macros.

Beware that Test Suite is also used outside this document to mean a full set of tests for a given profile from a given provider. For example, Synopsys, Breker, and riscv-arch-test all have test suites for the RVI20U32 profile.

2. Certification Process

Certifying a RISC-V Device-Under-Test (DUT) involves the following steps:

  • Selecting a profile for the DUT

  • Providing a Unified Database (UDB) configuration for the DUT, such as optional extensions, peripheral addresses, and PMP granularity

  • Generating self-checking tests based on the selected profile and UDB

  • Running the tests and reporting pass/fail

Test developers also need to

  • Generate a coverage report confirming that the tests hit all the coverpoints based on a trace from the RISC-V Sail model

TODO: Update to point to CSC page when ready.

3. Profiles & Test Suites

This test plan contains test suites for all of the mandatory and optional extensions in the RVA23 and earlier profiles, and for various other extensions. Some of these profiles, ratified and unratified, are listed below:

  • RVI20 Profile (Ratified)

    • RV{32/64}IMAFDC_Zifencei_Zicntr_Zihpm with no Sm machine mode, no PMP. Zicsr instructions only access counters and floating-point CSRs. Optional support for misaligned loads/stores (MISALIGNED_LDST parameter).

  • MC100 Microcontroller Profile

    • RV{32/64}IMZca_Zifencei_Zicsr_Zicntr with machine mode 1.11, counters, exceptions, interrupts, PMP16

  • RVA22S64 Profile (Ratified)

    • Application processor without vector, hypervisor, and other newer extensions

  • RVB23S64 Profile (Ratified)

    • RVA23 less vector and hypervisor

  • RVA23 Profile (RVA23 CRD)

Where a CRD is available, it lists the mandatory and optional extensions and IN/OUT-OF_SCOPE parameters.

This test plan makes some further assumptions, which should be checked against the CRDs when they become available:

  • All certificates for profiles that support interrupts require that the platform be able to set and clear via software all implemented interrupt pending bits

  • Although the RVI20 profile states that ecall causes a trap to the execution environment, it also says that Zicsr instructions are not supported independent of the Zicntr or F instructions, so there is no way to control mtvec and write a trap handler. Therefore ecall is not exercised.

  • Atomics and fences are much more interesting in a multi-core / multi-master environment. The base test plan just checks that they execute on a single core.

3.1. Profile Coverage Matrix

Table 1 summarizes the coverage files applicable to each profile. x indicates a mandatory extension, and o indicates an optional extension. The certification test plan handles all mandatory and optional extensions.

Coverage files with multiple extensions in the name apply when all the extensions are supported; for example, ZicsrF is used in a system supporting the Zicsr and F extensions.

All privileged suites require at least version 1.12 of the privileged specification. Features specific to version 1.13 are tested separately in the Sm1p13 and Ss1p13 suites.

Table 1. Profile Coverage Files
Coverage File Description Test Plan RVI20 MC100 RVA22S64 RVB23S64 RVA23S64

XLEN

32/64

32

64

64

64

Unprivileged

I

Integer

Table 18

x

x

x

x

x

M

Mult/Div

Table 21

o

x

x

x

x

Zmmul

Mult Only

Table 23

Zaamo

Atomic Memory Ops

Table 34

o

x

x

x

Zalrsc

Load Reserved / Store Cond

Table 37

o

x

x

x

Zca

Compressed

Table 25

o

x

x

x

x

Zcb

Extra Compressed

Table 32

x

x

Zcf

Compressed Float

Table 28

o

Zcd

Compressed Double

Table 30

o

x

x

x

F

Float

Table 42

o

x

x

x

D

Double

Table 44

o

x

x

x

ZicsrF

Float CSRs

Table 54

o

x

x

x

Zfh

Half

Table 46

o

o

o

Zfhmin

Half Converts

Table 48

x

o

x

Zfa

Additional Float

Table 50

x

x

Zba

Address Generation

Table 56

x

x

x

Zbb

Basic Bit Manipulation

Table 58

x

x

x

Zbc

Carryless Multiplication

Table 60

o

o

o

Zbs

Single-Bit

Table 62

x

x

x

Zbkb

Bit Manip for Crypto

Table 64

o

Zbkc

Carryless Multiply for Crypto

Table 66

o

Zbkx

Permutations

Table 68

o

Zknd

AES Decryption

Table 72

o

Zkne

AES Encryption

Table 70

o

Zknh

SHA2 Hashing

Table 74

o

Zksed

SM4 Cipher

Table 76

o

Zksh

SM3 Hashing

Table 78

o

Zicsr

CSR Instructions

Table 84

x

x

x

x

Zicond

Conditional Move

Table 100

x

x

Zifencei

Instruction Fence

Table 86

o

x

x

x

x

Ziccif

Main Memory Instruction Fetch

Table 92

x

x

x

Ziccrse

Main Memory RsrvEventual

Table 94

x

x

x

Ziccamoa

Main Memory AMOArithmetic

Table 96

x

x

x

Ziccamoc

Main Memory AMOCASQ

Table 98

x

x

Zicclsm

Misaligned Loads / Stores

Table 90

o

o

x

x

x

Zihintpause

Pause Hint

Table 110

x

x

x

Zihintntl

Nontemporal Locality Hint

Table 112

x

x

Zicbom

Cache Block Flush/Inval

Table 117

x

x

x

Zicboz

Cache Block Zero

Table 115

x

x

x

Zicbop

Cache Block Prefetch

Table 119

x

x

x

Za64rs

Max 64B Reservation Sets

Table 121

x

x

x

Zic64b

64B Cache Blocks

Table 123

x

x

x

Privileged

Sm

Machine CSRs

Table 166

x

x

x

x

S

Supervisor CSRs

Table 169

x

x

x

U

User CSRs

Table 171

x

x

x

Zkr

Entropy CSR

Table 174

o

o

o

Exceptions

Exceptions

Table 178

x

x

x

x

InterruptsSm

Machine Interrupts

Table 192

x

x

x

x

InterruptsS

Supervisor Interrupts

Table 196

x

x

x

Sstc

Supervisor Timer Compare

Table 199

x

x

x

Zihpm

Hardware Performance Monitors

Table 106

o

x

x

x

x

EndianSm

Machine Endian

Table 204

EndianS

Supervisor Endian

Table 206

EndianU

User Endian

Table 208

EndianZaamo

AMO Endian

Table 210

EndianZalrsc

LR/SC Endian

Table 211

EndianF

Float Endian

Table 212

EndianZca

Compressed Endian

Table 213

PMP

Physical Memory Protection

[t-PMP-coverpoints]

Svbare

No Virtual Memory

Table 245

x

x

x

Sv

Sv32/39/48/57 Virtual Memory

Table 232

x

x

x

Svinval

TLB Invalidation

Table 248

x

x

x

Svade

Page Table A/D Exceptions

Table 253

x

x

x

Svadu

Page Table Update

Table 255

o

o

Svpbmt

Page-based Memory Types

Table 258

x

x

x

Svnapot

Naturally Aligned Pages

Table 261

o

x

x

Svvptc

Valid PTEs Visible without Fence

Table 264

o

o

Svukte

User Kernel Translation Enable

Table 266

o

o

o

Sscofpmf

Counter Filtering

Table 296

o

x

x

Ssstateen

Supervisor State Enable

Table 301

o

x

Ssu64xl

64-bit UXL

Table 303

o

x

x

Sscounterenw

Counter Enables Writable

Table 305

x

x

x

Sstvecd

Direct Vector

Table 307

x

x

x

Sstvala

stval Addresses

Table 309

x

x

x

Strict

Ssstrict

Strict

Table 215

o

o

o

Vector

Vx8

Vector Integer 8-bit

Table 126

o

o

x

Vx16

Vector Integer 16-bit

Table 126

o

o

x

Vx32

Vector Integer 32-bit

Table 126

o

o

x

Vx64

Vector Integer 64-bit

Table 126

o

o

x

Vls8

Vector Load/Store 8-bit

Table 128

o

o

x

Vls16

Vector Load/Store 16-bit

Table 128

o

o

x

Vls32

Vector Load/Store 32-bit

Table 128

o

o

x

Vls64

Vector Load/Store 64-bit

Table 128

o

o

x

Vf8 (Zvfh)

Vector Float conversions with 8-bit integers

Table 130

o

o

Vf16 (Zvfh)

Vector Float 16-bit

Table 130

o

o

Vf32

Vector Float 32-bit

Table 130

o

o

x

Vf64

Vector Float 64-bit

Table 130

o

o

x

Zvfhmin

Vector half conversions

Table 132

o

o

Zvfbfmin

Vector BF16 Convert

Table 133

o

o

Zvfbfwma

Vector BF16 MAC

Table 135

o

o

Zvbb8

Vector Bit Manip 8-bit

Table 137

o

x

Zvbb16

Vector Bit Manip 16-bit

Table 137

o

x

Zvbb32

Vector Bit Manip 32-bit

Table 137

o

x

Zvbb64

Vector Bit Manip 64-bit

Table 137

o

x

Zvkb8

Vector Crypto Bit Manip 8-bit

Table 141

o

o

Zvkb16

Vector Crypto Bit Manip 16-bit

Table 141

o

o

Zvkb32

Vector Crypto Bit Manip 32-bit

Table 141

o

o

Zvkb64

Vector Crypto Bit Manip 64-bit

Table 141

o

o

Zvbc64

Vector Carryless Mult

[t-Zvbc64-coverpoints]

o

o

Zvkg32

Vector GCM

Table 143

o

o

Zvkned32

Vector Crypt

Table 145

o

o

Zvknha32

Vector Hash 32-bit

Table 147

Zvknhb64

Vector Hash 64-bit

Table 148

o

o

Zvksed32

Vector ShangMi Crypt

Table 150

o

o

Zvksh32

Vector ShangMi Hash

Table 152

o

o

Vector Privileged

ExceptionsVx

Vector Integer Exceptions

Table 290

o

o

x

ExceptionsVf

Vector Float Exceptions

Table 292

o

o

x

ExceptionsVls

Vector Load/Store Exceptions

Table 294

o

o

x

MisalignV

Vector Misalignment

Table 286

o

o

o

SsstrictV

Vector Strict

Table 288

o

o

o

Hypervisor

H

Hypervisor Instructions

Table 267

o

o

x

InterruptsH

Hypervisor Interrupts

Table 269

o

o

x

EndianH

Hypervisor Endian

Table 270

PMPH

Hypervisor PMP

Table 273

o

o

x

Shcounterenw

Counter Enables

Table 274

o

o

x

Shvsatpa

VM Modes Supported

Table 276

o

o

x

Shgatpa

VM x4 Modes Supported

Table 278

o

o

x

Shvstvecd

Direct Vectoring

Table 280

o

o

x

Shvstvala

vstval Addresses

Table 282

o

o

x

Shtvala

htval Addresses

Table 284

o

o

x

Shlcofideleg

Counter Overflow Delegation

[t-Shlcofideleg-coverpoints]

o

o

x

Miscellaneous RV{A/B}23 Extensions

Ss1p13

Supervisor 1p13

Table 313

x

x

Ssnpm

Pointer Masking

Table 315

x

x

Zacas

Atomic Compare-And-Swap

Table 154

o

o

Zabha

Subword Atomics

Table 157

o

o

Zama16b

Main memory PMA supports misaligned atomics within 16-byte regions

Table 341

x

Zicfilp

Landing Pads

Table 324

o

o

Zicfiss

Shadow Stack

[t-Zicfiss_common-coverpoints]

o

o

Zfbfmin

BF16 Convert

Table 52

o

o

Zimop

Maybe-Ops

Table 159

x

x

Zcmop

Compressed Maybe-Ops

Table 161

x

x

Zawrs

Wait on Reservation Set

[t-Zawrs_common-coverpoints]

x

x

SdtrigSm

Debug Triggers

Table 343

o

o

Non-Profile Extensions

E

Embedded 16 Regs

Table 165

Zfinx

Float in Int Regs

Section A.15.2

Zdinx

Double in Int Regs

Section A.15.3

Zhinx

Half in Int Regs

Section A.15.4

Zhinxmin

Half Cvt in Int Regs

Section A.15.5

Q

Quad-Precision Float

Section A.15.6

ZfhQ

Half-Quad Converts

Section A.15.7

ZfhminQ

Half-Quad Converts

Section A.15.7

ZfaQ

Additional Quad

Section A.15.9

ZfaZfhQ

Additional Half-Quad Converts

Section A.15.10

Zcmp

Compressed Push/Pop

none yet

Zcmt

Compressed Table Jumps

none yet

Zilsd

Load/Store Double

Section A.15.13

Zclsd

Compressed Load/Store Double

Section A.16

Smcsrind

Machine Indirect CSRs

Smcsrind Coverpoints

Sscsrind

Supervisor Indirect CSRs

Section B.11.5

SscrindH

Hypervisor Indirect CSR

[t-SscrindH-coverpoints]

o

o

x

Smepmp

Enhanced PMP

Section B.11.6

Smrnmi

Machine Resumable Interrupts

Smrnmi Coverpoints

Ssrnmi

Supervisor Resumable Interrupts

Section B.11.8

Sm1p13

Machine 1p13

Table 349

x

x

Smstateen

Machine State Enable

Table 351

Smcntrpmf

Cycle and Instret Mode Filtering

Section B.11.9

Smcdeleg

Counter Delegation

Smcdeleg Coverpoints

Ssccfg

Counter Delegation

Section B.11.11

SscfgH

Hypervisor Counter Delegation

[t-SscfgH-coverpoints]

Smdbltrp

Machine Double Trap

Smdbltrp Coverpoints

Ssdbltrp

Supervisor Double Trap

Ssdbltrp Coverpoints

SsdbltrpH

Hypervisor Double Trap

[t-SsdbltrpH-coverpoints]

Smnpm

Machine Pointer Masking

Table 320

Smmpm

Pointer Masking

Table 323

SmnpmH

Hypervisor Pointer Masking

[t-SmnpmH-coverpoints]

Smctr

Control Transfer Records

Section B.11.14

SmctrH

Hypervisor Control Transfer Records

[t-SmctrH-coverpoints]

Ssqosid

Quality-of-Service ID

Ssqosid Coverpoints

Debug

DM

Debug Module

none yet

DTM

Debug Transport Module

none yet

Sdext

Debug Mode

none yet

Advanced Interrupt Architecture

Smaia

Machine Advanced Interrupts

Section C.2.2

Ssaia

Supervisor Advanced Interrupts

Section C.2.3

IMSIC

Incoming MSI Controller

Section C.2.4

APLIC

Advanced Platform-Level Interrupt Controller

Section C.3

I/O Memory Management Unit

IOMMU

I/O Memory Management Unit

IOMMU Coverpoints

3.2. Out-of-Scope Extensions

Table 2 lists certain extensions whose behavior is presently outside the scope of certification. An x in the table means the extension is required for that profile. Some of these behaviors are not readily visible at the architectural level of observed program behavior, such as constant-time instructions. Measuring the latency of an instruction with a cycle counter is unreliable because instruction fetch, branch prediction, superscalar issue, and out-of-order execution make the count depend on where the instruction is and what surrounds it, not only on its operand data. PMA properties are implicitly tested by executing instructions that depend on the property, but not tested comprehensively across the entire memory map. Entropy generation requires statistical analysis beyond the present scope of certification. These extensions might be added to scope in the future.

Table 2. Extensions Lacking Architectural Visibility for Certification Testing
Coverage File Description RVI20 uController RVA22S64 RVB23S64 RVA23S64

Zkt

Constant-time scalar crypto

x

x

x

Zvkt

Constant-time vector crypto

x

x

x

Furthermore, the following features are not supported in this version of the certification test plan:

  • sfence.vma, sinval, and hypervisor fences are lightly tested because it is hard to prove they don’t work

  • Physical Memory Attributes (PMA): no standard representation yet; tests assume programs run in main memory with full capabilities. TODO: Add a mechanism to define memory region PMAs in UDB, and exercise each type of access (load/store/execute, misaligned, at start/middle/end/partially wrapping) to each region.

  • Testing privilege modes whose XLEN differs from MXLEN; low ROI

  • Testing extensions that have been disabled with misa fields; behavior is unspecified.

  • Non-Maskable Interrupts (NMI) - no standard way to generate them yet

  • Reset behavior - no way for a program to reset itself

  • Delegation of MEI/MTI/MSI to S-mode - "most platforms will choose not to make these interrupts delegatable from M-mode to S-mode"

  • Multicore or multi-master systems; current tests only run on one core and atomics and memory consistency are only lightly tested. TODO: coming later.

  • Custom extensions

A hart with these features can still be certified if it meets all other requirements; these features are simply not tested.

4. General Test Plan Strategy

This CTP describes tests for all supported RISC-V profiles, but the tests run on a specific DUT. The DUT memory map is defined by a Linker Script. The DUT configuration is described with RISC-V Unified Database, and supplementary files such as simulator configuration files are (TODO) automatically generated from the UDB so there is a single configuration file to maintain. The UDB describes the supported extensions, and also has parameters defining optional behaviors of those extensions. If a behavior is UNSPECIFIED in the specification, it is not tested because there are no wrong answers. A common purpose of parameters is to define the behavior of WARL fields in CSRs.

4.1. Configuration

The DUT is described with a Unified Database (UDB) YAML file. This file lists:

  • all of the supported extensions

  • all of the parameters required to describe the behavior of the extensions

The DUT also needs to know how to boot the core, terminate a test with a success code, send a message to a console, and cause interrupts. These DUT-specific behaviors are defined by RVMODEL DUT-Specific Macros, which are an assembly-language library implementing an API using DUT-specific hardware.

4.2. Unified Database

Unified Database allows partially- and fully-configured descriptions. A profile is an example of a partially configured description because it has a mix of required and optional extensions, and does not specify parameter values for most of the extensions. A DUT needs to have a fully configured description including precisely which versions of which extensions are supported and what parameter values are implemented, so that a simulator can exactly match its behavior.

The certification framework requires a fully-configured UDB description of the DUT and RVMODEL macros for the DUT. It uses UDB to produce supplementary configuration files including:

  • JSON file configuring the RISC-V Sail reference model to match the DUT

  • Configuration files for other optional simulators, such as Spike, ImperasFPM

  • SystemVerilog coverage.svh file describing which coverage files and parameter values to use for coverage measurement

  • Optional DUT configuration files (CORE-V Wally Example) providing parameter values to configurable RTL

4.2.1. Configuration Parameters

The UDB parameters for each extension are defined in:

  • The CSC Tests and Models working group developed the following list of configuration parameters. Need to check if they match the parameters in UDB extensions.

A partially-configured UDB description of each profile is given in:

4.3. Unspecified and Reserved Behaviors

Some RISC-V behaviors are UNSPECIFIED, which means an implementation can do anything. These behaviors are not tested because there is no wrong answer. Table 3 summarizes the normative rules regarding reserved behaviors.

Unimplemented opcodes (except in the custom space) and instructions accessing non-existent CSRs are reserved. The behavior of reserved instructions is UNSPECIFIED, so they should not be tested by most testplans. However, when the Ssstrict extension is enabled, reserved instructions raise an illegal instruction exception. This is tested by the Ssstrict_S test plan.

Table 3. I Normative Rules Regarding Behaviors
Spec Section Normative Rule

Unpriv 1.7

The term UNSPECIFIED refers to a behavior or value that is intentionally unconstrained.

Unpriv 2.2

For this purpose, we divide each RISC-V instruction-set encoding space (and related encoding spaces such as the CSRs) into three disjoint categories: standard, reserved, and custom. …​ Reserved encodings are currently not defined but are saved for future standard extensions; once thus used, they become standard encodings. …​ The behavior upon decoding a reserved instruction is UNSPECIFIED.

Privileged 2.1

Instructions that access a non-existent CSR are reserved.

rva23-profile

Ssstrict No non-conforming extensions are present. Attempts to execute unimplemented opcodes or access unimplemented CSRs in the standard or reserved encoding spaces raises an illegal instruction exception that results in a contained trap to the supervisor-mode trap handler.

TODO: Generate this table from norm rules via YAML when Ssstrict is tagged. Expand on definition of Ssstrict in light of github.com/riscv/riscv-isa-manual/issues/3258.

4.4. CSR Bitfields

CSR fields can be Write Preserves, Read Ignores (WPRI), Write Legal, Read Legal (WLRL), or Write Any, Read Legal (WARL). Examples of WPRI fields include undefined fields of xstatus, xenvcfg, mseccfg, and xstateen* that could have unintended side effects if they are subsequently defined and unwittingly set to nonzero values. Examples of WLRL fields include xcause.ExceptionCode and hstatus.VGEIN. Other CSR fields are generally WARL.

WPRI fields should be read-only zero if not furnished by the implementation, but are not tested because the test suite may be unaware of subsequently ratified extensions that furnish them. WLRL fields are tested with legal values but no illegal values. Similarly, WARL fields are tested with legal values. The legalization of illegal values is implementation-specific and can be difficult to convey to a reference model for multibit fields, so WARL fields are not tested with illegal values unless it is easy to determine their legality (e.g. 1-bit fields). Reserved values are never tested in CSRs because the behavior is implementation-defined.

Instructions and CSRs in the custom encoding space are never tested because the behavior is implementation-defined.

Table 4 summarizes the normative rules regarding CSR bitfields.

Table 4. I Normative Rules Regarding Bitfields
Spec Section Normative Rule

Privileged 2.3

Some whole read/write fields are reserved for future use. Software should ignore the values read from these fields, and should preserve the values held in these fields when writing values to other fields of the same register. For forward compatibility, implementations that do not furnish these fields must make them read-only zero. These fields are labeled WPRI in the register descriptions.

Privileged 2.3

Some read/write CSR fields specify behavior for only a subset of possible bit encodings, with other bit encodings reserved. Software should not write anything other than legal values to such a field, and should not assume a read will return a legal value unless the last write was of a legal value, or the register has not been written since another operation (e.g., reset) set the register to a legal value. These fields are labeled WLRL in the register descriptions.

Privileged 2.3

Implementations are permitted but not required to raise an illegal-instruction exception if an instruction attempts to write a non-supported value to a WLRL field. Implementations can return arbitrary bit patterns on the read of a WLRL field when the last write was of an illegal value, but the value returned should deterministically depend on the illegal written value and the value of the field prior to the write.

Privileged 2.3

Some read/write CSR fields are only defined for a subset of bit encodings, but allow any value to be written while guaranteeing to return a legal value whenever read. Assuming that writing the CSR has no other side effects, the range of supported values can be determined by attempting to write a desired setting then reading to see if the value was retained. These fields are labeled WARL in the register descriptions.

Privileged 2.3

Implementations will not raise an exception on writes of unsupported values to a WARL field. Implementations can return any legal value on the read of a WARL field when the last write was of an illegal value, but the legal value returned should deterministically depend on the illegal written value and the architectural state of the hart.

TODO: replace with references to normative rules tagged in spec.

4.5. Normative Rules

The testplan for each extension contains a list of normative rules applicable to that extension. Normative rules are generally direct quotations from a ratified RISC-V specification describing a single certifiable feature. Normative rules specify the behaviors an implementation must meet in order to be compliant with the standard. In particular, introductory overview and non-normative explanatory text is not quoted as a normative rule.

See tagging_normative_rules for more information about normative rules and IDs and how to tag them in the specification.

4.6. Coverpoints

Coverpoints are written with one file that covers both RV32 and RV64, to reduce the duplication and risk of becoming out of sync. When a coverage file contains coverpoints that apply only to one XLEN or the other (e.g. 32 or 64-bit edge values), they are separated by `ifdef UDB_MXLEN_32 or UDB_MXLEN_64 directives. Similarly, when a coverpoint applies only to a certain parameter value (PMP NA4 regions are not supported for granularity coarser than 4 bytes), they uses `ifdef to exclude tests based on the parameter value.

Not all normative rules have coverpoints and tests. A normative rule that a behavior is UNSPECIFIED is not tested because there is no wrong answer. For example, writing satp.MODE = Bare with nonzero values in other fields has unspecified behavior and is untested. The CTP may declare that other normative rules are too difficult to test relative to their value (low return on investment) and choose not to test them. For example, if the Zcf extension is supported, misa.C depends on whether misa.F is supported. misa.F is WARL and may be read-only one, so it is not always possible to test the misa.C dependence on misa.F = 0 and, for simplicity, this dependence might never be tested.

To the extent that there are any normative rules associated with instruction opcodes or CSR numbers, if these rules can be tested by coverpoints that execute the instruction or access the CSR, then no other coverpoints are needed. For example, a normative rule that an add instruction has op = 0110011, funct3 = 000, and funct7 = 0000000 is tested by the ordinary coverpoints that exercise the add instruction.

4.7. Tests

Privileged tests are mostly generated by scripts. They preferably share a single .S file that can be compiled for either RV32 or RV64, again with ifdef directives to separate the two. Unprivileged tests are generated from a template using a Python script, and are divided into RV32 and RV64 directories because the random values differ with XLEN.

5. Test Suite Requirements

The test suites may be provided by multiple suppliers, but must meet a common set of requirements to interoperate transparently for the user:

  • All tests use a common set of DUT configuration files so the user only has to write them once:

    • <dut>.yaml for the UDB configuration including supported extensions and parameter values

    • rvmodel_macros.h for the RVMODEL DUT-Specific Macros

    • link.ld for the linker script

  • All tests are self-checking

    • Able to run on simulators, RTL, and hardware

    • Expected values may be produced by the RISC-V Sail reference model or the test code itself, and must account for relevant parameters

      • Alternate reference model may be used for development until RISC-V Sail is sufficiently mature

    • Only test features whose behavior is specified for the given parameters (e.g. only test unimplemented instructions if Ssstrict is supported)

    • Calls RVMODEL_BOOT for DUT-specific boot code (can be empty or omitted) before starting the test

    • Test begins in machine mode, if any privileged modes are implemented

    • Terminate with RVMODEL_HALT_PASS or RVMODEL_HALT_FAIL to indicate success

    • Print meaningful information to localize a failure with RVMODEL_IO_WRITE_STR, including:

      • PC at failure point

      • Expected and actual values of mismatching registers

      • Name of coverpoint and bin that failed, if practical

    • Tests should not contain loops over multiple bins. Each bin of each coverpoint should be tested by a unique instruction so that a failing bin can be uniquely identified from the program counter. Loops should go in the test generator instead of the test itself.

  • Tests are organized in a granular way so that each ISA feature can be tested independently of other features

  • All tests are written in assembly or C and work with the latest release of both GCC and Clang

    • The latest release is typically needed because new extensions are rapidly being added to these compilers

    • Certificates will be tied to specific compiler versions to ensure consistency

  • Qualifying each test includes running on the RISC-V Sail reference model, Spike, and Whisper for at least one choice of parameters

    • Exceptions can be made for specific tests when there are known bugs or unimplemented extensions

  • Tests are for certification, not verification

    • Every normative rule is addressed by at least one coverpoint, defined in the CTP

      • Specific normative rules can be omitted from testing if they are not testable. In this case, the rule should still be listed in the CTP and should be explicitly marked as not tested

    • Every test is directed to a specific normative rule/coverpoint bin, not fuzzing in the hopes of randomly hitting a rule/coverpoint

      • Exception: Multicore memory ordering is necessarily nondeterministic

    • Tests emphasize RISC-V architectural behavior, not microarchitectural behavior such as complex pipeline hazards or timing

    • Runtime is important

    • Size is important

  • All tests have SystemVerilog coverpoints

    • Use standard syntax compatible with Questa, VCS and Xcelium (regression on at least Questa)

    • All coverpoints must use the RVVI interface

  • All testing collateral (tests, test generators, coverpoints, frameworks, documentation, etc.) are owned by RVI and distributed under an open-source license ** TODO: Jeff/Tom/Moiz to update this section

    • Hosted in the RISC-V architectural test repository under the stewardship of Architectural Certification Test (ACT) SIG

    • Repository contains tests for ratified and in-development features, not just features in certificates

    • Generators necessary to recreate the tests for a DUT are included in the repository, but, when tests are not unique to a DUT, the generated tests themselves are also included to reduce requiring users to run generators and to make the tests easier to view and understand

  • Don’t let the perfect be the enemy of the good

    • If necessary to meet schedule, tests can be released addressing most of the normative rules and coverpoints for a feature, and improved over time

    • Initial test development prioritizes the common parameter choices (such as XLEN=MXLEN, Endian=Little), and other parameter choices can be added over time

    • All limitations must be documented in CTP

5.1. For discussion:

  • Testing of WARL, WLRL, WPRI fields, and the necessary parameters to define what fields should be tested and behaviors should be expected, in collaboration with the Parameters Working Group

  • Regression requirements, including multiple parameters

6. Abstraction Layer

The abstraction layer provides a set of macros that allow test programs and coverpoints to interact with the DUT in a platform-specific way. This allows the same test program and coverpoint source code to be used across different DUTs, with only the abstraction layer macros needing to be modified for each DUT. In particular, the abstraction layer includes

  • Boot macros to initialize state.

  • Trap handler

  • Supervisor Binary Interface (SBI) calls

  • RVMODEL DUT-specific macros (semihosting/trick box)

  • Memory map (linker script)

Fundamental design considerations are:

  • For unprivileged extensions, RISC-V tests cannot assume the existence of any privileged capabilities whatsoever unless a profile explicitly requires them. For example, RV32I tests should be able to run on a microcontroller that does not implement any CSRs, including mtvec, and thus cannot have a trap handler.

  • Even if machine-mode exists, the tests cannot assume the existence of a Standard Machine Mode, i.e. a machine mode that implements all of the features in the ISA specification. A DUT might implement a Custom Machine Mode, such as a minimal implementation for a specific application, or additional security features. In particular, the RVA23S64 profile of particular interest for certification does not require standard M-mode, only an execution environment that responds to certain things such as ecall.

  • Nevertheless, most users will implement standard M-mode on their DUT. Therefore, the abstraction layer should provide default implementations of boot macros, trap handler, and SBI calls that assume a standard M-mode, and users can override these implementations as needed for their DUT.

  • To reduce the risk of bugs from uninitialized state and the burden on test developers, the boot process places known values in all applicable GPRs and CSRs.

The boot sequence boots to the lowest available privilege mode sufficient to run the tests. Tests may define the BOOT_TO_MMODE or BOOT_TO_SMODE symbols to force booting to M-mode or S-mode, respectively, if the DUT supports those modes. If neither symbol is defined, the boot sequence boots to U-mode if supported, and M-mode (possibly custom) otherwise. Note that hypervisor tests should define BOOT_TO_SMODE to boot into S (effectively HS)-mode and then are responsible for setting up and switching to VS/VU mode if desired.

In the ACT framework, BOOT_TO_MMODE is defined when REQUIRED_EXTENSIONS contains Sm. BOOT_TO_SMODE is defined when REQUIRED_EXTENSIONS contains S. Otherwise, neither symbol is defined. Hence, privileged tests that specify Sm, S, or U will boot into these modes, respectively. Unprivileged tests run in U-mode if supported, and in M-mode (possibly custom) otherwise. Another consequence is that if the DUT defines STANDARD_SM_SUPPORTED, then the trap handler is enabled even for unprivileged tests, helping produce graceful error messages for illegal instructions. However, a simple core such as an RV32I microcontroller may not enable STANDARD_SM_SUPPORTED and will not set up a trap handler.

6.1. Controlling Parameters

Every DUT has S_SUPPORTED, U_SUPPORTED, and H_SUPPORTED parameters from the UDB that indicate which privilege modes are supported. All DUT UDB configs support Sm, but not necessarily standard M-mode (and possibly no CSRs at all). Therefore, the DUT’s rvmodel_macros.h defines STANDARD_SM_SUPPORTED when the DUT implements mandatory portions of the M-mode spec, and leaves it undefined otherwise.

A DUT with no CSRs at all, such as an RV32I microcontroller, still declares Sm in its UDB config, because UDB defines MXLEN only when Sm is implemented, but does not declare Zicsr. It leaves STANDARD_SM_SUPPORTED undefined, so the boot code and trap handler touch no CSRs, and sets include_priv_tests: False in its test_config.yaml, so the privileged tests that the Sm declaration would otherwise select are skipped. config/cores/picorv32/picorv32-rv32imc is an example.

6.2. Boot Sequence

The user is responsible for loading the test ELF onto the DUT and jumping to rvtest_entry_point. The user may optionally run some other firmware or custom boot loader that performs DUT-specific initialization before loading the test ELF.

The test ELF begins with the RVTEST_BEGIN macro, which defines rvtest_entry_point (at an address specified in the link.ld file), and jumps to rvmodel_boot.

rvmodel_boot in turn calls the RVMODEL_BOOT macro, which optionally contains DUT-specific boot code such as turning on a PLL or memory controller. This macro can be empty or undefined in the common case that no DUT-specific boot code is required or that the DUT-specific boot is performed earlier by a separate bootloader.

Next, rvmodel_boot calls RVMODEL_IO_INIT to perform any necessary I/O initialization, such as configuring baud rate and flow control in a UART. This macro can also be empty or undefined if no I/O initialization is needed.

Next, rvmodel_boot calls RVTEST_BOOT_TO_MMODE to set up the trap handlers and initialize M-mode CSRs. This macro first checks if RVMODEL_BOOT_TO_MMODE is defined. If undefined, it runs default boot code assuming standard M-mode. If defined, it runs the DUT-specific RVMODEL_BOOT_TO_MMODE that performs the same general steps for custom M-mode. The default boot code touches CSRs only when STANDARD_SM_SUPPORTED is defined, so a DUT with no M-mode CSRs, such as an RV32I DUT, leaves both STANDARD_SM_SUPPORTED and RVMODEL_BOOT_TO_MMODE undefined.

CSR initialization includes

  • mie/mip = 0 (disable all interrupts)

  • mideleg/medeleg = 0 (don’t delegate traps unless turned on during S-mode boot)

  • mstatus (SXLEN/UXLEN = MXLEN, SBE/UBE = MBE, other features off)

  • menvcfg (enable unpriv features if U supported)

  • mstateen0 (enable unpriv features if SMSTATEN_SUPPORTED)

  • mcountinhibit = 0 (if implemented)

  • mhpmenvent3…​31/h = 0

  • mseccfg (disable features if supported)

  • mnstatus (disable resumable NMI fields if SMRNMI_SUPPORTED)

  • pmpaddr0/pmpcfg0 if PMP_ENTRIES > 0

  • turn off virtual memory and perform sfence.vma to synchronize MMU if SV32_SUPPORTED or SV39_SUPPORTED

Even if standard M-mode is not supported or RVMODEL_BOOT_TO_MMODE is defined, the boot code still attempts to turn on mstatus.FS/VS if float or vector is supported, because these are needed for unprivileged tests, even on a RV32I DUT that has no other M-mode features.

The boot process ends in M-mode if the BOOT_TO_MMODE symbol is defined in the test (for tests intended to run in machine mode), or if no lower privilege mode is supported.

If the test is continuing to boot to a lower privilege mode, it next checks if S_SUPPORTED and, if so, calls RVTEST_BOOT_TO_SMODE. This initializes S-mode CSRs, and adjusts M-mode CSRs such as trap delegation and environment configuration. It then enters S-mode. A DUT with a nonstandard M-mode replaces the reference T-SEE rather than this routine.

S-mode CSR initialization includes

  • medeleg = 0xFCB5FF (delegate all exceptions except for ecall from M and S mode, and double traps)

  • mideleg = 0x366 (delegate all user and supervisor-mode interrupts, including counter overflow)

  • sstateen0 (enable unprivileged features if SSSTATEEN)

  • scounteren = all 1s (enable counter access from lower priv modes)

  • senvcfg (enable unpriv features)

The boot process ends in S-mode if the BOOT_TO_SMODE symbol is defined in the test (for tests intended to run in supervisor mode).

If the test is not intended to run in S-mode, and U-mode is supported, rvmodel_boot calls RVTEST_BOOT_TO_UMODE, which switches to U-mode through T-SBI.

Finally, rvmodel_boot clears the trap counter and runs RVTEST_INIT_REGS, which initializes the integer, floating-point and vector registers, then sets up the signature pointer and checks a canary if applicable. It then jumps to rvtest_code_begin to start the test.

6.3. RVMODEL DUT-Specific Macros

Each DUT requires implementing a set of macros to perform the following non-ISA functions:

  • Run DUT-specific boot code

  • Terminate a test with a pass or fail indication

  • Send a character to a terminal

  • Deliver each supported type of interrupt to the core (Machine/Supervisor External/Timer/Software + guest external interrupts)

The macro names begin with RVMODEL, so they are called RVMODEL DUT-Specific Macros. Their functions are sometimes called semihosting or trick box.

The RVMODEL DUT-Specific Macros rely on the capabilities of the SoC and/or testbench. For example, a SoC with a 16550-compatible UART sends a character by writing a byte to the UART’s memory-mapped Transmit Holding Register. A SoC without a UART may have a testbench that monitors writes to a specific memory address and prints the byte written to that address.

6.3.1. Macros

The RVMODEL DUT-Specific Macros are given in Table 5. The "Can Be Empty?" field indicates circumstances under which the macro can be empty. The Mode column indicates the privilege mode from which the macro can be called. All macros can clobber a0, a1, and a2 if needed to make T-SBI calls.

Table 5. RVMODEL DUT-Specific Macros
Macro Description Can be Empty? Mode

RVMODEL_BOOT

Perform boot operations, such as turning on a phase-locked loop or DRAM controller or initializing custom state. Cannot clobber x1/ra, but any other registers may be trashed.

Empty or omitted if no boot operations are needed, or a separate DUT-specific executable is used for booting before loading and invoking the test ELF.

Machine

RVMODEL_BOOT_TO_MMODE

Replaces the default M-mode boot in RVTEST_BOOT_TO_MMODE (trap handler setup and M-mode CSR initialization) for a DUT with a custom M-mode that cannot run it. It must leave the trap handlers set up as the default does.

Omit for a standard M-mode, and for a DUT with no M-mode CSRs that leaves STANDARD_SM_SUPPORTED undefined.

Machine

RVMODEL_HALT_PASS

Terminate test with a pass indication. When the test is run in simulation, this should end the simulation.

No

Any

RVMODEL_HALT_FAIL

Terminate test with a fail indication. When the test is run in simulation, this should end the simulation.

No

Any

RVMODEL_IO_INIT(_R1, _R2, _R3)

Initialization steps needed prior to writing to the console. _R1, _R2, and _R3 are temporary registers that may be trashed by the macro.

Empty or omitted if no I/O initialization is needed.

Machine

RVMODEL_IO_WRITE_STR(_R1, _R2, _R3, _STR_PTR)

Write a null-terminated ASCII string to the console, where _R1, _R2, and _R3 are temporary registers that may be trashed by the macro and _STR_PTR is a register containing the address of the first byte of the string.

If the console is unavailable and the user implements an alternate way to signal success (such as test bench reporting or colored LEDs controlled by RVMODEL_HALT). However, a console is required for certification.

Any

RVMODEL_SET_MEXT_INT(_R1, _R2)

Sets the Machine External Interrupt mip.MEIP using platform-specific interrupt controller, if supported. _R1 and _R2 are temporary registers that may be trashed by the macro. Uses T-SBI if necessary to access controller from any privilege mode.

If machine external interrupts are not tested.

Any

RVMODEL_SET_MEXT_INT_M(_R1, _R2)

Sets the Machine External Interrupt mip.MEIP using platform-specific interrupt controller. _R1 and _R2 are temporary registers that may be trashed by the macro. Only runs in machine mode, so it is usable without making a T-SBI call. Leave undefined to use non-M version. Must be defined if RVMODEL_SET_MEXT_INT uses T-SBI.

If machine external interrupts are not tested.

Machine

RVMODEL_CLR_MEXT_INT(_R1, _R2)

Clears the Machine External Interrupt mip.MEIP using platform-specific interrupt controller. _R1 and _R2 are temporary registers that may be trashed by the macro. Uses T-SBI if necessary to access controller from any privilege mode.

If machine external interrupts are not supported.

Any

RVMODEL_CLR_MEXT_INT_M(_R1, _R2)

Clears the Machine External Interrupt mip.MEIP using platform-specific interrupt controller. _R1 and _R2 are temporary registers that may be trashed by the macro. Only runs in machine mode, so it is usable within a M-mode interrupt handler without making a T-SBI call. Leave undefined to use non-M version. Must be defined if RVMODEL_CLR_MEXT_INT uses T-SBI.

If machine external interrupts are not tested.

Machine

RVMODEL_SET_MSW_INT(_R1, _R2)

Sets the Machine Software Interrupt mip.MSIP using a memory-mapped control register, if supported. _R1 and _R2 are temporary registers that may be trashed by the macro. Uses T-SBI if necessary to access controller from any privilege mode.

If RVMODEL_MSIP_ADDRESS is defined or machine software interrupts are not tested.

Any

RVMODEL_SET_MSW_INT_M(_R1, _R2)

Sets the Machine Software Interrupt mip.MSIP using a memory-mapped control register, if supported. _R1 and _R2 are temporary registers that may be trashed by the macro. Only runs in machine mode, so it is usable without making a T-SBI call. Leave undefined to use non-M version. Must be defined if RVMODEL_SET_MSW_INT uses T-SBI.

If RVMODEL_MSIP_ADDRESS is defined or machine software interrupts are not tested.

Machine

RVMODEL_CLR_MSW_INT(_R1, _R2)

Clears the Machine Software Interrupt mip.MSIP using a memory-mapped control register. _R1 and _R2 are temporary registers that may be trashed by the macro. Uses T-SBI if necessary to access controller from any privilege mode.

If RVMODEL_MSIP_ADDRESS is defined and accessible from lower privilege modes or if machine software interrupts are not tested.

Any

RVMODEL_CLR_MSW_INT_M(_R1, _R2)

Clears the Machine Software Interrupt mip.MSIP using a memory-mapped control register. _R1 and _R2 are temporary registers that may be trashed by the macro. Only runs in machine mode, so it is usable within a M-mode interrupt handler without making a T-SBI call. Leave undefined to use non-M version. Must be defined if RVMODEL_CLR_MSW_INT uses T-SBI.

If RVMODEL_MSIP_ADDRESS is defined or machine software interrupts are not tested.

Machine

RVMODEL_SET_SEXT_INT(_R1, _R2)

Sets the Supervisor External Interrupt sip.SEIP using platform-specific interrupt controller, if supported. _R1 and _R2 are temporary registers that may be trashed by the macro. Uses T-SBI if necessary to access controller from any privilege mode.

If supervisor external interrupts are not supported.

Any

RVMODEL_SET_SEXT_INT_M(_R1, _R2)

Sets the Supervisor External Interrupt sip.SEIP using platform-specific interrupt controller. _R1 and _R2 are temporary registers that may be trashed by the macro. Only runs in machine mode, so it is usable without making a T-SBI call. Leave undefined to use non-M version. Must be defined if RVMODEL_SET_SEXT_INT uses T-SBI.

If supervisor external interrupts are not supported.

Machine

RVMODEL_CLR_SEXT_INT(_R1, _R2)

Clears the Supervisor External Interrupt sip.SEIP using platform-specific interrupt controller. _R1 and _R2 are temporary registers that may be trashed by the macro. Uses T-SBI if necessary to access controller from any privilege mode.

If supervisor external interrupts are not supported.

Any

RVMODEL_CLR_SEXT_INT_M(_R1, _R2)

Clears the Supervisor External Interrupt sip.SEIP using platform-specific interrupt controller. _R1 and _R2 are temporary registers that may be trashed by the macro. Only runs in machine mode, so it is usable within a M-mode interrupt handler without making a T-SBI call. Leave undefined to use non-M version. Must be defined if RVMODEL_CLR_SEXT_INT uses T-SBI.

If supervisor external interrupts are not supported.

Machine

RVMODEL_SET_SSW_INT(_R1, _R2)

Sets the Supervisor Software Interrupt sip.SSIP using a platform-specific interrupt controller, if supported. _R1 and _R2 are temporary registers that may be trashed by the macro. Uses T-SBI if necessary to access controller from any privilege mode.

If there is no platform-specific interrupt controller for SSI or no supervisor software interrupts.

Any

RVMODEL_SET_SSW_INT_M(_R1, _R2)

Sets the Supervisor Software Interrupt sip.SSIP using a platform-specific interrupt controller, if supported. _R1 and _R2 are temporary registers that may be trashed by the macro. Only runs in machine mode, so it is usable without making a T-SBI call. Leave undefined to use non-M version. Must be defined if RVMODEL_SET_SSW_INT uses T-SBI.

If there is no platform-specific interrupt controller for SSI or no supervisor software interrupts.

Machine

RVMODEL_CLR_SSW_INT(_R1, _R2)

Clears the Supervisor Software Interrupt sip.SSIP by using a platform-specific interrupt controller, if supported. _R1 and _R2 are temporary registers that may be trashed by the macro. Uses T-SBI if necessary to access controller from any privilege mode.

If there is no platform-specific interrupt controller for SSI or no supervisor software interrupts.

Any

RVMODEL_CLR_SSW_INT_M(_R1, _R2)

Clears the Supervisor Software Interrupt sip.SSIP by using a platform-specific interrupt controller, if supported. _R1 and _R2 are temporary registers that may be trashed by the macro. Only runs in machine mode, so it is usable within a M-mode interrupt handler without making a T-SBI call. Leave undefined to use non-M version. Must be defined if RVMODEL_CLR_SSW_INT uses T-SBI.

If there is no platform-specific interrupt controller for SSI or no supervisor software interrupts.

Machine

RVMODEL_SET_GUEST_EXT_INT(_GEI, _R1, _R2)

Sets bit _GEI of hgeip, the guest external interrupt pending register, using a platform-specific interrupt controller such as an IMSIC guest interrupt file. _GEI is a register holding the guest external interrupt number, 1 to GEILEN. _GEI, _R1 and _R2 may be trashed by the macro; the framework passes a0, a1 and a2, the registers a T-SBI call uses. Uses T-SBI if necessary to access controller from any privilege mode. Required when H is supported with GEILEN (NUM_EXTERNAL_GUEST_INTERRUPTS) > 0.

If the hypervisor extension is not supported or GEILEN is 0. A platform that cannot raise guest external interrupts must declare GEILEN = 0.

Any

RVMODEL_SET_GUEST_EXT_INT_M(_GEI, _R1, _R2)

Sets bit _GEI of hgeip as RVMODEL_SET_GUEST_EXT_INT does. Only runs in machine mode, so it is usable without making a T-SBI call. Leave undefined to use non-M version. Must be defined if RVMODEL_SET_GUEST_EXT_INT uses T-SBI.

If the hypervisor extension is not supported or GEILEN is 0.

Machine

RVMODEL_CLR_GUEST_EXT_INT(_GEI, _R1, _R2)

Clears bit _GEI of hgeip. _GEI, _R1 and _R2 are as for RVMODEL_SET_GUEST_EXT_INT. Uses T-SBI if necessary to access controller from any privilege mode.

Must be defined if RVMODEL_SET_GUEST_EXT_INT is.

Any

RVMODEL_CLR_GUEST_EXT_INT_M(_GEI, _R1, _R2)

Clears bit _GEI of hgeip. Only runs in machine mode, so it is usable within a M-mode interrupt handler without making a T-SBI call. Leave undefined to use non-M version. Must be defined if RVMODEL_CLR_GUEST_EXT_INT uses T-SBI.

If the hypervisor extension is not supported or GEILEN is 0.

Machine

RVMODEL_HPM_COUNTER

The index, 3 to 31, of the HPM counter used by the Sscofpmf tests. The tests derive the mhpmevent and mhpmcounter CSRs, and their RV32 high halves, from it.

If Sscofpmf is not supported.

n/a

RVMODEL_MHPMEVENT_VAL

The event selector written to bits 55:0 of the selected mhpmevent CSR so that RVMODEL_MHPMEVENT_CODE increments the selected counter. The Sail reference model does not have to count the same event: its build runs a fence in place of RVMODEL_MHPMEVENT_CODE, so map EV_FENCE to this selector value in event_selectors of the DUT’s sail.json. An event that counts every instruction or cycle is acceptable: the tests preset the counter with counting inhibited, and inhibit counting in the modes above the one under test so that the T-SBI trap handler is not counted. 0 if the DUT cannot count any event; leave event_selectors empty, and the overflow checks are vacuous.

If Sscofpmf is not supported.

n/a

RVMODEL_MHPMEVENT_CODE(_R1, _R2)

Code that makes the selected counter increment one or more times in the current privilege mode. The tests check that the counter moved, not by how much. _R1 holds the address of a writable scratch word; _R2 may be trashed. The code must not trap, and it must assemble to 4 bytes.

If Sscofpmf is not supported.

Any

RVMODEL_ACCESS_FAULT_ADDRESS

The base physical address of a region that causes a precise access fault when any part of the region is read, written or fetched. This is used to test exceptions. The faulting region must be at least 128 bytes; if vector fault-only-first loads are tested, it must be at least ceil(VLEN*LMUL/8) bytes (the vector coverpoints exercise up to 2*VLEN/8 bytes with LMUL=2). For typical implementations where address 0 is unmapped, the entire first page satisfies both requirements. It is the default value of each RVMODEL_ACCESS_FAULT_ADDRESS_<TYPE> macro below. See [access-fault-address].

Omit if the DUT does not generate access faults, or if it defines only some RVMODEL_ACCESS_FAULT_ADDRESS_<TYPE> macros.

n/a

RVMODEL_ACCESS_FAULT_ADDRESS_LOAD

The base physical address of a region that gives a precise load access fault. Used for scalar, floating-point, compressed, hypervisor, and vector loads. The size requirements of RVMODEL_ACCESS_FAULT_ADDRESS apply.

Defaults to RVMODEL_ACCESS_FAULT_ADDRESS. Omit, with RVMODEL_ACCESS_FAULT_ADDRESS, if the DUT cannot give precise load access faults.

n/a

RVMODEL_ACCESS_FAULT_ADDRESS_STORE

The base physical address of a region that gives a precise store/AMO access fault for a store. Used for scalar, floating-point, compressed, hypervisor, and vector stores, and for cache-block operations. The size requirements of RVMODEL_ACCESS_FAULT_ADDRESS apply.

Defaults to RVMODEL_ACCESS_FAULT_ADDRESS. Omit, with RVMODEL_ACCESS_FAULT_ADDRESS, if the DUT cannot give precise store access faults.

n/a

RVMODEL_ACCESS_FAULT_ADDRESS_FETCH

The base physical address of a region that gives an instruction access fault when code is fetched from it.

Defaults to RVMODEL_ACCESS_FAULT_ADDRESS. Omit, with RVMODEL_ACCESS_FAULT_ADDRESS, if the DUT cannot give precise instruction access faults.

n/a

RVMODEL_ACCESS_FAULT_ADDRESS_AMO

The base physical address of a region that gives a precise store/AMO access fault for a Zaamo AMO.

Defaults to RVMODEL_ACCESS_FAULT_ADDRESS. Omit, with RVMODEL_ACCESS_FAULT_ADDRESS, if the DUT cannot give precise AMO access faults.

n/a

RVMODEL_ACCESS_FAULT_ADDRESS_LRSC

The base physical address of a region that gives a precise access fault for lr (load access fault) and sc (store/AMO access fault).

Defaults to RVMODEL_ACCESS_FAULT_ADDRESS. Omit, with RVMODEL_ACCESS_FAULT_ADDRESS, if the DUT cannot give precise LR/SC access faults.

n/a

RVMODEL_MSIP_ADDRESS

The address of the memory-mapped msip register, used to set and clear machine software interrupts (mip.MSIP).Formally defined only for Sm version 1.13 and above; preferred over RVMODEL_SET_MSW_INT if msip exists.

Omit if machine software interrupts are not tested or require a platform-specific controller.

n/a

RVMODEL_MTIME_ADDRESS

The address of the memory-mapped mtime register, used for timer accesses and interrupts.

Omit only if machine timer interrupts are not implemented and Sstc, if implemented, has Zicntr to read time.

n/a

RVMODEL_MTIMECMP_ADDRESS

The address of the memory-mapped mtimecmp register, used for timer interrupts.

Omit if machine timer interrupts are not implemented.

n/a

RVMODEL_INTERRUPT_LATENCY

Expected latency (in cycles/NOPs) for interrupt trap processing. Ensures interrupt is received and can be processed before test continues.

Can be 0 if interrupt controller adds no delay. Omit if the DUT has neither standard M-mode (STANDARD_SM_SUPPORTED) nor S-mode.

n/a

RVMODEL_TIMER_INT_SOON_DELAY

The delay (in timer ticks) before a timer interrupt fires when an interrupt is requested "soon". Used in logic such as mtimecmp = mtime + delay. Must be long enough for the test to return from the RVTEST_SET_*INT_SOON* routine and reach the instruction under test before the interrupt fires. When the test runs below machine mode that routine takes a T-SBI round trip through the machine-mode trap handler, so the delay must cover an ecall, the handler, and the return to the original mode.

If timer interrupts, wfi, and wrs are not tested. Omit if the DUT has neither standard M-mode (STANDARD_SM_SUPPORTED) nor S-mode.

n/a

RVMODEL_DATA_SECTION

DUT-specific data that will be placed in a .data section. Used for memory-mapped regions like tohost/fromhost.

Yes, if not needed by DUT.

n/a

RVMODEL_INVISIBLE_TRAP_HANDLER(_PC_REG, _INSTRUCTION_REG, _ACTION_REG, _DEST_REG, _VALUE_REG)

Optionally emulates an illegal instruction in the M-mode invisible trap handler. _PC_REG and _INSTRUCTION_REG are read-only and contain the trapping PC and instruction, respectively. _ACTION_REG, _DEST_REG, and _VALUE_REG may be changed. See Section 6.3.3 for full details.

Omit if the DUT has no invisible trap emulation.

Machine

RVMODEL_FENCEI

The instruction that makes instruction fetch see code the framework has just stored (a relocated trap trampoline or code in a PMP region), used in place of fence.i. It must be one instruction, or a jal to a DUT routine, so that code size does not depend on the DUT.

Omit to use fence.i with Zifencei and nop without it (instruction fetch is then assumed to be coherent with stores).

Any

The RVMODEL_MTIME_ADDRESS, RVMODEL_MTIMECMP_ADDRESS and RVMODEL_TIMER_INT_SOON_DELAY macros are required when machine timer interrupts (MTI_INTR_IMPL) are implemented, because the tests arm mtimecmp relative to mtime. Similarly, the DUT or its test harness must provide the memory-mapped mtime and mtimecmp registers. Sstc timer interrupts are armed relative to the time CSR, so they need RVMODEL_MTIME_ADDRESS only when Zicntr is not implemented. The RVMODEL_SET_*INT and RVMODEL_CLR*_INT macros are only required for interrupts controlled in a platform-specific fashion. VS-level interrupts need no macros: the tests raise them through hvip.

The tests require precise access faults. The privileged specification permits imprecise reporting (norm:pma_imprecise_ok): "Precise PMA traps might not always be possible, for example, when probing a legacy bus architecture that uses access failures as part of the discovery mechanism. In this case, error responses from peripheral devices will be reported as imprecise bus-error interrupts." Define the RVMODEL_ACCESS_FAULT_ADDRESS_* macros only if the DUT gives a precise access-fault exception for that type of access at the specified address. Do not define it if the DUT reports the error imprecisely, even if the report is an access-fault exception.

A DUT can throw access faults for some types of access and not for others. It can also throw them at different addresses for different types of access. For example, a core can fault on a fetch from a region but complete loads and stores there, or report store faults imprecisely through a bus error. Another core can give precise load and store faults but not have a region in which AMOs or LR/SC fault. Thus there is a separate RVMODEL_ACCESS_FAULT_ADDRESS_<TYPE> macro for each of LOAD, STORE, FETCH, AMO and LRSC.

Tests that put a page table in an access-fault region use the RVMODEL_ACCESS_FAULT_ADDRESS_LOAD region, because a page-table walk reads the table. The specification requires such a fault to be "an access-fault exception corresponding to the original access type", so a fetch, load or store whose page-table read faults gives an instruction, load or store/AMO access fault. Thus RVMODEL_ACCESS_FAULT_ADDRESS_LOAD must also give a precise fault on implicit page-table reads.

  • If RVMODEL_ACCESS_FAULT_ADDRESS is defined, each RVMODEL_ACCESS_FAULT_ADDRESS_<TYPE> macro that is not defined gets its value. A defined RVMODEL_ACCESS_FAULT_ADDRESS_<TYPE> macro overrides it.

  • If RVMODEL_ACCESS_FAULT_ADDRESS is not defined, only the RVMODEL_ACCESS_FAULT_ADDRESS_<TYPE> macros that the DUT defines have a value.

  • The tests and coverpoints for access faults of a type are included only if its macro is defined.

To skip a type of access fault, do not define RVMODEL_ACCESS_FAULT_ADDRESS, and define only the other RVMODEL_ACCESS_FAULT_ADDRESS_<TYPE> macros. For example, a DUT that gives only instruction access faults defines only RVMODEL_ACCESS_FAULT_ADDRESS_FETCH.

If a macro needs machine mode privileges to perform its function but might be called from any mode, it must change privilege level. For example, if RVMODEL_IO_WRITE_STR needs machine mode to access a UART, it may call RVTEST_TSBI_GOTO_MMODE or use a T-SBI call to access UART memory. Printing (and halting) is done at the end of a test, so there is no need to return to the previous privilege mode.

6.3.2. The M-Mode Dance

Because profiles such as RVA23 do not require portable M-mode, the test suites go through weird and wonderful gymnastics to avoid directly using M-mode for supervisor and user-level features. This is described further in the RVA23 Certification Requirement Document. Thus, tests are divided into machine and non-machine tests.

Machine test suites are usually but not always suffixed with Sm. They boot to M-mode and test M-mode features as defined in the privileged ISA manual. They can freely switch privilege modes within tests, such as to check traps from a lower privilege mode into M-mode. Examples include Sm, InterruptsSm, Exceptions_Sm, PMP, and Smstateen. Machine test suites are not part of the certification tests for RVA23 or other profiles that do not require M-mode.

Non-machine tests boot to S or U mode. They only access M-mode features via the T-SBI. They can switch privilege modes within tests, but never enter M-mode except via T-SBI calls that manipulate state and return to the calling mode. They expect all other traps to be delegated to supervisor level (or below) if supervisor exists.

All unprivileged tests are non-machine tests and run in the lowest available privilege mode (U if supported, otherwise M). These tests do not intentionally cause traps, though they do have the trap handler available to catch unexpected traps. Their behavior should be independent of the privilege mode. Examples include F, Zba, and Vx16.

All tests required for RVA23 certification are non-machine tests that require S-mode support.

Therefore, when booting to a non-M privilege mode, the boot code attempts to delegate all traps (aside from ecall from S/M modes, which are needed for the T-SBI; double trap, which is an undelegable M-mode feature; and machine-mode interrupts MEI/MTI/MSI, which are not part of a supervisor-level profile). Also, invisible traps must go to M-mode, be checked, and be relayed to lower-mode if not handled at M-mode, as described in the next section. The medeleg and mideleg CSRs may have read-only 0 bits that prevent such delegation. Therefore, on a system supporting S-mode, the M-mode trap handler performs the following functions even for non-machine tests:

  1. Check if the trap is a T-SBI call and if so, perform the requested T-SBI function and return from the ecall.

  2. Call custom firmware, if any exists, to handle invisible traps, as described in the next section.

  3. Otherwise, delegate the trap to the S-mode handler via software. This involves setting up sstatus, sepc, scause, and stval with values coming from the machine-mode trap CSRs, setting sstatus.SPP, SIE, and SPIE appropriately, and returning to the S-mode trap handler at stvec (possibly vectored). Traps from VS or VU must also set htval, htinst, and relevant hstatus bits. A trap from VS or VU that hedeleg also delegates goes on to the VS-mode handler instead, through vsstatus, vsepc, vscause, vstval, and vstvec.

The rvtest_setup.S and rvtest_trap_handler.S files implement the boot code, T-SBI, and machine-mode trap handler using standard M-mode capabilities. In theory, a DUT that does not implement standard M-mode might have to reimplement some or all of this code. In practice, we have not yet encountered any DUT that cannot use this standard M-mode code.

6.3.3. Invisible Trap Emulation

A DUT can use an invisible trap to emulate an instruction that is not implemented in hardware or has a known bug. When invisible traps are enabled, all illegal-instruction exceptions are first sent to M-mode for possible emulation before being forwarded to the normal trap handler. Invisible traps are enabled when RVMODEL_INVISIBLE_TRAP_HANDLER is defined or UDB_TIME_CSR_IMPLEMENTED is false. In the latter case, the framework emulates the time and timeh CSRs using mtime, adding htimedelta in VS and VU and applying the mcounteren, hcounteren, and scounteren checks.

Custom invisible traps implemented using the RVMODEL_INVISIBLE_TRAP_HANDLER macro must follow the conventions described below.

RVMODEL_INVISIBLE_TRAP_HANDLER gets five inputs:

  • _PC_REG: A register containing the trapping PC. Read-only.

  • _INSTRUCTION_REG: A register containing the trapping instruction. Read-only.

  • _ACTION_REG: The action to be taken by the trap handler.

  • _DEST_REG: The destination GPR number for action 2.

  • _VALUE_REG: The value to write for action 2.

The supported return codes in the _ACTION_REG are:

  • 0: The macro did not handle the instruction. Continue with the normal trap handling. _ACTION_REG is preset to 0 before RVMODEL_INVISIBLE_TRAP_HANDLER.

  • 1: The macro handled the instruction and wrote all required architectural state. Resume after the instruction.

  • 2: The macro handled the instruction and needs to write a GPR result. Write _VALUE_REG to the GPR whose number is in _DEST_REG, then resume after the instruction.

  • 3: The instruction raises a virtual-instruction exception, which is taken in HS-mode if medeleg delegates it and in M-mode otherwise. Valid only when H is supported.

  • Any other code is invalid and the test will produce an error.

Action 2 must be used to write GPR results because a direct write to a saved GPR would be lost when the trap handler restores that register upon exiting. Floating-point and vector registers are not restored, so they can be directly written without using action 2.

The following example emulates a read of custom CSR 0xBC0 and returns 42. It accepts CSRRS, CSRRC, CSRRSI, or CSRRCI only when rs1 or uimm is zero. The mask ignores the rd field and CSR function bit 12.

#define RVMODEL_INVISIBLE_TRAP_HANDLER(_PC_REG, _INSTRUCTION_REG, _ACTION_REG, _DEST_REG, _VALUE_REG) \
  li  _VALUE_REG, INSN_FIELD_CSR | INSN_FIELD_RS1 | INSN_FIELD_OPCODE | (2 << 12); \
  and _DEST_REG, _INSTRUCTION_REG, _VALUE_REG;                                         \
  li  _VALUE_REG, (0xBC0 << 20) | (2 << 12) | 0x73;                                   \
  bne _DEST_REG, _VALUE_REG, 1f;                                                       \
  li  _VALUE_REG, 42;                                                                  \
  srli _DEST_REG, _INSTRUCTION_REG, 7;                                                  \
  andi _DEST_REG, _DEST_REG, 0x1F;                                                     \
  li  _ACTION_REG, 2;                                                                  \
1:

The built-in RVTEST_INVISIBLE_TIME_HANDLER macro in tests/env/rvtest_invisible_trap_handler.h uses the same interface and is a larger example. It checks the CSR instruction and counter permissions, reads RVMODEL_MTIME_ADDRESS, and returns the value with action 2.

6.3.4. RVMODEL_BOOT Requirements

The RVMODEL_BOOT macro may be empty for a simple DUT.

For a complex SoC, the macro may need to perform initialization steps such as turning on a phase-locked loop or DRAM controller or initializing custom state. It must not clobber x1/ra, but any other registers may be trashed.

At the end of RVMODEL_BOOT, the system should be in standard machine mode, with XLEN and endianness for each lower privilege mode set to the same value as in machine mode (MXLEN = SXLEN = UXLEN = HSXLEN = VSXLEN and MBE = SBE = UBE = VSBE).

Alternatively, the DUT might run a separate proprietary bootloader executable file that initializes the system, then loads the test ELF and jumps to rvtest_entry_point. Or the DUT could modify link.ld to link proprietary bootloader code into the test ELF and jump to rvtest_entry_point. In these cases, RVMODEL_BOOT can be empty.

6.3.5. RVMODEL Macros for Spike and SAIL

RVMODEL macros for Spike are implemented in spike-rv64-max/rvmodel_macros.h. They use HTIF for termination, and write to a virtual UART at address 0x1000_0000 to print characters. TODO: Interrupts

RVMODEL macros for the RISC-V Sail model are implemented in tests/env/sail_test.h. They are similar to Spike but use HTIF for printing. TODO: interrupts

6.3.6. Host Target Interface

The host target interface (HTIF) is an unofficial semihosting method that has become widely used by RISC-V simulators (Spike, QEMU, RISC-V Sail) and test benches. If your SystemVerilog testbench supports it, you can share the same HTIF code as Spike and RISC-V Sail for the RVMODEL_HALT_PASS, RVMODEL_HALT_FAIL, and RVMODEL_IO_WRITE_STR DUT-specific macros. A drawback is that your testbench needs to parse the ELF labels to find the address of the tohost symbol, which is used for HTIF communication. If your testbench does not support HTIF, you can implement the RVMODEL macros using other methods, such as memory-mapped I/O to a SoC peripheral or an address monitored by the testbench.

For example, the testbench might implement the [unofficial HTIF semihosting specification] and print the character A by writing the doubleword 0x01010000_00000041 to a label called tohost in the .data section of the test program. The most significant byte is the device (console), the next byte is the command (write), and the least significant 4 bytes are the data (the ASCII code for A). Terminating with a failure code is done by writing the doubleword 0x00000000_00000003 to tohost, and terminating with a success code is done by writing the doubleword 0x00000000_00000001 to tohost.

Note that writing the upper word of the doubleword to tohost with sd is only properly defined for RV64. Therefore, RV32 can use HTIF to terminate with a success or failure code but not necessarily to write to the console.

6.3.7. RVMODEL Macros for Other DUTs

If you have a simple DUT designed to match the behavior of RISC-V Sail and Spike, you may be able to implement the RVMODEL macros with the same code used by RISC-V Sail. Your RVMODEL_BOOT macro can be empty. The interrupt macros for unsupported privilege modes can be empty.

If you have a complex DUT, you presumably have a team of sophisticated verification engineers who can adapt the example macros to your DUT’s requirements.

6.4. Linker Script

Each DUT needs a linker script tailored to its memory map. The linker script in config/<core>/<version>/link.ld defines where to place the code and data regions in the DUT’s memory map. It must contain .text.init, .text.rvtest, .data, and .text.rvmodel sections (in that order), and an ENTRY point named rvtest_entry_point. The first line of the list of SECTIONS in the linker script sets the starting address of the ELF (. = 0x…​) and is the only part of the sample linker script that most users will need to change. Set it to your reset address for simple DUTs. Users with special needs can customize the linker script to start at their own boot code (leaving the RVMODEL_BOOT macro blank) and then jump to rvtest_entry_point.

The .text.rvmodel section contains DUT-specific (RVMODEL) code and must be placed after the .data section. This ensures that variable-size model-specific macro expansions (which may differ between the DUT build and the reference-model build) do not affect the addresses of test data symbols such as scratch and begin_signature, preventing signature mismatches.

On harts that support virtual memory, the test image must be placed where the virtual memory tests leave it mapped. 0x8000_0000, used by the sample configurations, works for both RV32 and RV64. The boot code identity-maps the superpage that contains the test data (a 4 MiB megapage on RV32, a 1 GiB gigapage on RV64), so the whole image must fit inside one aligned superpage. The tests also map fixed virtual addresses, such as 0, all ones, and aliases of the code and data. If one of these falls in the same superpage as the image, the test overwrites the image’s identity mapping and hangs. On RV64, the image must also lie in the Sv39 address space, below 2^38 (256 GiB), even on harts that support Sv48 or Sv57, because the Sv39 tests run on those harts too. The safe ranges are:

  • RV32: 0x0140_0000–0x03FF_FFFF, 0x0440_0000–0x2FFF_FFFF, 0x3040_0000–0x8FFF_FFFF and 0x90C0_0000–0xFFBF_FFFF.

  • RV64: 0x4000_0000–0xBFFF_FFFF (1–3 GiB) and 0x2_0000_0000–0x3F_FFFF_FFFF (8–256 GiB).

For some systems, this may involve configuring a non-default physical address and size for main memory.

6.5. File Organization

Standard macros are defined in tests/env. DUT-specific macros are defined in rvmodel_macros.h, which is in a DUT-specific config directory (e.g. config/<dut>/<version>/rvmodel_macros.h for predefined simulators, or out-of-tree for custom DUTs).

Standard framework macros begin with RVTEST. They include rvtest_setup.h for boot macros and rvtest_trap_handler.h for standard trap handlers, and rvtest_failure_code.h for error reporting. Other macros are defined in ***util.h, …​ describe further

DUT-specific macros begin with RVMODEL. Some RVTEST macros check if corresponding RVMODEL macros are defined and invoke the RVMODEL macro instead for DUTs with custom M-mode, when defined.

6.6. Test Supervisor Binary Interface (T-SBI)

The test must implement a custom Test Supervisor Binary Interface (T-SBI) providing an abstraction layer to facilitate S and U-mode tests requesting services from a possibly custom M-mode. These services include testing ECALL to the execution environment and accessing CSRs.

The ratified SBI compiles into a ~1MB OpenSBI firmware binary, which is unnecessarily large to load with every test. Moreover, the SBI calling convention uses a7 and a6, which are not available on RV32E. Therefore, T-SBI is a lighter-weight implementation with a custom calling convention that is incompatible with the ratified SBI.

The SBI is invoked with the ecall instruction. The operation is passed in a0. An additional argument could be passed in a1 (and possibly a2) and a result could be returned in a0 if needed. Other values of a0 are reserved.

Table 6. T-SBI Calls
Function Name Operation(a0) Description

TSBI_ECALL_TEST

0x00000073

Test ecall to the execution environment. The trap handler records the ecall in the trap signature and returns past it with xEPC in a0.

TSBI_CSR_SET

0x<CSR>5a073

Performs the functionality of a CSRS instruction specified by the opcode. a1 contains the value to write. <CSR> is the 12-bit CSR encoding.

TSBI_CSR_CLEAR

0x<CSR>5b073

Performs CSRC instruction specified by the opcode. a1 contains the value to write.

TSBI_CSR_WRITE

0x<CSR>59073

Performs CSRW instruction specified by the opcode. a1 contains the value to write.

TSBI_CSR_READ

0x<CSR>02573

Performs CSRR instruction specified by the opcode. Returns result in a0.

TSBI_LW

0x0005a503

LW a0, 0(a1) - Load word from physical address in a1 with machine-mode privileges. Returns result in a0. Used to read mtime or access other memory-mapped I/O.

TSBI_LWP4

0x0045a503

LW a0, 4(a1) - Load word from physical address in a1+4 with machine-mode privileges. Returns result in a0. Used to read upper half of mtime or access other memory-mapped I/O.

TSBI_LD

0x0005b503

LD a0, 0(a1) - Load doubleword from physical address in a1 with machine-mode privileges. Returns result in a0. Used to read mtime or access other memory-mapped I/O. RV64 only

TSBI_SW

0x00c5a023

SW a2, 0(a1) - Store word to physical address in a1 with machine-mode privileges. Used to write memory-mapped I/O.

TSBI_SWP4

0x00c5a223

SW a2, 4(a1) - Store word to physical address in a1+4 with machine-mode privileges. Used to write memory-mapped I/O.

TSBI_SD

0x00c5b023

SD a2, 0(a1) - Store doubleword to physical address in a1 with machine-mode privileges. Used to write memory-mapped I/O. RV64 only

TSBI_SFENCE_VMA

0x12000073

SFENCE.VMA x0, x0 - Flushes the address-translation caches. Used by a U-mode test that sets satp with TSBI_CSR_WRITE and cannot execute sfence.vma itself. Requires S-mode.

For example, an S-mode program can request setting mstatus.TW with a CSR_SET call corresponding to csrrs x0, mstatus, a1 (a0 = 0x3005a073) with a1 containing a 1 in bit 21 (the TW bit) and all other bits 0. The ACT trap handler implements this using an instruction table. If a custom M-mode does not implement mstatus.TW, it must emulate the behavior in some other way. Similarly, S-mode can read mip to a0 with a CSR_READ call corresponding to csrrs a0, mip, x0 (a0 = 0x34402573).

The ACT trap handlers implement an additional set of convenience calls changing between privilege modes in a standard fashion. This includes changing to M-mode. The behavior in M-mode is only predictable if STANDARD_SM_SUPPORTED is true. Another suite with different trap handlers might not support these calls.

Table 7. Additional ACT System Calls
Function Name Operation(a0) Description

TSBI_GOTO_MMODE

0x00000001

Switches to M-mode from any privilege mode. Behavior may be unpredictable if STANDARD_SM_SUPPORTED is false.

TSBI_GOTO_SMODE

0x00000002

Switches to S/HS-mode from any privilege mode.

TSBI_GOTO_UMODE

0x00000003

Switches to U-mode from any privilege mode.

TSBI_GOTO_VSMODE

0x00000004

Switches to VS-mode from any privilege mode.

TSBI_GOTO_VUMODE

0x00000005

Switches to VU-mode from any privilege mode.

The ACT S/HS and VS-mode trap handlers implement the same calls. Each trap handler performs the request if possible at the current privilege level, or else makes another ecall to pass the request up the privilege chain if necessary. For example, GOTO_MMODE is always passed up the chain. A CSR access to S-mode CSRs is handled by the S-mode handler, while a CSR access to M-mode received by the S-mode handler is passed up to the M-mode handler by an ecall with unchanged arguments.

6.6.1. System Call Macros

The following macros are defined for developer convenience to access the T-SBI and ACT system calls. They are not required.

  • RVTEST_TSBI_ECALL_TEST(): records the ecall in the trap signature and returns xEPC in a0

  • RVTEST_TSBI_CSR_SET(csr, imm)

  • RVTEST_TSBI_CSR_CLEAR(csr, imm)

  • RVTEST_TSBI_CSR_WRITE(csr, imm)

  • RVTEST_TSBI_CSR_WRITE_A1(csr): write value in a1

  • RVTEST_TSBI_CSR_READ(csr): returns value in a0

  • RVTEST_TSBI_SFENCE_VMA

    csr is the 12-bit CSR number (e.g. CSR_MIP from encoding.h) and imm is a constant that the macro loads into a1 with li before the call.

  • RVTEST_TSBI_GOTO_MMODE

  • RVTEST_TSBI_GOTO_SMODE

  • RVTEST_TSBI_GOTO_UMODE

  • RVTEST_TSBI_GOTO_VSMODE

  • RVTEST_TSBI_GOTO_VUMODE

  • RVTEST_TSBI_LW: performs lw a0, 0(a1) with machine-mode privileges. Returns result in a0. Used to read mtime or access other memory-mapped I/O.

  • RVTEST_TSBI_LWP4: performs lw a0, 4(a1) with machine-mode privileges. Returns result in a0. Used to read mtime or access other memory-mapped I/O.

  • RVTEST_TSBI_LD: performs ld a0, 0(a1) with machine-mode privileges. Returns result in a0. Used to read mtime or access other memory-mapped I/O. RV64 only.

  • RVTEST_TSBI_SW: performs sw a2, 0(a1) with machine-mode privileges. Used to write memory-mapped I/O such as mtimecmp or msip.

  • RVTEST_TSBI_SWP4: performs sw a2, 4(a1) with machine-mode privileges. Used to write memory-mapped I/O such as mtimecmph.

  • RVTEST_TSBI_SD: performs sd a2, 0(a1) with machine-mode privileges. Used to write memory-mapped I/O such as mtimecmp or msip. RV64 only.

TODO

testgen/src/testgen/io/templates.py format_params needs to accept STANDARD_SM_SUPPORTED parameter when available. How to deal with UDB? (Released in UDB 4/29/26).

remove mention of RVTEST_VECTOR from vector code

Test generator: Any test that lists Sm in REQUIRED_EXTENSIONS adds STANDARD_SM_SUPPORTED as a parameter (outdated; as of 9/16/26 it adds BOOT_TO_MMODE) DONE * edit generators/testgen/src/testgen/io/templates.py/generate_defines_from_extensions to define these boot_TO_*. DONE Drop RVTEST_FP and tweak where it was used (hopefully removed)

Restore this code when fully transitioned to S-SBI
    if any(ext in ext_components for ext in ["H", "S"]):
        extra_defines.append("#define BOOT_TO_SMODE")
    elif any(ext in ext_components for ext in ["Sm"]):
        extra_defines.append("#define BOOT_TO_MMODE")

7. Architectural Functional Coverage

In principle, a test plan could simply list a set of features to test, and a set of tests that exercise these features. Experienced verification engineers have learned that tests often have bugs and don’t exercise the feature that the author intended. Many of these bugs can be caught if a different engineer independently writes functional coverpoints that measure whether the tests exercised the features.

This Certification Test Plan focuses on whether a DUT implements all of the architectural features of a profile. Architectural features are those that are directly visible to the programmer, especially those defined in the unprivileged and privileged ISA specifications.

Later certificates may add ratified architectural features outside the ISA spec, such as IOMMU, debug, or AIA.

Certification differs from design verification in that it does not systematically test microarchitectural features. Design verification must be aware of DUT-specific features such as the pipeline design. For example, DV should test design-specific interactions of interrupt arrival time, pipeline hazards, multicycle instructions, MMU, and memory system. Design verification also should test tricky implementation issues, such as hard floating-point rounding cases.

This plan uses the term Architectural Functional Coverage to describe the functional coverpoints required for certification. In contrast, full design verification also has Microarchitectural Functional Coverage.

Functional coverage also differs from code coverage, which measures whether the test suite exercises all of the lines of code in the RTL. Each of these detects different types of bugs. Code coverage is part of DV but not certification.

Architectural functional coverage requires a way to measure the architectural state of the machine after each instruction. The RISC-V Verification Interface (RVVI) provides a standard way to observe this state in the DUT. This document defines Extended RVVI with additional signals to facilitate testing virtual memory.

7.1. Extended RVVI

As compared to the base RVVI, Extended RVVI adds the following signals:

Table 8. Extended RVVI Signals
Signal Width Description

virt_adr_i

XLEN

Virtual address of instruction

virt_adr_d

XLEN

Virtual address of data accessed by instruction

phys_adr_i

PA_BITS

Physical address of instruction

phys_adr_d

PA_BITS

Physical address of data accessed by instruction

g_phys_adr_i

PA_BITS

Guest physical address of instruction (when Hypervisor is active, 0 when inactive)

g_phys_adr_d

PA_BITS

Guest physical address of data accessed by instruction (when Hypervisor is active, 0 when inactive)

pte_i

XLEN

Instruction page table entry (VS-stage when Hypervisor is active)

pte_d

XLEN

Data page table entry (VS-stage when Hypervisor is active)

g_pte_i

XLEN

Instruction page table entry (G-stage when Hypervisor is active, 0 when inactive)

g_pte_d

XLEN

Data page table entry (G-stage when Hypervisor is active, 0 when inactive)

page_type_i

3

Instruction page type (VS-stage when hypervisor is active))

page_type_d

3

Data page type (VS-stage when hypervisor is active))

g_page_type_i

3

Instruction page type (G-stage when hypervisor is inactive, 0 when inactive)

g_page_type_d

3

Data page type (G-stage when hypervisor is inactive, 0 when inactive)

tdata1[NTRIGGERS]

XLEN*NTRIGGERS

Sdtrig Trigger Data 1 for each debug trigger

tdata2[NTRIGGERS]

XLEN*NTRIGGERS

Sdtrig Trigger Data 2 for each debug trigger

tdata3[NTRIGGERS]

XLEN*NTRIGGERS

Sdtrig Trigger Data 3 for each debug trigger

tinfo[NTRIGGERS]

XLEN*NTRIGGERS

Sdtrig Trigger Info for each debug trigger

Table 9. Page Types
Code Type

000

kilopage

001

megapage

010

gigapage

011

terapage

100

petapage

other

reserved

Some accesses touch more than one physical page. Examples include misaligned accesses wrapping a page boundary, and some vector accesses. Extended RVVI provides the signals corresponding to the base address of the access. For vector, they correspond to the base address of the initial element access.

NTRIGGERS is a new parameter similar to FLEN defining the number of Sdtrig debug triggers supported by the platform.

7.2. riscvISACOV Signals

Coverpoints are described using the open riscvISACOV framework.

The framework collects data coming across the RVVI interface and presents it with ins.current and ins.prev data structures to allow easy access to the architectural state at the end of the current and previous instructions. For example, ins.current.rs1 is the source register for the current instruction, and ins.current.rd_val is the value written to the destination register by the current instruction.

Most coverpoints use ins.current, to measure architectural state at the end of the instruction. However, some privileged coverpoints need to know the privilege mode or values of CSRs at the start of the instruction and thus use ins.prev.

The available fields are given in framework/src/act/fcov/coverage/RISCV_coverage_rvvi.svh. Most commonly used fields are summarized in Table 10. Other fields include floating-point and vector register IDs and values, MMU extended RVVI signals, vector type information, and pending interrupts. TODO: handling register pairs.

Table 10. riscvISACOV Signals for Coverpoints
Signal Width Description Example

insn

ILEN

Instruction bit pattern

* add x10, x11, x12

inst_name

string

Instruction name

add

disass

string

Disassembled instruction

add x10, x11, x12

trap

1

Instruction trapped rather than retiring

0

mode

2

Privilege mode 11 = machine, 01 = supervisor, 00 = user

11

pc_rdata

XLEN

PC of current instruction

0x80000000

pc_wdata

XLEN

PC of next instruction

0x80000004

rs1

5

Source register 1 ID

11

rs2

5

Source register 2 ID

12

rd

5

Destination register ID

10

rs1_val

XLEN

Source register 1 value

42

rs2_val

XLEN

Source register 2 value

69

rd_val

XLEN

Value written to destination register

111

imm

XLEN

Value of immediate

100

csr

XLEN x 4096

Value of CSRs

  • exact meaning of trap, importance in writing test

RVVI and riscvISACOV support the notion of multiple harts that retire multiple instructions per cycle. The number of instructions retired per cycle is a microarchitectural issue irrelevant to architectural functional verification, so it is set to 1, consistent with simulators that report each instruction retiring individually.

Our riscvISACOV implementation uses a SystemVerilog disassembler in fcov/disassemble.svh, replacing a proprietary disassembler from Imperas. When adding new extensions, update the disassembler accordingly.

7.3. Writing Coverpoints with riscvISACOV

Move this and the remainder to ACT repo

  • example of coverpoint

  • organization of files

7.4. Trace Coverage Flow

Coverage is measured by running tests on the RISC-V Sail model and generating a RVVI-Trace file, then passing this file to an RVVI agent in a SystemVerilog testbench that checks coverage.

The number of coverpoints and the number of tests both grow with the number of extensions, so the runtime to measure coverage can grow quadratically with the number of extensions, and becomes problematic. To avoid this, it is recommended to only enable coverpoints for one extension (or small group of extensions) at a time and to only run tests for that extension, and generate a Unified Coverage Database (UDCB) file and report for that extension. A script will kick off such tests in parallel for all extensions, and merge the coverage reports.

The RISC-V Sail model produces the trace file in a standard RVVI-Trace format (see Section Section 7.5). Any other simulator that implements the same trace format can also be used to cross-check coverage.

  • Jordan add instructions on how to run this

7.5. RVVI-Trace Format

  • Jordan write

  • how to handle instructions that change multiple CSRs, such as a write to mstatus.SIE also affecting sstatus.SIE

8. Reference Model

Certification may rely on a reference model (simulator) to compute the expected results of a test, such as sum of two numbers in an add instruction or the answer for a fsqrt.d instruction. Self-checking tests compare the result from the DUT against the expected result that was precomputed by the reference model and flag mismatches. Alternatively, the test may be generated with a set of one or more expected results for each test case (without a reference model), and the test can check that the DUT produces one of the expected results.

TODO: Discuss one vs. many reference models. RISC-V International has blessed RISC-V Sail as the golden RISC-V model, so RISC-V Sail is used as the reference model.

8.1. Deterministic, Nondeterministic, and Unspecified Behaviors

RISC-V feature behavior can be classified as deterministic, nondeterministic, and unspecified. Deterministic features have a unique expected value for a given configuration, such as the result of sub 1 - 2 on RV32. Nondeterministic features have a fine set of possible outcomes, and might vary unpredictably even on the same DUT. For example, vector tail-agnostic elements can preserve the input value or propagate all 1s, with no guarantee whether the same instruction has the same behavior on all elements or when executed twice in a row. Unspecified features, such as unimplemented instructions, could do anything, from being ignored, to predictably or unpredictably changing architectural state, to halting and catching fire.

All RISC-V simulators, when properly configured to match the behavior of a DUT, should produce the same answers as the DUT and each other for deterministic features. For nondeterministic features, they should produce one of the legal outcomes. For unspecified features, they can do anything.

Self-checking certification tests must check that the result of deterministic features match the reference model. Nondeterministic features must produce one of the finite set of legal outcomes, which must be provided by the test developer because a reference model only produces a single outcome. Unspecified features are not tested because there are no wrong answers.

This is harder than it seems because RISC-V has many features whose behaviors are not fully specified. Many of these features are not yet named, and the set of legal behaviors is not yet enumerated. Unified Database (UDB) is in the process of naming and enumerating all of these features and behaviors to fully describe the behavior of a DUT. Moreover, no simulator yet is fully configurable to match every feature. Some simulators, such as Spike, intentionally have a minimal set of configuration options and are hardwired to particular behaviors.

Nevertheless, the RISC-V Sail model is making rapid progress and is aiming to fully implement the ratified RVA23 profile, read a UDB configuration, and support at least the most reasonable behaviors in time for certification.

8.2. List of Fundamentally Nondeterministic Behaviors

  • Mask- and tail-agnostic vector operations

    • Self-checking tests must accept undisturbed and all 1s in each element

  • Traps on misaligned accesses

    • If mtval is written with a nonzero value, it can be any address within the access***

    • When it also causes access fault / misaligned store, Allen has list of 7ish possible outcomes.

If nondeterministic behaviors are tested, the test must accept all legal outcomes. This is costly, so some nondeterministic behaviors may be untested. Nevertheless, agnostic vector operations will definitely be tested and accept all legal results.

When possible, the behavior should be made deterministic by a parameter such that the reference model can match the DUT with that parameter setting.

8.3. List of Theoretically Nondeterministic Behaviors with Configurable Deterministic Implementations

  • CSR WARL Fields: any legal value could be read, and the value is theoretically nondeterministic and could change from one write to another. UDB will define configurations with a single sensible behavior (such as all 0s), and we may limit certification to DUTs that implement a reasonable configuration.

Appendix A: Unprivileged Test Plan

Unprivileged tests exercise every instruction using every applicable source and destination register, and reasonable architectural edge values of sources. They are intended for certification, not verification. For example, they do not stress interrupts arriving in the midst of multicycle instructions.

The unprivileged test plan is written to be easily reviewed by a human, and to be automatically converted to machine-readable coverpoints and tests. It is defined with spreadsheets in comma-separated value (CSV) format. A testplan may have an ExtraExtensions column. A non-empty entry names one or more extensions, separated by colons, that the row requires in addition to the testplan’s own, such as D in Table 48 or Zfh:D in Table 50. The row’s tests are in the testplan’s test suite directory, but they run only on configurations that also implement those extensions. Its tests and covergroups are named after the testplan followed by the extensions, such as ZfhminD-fcvt.d.h-00.S and ZfhminD_fcvt_d_h_cg, and the covergroups are compiled only when the extensions are supported.

A.1. Unprivileged Tests

Every bin in every coverpoint is associated with a specific test [3]. Unprivileged tests sweep some feature under test (such as the destination register rd) while randomizing all applicable register IDs and source values (including values to be loaded from memory). For example, the unprivileged test for the cp_rd coverpoint of the add instruction contains 32 add instructions, using the 32 different choices of rd. The rs1 and rs2 register numbers and values are selected randomly. Appendix E gives examples of unprivileged coverpoints and tests meeting these requirements and the coverpoints of Table 18 for the add instruction. Each test is self-checking, checking the destination register value against one provided by a reference model. Certain tests also test other state such as stores or floating-point flags, as described in those sections.

The random values are preferably selected in a deterministic way so that regenerating tests use the same random values where possible, minimizing differences between tests. This can be done by seeding the random number generator with a has of the instruction and coverpoint name.

Unprivileged tests are designed to never trap. Their results are independent of the privilege mode in which they are run, so they generally are run only in machine mode. They generally involve no privileged instructions, except that floating-point and vector tests turn on the mstatus.{FS/VS} bits to enable these extensions.

A.2. Unprivileged Coverpoints

The coverpoints in Table 11 are used in most of the unprivileged test plans in subsequent sections.

Table 11. Coverpoint Definitions
Coverpoint Bins Definition

Basic Coverpoints

cp_asm_count

1

Number of times the instruction is executed in the test, must be greater than 0.

cp_rs1

32

The rs1 register number used in the instruction.

cp_rs2

32

The rs2 register number used in the instruction.

cp_rd

32

The rd register number used in the instruction.

cp_rs1_edges

12 (RV32), 18 (RV64)

Edge values for rs1 (see Table 12).

cp_rs2_edges

12 (RV32), 18 (RV64)

Edge values for rs2 (see Table 12).

cp_imm_edges

20

Edge values for 12-bit immediates (see Table 13).

cr_rs1_imm_edges

12*20 (RV32), 18*20 (RV64)

Cross-product of rs1 and 12-bit immediate edges (see Table 13).

cr_rs1_rs2_edges

12*12 (RV32), 18*18 (RV64)

Cross-product of rs1 and rs2 edges, used for instructions with two source registers.

cmp_rs1_rs2

32

The rs1 and rs2 registers have the same register number.

cmp_rd_rs1

32

The rd register has the same register number as the rs1 register.

cmp_rd_rs2

32

The rd register has the same register number as the rs2 register.

cmp_rd_rs1_rs2

32

The rd register has the same register number as both the rs1 and rs2 registers.

cp_offset

2

A branch or jalr instruction has a positive and negative offset.

cp_uimm

XLEN

Exercise all XLEN unsigned immediate values, such as shift amounts.

cp_align

≤ 8

Alignment of naturally-aligned sub-doubleword load/store operand within doubleword

cp_memval

5

Edge values for integer memory values loaded by load instructions.

Coverpoints for Compressed Instructions

cp_rs1_p

8

The rs1 register number used in compressed instructions supporting x8-x15.

cp_rs2_p

8

The rs2 register number used in compressed instructions supporting x8-x15.

cp_rd_p

8

The rd register number used in compressed instructions supporting x8-x15.

cp_fd_p

8

The fd register number used in compressed floating-point instructions supporting f8-f15.

cp_fs2_p

8

The fs2 register number used in compressed floating-point instructions supporting f8-f15.

cp_imm_mul

32

Immediate offset for word-sized compressed loads/stores: multiples of 4 from 0 to 124.

Coverpoints for Floating-Point Instructions

cp_fs1

32

The fs1 register number used in the instruction.

cp_fs2

32

The fs2 register number used in the instruction.

cp_fs3

32

The fs3 register number used in the instruction.

cp_fd

32

The fd register number used in the instruction.

cp_fs1_edges

26

Edge values for fs1 (see Table 14)

cp_fs2_edges

26

Edge values for fs2 (see Table 14)

cp_fs3_edges

26

Edge values for fs3 (see Table 14)

cmp_fd_fs1

32

The fd register has the same register number as the fs1 register.

cmp_fd_fs2

32

The fd register has the same register number as the fs2 register.

cmp_fd_fs3

32

The fd register has the same register number as the fs3 register.

cp_frm

5

The floating-point rounding mode used in the instruction: rne, rdn, rup, rtz, rmm, dyn.

cp_csr_fflags

10

The instruction sets the {NV, DZ, OF, UF, NX} flags in the fflags CSR.

cp_csr_frm

5

Dynamic rounding mode in the frm CSR: rne, rdn, rup, rtz, rmm

cr_fs1_fs2_edges

26*26

Cross product of edges of fs1 and fs2 registers.

cr_fs1_fs3_edges

26*26

Cross product of edges of fs1 and fs3 registers.

cp_fclass

10

All 10 fclass classes.

cp_NaNBox

1

Upper bits of NaN-boxed value are all 1s

cp_fs1_badNB

12

The fs1 register contains an incorrectly-NaN-boxed lower-precision value.

cp_fs2_badNB

12

The fs2 register contains an incorrectly-NaN-boxed lower-precision value.

cp_fs3_badNB

12

The fs3 register contains an incorrectly-NaN-boxed lower-precision value.

cp_fpr_hazard

4

Floating-point register hazard detection: RAW, WAR, WAW, and no hazard. [TODO: this should be dropped when full hazards are implemented]

Miscellaneous Coverpoints

cp_bs

4

Byte select field for 32-bit AES instructions

cp_rnum

11

Round number for AES instructions

Notes:

  • These coverpoints are adapted from the Imperas riscvISACOV functional coverage project.

  • Register number is a 5-bit ID (e.g. x7), while register value is an XLEN-sized number.

  • Most coverpoints typically have 32 bins because they exercise all 32 integer registers.

  • Cross-products exercise all combinations of two or more coverpoints. They can have a large number of bins.

  • Each of these coverpoints can optionally have a modifier appended. For example, cp_rs1_nx0 is a modified version of cp_rs1, covering all 31 rs1 register numbers excluding x0. It is used for load/store/jalr instructions that can’t rely on address 0 specified by x0 being legal. Modifiers are defined in the extensions that they apply to.

  • The cmp_* and cp_*_hazard coverpoints occupy the fuzzy land at the edge of certification and verification. They are included because they are easy.

  • It would be possible to add more floating-point coverpoints such as cmp_fd_fs1_fs2_fs3 but the value is considered low.

  • The riscvISACOV test plan had cmp_rd_{rs1/rs2}_eqval coverpoints that compare if rd and one of the sources have the same value. These are generally hit by the cr_rs1_rs2_edges tests, so they don’t add interesting additional coverage and were dropped. riscvISACOV also had cp_{rs1/rs2/rd}_toggle tests that checked if each bit changed from 1 to 0 and vice versa. This is trivially exercised by providing all 0s followed by all 1s followed by all 0s again, so they were dropped.

Table 12. Integer Edge Case Definitions
Bin RV32 RV64

zero

00000000000000000000000000000000

0000000000000000000000000000000000000000000000000000000000000000

one

00000000000000000000000000000001

0000000000000000000000000000000000000000000000000000000000000001

two

00000000000000000000000000000010

0000000000000000000000000000000000000000000000000000000000000010

min

10000000000000000000000000000000

1000000000000000000000000000000000000000000000000000000000000000

minp1

10000000000000000000000000000001

1000000000000000000000000000000000000000000000000000000000000001

max

01111111111111111111111111111111

0111111111111111111111111111111111111111111111111111111111111111

maxm1

01111111111111111111111111111110

0111111111111111111111111111111111111111111111111111111111111110

ones

11111111111111111111111111111111

1111111111111111111111111111111111111111111111111111111111111111

onesm1

11111111111111111111111111111110

1111111111111111111111111111111111111111111111111111111111111110

walkodd

10101010101010101010101010101010

1010101010101010101010101010101010101010101010101010101010101010

walkeven

01010101010101010101010101010101

0101010101010101010101010101010101010101010101010101010101010101

random

01???????????????????????????010

01???????????????????????????????????????????????????????????010

Wmax

n/a

0000000000000000000000000000000011111111111111111111111111111111

Wmaxm1

n/a

0000000000000000000000000000000011111111111111111111111111111110

Wmaxp1

n/a

0000000000000000000000000000000100000000000000000000000000000000

Wmaxp2

n/a

0000000000000000000000000000000100000000000000000000000000000001

W80

n/a

0000000000000000000000000000000010000000000000000000000000000000

W7F

n/a

0000000000000000000000000000000001111111111111111111111111111111

Table 13. Immediate Edge Case Definitions (12-bit)
Bin 12-bit Signed Value

zero

0

p0

1

p1

2

three

3

p2

4

p3

8

p4

16

p5

32

p6

64

p7

128

p8

256

p9

512

hm1

1023

p10

1024

max

2047

min

-2048

minp1

-2047

onesm1

-2

ones

-1

randomp

1795

Table 14. Floating-Point Edge Case Definitions
Bin Half BF16 Float Double

pos0

0000

0000

00000000

0000000000000000

neg0

8000

8000

80000000

8000000000000000

pos1

3C00

3F80

3F800000

3FF0000000000000

neg1

BC00

BF80

BF800000

BFF0000000000000

pos2p5

4100

4020

40200000

4004000000000000

neg2p5

C100

C020

C0200000

C004000000000000

pos2prec

6800

4380

4B800000

4340000000000000

neg2prec

E800

C380

CB800000

C340000000000000

posminnorm

0400

0080

00800000

0010000000000000

negminnorm

8400

8080

80800000

8010000000000000

posmaxnorm

7BFF

7F7F

7F7FFFFF

7FEFFFFFFFFFFFFF

negmaxnorm

FBFF

FF7F

FF7FFFFF

FFEFFFFFFFFFFFFF

posmax_subnorm

03FF

007F

007FFFFF

000FFFFFFFFFFFFF

negmax_subnorm

83FF

807F

807FFFFF

800FFFFFFFFFFFFF

posmid_subnorm

0200

0040

00400000

0008000000000000

negmid_subnorm

8200

8040

80400000

8008000000000000

posmin_subnorm

0001

0001

00000001

0000000000000001

negmin_subnorm

8001

8001

80000001

8000000000000001

posinfinity

7C00

7F80

7F800000

7FF0000000000000

neginfinity

FC00

FF80

FF800000

FFF0000000000000

posQNaN

7E00-7FFF

7FC0-7FFF

7FC00000-7FFFFFFF

7FF8000000000000-7FFFFFFFFFFFFFFF

posSNaN

7C01-7DFF

7F81-7FBF

7F800001-7FBFFFFF

7FF0000000000001-7FF7FFFFFFFFFFFF

negQNaN

FE00-FFFF

FFC0-FFFF

FFC00000-FFFFFFFF

FFF8000000000000-FFFFFFFFFFFFFFFF

negSNaN

FC01-FDFF

FF81-FFBF

FF800001-FFBFFFFF

FFF0000000000001-FFF7FFFFFFFFFFFF

posrandom

58B4

7EF8

7EF8654F

5A392534A57711AD

negrandom

C93A

813D

813D9AB0

A6E895993737426C

±2.5 and ±2p (p is the format’s precision: 11 for half, 8 for BF16, 24 for float, 53 for double) are exact ties for some operations, so they distinguish RMM from RNE. Converting ±2.5 to an integer is a tie between 2 and 3. Adding ±1.0 to ±2p is a tie between 2p and 2p+2.

The register edge cases are selected to include extreme values and their immediate neighbors. They also include walking 1s and an arbitrary intermediate value. RV64 adds edge cases near the 32-bit boundary to stress W-type instructions. Immediate edge cases exercise each bit of the immediate, extreme values, and one random intermediate value.

A.2.1. Hazards

Hazard tests are applied to every unprivileged Instruction Under Test (IUT) that uses a source or destination. The hazard receives the source from Secondary_Producer_Instruction (SPI) or sends the destination value to a Secondary Consumer Instruction (SCI). All relevant Read-After-Write (RAW), Write-After-Read (WAR), and Write-After-Write (WAW) hazards are exercised. They are tested with the SI being adjacent to the IUT, and being separated by a small amount. The SI is selected as a representative instruction from each of many categories of instructions to exercise forwarding between different functional units.

The categories of SPI and SCI are given in Table 15 and Table 16, respectively.

Table 15. Secondary Producer Instruction Categories
Category ALU Complex Memory Control CSR (Zicsr) Mult (Zmmul/M) Float (F) VectorInt (Zve32x + Zvl64b) VectorFloat (Zve32f+Zvl64b)

Int (rd)

auipc, li

sll, cpop (Zbb), clmul (Zbc), sha256sig0 (Zknh)

lw, amoswap.w (Zaamo)

jal

csrr

mul, div

fcvt.w.s, fmv.x.w, fclass.s, feq.s

vmv.x.s

PC

jal, jalr, beq

FP (fd)

flw

fmadd.s, fdiv.s, fli.s (Zfa), fsqrt.d (D), fsqrt.h (Zfh), fsqrt.q (Q)

vmv.f.s

Vector (vd)

vle32.v

vadd.vi

vfadd.vf

Memory

sw, amoswap.w (Zaamo), cbo.zero (Zicboz)

fsw

vse32.v

CSR (rd)

csrr fflags

csrr vcsr

Table 16. Secondary Consumer Instruction Categories
Category ALU Complex Memory Control CSR (Zicsr) Mult (Zmmul/M) Float (F) VectorInt (Zve32x + Zvl64b) VectorFloat (Zve32f+Zvl64b)

Int

add (rs1/2), addi (rs1)

srl, sh1add (Zba), binv (Zbs), aes32dsmi (Zknd32), aes64dsm (Zknd32)

sw (rs2), amoswap.w (rs2, Zaamo)

beq (rs1/2)

csrw (rs1)

mul (rs1/2), div (rs1/2)

fcvt.s.w (rs1), fmv.w.x (rs1)

vadd.vx (rs1), vmv.v.x (rs1)

PC

auipc (implicit)

jal, jalr (implicit)

FP

fsw (fs2)

fmadd.s (fs1/2/3), fdiv.s (fs1/2), fli.s (fs1), fsqrt.d (fs1, D), fsqrt.h (fs1, Zfh), fsqrt.q (fs1, Q)

vfadd.vf (fs1), vmv.v.f (fs1)

Vector

vse32.v(vs2)

vadd.vv (vs1/2), vadd.vi (vs2), vmacc.vv (vs1/2/vd)

vfadd.vv (vs1/2), vfsqrt.v (vs2), vfmacc.vv (vs1/2/vd)

Memory

lw, amoswap.w (Zaamo)

fsw

vle32.v

CSR

csrw fflags

csrw vcsr

The types of hazards exercised are given in Table 17. Not all IUT have a source or destination, so not all hazard types are exercised for every IUT.

Table 17. Hazard Types
Type IUT First IUT Second

RAW

IUT dest → SCI source

SPI dest → IUT source

WAR

IUT source → SPI dest

SCI source → IUT dest

WAW

IUT dest → SPI dest

SPI dest → IUT dest

When multiple representative instructions are listed, one is randomly selected from the list for each test. Certain categories and certain instructions in a category (amoswap, fli, fsqrt.d/h/q) only may be selected if the relevant extension is present. Different source instructions consume one, two, or three sources. Loads, stores, and atomics always use rs1 as a pointer to a scratch memory location holding a random value. Subword load, store, and atomic IUTs use a random naturally aligned offset in the range [0, 3]. Tests assume mstatus.FS/VS are dirty, if applicable. Loads and atomics have a memory source operand. Stores, atomics, and cbo.zero have a memory destination operand. Vector instructions operate on a vector of 2 32-bit elements. They are omitted if the vector unit does not support this. Note that li is the pseudo-instruction for addi rd, x0, imm12.

The test cases are as follows:

  • If the IUT has {int/pc/fp/vector/memory/CSR} source operand:

    • For each IUT source

      • For each hazard_type in {RAW, WAR}

        • For each supported SPI category that can produce the source category (gated by #ifdef EXT_SUPPORTED)

          • For each delay in (0, random[1,3])

            • Pick random unused registers for IUT source(s) and destination from X1-x31 (-x15 for E), f0-f31, v0-v31. Ok to duplicate source registers.

            • Pick random representative SPI from category, and random unused source registers for SPI.

            • Initialize IUT and SPI sources to random values

            • If hazard_type = RAW // SPI dest → IUT source

              • SPI dest = random IUT source

              • Perform SPI

              • If delay > 0, perform delay dependent instructions

              • Perform IUT

              • SIGUPD IUT dest or otherwise test IUT result

            • If hazard_type = WAR // IUT source → SPI dest

              • SPI dest = random IUT source

              • Perform IUT

              • If delay > 0, perform delay dependent instructions

              • Perform SPI

              • SIGUPD IUT dest or otherwise test IUT result

              • SIGUPD SPI dest

  • If the IUT has {int/pc/fp/vector/memory/CSR} destination operand:

    • For each hazard_type in {RAW, WAR}

      • For each supported SCI category that can read the source category (gated by #ifdef EXT_SUPPORTED)

        • For each delay in (0, random[1,3])

          • Pick random unused registers for IUT source(s) and destination from X1-x15, f0-f31, v0-v31. Ok to duplicate source registers.

          • Pick random representative SCI from category, and random unused source registers for SCI.

          • Initialize IUT and SCI sources to random values

          • If hazard_type = RAW // IUT dest → SCI source

            • random SCI source = IUT dest

            • Perform IUT

            • If delay > 0, perform delay dependent instructions

            • Perform SCI

            • SIGUPD SI dest or otherwise test SI result

          • If hazard_type = WAR // SCI source → IUT dest

            • random SCI source = IUT dest

            • Perform SCI

            • If delay > 0, perform delay dependent instructions

            • Perform IUT

            • SIGUPD IUT dest or otherwise test IUT result

            • SIGUPD SCI dest

    • For hazard_type = WAW

      • For each supported SPI category that can produce the source category (gated by #ifdef EXT_SUPPORTED)

        • For each delay in (0, random[1,3])

          • Pick random unused registers for IUT source(s) and destination from X1-x31 (-x15 for E), f0-f31, v0-v31. Ok to duplicate source registers.

          • Pick random representative SPI from category, and random unused source registers for SPI.

          • Initialize IUT and SPI sources to random values

          • SPI dest = IUT dest

          • Perform SPI // SPI dest → IUT dest

          • If delay > 0, perform delay dependent instructions

          • Perform IUT

          • SIGUPD IUT dest or otherwise test IUT result

          • Perform IUT // IUT dest → SPI dest

          • If delay > 0, perform delay dependent instructions

          • Perform SPI

          • SIGUPD SPI dest or otherwise test SPI result

Hazard coverpoints are named cp_hazard_{hazard_type}_{IUT source/dest}_{to/from}_{SI category}_{delay}. IUT source/dest is one of {rs1, rs2, rd, fs1, fs2, fs3, fd, vs1, vs2, vd, memr, memw, csrr, csrw, pc}.

The number of hazard bins for a typical R-type integer IUT is 2 sources) * (2 hazard types) + (1 destination) * (4 hazard types * (8 categories) * (2 delays) = 128 bins.

A.3. I Base Integer Extension

Table 18 summarizes the coverpoints for the I extension. The Type column is used to generate tests with the appropriate operands. An x in the RV32 or RV64 column indicates that the instruction is supported in that XLEN. The remaining columns refer to coverpoints defined in Table 11. An x in a coverpoint column selects that coverpoint. Any other entry selects a modified coverpoint whose name is the column name followed by an underscore and the entry. For example, nx0 in the cp_rs1 column selects cp_rs1_nx0. Table 19 defines the modified coverpoints.

Table 18. I Instruction Coverpoints
Instruction add addi addiw addw and andi auipc beq bge bgeu blt bltu

RV32

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

cp_asm_count

x

x

x

x

x

x

x

x

x

x

x

x

cp_rs1

x

x

x

x

x

x

x

x

x

x

x

cp_rs2

x

x

x

x

x

x

x

x

cp_rd

x

x

x

x

x

x

x

cp_rs1_edges

x

x

x

x

x

x

x

x

x

x

x

cp_rs2_edges

x

x

x

x

x

x

x

x

cr_rs1_imm_edges

x

x

x

cr_rs1_rs2_edges

x

x

x

offset

offset

offset

offset

offset

cmp_rs1_rs2

x

x

x

x

x

x

x

x

cmp_rd_rs1

x

x

x

x

x

x

cmp_rd_rs2

x

x

x

cmp_rd_rs1_rs2

x

x

x

cp_offset

x

x

x

x

x

cp_imm_edges

x

x

x

20bit

branch

branch

branch

branch

branch

Instruction bne fence jal jalr lb lbu ld lh lhu lui lw lwu

RV32

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

cp_asm_count

x

x

x

x

x

x

x

x

x

x

x

x

cp_rs1

x

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

cp_rs2

x

cp_rd

x

x

x

x

x

x

x

x

x

x

cp_rs1_edges

x

cp_rs2_edges

x

cr_rs1_rs2_edges

offset

cmp_rs1_rs2

x

cmp_rd_rs1

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

cp_offset

x

x

jalr

cp_imm_edges

branch

jal

x

x

x

x

x

x

20bit

x

x

cp_align

byte

byte

hword

hword

word

word

cp_memval

byte

byte

double

hword

hword

word

word

cp_custom

fence

Instruction nop or ori sb sd sh sll slli slliw sllw slt slti

RV32

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

cp_asm_count

x

x

x

x

x

x

x

x

x

x

x

x

cp_rs1

x

x

nx0

nx0

nx0

x

x

x

x

x

x

cp_rs2

x

x

x

x

x

x

x

cp_rd

x

x

x

nx0

nx0

x

nx0

nx0

cp_rs1_edges

x

x

x

x

x

x

x

x

cp_rs2_edges

x

x

x

x

x

x

x

cr_rs1_imm_edges

x

uimm

uimmw

x

cr_rs1_rs2_edges

x

x

x

x

cmp_rs1_rs2

x

x

x

x

cmp_rd_rs1

x

x

x

nx0

nx0

x

nx0

nx0

cmp_rd_rs2

x

x

x

nx0

cmp_rd_rs1_rs2

x

x

x

nx0

cp_uimm

x

5

cp_imm_edges

x

x

x

x

x

cp_align

byte

hword

Instruction sltiu sltu sra srai sraiw sraw srl srli srliw srlw sub subw

RV32

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

cp_asm_count

x

x

x

x

x

x

x

x

x

x

x

x

cp_rs1

x

x

x

x

x

x

x

x

x

x

x

x

cp_rs2

x

x

x

x

x

x

x

cp_rd

nx0

nx0

x

nx0

nx0

x

x

nx0

nx0

x

x

x

cp_rs1_edges

x

x

x

x

x

x

x

x

x

x

x

x

cp_rs2_edges

x

x

x

x

x

x

x

cr_rs1_imm_edges

x

uimm

uimmw

uimm

uimmw

cr_rs1_rs2_edges

x

x

x

x

x

x

x

cmp_rs1_rs2

x

x

x

x

x

x

x

cmp_rd_rs1

nx0

nx0

x

nx0

nx0

x

x

nx0

nx0

x

x

x

cmp_rd_rs2

nx0

x

x

x

x

x

x

cmp_rd_rs1_rs2

nx0

x

x

x

x

x

x

cp_uimm

x

5

x

5

cp_imm_edges

x

Instruction sw xor xori

RV32

x

x

x

RV64

x

x

x

cp_asm_count

x

x

x

cp_rs1

nx0

x

x

cp_rs2

x

x

cp_rd

x

x

cp_rs1_edges

x

x

cp_rs2_edges

x

x

cr_rs1_imm_edges

x

cr_rs1_rs2_edges

x

cmp_rs1_rs2

x

cmp_rd_rs1

x

x

cmp_rd_rs2

x

cmp_rd_rs1_rs2

x

cp_imm_edges

x

x

cp_align

word

Table 19. I Modified Coverpoints
Modified Coverpoint Bins Definition

cp_rs1_nx0

31

The rs1 register number, excluding x0. Used by loads, stores, and jalr, whose address would otherwise be the immediate alone, which might not be accessible.

cp_rd_nx0

31

The rd register number, excluding x0. Used by instructions whose rd = x0 encodings are custom HINTs (see below).

cmp_rd_rs1_nx0, cmp_rd_rs2_nx0, cmp_rd_rs1_rs2_nx0

31

cmp_rd_rs1, cmp_rd_rs2, and cmp_rd_rs1_rs2, excluding x0. Used with cp_rs1_nx0 or cp_rd_nx0.

cp_offset_jalr

2 + 4

Expands to two coverpoints for jalr. cp_offset has 2 bins: the target address rs1 + imm is below or above the pc of the jalr. cp_offset_lsbs has 4 bins: every combination of rs1[0] and imm[0], because jalr clears the least-significant bit of rs1 + imm.

cp_imm_edges_branch

8

Branch offsets 4, 8, 16, 2048, 4092, -4, -8, and -4096. These include the most negative offset and the largest positive multiple of 4.

cr_rs1_rs2_edges_offset

12*12*2 (RV32), 18*18*2 (RV64)

Cross-product of rs1 edges, rs2 edges (see Table 12) and branch direction (cp_offset) for branches.

cr_rs1_imm_edges_uimm

5 + 12*5 (RV32), 10 + 18*10 (RV64)

Expands to cp_imm_edges_uimm and its cross-product with cp_rs1_edges, for slli, srli, and srai. cp_imm_edges_uimm has the shift amounts 0, 1, 19, 30, and 31, plus 32, 33, 45, 62, and 63 on RV64.

cr_rs1_imm_edges_uimmw

5 + 18*5

Expands to cp_imm_edges_uimmw and its cross-product with cp_rs1_edges, for slliw, srliw, and sraiw. cp_imm_edges_uimmw has the shift amounts 0, 1, 19, 30, and 31.

cp_uimm_5

32

5-bit unsigned shift amount for slliw, srliw, and sraiw.

cp_imm_edges_20bit

27

20-bit variant of Table 13 for lui and auipc.

cp_imm_edges_jal

24

jal offsets of ±2k for k = 2 to 13 (±4 to ±8192). The J-type offset reaches ±1 MiB, but long jumps take a large amount of program memory, so the bins cover a subset of the range.

cp_align_{byte/hword/word}

8/4/2

Position of a naturally aligned byte, halfword, or word access within a doubleword in memory.

cp_memval_{byte/hword/word/double}

5

The loaded value in the low 8, 16, 32, or 64 bits of rd is 0, 1, the largest positive value, the most negative value, or all ones.

cp_custom_fence_pred_succ

256

Every fence pred and succ set with fm = 0 and rd = rs1 = x0 executes without trapping, including the HINT encodings with pred = 0 or succ = 0.

cp_custom_fence_reserved

9

fence.tso, fm = 1000 with another pred and succ, a reserved fm value, fences with nonzero rd or rs1, and HINTs with pred = 0 or succ = 0 and nonzero rd or rs1 execute without trapping.

Table 20 summarizes the normative rules in the RV{32/64}I specification and the unprivileged coverpoints that check they have been exercised. Privileged coverpoints related to integer instructions are described in the relevant parts of Privileged Test Plan such as Sm and Exceptions. In particular, ebreak and ecall are only tested in the Privileged test plan because their behavior is UNSPECIFIED without an mtvec trap vector CSR. Reserved behaviors are checked in Section B.5. Note that the testplans always test the following fundamental capabilities, even if no normative rule is cited:

  • Opcodes (cp_asm_count)

  • All Source and Destination Registers (cp_rs1, cp_rs2, cp_rd)

  • Edge values (cp_rs1_edges, cp_rs2_edges, cp_imm_edges, cr_rs1_rs2_edges, cr_rs1_imm_edges)

  • All other bitfields in the instruction

Table 20. I Normative Rules
Normative Rule Rule Text Coverpoints

ee_impl_flex

The implementation of a RISC-V execution environment can be pure hardware, pure software, or a combination of hardware and software. For example, opcode traps and software emulation can be used to implement functionality not provided in hardware.

Descriptive spec text with no separately testable behavior

base_integer_variants

There are two primary base integer variants, RV32I and RV64I, described in rv32 and rv64, which provide 32-bit or 64-bit address spaces respectively.

Definition, checked through UDB

xlen_definition

We use the term XLEN to refer to the width of an integer register in bits (either 32 or 64).

Definition, checked through UDB

exception_def

We use the term exception to refer to an unusual condition occurring at run time associated with an instruction in the current RISC-V hart.

Descriptive spec text with no separately testable behavior

interrupt_def

We use the term interrupt to refer to an external asynchronous event that may cause a RISC-V hart to experience an unexpected transfer of control.

Descriptive spec text with no separately testable behavior

trap_def

We use the term trap to refer to the transfer of control to a trap handler caused by either an exception or an interrupt.

Descriptive spec text with no separately testable behavior

rv32i_xreg_sz

For RV32I, the 32 x registers are each 32 bits wide, i.e., XLEN=32.

I_add_cg/{cp_rs1, cp_rs2, cp_rd, cr_rs1_rs2_edges}

rv32i_rv64i_other_xregs

General purpose registers x1&#8205;&#8211;&#8205;x31 hold values that various instructions interpret as a collection of Boolean values, or as two’s complement signed binary integers or unsigned binary integers.

I_add_cg/{cp_rs1, cp_rs2, cp_rd, cr_rs1_rs2_edges}

pcreg_op

There is one additional unprivileged register: the program counter pc holds the address of the current instruction.

I_auipc_cg/{cp_rd, cp_imm_edges_20bit}

slti_sltiu_op

SLTI (set less than immediate) places the value 1 in register rd if register rs1 is less than the sign-extended immediate when both are treated as signed numbers, else 0 is written to rd. SLTIU is similar but compares the values as unsigned numbers (i.e., the immediate is first sign-extended to XLEN bits then treated as an unsigned number).

I_slti_cg/{cp_rs1, cp_rd_nx0, cr_rs1_imm_edges}, I_sltiu_cg/{cp_rs1, cp_rd_nx0, cr_rs1_imm_edges}

x0eq0

Register x0 is hardwired with all bits equal to 0.

I_add_cg/{cp_rs1, cp_rs2, cp_rd, cr_rs1_rs2_edges}

twos_complement_signed_integers

The base integer instruction sets use a two’s-complement representation for signed integer values.

I_slt_cg/cr_rs1_rs2_edges, I_slti_cg/cr_rs1_imm_edges, I_blt_cg/cr_rs1_rs2_edges_offset, I_sra_cg/cr_rs1_rs2_edges

nop_enc

NOP is encoded as ADDI x0, x0, 0.

I_nop_cg/cp_asm_count

nop_op

The NOP instruction does not change any architecturally visible state, except for advancing the pc and incrementing any applicable performance counters.

I_nop_cg/{cp_asm_count}

addi_op

ADDI adds the sign-extended 12-bit immediate to register rs1.

I_addi_cg/{cp_rs1, cp_rd, cr_rs1_imm_edges}

addi_overflow

Arithmetic overflow is ignored and the result is simply the low XLEN bits of the result.

I_addi_cg/cr_rs1_imm_edges. Cases such as all 1s + all 1s overflow.

andi_ori_xori_op

ANDI, ORI, XORI are logical operations that perform bitwise AND, OR, and XOR on register rs1 and the sign-extended 12-bit immediate and place the result in rd.

{I_andi_cg, I_ori_cg, I_xori_cg}/{cp_rs1, cp_rd, cr_rs1_imm_edges}

slli_op

SLLI is a logical left shift (zeros are shifted into the lower bits);

I_slli_cg/{cp_rs1, cp_rd_nx0, cr_rs1_imm_edges_uimm}

srli_op

SRLI is a logical right shift (zeros are shifted into the upper bits);

I_srli_cg/{cp_rs1, cp_rd_nx0, cr_rs1_imm_edges_uimm}

srai_op

SRAI is an arithmetic right shift (the original sign bit is copied into the vacated upper bits).

I_srai_cg/{cp_rs1, cp_rd_nx0, cr_rs1_imm_edges_uimm}

lui_op

LUI places the 32-bit U-immediate value into the destination register rd, filling in the lowest 12 bits with zeros.

I_lui_cg/{cp_rd, cp_imm_edges_20bit}

auipc_op

AUIPC forms a 32-bit offset from the U-immediate, filling in the lowest 12 bits with zeros, adds this offset to the address of the AUIPC instruction, then places the result in register rd.

I_auipc_cg/{cp_rd, cp_imm_edges_20bit}

R-type_operands

All operations read the rs1 and rs2 registers as source operands and write the result into register rd.

I_add_cg/{cp_rs1, cp_rs2, cp_rd, cmp_rd_rs1_rs2}

add_op

ADD performs the addition of rs1 and rs2.

I_add_cg/{cp_rs1, cp_rs2, cp_rd, cr_rs1_rs2_edges}

sub_op

SUB performs the subtraction of rs2 from rs1.

I_sub_cg/{cp_rs1, cp_rs2, cp_rd, cr_rs1_rs2_edges}

add_sub_overflow

Overflows are ignored and the low XLEN bits of results are written to the destination rd.

{I_add_cg, I_sub_cg}/cr_rs1_rs2_edges. Cases such as all 1s + all 1s overflow.

slt_sltu_op

SLT and SLTU perform signed and unsigned compares respectively, writing 1 to rd if rs1 < rs2, 0 otherwise.

I_slt_cg/{cp_rs1, cp_rs2, cp_rd_nx0, cr_rs1_rs2_edges}, I_sltu_cg/{cp_rs1, cp_rs2, cp_rd_nx0, cr_rs1_rs2_edges}

and_or_xor_op

AND, OR, and XOR perform bitwise logical operations.

{I_and_cg, I_or_cg, I_xor_cg}/{cp_rs1, cp_rs2, cp_rd, cr_rs1_rs2_edges}

sll_srl_sra_op

SLL, SRL, and SRA perform logical left, logical right, and arithmetic right shifts on the value in register rs1 by the shift amount held in the lower 5 bits of register rs2.

{I_sll_cg, I_srl_cg, I_sra_cg}/{cp_rs1, cp_rs2, cp_rd, cr_rs1_rs2_edges}

no_cti_delay_slots

Control transfer instructions in RV32I do not have architecturally visible delay slots.

{I_beq_cg, I_jal_cg, I_jalr_cg}/cp_offset

jal_target

The offset is sign-extended and added to the address of the jump instruction to form the jump target address.

I_jal_cg/cp_offset

jal_op

JAL stores the address of the instruction following the jump (pc+4) into register rd.

I_jal_cg/{cp_rd}

jalr_target

The target address is obtained by adding the sign-extended 12-bit I-immediate to the register rs1, then setting the least-significant bit of the result to zero.

I_jalr_cg/{cp_imm_edges, cp_offset_lsbs}

jalr_op

The address of the instruction following the jump (pc+4) is written to register rd.

I_jalr_cg/{cp_rd}

br_target

The 12-bit B-immediate encodes signed offsets in multiples-of-two bytes. The offset is sign-extended and added to the address of the branch instruction to give the target address.

{I_beq_cg, I_bne_cg}/{cp_offset, cp_imm_edges_branch}

beq_bne_op

BEQ and BNE take the branch if registers rs1 and rs2 are equal or unequal respectively.

{I_beq_cg, I_bne_cg}/{cp_rs1, cp_rs2, cr_rs1_rs2_edges_offset}

blt_bltu_op

BLT and BLTU take the branch if rs1 is less than rs2, using signed and unsigned comparison respectively.

{I_blt_cg, I_bltu_cg}/{cp_rs1, cp_rs2, cr_rs1_rs2_edges_offset}

bge_bgeu_op

BGE and BGEU take the branch if rs1 is greater than or equal to rs2, using signed and unsigned comparison respectively.

{I_bge_cg, I_bgeu_cg}/{cp_rs1, cp_rs2, cr_rs1_rs2_edges_offset}

ldst_ea

The effective address is obtained by adding register rs1 to the sign-extended 12-bit offset.

{I_lw_cg, I_sw_cg}/{cp_rs1_nx0, cp_imm_edges}

ldst_no_exc_aligned

loads and stores whose effective addresses are naturally aligned shall not raise an address-misaligned exception.

I_lw_cg/cp_align_word, I_lh_cg/cp_align_hword, I_sw_cg/cp_align_word, I_sh_cg/cp_align_hword

load_op

Loads copy a value from memory to register rd.

I_lw_cg/{cp_memval_word}

store_op

Stores copy the value in register rs2 to memory.

I_sw_cg/{cp_rs2_edges}

lw_op

The LW instruction loads a 32-bit value from memory into rd.

I_lw_cg/{cp_rs1_nx0, cp_rd, cp_imm_edges, cp_memval_word}

lh_op

LH loads a 16-bit value from memory, then sign-extends to 32-bits before storing in rd.

I_lh_cg/{cp_rs1_nx0, cp_rd, cp_imm_edges, cp_memval_hword}

lhu_op

LHU loads a 16-bit value from memory but then zero extends to 32-bits before storing in rd.

I_lhu_cg/{cp_rs1_nx0, cp_rd, cp_imm_edges, cp_memval_hword}

lb_lbu_op

LB and LBU are defined analogously for 8-bit values.

I_lb_cg/{cp_rs1_nx0, cp_rd, cp_imm_edges, cp_memval_byte}, I_lbu_cg/{cp_rs1_nx0, cp_rd, cp_imm_edges, cp_memval_byte}

sw_sh_sb_op

The SW, SH, and SB instructions store 32-bit, 16-bit, and 8-bit values from the low bits of register rs2 to memory.

I_sw_cg/{cp_rs1_nx0, cp_rs2, cp_rs2_edges, cp_imm_edges}, I_sh_cg/{cp_rs1_nx0, cp_rs2, cp_rs2_edges, cp_imm_edges}, I_sb_cg/{cp_rs1_nx0, cp_rs2, cp_rs2_edges, cp_imm_edges}

ldst_atomicity_for_aligned

naturally aligned loads and stores are guaranteed to execute atomically

{I_lw_cg, I_sw_cg}/cp_align_word, Not tested: atomicity is not observable in single-hart signature tests

fence_op

A FENCE (with fm=0000) orders all memory operations in its predecessor set before all memory operations in its successor set.

I_fence_cg/{cp_custom_fence_pred_succ}, ordering not tested

fence-tso_op

FENCE.TSO orders all load operations in its predecessor set before all memory operations in its successor set, and all store operations in its predecessor set before all store operations in its successor set. This leaves non-AMO store operations in the FENCE.TSO’s predecessor set unordered with non-AMO loads in its successor set.

I_fence_cg/{cp_custom_fence_reserved}, ordering not tested

fence_unused_flds_rsv

The unused fields in the FENCE instructions, rs1 and rd, are reserved for finer-grain fences in future extensions. For forward compatibility, base implementations shall ignore these fields

I_fence_cg/{cp_custom_fence_reserved, cp_custom_fence_pred_succ}

hints_enc

Most RV32I HINTs are encoded as integer computational instructions with rd=x0. The other RV32I HINTs are encoded as FENCE instructions with a null predecessor or successor set and with fm=0.

{I_add_cg, I_addi_cg, I_lui_cg}/cp_rd, I_fence_cg/{cp_custom_fence_pred_succ, cp_custom_fence_reserved}

hints_op

HINTs do not change any architecturally visible state, except for advancing the pc and any applicable performance counters. Implementations are always allowed to ignore the encoded hints.

{I_add_cg, I_addi_cg}/cp_rd, I_fence_cg/{cp_custom_fence_pred_succ, cp_custom_fence_reserved}

rvwmo_single_hart_op

Under RVWMO, code running on a single hart appears to execute in order from the perspective of other memory instructions in the same hart, but memory instructions from another hart may observe the memory instructions from the first hart being executed in a different order.

{I_sw_cg, I_sh_cg, I_sb_cg, I_sd_cg}/cp_rs2_edges, Observation by other harts OUT-OF-SCOPE for single hart

rvwmo_single_copy_atomic

All memory operations are single-copy atomic: they can never be observed in a partially complete state.

OUT-OF-SCOPE for single hart

rvwmo_aligned_memop

Each aligned memory instruction that accesses XLEN or fewer bits gives rise to exactly one memory operation, unless specified otherwise.

OUT-OF-SCOPE for single hart

rvwmo_aligned_amo_memop

An aligned AMO gives rise to a single memory operation that is both a load operation and a store operation simultaneously.

OUT-OF-SCOPE for single hart

rvwmo_misaligned_ldst_memops

A misaligned load or store instruction may be decomposed into a set of component memory operations of any granularity.

OUT-OF-SCOPE for single hart

rvwmo_fp_gt_xlen_memops

A floating-point load or store of more than XLEN bits may also be decomposed into a set of component memory operations of any granularity.

OUT-OF-SCOPE for single hart

rvwmo_order_multi_memops

The memory operations generated by such instructions are not ordered with respect to each other in program order, but they are ordered normally with respect to the memory operations generated by preceding and subsequent instructions in program order.

OUT-OF-SCOPE for single hart

rvwmo_misaligned_in_atomic_pma

memory accesses affected by the misaligned atomicity granule PMA that lie within a misaligned atomicity granule are not decomposed.

OUT-OF-SCOPE for single hart

rvwmo_ppo_lead_in

The complete definition of preserved program order is as follows (and note that AMOs are simultaneously both loads and stores): memory operation a precedes memory operation b in preserved program order (and hence also in the global memory order) if a precedes b in program order, a and b both access regular main memory (rather than I/O regions), and any of the following hold:

OUT-OF-SCOPE for single hart

rvwmo_ppo_overlap1

b is a store, and a and b access overlapping memory addresses

TODO: load then store, and store then store, to one address, checking the load returns the old value and the later store’s value persists, Ordering seen by other harts OUT-OF-SCOPE for single hart

rvwmo_ppo_overlap2

a and b are loads, x is a byte read by both a and b, there is no store to x between a and b in program order, and a and b return values for x written by different memory operations

OUT-OF-SCOPE for single hart

rvwmo_ppo_overlap3

a is generated by an AMO or SC instruction, b is a load, and b returns a value written by a

OUT-OF-SCOPE for single hart

rvwmo_ppo_sync1

There is a FENCE instruction that orders a before b

OUT-OF-SCOPE for single hart

rvwmo_ppo_sync2

a has an acquire annotation

OUT-OF-SCOPE for single hart

rvwmo_ppo_sync3

b has a release annotation

OUT-OF-SCOPE for single hart

rvwmo_ppo_sync4

a and b both have RCsc annotations

OUT-OF-SCOPE for single hart

rvwmo_ppo_sync5

a is paired with b

OUT-OF-SCOPE for single hart

rvwmo_ppo_dep1

b has a syntactic address dependency on a

OUT-OF-SCOPE for single hart

rvwmo_ppo_dep2

b has a syntactic data dependency on a

OUT-OF-SCOPE for single hart

rvwmo_ppo_dep3

b is a store, and b has a syntactic control dependency on a

OUT-OF-SCOPE for single hart

rvwmo_ppo_pipe1

b is a load, and there exists some store m between a and b in program order such that m has an address or data dependency on a, and b returns a value written by m

OUT-OF-SCOPE for single hart

rvwmo_ppo_pipe2

b is a store, and there exists some instruction m between a and b in program order such that m has an address dependency on a

OUT-OF-SCOPE for single hart

rvwmo_obeyed

An execution of a RISC-V program obeys the RVWMO memory consistency model only if there exists a global memory order conforming to preserved program order and satisfying the load value axiom, the atomicity axiom, and the progress axiom.

OUT-OF-SCOPE for single hart

rvwmo_ld_val_axiom_lead_in

Each byte of each load i returns the value written to that byte by the store that is the latest in global memory order among the following stores:

{I_sw_cg, I_sh_cg, I_sb_cg, I_sd_cg}/cp_rs2_edges, Stores from other harts OUT-OF-SCOPE for single hart

rvwmo_ld_val_axiom_list

Stores that write that byte and that precede i in the global memory order Stores that write that byte and that precede i in program order

{I_sw_cg, I_sh_cg, I_sb_cg, I_sd_cg}/cp_rs2_edges, Stores from other harts OUT-OF-SCOPE for single hart

rvwmo_atomicity_axiom

If r and w are paired load and store operations generated by aligned LR and SC instructions in a hart h, s is a store to byte x, and r returns a value written by s, then s must precede w in the global memory order, and there can be no store from a hart other than h to byte x following s and preceding w in the global memory order.

OUT-OF-SCOPE for single hart

rvwmo_progress_axiom

No memory operation may be preceded in the global memory order by an infinite sequence of other memory operations.

OUT-OF-SCOPE for single hart

lui_enc

LUI

I_lui_cg/cp_asm_count

auipc_enc

AUIPC

I_auipc_cg/cp_asm_count

jal_enc

JAL

I_jal_cg/cp_asm_count

jalr_enc

JALR

I_jalr_cg/cp_asm_count

beq_enc

BEQ

I_beq_cg/cp_asm_count

bne_enc

BNE

I_bne_cg/cp_asm_count

blt_enc

BLT

I_blt_cg/cp_asm_count

bge_enc

BGE

I_bge_cg/cp_asm_count

bltu_enc

BLTU

I_bltu_cg/cp_asm_count

bgeu_enc

BGEU

I_bgeu_cg/cp_asm_count

lb_enc

LB

I_lb_cg/cp_asm_count

lh_enc

LH

I_lh_cg/cp_asm_count

lw_enc

LW

I_lw_cg/cp_asm_count

lbu_enc

LBU

I_lbu_cg/cp_asm_count

lhu_enc

LHU

I_lhu_cg/cp_asm_count

sb_enc

SB

I_sb_cg/cp_asm_count

sh_enc

SH

I_sh_cg/cp_asm_count

sw_enc

SW

I_sw_cg/cp_asm_count

addi_enc

ADDI

I_addi_cg/cp_asm_count

slti_enc

SLTI

I_slti_cg/cp_asm_count

sltiu_enc

SLTIU

I_sltiu_cg/cp_asm_count

xori_enc

XORI

I_xori_cg/cp_asm_count

ori_enc

ORI

I_ori_cg/cp_asm_count

andi_enc

ANDI

I_andi_cg/cp_asm_count

slli_enc

SLLI

I_slli_cg/cp_asm_count

srli_enc

SRLI

I_srli_cg/cp_asm_count

srai_enc

SRAI

I_srai_cg/cp_asm_count

add_enc

ADD

I_add_cg/cp_asm_count

sub_enc

SUB

I_sub_cg/cp_asm_count

sll_enc

SLL

I_sll_cg/cp_asm_count

slt_enc

SLT

I_slt_cg/cp_asm_count

sltu_enc

SLTU

I_sltu_cg/cp_asm_count

xor_enc

XOR

I_xor_cg/cp_asm_count

srl_enc

SRL

I_srl_cg/cp_asm_count

sra_enc

SRA

I_sra_cg/cp_asm_count

or_enc

OR

I_or_cg/cp_asm_count

and_enc

AND

I_and_cg/cp_asm_count

fence_enc

FENCE

I_fence_cg/cp_asm_count

fence-tso_enc

FENCE.TSO

I_fence_cg/cp_custom_fence_reserved

ecall_enc

ECALL

Exceptions_Sm_cg/cp_ecall_m

ebreak_enc

EBREAK

Exceptions_Sm_cg/cp_breakpoint

rv64i_xreg_sz

RV64I widens the integer registers and supported user address space to 64 bits, i.e., XLEN=64.

I_addw_cg/{cp_rs1, cp_rs2, cp_rd, cr_rs1_rs2_edges}

addiw_op

ADDIW is an RV64I instruction that adds the sign-extended 12-bit immediate to register rs1 and produces the proper sign extension of a 32-bit result in rd.

I_addiw_cg/{cp_rs1, cp_rd, cr_rs1_imm_edges}

addiw_overflow

Overflows are ignored and the result is the low 32 bits of the result sign-extended to 64 bits.

I_addiw_cg/cr_rs1_imm_edges

addw_subw_op

ADDW and SUBW are RV64I-only instructions that are defined analogously to ADD and SUB but operate on 32-bit values and produce signed 32-bit results.

{I_addw_cg, I_subw_cg}/{cp_rs1, cp_rs2, cp_rd, cr_rs1_rs2_edges}

addw_subw_overflow

Overflows are ignored, and the low 32-bits of the result is sign-extended to 64-bits and written to the destination register.

{I_addw_cg, I_subw_cg}/cr_rs1_rs2_edges

auipc_op_rv64i

AUIPC forms a 32-bit offset from the U-immediate, filling in the lowest 12 bits with zeros, sign-extends the result to 64 bits, adds it to the address of the AUIPC instruction, then places the result in register rd.

I_auipc_cg/{cp_rd, cp_imm_edges_20bit}

ld_op_rv64i

The LD instruction loads a 64-bit value from memory into register rd for RV64I.

I_ld_cg/{cp_rs1_nx0, cp_rd, cp_imm_edges, cp_memval_double}

lw_op_rv64i

The LW instruction loads a 32-bit value from memory and sign-extends this to 64 bits before storing it in register rd for RV64I.

I_lw_cg/cp_memval_word

lh_lhu_lb_lbu_op_rv64i

LH and LHU are defined analogously for 16-bit values, as are LB and LBU for 8-bit values.

I_lb_cg/cp_memval_byte, I_lbu_cg/cp_memval_byte, I_lh_cg/cp_memval_hword, I_lhu_cg/cp_memval_hword

lui_op_rv64i

LUI places the 32-bit U-immediate into register rd, filling in the lowest 12 bits with zeros. The 32-bit result is sign-extended to 64 bits.

I_lui_cg/cp_imm_edges_20bit

lwu_op

The LWU instruction, on the other hand, zero-extends the 32-bit value from memory for RV64I.

I_lwu_cg/cp_memval_word

rv64_w_sex

These *W instructions ignore the upper 32 bits of their inputs and always produce 32-bit signed values, sign-extending them to 64 bits, i.e. bits XLEN-1 through 31 are equal.

{I_addw_cg, I_sraw_cg}/cr_rs1_rs2_edges, I_addiw_cg/cr_rs1_imm_edges, I_sraiw_cg/cr_rs1_imm_edges_uimmw

sd_sw_sh_sb_op_rv64i

The SD, SW, SH, and SB instructions store 64-bit, 32-bit, 16-bit, and 8-bit values from the low bits of register rs2 to memory respectively.

I_sb_cg/cp_rs2_edges, I_sd_cg/cp_rs2_edges, I_sh_cg/cp_rs2_edges, I_sw_cg/cp_rs2_edges

sll_srl_sra_shamt_rv64i

In RV64I, only the low 6 bits of rs2 are considered for the shift amount.

I_sll_cg/cr_rs1_rs2_edges, I_sra_cg/cr_rs1_rs2_edges, I_srl_cg/cr_rs1_rs2_edges

slliw_srliw_sraiw_imm5_rsv

SLLIW, SRLIW, and SRAIW encodings with imm[5]≠0 are reserved.

I_slliw_cg/cp_uimm_5, See also Ssstrict in Section B.5, I_sraiw_cg/cp_uimm_5, See also Ssstrict in Section B.5, I_srliw_cg/cp_uimm_5, See also Ssstrict in Section B.5

slliw_srliw_sraiw_op

SLLIW, SRLIW, and SRAIW are RV64I-only instructions that are analogously defined but operate on 32-bit values and sign-extend their 32-bit results to 64 bits.

I_slliw_cg/{cp_rs1, cp_rd_nx0, cp_uimm_5, cr_rs1_imm_edges_uimmw}, I_sraiw_cg/{cp_rs1, cp_rd_nx0, cp_uimm_5, cr_rs1_imm_edges_uimmw}, I_srliw_cg/{cp_rs1, cp_rd_nx0, cp_uimm_5, cr_rs1_imm_edges_uimmw}

sllw_srlw_sraw_op

SLLW, SRLW, and SRAW are RV64I-only instructions that are analogously defined but operate on 32-bit values and sign-extend their 32-bit results to 64 bits. The shift amount is given by rs2[4:0].

I_sllw_cg/{cp_rs1, cp_rs2, cp_rd, cr_rs1_rs2_edges}, I_sraw_cg/{cp_rs1, cp_rs2, cp_rd, cr_rs1_rs2_edges}, I_srlw_cg/{cp_rs1, cp_rs2, cp_rd, cr_rs1_rs2_edges}

lwu_enc

LWU

I_lwu_cg/cp_asm_count

ld_enc

LD

I_ld_cg/cp_asm_count

sd_enc

SD

I_sd_cg/cp_asm_count

addiw_enc

ADDIW

I_addiw_cg/cp_asm_count

slliw_enc

SLLIW

I_slliw_cg/cp_asm_count

srliw_enc

SRLIW

I_srliw_cg/cp_asm_count

sraiw_enc

SRAIW

I_sraiw_cg/cp_asm_count

addw_enc

ADDW

I_addw_cg/cp_asm_count

subw_enc

SUBW

I_subw_cg/cp_asm_count

sllw_enc

SLLW

I_sllw_cg/cp_asm_count

srlw_enc

SRLW

I_srlw_cg/cp_asm_count

sraw_enc

SRAW

I_sraw_cg/cp_asm_count

UDB Parameters: None.

HINTs are covered as follows:

  • Standard HINTs encoded as integer computational instructions with rd = x0 are executed by the x0 bin of cp_rd. These instructions are lui, auipc, addi, andi, ori, xori, add, sub, and, or, xor, sll, srl, and sra, plus addiw, addw, subw, sllw, srlw, and sraw on RV64.

  • fence HINTs are covered by cp_custom_fence_pred_succ and cp_custom_fence_reserved.

  • Ratified HINTs such as Zihintpause and Zihintntl are covered in Section A.10.

  • The semihosting markers slli x0, x0, 31 and srai x0, x0, 7 are standard HINTs, but they are not tested.

  • Custom HINTs are not tested. They are the other rd = x0 encodings of slti, sltiu, slli, srli, srai, slt, and sltu, plus slliw, srliw, and sraiw on RV64. These instructions use cp_rd_nx0 and the cmp_*_nx0 coverpoints, so their tests never write x0.

A.4. M Extension for Integer Multiplication and Division

Table 21 summarizes the coverpoints for the M extension. Table 22 summarizes the relevant normative rules.

Table 21. M Instruction Coverpoints
Instruction div divu divuw divw mul mulh mulhsu mulhu mulw rem remu remuw

RV32

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

cp_asm_count

x

x

x

x

x

x

x

x

x

x

x

x

cp_rs1

x

x

x

x

x

x

x

x

x

x

x

x

cp_rs2

x

x

x

x

x

x

x

x

x

x

x

x

cp_rd

x

x

x

x

x

x

x

x

x

x

x

x

cp_rs1_edges

x

x

x

x

x

x

x

x

x

x

x

x

cp_rs2_edges

x

x

x

x

x

x

x

x

x

x

x

x

cr_rs1_rs2_edges

x

x

x

x

x

x

x

x

x

x

x

x

cmp_rs1_rs2

x

x

x

x

x

x

x

x

x

x

x

x

cmp_rd_rs1

x

x

x

x

x

x

x

x

x

x

x

x

cmp_rd_rs2

x

x

x

x

x

x

x

x

x

x

x

x

cmp_rd_rs1_rs2

x

x

x

x

x

x

x

x

x

x

x

x

Instruction remw

RV64

x

cp_asm_count

x

cp_rs1

x

cp_rs2

x

cp_rd

x

cp_rs1_edges

x

cp_rs2_edges

x

cr_rs1_rs2_edges

x

cmp_rs1_rs2

x

cmp_rd_rs1

x

cmp_rd_rs2

x

cmp_rd_rs1_rs2

x

Table 22. M Normative Rules
Normative Rule Rule Text Coverpoints

mul_op

MUL performs an XLEN-bit×XLEN-bit multiplication of rs1 by rs2 and places the lower XLEN bits in the destination register.

M_mul_cg/{cp_rs1, cp_rs2, cp_rd, cr_rs1_rs2_edges}

mulh_mulhu_mulhsu_op

MULH, MULHU, and MULHSU perform the same multiplication but return the upper XLEN bits of the full 2×XLEN-bit product, for signed×signed, unsigned×unsigned, and rs1×unsigned rs2 multiplication.

{M_mulh_cg, M_mulhu_cg, M_mulhsu_cg}/{cp_rs1, cp_rs2, cp_rd, cr_rs1_rs2_edges}

div_divu_op

DIV and DIVU perform an XLEN bits by XLEN bits signed and unsigned integer division of rs1 by rs2, rounding towards zero.

{M_div_cg, M_divu_cg}/{cp_rs1, cp_rs2, cp_rd, cr_rs1_rs2_edges}

divw_divuw_op

DIVW and DIVUW are RV64 instructions that divide the lower 32 bits of rs1 by the lower 32 bits of rs2, treating them as signed and unsigned integers, placing the 32-bit quotient in rd, sign-extended to 64 bits.

{M_divw_cg, M_divuw_cg}/{cp_rs1, cp_rs2, cp_rd, cr_rs1_rs2_edges}

rem_remu_op

REM and REMU provide the remainder of the corresponding division operation.

{M_rem_cg, M_remu_cg}/{cp_rs1, cp_rs2, cp_rd, cr_rs1_rs2_edges}

remw_remuw_op

REMW and REMUW are RV64 instructions that provide the corresponding signed and unsigned remainder operations.

{M_remw_cg, M_remuw_cg}/{cp_rs1, cp_rs2, cp_rd, cr_rs1_rs2_edges}

div_by_zero

The quotient of division by zero has all bits set

{M_div_cg, M_divu_cg, M_divw_cg, M_divuw_cg}/{cr_rs1_rs2_edges}

rem_by_zero

the remainder of division by zero equals the dividend.

{M_rem_cg, M_remu_cg, M_remw_cg, M_remuw_cg}/{cr_rs1_rs2_edges}

signed_div_overflow

Signed division overflow occurs only when the most-negative integer is divided by −1. The quotient of a signed division with overflow is equal to the dividend, and the remainder is zero.

{M_div_cg, M_rem_cg, M_divw_cg, M_remw_cg}/{cr_rs1_rs2_edges}

rem_result_sign

For REM, the sign of a nonzero result equals the sign of the dividend.

{M_rem_cg, M_remw_cg}/{cr_rs1_rs2_edges}

remw_remuw_result_sign

Both REMW and REMUW always sign-extend the 32-bit result to 64 bits, including on a divide by zero.

{M_remw_cg, M_remuw_cg}/{cr_rs1_rs2_edges}

mulw_op

MULW is an RV64 instruction that multiplies the lower 32 bits of the source registers, placing the sign extension of the lower 32 bits of the result into the destination register.

M_mulw_cg/{cp_rs1, cp_rs2, cp_rd, cr_rs1_rs2_edges}

mul_enc

MUL

M_mul_cg/cp_asm_count

mulh_enc

MULH

M_mulh_cg/cp_asm_count

mulhsu_enc

MULHSU

M_mulhsu_cg/cp_asm_count

mulhu_enc

MULHU

M_mulhu_cg/cp_asm_count

div_enc

DIV

M_div_cg/cp_asm_count

divu_enc

DIVU

M_divu_cg/cp_asm_count

rem_enc

REM

M_rem_cg/cp_asm_count

remu_enc

REMU

M_remu_cg/cp_asm_count

mulw_enc

MULW

M_mulw_cg/cp_asm_count

divw_enc

DIVW

M_divw_cg/cp_asm_count

divuw_enc

DIVUW

M_divuw_cg/cp_asm_count

remw_enc

REMW

M_remw_cg/cp_asm_count

remuw_enc

REMUW

M_remuw_cg/cp_asm_count

UDB Parameters: None.

A.4.1. Zmmul

The Zmmul extension is a subset of the M extension that includes only the multiply instructions. The coverpoints are listed in Table 23. If a configuration supports M, it implicitly also supports Zmmul, and thus these multiply instructions are tested twice. The runtime is negligible so multiplication is left in M to avoid confusion.

Table 23. Zmmul Instruction Coverpoints
Instruction mul mulh mulhsu mulhu mulw

RV32

x

x

x

x

RV64

x

x

x

x

x

cp_asm_count

x

x

x

x

x

cp_rs1

x

x

x

x

x

cp_rs2

x

x

x

x

x

cp_rd

x

x

x

x

x

cp_rs1_edges

x

x

x

x

x

cp_rs2_edges

x

x

x

x

x

cr_rs1_rs2_edges

x

x

x

x

x

cmp_rs1_rs2

x

x

x

x

x

cmp_rd_rs1

x

x

x

x

x

cmp_rd_rs2

x

x

x

x

x

cmp_rd_rs1_rs2

x

x

x

x

x

Table 24. Zmmul Normative Rules
Normative Rule Rule Text Coverpoints

Zmmul_insns

The Zmmul extension implements the multiplication subset of the M extension. It adds the following instructions defined in extm: MUL, MULH, MULHU, MULHSU, and (for RV64 only) MULW. The encodings and semantics are identical to those of the corresponding instructions in M. M implies Zmmul.

{Zmmul_mul_cg, Zmmul_mulh_cg, Zmmul_mulhu_cg, Zmmul_mulhsu_cg}/cp_asm_count

Zmmul_enc_same

The encodings and semantics are identical to those of the corresponding instructions in M.

{Zmmul_mul_cg, Zmmul_mulh_cg, Zmmul_mulhu_cg, Zmmul_mulhsu_cg}/cr_rs1_rs2_edges

M_implies_Zmmul

M implies Zmmul.

Definition, checked through UDB

mul_op

MUL performs an XLEN-bit×XLEN-bit multiplication of rs1 by rs2 and places the lower XLEN bits in the destination register.

Zmmul_mul_cg/{cp_rs1, cp_rs2, cp_rd, cr_rs1_rs2_edges}

mulh_mulhu_mulhsu_op

MULH, MULHU, and MULHSU perform the same multiplication but return the upper XLEN bits of the full 2×XLEN-bit product, for signed×signed, unsigned×unsigned, and rs1×unsigned rs2 multiplication.

{Zmmul_mulh_cg, Zmmul_mulhu_cg, Zmmul_mulhsu_cg}/cr_rs1_rs2_edges

mulw_op

MULW is an RV64 instruction that multiplies the lower 32 bits of the source registers, placing the sign extension of the lower 32 bits of the result into the destination register.

Zmmul_mulw_cg/{cp_rs1, cp_rs2, cp_rd, cr_rs1_rs2_edges}

UDB Parameters: None.

A.5. C Compressed Extension

The C extension is subdivided into Zca, Zcf, and Zcd. All configurations supporting C contain Zca. RV32CF configurations also contain Zcf, and RV{32/64}CD configurations also contain Zcd. A configuration supporting C should test all of the applicable Zc* extensions.

Compressed-instruction behavior that traps (reserved encodings, illegal instructions, misaligned and faulting loads and stores) is covered by the Exceptions_Zc (Table 184) and Ssstrict_S (Table 215) test plans. Table 190 summarizes the normative rules for compressed-instruction exceptions.

A.5.1. Zca Compressed Extension

Table 25 summarizes the coverpoints for the Zca extension. These include the standard compressed HINTs in the cp_c_hint_* family. Note that some of these HINTs (c.add x0, x2-x5) are also Zihintntl HINTs. The c.slli, c.srli, and c.srai HINT encodings (shamt = 0, and c.slli with rd = x0) are designated for custom use, so they are deliberately not tested.

Table 25. Zca Instruction Coverpoints
Instruction c.add c.addi c.addi16sp c.addi4spn c.addiw c.addw c.and c.andi c.beqz c.bnez c.j c.jal

RV32

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

cp_asm_count

x

x

x

x

x

x

x

x

x

x

x

x

cp_rs1

nx0

nx0

nx0

p

p

p

p

p

cp_rs2

nx0

p

p

cp_rd

p

cp_rs1_edges

x

x

x

x

x

x

x

x

cp_rs2_edges

x

x

x

cr_rs1_imm_edges

6bit_n0

6bit

6bit

cr_rs1_rs2_edges

x

x

x

cmp_rs1_rs2

nx0

c

c

cp_offset

x

x

x

x

cp_imm_edges

c_branch

c_branch

c_jal

c_jal

cp_imm_mul

addi16sp

addi4spn

cp_c_hint

add

addi

Instruction c.jalr c.jr c.ld c.ldsp c.li c.lui c.lw c.lwsp c.mv c.nop c.or c.sd

RV32

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

cp_asm_count

x

x

x

x

x

x

x

x

x

nop

x

x

cp_rs1

nx0

nx0

p

nx0

nx2

p

p

p

cp_rs2

nx0

p

p

cp_rd

p

nx0

p

nx0

nx0

cp_rs1_edges

x

cp_rs2_edges

x

x

x

cr_rs1_rs2_edges

x

cmp_rs1_rs2

nx0

c

cmp_rd_rs1

c

c

cp_offset

c_jr

c_jr

cp_imm_edges

6bit

6bit_n0

cp_imm_mul

8

8sp

x

4sp

8

cp_c_hint

li

lui

mv

nop

cp_memval

double

double

word

word

Instruction c.sdsp c.slli c.srai c.srli c.sub c.subw c.sw c.swsp c.xor

RV32

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

cp_asm_count

x

x

x

x

x

x

x

x

x

cp_rs1

nx0

p

p

p

p

p

p

cp_rs2

x

p

p

p

x

p

cp_rs1_edges

x

x

x

x

x

x

cp_rs2_edges

x

x

x

x

x

x

cr_rs1_imm_edges

c

c

c

cr_rs1_rs2_edges

x

x

x

cmp_rs1_rs2

c

c

c

cp_uimm

n0

n0

n0

cp_imm_mul

8sp

x

4sp

Modified coverpoints for Zc* are summarized in Table 26. As defined in Table 11, the p versions of coverpoints work on registers x8-x15.

Table 26. Zc Modified Coverpoints
Modified Coverpoint Bins Definition

cp_asm_count_nop

1

Number of times the canonical c.nop form is executed in the test with imm == 0, must be greater than 0.

cp_rs1_nx2

30

rs1 (the destination of c.lui) excluding x0 (a HINT) and x2 (c.addi16sp)

cp_uimm_n0

31 (RV32), 63 (RV64)

Nonzero 5- or 6-bit shift amounts 1 to XLEN-1

cp_imm_edges_6bit

13

Signed 6-bit immediates 0, 1, 2, 3, 4, 8, 16, 30, 31, -32, -31, -2, -1

cp_imm_edges_6bit_n0

12

cp_imm_edges_6bit excluding 0

cp_imm_edges_c

11 (RV32), 16 (RV64)

Unsigned 5- or 6-bit shift amounts 1, 2, 3, 4, 8, 14, 15, 16, 17, 30, 31. XLEN=64 adds 32, 33, 48, 62, 63

cr_rs1_imm_edges_6bit

12*13 (RV32), 18*13 (RV64)

rs1 edges x cp_imm_edges_6bit

cr_rs1_imm_edges_6bit_n0

12*12 (RV32), 18*12 (RV64)

rs1 edges x cp_imm_edges_6bit_n0

cr_rs1_imm_edges_c

12*11 (RV32), 18*16 (RV64)

rs1 edges x cp_imm_edges_c

cp_imm_edges_c_jal

21

Selected signed multiples of 2 from -2048 to 1024

cp_imm_edges_c_branch

15

Branch offsets for c.beqz and c.bnez: +2 to +128 setting each of offset[7:1] alone, and -2 to -256 in powers of 2

cmp_rs1_rs2_c

8

Same register x8-x15 for both rs1 and rs2 (and hence rd)

cmp_rd_rs1_c

8

Same register x8-x15 for both rd and rs1 (the base address of a compressed load)

cp_imm_mul

32

Multiples of 4 from 0 to 124

cp_imm_mul_4sp

64

Multiples of 4 from 0 to 252

cp_imm_mul_8

32

Multiples of 8 from 0 to 248

cp_imm_mul_8sp

64

Multiples of 8 from 0 to 504

cp_imm_mul_addi16sp

63

Nonzero multiples of 16 from -512 to 496

cp_imm_mul_addi4spn

255

Multiples of 4 from 4 to 1020

cp_offset_lsbs

4

rs1_val[1:0] of the c.jr/c.jalr jump target (used with cp_offset)

cp_uimm_2

4

Zcb byte offsets 0-3 for c.lbu and c.sb. The memory holds a distinct byte at each offset.

cp_uimm_2h

2

Zcb halfword offsets 0 and 2 for c.lh, c.lhu, and c.sh. The memory holds a distinct halfword at each offset.

cp_c_hint_{nop,addi,li,lui,mv,add}

63+31+64+63+31+31

Compressed standard HINTs c.nop (imm != 0), c.addi (imm = 0), c.li (rd = x0), c.lui (rd = x0), c.mv (rd = x0), c.add (rd = x0)

Table 27. Zca Normative Rules
Normative Rule Rule Text Coverpoints

C_dep_Zca

The C extension depends upon the Zca extension.

Definition, checked through UDB

Zca_offsets_mul2

As with base RVI instructions, the offsets of all Zca control transfer instructions are in multiples of 2 bytes.

Zca_c_j_cg/{cp_imm_edges_c_jal}, Zca_c_beqz_cg/{cp_imm_edges_c_branch}

Zca_regs8

CIW, CL, CS, CA, and CB are limited to just 8 of them. registers lists these popular registers, which correspond to registers x8 to x15.

Zca_c_and_cg/{cp_rs1_p, cp_rs2_p}

c-add_op

C.ADD adds the values in registers rd and rs2 and writes the result to register rd. It expands into ADD rd, rd, rs2.

Zca_c_add_cg/{cp_rs1_nx0, cp_rs2_nx0, cr_rs1_rs2_edges}

c-add_val

C.ADD is only valid when rs2≠x0; the code points with rs2=x0 correspond to the C.JALR and C.EBREAK instructions.

Zca_c_add_cg/{cp_rs1_nx0, cp_rs2_nx0}

c-addi16sp_op

C.ADDI16SP (add immediate to stack pointer) shares the opcode with C.LUI, but has a destination field of x2. C.ADDI16SP adds the non-zero sign-extended 6-bit immediate to the value in the stack pointer (sp=x2), where the immediate is scaled to represent multiples of 16 in the range [-512, 496]. C.ADDI16SP is used to adjust the stack pointer in procedure prologues and epilogues. It expands into ADDI x2, x2, nzimm[9:4].

Zca_c_addi16sp_cg/{cp_imm_mul_addi16sp}

c-addi4spn_op

C.ADDI4SPN (add immediate to stack pointer, non-destructive) is a CIW-format instruction that adds a zero-extended non-zero immediate, scaled by 4, to the stack pointer, x2, and writes the result to rd′. This instruction is used to generate pointers to stack-allocated variables, and expands to ADDI rd′, x2, nzuimm[9:2].

Zca_c_addi4spn_cg/{cp_imm_mul_addi4spn}

c-addi_nop

The code points with rd=x0 encode the C.NOP instruction, of which the code points with imm≠0 are HINTs.

Zca_c_nop_cg/{cp_asm_count_nop, cp_c_hint_nop}

c-addi_op

C.ADDI adds the non-zero sign-extended 6-bit immediate to the value in register rd then writes the result to rd. It expands into ADDI rd, rd, imm.

Zca_c_addi_cg/{cp_rs1_nx0, cr_rs1_imm_edges_6bit_n0}

c-addiw_op

C.ADDIW is an XLEN=64-only instruction that performs the same computation but produces a 32-bit result, then sign-extends result to 64 bits. It expands into ADDIW rd, rd, imm. The immediate can be zero for C.ADDIW, where this corresponds to SEXT.W rd.

Zca_c_addiw_cg/{cp_rs1_nx0, cr_rs1_imm_edges_6bit}

c-addw_op

C.ADDW is an XLEN=64-only instruction that adds the values in registers rd′ and rs2′, then sign-extends the lower 32 bits of the sum before writing the result to register rd′. It expands into ADDW rd′, rd′, rs2′.

Zca_c_addw_cg/{cp_rs1_p, cp_rs2_p, cr_rs1_rs2_edges}

c-and_op

C.AND computes the bitwise AND of the values in registers rd′ and rs2′, then writes the result to register rd′. It expands into AND rd′, rd′, rs2′.

Zca_c_and_cg/{cp_rs1_p, cp_rs2_p, cr_rs1_rs2_edges}

c-andi_op

C.ANDI is a CB-format instruction that computes the bitwise AND of the value in register rd′ and the sign-extended 6-bit immediate, then writes the result to rd′. It expands to ANDI rd′, rd′, imm.

Zca_c_andi_cg/{cp_rs1_p, cr_rs1_imm_edges_6bit}

c-beqz_op

C.BEQZ performs conditional control transfers. The offset is sign-extended and added to the pc to form the branch target address. It can therefore target a ±256 B range. C.BEQZ takes the branch if the value in register rs1′ is zero. It expands to BEQ rs1′, x0, offset`.

Zca_c_beqz_cg/{cp_rs1_p, cp_rs1_edges, cp_offset, cp_imm_edges_c_branch}

c-bnez_op

C.BNEZ is defined analogously, but it takes the branch if rs1′ contains a nonzero value. It expands to BNE rs1′, x0, offset`.

Zca_c_bnez_cg/{cp_rs1_p, cp_rs1_edges, cp_offset, cp_imm_edges_c_branch}

c-j_op

C.J performs an unconditional control transfer. The offset is sign-extended and added to the pc to form the jump target address. C.J can therefore target a ±2 KiB range. It expands to JAL x0, offset.

Zca_c_j_cg/{cp_imm_edges_c_jal}

c-jal_op

C.JAL is an XLEN=32-only instruction that performs the same operation as C.J, but additionally writes the address of the instruction following the jump (pc+2) to the link register, x1. It expands to JAL x1, offset.

Zca_c_jal_cg/{cp_imm_edges_c_jal}

c-jalr_op

C.JALR (jump and link register) performs the same operation as C.JR, but additionally writes the address of the instruction following the jump (pc+2) to the link register, x1. It expands to JALR x1, 0(rs1).

Zca_c_jalr_cg/{cp_rs1_nx0, cp_offset_lsbs}

c-jr_op

C.JR (jump register) performs an unconditional control transfer to the address in register rs1. It expands to JALR x0, 0(rs1).

Zca_c_jr_cg/{cp_rs1_nx0, cp_offset_lsbs}

c-ld_op

C.LD is an XLEN=64-only instruction that loads a 64-bit value from memory into register rd′. It computes an effective address by adding the zero-extended offset, scaled by 8, to the base address in register rs1′. It expands to LD rd′, offset(rs1′).

Zca_c_ld_cg/{cp_rs1_p, cp_rd_p, cp_imm_mul_8, cp_memval_double}

c-ldsp_op

C.LDSP is an XLEN=64-only instruction that loads a 64-bit value from memory into register rd. It computes its effective address by adding the zero-extended offset, scaled by 8, to the stack pointer, x2. It expands to LD rd, offset(x2).

Zca_c_ldsp_cg/{cp_rd_nx0, cp_imm_mul_8sp, cp_memval_double}

c-li_op

C.LI loads the sign-extended 6-bit immediate, imm, into register rd. It expands into ADDI rd, x0, imm.

Zca_c_li_cg/{cp_rs1_nx0, cp_imm_edges_6bit}

c-lui_op

C.LUI loads the non-zero 6-bit immediate field into bits 17–12 of the destination register, clears the bottom 12 bits, and sign-extends bit 17 into all higher bits of the destination. It expands into LUI rd, imm.

Zca_c_lui_cg/{cp_rs1_nx2, cp_imm_edges_6bit_n0}

c-lw_op

C.LW loads a 32-bit value from memory into register rd′. It computes an effective address by adding the zero-extended offset, scaled by 4, to the base address in register rs1′. It expands to LW rd′, offset(rs1′).

Zca_c_lw_cg/{cp_rs1_p, cp_rd_p, cp_imm_mul, cp_memval_word}

c-lwsp_op

C.LWSP loads a 32-bit value from memory into register rd. It computes an effective address by adding the zero-extended offset, scaled by 4, to the stack pointer, x2. It expands to LW rd, offset(x2).

Zca_c_lwsp_cg/{cp_rd_nx0, cp_imm_mul_4sp, cp_memval_word}

c-mv_jr

C.MV is valid only when rs2≠x0; the code points with rs2=x0 correspond to the C.JR instruction.

Zca_c_jr_cg/{cp_rs1_nx0, cp_offset_lsbs}

c-mv_op

C.MV copies the value in register rs2 into register rd. It expands into ADD rd, x0, rs2.

Zca_c_mv_cg/{cp_rd_nx0, cp_rs2_nx0}

c-nop_op

C.NOP is a CI-format instruction that does not change any user-visible state, except for advancing the pc and incrementing any applicable performance counters. C.NOP expands to NOP.

Zca_c_nop_cg/{cp_asm_count_nop}

c-or_op

C.OR computes the bitwise OR of the values in registers rd′ and rs2′, then writes the result to register rd′. It expands into OR rd′, rd′, rs2′.

Zca_c_or_cg/{cp_rs1_p, cp_rs2_p, cr_rs1_rs2_edges}

c-sd_op

C.SD is an XLEN=64-only instruction that stores a 64-bit value in register rs2′ to memory. It computes an effective address by adding the zero-extended offset, scaled by 8, to the base address in register rs1′. It expands to SD rs2′, offset(rs1′).

Zca_c_sd_cg/{cp_rs1_p, cp_rs2_p, cp_rs2_edges, cp_imm_mul_8}

c-sdsp_op

C.SDSP is an XLEN=64-only instruction that stores a 64-bit value in register rs2 to memory. It computes an effective address by adding the zero-extended offset, scaled by 8, to the stack pointer, x2. It expands to SD rs2, offset(x2).

Zca_c_sdsp_cg/{cp_rs2, cp_rs2_edges, cp_imm_mul_8sp}

c-slli_op

C.SLLI is a CI-format instruction that performs a logical left shift of the value in register rd then writes the result to rd. The shift amount is encoded in the shamt field. It expands into SLLI rd, rd, shamt[5:0].

Zca_c_slli_cg/{cp_rs1_nx0, cr_rs1_imm_edges_c}

c-slli_shamt5

For XLEN=32, shamt[5] must be zero; the code points with shamt[5]=1 are designated for custom extensions.

Zca_c_slli_cg/{cp_uimm_n0}

c-srai_op

C.SRAI is defined analogously to C.SRLI, but instead performs an arithmetic right shift. It expands to SRAI rd′, rd′, shamt.

Zca_c_srai_cg/{cp_rs1_p, cr_rs1_imm_edges_c}

c-srli_op

C.SRLI is a CB-format instruction that performs a logical right shift of the value in register rd′ then writes the result to rd′. The shift amount is encoded in the shamt field. It expands into SRLI rd′, rd′, shamt.

Zca_c_srli_cg/{cp_rs1_p, cr_rs1_imm_edges_c}

c-srli_shamt5

For XLEN=32, shamt[5] must be zero; the code points with shamt[5]=1 are designated for custom extensions.

Zca_c_srli_cg/{cp_uimm_n0}

c-sub_op

C.SUB subtracts the value in register rs2′ from the value in register rd′, then writes the result to register rd′. It expands into SUB rd′, rd′, rs2′.

Zca_c_sub_cg/{cp_rs1_p, cp_rs2_p, cr_rs1_rs2_edges}

c-subw_op

C.SUBW is an XLEN=64-only instruction that subtracts the value in register rs2′ from the value in register rd′, then sign-extends the lower 32 bits of the difference before writing the result to register rd′. It expands into SUBW rd′, rd′, rs2′.

Zca_c_subw_cg/{cp_rs1_p, cp_rs2_p, cr_rs1_rs2_edges}

c-sw_op

C.SW stores a 32-bit value in register rs2′ to memory. It computes an effective address by adding the zero-extended offset, scaled by 4, to the base address in register rs1′. It expands to SW rs2′, offset(rs1′).

Zca_c_sw_cg/{cp_rs1_p, cp_rs2_p, cp_rs2_edges, cp_imm_mul}

c-swsp_op

C.SWSP stores a 32-bit value in register rs2 to memory. It computes an effective address by adding the zero-extended offset, scaled by 4, to the stack pointer, x2. It expands to SW rs2, offset(x2).

Zca_c_swsp_cg/{cp_rs2, cp_rs2_edges, cp_imm_mul_4sp}

c-xor_op

C.XOR computes the bitwise XOR of the values in registers rd′ and rs2′, then writes the result to register rd′. It expands into XOR rd′, rd′, rs2′.

Zca_c_xor_cg/{cp_rs1_p, cp_rs2_p, cr_rs1_rs2_edges}

Zca_hints

A portion of the Zca encoding space is reserved for microarchitectural HINTs. Like the HINTs in the RV32I base ISA (see rv32i-hints), these instructions do not modify any architectural state, except for advancing the pc and any applicable performance counters. HINTs are executed as no-ops on implementations that ignore them.

Zca_c_add_cg/{cp_c_hint_add}

c-add_hint

The code points with rs2≠x0 and rd=x0 are HINTs.

Zca_c_add_cg/{cp_c_hint_add}

c-addi_hint

The code points with rd≠0 and imm=0 are HINTs.

Zca_c_addi_cg/{cp_c_hint_addi}

c-li_hint

The C.LI code points with rd=x0 are HINTs.

Zca_c_li_cg/{cp_c_hint_li}

c-lui_hint

The code points with rd=x0 and imm≠0 are HINTs.

Zca_c_lui_cg/{cp_c_hint_lui}

c-mv_hint

The code points with rs2≠x0 and rd=x0 are HINTs.

Zca_c_mv_cg/{cp_c_hint_mv}

c-nop_hint

The C.NOP code points with imm≠0 encode HINTs.

Zca_c_nop_cg/{cp_c_hint_nop}

c-slli_hint

The C.SLLI code points with shamt=0 or with rd=x0 are HINTs.

N/A custom hints not certified

c-srli_hint

The C.SRLI code points with shamt=0 are HINTs.

N/A custom hints not certified

UDB Parameters: None.

A.5.2. Zcf Compressed Floating-Point Extension

Table 28 summarizes the coverpoints for the Zcf extension.

Table 28. Zcf Instruction Coverpoints
Instruction c.flw c.flwsp c.fsw c.fswsp

RV32

x

x

x

x

cp_asm_count

x

x

x

x

cp_rs1

p

p

cp_fd

p

x

cp_fs2

p

x

cp_imm_mul

x

4sp

x

4sp

cp_memval

fp_single

fp_single

Table 29. Zcf Normative Rules
Normative Rule Rule Text Coverpoints

c-flwsp_op

C.FLWSP is an RV32FC-only instruction that loads a single-precision floating-point value from memory into floating-point register rd. It computes its effective address by adding the zero-extended offset, scaled by 4, to the stack pointer, x2. It expands to FLW rd, offset(x2). C.FLWSP uses the CI format.

Zcf_c_flwsp_cg/{cp_fd, cp_imm_mul_4sp, cp_memval_fp_single}

c-fswsp_op

C.FSWSP is an RV32FC-only instruction that stores a single-precision floating-point value in floating-point register rs2 to memory. It computes an effective address by adding the zero-extended offset, scaled by 4, to the stack pointer, x2. It expands to FSW rs2, offset(x2).

Zcf_c_fswsp_cg/{cp_fs2, cp_imm_mul_4sp}

Zc_fp_regs

Compressed register-based floating-point loads and stores use the CL and CS formats, respectively, with the eight registers mapping to f8 to f15.

Zcf_c_flw_cg/cp_fd_p, Zcf_c_fsw_cg/cp_fs2_p

c-flw_op

C.FLW is an RV32FC-only instruction that loads a single-precision floating-point value from memory into floating-point register rd′. It computes an effective address by adding the zero-extended offset, scaled by 4, to the base address in register rs1′. It expands to FLW rd′, offset(rs1′).

Zcf_c_flw_cg/{cp_rs1_p, cp_fd_p, cp_imm_mul, cp_memval_fp_single}

c-fsw_op

C.FSW is an RV32FC-only instruction that stores a single-precision floating-point value in floating-point register rs2′ to memory. It computes an effective address by adding the zero-extended offset, scaled by 4, to the base address in register rs1′. It expands to FSW rs2′, offset(rs1′).

Zcf_c_fsw_cg/{cp_rs1_p, cp_fs2_p, cp_imm_mul}

C_dep_Zcf

If XLEN=32 and the F extension is present, the C extension additionally depends upon the Zcf extension.

Not tested: extension dependency checked by the UDB configuration

Zce_dep_Zcf

If XLEN=32 and the F extension is present, the Zce extension additionally depends upon the Zcf extension.

Not tested: extension dependency checked by the UDB configuration

UDB Parameters: None.

A.5.3. Zcd Compressed Double-Precision FP Extension

Table 30 summarizes the coverpoints for the Zcd extension.

Table 30. Zcd Instruction Coverpoints
Instruction c.fld c.fldsp c.fsd c.fsdsp

RV32

x

x

x

x

RV64

x

x

x

x

cp_asm_count

x

x

x

x

cp_rs1

p

p

cp_fd

p

x

cp_fs2

p

x

cp_imm_mul

8

8sp

8

8sp

cp_memval

fp_double

fp_double

Table 31. Zcd Normative Rules
Normative Rule Rule Text Coverpoints

Zc_fp_regs

Compressed register-based floating-point loads and stores use the CL and CS formats, respectively, with the eight registers mapping to f8 to f15.

Zcd_c_fld_cg/cp_fd_p, Zcd_c_fsd_cg/cp_fs2_p

c-fldsp_op

C.FLDSP is an RV32DC/RV64DC-only instruction that loads a double-precision floating-point value from memory into floating-point register rd. It computes its effective address by adding the zero-extended offset, scaled by 8, to the stack pointer, x2. It expands to FLD rd, offset(x2).

Zcd_c_fldsp_cg/{cp_fd, cp_imm_mul_8sp, cp_memval_fp_double}

c-fsdsp_op

C.FSDSP is an RV32DC/RV64DC-only instruction that stores a double-precision floating-point value in floating-point register rs2 to memory. It computes an effective address by adding the zero-extended offset, scaled by 8, to the stack pointer, x2. It expands to FSD rs2, offset(x2).

Zcd_c_fsdsp_cg/{cp_fs2, cp_imm_mul_8sp}

c-fld_op

C.FLD is an RV32DC/RV64DC-only instruction that loads a double-precision floating-point value from memory into floating-point register rd′. It computes an effective address by adding the zero-extended offset, scaled by 8, to the base address in register rs1′. It expands to FLD rd′, offset(rs1′).

Zcd_c_fld_cg/{cp_rs1_p, cp_fd_p, cp_imm_mul_8, cp_memval_fp_double}

c-fsd_op

C.FSD is an RV32DC/RV64DC-only instruction that stores a double-precision floating-point value in floating-point register rs2′ to memory. It computes an effective address by adding the zero-extended offset, scaled by 8, to the base address in register rs1′. It expands to FSD rs2′, offset(rs1′).

Zcd_c_fsd_cg/{cp_rs1_p, cp_fs2_p, cp_imm_mul_8}

C_dep_Zcd

If the D extension is present, the C extension additionally depends upon the Zcd extension.

Not tested: extension dependency checked by the UDB configuration

UDB Parameters: None.

A.5.4. Zcb Additional Compressed Instructions

Table 32 summarizes the coverpoints for the Zcb extension. The rows with an entry in the ExtraExtensions column apply only when that extension is also supported: c.mul needs Zmmul (which M implies), c.zext.w needs Zba, and c.sext.b, c.sext.h, and c.zext.h need Zbb.

Table 32. Zcb Instruction Coverpoints
Instruction c.lbu c.lh c.lhu c.not c.sb c.sh c.zext.b c.mul c.zext.w c.sext.b c.sext.h c.zext.h

RV32

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

ExtraExtensions

Zmmul

Zba

Zbb

Zbb

Zbb

cp_asm_count

x

x

x

x

x

x

x

x

x

x

x

x

cp_rs1

p

p

p

p

p

p

p

p

p

p

p

p

cp_rs2

p

p

p

cp_rd

p

p

p

cp_rs1_edges

x

x

x

x

x

x

x

cp_rs2_edges

x

x

x

cr_rs1_rs2_edges

x

cmp_rs1_rs2

c

cmp_rd_rs1

c

c

c

cp_uimm

2

2h

2h

2

2h

Table 33. Zcb Normative Rules
Normative Rule Rule Text Coverpoints

c-lbu_op

loads a byte from the memory address formed by adding rs1' to the zero extended immediate uimm. The resulting byte is zero extended to XLEN bits and is written to rd'.

Zcb_c_lbu_cg/{cp_rs1_p, cp_rd_p, cp_uimm_2}

c-lh_op

loads a halfword from the memory address formed by adding rs1' to the zero extended immediate uimm. The resulting halfword is sign extended to XLEN bits and is written to rd'.

Zcb_c_lh_cg/{cp_rs1_p, cp_rd_p, cp_uimm_2h}

c-lhu_op

loads a halfword from the memory address formed by adding rs1' to the zero extended immediate uimm. The resulting halfword is zero extended to XLEN bits and is written to rd'.

Zcb_c_lhu_cg/{cp_rs1_p, cp_rd_p, cp_uimm_2h}

c-mul_op

multiplies XLEN bits of the source operands from rsd' and rs2' and writes the lowest XLEN bits of the result to rsd'.

ZcbZmmul_c_mul_cg/{cp_rs1_p, cp_rs2_p, cr_rs1_rs2_edges}

c-not_op

takes the one’s complement of rd'/rs1' and writes the result to the same register.

Zcb_c_not_cg/{cp_rs1_p, cp_rs1_edges}

c-sb_op

stores the least significant byte of rs2' to the memory address formed by adding rs1' to the zero extended immediate uimm.

Zcb_c_sb_cg/{cp_rs1_p, cp_rs2_p, cp_rs2_edges, cp_uimm_2}

c-sext-b_op

sign-extends the least-significant byte in the operand to XLEN bits by copying the most-significant bit in the byte (i.e., bit 7) to all of the more-significant bits.

ZcbZbb_c_sext_b_cg/{cp_rs1_p, cp_rs1_edges}

c-sext-h_op

sign-extends the least-significant halfword in the operand to XLEN bits by copying the most-significant bit in the halfword (i.e., bit 15) to all of the more-significant bits.

ZcbZbb_c_sext_h_cg/{cp_rs1_p, cp_rs1_edges}

c-sh_op

stores the least significant halfword of rs2' to the memory address formed by adding rs1' to the zero extended immediate uimm.

Zcb_c_sh_cg/{cp_rs1_p, cp_rs2_p, cp_rs2_edges, cp_uimm_2h}

c-zext-b_op

zero-extends the least-significant byte of the operand to XLEN bits by inserting zeros into all of the bits more significant than 7.

Zcb_c_zext_b_cg/{cp_rs1_p, cp_rs1_edges}

c-zext-h_op

zero-extends the least-significant halfword of the operand to XLEN bits by inserting zeros into all of the bits more significant than 15.

ZcbZbb_c_zext_h_cg/{cp_rs1_p, cp_rs1_edges}

c-zext-w_op

zero-extends the least-significant word of the operand to XLEN bits by inserting zeros into all of the bits more significant than 31.

ZcbZba_c_zext_w_cg/{cp_rs1_p, cp_rs1_edges}

Zce_dep

The Zce extension depends upon the Zca, Zcb, Zcmp, and Zcmt extensions.

Definition, checked through UDB

UDB Parameters: None.

A.6. A Atomic Extension

The A extension is subdivided into Zaamo and Zalrsc.

This section exercises unprivileged tests that will not trap. Privileged tests are in other sections, such as Exceptions_Zaamo.

A.6.1. Zaamo Atomic Memory Operations Extension

Table 34 summarizes the coverpoints for the Zaamo extension.

Table 34. Zaamo Instruction Coverpoints
Instruction amoadd.d amoadd.w amoand.d amoand.w amomax.d amomax.w amomaxu.d amomaxu.w amomin.d amomin.w amominu.d amominu.w

RV32

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

cp_asm_count

x

x

x

x

x

x

x

x

x

x

x

x

cp_rs1

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

cp_rs2

x

x

x

x

x

x

x

x

x

x

x

x

cp_rd

x

x

x

x

x

x

x

x

x

x

x

x

cp_rs2_edges

x

x

x

x

x

x

x

x

x

x

x

x

cmp_rs1_rs2

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

cmp_rd_rs1

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

cmp_rd_rs2

x

x

x

x

x

x

x

x

x

x

x

x

cmp_rd_rs1_rs2

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

cp_align

word

word

word

word

word

word

cp_memval

double

word

double

word

double

word

double

word

double

word

double

word

cp_custom

amo_aqrl

amo_aqrl

amo_aqrl

amo_aqrl

amo_aqrl

amo_aqrl

amo_aqrl

amo_aqrl

amo_aqrl

amo_aqrl

amo_aqrl

amo_aqrl

cr_memval_rs2_edges

double

word

double

word

double

word

double

word

Instruction amoor.d amoor.w amoswap.d amoswap.w amoxor.d amoxor.w

RV32

x

x

x

RV64

x

x

x

x

x

x

cp_asm_count

x

x

x

x

x

x

cp_rs1

nx0

nx0

nx0

nx0

nx0

nx0

cp_rs2

x

x

x

x

x

x

cp_rd

x

x

x

x

x

x

cp_rs2_edges

x

x

x

x

x

x

cmp_rs1_rs2

nx0

nx0

nx0

nx0

nx0

nx0

cmp_rd_rs1

nx0

nx0

nx0

nx0

nx0

nx0

cmp_rd_rs2

x

x

x

x

x

x

cmp_rd_rs1_rs2

nx0

nx0

nx0

nx0

nx0

nx0

cp_align

word

word

word

cp_memval

double

word

double

word

double

word

cp_custom

amo_aqrl

amo_aqrl

amo_aqrl

amo_aqrl

amo_aqrl

amo_aqrl

Table 35. Zaamo Coverpoint Definitions
Coverpoint Bins Definition

cp_custom_amo_aqrl coverpoints

cp_custom_aqrl

4

none, aq, rl, aqrl

cr_memval_rs2_edges coverpoints (amomin, amomax, amominu, amomaxu)

cr_memval_rs2_edges

cp_memval bins x cp_rs2_edges bins

Cross of the standard memory-value and rs2 edge coverpoints

Table 36. Zaamo Normative Rules
Normative Rule Rule Text Coverpoints

A_aq_rl_bits

each atomic instruction has two bits, aq and rl, used to specify additional memory ordering constraints as viewed by other RISC-V harts.

Zaamo_amoadd_w_cg/cp_custom_aqrl

amo_release_consistency

If the aq bit is set, then no later memory operations in this RISC-V hart can be observed to take place before the AMO. Conversely, if the rl bit is set, then other RISC-V harts will not observe the AMO before memory accesses preceding the AMO in this RISC-V hart. Setting both the aq and the rl bit on an AMO makes the sequence sequentially consistent, meaning that it cannot be reordered with earlier or later memory operations from the same hart.

OUT-OF-SCOPE for single hart

A_domain_specific_ordering

The bits order accesses to one of the two address domains, memory or I/O, depending on which address domain the atomic instruction is accessing. No ordering constraint is implied to accesses to the other domain, and a FENCE instruction should be used to order across both domains.

OUT-OF-SCOPE for single hart

A_no_aq_rl

If both bits are clear, no additional ordering constraints are imposed on the atomic memory operation.

OUT-OF-SCOPE for single hart

A_acquire_semantics

If only the aq bit is set, the atomic memory operation is treated as an acquire access, i.e., no following memory operations on this RISC-V hart can be observed to take place before the acquire memory operation.

OUT-OF-SCOPE for single hart

A_release_semantics

If only the rl bit is set, the atomic memory operation is treated as a release access, i.e., the release memory operation cannot be observed to take place before any earlier memory operations on this RISC-V hart.

OUT-OF-SCOPE for single hart

A_seq_cst_semantics

If both the aq and rl bits are set, the atomic memory operation is sequentially consistent and cannot be observed to happen before any earlier memory operations or after any later memory operations in the same RISC-V hart and to the same address domain.

OUT-OF-SCOPE for single hart

A_comprises

The A extension comprises the Zalrsc and Zaamo extensions, which are defined in the following sections.

Definition, checked through UDB

amo_op

These AMO instructions atomically load a data value from the address in rs1, place the value into register rd, apply a binary operator to the loaded value and the original value in rs2, then store the result back to the original address in rs1.

Zaamo_amoadd_w_cg/{cp_memval_word, cp_rs2_edges}, Zaamo_amoadd_d_cg/{cp_memval_double, cp_rs2_edges}

amo_ops_supported

The operations supported are swap, integer add, bitwise AND, bitwise OR, bitwise XOR, and signed and unsigned integer maximum and minimum.

{Zaamo_amoswap_w_cg, Zaamo_amoadd_w_cg, Zaamo_amoand_w_cg, Zaamo_amoor_w_cg, Zaamo_amoxor_w_cg}/cp_asm_count, {Zaamo_amomin_w_cg, Zaamo_amomax_w_cg, Zaamo_amominu_w_cg, Zaamo_amomaxu_w_cg}/cr_memval_rs2_edges_word

amo_operand_size

AMOs can either operate on doublewords (RV64 only) or words in memory. For RV64, 32-bit AMOs always sign-extend the value placed in rd, and ignore the upper 32 bits of the original value of rs2.

Zaamo_amoadd_w_cg/{cp_memval_word, cp_rs2_edges}, Zaamo_amoadd_d_cg/{cp_memval_double, cp_rs2_edges}

misaligned_atomicity_granule_size

The misaligned atomicity granule PMA, defined in sec:misaligned-atomicity-granule, optionally relaxes this alignment requirement. If present, the misaligned atomicity granule PMA specifies the size of a misaligned atomicity granule, a power-of-two number of bytes. The misaligned atomicity granule PMA applies only to AMOs defined in the Zaamo, Zabha, and Zacas extensions; loads and stores defined in the base ISAs; loads and stores of no more than XLEN bits defined in the F, D, and Q extensions; the load-acquire and store-release instructions defined in the Zalasr extension; and compressed encodings of the foregoing loads and stores. For an instruction in that set, if all accessed bytes lie within the same misaligned atomicity granule, the instruction will not raise an exception for reasons of address alignment, and the instruction will give rise to only one memory operation for the purposes of RVWMO—​i.e., it will execute atomically.

OUT-OF-SCOPE: aligned AMOs only; misaligned AMOs are exercised by Zama16b and Exceptions_Zaamo

amo_alignment

For AMOs, the Zaamo extension requires that the address held in rs1 be naturally aligned to the size of the operand (i.e., eight-byte aligned for doublewords and four-byte aligned for words).

Zaamo_amoadd_w_cg/cp_align_word

pma_amo_sz_support

For each level of support, naturally aligned AMOs of a given width are supported if the underlying memory region supports reads and writes of that width.

{Zaamo_amoadd_w_cg, Zaamo_amoadd_d_cg}/cp_asm_count

UDB Parameters: None.

This test suite is unprivileged and does not perform misaligned accesses. The MISALIGNED_AMO parameter affects the expected results of Exceptions_Zaamo/cp_amo_address_misaligned (Table 183).

A.6.2. Zalrsc Load-Reserved / Store-Conditional Extension

Table 37 summarizes the coverpoints for the Zalrsc extension.

Table 37. Zalrsc Instruction Coverpoints
Instruction lr.d lr.w sc.d sc.w

RV32

x

x

RV64

x

x

x

x

cp_asm_count

x

x

x

x

cp_rs1

nx0

nx0

nx0

nx0

cp_rs2

x

x

cp_rd

x

x

x

x

cp_rs2_edges

x

x

cmp_rs1_rs2

nx0

nx0

cmp_rd_rs1

nx0

nx0

nx0

nx0

cmp_rd_rs2

x

x

cmp_rd_rs1_rs2

nx0

nx0

cp_custom

lr

lr

sc

sc

Table 38. Zalrsc Coverpoint Definitions
Coverpoint Bins Definition

cp_custom_lr coverpoints

cp_custom_aqrl

3

none, aq, aqrl

cp_custom_rd_edges

3

rd_value = 0, 1, -1

cp_custom_sc coverpoints

cp_custom_aqrl

3

none, rl, aqrl. Each sc is retried in a constrained LR/SC loop of up to 100 attempts.

cp_custom_sc_after_sc

2

sc immediately preceded or not preceded by another sc

cp_custom_sc_lr

2

lr followed by sc that fails and passes, sc pairs with most recent lr. The passing sc is retried in a constrained LR/SC loop of up to 100 attempts.

cp_custom_sc_addresses

32

lr followed by sc of the same size at an address 0, 8, …​, 248 bytes above the lr address. The sc may succeed if the reservation set includes its address, so it is retried up to 100 times. This is not a constrained LR/SC loop, because the sc and lr addresses differ.

A single LR/SC pair may fail spuriously, and only a constrained LR/SC loop is guaranteed to succeed eventually. Therefore, every sc test that can succeed retries its lr/sc pair up to 100 times, including the standard register and value coverpoints of sc.w and sc.d.

Table 39. Zalrsc Normative Rules
Normative Rule Rule Text Coverpoints

A_aq_rl_bits

each atomic instruction has two bits, aq and rl, used to specify additional memory ordering constraints as viewed by other RISC-V harts.

Zalrsc_lr_w_cg/cp_custom_aqrl

A_domain_specific_ordering

The bits order accesses to one of the two address domains, memory or I/O, depending on which address domain the atomic instruction is accessing. No ordering constraint is implied to accesses to the other domain, and a FENCE instruction should be used to order across both domains.

OUT-OF-SCOPE for single hart without defined I/O domains

A_no_aq_rl

If both bits are clear, no additional ordering constraints are imposed on the atomic memory operation.

OUT-OF-SCOPE for single hart

A_acquire_semantics

If only the aq bit is set, the atomic memory operation is treated as an acquire access, i.e., no following memory operations on this RISC-V hart can be observed to take place before the acquire memory operation.

OUT-OF-SCOPE for single hart

A_release_semantics

If only the rl bit is set, the atomic memory operation is treated as a release access, i.e., the release memory operation cannot be observed to take place before any earlier memory operations on this RISC-V hart.

OUT-OF-SCOPE for single hart

A_seq_cst_semantics

If both the aq and rl bits are set, the atomic memory operation is sequentially consistent and cannot be observed to happen before any earlier memory operations or after any later memory operations in the same RISC-V hart and to the same address domain.

OUT-OF-SCOPE for single hart

A_comprises

The A extension comprises the Zalrsc and Zaamo extensions, which are defined in the following sections.

Definition, checked through UDB

lr-w_op

LR.W loads a word from the address in rs1, places the sign-extended value in rd, and registers a reservation set: a set of bytes that subsumes the bytes in the addressed word.

Zalrsc_lr_w_cg/{cp_rs1_nx0, cp_rd, cp_custom_rd_edges}

sc-w_success

SC.W conditionally writes a word in rs2 to the address in rs1: the SC.W succeeds only if the reservation is still valid and the reservation set contains the bytes being written. If the SC.W succeeds, the instruction writes the word in rs2 to memory, and it writes zero to rd.

Zalrsc_sc_w_cg/cp_sc_pass_fail

sc-w_failure

If the SC.W fails, the instruction does not write to memory, and it writes a nonzero value to rd.

Zalrsc_sc_w_cg/cp_sc_pass_fail

sc_failed_side_effects

but it is UNSPECIFIED whether any side effects of implicit address translation and protection memory accesses (such as setting a page-table entry D bit) occur on a failed SC.W.

NONE: Behavior is UNSPECIFIED and OUT-OF-SCOPE

sc_reservation_invalidate

Regardless of success or failure, executing an SC.W instruction invalidates any reservation held by this hart.

Zalrsc_sc_w_cg/cp_custom_sc_after_sc

lr_sc_rv64

LR.D and SC.D act analogously on doublewords and are only available on RV64. For RV64, LR.W and SC.W sign-extend the value placed in rd.

Zalrsc_lr_d_cg/{cp_rs1_nx0, cp_rd}, Zalrsc_sc_d_cg/cp_sc_pass_fail, Zalrsc_lr_w_cg/cp_custom_rd_edges; its max bin on RV64 checks that LR.W sign-extends

sc_failure_code

The failure code with value 1 encodes an unspecified failure. Other failure codes are reserved at this time. Portable software should only assume the failure code will be non-zero.

Zalrsc_sc_w_cg/cp_sc_pass_fail

lr_reservation_set_size

An implementation can register an arbitrarily large reservation set on each LR, provided the reservation set includes all bytes of the addressed data word or doubleword.

Zalrsc_sc_w_cg/cp_custom_sc_addresses

sc_pairs_latest_lr

An SC can only pair with the most recent LR in program order.

Zalrsc_sc_w_cg/cp_custom_sc_lr; the LR, LR (other address), SC testcase is directed and hits no bin of its own

sc_success_conditions

An SC may succeed only if no store from another hart to the reservation set can be observed to have occurred between the LR and the SC, and if there is no other SC between the LR and itself in program order.

Zalrsc_sc_w_cg/cp_custom_sc_after_sc; multihart not tested

sc_device_write_failure

An SC may succeed only if no write from a device other than a hart to the bytes accessed by the LR instruction can be observed to have occurred between the LR and SC.

OUT-OF-SCOPE: device writes not modeled

sc_addr_not_in_reservation_fail

The SC must fail if the address is not within the reservation set of the most recent LR in program order.

Zalrsc_sc_w_cg/cp_custom_sc_addresses

sc_other_hart_store_fail

The SC must fail if a store to the reservation set from another hart can be observed to occur between the LR and SC.

OUT-OF-SCOPE for single hart

sc_other_device_write_fail

The SC must fail if a write from some other device to the bytes accessed by the LR can be observed to occur between the LR and SC.

OUT-OF-SCOPE: device writes not modeled

sc_intervening_sc_fail

An SC must fail if there is another SC (to any address) between the LR and the SC in program order.

Zalrsc_sc_w_cg/cp_custom_sc_after_sc

lr_sc_atomicity_axiom

The precise statement of the atomicity requirements for successful LR/SC sequences is defined by the Atomicity Axiom in rvwmo.

OUT-OF-SCOPE for single hart

sc_not_observable_before_lr

An SC instruction can never be observed by another RISC-V hart before the LR instruction that established the reservation.

OUT-OF-SCOPE for single hart

constrained_lrsc_loop_size

The loop comprises only an LR/SC sequence and code to retry the sequence in the case of failure, and must comprise at most 16 instructions placed sequentially in memory.

Untested

constrained_lrsc_instruction_set

An LR/SC sequence begins with an LR instruction and ends with an SC instruction. The dynamic code executed between the LR and SC instructions can only contain instructions from the I or E base instruction set, excluding loads, stores, backward jumps, taken backward branches, JALR, FENCE, and SYSTEM instructions.

Untested

constrained_lrsc_compressed_allowed

Compressed forms of the aforementioned I or E instructions in the C (hence Zca) and Zcb extensions are also permitted.

Untested

constrained_lrsc_retry_code

The code to retry a failing LR/SC sequence can contain backwards jumps and/or branches to repeat the LR/SC sequence, but otherwise has the same constraint as the code between the LR and SC.

Untested

lrsc_eventuality_region

The LR and SC addresses must lie within a memory region with the LR/SC eventuality property. The execution environment is responsible for communicating which regions have this property.

PMAs not tested

lrsc_same_address_and_size

The SC must be to the same effective address and of the same data size as the latest LR executed by the same hart.

Zalrsc_sc_w_cg/cp_custom_sc_addresses

unconstrained_lrsc_no_progress

LR/SC sequences that do not lie within constrained LR/SC loops are unconstrained. Unconstrained LR/SC sequences might succeed on some attempts on some implementations, but might never succeed on other implementations.

Behavior is unconstrained

constrained_lrsc_forward_progress_intro

If a hart H enters a constrained LR/SC loop, the execution environment must guarantee that one of the following events eventually occurs

{Zalrsc_sc_w_cg, Zalrsc_sc_d_cg}/cp_custom_sc_lr; SC success cases (except rd = x0) run in a bounded constrained LR/SC loop, other harts and devices OUT-OF-SCOPE for single hart

constrained_lrsc_forward_progress_sc

H or some other hart executes a successful SC to the reservation set of the LR instruction in H’s constrained LR/SC loops.

{Zalrsc_sc_w_cg, Zalrsc_sc_d_cg}/cp_custom_sc_lr; SC success cases (except rd = x0) run in a bounded constrained LR/SC loop, other harts OUT-OF-SCOPE for single hart

constrained_lrsc_forward_progress_store_amo

Some other hart executes an unconditional store or AMO instruction to the reservation set of the LR instruction in H’s constrained LR/SC loop, or some other device in the system writes to that reservation set.

OUT-OF-SCOPE for single hart

constrained_lrsc_forward_progress_branch

H executes a branch or jump that exits the constrained LR/SC loop.

Descriptive spec text with no separately testable behavior

constrained_lrsc_forward_progress_trap

H traps.

Descriptive spec text with no separately testable behavior

Table 40. Zalrsc UDB Parameters
Parameter Description Coverpoint Effect

LRSC_RESERVATION_STRATEGY

Strategy used to handle reservation sets.

* "reserve naturally-aligned 64-byte region": Always reserve the 64-byte block containing the LR/SC address * "reserve naturally-aligned 128-byte region": Always reserve the 128-byte block containing the LR/SC address * "reserve exactly enough to cover the access": Always reserve exactly the LR/SC access, and no more * "custom": Custom behavior, leading to an 'unpredictable' call on any LR/SC

Zalrsc_sc_w_cg/cp_custom_sc_addresses

Expected results

LRSC_FAIL_ON_NON_EXACT_LRSC

Whether or not a Store Conditional fails if its physical address and size do not exactly match the physical address and size of the last Load Reserved in program order (independent of whether or not the SC is in the current reservation set)

Zalrsc_sc_d_cg/cp_custom_sc_lr, Zalrsc_sc_w_cg/cp_custom_sc_addresses

Expected results

LRSC_FAIL_ON_VA_SYNONYM

Whether or not an sc.l/sc.d will fail if its VA does not match the VA of the prior lr.l/lr.d, even if the physical address of the SC and LR are the same

Not tested because spec does not require any specific behavior

The spec imposes no requirements on reservation set form, including alignment, NAPOT, or even being contiguous. Therefore, it is not practical to build reference models that reliably predict whether a sc would succeed or fail on every DUT. Current profiles require Za64rs or Za128rs, which can be supported by reference models. However, unusual DUTs that do not match any reasonable reference model may not be able to pass this test suite. The expected outcome of an sc to an address other than that of the latest lr but within its reservation set follows the LRSC_RESERVATION_STRATEGY and LRSC_FAIL_ON_NON_EXACT_LRSC parameters.

The sc tests follow these conventions:

  • An sc may fail spuriously, so every testcase that expects an sc to succeed runs the lr/sc pair in a constrained LR/SC loop ([sec:lrscseq]) that retries up to 100 times. If rd is also rs1 or rs2, the loop restores that register from a copy before each attempt, because a failing sc overwrites it with the failure code. When rd is x0, the sc reports no status, so the loop reads back the target to decide whether to retry. That load takes the loop out of the constrained form, but the loop is still bounded.

  • Before each sc, the XLEN-bit word at the target is filled with the complement of rs2, so the sc changes every bit it writes. The test reads the target back afterward, so an sc that reports success but drops its store or writes another address fails, as does an sc that reports failure but writes memory.

  • A failing sc is checked for rd = 1. The other nonzero failure codes are reserved.

  • cp_custom_sc_after_sc executes lr, then an sc to the address 8 bytes above, whose outcome is not checked, then an sc to the lr address. That second sc must fail and leave its target unchanged, whether or not the first one succeeded.

  • The testcase for sc_pairs_latest_lr makes a single attempt, because its sc is expected to fail.

  • The suite does not deliberately place compressed instructions in its constrained loops, so constrained_lrsc_compressed_allowed is not tested.

A.7. Floating-Point Extensions

Supporting floating-point involves enabling at least the F extension. Other extensions depend on F. The coverpoints are specified in the following sections. Some tests only apply when multiple extensions are supported.

The basic coverpoints are defined in Table 11. Modified coverpoints for floating-point instructions are defined in Table 41. D and H suffixes apply to double-precision and half-precision floating-point instructions, respectively.

Table 41. Floating-Point Modified Coverpoint Definitions
Modified Coverpoint Bins Definition

cp_frm_{2, 3, 4}

6

Rounding modes for instructions with 2/3/4 arguments

cr_fs1_edges_frm

26 * 6

Cross product of fs1 edges and rounding modes

cp_csr_fflags_{n, v, vn, von, voun, vdoun}

2-10

Set / preserve fflags bits

cp_memval_fp_single

26

Single-precision edge values loaded by fp memory load instructions

cp_memval_fp_double

26

Double-precision edge values loaded by fp memory load instructions

cp_memval_fp_half

26

Half-precision edge values loaded by fp memory load instructions

cr_fs1_fs2_edges_frm

26 * 26 * 6

Cross product of fs1 and fs2 edges and rounding modes

cr_fs1_fs2_edges_frm4

26 * 26 * 6

Cross product of fs1 and fs2 edges and rounding modes for fma

cr_fs1_fs3_edges_frm4

26 * 26 * 6

Cross product of fs1 and fs3 edges and rounding modes for fma

These coverpoints do not yet certify that floating-point operations conform to the IEEE 754 standard. More robust coverpoints based on the IBM suite are under development.

cr_fs1_fs2_edges_frm includes cases that affect all of the flags in each rounding mode.

A.7.1. F Single-Precision FP

Table 42. F Instruction Coverpoints
Instruction fadd.s fclass.s fcvt.l.s fcvt.lu.s fcvt.s.l fcvt.s.lu fcvt.s.w fcvt.s.wu fcvt.w.s fcvt.wu.s fdiv.s feq.s

RV32

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

cp_asm_count

x

x

x

x

x

x

x

x

x

x

x

x

cp_rs1

x

x

x

x

cp_rd

x

x

x

x

x

x

cp_rs1_edges

x

x

x

x

cp_fs1

x

x

x

x

x

x

x

x

cp_fs2

x

x

x

cp_fd

x

x

x

x

x

x

cp_fs1_edges

x

x

frm

frm

frm

frm

x

x

cp_fs2_edges

x

x

x

cmp_fd_fs1

x

x

cmp_fd_fs2

x

x

cp_frm

3

2

2

2

2

2

2

2

2

3

cp_csr_fflags

von

vn

vn

n

n

n

n

vn

vn

vdoun

v

cp_csr_frm

x

x

x

x

x

x

x

x

x

x

cr_fs1_fs2_edges

frm

frm

x

cp_fclass

x

Instruction fle.s flt.s flw fmadd.s fmax.s fmin.s fmsub.s fmul.s fmv.w.x fmv.x.w fnmadd.s fnmsub.s

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

cp_asm_count

x

x

x

x

x

x

x

x

x

x

x

x

cp_rs1

nx0

x

cp_rd

x

x

x

cp_rs1_edges

x

cp_imm_edges

x

cp_fs1

x

x

x

x

x

x

x

x

x

x

cp_fs2

x

x

x

x

x

x

x

x

x

cp_fs3

x

x

x

x

cp_fd

x

x

x

x

x

x

x

x

x

cp_fs1_edges

x

x

x

x

x

x

x

x

x

x

cp_fs2_edges

x

x

x

x

x

x

x

x

x

cp_fs3_edges

x

x

x

x

cmp_fd_fs1

x

x

x

x

x

x

x

cmp_fd_fs2

x

x

x

x

x

x

x

cmp_fd_fs3

x

x

x

x

cp_frm

4

4

3

4

4

cp_csr_fflags

v

v

voun

v

v

voun

voun

voun

voun

cp_csr_frm

x

x

x

x

x

cr_fs1_fs2_edges

x

x

frm4

x

x

frm4

frm

frm4

frm4

cr_fs1_fs3_edges

frm4

frm4

frm4

frm4

cp_memval

fp_single

Instruction fsgnj.s fsgnjn.s fsgnjx.s fsqrt.s fsub.s fsw

RV32

x

x

x

x

x

x

RV64

x

x

x

x

x

x

cp_asm_count

x

x

x

x

x

x

cp_rs1

nx0

cp_imm_edges

x

cp_fs1

x

x

x

x

x

cp_fs2

x

x

x

x

x

cp_fd

x

x

x

x

x

cp_fs1_edges

x

x

x

frm

x

cp_fs2_edges

x

x

x

x

x

cmp_fd_fs1

x

x

x

x

x

cmp_fd_fs2

x

x

x

x

cp_frm

2

3

cp_csr_fflags

vn

von

cp_csr_frm

x

x

cr_fs1_fs2_edges

x

x

x

frm

Table 43. F Normative Rules
Normative Rule Rule Text Coverpoints

flen_def

FLEN can be 32, 64, or 128 depending on which of the F, D, and Q extensions are supported.

Definition, checked through UDB

Zfinx_Zdinx_incompatible_F_D

These extensions, intended for lower-cost systems, are incompatible with the F and D extensions.

Definition, checked through UDB

F_ieee_compliance

computational instructions compliant with the IEEE 754-2008 arithmetic standard’s binary32 format and operations.

{F_fadd_s_cg, F_fdiv_s_cg}/cr_fs1_fs2_edges_frm, F_fmadd_s_cg/cr_fs1_fs2_edges_frm4, F_fsqrt_s_cg/cr_fs1_edges_frm

F_depends_Zicsr

The F extension depends on the Zicsr extension.

Not tested: extension dependency checked by the UDB configuration

flen

The F extension adds 32 floating-point registers, f0&#8205;&#8211;&#8205;f31, each 32 bits wide, i.e., FLEN=32.

F_fadd_s_cg/{cp_fs1, cp_fs2, cp_fd}

roundingmode_dynamic

Floating-point operations use either a static rounding mode encoded in the instruction, or a dynamic rounding mode held in frm. Rounding modes are encoded as shown in norm:dyn_round_enc. A value of 111 in the instruction’s rm field selects the dynamic rounding mode held in frm

F_fadd_s_cg/{cp_frm_3, cp_csr_frm}, {F_fsqrt_s_cg, F_fcvt_w_s_cg}/cp_csr_frm

dyn_round_enc

Rounding Mode|Mnemonic|Meaning === 000|RNE|Round to Nearest, ties to Even¶001|RTZ|Round towards Zero¶010|RDN|Round Down (towards −∞)¶011|RUP|Round Up (towards +∞)¶100|RMM|Round to Nearest, ties to Max Magnitude¶101||Reserved for future use.¶110||Reserved for future use.¶111|DYN|In instruction’s rm field, selects dynamic rounding mode; In Rounding Mode register, reserved. ===

F_fadd_s_cg/{cp_frm_3, cp_csr_frm}, F_fmadd_s_cg/{cp_frm_4, cp_csr_frm}

canonical_nan

Except when otherwise stated, if the result of a floating-point operation is NaN, it is the canonical NaN.

{F_fadd_s_cg, F_fdiv_s_cg}/cr_fs1_fs2_edges_frm, F_fsqrt_s_cg/cp_fs1_edges, F_fmin_s_cg/cr_fs1_fs2_edges

F_canonical_nan

For single-precision floating-point, the canonical NaN has a positive sign and all significand bits clear except the MSB, the quiet bit. In other words, for single-precision floating-point, the canonical NaN corresponds to the pattern 0x7fc00000.

{F_fadd_s_cg, F_fdiv_s_cg}/cr_fs1_fs2_edges_frm, F_fsqrt_s_cg/cp_fs1_edges, F_fmin_s_cg/cr_fs1_fs2_edges

ieee_std_subnormal

Operations on subnormal numbers are handled in accordance with IEEE 754-2008.

{F_fadd_s_cg, F_fmul_s_cg}/cr_fs1_fs2_edges_frm, F_fclass_s_cg/cp_fclass, ZicsrF_cg/cp_underflow_after_rounding_fma_s

ieee_std_tininess

In the parlance of IEEE 754-2008, tininess is detected after rounding.

ZicsrF_cg/{cp_underflow_after_rounding_fma_s, cp_underflow_after_rounding_fmul_s}

fsw_flw_op

Floating-point loads and stores use the same base+offset addressing mode as the integer base ISAs, with a base address in register rs1 and a 12-bit signed byte offset. The FLW instruction loads a single-precision floating-point value from memory into floating-point register rd. FSW stores a single-precision value from floating-point register rs2 to memory.

{F_flw_cg, F_fsw_cg}/{cp_rs1_nx0, cp_imm_edges}

fsw_flw_atomic_align

FLW and FSW are only guaranteed to execute atomically if the effective address is naturally aligned.

Not tested: atomicity is not observable in single-hart signature tests

fsw_flw_bits_maintained

FLW and FSW do not modify the bits being transferred; in particular, the payloads of non-canonical NaNs are preserved.

F_flw_cg/cp_memval_fp_single, F_fsw_cg/cp_fs2_edges

fadd-s_fmul-s_op

FADD.S and FMUL.S perform single-precision floating-point addition and multiplication respectively, between rs1 and rs2

{F_fadd_s_cg, F_fmul_s_cg}/{cp_fd, cr_fs1_fs2_edges_frm}

fsub-s_op

FSUB.S performs the single-precision floating-point subtraction of rs2 from rs1

F_fsub_s_cg/{cp_fs1, cp_fs2, cp_fd, cr_fs1_fs2_edges_frm}

fdiv-s_op

FDIV.S performs the single-precision floating-point division of rs1 by rs2

F_fdiv_s_cg/{cp_fs1, cp_fs2, cp_fd, cr_fs1_fs2_edges_frm}

fsqrt-s_op

FSQRT.S computes the square root of rs1

F_fsqrt_s_cg/{cp_fs1, cp_fd, cr_fs1_edges_frm}

fp_rd

In each case, the result is written to rd.

{F_fadd_s_cg, F_fmul_s_cg, F_fdiv_s_cg, F_fsqrt_s_cg}/cp_fd

F_fmt_single

The 2-bit floating-point format field fmt is encoded as shown in norm:fp_fmt_enc. It is set to S (00) for all instructions in the F extension.

{F_fadd_s_cg, F_fmadd_s_cg, F_fcvt_w_s_cg, F_fsgnj_s_cg}/cp_asm_count

F_rm_field

All floating-point operations that perform rounding can select the rounding mode using the rm field with the encoding shown in norm:dyn_round_enc.

F_fadd_s_cg/cr_fs1_fs2_edges_frm, F_fmadd_s_cg/cr_fs1_fs2_edges_frm4, F_fsqrt_s_cg/cr_fs1_edges_frm, F_fcvt_w_s_cg/cr_fs1_edges_frm

fmin-s_fmax-s_op

Floating-point minimum-number and maximum-number instructions FMIN.S and FMAX.S write, respectively, the smaller or larger of rs1 and rs2 to rd

{F_fmin_s_cg, F_fmax_s_cg}/{cp_fd, cr_fs1_fs2_edges}

fmin-s_fmax-s_zero_compare

For the purposes of these instructions only, the value −0.0 is considered to be less than the value +0.0

{F_fmin_s_cg, F_fmax_s_cg}/cr_fs1_fs2_edges

fmin-s_fmax-s_both_nan_input

If both inputs are NaNs, the result is the canonical NaN

{F_fmin_s_cg, F_fmax_s_cg}/cr_fs1_fs2_edges

fmin-s_fmax-s_one_nan_input

If only one operand is a NaN, the result is the non-NaN operand

{F_fmin_s_cg, F_fmax_s_cg}/cr_fs1_fs2_edges

fmin-s_fmax-s_signaling_nan_nv

Signaling NaN inputs set the invalid operation exception flag, even when the result is not NaN

{F_fmin_s_cg, F_fmax_s_cg}/{cr_fs1_fs2_edges, cp_csr_fflags_v}

fma_rs3

Floating-point fused multiply-add (FMA) instructions require a new standard instruction format. R4-type instructions specify three source registers (rs1, rs2, and rs3) and a destination register (rd). This format is only used by the floating-point fused multiply-add instructions.

{F_fmadd_s_cg, F_fmsub_s_cg, F_fnmadd_s_cg, F_fnmsub_s_cg}/cp_fs3

fmadd-s_op

FMADD.S multiplies the values in rs1 and rs2, adds the value in rs3, and writes the final result to rd. FMADD.S computes (rs1×rs2)+rs3.

F_fmadd_s_cg/{cp_fs3, cp_fd, cr_fs1_fs2_edges_frm4, cr_fs1_fs3_edges_frm4}

fmsub-s_op

FMSUB.S multiplies the values in rs1 and rs2, subtracts the value in rs3, and writes the final result to rd. FMSUB.S computes (rs1×rs2)−rs3.

F_fmsub_s_cg/{cp_fs3, cp_fd, cr_fs1_fs2_edges_frm4, cr_fs1_fs3_edges_frm4}

fnmsub-s_op

FNMSUB.S multiplies the values in rs1 and rs2, negates the product, adds the value in rs3, and writes the final result to rd. FNMSUB.S computes −(rs1×rs2)+rs3.

F_fnmsub_s_cg/{cp_fs3, cp_fd, cr_fs1_fs2_edges_frm4, cr_fs1_fs3_edges_frm4}

fnmadd-s_op

FNMADD.S multiplies the values in rs1 and rs2, negates the product, subtracts the value in rs3, and writes the final result to rd. FNMADD.S computes −(rs1×rs2)−rs3.

F_fnmadd_s_cg/{cp_fs3, cp_fd, cr_fs1_fs2_edges_frm4, cr_fs1_fs3_edges_frm4}

fma_nv_flag

The fused multiply-add instructions must set the invalid operation exception flag when the multiplicands are ∞ and zero, even when the addend is a quiet NaN.

fcvt-l-s_fcvt-w-s_op

FCVT.W.S or FCVT.L.S converts a floating-point number in floating-point register rs1 to a signed 32-bit or 64-bit integer, respectively, in integer register rd

{F_fcvt_w_s_cg, F_fcvt_l_s_cg}/{cp_rd, cr_fs1_edges_frm}

fcvt-s-w_fcvt-s-l_op

FCVT.S.W or FCVT.S.L converts a 32-bit or 64-bit signed integer, respectively, in integer register rs1 into a floating-point number in floating-point register rd

{F_fcvt_s_w_cg, F_fcvt_s_l_cg}/{cp_fd, cp_rs1_edges}

fcvt-wu-s_fcvt-lu-s_fcvt-s-wu_fcvt-s-lu_op

FCVT.WU.S, FCVT.LU.S, FCVT.S.WU, and FCVT.S.LU variants convert to or from unsigned integer values. For XLEN>32, FCVT.W.S and FCVT.WU.S sign-extend the 32-bit result to the destination register width

{F_fcvt_wu_s_cg, F_fcvt_lu_s_cg}/cr_fs1_edges_frm, {F_fcvt_s_wu_cg, F_fcvt_s_lu_cg}/cp_rs1_edges

fcvt_long_float_rv64_only

FCVT.L.S, FCVT.LU.S, FCVT.S.L, and FCVT.S.LU are RV64-only instructions

{F_fcvt_l_s_cg, F_fcvt_lu_s_cg, F_fcvt_s_l_cg, F_fcvt_s_lu_cg}/cp_asm_count

fcvt_unrepresentable_nv

If the rounded result is not representable in the destination format, it is clipped to the nearest value and the invalid flag is set

{F_fcvt_w_s_cg, F_fcvt_wu_s_cg, F_fcvt_l_s_cg, F_fcvt_lu_s_cg}/cr_fs1_edges_frm

fcvt_int_float_valid_input

norm:fcvt_int_domain_tbl gives the range of valid inputs for FCVT.W.S, FCVT.WU.S, FCVT.L.S, and FCVT.LU.S and the behavior of these instructions for invalid inputs

{F_fcvt_w_s_cg, F_fcvt_wu_s_cg, F_fcvt_l_s_cg, F_fcvt_lu_s_cg}/cr_fs1_edges_frm

fcvt_round

All floating-point to integer and integer to floating-point conversion instructions round according to the rm field.

{F_fcvt_w_s_cg, F_fcvt_l_s_cg}/cr_fs1_edges_frm, {F_fcvt_s_w_cg, F_fcvt_s_l_cg}/cp_frm_2

fcvt_nx

All floating-point conversion instructions set the Inexact exception flag if the rounded result differs from the operand value and the Invalid exception flag is not set.

F_fcvt_w_s_cg/{cr_fs1_edges_frm, cp_csr_fflags_vn}, F_fcvt_s_w_cg/{cp_rs1_edges, cp_csr_fflags_n}

fsgnj-s_fsgnjn-s_fsgnjx-s_op

FSGNJ.S, FSGNJN.S, and FSGNJX.S are floating-point to floating-point sign-injection instructions that produce a result that takes all bits except the sign bit from rs1. For FSGNJ, the result’s sign bit is rs2’s sign bit; for FSGNJN, the result’s sign bit is the opposite of rs2’s sign bit; and for FSGNJX, the sign bit is the XOR of the sign bits of rs1 and rs2. Sign-injection instructions do not set floating-point exception flags, nor do they canonicalize NaNs

{F_fsgnj_s_cg, F_fsgnjn_s_cg, F_fsgnjx_s_cg}/cr_fs1_fs2_edges

fmv-x-w_op

FMV.X.W moves the single-precision value in floating-point register rs1 represented in the IEEE 754-2008 encoding to the lower 32 bits of integer register rd. The bits are not modified in the transfer, and in particular, the payloads of non-canonical NaNs are preserved. For RV64, the higher 32 bits of the destination register are filled with copies of the floating-point number’s sign bit

F_fmv_x_w_cg/{cp_rd, cp_fs1, cp_fs1_edges}

fmv-w-x_op

FMV.W.X moves the single-precision value encoded in the IEEE 754-2008 encoding from the lower 32 bits of integer register rs1 to the floating-point register rd. The bits are not modified in the transfer, and in particular, the payloads of non-canonical NaNs are preserved.

F_fmv_w_x_cg/{cp_rs1, cp_rs1_edges, cp_fd}

feq-s_flt-s_fle-s_op

Floating-point compare instructions (FEQ.S, FLT.S, FLE.S) perform the specified comparison between floating-point registers (rs1 = rs2, rs1 < rs2, rs1 ≤ rs2) writing 1 to the integer register rd if the condition holds, and 0 otherwise.

{F_feq_s_cg, F_flt_s_cg, F_fle_s_cg}/cr_fs1_fs2_edges

flt-s_fle-s_signaling

FLT.S and FLE.S perform what IEEE 754-2008 refers to as signaling comparisons: that is, they set the invalid operation exception flag if either input is NaN

{F_fle_s_cg, F_flt_s_cg}/{cr_fs1_fs2_edges, cp_csr_fflags_v}

feq-s_quiet

FEQ.S performs a quiet comparison: it only sets the invalid operation exception flag if either input is a signaling NaN

F_feq_s_cg/{cr_fs1_fs2_edges, cp_csr_fflags_v}

feq-s_flt-s_fle-s_nan_input

For all three instructions, the result is 0 if either operand is NaN

{F_feq_s_cg, F_fle_s_cg, F_flt_s_cg}/cr_fs1_fs2_edges

fclass-s_op

The FCLASS.S instruction examines the value in floating-point register rs1 and writes to integer register rd a 10-bit mask that indicates the class of the floating-point number. The format of the mask is described in norm:fclass_result_enc. The corresponding bit in rd will be set if the property is true and clear otherwise. All other bits in rd are cleared. Note that exactly one bit in rd will be set. FCLASS.S does not set the floating-point exception flags.

F_fclass_s_cg/{cp_rd, cp_fs1, cp_fs1_edges, cp_fclass}

UDB Parameters: None.

A.7.2. D Double-Precision FP

Table 44. D Instruction Coverpoints
Instruction fadd.d fclass.d fcvt.d.l fcvt.d.lu fcvt.d.s fcvt.d.w fcvt.d.wu fcvt.l.d fcvt.lu.d fcvt.s.d fcvt.w.d fcvt.wu.d

RV32

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

cp_asm_count

x

x

x

x

x

x

x

x

x

x

x

x

cp_rs1

x

x

x

x

cp_rd

x

x

x

x

x

cp_rs1_edges

x

x

x

x

cp_fs1

x

x

x

x

x

x

x

x

cp_fs2

x

cp_fd

x

x

x

x

x

x

x

cp_fs1_edges

D

D

x

frm_D

frm_D

frm_D

frm_D

frm_D

cp_fs2_edges

D

cmp_fd_fs1

x

x

x

cmp_fd_fs2

x

cp_frm

3

2

2

2

2

2

2

2

cp_csr_fflags

von

n

n

v

vn

vn

voun

vn

vn

cp_csr_frm

x

x

x

x

x

x

x

x

cr_fs1_fs2_edges

frm_D

cp_fclass

x

cp_NaNBox

D_S

cp_fs1_badNB

D_S

Instruction fdiv.d feq.d fld fle.d flt.d fmadd.d fmax.d fmin.d fmsub.d fmul.d fmv.d.x fmv.x.d

RV32

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

cp_asm_count

x

x

x

x

x

x

x

x

x

x

x

x

cp_rs1

nx0

x

cp_rd

x

x

x

x

cp_rs1_edges

x

cp_imm_edges

x

cp_fs1

x

x

x

x

x

x

x

x

x

x

cp_fs2

x

x

x

x

x

x

x

x

x

cp_fs3

x

x

cp_fd

x

x

x

x

x

x

x

x

cp_fs1_edges

D

D

D

D

D

D

D

D

D

D

cp_fs2_edges

D

D

D

D

D

D

D

D

D

cp_fs3_edges

D

D

cmp_fd_fs1

x

x

x

x

x

x

cmp_fd_fs2

x

x

x

x

x

x

cmp_fd_fs3

x

x

cp_frm

3

4

4

3

cp_csr_fflags

vdoun

v

v

v

voun

v

v

voun

voun

cp_csr_frm

x

x

x

x

cr_fs1_fs2_edges

frm_D

D

D

D

frm4_D

D

D

frm4_D

frm_D

cr_fs1_fs3_edges

frm4_D

frm4_D

cp_memval

fp_double

Instruction fnmadd.d fnmsub.d fsd fsgnj.d fsgnjn.d fsgnjx.d fsqrt.d fsub.d

RV32

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

cp_asm_count

x

x

x

x

x

x

x

x

cp_rs1

nx0

cp_imm_edges

x

cp_fs1

x

x

x

x

x

x

x

cp_fs2

x

x

x

x

x

x

x

cp_fs3

x

x

cp_fd

x

x

x

x

x

x

x

cp_fs1_edges

D

D

D

D

D

D

D

cp_fs2_edges

D

D

x

D

D

D

D

cp_fs3_edges

D

D

cmp_fd_fs1

x

x

x

x

x

x

x

cmp_fd_fs2

x

x

x

x

x

x

cmp_fd_fs3

x

x

cp_frm

4

4

2

3

cp_csr_fflags

voun

voun

vn

von

cp_csr_frm

x

x

x

x

cr_fs1_fs2_edges

frm4_D

frm4_D

D

D

D

frm_D

cr_fs1_fs3_edges

frm4_D

frm4_D

Instruction fadd.s fclass.s fcvt.l.s fcvt.lu.s fcvt.s.l fcvt.s.lu fcvt.s.w fcvt.s.wu fcvt.w.s fcvt.wu.s fdiv.s feq.s

RV32

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

cp_NaNBox

D_S

D_S

D_S

D_S

D_S

D_S

cp_fs1_badNB

D_S

D_S

D_S

D_S

D_S

D_S

D_S

D_S

cp_fs2_badNB

D_S

D_S

D_S

Instruction fle.s flt.s flw fmadd.s fmax.s fmin.s fmsub.s fmul.s fmv.w.x fmv.x.w fnmadd.s fnmsub.s

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

cp_NaNBox

D_S

D_S

D_S

D_S

D_S

D_S

D_S

D_S

D_S

cp_fs1_badNB

D_S

D_S

D_S

D_S

D_S

D_S

D_S

D_S

D_S

D_S

cp_fs2_badNB

D_S

D_S

D_S

D_S

D_S

D_S

D_S

D_S

D_S

cp_fs3_badNB

D_S

D_S

D_S

D_S

Instruction fsgnj.s fsgnjn.s fsgnjx.s fsqrt.s fsub.s fsw

RV32

x

x

x

x

x

x

RV64

x

x

x

x

x

x

cp_NaNBox

D_S

D_S

D_S

D_S

D_S

cp_fs1_badNB

D_S

D_S

D_S

D_S

D_S

cp_fs2_badNB

D_S

D_S

D_S

D_S

D_S

Table 45. D Normative Rules
Normative Rule Rule Text Coverpoints

roundingmode_dynamic

Floating-point operations use either a static rounding mode encoded in the instruction, or a dynamic rounding mode held in frm. Rounding modes are encoded as shown in norm:dyn_round_enc. A value of 111 in the instruction’s rm field selects the dynamic rounding mode held in frm

D_fadd_d_cg/{cp_frm_3, cp_csr_frm}, {D_fsqrt_d_cg, D_fcvt_s_d_cg}/cp_csr_frm

dyn_round_enc

Rounding Mode|Mnemonic|Meaning === 000|RNE|Round to Nearest, ties to Even¶001|RTZ|Round towards Zero¶010|RDN|Round Down (towards −∞)¶011|RUP|Round Up (towards +∞)¶100|RMM|Round to Nearest, ties to Max Magnitude¶101||Reserved for future use.¶110||Reserved for future use.¶111|DYN|In instruction’s rm field, selects dynamic rounding mode; In Rounding Mode register, reserved. ===

D_fadd_d_cg/{cp_frm_3, cp_csr_frm}, D_fmadd_d_cg/{cp_frm_4, cp_csr_frm}

ieee_std_subnormal

Operations on subnormal numbers are handled in accordance with IEEE 754-2008.

{D_fadd_d_cg, D_fmul_d_cg}/cr_fs1_fs2_edges_frm_D, D_fclass_d_cg/cp_fclass, ZicsrF_cg/cp_underflow_after_rounding_fma_d

ieee_std_tininess

In the parlance of IEEE 754-2008, tininess is detected after rounding.

ZicsrF_cg/{cp_underflow_after_rounding_fma_d, cp_underflow_after_rounding_fmul_d, cp_underflow_after_rounding_fcvt_s_d}

fcvt_unrepresentable_nv

If the rounded result is not representable in the destination format, it is clipped to the nearest value and the invalid flag is set

{D_fcvt_w_d_cg, D_fcvt_wu_d_cg, D_fcvt_l_d_cg, D_fcvt_lu_d_cg}/cr_fs1_edges_frm_D

fcvt_round

All floating-point to integer and integer to floating-point conversion instructions round according to the rm field.

{D_fcvt_w_d_cg, D_fcvt_l_d_cg}/cr_fs1_edges_frm_D, {D_fcvt_d_l_cg, D_fcvt_d_lu_cg}/cp_frm_2

fcvt_nx

All floating-point conversion instructions set the Inexact exception flag if the rounded result differs from the operand value and the Invalid exception flag is not set.

D_fcvt_w_d_cg/{cr_fs1_edges_frm_D, cp_csr_fflags_vn}, D_fcvt_s_d_cg/{cr_fs1_edges_frm_D, cp_csr_fflags_voun}

D_canonical_nan

For double-precision floating-point, the canonical NaN corresponds to the pattern 0x7ff8000000000000.

{D_fadd_d_cg, D_fdiv_d_cg}/cr_fs1_fs2_edges_frm_D, D_fsqrt_d_cg/cp_fs1_edges_D, D_fmin_d_cg/cr_fs1_fs2_edges_D

D_flen_64

The D extension widens the 32 floating-point registers, f0&#8205;&#8211;&#8205;f31, to 64 bits, i.e., FLEN=64.

D_fadd_d_cg/cr_fs1_fs2_edges_frm_D, D_fld_cg/cp_memval_fp_double

fp_nan_boxing

When multiple floating-point precisions are supported, then valid values of narrower n-bit types, n<FLEN, are represented in the lower n bits of an FLEN-bit NaN value, in a process termed NaN-boxing. The upper bits of a valid NaN-boxed value must be all 1s. Valid NaN-boxed n-bit values therefore appear as negative quiet NaNs (qNaNs) when viewed as any wider m-bit value, n < m ≤ FLEN. Any operation that writes a narrower result to an f register must write all 1s to the uppermost FLEN-n bits to yield a legal NaN-boxed value.

{D_fadd_s_cg, D_fcvt_s_d_cg, D_flw_cg, D_fmv_w_x_cg}/cp_NaNBox_D_S

fp_transfer_instrs_narrow_transfer_in

A narrower n-bit transfer, n<FLEN, into the f registers will create a valid NaN-boxed value

{D_flw_cg, D_fmv_w_x_cg}/cp_NaNBox_D_S

fp_transfer_instrs_narrow_transfer_out

A narrower n-bit transfer out of the floating-point registers will transfer the lower n bits of the register ignoring the upper FLEN-n bits

D_fsw_cg/cp_fs2_badNB_D_S, D_fmv_x_w_cg/cp_fs1_badNB_D_S

fp_nontransfer_instrs_improper_nan_boxed_input

Apart from transfer operations described in the previous paragraph, all other floating-point operations on narrower n-bit operations, n<FLEN, check if the input operands are correctly NaN-boxed, i.e., all upper FLEN-n bits are 1. If so, the n least-significant bits of the input are used as the input value, otherwise the input value is treated as an n-bit canonical NaN.

D_fadd_s_cg/{cp_fs1_badNB_D_S, cp_fs2_badNB_D_S}, D_fmadd_s_cg/cp_fs3_badNB_D_S, D_fsqrt_s_cg/cp_fs1_badNB_D_S

fld_op

The FLD instruction loads a double-precision floating-point value from memory into floating-point register rd

D_fld_cg/{cp_rs1_nx0, cp_imm_edges, cp_fd, cp_memval_fp_double}

fsd_op

FSD stores a double-precision value from the floating-point registers to memory

D_fsd_cg/{cp_rs1_nx0, cp_imm_edges, cp_fs2, cp_fs2_edges}

fld_fsd_atomic_align

FLD and FSD are only guaranteed to execute atomically if the effective address is naturally aligned and XLEN≥64.

Not tested: atomicity is not observable in single-hart signature tests

fld_fsd_bits_maintained

FLD and FSD do not modify the bits being transferred; in particular, the payloads of non-canonical NaNs are preserved.

D_fld_cg/cp_memval_fp_double

D_computational_instrs

The double-precision floating-point computational instructions are defined analogously to their single-precision counterparts, but operate on double-precision operands and produce double-precision results.

{D_fadd_d_cg, D_fdiv_d_cg}/cr_fs1_fs2_edges_frm_D, D_fmadd_d_cg/cr_fs1_fs2_edges_frm4_D, D_fsqrt_d_cg/cp_fs1_edges_D

fcvt-w-d_fcvt-l-d_op

FCVT.W.D or FCVT.L.D converts a double-precision floating-point number in floating-point register rs1 to a signed 32-bit or 64-bit integer, respectively, in integer register rd

{D_fcvt_w_d_cg, D_fcvt_l_d_cg}/{cp_rd, cr_fs1_edges_frm_D}

fcvt-d-w_fcvt-d-l_op

FCVT.D.W or FCVT.D.L converts a 32-bit or 64-bit signed integer, respectively, in integer register rs1 into a double-precision floating-point number in floating-point register rd

{D_fcvt_d_w_cg, D_fcvt_d_l_cg}/{cp_fd, cp_rs1_edges}

fcvt-wu-d_fcvt-lu-d_fcvt-d-wu_fcvt-d-lu_op

FCVT.WU.D, FCVT.LU.D, FCVT.D.WU, and FCVT.D.LU variants convert to or from unsigned integer values

{D_fcvt_wu_d_cg, D_fcvt_lu_d_cg}/cr_fs1_edges_frm_D, {D_fcvt_d_wu_cg, D_fcvt_d_lu_cg}/cp_rs1_edges

fcvt-w-d_fcvt-wu-d_sign_ext

For RV64, FCVT.W.D and FCVT.WU.D sign-extend the 32-bit result

{D_fcvt_w_d_cg, D_fcvt_wu_d_cg}/cr_fs1_edges_frm_D

fcvt_long_double_rv64_only

FCVT.L.D, fcvt.lu.d[], fcvt.d.l[], and fcvt.d.lu[] are RV64-only instructions.

{D_fcvt_l_d_cg, D_fcvt_lu_d_cg, D_fcvt_d_l_cg, D_fcvt_d_lu_cg}/cp_asm_count

fcvt_int_double_valid_input

The range of valid inputs for FCVT.W.D, FCVT.WU.D, FCVT.L.D, and FCVT.LU.D and the behavior of these instructions for invalid inputs are the same as for FCVT.W.S, FCVT.WU.S, FCVT.L.S, and FCVT.LU.S

{D_fcvt_w_d_cg, D_fcvt_wu_d_cg, D_fcvt_l_d_cg, D_fcvt_lu_d_cg}/cr_fs1_edges_frm_D

fcvt-s-d_fcvt-d-s_op

The double-precision to single-precision and single-precision to double-precision conversion instructions, FCVT.S.D and FCVT.D.S, are encoded in the OP-FP major opcode space and both the source and destination are floating-point registers. The rs2 field encodes the datatype of the source, and the fmt field encodes the datatype of the destination

D_fcvt_s_d_cg/{cp_fd, cr_fs1_edges_frm_D}, D_fcvt_d_s_cg/{cp_fd, cp_fs1_edges}

fcvt_float_rounding

FCVT.S.D rounds according to the rm field; FCVT.D.S will never round

D_fcvt_s_d_cg/cr_fs1_edges_frm_D, D_fcvt_d_s_cg/{cp_fs1_edges, cp_csr_fflags_v}, ZicsrF_cg/cp_underflow_after_rounding_fcvt_s_d

fsgnj-d_fsgnjn-d_fsgnjx-d_op

Floating-point to floating-point sign-injection instructions, FSGNJ.D, FSGNJN.D, and FSGNJX.D, are defined analogously to the single-precision sign-injection instruction.

{D_fsgnj_d_cg, D_fsgnjn_d_cg, D_fsgnjx_d_cg}/cr_fs1_fs2_edges_D

fmv-x-d_op

FMV.X.D moves the double-precision value in floating-point register rs1 to a representation in the IEEE 754-2008 encoding in integer register rd

D_fmv_x_d_cg/{cp_rd, cp_fs1, cp_fs1_edges_D}

fmv-d-x_op

FMV.D.X moves the double-precision value encoded in the IEEE 754-2008 encoding from the integer register rs1 to the floating-point register rd

D_fmv_d_x_cg/{cp_rs1, cp_rs1_edges, cp_fd}

fmv_bits_preserved

FMV.X.D and FMV.D.X do not modify the bits being transferred; in particular, the payloads of non-canonical NaNs are preserved.

D_fmv_x_d_cg/cp_fs1_edges_D, D_fmv_d_x_cg/cp_rs1_edges

D_compare_instrs

The double-precision floating-point compare instructions are defined analogously to their single-precision counterparts, but operate on double-precision operands.

{D_feq_d_cg, D_flt_d_cg, D_fle_d_cg}/cr_fs1_fs2_edges_D, D_feq_d_cg/cp_csr_fflags_v

fclass-d_op

The double-precision floating-point classify instruction, FCLASS.D, is defined analogously to its single-precision counterpart, but operates on double-precision operands.

D_fclass_d_cg/{cp_rd, cp_fs1, cp_fs1_edges_D, cp_fclass}

UDB Parameters: None.

A.7.3. Zfh Half-Precision FP

The rows of Table 46 with D in the ExtraExtensions column apply only when D is also supported. They cover fcvt.d.h, fcvt.h.d, and NaN-boxing of half-precision values in 64-bit registers.

Table 46. Zfh Instruction Coverpoints
Instruction fadd.h fclass.h fcvt.h.l fcvt.h.lu fcvt.h.s fcvt.h.w fcvt.h.wu fcvt.l.h fcvt.lu.h fcvt.s.h fcvt.w.h fcvt.wu.h

RV32

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

cp_asm_count

x

x

x

x

x

x

x

x

x

x

x

x

cp_rs1

x

x

x

x

cp_rd

x

x

x

x

x

cp_rs1_edges

x

x

x

x

cp_fs1

x

x

x

x

x

x

x

x

cp_fs2

x

cp_fd

x

x

x

x

x

x

x

cp_fs1_edges

H

H

frm

frm_H

frm_H

H

frm_H

frm_H

cp_fs2_edges

H

cmp_fd_fs1

x

x

x

cmp_fd_fs2

x

cp_frm

3

2

2

2

2

2

2

2

2

2

cp_csr_fflags

von

on

on

voun

on

on

vn

vn

v

vn

vn

cp_csr_frm

x

x

x

x

x

x

x

x

x

x

cr_fs1_fs2_edges

frm_H

cp_fclass

x

cp_NaNBox

S_H

S_H

S_H

S_H

S_H

S_H

cp_fs1_badNB

S_H

S_H

S_H

S_H

S_H

S_H

S_H

cp_fs2_badNB

S_H

Instruction fdiv.h feq.h fle.h flh flt.h fmadd.h fmax.h fmin.h fmsub.h fmul.h fmv.h.x fmv.x.h

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

cp_asm_count

x

x

x

x

x

x

x

x

x

x

x

x

cp_rs1

nx0

x

cp_rd

x

x

x

x

cp_rs1_edges

x

cp_imm_edges

x

cp_fs1

x

x

x

x

x

x

x

x

x

x

cp_fs2

x

x

x

x

x

x

x

x

x

cp_fs3

x

x

cp_fd

x

x

x

x

x

x

x

x

cp_fs1_edges

H

H

H

H

H

H

H

H

H

H

cp_fs2_edges

H

H

H

H

H

H

H

H

H

cp_fs3_edges

H

H

cmp_fd_fs1

x

x

x

x

x

x

cmp_fd_fs2

x

x

x

x

x

x

cmp_fd_fs3

x

x

cp_frm

3

4

4

3

cp_csr_fflags

vdoun

v

v

v

voun

v

v

voun

voun

cp_csr_frm

x

x

x

x

cr_fs1_fs2_edges

frm_H

H

H

H

frm4_H

H

H

frm4_H

frm_H

cr_fs1_fs3_edges

frm4_H

frm4_H

cp_NaNBox

S_H

S_H

S_H

S_H

S_H

S_H

S_H

S_H

cp_fs1_badNB

S_H

S_H

S_H

S_H

S_H

S_H

S_H

S_H

S_H

S_H

cp_fs2_badNB

S_H

S_H

S_H

S_H

S_H

S_H

S_H

S_H

S_H

cp_fs3_badNB

S_H

S_H

cp_memval

fp_half

Instruction fnmadd.h fnmsub.h fsgnj.h fsgnjn.h fsgnjx.h fsh fsqrt.h fsub.h fcvt.d.h fcvt.h.d fadd.h fclass.h

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

ExtraExtensions

D

D

D

D

cp_asm_count

x

x

x

x

x

x

x

x

x

x

cp_rs1

nx0

cp_imm_edges

x

cp_fs1

x

x

x

x

x

x

x

x

x

cp_fs2

x

x

x

x

x

x

x

cp_fs3

x

x

cp_fd

x

x

x

x

x

x

x

x

x

cp_fs1_edges

H

H

H

H

H

H

H

H

frm_D

cp_fs2_edges

H

H

H

H

H

H

H

cp_fs3_edges

H

H

cmp_fd_fs1

x

x

x

x

x

x

x

x

x

cmp_fd_fs2

x

x

x

x

x

x

cmp_fd_fs3

x

x

cp_frm

4

4

2

3

2

cp_csr_fflags

voun

voun

vn

von

v

voun

cp_csr_frm

x

x

x

x

x

cr_fs1_fs2_edges

frm4_H

frm4_H

H

H

H

frm_H

cr_fs1_fs3_edges

frm4_H

frm4_H

cp_NaNBox

S_H

S_H

S_H

S_H

S_H

S_H

S_H

D_H

D_H

cp_fs1_badNB

S_H

S_H

S_H

S_H

S_H

S_H

S_H

D_H

D_H

D_H

cp_fs2_badNB

S_H

S_H

S_H

S_H

S_H

S_H

S_H

D_H

cp_fs3_badNB

S_H

S_H

Instruction fcvt.h.l fcvt.h.lu fcvt.h.s fcvt.h.w fcvt.h.wu fcvt.l.h fcvt.lu.h fcvt.s.h fcvt.w.h fcvt.wu.h fdiv.h feq.h

RV32

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

ExtraExtensions

D

D

D

D

D

D

D

D

D

D

D

D

cp_NaNBox

D_H

D_H

D_H

D_H

D_H

D_S

D_H

cp_fs1_badNB

D_H

D_H

D_H

D_H

D_H

D_H

D_H

D_H

cp_fs2_badNB

D_H

D_H

Instruction fle.h flh flt.h fmadd.h fmax.h fmin.h fmsub.h fmul.h fmv.h.x fmv.x.h fnmadd.h fnmsub.h

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

ExtraExtensions

D

D

D

D

D

D

D

D

D

D

D

D

cp_NaNBox

D_H

D_H

D_H

D_H

D_H

D_H

D_H

D_H

D_H

cp_fs1_badNB

D_H

D_H

D_H

D_H

D_H

D_H

D_H

D_H

D_H

D_H

cp_fs2_badNB

D_H

D_H

D_H

D_H

D_H

D_H

D_H

D_H

D_H

cp_fs3_badNB

D_H

D_H

D_H

D_H

Instruction fsgnj.h fsgnjn.h fsgnjx.h fsh fsqrt.h fsub.h

RV32

x

x

x

x

x

x

RV64

x

x

x

x

x

x

ExtraExtensions

D

D

D

D

D

D

cp_NaNBox

D_H

D_H

D_H

D_H

D_H

cp_fs1_badNB

D_H

D_H

D_H

D_H

D_H

cp_fs2_badNB

D_H

D_H

D_H

D_H

D_H

Table 47. Zfh Normative Rules
Normative Rule Rule Text Coverpoints

roundingmode_dynamic

Floating-point operations use either a static rounding mode encoded in the instruction, or a dynamic rounding mode held in frm. Rounding modes are encoded as shown in norm:dyn_round_enc. A value of 111 in the instruction’s rm field selects the dynamic rounding mode held in frm

Zfh_fadd_h_cg/{cp_frm_3, cp_csr_frm}, {Zfh_fsqrt_h_cg, Zfh_fcvt_h_s_cg}/cp_csr_frm

dyn_round_enc

Rounding Mode|Mnemonic|Meaning === 000|RNE|Round to Nearest, ties to Even¶001|RTZ|Round towards Zero¶010|RDN|Round Down (towards −∞)¶011|RUP|Round Up (towards +∞)¶100|RMM|Round to Nearest, ties to Max Magnitude¶101||Reserved for future use.¶110||Reserved for future use.¶111|DYN|In instruction’s rm field, selects dynamic rounding mode; In Rounding Mode register, reserved. ===

Zfh_fadd_h_cg/{cp_frm_3, cp_csr_frm}, Zfh_fmadd_h_cg/{cp_frm_4, cp_csr_frm}

ieee_std_subnormal

Operations on subnormal numbers are handled in accordance with IEEE 754-2008.

{Zfh_fadd_h_cg, Zfh_fmul_h_cg}/cr_fs1_fs2_edges_frm_H, Zfh_fclass_h_cg/cp_fclass, ZicsrF_cg/cp_underflow_after_rounding_fma_h

ieee_std_tininess

In the parlance of IEEE 754-2008, tininess is detected after rounding.

ZicsrF_cg/{cp_underflow_after_rounding_fma_h, cp_underflow_after_rounding_fmul_h, cp_underflow_after_rounding_fcvt_h_s}

fcvt_unrepresentable_nv

If the rounded result is not representable in the destination format, it is clipped to the nearest value and the invalid flag is set

{Zfh_fcvt_w_h_cg, Zfh_fcvt_wu_h_cg, Zfh_fcvt_l_h_cg, Zfh_fcvt_lu_h_cg}/cr_fs1_edges_frm_H

fcvt_round

All floating-point to integer and integer to floating-point conversion instructions round according to the rm field.

{Zfh_fcvt_w_h_cg, Zfh_fcvt_l_h_cg}/cr_fs1_edges_frm_H, {Zfh_fcvt_h_w_cg, Zfh_fcvt_h_l_cg}/cp_frm_2

fcvt_nx

All floating-point conversion instructions set the Inexact exception flag if the rounded result differs from the operand value and the Invalid exception flag is not set.

Zfh_fcvt_w_h_cg/{cr_fs1_edges_frm_H, cp_csr_fflags_vn}, Zfh_fcvt_h_w_cg/{cp_rs1_edges, cp_csr_fflags_on}

fp_nan_boxing

When multiple floating-point precisions are supported, then valid values of narrower n-bit types, n<FLEN, are represented in the lower n bits of an FLEN-bit NaN value, in a process termed NaN-boxing. The upper bits of a valid NaN-boxed value must be all 1s. Valid NaN-boxed n-bit values therefore appear as negative quiet NaNs (qNaNs) when viewed as any wider m-bit value, n < m ≤ FLEN. Any operation that writes a narrower result to an f register must write all 1s to the uppermost FLEN-n bits to yield a legal NaN-boxed value.

{Zfh_fadd_h_cg, Zfh_fcvt_h_s_cg, Zfh_flh_cg, Zfh_fmv_h_x_cg}/cp_NaNBox_S_H, {ZfhD_fadd_h_cg, ZfhD_fcvt_h_d_cg, ZfhD_flh_cg, ZfhD_fmv_h_x_cg}/cp_NaNBox_D_H

fp_transfer_instrs_narrow_transfer_in

A narrower n-bit transfer, n<FLEN, into the f registers will create a valid NaN-boxed value

{Zfh_flh_cg, Zfh_fmv_h_x_cg}/cp_NaNBox_S_H, {ZfhD_flh_cg, ZfhD_fmv_h_x_cg}/cp_NaNBox_D_H

fp_transfer_instrs_narrow_transfer_out

A narrower n-bit transfer out of the floating-point registers will transfer the lower n bits of the register ignoring the upper FLEN-n bits

Zfh_fsh_cg/cp_fs2_badNB_S_H, Zfh_fmv_x_h_cg/cp_fs1_badNB_S_H, ZfhD_fsh_cg/cp_fs2_badNB_D_H, ZfhD_fmv_x_h_cg/cp_fs1_badNB_D_H

fp_nontransfer_instrs_improper_nan_boxed_input

Apart from transfer operations described in the previous paragraph, all other floating-point operations on narrower n-bit operations, n<FLEN, check if the input operands are correctly NaN-boxed, i.e., all upper FLEN-n bits are 1. If so, the n least-significant bits of the input are used as the input value, otherwise the input value is treated as an n-bit canonical NaN.

Zfh_fadd_h_cg/{cp_fs1_badNB_S_H, cp_fs2_badNB_S_H}, Zfh_fmadd_h_cg/cp_fs3_badNB_S_H, Zfh_fcvt_s_h_cg/cp_fs1_badNB_S_H, ZfhD_fadd_h_cg/{cp_fs1_badNB_D_H, cp_fs2_badNB_D_H}, ZfhD_fmadd_h_cg/cp_fs3_badNB_D_H, ZfhD_fcvt_d_h_cg/cp_fs1_badNB_D_H

Zfh_canonical_nan

For half-precision floating-point, the canonical NaN corresponds to the pattern 0x7e00.

{Zfh_fadd_h_cg, Zfh_fdiv_h_cg}/cr_fs1_fs2_edges_frm_H, Zfh_fsqrt_h_cg/cp_fs1_edges_H, Zfh_fmin_h_cg/cr_fs1_fs2_edges_H, ZfhD_fcvt_h_d_cg/cr_fs1_edges_frm_D

fsh_flh_op

New 16-bit variants of LOAD-FP and STORE-FP instructions are added, encoded with a new value for the funct3 width field.

{Zfh_flh_cg, Zfh_fsh_cg}/{cp_rs1_nx0, cp_imm_edges}

fsh_flh_bits_maintained

FLH and FSH do not modify the bits being transferred; in particular, the payloads of non-canonical NaNs are preserved. FLH NaN-boxes the result written to rd, whereas FSH ignores all but the lower 16 bits in rs2.

Zfh_flh_cg/{cp_memval_fp_half, cp_NaNBox_S_H}, Zfh_fsh_cg/{cp_fs2_edges_H, cp_fs2_badNB_S_H}, ZfhD_flh_cg/cp_NaNBox_D_H, ZfhD_fsh_cg/cp_fs2_badNB_D_H

Zfh_computational_instrs

The half-precision floating-point computational instructions are defined analogously to their single-precision counterparts, but operate on half-precision operands and produce half-precision results.

{Zfh_fadd_h_cg, Zfh_fdiv_h_cg}/cr_fs1_fs2_edges_frm_H, Zfh_fmadd_h_cg/cr_fs1_fs2_edges_frm4_H, Zfh_fsqrt_h_cg/cp_fs1_edges_H

fcvt-w-h_fcvt-l-h_op

FCVT.W.H or FCVT.L.H converts a half-precision floating-point number to a signed 32-bit or 64-bit integer, respectively

{Zfh_fcvt_w_h_cg, Zfh_fcvt_l_h_cg}/{cp_rd, cr_fs1_edges_frm_H}

fcvt-h-w_fcvt-h-l_op

FCVT.H.W or FCVT.H.L converts a 32-bit or 64-bit signed integer, respectively, into a half-precision floating-point number

{Zfh_fcvt_h_w_cg, Zfh_fcvt_h_l_cg}/{cp_fd, cp_rs1_edges}

fcvt-wu-h_fcvt-lu-h_fcvt-h-wu_fcvt-h-lu_op

FCVT.WU.H, FCVT.LU.H, FCVT.H.WU, and FCVT.H.LU variants convert to or from unsigned integer values

{Zfh_fcvt_wu_h_cg, Zfh_fcvt_lu_h_cg}/cr_fs1_edges_frm_H, {Zfh_fcvt_h_wu_cg, Zfh_fcvt_h_lu_cg}/cp_rs1_edges

fcvt_long_half_rv64_only

FCVT.L.H, FCVT.LU.H, FCVT.H.L, and FCVT.H.LU are RV64-only instructions.

{Zfh_fcvt_l_h_cg, Zfh_fcvt_lu_h_cg, Zfh_fcvt_h_l_cg, Zfh_fcvt_h_lu_cg}/cp_asm_count

fcvt-s-h_fcvt-h-s_op

FCVT.S.H or FCVT.H.S converts a half-precision floating-point number to a single-precision floating-point number, or vice-versa, respectively

Zfh_fcvt_h_s_cg/{cp_fd, cr_fs1_edges_frm}, Zfh_fcvt_s_h_cg/{cp_fd, cp_fs1_edges_H}, ZfhD_fcvt_h_s_cg/cp_NaNBox_D_H, ZfhD_fcvt_s_h_cg/{cp_NaNBox_D_S, cp_fs1_badNB_D_H}

fcvt-d-h_fcvt-h-d_op

If the D extension is present, FCVT.D.H or FCVT.H.D converts a half-precision floating-point number to a double-precision floating-point number, or vice-versa, respectively

ZfhD_fcvt_d_h_cg/{cp_fd, cp_fs1_edges_H}, ZfhD_fcvt_h_d_cg/{cp_fd, cr_fs1_edges_frm_D}

fsgnj-h_fsgnjn-h_fsgnjx-h_op

Floating-point to floating-point sign-injection instructions, FSGNJ.H, FSGNJN.H, and FSGNJX.H are defined analogously to the single-precision sign-injection instruction.

{Zfh_fsgnj_h_cg, Zfh_fsgnjn_h_cg, Zfh_fsgnjx_h_cg}/cr_fs1_fs2_edges_H

fmv-x-h_op

FMV.X.H moves the half-precision value in floating-point register rs1 to a representation in the IEEE 754-2008 encoding in integer register rd, filling the upper XLEN-16 bits with copies of the floating-point number’s sign bit

Zfh_fmv_x_h_cg/{cp_rd, cp_fs1, cp_fs1_edges_H}, ZfhD_fmv_x_h_cg/cp_fs1_badNB_D_H

fmv-h-x_op

FMV.H.X moves the half-precision value encoded in the IEEE 754-2008 encoding from the lower 16 bits of integer register rs1 to the floating-point register rd, NaN-boxing the result.

Zfh_fmv_h_x_cg/{cp_rs1, cp_rs1_edges, cp_fd, cp_NaNBox_S_H}, ZfhD_fmv_h_x_cg/cp_NaNBox_D_H

Zfh_compare_instrs

The half-precision floating-point compare instructions are defined analogously to their single-precision counterparts, but operate on half-precision operands.

{Zfh_feq_h_cg, Zfh_flt_h_cg, Zfh_fle_h_cg}/cr_fs1_fs2_edges_H, Zfh_feq_h_cg/cp_csr_fflags_v

fclass-h_op

The half-precision floating-point classify instruction, FCLASS.H, is defined analogously to its single-precision counterpart, but operates on half-precision operands.

Zfh_fclass_h_cg/{cp_rd, cp_fs1, cp_fs1_edges_H, cp_fclass}

UDB Parameters: None.

Zfhmin

The rows of Table 48 with D in the ExtraExtensions column apply only when D is also supported. They cover fcvt.d.h, fcvt.h.d, and NaN-boxing of half-precision values in 64-bit registers.

Table 48. Zfhmin Instruction Coverpoints
Instruction fcvt.h.s fcvt.s.h flh fmv.h.x fmv.x.h fsh fcvt.d.h fcvt.h.d fcvt.h.s fcvt.s.h flh fmv.h.x

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

ExtraExtensions

D

D

D

D

D

D

cp_asm_count

x

x

x

x

x

x

x

x

cp_rs1

nx0

x

nx0

cp_rd

x

cp_rs1_edges

x

cp_imm_edges

x

x

cp_fs1

x

x

x

x

x

cp_fs2

x

cp_fd

x

x

x

x

x

x

cp_fs1_edges

x

H

H

H

frm_D

cp_fs2_edges

H

cmp_fd_fs1

x

x

x

x

cp_frm

2

2

cp_csr_fflags

voun

v

v

voun

cp_csr_frm

x

x

cp_NaNBox

S_H

S_H

S_H

D_H

D_H

D_H

D_H

cp_fs1_badNB

S_H

S_H

D_H

D_H

cp_fs2_badNB

S_H

cp_memval

fp_half

Instruction fmv.x.h fsh

RV32

x

x

RV64

x

x

ExtraExtensions

D

D

cp_fs1_badNB

D_H

cp_fs2_badNB

D_H

Table 49. Zfhmin Normative Rules
Normative Rule Rule Text Coverpoints

ieee_std_tininess

In the parlance of IEEE 754-2008, tininess is detected after rounding.

ZicsrF_cg/cp_underflow_after_rounding_fcvt_h_s

fp_nan_boxing

When multiple floating-point precisions are supported, then valid values of narrower n-bit types, n<FLEN, are represented in the lower n bits of an FLEN-bit NaN value, in a process termed NaN-boxing. The upper bits of a valid NaN-boxed value must be all 1s. Valid NaN-boxed n-bit values therefore appear as negative quiet NaNs (qNaNs) when viewed as any wider m-bit value, n < m ≤ FLEN. Any operation that writes a narrower result to an f register must write all 1s to the uppermost FLEN-n bits to yield a legal NaN-boxed value.

{Zfhmin_flh_cg, Zfhmin_fmv_h_x_cg, Zfhmin_fcvt_h_s_cg}/cp_NaNBox_S_H, {ZfhminD_fcvt_h_d_cg, ZfhminD_fcvt_h_s_cg, ZfhminD_flh_cg, ZfhminD_fmv_h_x_cg}/cp_NaNBox_D_H

fp_transfer_instrs_narrow_transfer_in

A narrower n-bit transfer, n<FLEN, into the f registers will create a valid NaN-boxed value

{Zfhmin_flh_cg, Zfhmin_fmv_h_x_cg}/cp_NaNBox_S_H, {ZfhminD_flh_cg, ZfhminD_fmv_h_x_cg}/cp_NaNBox_D_H

fp_transfer_instrs_narrow_transfer_out

A narrower n-bit transfer out of the floating-point registers will transfer the lower n bits of the register ignoring the upper FLEN-n bits

Zfhmin_fmv_x_h_cg/cp_fs1_badNB_S_H, Zfhmin_fsh_cg/cp_fs2_badNB_S_H, ZfhminD_fmv_x_h_cg/cp_fs1_badNB_D_H, ZfhminD_fsh_cg/cp_fs2_badNB_D_H

fp_nontransfer_instrs_improper_nan_boxed_input

Apart from transfer operations described in the previous paragraph, all other floating-point operations on narrower n-bit operations, n<FLEN, check if the input operands are correctly NaN-boxed, i.e., all upper FLEN-n bits are 1. If so, the n least-significant bits of the input are used as the input value, otherwise the input value is treated as an n-bit canonical NaN.

Zfhmin_fcvt_s_h_cg/cp_fs1_badNB_S_H, {ZfhminD_fcvt_d_h_cg, ZfhminD_fcvt_s_h_cg}/cp_fs1_badNB_D_H

Zfh_canonical_nan

For half-precision floating-point, the canonical NaN corresponds to the pattern 0x7e00.

Zfhmin_fcvt_h_s_cg/cp_fs1_edges, ZfhminD_fcvt_h_d_cg/cr_fs1_edges_frm_D

fsh_flh_op

New 16-bit variants of LOAD-FP and STORE-FP instructions are added, encoded with a new value for the funct3 width field.

{Zfhmin_flh_cg, Zfhmin_fsh_cg}/{cp_rs1_nx0, cp_imm_edges}

fsh_flh_atomic_align

FLH and FSH are only guaranteed to execute atomically if the effective address is naturally aligned.

Not tested: atomicity is not observable in single-hart signature tests

fsh_flh_bits_maintained

FLH and FSH do not modify the bits being transferred; in particular, the payloads of non-canonical NaNs are preserved. FLH NaN-boxes the result written to rd, whereas FSH ignores all but the lower 16 bits in rs2.

Zfhmin_flh_cg/{cp_memval_fp_half, cp_NaNBox_S_H}, Zfhmin_fsh_cg/{cp_fs2_edges_H, cp_fs2_badNB_S_H}, ZfhminD_flh_cg/cp_NaNBox_D_H, ZfhminD_fsh_cg/cp_fs2_badNB_D_H

fcvt-s-h_fcvt-h-s_op

FCVT.S.H or FCVT.H.S converts a half-precision floating-point number to a single-precision floating-point number, or vice-versa, respectively

Zfhmin_fcvt_h_s_cg/{cp_fd, cp_fs1_edges, cp_frm_2}, Zfhmin_fcvt_s_h_cg/cp_fs1_edges_H, ZfhminD_fcvt_h_s_cg/cp_NaNBox_D_H, ZfhminD_fcvt_s_h_cg/cp_fs1_badNB_D_H

fcvt-d-h_fcvt-h-d_op

If the D extension is present, FCVT.D.H or FCVT.H.D converts a half-precision floating-point number to a double-precision floating-point number, or vice-versa, respectively

ZfhminD_fcvt_d_h_cg/{cp_fd, cp_fs1_edges_H}, ZfhminD_fcvt_h_d_cg/{cp_fd, cr_fs1_edges_frm_D}

fcvt-q-h_fcvt-h-q_op

If the Q extension is present, FCVT.Q.H or FCVT.H.Q converts a half-precision floating-point number to a quad-precision floating-point number, or vice-versa, respectively

fmv-x-h_op

FMV.X.H moves the half-precision value in floating-point register rs1 to a representation in the IEEE 754-2008 encoding in integer register rd, filling the upper XLEN-16 bits with copies of the floating-point number’s sign bit

Zfhmin_fmv_x_h_cg/{cp_rd, cp_fs1, cp_fs1_edges_H}, ZfhminD_fmv_x_h_cg/cp_fs1_badNB_D_H

fmv-h-x_op

FMV.H.X moves the half-precision value encoded in the IEEE 754-2008 encoding from the lower 16 bits of integer register rs1 to the floating-point register rd, NaN-boxing the result.

Zfhmin_fmv_h_x_cg/{cp_rs1, cp_rs1_edges, cp_fd, cp_NaNBox_S_H}, ZfhminD_fmv_h_x_cg/cp_NaNBox_D_H

fmv_half_bits_preserved

FMV.X.H and FMV.H.X do not modify the bits being transferred; in particular, the payloads of non-canonical NaNs are preserved.

Zfhmin_fmv_x_h_cg/cp_fs1_edges_H, Zfhmin_fmv_h_x_cg/cp_rs1_edges

Zfhmin

The Zfhmin extension includes the following instructions from the Zfh extension: FLH, FSH, FMV.X.H, FMV.H.X, FCVT.S.H, and FCVT.H.S. If the D extension is present, the FCVT.D.H and FCVT.H.D instructions are also included. If the Q extension is present, the FCVT.Q.H and FCVT.H.Q instructions are additionally included.

{Zfhmin_flh_cg, Zfhmin_fsh_cg, Zfhmin_fmv_x_h_cg, Zfhmin_fcvt_h_s_cg}/cp_asm_count

UDB Parameters: None.

A.7.4. Zfa Additional FP

The rows of Table 50 with an entry in the ExtraExtensions column apply only when those extensions are also supported. The D rows cover the double-precision instructions and NaN-boxing of single-precision values in 64-bit registers, and the Zfh rows cover the half-precision instructions. The Zfh:D rows, which need both Zfh and D, cover NaN-boxing of half-precision values in 64-bit registers. The Zvfh row covers fli.h, which Zfa provides with Zvfh even when Zfh is not supported.

Table 50. Zfa Instruction Coverpoints
Instruction fleq.s fli.s fltq.s fmaxm.s fminm.s fround.s froundnx.s fcvtmod.w.d fleq.d fli.d fltq.d fmaxm.d

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

ExtraExtensions

D

D

D

D

D

cp_asm_count

x

x

x

x

x

x

x

x

x

x

x

x

cp_rs1

fli

fli

cp_rd

x

x

x

x

x

cp_fs1

x

x

x

x

x

x

x

x

x

x

cp_fs2

x

x

x

x

x

x

x

cp_fd

x

x

x

x

x

x

x

cp_fs1_edges

x

x

x

x

x

x

D

D

D

D

cp_fs2_edges

x

x

x

x

D

D

D

cmp_fd_fs1

x

x

x

x

x

cmp_fd_fs2

x

x

x

cp_frm

2

2

cp_csr_fflags

v

v

v

v

v

vn

vn

v

v

v

cp_csr_frm

x

x

cr_fs1_fs2_edges

x

x

x

x

D

D

D

Instruction fminm.d fmvh.x.d fmvp.d.x fround.d froundnx.d fleq.s fli.s fltq.s fmaxm.s fminm.s fround.s froundnx.s

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

ExtraExtensions

D

D

D

D

D

D

D

D

D

D

D

D

cp_asm_count

x

x

x

x

x

cp_rs1

x

cp_rs2

x

cp_rd

x

cp_rs1_edges

x

cp_rs2_edges

x

cp_fs1

x

x

x

x

cp_fs2

x

cp_fd

x

x

x

x

cp_fs1_edges

D

D

D

D

cp_fs2_edges

D

cmp_fd_fs1

x

x

x

cmp_fd_fs2

x

cp_frm

2

2

cp_csr_fflags

v

v

vn

cp_csr_frm

x

x

cr_fs1_fs2_edges

D

cp_NaNBox

D_S

D_S

D_S

D_S

D_S

cp_fs1_badNB

D_S

D_S

D_S

D_S

D_S

D_S

cp_fs2_badNB

D_S

D_S

D_S

D_S

Instruction fleq.h fli.h fltq.h fmaxm.h fminm.h fround.h froundnx.h fli.h fleq.h fli.h fltq.h fmaxm.h

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

ExtraExtensions

Zfh

Zfh

Zfh

Zfh

Zfh

Zfh

Zfh

Zvfh

Zfh:D

Zfh:D

Zfh:D

Zfh:D

cp_asm_count

x

x

x

x

x

x

x

x

cp_rs1

fli

fli

cp_rd

x

x

cp_fs1

x

x

x

x

x

x

cp_fs2

x

x

x

x

cp_fd

x

x

x

x

x

x

cp_fs1_edges

H

H

H

H

H

H

cp_fs2_edges

H

H

H

H

cmp_fd_fs1

x

x

x

x

cmp_fd_fs2

x

x

cp_frm

2

2

cp_csr_fflags

v

v

v

v

v

vn

cp_csr_frm

x

x

cr_fs1_fs2_edges

H

H

H

H

cp_NaNBox

S_H

S_H

S_H

S_H

S_H

S_H

D_H

D_H

cp_fs1_badNB

S_H

S_H

S_H

S_H

S_H

S_H

D_H

D_H

D_H

cp_fs2_badNB

S_H

S_H

S_H

S_H

D_H

D_H

D_H

Instruction fminm.h fround.h froundnx.h

RV32

x

x

x

RV64

x

x

x

ExtraExtensions

Zfh:D

Zfh:D

Zfh:D

cp_NaNBox

D_H

D_H

D_H

cp_fs1_badNB

D_H

D_H

D_H

cp_fs2_badNB

D_H

Table 51. Zfa Normative Rules
Normative Rule Rule Text Coverpoints

fp_nan_boxing

When multiple floating-point precisions are supported, then valid values of narrower n-bit types, n<FLEN, are represented in the lower n bits of an FLEN-bit NaN value, in a process termed NaN-boxing. The upper bits of a valid NaN-boxed value must be all 1s. Valid NaN-boxed n-bit values therefore appear as negative quiet NaNs (qNaNs) when viewed as any wider m-bit value, n < m ≤ FLEN. Any operation that writes a narrower result to an f register must write all 1s to the uppermost FLEN-n bits to yield a legal NaN-boxed value.

{ZfaD_fli_s_cg, ZfaD_fminm_s_cg, ZfaD_fround_s_cg, ZfaD_froundnx_s_cg}/cp_NaNBox_D_S, {ZfaZfh_fli_h_cg, ZfaZfh_fminm_h_cg, ZfaZfh_fround_h_cg}/cp_NaNBox_S_H, {ZfaZfhD_fli_h_cg, ZfaZfhD_fminm_h_cg, ZfaZfhD_fround_h_cg, ZfaZfhD_froundnx_h_cg}/cp_NaNBox_D_H

fp_nontransfer_instrs_improper_nan_boxed_input

Apart from transfer operations described in the previous paragraph, all other floating-point operations on narrower n-bit operations, n<FLEN, check if the input operands are correctly NaN-boxed, i.e., all upper FLEN-n bits are 1. If so, the n least-significant bits of the input are used as the input value, otherwise the input value is treated as an n-bit canonical NaN.

{ZfaD_fleq_s_cg, ZfaD_fminm_s_cg}/{cp_fs1_badNB_D_S, cp_fs2_badNB_D_S}, {ZfaZfh_fleq_h_cg, ZfaZfh_fminm_h_cg}/{cp_fs1_badNB_S_H, cp_fs2_badNB_S_H}, {ZfaZfhD_fleq_h_cg, ZfaZfhD_fminm_h_cg}/{cp_fs1_badNB_D_H, cp_fs2_badNB_D_H}

fli-s_op

The FLI.S instruction loads one of 32 single-precision floating-point constants, encoded in the rs1 field, into floating-point register rd. The correspondence of rs1 field values and single-precision floating-point values is shown in norm:fli_imm_enc. FLI.S is encoded like FMV.W.X, but with rs2=1.

Zfa_fli_s_cg/{cp_rs1_fli, cp_fd}

fli-d_op

If the D extension is implemented, FLI.D performs the analogous operation, but loads a double-precision value into floating-point register rd. Note that entry 1 (corresponding to the minimum positive normal value) has a numerically different value for double-precision than for single-precision. FLI.D is encoded like FLI.S, but with fmt=D.

ZfaD_fli_d_cg/{cp_rs1_fli, cp_fd}

fli-q_op

If the Q extension is implemented, FLI.Q performs the analogous operation, but loads a quad-precision value into floating-point register rd. Note that entry 1 (corresponding to the minimum positive normal value) has a numerically different value for quad-precision. FLI.Q is encoded like FLI.S, but with fmt=Q.

fli-h_op

If the Zfh or Zvfh extension is implemented, FLI.H performs the analogous operation, but loads a half-precision floating-point value into register rd. Note that entry 1 (corresponding to the minimum positive normal value) has a numerically different value for half-precision. Furthermore, since 216 is not representable in half-precision floating-point, entry 29 in the table instead loads positive infinity—i.e., it is redundant with entry 30. FLI.H is encoded like FLI.S, but with fmt=H.

ZfaZfh_fli_h_cg/{cp_rs1_fli, cp_fd}, ZfaZvfh_fli_h_cg/{cp_rs1_fli, cp_fd, cp_NaNBox_S_H}, ZfaZfhD_fli_h_cg/cp_NaNBox_D_H

fmaxm-s_fminm-s_op

The FMINM.S and FMAXM.S instructions are defined like the FMIN.S and FMAX.S instructions, except that if either input is NaN, the result is the canonical NaN.

{Zfa_fminm_s_cg, Zfa_fmaxm_s_cg}/{cr_fs1_fs2_edges, cp_csr_fflags_v}

fmaxm-d_fminm-d_op

If the D extension is implemented, FMINM.D and FMAXM.D instructions are analogously defined to operate on double-precision numbers.

{ZfaD_fminm_d_cg, ZfaD_fmaxm_d_cg}/{cr_fs1_fs2_edges_D, cp_csr_fflags_v}

fmaxm-q_fminm-q_op

If the Q extension is implemented, FMINM.Q and FMAXM.Q instructions are analogously defined to operate on quad-precision numbers.

fmaxm-h_fminm-h_op

If the Zfh extension is implemented, FMINM.H and FMAXM.H instructions are analogously defined to operate on half-precision numbers.

{ZfaZfh_fminm_h_cg, ZfaZfh_fmaxm_h_cg}/{cr_fs1_fs2_edges_H, cp_csr_fflags_v}, {ZfaZfhD_fminm_h_cg, ZfaZfhD_fmaxm_h_cg}/{cp_fs1_badNB_D_H, cp_fs2_badNB_D_H}

fround-s_op

The FROUND.S instruction rounds the single-precision floating-point number in floating-point register rs1 to an integer, according to the rounding mode specified in the instruction’s rm field. It then writes that integer, represented as a single-precision floating-point number, to floating-point register rd

Zfa_fround_s_cg/{cp_fs1_edges, cp_frm_2, cp_csr_frm, cp_csr_fflags_v}

fround-s_zero_inf

Zero and infinite inputs are copied to rd unmodified

{Zfa_fround_s_cg, Zfa_froundnx_s_cg}/cp_fs1_edges

fround-s_nan_nv

Signaling NaN inputs cause the invalid operation exception flag to be set; no other exception flags are set

Zfa_fround_s_cg/{cp_fs1_edges, cp_csr_fflags_v}, Zfa_froundnx_s_cg/{cp_fs1_edges, cp_csr_fflags_vn}

froundnx-s_op

The FROUNDNX.S instruction is defined similarly, but it also sets the inexact exception flag if the input differs from the rounded result and is not NaN. FROUNDNX.S is encoded like FCVT.S.D, but with rs2=5.

Zfa_froundnx_s_cg/{cp_fs1_edges, cp_frm_2, cp_csr_frm, cp_csr_fflags_vn}

fround-d_froundnx-d_op

If the D extension is implemented, FROUND.D and FROUNDNX.D instructions are analogously defined to operate on double-precision numbers. They are encoded like FCVT.D.S, but with rs2=4 and 5, respectively,

{ZfaD_fround_d_cg, ZfaD_froundnx_d_cg}/{cp_fs1_edges_D, cp_frm_2}

fround-q_froundnx-q_op

If the Q extension is implemented, FROUND.Q and FROUNDNX.Q instructions are analogously defined to operate on quad-precision numbers. They are encoded like FCVT.Q.S, but with rs2=4 and 5, respectively,

fround-h_froundnx-h_op

If the Zfh extension is implemented, FROUND.H and FROUNDNX.H instructions are analogously defined to operate on half-precision numbers. They are encoded like FCVT.H.S, but with rs2=4 and 5, respectively,

{ZfaZfh_fround_h_cg, ZfaZfh_froundnx_h_cg}/{cp_fs1_edges_H, cp_frm_2}, {ZfaZfhD_fround_h_cg, ZfaZfhD_froundnx_h_cg}/{cp_NaNBox_D_H, cp_fs1_badNB_D_H}

fcvtmod-w-d_op

The FCVTMOD.W.D instruction is defined similarly to the FCVT.W.D instruction, with the following differences. FCVTMOD.W.D always rounds towards zero. Bits 31:0 are taken from the rounded, unbounded two’s complement result, then sign-extended to XLEN bits and written to integer register rd. ±∞ and NaN are converted to zero.

ZfaD_fcvtmod_w_d_cg/{cp_rd, cp_fs1, cp_fs1_edges_D, cp_csr_fflags_vn}

fcvtmod-w-d_flags

Floating-point exception flags are raised the same as they would be for FCVT.W.D with the same input operand.

ZfaD_fcvtmod_w_d_cg/{cp_fs1_edges_D, cp_csr_fflags_vn}

fmvh-x-d_op

For RV32 only, if the D extension is implemented, the FMVH.X.D instruction moves bits 63:32 of floating-point register rs1 into integer register rd. It is encoded in the OP-FP major opcode with funct3=0, rs2=1, and funct7=1110001.

ZfaD_fmvh_x_d_cg/{cp_rd, cp_fs1, cp_fs1_edges_D}

fmvp-d-x_op

For RV32 only, if the D extension is implemented, the FMVP.D.X instruction moves a double-precision number from a pair of integer registers into a floating-point register. Integer registers rs1 and rs2 supply bits 31:0 and 63:32, respectively; the result is written to floating-point register rd. FMVP.D.X is encoded in the OP-FP major opcode with funct3=0 and funct7=1011001.

ZfaD_fmvp_d_x_cg/{cp_rs1_edges, cp_rs2_edges, cp_fd}

fmvh-x-q_op

For RV64 only, if the Q extension is implemented, the FMVH.X.Q instruction moves bits 127:64 of floating-point register rs1 into integer register rd. It is encoded in the OP-FP major opcode with funct3=0, rs2=1, and funct7=1110011.

fmvp-q-x_op

For RV64 only, if the Q extension is implemented, the FMVP.Q.X instruction moves a double-precision number from a pair of integer registers into a floating-point register. Integer registers rs1 and rs2 supply bits 63:0 and 127:64, respectively; the result is written to floating-point register rd. FMVP.Q.X is encoded in the OP-FP major opcode with funct3=0 and funct7=1011011.

fleq-s_fltq-s_op

The FLEQ.S and FLTQ.S instructions are defined like the FLE.S and FLT.S instructions, except that quiet NaN inputs do not cause the invalid operation exception flag to be set.

{Zfa_fleq_s_cg, Zfa_fltq_s_cg}/{cr_fs1_fs2_edges, cp_csr_fflags_v}

fleq-d_fltq-d_op

If the D extension is implemented, FLEQ.D and FLTQ.D instructions are analogously defined to operate on double-precision numbers.

{ZfaD_fleq_d_cg, ZfaD_fltq_d_cg}/{cr_fs1_fs2_edges_D, cp_csr_fflags_v}

fleq-q_fltq-q_op

If the Q extension is implemented, FLEQ.Q and FLTQ.Q instructions are analogously defined to operate on quad-precision numbers.

fleq-h_fltq-h_op

If the Zfh extension is implemented, FLEQ.H and FLTQ.H instructions are analogously defined to operate on half-precision numbers.

{ZfaZfh_fleq_h_cg, ZfaZfh_fltq_h_cg}/{cr_fs1_fs2_edges_H, cp_csr_fflags_v}, {ZfaZfhD_fleq_h_cg, ZfaZfhD_fltq_h_cg}/{cp_fs1_badNB_D_H, cp_fs2_badNB_D_H}

UDB Parameters: None.

Zfbfmin Scalar BF16 Converts
Table 52. Zfbfmin Instruction Coverpoints
Instruction fcvt.bf16.s fcvt.s.bf16 flh fmv.h.x fmv.x.h fsh

RV32

x

x

x

x

x

x

RV64

x

x

x

x

x

x

cp_asm_count

x

x

x

x

x

x

cp_rs1

nx0

x

nx0

cp_rd

x

cp_rs1_edges

x

cp_imm_edges

x

x

cp_fs1

x

x

x

cp_fs2

x

cp_fd

x

x

x

x

cp_fs1_edges

x

BF16

H

cp_fs2_edges

H

cmp_fd_fs1

x

x

cp_frm

2

cp_csr_fflags

voun

v

cp_csr_frm

x

cp_NaNBox

S_H

S_H

S_H

cp_fs1_badNB

S_H

S_H

cp_fs2_badNB

S_H

Table 53. Zfbfmin Normative Rules
Normative Rule Rule Text Coverpoints

fp_nan_boxing

When multiple floating-point precisions are supported, then valid values of narrower n-bit types, n<FLEN, are represented in the lower n bits of an FLEN-bit NaN value, in a process termed NaN-boxing. The upper bits of a valid NaN-boxed value must be all 1s. Valid NaN-boxed n-bit values therefore appear as negative quiet NaNs (qNaNs) when viewed as any wider m-bit value, n < m ≤ FLEN. Any operation that writes a narrower result to an f register must write all 1s to the uppermost FLEN-n bits to yield a legal NaN-boxed value.

{Zfbfmin_fcvt_bf16_s_cg, Zfbfmin_flh_cg, Zfbfmin_fmv_h_x_cg}/cp_NaNBox_S_H

fp_transfer_instrs_narrow_transfer_in

A narrower n-bit transfer, n<FLEN, into the f registers will create a valid NaN-boxed value

{Zfbfmin_flh_cg, Zfbfmin_fmv_h_x_cg}/cp_NaNBox_S_H

fp_transfer_instrs_narrow_transfer_out

A narrower n-bit transfer out of the floating-point registers will transfer the lower n bits of the register ignoring the upper FLEN-n bits

Zfbfmin_fmv_x_h_cg/cp_fs1_badNB_S_H, Zfbfmin_fsh_cg/cp_fs2_badNB_S_H

fp_nontransfer_instrs_improper_nan_boxed_input

Apart from transfer operations described in the previous paragraph, all other floating-point operations on narrower n-bit operations, n<FLEN, check if the input operands are correctly NaN-boxed, i.e., all upper FLEN-n bits are 1. If so, the n least-significant bits of the input are used as the input value, otherwise the input value is treated as an n-bit canonical NaN.

Zfbfmin_fcvt_s_bf16_cg/cp_fs1_badNB_S_H

fsh_flh_op

New 16-bit variants of LOAD-FP and STORE-FP instructions are added, encoded with a new value for the funct3 width field.

{Zfbfmin_flh_cg, Zfbfmin_fsh_cg}/{cp_rs1_nx0, cp_imm_edges}

fmv-x-h_op

FMV.X.H moves the half-precision value in floating-point register rs1 to a representation in the IEEE 754-2008 encoding in integer register rd, filling the upper XLEN-16 bits with copies of the floating-point number’s sign bit

Zfbfmin_fmv_x_h_cg/{cp_rd, cp_fs1, cp_fs1_edges_H}

fmv-h-x_op

FMV.H.X moves the half-precision value encoded in the IEEE 754-2008 encoding from the lower 16 bits of integer register rs1 to the floating-point register rd, NaN-boxing the result.

Zfbfmin_fmv_h_x_cg/{cp_rs1, cp_rs1_edges, cp_fd, cp_NaNBox_S_H}

bf16_subnorm

BF16 computational instructions defined in this chapter support all IEEE 754-2008 features, including all rounding modes, subnormal inputs and outputs, overflow and underflow, and default exception handling. Tininess is detected after rounding.

Zfbfmin_fcvt_bf16_s_cg/{cp_fs1_edges, cp_frm_2, cp_csr_fflags_voun}

bf16_canonical_nan

For BF16, the canonical NaN corresponds to the pattern 0x7fc0.

Zfbfmin_fcvt_bf16_s_cg/cp_fs1_edges

fcvt-bf16-s_op

Narrowing convert FP32 value to a BF16 value. Round according to the RM field.

Zfbfmin_fcvt_bf16_s_cg/{cp_fd, cp_fs1_edges, cp_frm_2, cp_csr_frm}

fcvt-s-bf16_op

Converts a BF16 value to an FP32 value. The conversion is exact.

Zfbfmin_fcvt_s_bf16_cg/{cp_fd, cp_fs1_edges_BF16, cp_csr_fflags_v}

UDB Parameters: None.

A.7.5. ZicsrF Floating-Point CSRs

These test additional CSRs that exist when floating-point is supported. Although these tests, like most privileged tests, are generated from a spreadsheet and manual coverpoints rather than a CSV, they do not assume any privileged capabilities, including the existence of machine mode. Hence they are compatible with RVI20 and simple cores that lack privileged modes.

Note that this suite also tests that the underflow flag is set only if the result is tiny after rounding, per the RISC-V spec.

Table 54. ZicsrF Coverpoints
Coverpoint Goal Feature Description Normative Rule

cp_fcsr_access

Writing to the CSR field
(WARL)

csr read, write all 1s, write all 0s, set all 1s, clear all 1s, write back initial value of each register: fcsr, fflags, frm

fcsr_op_sz_acc
fcsr_rsv

cp_fcsr_frm_write

Writing to the CSR field
(WARL)

Write 0-7 to fcsr.frm and read back fcsr and frm and fflags

fflags_op_sz_acc
frm_op_sz_acc

cp_fcsr_fflags_write

Writing to the CSR field
(WARL)

Write 0-31 to fcsr.fflags and read back fcsr and frm and fflags

fflags_op_sz_acc
frm_op_sz_acc

cp_fcsr_walk

Writing to the CSR field
(WARL)

Write walking 1s to fcsr, frm, fflags

fcsr_op_sz_acc
fcsr_rsv

cp_frm_write

Writing to the CSR field
(WARL)

Write 0-7 to frm and read back fcsr, frm, fflags

fflags_op_sz_acc
frm_op_sz_acc

cp_fflags_write

Writing to the CSR field
(WARL)

write 0-31 to fflags and read back fflags, frm, fcsr

fflags_op_sz_acc
frm_op_sz_acc

csr_fflags_set_m_*

Writing to the CSR field
(WARL)

Reset fflags to 0, then execute following instructions: 1/0 (DivZero), 1/3 (Inexact), largest + largest (overflow), smallest * smallest (underflow), infinity - infinity (invalid)

cp_underflow_after_rounding

Test each of the following floating-point operations does not set the underflow flag, even though it would if underflow were detected before rounding. Note that these test cases are obtained from TestFloat.
fma.s.rdn 3F00FBFF x 80000001 + 807FFFFF = 80800000
fmul.s.rup 00800001 x 3F7FFFFE = 00800000
if D supported:
fma.d.rup 802FFFFFFFBFFEFF x 000FFFFFFFFFFFFE + 0010000000000000 = 0010000000000000
fmul.rdn 0010000000000001 x BFEFFFFFFFFFFFFE = 8010000000000000
fcvt.s.d.rne B80FFFFFFFFDFEFF = 80800000
if Q supported:
fma.q.rdn 3F9800000000000001FFFFFFFF7FFFFE x 00000000000000000000000000000001 + 80010000000000000000000000000000 = 80010000000000000000000000000000
fmul.q.rne 0000FFFFFFFFFFFFFFFFFFFFFFFFFFFF x 3FFF0000000000000000000000000001 = 00010000000000000000000000000000
fcvt.s.q.rup 3F80FFFFFFFE0000000000FFFFFFFFFF = 00800000
If Zfh supported:
fma.h.rne 0BC7 x 03FF + 8400 = 8400
fmul.h.rup 0401 x 3BF8 = 0400
fcvt.h.s.rne 387FF000 = *
Notes:
sqrt, add, sub cannot cause underflow so are not tested
TODO: Adding division underflow tests would be good
No Zfa tests cause underflow

ieee_std_tininess
fcvt_float_rounding
ieee_std_subnormal

These are unprivileged tests that should never trap. Suitable for RVI20 and other systems with no machine mode.

Tests run in M mode with mstatus.FS = 11 if Sm is supported, or else mode is not set

fdiv.h.rne 07FF 4000 = 03FF

Table 55. ZicsrF Normative Rules
Normative Rule Rule Text Coverpoints

fcsr_op_sz_acc

The floating-point CSR, fcsr, is a 32-bit read/write register that selects the dynamic rounding mode for floating-point arithmetic operations and holds the accrued exception flags, as shown in fcsr.

ZicsrF_cg/{cp_fcsr_access, cp_fcsr_walk}, F_fadd_s_cg/cp_csr_frm

fcsr_rsv

Bits 31‍–‍8 of the fcsr are reserved for other standard extensions. If these extensions are not present, implementations shall ignore writes to these bits and supply a zero value when read. Standard software should preserve the contents of these bits.

ZicsrF_cg/{cp_fcsr_walk, cp_fcsr_access}

fflags_op_sz_acc, frm_op_sz_acc

fflags_op_sz_acc: The fflags CSR contains the Accrued Exception Flags field (fcsr bits 4&#8205;&#8211;&#8205;0), zero-extended. frm_op_sz_acc: The frm CSR contains the Rounding Mode field (fcsr bits 7&#8205;&#8211;&#8205;5), zero-extended.

ZicsrF_cg/{cp_fcsr_frm_write, cp_frm_write, cp_fcsr_fflags_write, cp_fflags_write, cp_fcsr_swap}

dyn_round_enc

Rounding Mode|Mnemonic|Meaning === 000|RNE|Round to Nearest, ties to Even¶001|RTZ|Round towards Zero¶010|RDN|Round Down (towards −∞)¶011|RUP|Round Up (towards +∞)¶100|RMM|Round to Nearest, ties to Max Magnitude¶101||Reserved for future use.¶110||Reserved for future use.¶111|DYN|In instruction’s rm field, selects dynamic rounding mode; In Rounding Mode register, reserved. ===

ZicsrF_cg/cp_frm_reserved_static_rm, F_fadd_s_cg/cp_csr_frm

roundingmode_dynamic

Floating-point operations use either a static rounding mode encoded in the instruction, or a dynamic rounding mode held in frm. Rounding modes are encoded as shown in norm:dyn_round_enc. A value of 111 in the instruction’s rm field selects the dynamic rounding mode held in frm

ZicsrF_cg/cp_frm_reserved_static_rm, F_fadd_s_cg/{cp_frm_3, cp_csr_frm}

fcsr_fflags_op

The accrued exception flags indicate the exception conditions that have arisen on any floating-point arithmetic instruction since the field was last reset by software, as shown in norm:fflags_enc

ZicsrF_cg/{cp_fflags_set_m_NV, cp_fflags_set_m_DZ, cp_fflags_set_m_OF, cp_fflags_set_m_UF, cp_fflags_set_m_NX}, F_fdiv_s_cg/cp_csr_fflags_vdoun

ieee_std_subnormal

Operations on subnormal numbers are handled in accordance with IEEE 754-2008.

ZicsrF_cg/cp_underflow_after_rounding_fma_s

ieee_std_tininess

In the parlance of IEEE 754-2008, tininess is detected after rounding.

ZicsrF_cg/{cp_underflow_after_rounding_fma_s, cp_underflow_after_rounding_fmul_s}

UDB Parameters: None.

A.8. Zb* Bit Manipulation Extensions

A.8.1. Zba Bit-Manipulation for Addressing

Table 56. Zba Instruction Coverpoints
Instruction add.uw sh1add sh1add.uw sh2add sh2add.uw sh3add sh3add.uw slli.uw

RV32

x

x

x

RV64

x

x

x

x

x

x

x

x

cp_asm_count

x

x

x

x

x

x

x

x

cp_rs1

x

x

x

x

x

x

x

x

cp_rs2

x

x

x

x

x

x

x

cp_rd

x

x

x

x

x

x

x

x

cp_rs1_edges

x

x

x

x

x

x

x

x

cp_rs2_edges

x

x

x

x

x

x

x

cr_rs1_rs2_edges

x

x

x

x

x

x

x

cmp_rs1_rs2

x

x

x

x

x

x

x

cmp_rd_rs1

x

x

x

x

x

x

x

x

cmp_rd_rs2

x

x

x

x

x

x

x

cmp_rd_rs1_rs2

x

x

x

x

x

x

x

cp_uimm

x

cr_rs1_imm_edges

uimm

Table 57. Zba Normative Rules
Normative Rule Rule Text Coverpoints

Zba_insns_tbl

RV32|RV64|Mnemonic|Instruction === |✓|ADD.UW rd, rs1, rs2|insns-add_uw¶✓|✓|SH1ADD rd, rs1, rs2|insns-sh1add¶|✓|SH1ADD.UW rd, rs1, rs2|insns-sh1add_uw¶✓|✓|SH2ADD rd, rs1, rs2|insns-sh2add¶|✓|SH2ADD.UW rd, rs1, rs2|insns-sh2add_uw¶✓|✓|SH3ADD rd, rs1, rs2|insns-sh3add¶|✓|SH3ADD.UW rd, rs1, rs2|insns-sh3add_uw¶|✓|SLLI.UW rd, rs1, imm|insns-slli_uw ===

{Zba_sh1add_cg, Zba_sh2add_cg, Zba_sh3add_cg, Zba_add_uw_cg}/cp_asm_count

bitmanip_rv32_rv64

The bitmanip extensions are defined for RV32 and RV64.

Zba_sh1add_cg/cr_rs1_rs2_edges

bitmanip_uw_suffix_semantics

Bitmanip instructions with the suffix .UW have one operand that is an unsigned 32-bit value that is extracted from the least-significant 32 bits of the specified register. Other than that, these perform full-XLEN operations.

{Zba_add_uw_cg, Zba_sh1add_uw_cg}/cr_rs1_rs2_edges, Zba_slli_uw_cg/cr_rs1_imm_edges_uimm

slli-uw_op

Operation

Zba_slli_uw_cg/cr_rs1_imm_edges_uimm

sh1add_enc

Encoding

Zba_sh1add_cg/cr_rs1_rs2_edges

sh1add_op

Operation

Zba_sh1add_cg/cr_rs1_rs2_edges

sh1add-uw_enc

Encoding

Zba_sh1add_uw_cg/cr_rs1_rs2_edges

sh1add-uw_op

Operation

Zba_sh1add_uw_cg/cr_rs1_rs2_edges

sh2add_enc

Encoding

Zba_sh2add_cg/cr_rs1_rs2_edges

sh2add_op

Operation

Zba_sh2add_cg/cr_rs1_rs2_edges

sh2add-uw_enc

Encoding

Zba_sh2add_uw_cg/cr_rs1_rs2_edges

sh2add-uw_op

Operation

Zba_sh2add_uw_cg/cr_rs1_rs2_edges

sh3add_enc

Encoding

Zba_sh3add_cg/cr_rs1_rs2_edges

sh3add_op

Operation

Zba_sh3add_cg/cr_rs1_rs2_edges

sh3add-uw_enc

Encoding

Zba_sh3add_uw_cg/cr_rs1_rs2_edges

sh3add-uw_op

Operation

Zba_sh3add_uw_cg/cr_rs1_rs2_edges

add-uw_enc

Encoding

Zba_add_uw_cg/cr_rs1_rs2_edges

add-uw_op

Operation

Zba_add_uw_cg/cr_rs1_rs2_edges

slli-uw_enc

Encoding

Zba_slli_uw_cg/cr_rs1_imm_edges_uimm

UDB Parameters: None.

A.8.2. Zbb Basic Bit-Manipulation

Table 58. Zbb Instruction Coverpoints
Instruction andn clz clzw cpop cpopw ctz ctzw max maxu min minu orc.b

RV32

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

cp_asm_count

x

x

x

x

x

x

x

x

x

x

x

x

cp_rs1

x

x

x

x

x

x

x

x

x

x

x

x

cp_rs2

x

x

x

x

x

cp_rd

x

x

x

x

x

x

x

x

x

x

x

x

cp_rs1_edges

x

walkone

walkonew

walkmask

walkmaskw

walkone

walkonew

x

x

x

x

orcb

cp_rs2_edges

x

x

x

x

x

cr_rs1_rs2_edges

x

x

x

x

x

cmp_rs1_rs2

x

x

x

x

x

cmp_rd_rs1

x

x

x

x

x

x

x

x

x

x

x

x

cmp_rd_rs2

x

x

x

x

x

cmp_rd_rs1_rs2

x

x

x

x

x

Instruction orn rev8 rol rolw ror rori roriw rorw sext.b sext.h xnor zext.h

RV32

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

cp_asm_count

x

x

x

x

x

x

x

x

x

x

x

x

cp_rs1

x

x

x

x

x

x

x

x

x

x

x

x

cp_rs2

x

x

x

x

x

x

cp_rd

x

x

x

x

x

x

x

x

x

x

x

x

cp_rs1_edges

x

x

x

x

x

x

x

x

x

x

x

x

cp_rs2_edges

x

x

x

x

x

x

cr_rs1_rs2_edges

x

x

x

x

x

x

cmp_rs1_rs2

x

x

x

x

x

x

cmp_rd_rs1

x

x

x

x

x

x

x

x

x

x

x

x

cmp_rd_rs2

x

x

x

x

x

x

cmp_rd_rs1_rs2

x

x

x

x

x

x

cp_uimm

x

5

cr_rs1_imm_edges

uimm

uimmw

Table 59. Zbb Normative Rules
Normative Rule Rule Text Coverpoints

bitmanip_w_suffix_semantics

The bitmanip extension follows the convention in RV64 that *W-suffixed instructions (without a dot before the W) ignore the upper 32 bits of their inputs, operate on the least-significant 32 bits as signed values, and produce a 32-bit signed result that is sign-extended to XLEN.

Zbb_clzw_cg/cp_rs1_edges_walkonew, Zbb_cpopw_cg/cp_rs1_edges_walkmaskw, Zbb_rolw_cg/cr_rs1_rs2_edges, Zbb_roriw_cg/cr_rs1_imm_edges_uimmw

bitmanip_bhw_suffix_semantics

Bitmanip instructions with the suffixes .B, .H, and .W only look at the least-significant 8 bits, 16 bits, and 32 bits of the input (respectively) and produce an XLEN-wide result that is sign-extended or zero-extended, based on the specific instruction.

Zbb_orc_b_cg/cp_rs1_edges_orcb, {Zbb_sext_b_cg, Zbb_sext_h_cg}/cp_rs1_edges

B_extension_composition

The B standard extension comprises instructions provided by the Zba, Zbb, and Zbs extensions.

Definition, checked through UDB

Zbb_sign_zero_extension_function

These instructions perform the sign extension or zero extension of the least-significant 8 bits or 16 bits of the source register.

{Zbb_sext_b_cg, Zbb_sext_h_cg, Zbb_zext_h_cg}/cp_rs1_edges

Zbb_rotate_semantics

where the shift-logical instructions shift in zeros, the rotate instructions shift in the bits that were shifted out of the other side of the value.

{Zbb_rol_cg, Zbb_ror_cg}/cr_rs1_rs2_edges, Zbb_rori_cg/cr_rs1_imm_edges_uimm

Zbb_orc-b_semantics

ORC.B sets the bits of each byte in the result rd to all zeros if no bit within the respective byte of rs is set, or to all ones if any bit within the respective byte of rs is set.

Zbb_orc_b_cg/cp_rs1_edges_orcb

andn_enc

Encoding

Zbb_andn_cg/cr_rs1_rs2_edges

andn_op

Operation

Zbb_andn_cg/cr_rs1_rs2_edges

clz_enc

Encoding

Zbb_clz_cg/cp_rs1_edges_walkone

clz_op

Operation

Zbb_clz_cg/cp_rs1_edges_walkone

clzw_enc

Encoding

Zbb_clzw_cg/cp_rs1_edges_walkonew

clzw_op

Operation

Zbb_clzw_cg/cp_rs1_edges_walkonew

cpop_enc

Encoding

Zbb_cpop_cg/cp_rs1_edges_walkmask

cpop_op

Operation

Zbb_cpop_cg/cp_rs1_edges_walkmask

cpopw_enc

Encoding

Zbb_cpopw_cg/cp_rs1_edges_walkmaskw

cpopw_op

Operation

Zbb_cpopw_cg/cp_rs1_edges_walkmaskw

ctz_enc

Encoding

Zbb_ctz_cg/cp_rs1_edges_walkone

ctz_op

Operation

Zbb_ctz_cg/cp_rs1_edges_walkone

ctzw_enc

Encoding

Zbb_ctzw_cg/cp_rs1_edges_walkonew

ctzw_op

Operation

Zbb_ctzw_cg/cp_rs1_edges_walkonew

max_enc

Encoding

Zbb_max_cg/cr_rs1_rs2_edges

max_op

Operation

Zbb_max_cg/cr_rs1_rs2_edges

maxu_enc

Encoding

Zbb_maxu_cg/cr_rs1_rs2_edges

maxu_op

Operation

Zbb_maxu_cg/cr_rs1_rs2_edges

min_enc

Encoding

Zbb_min_cg/cr_rs1_rs2_edges

min_op

Operation

Zbb_min_cg/cr_rs1_rs2_edges

minu_enc

Encoding

Zbb_minu_cg/cr_rs1_rs2_edges

minu_op

Operation

Zbb_minu_cg/cr_rs1_rs2_edges

orc-b_enc

Encoding

Zbb_orc_b_cg/cp_rs1_edges_orcb

orc-b_op

Operation

Zbb_orc_b_cg/cp_rs1_edges_orcb

orn_enc

Encoding

Zbb_orn_cg/cr_rs1_rs2_edges

orn_op

Operation

Zbb_orn_cg/cr_rs1_rs2_edges

rev8_rv32_enc

Encoding (RV32)

Zbb_rev8_cg/cp_rs1_edges

rev8_rv64_enc

Encoding (RV64)

Zbb_rev8_cg/cp_rs1_edges

rev8_op

Operation

Zbb_rev8_cg/cp_rs1_edges

rol_enc

Encoding

Zbb_rol_cg/cr_rs1_rs2_edges

rol_op

Operation

Zbb_rol_cg/cr_rs1_rs2_edges

rolw_enc

Encoding

Zbb_rolw_cg/cr_rs1_rs2_edges

rolw_op

Operation

Zbb_rolw_cg/cr_rs1_rs2_edges

ror_enc

Encoding

Zbb_ror_cg/cr_rs1_rs2_edges

ror_op

Operation

Zbb_ror_cg/cr_rs1_rs2_edges

rori_rv32_enc

Encoding (RV32)

Zbb_rori_cg/cr_rs1_imm_edges_uimm

rori_rv64_enc

Encoding (RV64)

Zbb_rori_cg/cr_rs1_imm_edges_uimm

rori_op

Operation

Zbb_rori_cg/cr_rs1_imm_edges_uimm

roriw_enc

Encoding

Zbb_roriw_cg/cr_rs1_imm_edges_uimmw

roriw_op

Operation

Zbb_roriw_cg/cr_rs1_imm_edges_uimmw

rorw_enc

Encoding

Zbb_rorw_cg/cr_rs1_rs2_edges

rorw_op

Operation

Zbb_rorw_cg/cr_rs1_rs2_edges

sext-b_enc

Encoding

Zbb_sext_b_cg/cp_rs1_edges

sext-b_op

Operation

Zbb_sext_b_cg/cp_rs1_edges

sext-h_enc

Encoding

Zbb_sext_h_cg/cp_rs1_edges

sext-h_op

Operation

Zbb_sext_h_cg/cp_rs1_edges

xnor_enc

Encoding

Zbb_xnor_cg/cr_rs1_rs2_edges

xnor_op

Operation

Zbb_xnor_cg/cr_rs1_rs2_edges

zext-h_rv32_enc

Encoding (RV32)

Zbb_zext_h_cg/cp_rs1_edges

zext-h_rv64_enc

Encoding (RV64)

Zbb_zext_h_cg/cp_rs1_edges

zext-h_op

Operation

Zbb_zext_h_cg/cp_rs1_edges

UDB Parameters: None.

A.8.3. Zbc Carry-less Multiplication

Table 60. Zbc Instruction Coverpoints
Instruction clmul clmulh clmulr

RV32

x

x

x

RV64

x

x

x

cp_asm_count

x

x

x

cp_rs1

x

x

x

cp_rs2

x

x

x

cp_rd

x

x

x

cp_rs1_edges

x

x

x

cp_rs2_edges

x

x

x

cr_rs1_rs2_edges

x

x

x

cmp_rs1_rs2

x

x

x

cmp_rd_rs1

x

x

x

cmp_rd_rs2

x

x

x

cmp_rd_rs1_rs2

x

x

x

Table 61. Zbc Normative Rules
Normative Rule Rule Text Coverpoints

Zbc_clmul_clmulh_results

CLMUL produces the lower half of the carry-less product and CLMULH produces the upper half of the 2×XLEN carry-less product.

Zbc_clmul_cg/cr_rs1_rs2_edges, Zbc_clmulh_cg/cr_rs1_rs2_edges

Zbc_clmulr_results

CLMULR produces bits 2×XLEN−2:XLEN-1 of the 2×XLEN carry-less product.

Zbc_clmulr_cg/cr_rs1_rs2_edges

clmul_enc

Encoding

Zbc_clmul_cg/cr_rs1_rs2_edges

clmul_op

Operation

Zbc_clmul_cg/cr_rs1_rs2_edges

clmulh_enc

Encoding

Zbc_clmulh_cg/cr_rs1_rs2_edges

clmulh_op

Operation

Zbc_clmulh_cg/cr_rs1_rs2_edges

clmulr_enc

Encoding

Zbc_clmulr_cg/cr_rs1_rs2_edges

clmulr_op

Operation

Zbc_clmulr_cg/cr_rs1_rs2_edges

UDB Parameters: None.

A.8.4. Zbs Single-Bit Manipulation

Table 62. Zbs Instruction Coverpoints
Instruction bclr bclri bext bexti binv binvi bset bseti

RV32

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

cp_asm_count

x

x

x

x

x

x

x

x

cp_rs1

x

x

x

x

x

x

x

x

cp_rs2

x

x

x

x

cp_rd

x

x

x

x

x

x

x

x

cp_rs1_edges

x

x

x

x

x

x

x

x

cp_rs2_edges

x

x

x

x

cr_rs1_rs2_edges

x

x

x

x

cmp_rs1_rs2

x

x

x

x

cmp_rd_rs1

x

x

x

x

x

x

x

x

cmp_rd_rs2

x

x

x

x

cmp_rd_rs1_rs2

x

x

x

x

cp_uimm

x

x

x

x

cr_rs1_imm_edges

uimm

uimm

uimm

uimm

Table 63. Zbs Normative Rules
Normative Rule Rule Text Coverpoints

Zbs_single_bit_functionality

The single-bit instructions provide a mechanism to set, clear, invert, or extract a single bit in a register. The bit is specified by its index.

{Zbs_bset_cg, Zbs_bclr_cg, Zbs_binv_cg}/cr_rs1_rs2_edges, Zbs_bexti_cg/cr_rs1_imm_edges_uimm

bclr_enc

Encoding

Zbs_bclr_cg/cr_rs1_rs2_edges

bclr_op

Operation

Zbs_bclr_cg/cr_rs1_rs2_edges

bclri_rv32_enc

Encoding (RV32)

Zbs_bclri_cg/cr_rs1_imm_edges_uimm

bclri_rv64_enc

Encoding (RV64)

Zbs_bclri_cg/cr_rs1_imm_edges_uimm

bclri_op

Operation

Zbs_bclri_cg/cr_rs1_imm_edges_uimm

bext_enc

Encoding

Zbs_bext_cg/cr_rs1_rs2_edges

bext_op

Operation

Zbs_bext_cg/cr_rs1_rs2_edges

bexti_rv32_enc

Encoding (RV32)

Zbs_bexti_cg/cr_rs1_imm_edges_uimm

bexti_rv64_enc

Encoding (RV64)

Zbs_bexti_cg/cr_rs1_imm_edges_uimm

bexti_op

Operation

Zbs_bexti_cg/cr_rs1_imm_edges_uimm

binv_enc

Encoding

Zbs_binv_cg/cr_rs1_rs2_edges

binv_op

Operation

Zbs_binv_cg/cr_rs1_rs2_edges

binvi_rv32_enc

Encoding (RV32)

Zbs_binvi_cg/cr_rs1_imm_edges_uimm

binvi_rv64_enc

Encoding (RV64)

Zbs_binvi_cg/cr_rs1_imm_edges_uimm

binvi_op

Operation

Zbs_binvi_cg/cr_rs1_imm_edges_uimm

bset_enc

Encoding

Zbs_bset_cg/cr_rs1_rs2_edges

bset_op

Operation

Zbs_bset_cg/cr_rs1_rs2_edges

bseti_rv32_enc

Encoding (RV32)

Zbs_bseti_cg/cr_rs1_imm_edges_uimm

bseti_rv64_enc

Encoding (RV64)

Zbs_bseti_cg/cr_rs1_imm_edges_uimm

bseti_op

Operation

Zbs_bseti_cg/cr_rs1_imm_edges_uimm

UDB Parameters: None.

A.8.5. Zbkb Bit-Manipulation for Cryptography

Table 64. Zbkb Instruction Coverpoints
Instruction andn brev8 orn pack packh packw rev8 rol rolw ror rori roriw

RV32

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

cp_asm_count

x

x

x

x

x

x

x

x

x

x

x

x

cp_rs1

x

x

x

x

x

x

x

x

x

x

x

x

cp_rs2

x

x

nx0

x

nx0

x

x

x

cp_rd

x

x

x

x

x

x

x

x

x

x

x

x

cp_rs1_edges

x

x

x

x

x

x

x

x

x

x

x

x

cp_rs2_edges

x

x

x

x

x

x

x

x

cr_rs1_rs2_edges

x

x

x

x

x

x

x

x

cmp_rs1_rs2

x

x

nx0

x

nx0

x

x

x

cmp_rd_rs1

x

x

x

x

x

x

x

x

x

x

cmp_rd_rs2

x

x

nx0

x

nx0

x

x

x

cmp_rd_rs1_rs2

x

x

nx0

x

nx0

x

x

x

cp_uimm

x

5

cr_rs1_imm_edges

uimm

uimmw

Instruction rorw unzip xnor zip

RV32

x

x

x

RV64

x

x

cp_asm_count

x

x

x

x

cp_rs1

x

x

x

x

cp_rs2

x

x

cp_rd

x

x

x

x

cp_rs1_edges

x

x

x

x

cp_rs2_edges

x

x

cr_rs1_rs2_edges

x

x

cmp_rs1_rs2

x

x

cmp_rd_rs1

x

x

x

x

cmp_rd_rs2

x

x

cmp_rd_rs1_rs2

x

x

Table 65. Zbkb Normative Rules
Normative Rule Rule Text Coverpoints

Zbkb_insns_tbl

RV32|RV64|Mnemonic|Instruction === ✓|✓|ROL|insns-rol¶|✓|ROLW|insns-rolw¶✓|✓|ROR|insns-ror¶✓|✓|RORI|insns-rori¶|✓|RORIW|insns-roriw¶|✓|RORW|insns-rorw¶✓|✓|ANDN|insns-andn¶✓|✓|ORN|insns-orn¶✓|✓|XNOR|insns-xnor¶✓|✓|PACK|insns-pack¶✓|✓|PACKH|insns-packh¶|✓|PACKW|insns-packw¶✓|✓|BREV8|insns-brev8¶✓|✓|REV8|insns-rev8¶✓||ZIP|insns-zip¶✓||UNZIP|insns-unzip ===

{Zbkb_rol_cg, Zbkb_andn_cg, Zbkb_pack_cg, Zbkb_brev8_cg}/cp_asm_count

pack_enc

Encoding

Zbkb_pack_cg/cr_rs1_rs2_edges

pack_op

Operation

Zbkb_pack_cg/cr_rs1_rs2_edges

packh_enc

Encoding

Zbkb_packh_cg/cr_rs1_rs2_edges

packh_op

Operation

Zbkb_packh_cg/cr_rs1_rs2_edges

packw_enc

Encoding

Zbkb_packw_cg/cr_rs1_rs2_edges

packw_op

Operation

Zbkb_packw_cg/cr_rs1_rs2_edges

brev8_enc

Encoding

Zbkb_brev8_cg/cp_rs1_edges

brev8_op

Operation

Zbkb_brev8_cg/cp_rs1_edges

unzip_enc

Encoding

Zbkb_unzip_cg/cp_rs1_edges

unzip_op

Operation

Zbkb_unzip_cg/cp_rs1_edges

zip_enc

Encoding

Zbkb_zip_cg/cp_rs1_edges

zip_op

Operation

Zbkb_zip_cg/cp_rs1_edges

UDB Parameters: None.

See also normative rules from Zbb.

A.8.6. Zbkc Carry-less Multiplication for Cryptography

Table 66. Zbkc Instruction Coverpoints
Instruction clmul clmulh

RV32

x

x

RV64

x

x

cp_asm_count

x

x

cp_rs1

x

x

cp_rs2

x

x

cp_rd

x

x

cp_rs1_edges

x

x

cp_rs2_edges

x

x

cr_rs1_rs2_edges

x

x

cmp_rs1_rs2

x

x

cmp_rd_rs1

x

x

cmp_rd_rs2

x

x

cmp_rd_rs1_rs2

x

x

Table 67. Zbkc Normative Rules
Normative Rule Rule Text Coverpoints

Zbkc_insns

This extension is a subset of the Zbc extension, and only provides CLMUL and CLMULH.

{Zbkc_clmul_cg, Zbkc_clmulh_cg}/cr_rs1_rs2_edges

UDB Parameters: None.

See also normative rules from Zbc.

A.8.7. Zbkx Permutation

Table 68. Zbkx Instruction Coverpoints
Instruction xperm4 xperm8

RV32

x

x

RV64

x

x

cp_asm_count

x

x

cp_rs1

x

x

cp_rs2

x

x

cp_rd

x

x

cp_rs1_edges

x

x

cp_rs2_edges

x

x

cr_rs1_rs2_edges

x

x

cmp_rs1_rs2

x

x

cmp_rd_rs1

x

x

cmp_rd_rs2

x

x

cmp_rd_rs1_rs2

x

x

Table 69. Zbkx Normative Rules
Normative Rule Rule Text Coverpoints

Zbkx_lookup_table_model

These instructions implement a lookup table for 4- and 8-bit elements inside the general purpose registers.

{Zbkx_xperm4_cg, Zbkx_xperm8_cg}/cr_rs1_rs2_edges

Zbkx_indexing_behavior

Each element of the result is formed by using the corresponding index element from rs2 to select an element from rs1, or zero if the index element is out of bounds.

{Zbkx_xperm4_cg, Zbkx_xperm8_cg}/cr_rs1_rs2_edges

xperm8_enc

Encoding

Zbkx_xperm8_cg/cr_rs1_rs2_edges

xperm8_op

Operation

Zbkx_xperm8_cg/cr_rs1_rs2_edges

xperm4_enc

Encoding

Zbkx_xperm4_cg/cr_rs1_rs2_edges

xperm4_op

Operation

Zbkx_xperm4_cg/cr_rs1_rs2_edges

UDB Parameters: None.

A.9. Zk* Cryptographic Extensions

A.9.1. Zkne NIST AES Encryption

Table 70. Zkne Instruction Coverpoints
Instruction aes32esi aes32esmi aes64es aes64esm aes64ks1i aes64ks2

RV32

x

x

RV64

x

x

x

x

cp_asm_count

x

x

x

x

x

x

cp_rs1

x

x

x

x

x

x

cp_rs2

x

x

x

x

x

cp_rd

x

x

x

x

x

x

cp_rs1_edges

x

x

x

x

x

x

cp_rs2_edges

x

x

x

x

x

cr_rs1_rs2_edges

x

x

x

x

x

cmp_rs1_rs2

x

x

x

x

x

cmp_rd_rs1

x

x

x

x

x

x

cmp_rd_rs2

x

x

x

x

x

cmp_rd_rs1_rs2

x

x

x

x

x

cp_bs

x

x

cp_rnum

x

cp_sbox

x

x

x

x

rs1

Table 71. Zkne Normative Rules
Normative Rule Rule Text Coverpoints

Zkn_impl_all

A core which implements Zkn must implement all of the above extensions.

Definition, checked through UDB

Zk_impl_all

A core which implements Zk must implement all of the above extensions.

Definition, checked through UDB

Zk_scalar_xreg_op

All instructions described herein use the general-purpose x registers, and obey the 2-read-1-write register access constraint.

{Zkne_aes32esi_cg, Zkne_aes64es_cg}/{cr_rs1_rs2_edges}

aes32esi_enc

Encoding

Zkne_aes32esi_cg/{cr_rs1_rs2_edges}

aes32esi_op

Operation

Zkne_aes32esi_cg/{cr_rs1_rs2_edges, cp_bs, cp_sbox}

aes32esmi_enc

Encoding

Zkne_aes32esmi_cg/{cr_rs1_rs2_edges, cp_bs, cp_sbox}

aes32esmi_op

Operation

Zkne_aes32esmi_cg/{cr_rs1_rs2_edges, cp_bs, cp_sbox}

aes64es_enc

Encoding

Zkne_aes64es_cg/{cr_rs1_rs2_edges, cp_sbox}

aes64es_op

Operation

Zkne_aes64es_cg/{cr_rs1_rs2_edges, cp_sbox}

aes64esm_enc

Encoding

Zkne_aes64esm_cg/{cr_rs1_rs2_edges, cp_sbox}

aes64esm_op

Operation

Zkne_aes64esm_cg/{cr_rs1_rs2_edges, cp_sbox}

aes64ks1i_enc

Encoding

Zkne_aes64ks1i_cg/{cp_rs1_edges, cp_rnum, cp_sbox_rs1}

aes64ks1i_op

Operation

Zkne_aes64ks1i_cg/{cp_rs1_edges, cp_rnum, cp_sbox_rs1}

aes64ks2_enc

Encoding

Zkne_aes64ks2_cg/cr_rs1_rs2_edges

aes64ks2_op

Operation

Zkne_aes64ks2_cg/cr_rs1_rs2_edges

UDB Parameters: None.

A.9.2. Zknd NIST AES Decryption

Table 72. Zknd Instruction Coverpoints
Instruction aes32dsi aes32dsmi aes64ds aes64dsm aes64im aes64ks1i aes64ks2

RV32

x

x

RV64

x

x

x

x

x

cp_asm_count

x

x

x

x

x

x

x

cp_rs1

x

x

x

x

x

x

x

cp_rs2

x

x

x

x

x

cp_rd

x

x

x

x

x

x

x

cp_rs1_edges

x

x

x

x

x

x

x

cp_rs2_edges

x

x

x

x

x

cr_rs1_rs2_edges

x

x

x

x

x

cmp_rs1_rs2

x

x

x

x

x

cmp_rd_rs1

x

x

x

x

x

x

x

cmp_rd_rs2

x

x

x

x

x

cmp_rd_rs1_rs2

x

x

x

x

x

cp_bs

x

x

cp_rnum

x

cp_sbox

x

x

x

x

rs1

Table 73. Zknd Normative Rules
Normative Rule Rule Text Coverpoints

aes32dsi_enc

Encoding

Zknd_aes32dsi_cg/{cr_rs1_rs2_edges, cp_bs, cp_sbox}

aes32dsi_op

Operation

Zknd_aes32dsi_cg/{cr_rs1_rs2_edges, cp_bs, cp_sbox}

aes32dsmi_enc

Encoding

Zknd_aes32dsmi_cg/{cr_rs1_rs2_edges, cp_bs, cp_sbox}

aes32dsmi_op

Operation

Zknd_aes32dsmi_cg/{cr_rs1_rs2_edges, cp_bs, cp_sbox}

aes64ds_enc

Encoding

Zknd_aes64ds_cg/{cr_rs1_rs2_edges, cp_sbox}

aes64ds_op

Operation

Zknd_aes64ds_cg/{cr_rs1_rs2_edges, cp_sbox}

aes64dsm_enc

Encoding

Zknd_aes64dsm_cg/{cr_rs1_rs2_edges, cp_sbox}

aes64dsm_op

Operation

Zknd_aes64dsm_cg/{cr_rs1_rs2_edges, cp_sbox}

aes64im_enc

Encoding

Zknd_aes64im_cg/cp_rs1_edges

aes64im_op

Operation

Zknd_aes64im_cg/cp_rs1_edges

UDB Parameters: None.

A.9.3. Zknh NIST SHA2 Hashing

Table 74. Zknh Instruction Coverpoints
Instruction sha256sig0 sha256sig1 sha256sum0 sha256sum1 sha512sig0 sha512sig0h sha512sig0l sha512sig1 sha512sig1h sha512sig1l sha512sum0 sha512sum0r

RV32

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

cp_asm_count

x

x

x

x

x

x

x

x

x

x

x

x

cp_rs1

x

x

x

x

x

x

x

x

x

x

x

x

cp_rs2

x

x

x

x

x

cp_rd

x

x

x

x

x

x

x

x

x

x

x

x

cp_rs1_edges

x

x

x

x

x

x

x

x

x

x

x

x

cp_rs2_edges

x

x

x

x

x

cr_rs1_rs2_edges

x

x

x

x

x

cmp_rs1_rs2

x

x

x

x

x

cmp_rd_rs1

x

x

x

x

x

x

x

x

x

x

x

x

cmp_rd_rs2

x

x

x

x

x

cmp_rd_rs1_rs2

x

x

x

x

x

Instruction sha512sum1 sha512sum1r

RV32

x

RV64

x

cp_asm_count

x

x

cp_rs1

x

x

cp_rs2

x

cp_rd

x

x

cp_rs1_edges

x

x

cp_rs2_edges

x

cr_rs1_rs2_edges

x

cmp_rs1_rs2

x

cmp_rd_rs1

x

x

cmp_rd_rs2

x

cmp_rd_rs1_rs2

x

Table 75. Zknh Normative Rules
Normative Rule Rule Text Coverpoints

sha256sig0_enc

Encoding

Zknh_sha256sig0_cg/cp_rs1_edges

sha256sig0_op

Operation

Zknh_sha256sig0_cg/cp_rs1_edges

sha256sig1_enc

Encoding

Zknh_sha256sig1_cg/cp_rs1_edges

sha256sig1_op

Operation

Zknh_sha256sig1_cg/cp_rs1_edges

sha256sum0_enc

Encoding

Zknh_sha256sum0_cg/cp_rs1_edges

sha256sum0_op

Operation

Zknh_sha256sum0_cg/cp_rs1_edges

sha256sum1_enc

Encoding

Zknh_sha256sum1_cg/cp_rs1_edges

sha256sum1_op

Operation

Zknh_sha256sum1_cg/cp_rs1_edges

sha512sig0h_enc

Encoding

Zknh_sha512sig0h_cg/cr_rs1_rs2_edges

sha512sig0h_op

Operation

Zknh_sha512sig0h_cg/cr_rs1_rs2_edges

sha512sig0l_enc

Encoding

Zknh_sha512sig0l_cg/cr_rs1_rs2_edges

sha512sig0l_op

Operation

Zknh_sha512sig0l_cg/cr_rs1_rs2_edges

sha512sig1h_enc

Encoding

Zknh_sha512sig1h_cg/cr_rs1_rs2_edges

sha512sig1h_op

Operation

Zknh_sha512sig1h_cg/cr_rs1_rs2_edges

sha512sig1l_enc

Encoding

Zknh_sha512sig1l_cg/cr_rs1_rs2_edges

sha512sig1l_op

Operation

Zknh_sha512sig1l_cg/cr_rs1_rs2_edges

sha512sum0r_enc

Encoding

Zknh_sha512sum0r_cg/cr_rs1_rs2_edges

sha512sum0r_op

Operation

Zknh_sha512sum0r_cg/cr_rs1_rs2_edges

sha512sum1r_enc

Encoding

Zknh_sha512sum1r_cg/cr_rs1_rs2_edges

sha512sum1r_op

Operation

Zknh_sha512sum1r_cg/cr_rs1_rs2_edges

sha512sig0_enc

Encoding

Zknh_sha512sig0_cg/cp_rs1_edges

sha512sig0_op

Operation

Zknh_sha512sig0_cg/cp_rs1_edges

sha512sig1_enc

Encoding

Zknh_sha512sig1_cg/cp_rs1_edges

sha512sig1_op

Operation

Zknh_sha512sig1_cg/cp_rs1_edges

sha512sum0_enc

Encoding

Zknh_sha512sum0_cg/cp_rs1_edges

sha512sum0_op

Operation

Zknh_sha512sum0_cg/cp_rs1_edges

sha512sum1_enc

Encoding

Zknh_sha512sum1_cg/cp_rs1_edges

sha512sum1_op

Operation

Zknh_sha512sum1_cg/cp_rs1_edges

UDB Parameters: None.

A.9.4. Zksed ShangMi SM4 Block Cipher

Table 76. Zksed Instruction Coverpoints
Instruction sm4ed sm4ks

RV32

x

x

RV64

x

x

cp_asm_count

x

x

cp_rs1

x

x

cp_rs2

x

x

cp_rd

x

x

cp_rs1_edges

x

x

cp_rs2_edges

x

x

cr_rs1_rs2_edges

x

x

cmp_rs1_rs2

x

x

cmp_rd_rs1

x

x

cmp_rd_rs2

x

x

cmp_rd_rs1_rs2

x

x

cp_bs

x

x

cp_sbox

x

x

Table 77. Zksed Normative Rules
Normative Rule Rule Text Coverpoints

Zks_impl_all

A core which implements Zks must implement all of the above extensions.

Definition, checked through UDB

sm4ed_enc

Encoding

Zksed_sm4ed_cg/{cr_rs1_rs2_edges, cp_bs, cp_sbox}

sm4ed_op

Operation

Zksed_sm4ed_cg/{cr_rs1_rs2_edges, cp_bs, cp_sbox}

sm4ks_enc

Encoding

Zksed_sm4ks_cg/{cr_rs1_rs2_edges, cp_bs, cp_sbox}

sm4ks_op

Operation

Zksed_sm4ks_cg/{cr_rs1_rs2_edges, cp_bs, cp_sbox}

UDB Parameters: None.

A.9.5. Zksh ShangMi SM3 Hashing

Table 78. Zksh Instruction Coverpoints
Instruction sm3p0 sm3p1

RV32

x

x

RV64

x

x

cp_asm_count

x

x

cp_rs1

x

x

cp_rd

x

x

cp_rs1_edges

x

x

cmp_rd_rs1

x

x

Table 79. Zksh Normative Rules
Normative Rule Rule Text Coverpoints

sm3p0_enc

Encoding

Zksh_sm3p0_cg/{cp_rs1_edges}

sm3p0_op

Operation

Zksh_sm3p0_cg/{cp_rs1_edges}

sm3p1_enc

Encoding

Zksh_sm3p1_cg/{cp_rs1_edges}

sm3p1_op

Operation

Zksh_sm3p1_cg/{cp_rs1_edges}

UDB Parameters: None.

A.9.6. Zkt Constant-Time Instructions

Zkt requires the instructions it lists to have data-independent latency. Latency is not architecturally visible, and measuring it with a cycle counter is unreliable: instruction fetch, branch prediction, superscalar issue, and out-of-order execution make the count depend on where the instruction is and what surrounds it, not only on its operand data. Zkt is therefore out of scope for certification and is not tested (Table 2).

Table 80. Zkt Normative Rules
Normative Rule Rule Text Coverpoints

Zkt_optional_instr

Vendors do not have to implement all of the list’s instructions to be Zkt compliant;

Definition, checked through UDB

Zkt_impl_must_constant_latency

if they claim to have Zkt and implement any of the listed instructions, it must have data-independent latency.

Not tested: microarchitectural timing

UDB Parameters: None.

A.10. Zi* Additional Unpriv Extensions

This section includes a variety of unprivileged extensions.

A.10.1. Zibi Branch with Immediate

The Zibi extension adds the beqi and bnei instructions, which compare an integer register with a small immediate value and conditionally branch.

Table 81. Zibi Instruction Coverpoints
Instruction beqi bnei

RV32

x

x

RV64

x

x

cp_asm_count

x

x

cp_rs1

x

x

cp_rs1_edges

x

x

cr_rs1_imm_edges

5bit_u_n0_offset

5bit_u_n0_offset

cp_offset

x

x

cp_imm_edges

5bit_u_n0

5bit_u_n0

cr_imm_edges_5bit_u_n0_rs1_rel

x

x

Table 82. Zibi Modified Coverpoints
Modified Coverpoint Bins Definition

cp_imm_edges_5bit_u_n0

9

The Zibi comparison constants -1, 1, 2, 3, 4, 8, 16, 30, and 31. The value -1 exercises the all-zero cimm encoding.

cr_rs1_imm_edges_5bit_u_n0_offset

RV32: 216; RV64: 288

Cross-product of rs1 edge values, cp_imm_edges_5bit_u_n0, and positive and negative branch offsets.

cr_imm_edges_5bit_u_n0_rs1_rel

RV32: 27; RV64: 36

Cross-product of cp_imm_edges_5bit_u_n0 with the relation of rs1 to the constant: equal, constant plus 1, constant minus 1, and (RV64 only) same low word with a different upper word.

cp_instr_adr_misaligned_zibi_branch

2

Taken beqi and bnei branches to misaligned instruction addresses.

cp_instr_adr_misaligned_zibi_branch_nottaken

2

Not-taken beqi and bnei branches to misaligned instruction addresses.

The instruction-address-misaligned exception rule uses Zibi-specific tests in Exceptions_Sm, Exceptions_S, and Exceptions_U, which check both taken branches that trap and not-taken branches that do not trap for beqi and bnei.

Table 83. Zibi Normative Rules
Normative Rule Rule Text Coverpoints

zibi_btype_offset

{Zibi_beqi_cg, Zibi_bnei_cg}/{cp_offset, cr_rs1_imm_edges_5bit_u_n0_offset}

zibi_enc

{Zibi_beqi_cg, Zibi_bnei_cg}/cp_asm_count

zibi_cimm_decode

{Zibi_beqi_cg, Zibi_bnei_cg}/{cp_imm_edges_5bit_u_n0, cr_rs1_imm_edges_5bit_u_n0_offset, cr_imm_edges_5bit_u_n0_rs1_rel}

zibi_misaligned_exception

Exceptions_Sm_cg/{cp_instr_adr_misaligned_zibi_branch, cp_instr_adr_misaligned_zibi_branch_nottaken}, Exceptions_S_cg/{cp_instr_adr_misaligned_zibi_branch, cp_instr_adr_misaligned_zibi_branch_nottaken}, Exceptions_U_cg/{cp_instr_adr_misaligned_zibi_branch, cp_instr_adr_misaligned_zibi_branch_nottaken}

zibi_beqi_op

Zibi_beqi_cg/{cp_rs1, cp_rs1_edges, cp_imm_edges_5bit_u_n0, cp_offset, cr_rs1_imm_edges_5bit_u_n0_offset}

zibi_bnei_op

Zibi_bnei_cg/{cp_rs1, cp_rs1_edges, cp_imm_edges_5bit_u_n0, cp_offset, cr_rs1_imm_edges_5bit_u_n0_offset}

UDB Parameters: None.

A.10.2. Zicsr Control/Status Register Instructions

Table 84. Zicsr Instruction Coverpoints
Instruction csrrc csrrci csrrs csrrsi csrrw csrrwi

RV32

x

x

x

x

x

x

RV64

x

x

x

x

x

x

cp_asm_count

x

x

x

x

x

x

cp_rs1

x

x

x

cp_rd

x

x

x

x

x

x

cp_rs1_edges

x

x

x

cmp_rd_rs1

x

x

x

cp_uimm

5

5

5

Table 85. Zicsr Normative Rules
Normative Rule Rule Text Coverpoints

csrrc_op

The CSRRC (Atomic Read and Clear Bits in CSR) instruction reads the value of the CSR, zero-extends the value to XLEN bits, and writes it to integer register rd. The initial value in integer register rs1 is treated as a bit mask that specifies bit positions to be cleared in the CSR. Any bit that is high in rs1 will cause the corresponding bit to be cleared in the CSR, if that CSR bit is writable.

Zicsr_csrrc_cg/{cp_rs1, cp_rd, cp_rs1_edges}

csrrwi_csrrsi_csrrci_ops

The CSRRWI, CSRRSI, and CSRRCI variants are similar to CSRRW, CSRRS, and CSRRC respectively, except they update the CSR using an XLEN-bit value obtained by zero-extending a 5-bit unsigned immediate (uimm[4:0]) field encoded in the rs1 field instead of a value from an integer register. For CSRRSI and CSRRCI, if the uimm[4:0] field is zero, then these instructions will not write to the CSR, and shall not cause any of the side effects that might otherwise occur on a CSR write, nor raise illegal-instruction exceptions on accesses to read-only CSRs. For CSRRWI, if rd=x0, then the instruction shall not read the CSR and shall not cause any of the side effects that might occur on a CSR read. Both CSRRSI and CSRRCI will always read the CSR and cause any read side effects regardless of rd and rs1 fields.

{Zicsr_csrrwi_cg, Zicsr_csrrsi_cg, Zicsr_csrrci_cg}/cp_uimm_5

csrrs_op

The CSRRS (Atomic Read and Set Bits in CSR) instruction reads the value of the CSR, zero-extends the value to XLEN bits, and writes it to integer register rd. The initial value in integer register rs1 is treated as a bit mask that specifies bit positions to be set in the CSR. Any bit that is high in rs1 will cause the corresponding bit to be set in the CSR, if that CSR bit is writable.

Zicsr_csrrs_cg/{cp_rs1, cp_rd, cp_rs1_edges}

csrrw_op

The CSRRW (Atomic Read/Write CSR) instruction atomically swaps values in the CSRs and integer registers. CSRRW reads the old value of the CSR, zero-extends the value to XLEN bits, then writes it to integer register rd. The initial value in rs1 is written to the CSR. If rd=x0, then the instruction shall not read the CSR and shall not cause any of the side effects that might occur on a CSR read.

Zicsr_csrrw_cg/{cp_rs1, cp_rd, cp_rs1_edges}

csrrs_csrrc_rs1_x0

For both CSRRS and CSRRC, if rs1=x0, then the instruction will not write to the CSR at all, and so shall not cause any of the side effects that might otherwise occur on a CSR write, nor raise illegal-instruction exceptions on accesses to read-only CSRs. Both CSRRS and CSRRC always read the addressed CSR and cause any read side effects regardless of rs1 and rd fields. Note that if rs1 specifies a register other than x0, and that register holds a zero value, the instruction will not action any attendant per-field side effects, but will action any side effects caused by writing to the entire CSR.

Zicsr_csrrs_cg/cp_rs1, Zicsr_csrrc_cg/cp_rs1, Zicntr_csrrs_cg/cp_cntr, Zicntr_csrrc_cg/cp_cntr

csrrw_rs1_x0

A CSRRW with rs1=x0 will attempt to write zero to the destination CSR.

Zicsr_csrrw_cg/cp_rs1

csrrsi_csrrci_uimm_zero

For CSRRSI and CSRRCI, if the uimm[4:0] field is zero, then these instructions will not write to the CSR, and shall not cause any of the side effects that might otherwise occur on a CSR write, nor raise illegal-instruction exceptions on accesses to read-only CSRs.

Zicsr_csrrsi_cg/cp_uimm_5, Zicsr_csrrci_cg/cp_uimm_5, TODO: csrrsi and csrrci with uimm=0 on a read-only CSR must not trap

csrrwi_rd_x0

For CSRRWI, if rd=x0, then the instruction shall not read the CSR and shall not cause any of the side effects that might occur on a CSR read.

Zicsr_csrrwi_cg/cp_rd, Skipping the read is not observable: standard CSRs have no read side effects

csr_side_effects

csrsideeffects summarizes the behavior of the CSR instructions with respect to whether they read and/or write the CSR.

Zicsr_csrrw_cg/cp_rd, Zicsr_csrrs_cg/cp_rs1, Zicsr_csrrwi_cg/cp_rd, Zicsr_csrrsi_cg/cp_uimm_5

csr_rs1_uimm_side_effect

CSRRS, CSRRSI, CSRRC, and CSRRCI only action side effects for fields for which the rs1 or uimm argument has at least one bit set corresponding to that field.

Not tested: no standard CSR has side effects on field writes

csr_access_order

In particular, unless specified otherwise, a CSR access is performed after the execution of any prior instructions in program order whose behavior modifies or is modified by the CSR state and before the execution of any subsequent instructions in program order whose behavior modifies or is modified by the CSR state.

ZicsrF_cg/{cp_fflags_set_m_NV, cp_fflags_set_m_NX}, F_fadd_s_cg/cp_csr_frm

csrr_order

an explicit CSR read returns the CSR state before the execution of the instruction

{Zicsr_csrrw_cg, Zicsr_csrrs_cg, Zicsr_csrrc_cg}/cp_rs1_edges, Sm_mcsr_cg/cp_minstret_wraparound

csrw_order

an explicit CSR write suppresses and overrides any implicit writes or modifications to the same CSR by the same instruction.

Sm_mcsr_cg/cp_minstret_wraparound

csr_side_effects_synchronous

Likewise, any side effects from an explicit CSR access are normally observed to occur synchronously in program order. Unless specified otherwise, the full consequences of any such side effects are observable by the very next instruction, and no consequences may be observed out-of-order by preceding instructions.

csr_weakly_ordered

For the RVWMO memory consistency model (memorymodel), CSR accesses are weakly ordered by default, so other harts or devices may observe CSR accesses in an order different from program order.

OUT-OF-SCOPE for single hart

csr_memory_access_ordering

In addition, CSR accesses are not ordered with respect to explicit memory accesses, unless a CSR access modifies the execution behavior of the instruction that performs the explicit memory access or unless a CSR access and an explicit memory access are ordered by either the syntactic dependencies defined by the memory model or the ordering requirements defined in sec:memory-ordering-pmas.

OUT-OF-SCOPE for single hart

csr_fence_ordering

For the purposes of the FENCE instruction, CSR read accesses are classified as device input (I), and CSR write accesses are classified as device output (O).

OUT-OF-SCOPE for single hart

csr_strongly_ordered

The hardware platform may define that accesses to certain CSRs are strongly ordered, as defined in sec:memory-ordering-pmas. Accesses to strongly ordered CSRs have stronger ordering constraints with respect to accesses to both weakly ordered CSRs and accesses to memory-mapped I/O regions.

OUT-OF-SCOPE for single hart

Zicsr_no_read_side_effects

Standard CSRs do not have side effects on reads but may have side effects on writes.

Zicsr_nonexistent_rsv

Instructions that access a non-existent CSR address are reserved.

Ssstrict_Sm_mcsr_cg/{cp_csrr, cp_csrw_edges, cp_csrcs}, Ssstrict_U_ucsr_cg/cp_csrr

Zicsr_debug_range

Machine-mode standard read-write CSRs 0x7A0&#8205;&#8211;&#8205;0x7BF are reserved for use by the debug system. Of these CSRs, 0x7A0&#8205;&#8211;&#8205;0x7AF are accessible to machine mode, whereas

SdtrigSm_trig_module_reg_cg/{cp_csr_access_global, cp_csr_access_local}

Zicsr_wlrl_deterministic

Implementations can return arbitrary bit patterns on the read of a WLRL field when the last write was of an illegal value, but the value returned should deterministically depend on the illegal written value and the value of the field prior to the write.

Not tested: the value read after an illegal WLRL write is implementation-specific

Zicsr_warl_def

Some read/write CSR fields are only defined for a subset of bit encodings, but allow any value to be written while guaranteeing to return a legal value whenever read.

Sm_mcsr_cg/{cp_mcsrwalk, cp_mcsrwalk_masked}, S_scsr_cg/cp_scsrwalk

Zicsr_warl_deterministic

Implementations can return any legal value on the read of a WARL field when the last write was of an illegal value, but the legal value returned should deterministically depend on the illegal written value and the architectural state of the hart.

Not tested: the legal value returned after an illegal WARL write is implementation-specific; CSR walks check only that it is legal

Zicsr_field_modulation

If a write to one CSR changes the set of legal values allowed for a field of a second CSR, then unless specified otherwise, the second CSR’s field immediately gets an UNSPECIFIED value from among its new legal values. This is true even if the field’s value before the write remains legal after the write; the value of the field may be changed in consequence of the write to the controlling CSR.

Not tested: behavior is UNSPECIFIED

Zicsr_field_modulation_no_side_effects

A change to the value of a CSR for this reason is not a write to the affected CSR and thus does not trigger any side effects specified for that CSR.

Zicsr_implicit_read

Unless otherwise specified, the value returned by an implicit read of a CSR is the same value that would have been returned by an explicit read of the CSR, using a CSR-access instruction in a sufficient privilege mode.

F_fadd_s_cg/cp_csr_frm, Sm_mprivinst_cg/cp_mret

Zicsr_width_modulation

If the width of a CSR is changed (for example, by changing SXLEN or UXLEN, as described in xlen-control), the values of the writable fields and bits of the new-width CSR are, unless specified otherwise, determined from the previous-width CSR as though by this algorithm:

Not tested: changing SXLEN or UXLEN is not tested

Zicsr_width_modulation_no_side_effects

Changing the width of a CSR is not a read or write of the CSR and thus does not trigger any side effects.

Not tested: changing SXLEN or UXLEN is not tested

Zicsr_wide_csr_access

If a standard CSR is wider than XLEN bits, then an explicit read of the CSR returns the register’s least-significant XLEN bits, and an explicit write to the CSR modifies only the register’s least-significant XLEN bits, leaving the upper bits unchanged.

Sm_mcsr_cg/{cp_mcycle_wraparound, cp_minstret_wraparound}

Zicsr_high_half_alias

The high-half CSR aliases bits 63:32 of its namesake 64-bit CSR, thus providing a way for RV32 software to read and modify the otherwise-unreachable 32 bits.

Sm_mcsr_cg/{cp_mtimeh_write, cp_mcycleh_wraparound, cp_minstreth_wraparound}

Zicsr_high_half_rv64_rsv

Standard high-half CSRs are accessible only when the base RISC-V instruction set is RV32 (XLEN=32). For RV64 (when XLEN=64), the addresses of all standard high-half CSRs are reserved, so an attempt to access a high-half CSR typically raises an illegal-instruction exception.

Ssstrict_Sm_mcsr_cg/{cp_csrr, cp_csrw_edges, cp_csrcs}

UDB Parameters: None.

=== TRAP_ON_UNIMPLEMENTED_CSR affects the results of Ssstrict/cp_csrr (Table 215). It does not affect Zicsr because this is an unprivileged test that should never perform operations that trap. ===

A.10.3. Zifencei Instruction-Fetch Fence

Table 86. Zifencei Instruction Coverpoints
Instruction fence.i

RV32

x

RV64

x

cp_asm_count

x

cp_custom

fencei

Table 87. Zifencei Normative Rules
Normative Rule Rule Text Coverpoints

fence-i_op

A FENCE.I instruction orders all explicit memory accesses and instruction fetches that precede the FENCE.I in program order before all instruction fetches that follow the FENCE.I in program order.

Zifencei_fence_i_cg/{cp_custom_fencei}

fence-i_rsv

The unused fields in the FENCE.I instruction, funct12, rs1, and rd, are reserved for finer-grain fences in future extensions. For forward compatibility, base implementations shall ignore these fields, and standard software shall zero these fields.

Zifencei_fence_i_cg/{cp_custom_fencei}

UDB Parameters: None.

Table 88. Zifencei Coverpoint Definitions
Coverpoint Bins Definition

cp_custom_fencei

4

Executes normal fence.i and fence.i instructions with nonzero rs1, rd, and funct12 fields to verify that they execute without trapping.

The Zifencei tests must write an instruction to an address, execute fence.i, and then execute the instruction to check that the new instruction is executed.

A.10.4. Zicclsm: Misaligned Loads/Stores

Zicclsm requires misaligned loads and stores to main memory regions with both the coherence and cacheability PMAs to be supported. This applies to both scalar and vector accesses. It does not apply to Za* atomic extensions. It can be handled in hardware or with invisible software emulation.

The misaligned family of tests exercises integer, compressed, and single/double-precision floating-point loads/stores. It uses the cp_misalign and cp_misalign_cross64_{hword/word/double} coverpoints defined in Table 91. Each instruction is tested at byte offsets 0-8 in two 16-byte windows of the scratch area: one at the start of the 256-byte-aligned scratch area, and one starting 56 bytes in, so that misaligned accesses straddle the 64-byte boundary (and hence any 16-, 32- or 64-byte cache line or bus beat) at scratch+64. Each window is filled with 16 distinct bytes before the accesses. Loads are repeated with the bitwise complement of the pattern so that every width and offset is loaded with both a clear and a set sign bit, checking sign and zero extension. Stores check all 16 bytes of the window. It assumes that if these work, then Zfh and Zcb loads/stores will also work correctly. Misaligned atomics are exercised with {ExceptionsZaamo, ExceptionsZalrsc}/{cp_amo/load/store_address_misaligned}. Misaligned vector load/stores are exercised in Section B.9.1.

The rows with Zca, F or D in the ExtraExtensions column apply only when that extension is also supported.

Table 89. Zicclsm Instruction Coverpoints
Instruction ld lh lhu lw lwu sd sh sw c.lw c.lwsp c.ld c.ldsp

RV32

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

ExtraExtensions

Zca

Zca

Zca

Zca

cp_asm_count

x

x

x

x

x

x

x

x

x

x

x

x

cp_misalign

x

x

x

x

x

x

x

x

x

x

x

x

cp_misalign_cross64

double

hword

hword

word

word

double

hword

word

word

word

double

double

Instruction c.sw c.swsp c.sd c.sdsp flw fsw fld fsd

RV32

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

ExtraExtensions

Zca

Zca

Zca

Zca

F

F

D

D

cp_asm_count

x

x

x

x

x

x

x

x

cp_misalign

x

x

x

x

x

x

x

x

cp_misalign_cross64

word

word

double

double

word

word

double

double

Table 90. Zicclsm Normative Rules
Normative Rule Rule Text Coverpoints

Zicclsm_misaligned_support

If the Zicclsm extension is implemented, then misaligned loads and stores to main memory regions with both the coherence and cacheability PMAs must be supported.

{Zicclsm_lw_cg, Zicclsm_sw_cg}/cp_misalign, ZicclsmZca_c_lw_cg/cp_misalign, MisalignV_vle32_v_cg/cp_misalignv_ls_element_misaligned

misaligned_ldst_hw_support

misaligned loads and stores can be handled in hardware, or via an invisible trap into the execution environment implementation, or possibly a combination of hardware and invisible trap depending on address.

{Zicclsm_lw_cg,Zicclsm_sw_cg,Zicclsm_ld_cg,Zicclsm_sd_cg}/{cp_misalign}

misaligned_ldst_eei_dependent_behavior

Loads and stores whose effective address is not naturally aligned to the referenced datatype (i.e., the effective address is not divisible by the size of the access in bytes) have behavior dependent on the EEI.

{Zicclsm_lw_cg,Zicclsm_sw_cg}/{cp_misalign}

misaligned_ldst_exc_type

loads and stores that are not naturally aligned may either complete execution successfully or raise an exception. The exception raised can be either an address-misaligned exception or an access-fault exception. For a memory access that would otherwise be able to complete except for the misalignment, an access-fault exception can be raised instead of an address-misaligned exception if the misaligned access should not be emulated, e.g., if accesses to the memory region have side effects.

{Zicclsm_lw_cg,Zicclsm_sw_cg}/{cp_misalign}

lh_op

LH loads a 16-bit value from memory, then sign-extends to 32-bits before storing in rd.

Zicclsm_lh_cg/{cp_misalign}

lhu_op

LHU loads a 16-bit value from memory but then zero extends to 32-bits before storing in rd.

Zicclsm_lhu_cg/{cp_misalign}

lw_op

The LW instruction loads a 32-bit value from memory into rd.

Zicclsm_lw_cg/{cp_misalign}

sw_sh_sb_op

The SW, SH, and SB instructions store 32-bit, 16-bit, and 8-bit values from the low bits of register rs2 to memory.

Zicclsm_sh_cg/{cp_misalign}, Zicclsm_sw_cg/{cp_misalign}

lwu_op

The LWU instruction, on the other hand, zero-extends the 32-bit value from memory for RV64I.

Zicclsm_lwu_cg/{cp_misalign}

ld_op_rv64i

The LD instruction loads a 64-bit value from memory into register rd for RV64I.

Zicclsm_ld_cg/{cp_misalign}

sd_sw_sh_sb_op_rv64i

The SD, SW, SH, and SB instructions store 64-bit, 32-bit, 16-bit, and 8-bit values from the low bits of register rs2 to memory respectively.

Zicclsm_sd_cg/{cp_misalign}

c-lw_op

C.LW loads a 32-bit value from memory into register rd′. It computes an effective address by adding the zero-extended offset, scaled by 4, to the base address in register rs1′. It expands to LW rd′, offset(rs1′).

ZicclsmZca_c_lw_cg/{cp_misalign}

c-lwsp_op

C.LWSP loads a 32-bit value from memory into register rd. It computes an effective address by adding the zero-extended offset, scaled by 4, to the stack pointer, x2. It expands to LW rd, offset(x2).

ZicclsmZca_c_lwsp_cg/{cp_misalign}

c-ld_op

C.LD is an XLEN=64-only instruction that loads a 64-bit value from memory into register rd′. It computes an effective address by adding the zero-extended offset, scaled by 8, to the base address in register rs1′. It expands to LD rd′, offset(rs1′).

ZicclsmZca_c_ld_cg/{cp_misalign}

c-ldsp_op

C.LDSP is an XLEN=64-only instruction that loads a 64-bit value from memory into register rd. It computes its effective address by adding the zero-extended offset, scaled by 8, to the stack pointer, x2. It expands to LD rd, offset(x2).

ZicclsmZca_c_ldsp_cg/{cp_misalign}

c-sw_op

C.SW stores a 32-bit value in register rs2′ to memory. It computes an effective address by adding the zero-extended offset, scaled by 4, to the base address in register rs1′. It expands to SW rs2′, offset(rs1′).

ZicclsmZca_c_sw_cg/{cp_misalign}

c-swsp_op

C.SWSP stores a 32-bit value in register rs2 to memory. It computes an effective address by adding the zero-extended offset, scaled by 4, to the stack pointer, x2. It expands to SW rs2, offset(x2).

ZicclsmZca_c_swsp_cg/{cp_misalign}

c-sd_op

C.SD is an XLEN=64-only instruction that stores a 64-bit value in register rs2′ to memory. It computes an effective address by adding the zero-extended offset, scaled by 8, to the base address in register rs1′. It expands to SD rs2′, offset(rs1′).

ZicclsmZca_c_sd_cg/{cp_misalign}

c-sdsp_op

C.SDSP is an XLEN=64-only instruction that stores a 64-bit value in register rs2 to memory. It computes an effective address by adding the zero-extended offset, scaled by 8, to the stack pointer, x2. It expands to SD rs2, offset(x2).

ZicclsmZca_c_sdsp_cg/{cp_misalign}

fsw_flw_op

Floating-point loads and stores use the same base+offset addressing mode as the integer base ISAs, with a base address in register rs1 and a 12-bit signed byte offset. The FLW instruction loads a single-precision floating-point value from memory into floating-point register rd. FSW stores a single-precision value from floating-point register rs2 to memory.

ZicclsmF_flw_cg/{cp_misalign}, ZicclsmF_fsw_cg/{cp_misalign}

fp_misaligned

As described in ldst, the execution environment defines whether misaligned floating-point loads and stores are handled invisibly or raise a contained or fatal trap.

{ZicclsmF_flw_cg,ZicclsmF_fsw_cg,ZicclsmD_fld_cg,ZicclsmD_fsd_cg}/{cp_misalign}

fld_op

The FLD instruction loads a double-precision floating-point value from memory into floating-point register rd

ZicclsmD_fld_cg/{cp_misalign}

fsd_op

FSD stores a double-precision value from the floating-point registers to memory

ZicclsmD_fsd_cg/{cp_misalign}

fsq_flq_op

New 128-bit variants of LOAD-FP and STORE-FP instructions are added, encoded with a new value for the funct3 width field.

UDB Parameters: None.

Table 91. Zicclsm Coverpoint Definitions
Modified Coverpoint Bins Definition

cp_misalign

8

All 8 byte offsets within a doubleword: the three least significant bits of the effective address, on both RV32 and RV64.

cp_misalign_cross64_{hword/word/double}

2

Whether a 2-, 4-, or 8-byte access crosses a 64-byte boundary, from effective address bits [5:0].

A.10.5. Ziccif Main Memory Instruction Fetch

The Ziccif suite executes an uncompressed and a compressed instruction from main memory. It is short and largely redundant with the instruction suites; a single hart cannot observe atomicity, so atomicity is not tested.

Ziccif requires main memory regions with the coherence and cacheability PMAs to support instruction fetch, with naturally aligned fetches of up to min(ILEN, XLEN) bits atomic.

These tests run on a single hart, so they cannot check fetch atomicity, which is only observable when another hart or agent modifies the code being fetched concurrently. They show basic functionality of the extension and are largely redundant with the I and Zca suites.

Table 92. Ziccif Coverpoints
Coverpoint Goal Feature Description Expectation Bins Normative Rule

cp_ziccif_fetch

Fetch and execute instructions from main memory

Execute add with three distinct registers from main memory; if Zca is supported, execute c.add

Each instruction executes and writes the sum to rd

2 (1 without Zca)

Ziccif_if_atomicity

Table 93. Ziccif Normative Rules
Normative Rule Rule Text Coverpoints

Ziccif_if_atomicity

If the Ziccif extension is implemented, main memory regions with both the coherence and cacheability PMAs must support instruction fetch, and any instruction fetches of naturally aligned power-of-2 sizes of at most min(ILEN,XLEN) bits are atomic.

Ziccif_cg/cp_ziccif_fetch

Ziccif_fetch_mechanism

An implementation with the Ziccif extension fetches instructions in a manner equivalent to the following state machine.

OUT-OF-SCOPE for single hart

Ziccif_pma_application

Memory protection and executability PMAs are applied only to bytes that are not discarded by this algorithm.

OUT-OF-SCOPE: not observable with ILEN=32

UDB Parameters: None.

A.10.6. Ziccrse Main Memory RsrvEventual

The Ziccrse suite performs one constrained LR/SC sequence on main memory. It is short and largely redundant with the instruction suites; a single hart cannot observe atomicity, so atomicity is not tested.

Ziccrse requires main memory regions with the coherence and cacheability PMAs to support the RsrvEventual PMA, so a constrained LR/SC loop eventually succeeds.

These tests run on a single hart, so they cannot check eventual success in the presence of contending harts or agents. They show basic functionality of the extension and are largely redundant with the Zalrsc suites.

Table 94. Ziccrse Coverpoints
Coverpoint Goal Feature Description Expectation Bins Normative Rule

cp_ziccrse

LR/SC on main memory eventually succeeds

lr.w then sc.w on scratch in a constrained loop, retrying until sc.w succeeds or the retry limit is reached, as in the Zalrsc suite

sc.w succeeds (rd = 0), lr.w returns the stored value, and memory holds the sc.w value

1

Ziccrse_rsrv_eventual
Ziccrse_pma_rsrv_req

Table 95. Ziccrse Normative Rules
Normative Rule Rule Text Coverpoints

Ziccrse_rsrv_eventual

If the Ziccrse extension is implemented, then main memory regions with both the coherence and cacheability PMAs must support the RsrvEventual PMA.

Ziccrse_cg/cp_ziccrse, {Zalrsc_sc_w_cg, Zalrsc_sc_d_cg}/cp_sc_pass_fail

Ziccrse_pma_rsrv_req

The Ziccrse extension requires RsrvEventual support to main memory regions with both the coherence and cacheability PMAs.

Ziccrse_cg/cp_ziccrse, {Zalrsc_sc_w_cg, Zalrsc_sc_d_cg}/cp_sc_pass_fail

UDB Parameters: None.

A.10.7. Ziccamoa Main Memory AMOArithmetic

The Ziccamoa suite performs each supported AMOArithmetic-level AMO on main memory. It is short and largely redundant with the instruction suites; a single hart cannot observe atomicity, so atomicity is not tested.

Ziccamoa requires main memory regions with the coherence and cacheability PMAs to provide AMOArithmetic-level PMA support.

These tests run on a single hart, so they cannot check atomicity, which is only observable when another hart or agent accesses the same memory concurrently. They show basic functionality of the extension and are largely redundant with the Zaamo and Zabha suites.

Table 96. Ziccamoa Coverpoints
Coverpoint Goal Feature Description Expectation Bins Normative Rule

cp_ziccamoa

AMOArithmetic-level AMOs on main memory

For each op in {amoswap, amoadd, amoand, amoor, amoxor, amomin, amomax, amominu, amomaxu}, in .w, .d (RV64) and .b/.h (Zabha) forms, run the AMO once on scratch holding a nonzero pattern with a different source value

The AMO returns the old memory value and leaves the expected result in memory

9 (RV32), 18 (RV64), +18 with Zabha

Ziccamoa_amo_pma
Ziccamoa_pma_amo_req

Table 97. Ziccamoa Normative Rules
Normative Rule Rule Text Coverpoints

Ziccamoa_amo_pma

If the Ziccamoa extension is implemented, then main memory regions with both the coherence and cacheability PMAs must provide AMOArithmetic-level PMA support as defined in sec:amo-pma.

Ziccamoa_cg/cp_ziccamoa, Zaamo_amoswap_w_cg/cp_asm_count, Zaamo_amoand_w_cg/cp_asm_count, Zaamo_amoadd_w_cg/cp_asm_count, Zaamo_amomax_w_cg/cp_asm_count

Ziccamoa_pma_amo_req

The Ziccamoa extension requires AMOArithmetic-level support to main memory regions with both the coherence and cacheability PMAs.

Ziccamoa_cg/cp_ziccamoa, Zaamo_amoswap_w_cg/cp_asm_count, Zaamo_amoand_w_cg/cp_asm_count, Zaamo_amoadd_w_cg/cp_asm_count, Zaamo_amomax_w_cg/cp_asm_count

UDB Parameters: None.

A.10.8. Ziccamoc Main Memory AMOCASQ

The Ziccamoc suite performs each supported AMOCASQ-level AMO on main memory. It is short and largely redundant with the instruction suites; a single hart cannot observe atomicity, so atomicity is not tested.

Ziccamoc requires main memory regions with the coherence and cacheability PMAs to provide AMOCASQ-level PMA support, which includes AMOArithmetic-level support and the compare-and-swap AMOs.

These tests run on a single hart, so they cannot check atomicity, which is only observable when another hart or agent accesses the same memory concurrently. They show basic functionality of the extension and are largely redundant with the Zaamo, Zabha and Zacas suites.

Table 98. Ziccamoc Coverpoints
Coverpoint Goal Feature Description Expectation Bins Normative Rule

cp_ziccamoc

AMOCASQ-level AMOs on main memory

Every AMO of cp_ziccamoa, plus amocas.w, amocas.d, amocas.q (RV64) and amocas.b/amocas.h (Zabha), each run once on scratch, with the compare value equal to memory so the swap happens

The AMO returns the old memory value and leaves the expected result in memory

11 (RV32), 21 (RV64), +20 with Zabha

Ziccamoc_casq_pma
Ziccamoc_pma_amo_req

Table 99. Ziccamoc Normative Rules
Normative Rule Rule Text Coverpoints

Ziccamoc_casq_pma

If the Ziccamoc extension is implemented, then main memory regions with both the coherence and cacheability PMAs must provide AMOCASQ-level PMA support as defined in sec:amo-pma.

Ziccamoc_cg/cp_ziccamoc, Zacas_amocas_w_cg/cp_asm_count, Zacas_amocas_d_cg/cp_asm_count, Zacas_amocas_q_cg/cp_asm_count

Ziccamoc_pma_amo_req

The Ziccamoc extension requires AMOCASQ-level support to main memory regions with both the coherence and cacheability PMAs.

Ziccamoc_cg/cp_ziccamoc, Zacas_amocas_w_cg/cp_asm_count, Zacas_amocas_d_cg/cp_asm_count, Zacas_amocas_q_cg/cp_asm_count

UDB Parameters: None.

A.10.9. Zicond Conditional Instructions

Table 100. Zicond Instruction Coverpoints
Instruction czero.eqz czero.nez

RV32

x

x

RV64

x

x

cp_asm_count

x

x

cp_rs1

x

x

cp_rs2

x

x

cp_rd

x

x

cp_rs1_edges

x

x

cp_rs2_edges

x

x

cr_rs1_rs2_edges

x

x

cmp_rs1_rs2

x

x

cmp_rd_rs1

x

x

cmp_rd_rs2

x

x

cmp_rd_rs1_rs2

x

x

Table 101. Zicond Normative Rules
Normative Rule Rule Text Coverpoints

czero-eqz_op

If rs2 contains the value zero, this instruction writes the value zero to rd. Otherwise, this instruction copies the contents of rs1 to rd.

Zicond_czero_eqz_cg/{cp_rs1, cp_rs2, cp_rd, cr_rs1_rs2_edges}

czero-eqz_inst_ctime

Furthermore, if the Zkt extension is implemented, this instruction’s timing is independent of the data values in rs1 and rs2.

Not tested: microarchitectural timing

czero-nez_op

If rs2 contains a nonzero value, this instruction writes the value zero to rd. Otherwise, this instruction copies the contents of rs1 to rd.

Zicond_czero_nez_cg/{cp_rs1, cp_rs2, cp_rd, cr_rs1_rs2_edges}

czero-nez_Zkt_timing

Furthermore, if the Zkt extension is implemented, this instruction’s timing is independent of the data values in rs1 and rs2.

Not tested: microarchitectural timing

UDB Parameters: None.

A.10.10. Zicntr Counters

Zicntr provides unprivileged read access to the cycle, time, and instret counters. Note that, like all other unprivileged tests, these tests are performed in M-mode. The Zicntr groups of the S and U privileged tests exercise reading the counters in S-mode and U-mode, with control by mcounteren and scounteren CSRs. The Sm privileged tests exercise mcycle, minstret, and HPMs from M-mode.

Table 102. Zicntr Instruction Coverpoints
Instruction csrrs csrrc

RV32

x

x

RV64

x

x

cp_cntr

x

x

Table 103. Zicntr Normative Rules
Normative Rule Rule Text Coverpoints

Zihpm_op_sz_mode_acc_count

RISC-V ISAs provide a set of up to thirty-two 64-bit performance counters and timers

Zicntr_csrrs_cg/{cp_cntr}

Zihpm_op_sz_mode_acc_xlen32

when XLEN=32, the upper 32 bits are accessed via CSR registers 0xC80–0xC9F

Zicntr_csrrs_cg/{cp_cntr}

Zihpm_op_sz_mode_acc_partition

These counters are divided between the Zicntr and Zihpm extensions.

Zicntr_csrrs_cg/{cp_cntr}

Zihpm_op_sz_mode_acc_priv

accessible via unprivileged XLEN-bit read-only CSR registers 0xC00–0xC1F

Zicntr_csrrs_cg/{cp_cntr}, U_Zicntr_cg/cp_mcounteren_access_u, Sm_Zicntr_cg/cp_mcounteren_access_m

Zicntr_rdcycle_op

The RDCYCLE pseudoinstruction reads the low XLEN bits of the cycle CSR which holds a count of the number of clock cycles executed by the processor core on which the hart is running from an arbitrary start time in the past.

Zicntr_csrrs_cg/{cp_cntr}

Zicntr_rdcycleh_op

RDCYCLEH is only present when XLEN=32 and reads bits 63-32 of the same cycle counter.

Zicntr_csrrs_cg/{cp_cntr}

Zicntr_rdtime_op

The RDTIME pseudoinstruction reads the low XLEN bits of the time CSR, which counts wall-clock real time that has passed from an arbitrary start time in the past.

Zicntr_csrrs_cg/{cp_cntr}

Zicntr_rdtimeh_op

RDTIMEH is only present when XLEN=32 and reads bits 63-32 of the same real-time counter.

Zicntr_csrrs_cg/{cp_cntr}

Zicntr_rdinstret_op

The RDINSTRET pseudoinstruction reads the low XLEN bits of the instret CSR, which counts the number of instructions retired by this hart from some arbitrary start point in the past.

Zicntr_csrrs_cg/{cp_cntr}, U_Zicntr_cg/cp_instret_add, S_Zicntr_cg/cp_instret_add

Zicntr_rdinstreth_op

RDINSTRETH is only present when XLEN=32 and reads bits 63-32 of the same instruction counter.

Zicntr_csrrs_cg/{cp_cntr}

Zicntr_time_hart_sync

The real-time clocks of all harts must be synchronized to within one tick of the real-time clock.

OUT-OF-SCOPE for single hart

Table 104. Zicntr UDB Parameters
Parameter Description Coverpoint Effect

TIME_CSR_IMPLEMENTED

Whether or not a real hardware time CSR exists. Implementations can either provide a real CSR or emulate access at M-mode.

Possible values:

true:: time/timeh exists, and accessing it will not cause an IllegalInstruction trap

false:: time/timeh does not exist. Accessing the CSR will cause an IllegalInstruction trap or enter an unpredictable state, depending on TRAP_ON_UNIMPLEMENTED_CSR. Privileged software may emulate the time CSR, or may pass the exception to a lower level.

cp_cntr

If False, time and timeh reads trap to M-mode, which emulates them from mtime

MCOUNTENABLE_EN

Indicates which counters can be delegated via mcounteren.

MCOUNTENABLE_EN[n] controls whether mcounteren.HPM<n> is writable. It does not depend on whether hpmcounter<n>/mhpmcounter<n> is read-only zero.

MCOUNTENABLE_EN[0:2] must all be false if Zicntr is not implemented. MCOUNTENABLE_EN[3:31] must all be false if Zihpm is not implemented.

cp_cntr

With U-mode, skip each of cycle, time, and instret (and their high halves) whose bit is False

SCOUNTENABLE_EN

Indicates which counters can delegated via scounteren

SCOUNTENABLE_EN[n] controls whether scounteren.HPM<n> is writable. It does not depend on whether hpmcounter<n>/mhpmcounter<n> is read-only zero.

SCOUNTENABLE_EN[0:2] must all be false if Zicntr is not implemented. SCOUNTENABLE_EN[3:31] must all be false if Zihpm is not implemented.

cp_cntr

With S-mode, skip each of cycle, time, and instret (and their high halves) whose bit is False

TODO: add normative rule for TIME_CSR_IMPLEMENTED UDB parameter referencing the following text from the priv spec:

` emulate this functionality on behalf of less-privileged modes in M-mode software. ` This rule is checked by the time bin of cp_cntr coverpoint.

Table 105. Zicntr Coverpoint Definition
Coverpoint Bins Definition

cp_cntr

3

Read each of the counters (cycle, time, instret) twice using csrrs rd, csr, x0 and check that the difference is exactly right for instret, or at least 1 for cycle, 0 for time (time may not increment between reads). For RV32, also check cycleh, timeh, instreth with the same definitions. Skip time and timeh if parameter TIME_CSR_IMPLEMENTED = False.

A.10.11. Zihpm Hardware Performance Monitors

Zihpm provides unprivileged read access to custom hardware performance monitor CSRs.

Table 106. Zihpm Instruction Coverpoints
Instruction csrrs csrrc

RV32

x

x

RV64

x

x

cp_cntr

hpm

hpm

Table 107. Zihpm Normative Rules
Normative Rule Rule Text Coverpoints

Zihpm_op_sz_mode_acc_count

RISC-V ISAs provide a set of up to thirty-two 64-bit performance counters and timers

Zihpm_csrrs_cg/{cp_cntr_hpm}

Zihpm_op_sz_mode_acc_partition

These counters are divided between the Zicntr and Zihpm extensions.

Zihpm_csrrs_cg/{cp_cntr_hpm}

Zihpm_op_sz_mode_acc_priv

accessible via unprivileged XLEN-bit read-only CSR registers 0xC00–0xC1F

Zihpm_csrrs_cg/{cp_cntr_hpm}

Zihpm_op_sz_mode_acc_xlen32

when XLEN=32, the upper 32 bits are accessed via CSR registers 0xC80–0xC9F

Zihpm_csrrs_cg/{cp_cntr_hpm}

hpmcounter_op_sz_mode

The Zihpm extension comprises up to 29 additional unprivileged 64-bit hardware performance counters, hpmcounter3-hpmcounter31.

Zihpm_csrrs_cg/{cp_cntr_hpm}

hpm_counter_op_sz_mode_xlen32

When XLEN=32, the upper 32 bits of these performance counters are accessible via additional CSRs hpmcounter3h-hpmcounter31h.

Zihpm_csrrs_cg/cp_cntr_hpm/{hpmcounter3h, hpmcounter4h, hpmcounter5h, hpmcounter6h, hpmcounter7h, hpmcounter8h, hpmcounter9h, hpmcounter10h, hpmcounter11h, hpmcounter12h, hpmcounter13h, hpmcounter14h, hpmcounter15h, hpmcounter16h, hpmcounter17h, hpmcounter18h, hpmcounter19h, hpmcounter20h, hpmcounter21h, hpmcounter22h, hpmcounter23h, hpmcounter24h, hpmcounter25h, hpmcounter26h, hpmcounter27h, hpmcounter28h, hpmcounter29h, hpmcounter30h, hpmcounter31h}

hpm_counter_op_sz_mode_dependency

The Zihpm extension depends on the Zicsr extension.

Not tested: extension dependency checked by the UDB configuration

hpm_platform_specific_impl

The implemented number and width of these additional counters, and the set of events they count, are platform-specific.

Not tested: platform-specific. The implemented counters come from HPM_COUNTER_EN, and events are not tested.

hpm_misconfigured_event_behavior

If the configuration used to select the events counted by a counter is misconfigured, the counter may return a constant value.

Not tested: event selection is platform-specific, so there is no portable misconfiguration to test.

hpm_unimplemented_counter_access

Accessing an unimplemented counter may cause an illegal-instruction exception or may return a constant value.

Not tested: implementation-defined behavior; an unimplemented counter may trap or return a constant value, so neither response can be required. cp_cntr_hpm reads only the counters HPM_COUNTER_EN implements.

Table 108. Zihpm UDB Parameters
Parameter Description Coverpoint Effect

HPM_COUNTER_EN

Whether each HPM counter is implemented in hardware.

HPM_COUNTER_EN[n] being false means hpmcounter<n>/mhpmcounter<n> and the corresponding mhpmevent<n> are not implemented and are hardwired read-only zero. (It does not mean the counter is implemented but currently stopped from counting; that is a separate, run-time concept controlled by mcountinhibit.)

There is one entry for each hpmcounter, indexed 0-31.

Indices 0-2 must be false: they are placeholders for the three counters (cycle/mcycle (CY), time ™, and instret/minstret (IR)) whose implementation this parameter does not control. These counters are associated with indexes 0, 1, and 2. The rest of the HPM counters logically follow at indexes 3-31. Index 3 in HPM_COUNTER_EN corresponds to mhpmcounter3. Index 31 in HPM_COUNTER_EN corresponds to mhpmcounter31.

cp_cntr_hpm

Reads only hpmcounter<n> (and hpmcounter<n>h on RV32) with HPM_COUNTER_EN[n] true

MCOUNTENABLE_EN

Indicates which counters can be delegated via mcounteren.

MCOUNTENABLE_EN[n] controls whether mcounteren.HPM<n> is writable. It does not depend on whether hpmcounter<n>/mhpmcounter<n> is read-only zero.

MCOUNTENABLE_EN[0:2] must all be false if Zicntr is not implemented. MCOUNTENABLE_EN[3:31] must all be false if Zihpm is not implemented.

cp_cntr_hpm

With U-mode, skip each hpmcounter<n> (and hpmcounter<n>h on RV32) whose bit n is False

SCOUNTENABLE_EN

Indicates which counters can delegated via scounteren

SCOUNTENABLE_EN[n] controls whether scounteren.HPM<n> is writable. It does not depend on whether hpmcounter<n>/mhpmcounter<n> is read-only zero.

SCOUNTENABLE_EN[0:2] must all be false if Zicntr is not implemented. SCOUNTENABLE_EN[3:31] must all be false if Zihpm is not implemented.

cp_cntr_hpm

With S-mode, skip each hpmcounter<n> (and hpmcounter<n>h on RV32) whose bit n is False

Table 109. Zihpm Coverpoint Definition
Coverpoint Bins Definition

cp_cntr_hpm

up to 29 (58 on RV32)

Read each implemented hpmcounter<n> twice using csrrs rd, csr, x0 (and csrrc) and check that the difference is non-negative. For RV32, also read hpmcounter<n>h and check that the difference is exactly 0. There is one bin per counter with HPM_COUNTER_EN[n] = True; other counters are not read. The boot code writes mhpmevent<n> = 0 (no event), so the counters are frozen and this is an accessibility check: each read must not trap and the value must be stable.

Accessing an unimplemented counter may trap or return a constant value, so those counters are not read. The suite assumes that mcounteren and scounteren allow reads of the implemented counters from U-mode (the boot code sets every bit). See RISC-V ISA Manual Issue #2558 for discussion.

MCOUNTENABLE_EN, SCOUNTENABLE_EN and HCOUNTENABLE_EN are exercised by the Sm_Zicntr, S_Zicntr, U_Zicntr and H_Zicntr cp_mcounteren_access_*, cp_scounteren_access_* and cp_hcounteren_access_* coverpoints (Table 169). COUNTINHIBIT_EN is exercised by the Sm cp_inhibit_* coverpoints (Table 166).

A.10.12. Zihintpause Pause Hint

Table 110. Zihintpause Instruction Coverpoints
Instruction pause

RV32

x

RV64

x

cp_asm_count

x

Table 111. Zihintpause Normative Rules
Normative Rule Rule Text Coverpoints

pause_op

The PAUSE instruction is a HINT that indicates the current hart’s rate of instruction retirement should be temporarily reduced or paused. The duration of its effect must be bounded and may be zero.

Zihintpause_pause_cg/cp_asm_count

pause_enc_fence

PAUSE is encoded as a FENCE instruction with pred=W, succ=0, fm=0, rd=x0, and rs1=x0.

Zihintpause_pause_cg/cp_asm_count

pause_enc

PAUSE

Zihintpause_pause_cg/cp_asm_count

UDB Parameters: None.

A.10.13. Zihintntl Non-temporal Locality Hint

These instructions are hints that behave as nops. They are simply executed once. The rows of Table 112 with Zca in the ExtraExtensions column are the compressed instructions c.ntl.p1, c.ntl.pall, c.ntl.s1, and c.ntl.all, a subset of the c.add hints, and apply only when Zca is also supported.

Table 112. Zihintntl Instruction Coverpoints
Instruction ntl.p1 ntl.s1 ntl.pall ntl.all c.ntl.p1 c.ntl.s1 c.ntl.pall c.ntl.all

RV32

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

ExtraExtensions

Zca

Zca

Zca

Zca

cp_asm_count

x

x

x

x

x

x

x

x

Table 113. Zihintntl Normative Rules
Normative Rule Rule Text Coverpoints

ntl-p1_op

The NTL.P1 instruction indicates that the target instruction does not exhibit temporal locality within the capacity of the innermost level of private cache in the memory hierarchy.

Zihintntl_ntl_p1_cg/cp_asm_count

ntl-p1_enc

NTL.P1 is encoded as ADD x0, x0, x2.

Zihintntl_ntl_p1_cg/cp_asm_count

ntl-all_op

The NTL.ALL instruction indicates that the target instruction does not exhibit temporal locality within the capacity of any level of cache in the memory hierarchy.

Zihintntl_ntl_all_cg/cp_asm_count

ntl-all_enc

NTL.ALL is encoded as ADD x0, x0, x5.

Zihintntl_ntl_all_cg/cp_asm_count

ntl-pall_op

The NTL.PALL instruction indicates that the target instruction does not exhibit temporal locality within the capacity of any level of private cache in the memory hierarchy.

Zihintntl_ntl_pall_cg/cp_asm_count

ntl-pall_enc

NTL.PALL is encoded as ADD x0, x0, x3.

Zihintntl_ntl_pall_cg/cp_asm_count

ntl-s1_op

The NTL.S1 instruction indicates that the target instruction does not exhibit temporal locality within the capacity of the innermost level of shared cache in the memory hierarchy.

Zihintntl_ntl_s1_cg/cp_asm_count

ntl-s1_enc

NTL.S1 is encoded as ADD x0, x0, x4.

Zihintntl_ntl_s1_cg/cp_asm_count

ntl_compressed_variants

If the C or Zca extension is provided, compressed variants of these HINTs are also provided: C.NTL.P1 is encoded as C.ADD x0, x2; C.NTL.PALL is encoded as C.ADD x0, x3; C.NTL.S1 is encoded as C.ADD x0, x4; and C.NTL.ALL is encoded as C.ADD x0, x5.

{ZihintntlZca_c_ntl_p1_cg, ZihintntlZca_c_ntl_pall_cg, ZihintntlZca_c_ntl_s1_cg, ZihintntlZca_c_ntl_all_cg}/cp_asm_count

ntl_target_definition

The NTL instructions do not change architectural state, nor do they alter the architecturally visible effects of the target instruction.

{Zihintntl_ntl_p1_cg, Zihintntl_ntl_pall_cg, Zihintntl_ntl_s1_cg, Zihintntl_ntl_all_cg}/cp_asm_count

ntl_range

The NTL instructions affect all memory-access instructions except the cache-management instructions in the Zicbom extension.

Not tested: no architecturally visible effect

ntl_Zicbop_prefetch_outer

When an NTL instruction is applied to a prefetch hint in the Zicbop extension, it indicates that a cache line should be prefetched into a cache that is outer from the level specified by the NTL.

Not tested: no architecturally visible effect

ntl_trap_behavior

In the event that a trap is taken on the target instruction, implementations are discouraged from applying the NTL to the first instruction in the trap handler. Instead, implementations are recommended to ignore the HINT in this case.

Not tested: recommendation with no architecturally visible effect

UDB Parameters: None.

A.10.14. Zicboz Cache Block Zero

The cbo.zero instruction zeros a cache line. The cache line size may vary from one machine to another.

Table 114. Zicbo Coverpoint Definition
Coverpoint Bins Definition

cp_custom_cbo

65*2

Writes 65 words (260 bytes) of arbitrary data to scratch memory, executes cbo instruction at the aligned start of scratch, and then reads back all 260 bytes and stores them to the signature. The first cache line (often 64 bytes) of data should be zeroed and the rest unchanged. It repeats this operation with an offset of 255 bytes. The instruction ignores the offset within a cache line, so for 64-byte lines, this would zero bytes 192-255 and leave the others unchanged.

Table 115. Zicboz Instruction Coverpoints
Instruction cbo.zero

RV32

x

RV64

x

cp_asm_count

x

cp_rs1

nx0

cp_custom

cbo

Table 116. Zicboz Normative Rules
Normative Rule Rule Text Coverpoints

cache_block_size

The capacity and organization of a cache and the size of a cache block are both implementation-specific, and

Zicboz_cbo_zero_cg/cp_custom_cbo

cache_block_discovery

the execution environment provides software a means to discover information about the caches and cache blocks in a system.

Definition, checked through UDB

cache_block_size_uniform

In the initial set of CMO extensions, the size of a cache block shall be uniform throughout the system.

Definition, checked through UDB

cbo-zero_op

A CBO.ZERO instruction performs stores of zeros to the full set of bytes corresponding to the cache block that contains the address specified in rs1.

Zicboz_cbo_zero_cg/cp_custom_cbo

cbo-zero_unaligned

It is not required that rs1 is aligned to the size of a cache block.

Zicboz_cbo_zero_cg/cp_custom_cbo, Zic64b_cg/cp_zic64b

cbo-zero_specified_block

These instructions operate on the cache block, or the memory locations corresponding to the cache block, whose effective address is specified in rs1.

Zicboz_cbo_zero_cg/cp_custom_cbo

UDB Parameters: None.

A.10.15. Zicbom Cache Block Flush/Invalidate

Zicbom runs the same tests as Zicboz. cbo.flush and cbo.clean should have no architecturally visible effect. cbo.inval could discard the cache block, leaving the initial value of 0s. This may be difficult to match against a reference model, so perhaps this test needs to accept both the original data and 0s as correct answers. TODO - adjust if any machines need this.

Table 117. Zicbom Instruction Coverpoints
Instruction cbo.inval cbo.clean cbo.flush

RV32

x

x

x

RV64

x

x

x

cp_asm_count

x

x

x

cp_rs1

nx0

nx0

nx0

cp_custom

cbo

cbo

cbo

Table 118. Zicbom Normative Rules
Normative Rule Rule Text Coverpoints

ppo_overlap_1

if a precedes b in program order, then a will precede b in the global memory order if:

Not testable on a single core without DMA or other non-coherent agents

ppo_overlap_2

a is an invalidate, clean, or flush, b is a load, and a and b access overlapping memory addresses

Not testable on a single core without DMA or other non-coherent agents

invalidate_load_val_no_preceding_cmo

If no clean or flush operations on x precede i in the global memory order, either the initial value of x or the value of any store to x that precedes i

Not testable on a single core without DMA or other non-coherent agents

invalidate_load_val_no_store_before_cmo

If no store to x precedes a clean or flush operation on x in the global memory order and if the clean or flush operation on x precedes i in the global memory order, either the initial value of x or the value of any store to x that precedes i

Not testable on a single core without DMA or other non-coherent agents

invalidate_load_val_store_before_cmo

If a store to x precedes a clean or flush operation on x in the global memory order and if the clean or flush operation on x precedes i in the global memory order, either the value of the latest store to x that precedes the latest clean or flush operation on x or the value of any store to x that both precedes i and succeeds the latest clean or flush operation on x that precedes i

Not testable on a single core without DMA or other non-coherent agents

invalidate_load_val_noncoherent_store

The value of any store to x by a non-coherent agent regardless of the above conditions

Not testable on a single core without DMA or other non-coherent agents

pmp_same

The PMP access control bits shall be the same for all physical addresses in the cache block, and if write permission is granted by the PMP access control bits, read permission shall also be granted

Not tested: behavior is UNSPECIFIED

pma_same

The PMAs shall be the same for all physical addresses in the cache block, and if write permission is granted by the supported access type PMAs, read permission shall also be granted

Not tested: behavior is UNSPECIFIED

cbo_rsv

If the above constraints are not met, the behavior of a CBO instruction is UNSPECIFIED.

Not tested: behavior is UNSPECIFIED

H_trans_cache

For a standard cache-block management instruction (CBO.CLEAN, CBO.FLUSH, or CBO.INVAL) or cache-block zero instruction (CBO.ZERO), the transformed instruction has the format shown in transformedcboinst. The operation field corresponds to the 12 most significant bits of the trapping instruction.

TODO: Hypervisor tests

cbo-clean_op

A CBO.CLEAN instruction performs a clean operation on the cache block whose effective address is the base address specified in rs1.

Zicbom_cbo_clean_cg/cp_custom_cbo

cbo-flush_op

A CBO.FLUSH instruction performs a flush operation on the cache block that contains the address specified in rs1.

Zicbom_cbo_flush_cg/cp_custom_cbo

cbo-flush_unaligned

It is not required that rs1 is aligned to the size of a cache block.

Zicbom_cbo_flush_cg/cp_custom_cbo

cbo-inval_op

A CBO.INVAL instruction performs an invalidate operation on the cache block that contains the address specified in rs1.

Zicbom_cbo_inval_cg/cp_custom_cbo

cbo-inval_unaligned

It is not required that rs1 is aligned to the size of a cache block.

Zicbom_cbo_inval_cg/cp_custom_cbo

UDB Parameters: None.

A.10.16. Zicbop Cache Block Prefetch

The Zicbop prefetch instructions are hints that do not have to do anything. They are tested by being executed with a variety of rs1 values and offsets to ensure that they are decoded and executed without trapping, but no specific behavior is required or checked except that the 65 words written to scratch are still read back correctly.

Table 119. Zicbop Instruction Coverpoints
Instruction prefetch.i prefetch.r prefetch.w

RV32

x

x

x

RV64

x

x

x

cp_asm_count

x

x

x

cp_rs1

x

x

x

cp_custom

prefetch

prefetch

prefetch

Table 120. Zicbop Normative Rules
Normative Rule Rule Text Coverpoints

prefetch-i_op

A PREFETCH.I instruction indicates to hardware that the cache block whose effective address is the sum of the base address specified in rs1 and the sign-extended offset encoded in imm[11:0], where imm[4:0] equals 0b00000, is likely to be accessed by an instruction fetch in the near future.

Zicbop_prefetch_i_cg/cp_custom_prefetch

prefetch-r_op

A PREFETCH.R instruction indicates to hardware that the cache block whose effective address is the sum of the base address specified in rs1 and the sign-extended offset encoded in imm[11:0], where imm[4:0] equals 0b00000, is likely to be accessed by a data read (i.e. load) in the near future.

Zicbop_prefetch_r_cg/cp_custom_prefetch

prefetch-w_op

A PREFETCH.W instruction indicates to hardware that the cache block whose effective address is the sum of the base address specified in rs1 and the sign-extended offset encoded in imm[11:0], where imm[4:0] equals 0b00000, is likely to be accessed by a data write (i.e. store) in the near future.

Zicbop_prefetch_w_cg/cp_custom_prefetch

prefetch_operating_block

These instructions operate on the cache block whose effective address is the sum of the base address specified in rs1 and the sign-extended offset encoded in imm[11:0], where imm[4:0] shall equal 0b00000.

{Zicbop_prefetch_i_cg, Zicbop_prefetch_r_cg, Zicbop_prefetch_w_cg}/cp_custom_prefetch

cbp_access

A cache-block prefetch instruction is permitted to access the specified cache block whenever a load instruction, store instruction, or instruction fetch is permitted to access the corresponding physical addresses.

{Zicbop_prefetch_i_cg, Zicbop_prefetch_r_cg, Zicbop_prefetch_w_cg}/cp_custom_prefetch

cbp_unperm_noexcep

If access to the cache block is not permitted, a cache-block prefetch instruction does not raise any exceptions and shall not access any caches or memory.

PMP_Zicbo_cg/{cp_prefetch_i, cp_prefetch_r, cp_prefetch_w}

UDB Parameters: None.

A.10.17. Za64rs Max 64B Reservation Set

Table 121. Za64rs Coverpoints
Coverpoint Goal Feature Description Expectation Bins Normative Rule

cp_za64rs

reservation set size

For each offset in [0, 64] that is a multiple of 4, lr.w from base address that a multiple of 64 and then sc.w to an address with that offset from base

sc success code in rd matches reference model, succeeding for small offsets and failing for large offsets (definitely for 64, optionally smaller)

17

Za64rs_res_set_req
Reservation sets are contiguous, naturally aligned, and a maximum of 64 bytes.

Note:

Can borrow tests from sc.w unprivileged test

Table 122. Za64rs Normative Rules
Normative Rule Rule Text Coverpoints

Za128rs_res_set_req

The Za128rs extension requires that the reservation sets used by the instructions in the Zalrsc extension be contiguous, naturally aligned, and at most 128 bytes in size.

Za64rs_res_set_req

The Za64rs extension requires that the reservation sets used by the instructions in the Zalrsc extension be contiguous, naturally aligned, and at most 64 bytes in size.

Za64rs_cg/cp_za64rs

Za64rs_implies_Za128rs

The Za64rs extension implies the Za128rs extension.

Definition, checked through UDB

UDB Parameters: None.

A.10.18. Zic64b 64B Cache Block Zero

Table 123. Zic64b Coverpoints
Coverpoint Goal Feature Description Expectation Bins Normative Rule

cp_zic64b

Cache block zeros

For each offset in range of [0, 64]: Write all 1s to 128 consecutive bytes, then do cbo with offset from 64-bit aligned base. Read back words at offsets of 0, 60, 64, 124 from base.

Match ref model. Only 64 bytes written. When offset is 64, they are in the second block.

65

Zic64b_cache_block_size
cbo-zero_unaligned

Table 124. Zic64b Normative Rules
Normative Rule Rule Text Coverpoints

Zic64b_cache_block_size

If the Zic64b extension is implemented, then cache blocks must be 64 bytes in size, naturally aligned in the address space.

Zic64b_cg/cp_zic64b

UDB Parameters: None.

A.11. V Vector Extension

The vector coverpoints are intended to be flexible to support the full V extension, the Zve* embedded vector extensions, and arbitrary mixes of supported vector length (VLEN), element lengths (SEWMIN, ELEN), and floating-point precisions.

The vector extension is huge. The testplan is partitioned into three unprivileged portions discussed here, and two privileged portions (ExceptionsV, SsstrictV) discussed in Section B.9.

The full V extension supports all selected element widths SEW={8, 16, 32, 64}. The vector coverage files and tests are organized by SEW. Thus, a DUT could handle any contiguous subset of SEW from SEWMIN to ELEN. For example, a DUT with SEWMIN=16 and ELEN=32 would support SEW={16, 32}.

The tests detect VLMAX and set the vector length accordingly, up to some configurable maximum VLEN (default 4096 bits, although the vector extension theoretically supports up to 65536). Therefore, there is no need for different test suites for different VLENs.

A.11.1. Vector File Organization

Listing 1 summarizes the structure of the coverpoint and test files for the vector extension. The unprivileged vector tests are organized by integer (Vx), load/store (Vls), and floating-point (Vf) types of instructions. Each applies to SEW=8, 16, 32, and/or 64. The ExceptionsV, V, and SsstrictV privileged tests are described in section XREF.

The vector tests are organized by XLEN=32 and XLEN=64 because the scalar registers behavior differs by XLEN. For example, vadd.vx with SEW=64 sign-extends XLEN=32 scalar registers but does not modify XLEN=64 scalar registers. For a given XLEN, the vector tests are organized by type (Vx/Vls/Vf) and SEW (8/16/32/64). Each directory contains a .S file for every vector instruction of that type [4]. Vector load/store instructions run with any SEW but also specify EEW as part of the instruction name. For example, vle8.v and vle16.v can both be executed in either SEW=8 or SEW=16, and the EMUL behavior is different between these modes. Therefore, all the load/store variants are included in all of Vls{8/16/32/64}.

Vx and Vf are separated because certain extensions such as Zve64x do not support floating-point. Vls could be lumped with Vx, but the coverpoints are so different that it is easier to define the tests separately, and facilitates just running integer vs. load/store tests during development.

Listing 1. Vector Organization
fcov
    unpriv
        Vx8_coverage.svh
        Vx16_coverage.svh
        Vx32_coverage.svh
        Vx64_coverage.svh
        Vls8_coverage.svh
        Vls16_coverage.svh
        Vls32_coverage.svh
        Vls64_coverage.svh
        Vf8_coverage.svh
        Vf16_coverage.svh
        Vf32_coverage.svh
        Vf64_coverage.svh
      priv
        ExceptionsVx_coverage.svh
        ExceptionsVls_coverage.svh
        ExceptionsVf16_coverage.svh
        ExceptionsVf32_coverage.svh
        ExceptionsVf64_coverage.svh
        ExceptionsVfmin_coverage.svh
        MisalignV_coverage.svh
        SsstrictV_coverage.svh
        Sm_coverage.svh (Sm_V_cg, Sm_VF_cg)
        S_coverage.svh (S_V_cg, S_VF_cg)
        U_coverage.svh (U_V_cg, U_VF_cg)
tests
    rv32
        Vx8
            vadd.vv.S
            vadd.vx.S
            vadd.vi.S
            vsub.vv.S
            ...
        Vx16
            vadd.vv.S
            ...
        Vx32
            vadd.vv.S
            ...
        Vx64
            vadd.vv.S
            ...
        Vls8
            vle8.v.S
            vle16.v.S
            vle32.v.S
            vle64.v.S
            vlseg2e8.v.S
            ...
        Vls16
            vle8.v.S
            ...
        Vls32
            vle8.v.S
            ...
        Vls64
            vle8.v.S
            ...
        Vf8
            vfwcvt.f.x.v.S
            vfncvt.x.f.w.S
            ...
        Vf16
            vfadd.vv.S
            vfadd.vf.S
            vfwadd.vv.S
            vfsub.vv.S
            ...
        Vf32
            vfadd.vv.S
            ...
        Vf64
            vfadd.vv.S
            ...
    rv64
        Vx8
        Vx16
        Vx32
        Vx64
        Vls8
        Vls16
        Vls32
        Vls64
        Vf8
        Vf16
        Vf32
        Vf64
    priv
        ExceptionsVx
        ExceptionsVls
        ExceptionsVf16
        ExceptionsVf32
        MisalignV
        SsstrictV
        Sm (Sm_V_*.S, Sm_VF-*.S)
        S (S_V_*.S, S_VF-*.S)
        U (U_V_*.S, U_VF-*.S)

When an instruction’s EEW is not a supported SEW, the coverage files and tests exclude the instruction from testing. For example, vwadd.vv is not supported when SEW=32 and ELEN = 32 because it cannot widen to 64 bits.

The tests also account for unsupported register group overlap. For example, a widening add vwadd.wv v0, v2, v2 is unsupported because the source registers cannot be read with different EEWs. On the other hand vwadd.vv v0, v1, v8 with LMUL=1 is supported even though the destination vd=v0 widens to write [v0-v1], which overlaps with vs2=v1. The tests exercise all supported overlaps, but do not attempt any unsupported overlaps because the behavior is reserved and unpredictable.

A.11.2. Vector Configuration Parameters

The coverpoints and tests are parameterized by the minimum supported element width SEWMIN and the maximum supported element width ELEN. The coverpoints and tests exclude unsupported edge cases, such as widening to more than ELEN or using LMUL=1/8 with ELEN=32 but SEWMIN=8.

A.11.3. Vector Coverpoints

Running long vectors is computationally expensive, so only a subset of vectors tests run on multi-element vectors. Coverpoints for source and destination registers, edge values, etc. run on a vector length of vl = 1.

Table 125 defines the coverpoints used in vector instructions. Unless otherwise specified, each coverpoint uses vector length vl=1 and length multiplier LMUL=1, no mask (vm=1), and vstart=0. Hence, they act on exactly one vector element. For such coverpoints, instructions that require a mask use v0=0.

Table 125. Vector Coverpoint Definitions
Coverpoint # Bins Definition

Coverpoints acting on single element vl=1

cp_vd

32

All vector destination registers vd=0-31

cp_vs2

32

All vector source registers vs2=0-31

cp_vs1

32

All vector source registers vs1=0-31

cp_vs3

32

All vector source registers vs3=0-31

cp_rs1

32

All scalar registers rs1=0-31

cp_rs2

32

All scalar registers rs2=0-31

cp_imm_5bit

32

Signed immediate values -16 to +15

cmp_rs1_rs2

32

rs1 and rs2 are same register ID

cmp_vd_vs2

32

vd and vs2 are same register ID

cmp_vd_vs1

32

vd and vs1 are same register ID

cmp_vs2_vs1

32

vs2 and vs1 are same register ID

cmp_vs3_vs2

32

vs3 and vs2 are the same register ID

cmp_vd_vs1_vs2

32

vd and vs1 and vs2 are same register ID

cp_rs1_edges

9

0, 1, 2, -1, -2, most negative, most negative+1, most positive, most positive-1

cp_rs2_edges

5

0, 1, 2, -1, -2 (for strided vector load/store)

cp_fs1_edges

20

0, -1, -smallest subnorm, -inf, 1, 1+ulp, 0.5, 1.5, 2, 4, pi, 2^emax, largest normal, smallest normal, largest subnormal, subnormal with leading 1 in fraction, infinity, canonical quite NaN, noncanonical quiet NaN, signaling NaN with payload of 1

cp_vs2_edges

9 or 20

see cp_rs1_edges or cp_fs1_edges

cp_vs1_edges

9 or 20

see cp_rs1_edges

cr_vs2_vs1_edges

9^2 or 20^2

Cross-product of edges of vs2 and vs1

cr_vs2_rs1_edges

9*9

Cross-product of edges of vs2 and rs1

cr_vs2_fs1_edges

20*20

Cross-product of edges of vs2 and fs1

cr_vs2_imm_edges

9*9

Cross-product of edges of vs2 and imm={0, 1, 2, 14, 15, -1, -2, -15,-16}

cr_vxrm_vs2_vs1_edges

9*9*4

Cross-product of edges of vs2 and vs1 with vector rounding mode={rod, rdn, rne, rnu}

cr_vxrm_vs2_rs1_edges

9*9*4

See cr_vxrm_vs2_vs1_edges

cr_vxrm_vs2_imm_edges

9*9*4

See cr_vxrm_vs2_vs1_edges

cp_csr_frm

5*10

Floating-point rounding mode={rdn, rmm, rne, rtz, rup} with 10 random inputs per mode

cp_csr_fflags

5*2

Floating-point sets and clears all applicable flags

Coverpoints acting on multiple elements vl ≠ 1

cp_masking_edges

5

Mask edge cases v0=all 1s, all 0s, random, first VLMAX-1 ones, first VLMAX/2+1 ones; vl=VLMAX, vm=1 to mask, vma = random, vta = 0

cr_vl_lmul

7*3

Cross legal combinations of LMUL={1/2/4/8/f2/f4/f8} and vl={1, random, VLMAX}, while randomizing v0 mask value, vm, vta, vma.

cr_vtype_agnostic

4

Cross vta={0/1} and vma={0/1}. Random legal LMUL, random legal vl, vm=1, v0=random mask

cp_vxsat

2

vxsat={0, 1}. Hit by cr_vs2_vs1_edges so no tests needed.

cp_vl_0

1

vl=0. LMUL=1, no mask, vma=0, vta=1

As with other unprivileged testplans, an x in the spreadsheet indicates to use the coverpoint. Other values in the spreadsheet indicate a variant of the coverpoint:

  • nv0: Do not include v0 in the coverpoint. For example, cp_vd_nv0 means that the destination register vd does not include v0.

  • emul2: Only exercise even-numbered registers. For example cp_vs2_emul2 uses vs2={v0, v2, v4, …​v30}. For edge values, emul2 means the edge value is twice the width of SEW.

  • emul4/8: Similar to emul2

  • emulf2, emulf4, emulf8: edge values are 1/2, 1/4, or 1/8 the width of SEW. Used in extension instructions such as vsext.vf2.

  • u: Treat immediate as unsigned 0 to 31 rather than signed -16 to +15. For edge values, {0, 1, 2, 15, 16, 30, 31}.

  • eew1/mm: Mask instructions with 1-bit elements such as vmand.mm use at least vl=8 to operate on multi-bit masks.

  • wv: vs2 is double-width and uses emul2 for its edge values. vs1 is normal width.

  • wred: vs1 is double-width and uses emul2 for its edge values. vs2 is normal width.

  • wx: vs2 is double-width and uses emul2 for its edge values. rs1 is normal width.

  • wi/wiu: vs2 is double-width and uses emul2 for its edge values. immediate is 5 bit signed or unsigned.

  • lmul4max/emul4max: maximum LMUL/EMUL is 4 instead of 8. vwadd.vv uses lmul4max because it cannot accept LMUL=8 widened to 16. vlseg2e8.v uses emul4max because the number of segments * EMUL cannot exceed 8.

  • lmul2max/lmul1max/emul2max/emul1max: see lmul4max

  • lte30/…​/lte24: Register number is less than or equal to 30, …​, 24. Used for segmented load/store so segments won’t overflow the register file.

  • ls_e{8/16/32/64}: load/store edges with EEW=8,…​,64. Used to convert strided loads from elements to bytes.

  • ls: load/store edges instead of integer edges: vs2={0, random < 2*VLMAX}. rs2= {1, 2, -1, -2, 0}

  • f: floating-point edges instead of integer edges: *

  • cp_custom_*: custom coverpoint defined in the coverage file. See definitions for "Vx_custom_definitions, "VxCustom", "Vf_custom_definitions", "Vls_custom_definitions".

The coverpoints for each vector instruction are given in the following sections.

A.11.4. Vx

The Vx testplan is the same for SEW={8, 16, 32, 64}. Each SEW has its own coverage file (e.g. Vx8_coverages.svh) independent of XLEN, as well as tests that depend on XLEN (e.g. rv32/Vx8/vadd.vx.S).

Table 126. Vx Instruction Coverpoints
Instruction vadd.vv vadd.vx vadd.vi vwadd.vv vwadd.vx vwaddu.vv vwaddu.vx vwadd.wv vwadd.wx vwaddu.wv vwaddu.wx vsub.vv

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW8

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW16

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW32

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW64

x

x

x

x

cp_asm_count

x

x

x

x

x

x

x

x

x

x

x

x

cp_vd

x

x

x

emul2

emul2

emul2

emul2

emul2

emul2

emul2

emul2

x

cp_vs2

x

x

x

x

x

x

x

emul2

emul2

emul2

emul2

x

cp_vs1

x

x

x

x

x

x

cp_rs1

x

x

x

x

x

cp_imm_5bit

x

cmp_vd_vs2

x

x

x

emul2

emul2

emul2

emul2

x

cmp_vd_vs1

x

x

cmp_vs1_vs2

x

x

x

x

cmp_vd_vs1_vs2

x

x

cp_vs2_edges

x

x

x

x

x

x

x

emul2

emul2

emul2

emul2

x

cp_vs1_edges

x

x

x

x

x

x

cr_vs2_vs1_edges

x

x

x

wv

wv

x

cp_rs1_edges

x

x

x

x

x

cr_vs2_rs1_edges

x

x

x

wx

wx

cr_vs2_imm_edges

x

cp_masking_edges

x

x

x

x

x

x

x

x

x

x

x

x

cr_vl_lmul

x

x

x

lmul4max

lmul4max

lmul4max

lmul4max

lmul4max

lmul4max

lmul4max

lmul4max

x

cr_vtype_agnostic

x

x

x

lmul4max

lmul4max

lmul4max

lmul4max

lmul4max

lmul4max

lmul4max

lmul4max

x

cp_vl_0

x

x

x

x

x

x

x

x

x

x

x

x

std_vec

x

x

x

x

x

x

cp_custom

wvv_all

wvx_all

wvv

wvx

wwv_all

wwv

Instruction vsub.vx vwsub.vv vwsub.vx vwsubu.vv vwsubu.vx vwsub.wv vwsub.wx vwsubu.wv vwsubu.wx vrsub.vx vrsub.vi vzext.vf2

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW8

x

x

x

x

x

x

x

x

x

x

x

EFFEW16

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW32

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW64

x

x

x

x

cp_asm_count

x

x

x

x

x

x

x

x

x

x

x

x

cp_vd

x

emul2

emul2

emul2

emul2

emul2

emul2

emul2

emul2

x

x

x

cp_vs2

x

x

x

x

x

emul2

emul2

emul2

emul2

x

x

x

cp_vs1

x

x

x

x

cp_rs1

x

x

x

x

x

x

cp_imm_5bit

x

cmp_vd_vs2

x

emul2

emul2

emul2

emul2

x

x

cmp_vs1_vs2

x

x

cp_vs2_edges

x

x

x

x

x

emul2

emul2

emul2

emul2

x

x

emulf2

cp_vs1_edges

x

x

x

x

cr_vs2_vs1_edges

x

x

wv

wv

cp_rs1_edges

x

x

x

x

x

x

cr_vs2_rs1_edges

x

x

x

wx

wx

x

cr_vs2_imm_edges

x

cp_masking_edges

x

x

x

x

x

x

x

x

x

x

x

x

cr_vl_lmul

x

lmul4max

lmul4max

lmul4max

lmul4max

lmul4max

lmul4max

lmul4max

lmul4max

x

x

x

cr_vtype_agnostic

x

lmul4max

lmul4max

lmul4max

lmul4max

lmul4max

lmul4max

lmul4max

lmul4max

x

x

x

cp_vl_0

x

x

x

x

x

x

x

x

x

x

x

x

std_vec

x

x

x

x

x

x

x

cp_custom

wvv

wvx

wvv

wvx

wwv

wwv

vext2

Instruction vzext.vf4 vzext.vf8 vsext.vf2 vsext.vf4 vsext.vf8 vadc.vvm vadc.vxm vadc.vim vsbc.vvm vsbc.vxm vmadc.vvm vmadc.vxm

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW8

x

x

x

x

x

x

x

EFFEW16

x

x

x

x

x

x

x

x

EFFEW32

x

x

x

x

x

x

x

x

x

x

EFFEW64

x

x

x

x

x

x

x

x

x

x

x

x

cp_asm_count

x

x

x

x

x

x

x

x

x

x

x

x

cp_vd

x

x

x

x

x

nv0

nv0

nv0

nv0

nv0

x

x

cp_vs2

x

x

x

x

x

nv0

nv0

nv0

nv0

nv0

nv0

nv0

cp_vs1

nv0

nv0

nv0

cp_rs1

x

x

x

cp_imm_5bit

x

cmp_vd_vs2

nv0

nv0

nv0

nv0

nv0

cmp_vd_vs1

nv0

nv0

cmp_vs1_vs2

nv0

nv0

nv0

cmp_vd_vs1_vs2

nv0

nv0

cp_vs2_edges

emulf4

emulf8

emulf2

emulf4

emulf8

x

x

x

x

x

x

x

cp_vs1_edges

x

x

x

cr_vs2_vs1_edges

x

x

x

cp_rs1_edges

x

x

x

cr_vs2_rs1_edges

x

x

x

cr_vs2_imm_edges

x

cp_masking_edges

x

x

x

x

x

x

x

x

x

x

x

x

cr_vl_lmul

x

x

x

x

x

x

x

x

x

x

x

x

cr_vtype_agnostic

x

x

x

x

x

x

x

x

x

x

x

x

cp_vl_0

x

x

x

x

x

x

x

x

x

x

x

x

std_vec

x

x

x

x

x

x

x

cp_custom

vext4

vext8

vext2

vext4

vext8

maskwrite_masked

maskwrite_masked

Instruction vmadc.vim vmadc.vv vmadc.vx vmadc.vi vmsbc.vvm vmsbc.vxm vmsbc.vv vmsbc.vx vand.vv vand.vx vand.vi vor.vv

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW8

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW16

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW32

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW64

x

x

x

x

x

x

x

x

x

x

x

x

cp_asm_count

x

x

x

x

x

x

x

x

x

x

x

x

cp_vd

x

x

x

x

x

x

x

x

x

x

x

x

cp_vs2

nv0

x

x

x

nv0

nv0

x

x

x

x

x

x

cp_vs1

x

nv0

x

x

x

cp_rs1

x

x

x

x

cp_imm_5bit

x

x

x

cmp_vd_vs2

x

x

x

x

cmp_vd_vs1

x

x

cmp_vs1_vs2

x

nv0

x

x

x

cmp_vd_vs1_vs2

x

x

cp_vs2_edges

x

x

x

x

x

x

x

x

x

x

x

x

cp_vs1_edges

x

x

x

x

x

cr_vs2_vs1_edges

x

x

x

x

x

cp_rs1_edges

x

x

x

x

cr_vs2_rs1_edges

x

x

x

x

cr_vs2_imm_edges

x

x

x

cp_masking_edges

x

x

x

x

x

x

x

cr_vl_lmul

x

nomask

nomask

nomask

x

x

nomask

nomask

x

x

x

x

cr_vtype_agnostic

x

nomask

nomask

nomask

x

x

nomask

nomask

x

x

x

x

cp_vl_0

x

x

x

x

x

x

x

x

x

x

x

x

std_vec

x

x

x

x

x

x

x

x

cp_custom

maskwrite_masked

maskwrite_unmasked

maskwrite_unmasked

maskwrite_unmasked

maskwrite_masked

maskwrite_masked

maskwrite_unmasked

maskwrite_unmasked

Instruction vor.vx vor.vi vxor.vv vxor.vx vxor.vi vsll.vv vsll.vx vsll.vi vsrl.vv vsrl.vx vsrl.vi vnsrl.wv

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW8

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW16

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW32

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW64

x

x

x

x

x

x

x

x

x

x

x

cp_asm_count

x

x

x

x

x

x

x

x

x

x

x

x

cp_vd

x

x

x

x

x

x

x

x

x

x

x

x

cp_vs2

x

x

x

x

x

x

x

x

x

x

x

emul2

cp_vs1

x

x

x

x

cp_rs1

x

x

x

x

cp_imm_5bit

x

x

u

u

cmp_vd_vs2

x

x

x

x

x

x

x

x

x

x

x

cmp_vd_vs1

x

x

x

x

cmp_vs1_vs2

x

x

x

cmp_vd_vs1_vs2

x

x

x

cp_vs2_edges

x

x

x

x

x

x

x

x

x

x

x

emul2

cp_vs1_edges

x

x

x

x

cr_vs2_vs1_edges

x

x

x

wv

cp_rs1_edges

x

x

x

x

cr_vs2_rs1_edges

x

x

x

x

cr_vs2_imm_edges

x

x

u

u

cp_masking_edges

x

x

x

x

x

x

x

x

x

x

x

x

cr_vl_lmul

x

x

x

x

x

x

x

x

x

x

x

lmul4max

cr_vtype_agnostic

x

x

x

x

x

x

x

x

x

x

x

lmul4max

cp_vl_0

x

x

x

x

x

x

x

x

x

x

x

x

std_vec

x

x

x

x

x

cp_custom

shift_vv

shift_vx

shift_vv

shift_vx

shift_wv

Instruction vnsrl.wx vnsrl.wi vsra.vv vsra.vx vsra.vi vnsra.wv vnsra.wx vnsra.wi vmseq.vv vmseq.vx vmseq.vi vmsne.vv

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW8

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW16

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW32

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW64

x

x

x

x

x

x

x

cp_asm_count

x

x

x

x

x

x

x

x

x

x

x

x

cp_vd

x

x

x

x

x

x

x

x

x

x

x

x

cp_vs2

emul2

emul2

x

x

x

emul2

emul2

emul2

x

x

x

x

cp_vs1

x

x

x

x

cp_rs1

x

x

x

x

cp_imm_5bit

u

u

u

x

cmp_vd_vs2

x

x

x

cmp_vd_vs1

x

x

cmp_vs1_vs2

x

x

x

cmp_vd_vs1_vs2

x

cp_vs2_edges

emul2

emul2

x

x

x

emul2

emul2

emul2

x

x

x

x

cp_vs1_edges

x

x

x

x

cr_vs2_vs1_edges

x

wv

x

x

cp_rs1_edges

x

x

x

x

cr_vs2_rs1_edges

wx

x

wx

x

cr_vs2_imm_edges

wiu

u

wiu

x

cp_masking_edges

x

x

x

x

x

x

x

x

x

x

x

x

cr_vl_lmul

lmul4max

lmul4max

x

x

x

lmul4max

lmul4max

lmul4max

x

x

x

x

cr_vtype_agnostic

lmul4max

lmul4max

x

x

x

lmul4max

lmul4max

lmul4max

x

x

x

x

cp_vl_0

x

x

x

x

x

x

x

x

x

x

x

x

std_vec

x

x

x

x

x

x

x

x

x

x

x

cp_custom

shift_wx

shift_wi

shift_vv

shift_vx

shift_wv

shift_wx

shift_wi

maskwrite_masked

maskwrite_masked

maskwrite_masked

maskwrite_masked

cp_custom_shift_wi_all

x

x

Instruction vmsne.vx vmsne.vi vmslt.vv vmslt.vx vmsltu.vv vmsltu.vx vmsle.vv vmsle.vx vmsle.vi vmsleu.vv vmsleu.vx vmsleu.vi

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW8

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW16

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW32

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW64

x

x

x

x

x

x

x

x

x

x

x

x

cp_asm_count

x

x

x

x

x

x

x

x

x

x

x

x

cp_vd

x

x

x

x

x

x

x

x

x

x

x

x

cp_vs2

x

x

x

x

x

x

x

x

x

x

x

x

cp_vs1

x

x

x

x

cp_rs1

x

x

x

x

x

cp_imm_5bit

x

x

x

cmp_vs1_vs2

x

x

x

x

cp_vs2_edges

x

x

x

x

x

x

x

x

x

x

x

x

cp_vs1_edges

x

x

x

x

cr_vs2_vs1_edges

x

x

x

x

cp_rs1_edges

x

x

x

x

x

cr_vs2_rs1_edges

x

x

x

x

x

cr_vs2_imm_edges

x

x

x

cp_masking_edges

x

x

x

x

x

x

x

x

x

x

x

x

cr_vl_lmul

x

x

x

x

x

x

x

x

x

x

x

x

cr_vtype_agnostic

x

x

x

x

x

x

x

x

x

x

x

x

cp_vl_0

x

x

x

x

x

x

x

x

x

x

x

x

std_vec

x

x

x

x

x

x

x

x

x

x

x

x

cp_custom

maskwrite_masked

maskwrite_masked

maskwrite_masked

maskwrite_masked

maskwrite_masked

maskwrite_masked

maskwrite_masked

maskwrite_masked

maskwrite_masked

maskwrite_masked

maskwrite_masked

maskwrite_masked

Instruction vmsgt.vx vmsgt.vi vmsgtu.vx vmsgtu.vi vmin.vv vmin.vx vminu.vv vminu.vx vmax.vv vmax.vx vmaxu.vv vmaxu.vx

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW8

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW16

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW32

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW64

x

x

x

x

x

x

x

x

x

x

x

x

cp_asm_count

x

x

x

x

x

x

x

x

x

x

x

x

cp_vd

x

x

x

x

x

x

x

x

x

x

x

x

cp_vs2

x

x

x

x

x

x

x

x

x

x

x

x

cp_vs1

x

x

x

x

cp_rs1

x

x

x

x

x

x

cp_imm_5bit

x

x

cmp_vd_vs2

x

x

x

x

x

x

x

x

cmp_vd_vs1

x

x

x

x

cmp_vs1_vs2

x

x

x

x

cmp_vd_vs1_vs2

x

x

x

x

cp_vs2_edges

x

x

x

x

x

x

x

x

x

x

x

x

cp_vs1_edges

x

x

x

x

cr_vs2_vs1_edges

x

x

x

x

cp_rs1_edges

x

x

x

x

x

x

cr_vs2_rs1_edges

x

x

x

x

x

x

cr_vs2_imm_edges

x

x

cp_masking_edges

x

x

x

x

x

x

x

x

x

x

x

x

cr_vl_lmul

x

x

x

x

x

x

x

x

x

x

x

x

cr_vtype_agnostic

x

x

x

x

x

x

x

x

x

x

x

x

cp_vl_0

x

x

x

x

x

x

x

x

x

x

x

x

std_vec

x

x

x

x

cp_custom

maskwrite_masked

maskwrite_masked

maskwrite_masked

maskwrite_masked

Instruction vmul.vv vmul.vx vmulh.vv vmulh.vx vmulhu.vv vmulhu.vx vmulhsu.vv vmulhsu.vx vwmul.vv vwmul.vx vwmulu.vv vwmulu.vx

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW8

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW16

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW32

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW64

x

x

x

x

x

x

x

x

cp_asm_count

x

x

x

x

x

x

x

x

x

x

x

x

cp_vd

x

x

x

x

x

x

x

x

emul2

emul2

emul2

emul2

cp_vs2

x

x

x

x

x

x

x

x

x

x

x

x

cp_vs1

x

x

x

x

x

x

cp_rs1

x

x

x

x

x

x

cmp_vd_vs2

x

x

x

x

x

x

x

x

cmp_vd_vs1

x

x

x

x

cmp_vs1_vs2

x

x

x

x

x

x

cmp_vd_vs1_vs2

x

x

x

x

cp_vs2_edges

x

x

x

x

x

x

x

x

x

x

x

x

cp_vs1_edges

x

x

x

x

x

x

cr_vs2_vs1_edges

x

x

x

x

x

x

cp_rs1_edges

x

x

x

x

x

x

cr_vs2_rs1_edges

x

x

x

x

x

x

cp_masking_edges

x

x

x

x

x

x

x

x

x

x

x

x

cr_vl_lmul

x

x

x

x

x

x

x

x

lmul4max

lmul4max

lmul4max

lmul4max

cr_vtype_agnostic

x

x

x

x

x

x

x

x

lmul4max

lmul4max

lmul4max

lmul4max

cp_vl_0

x

x

x

x

x

x

x

x

x

x

x

x

std_vec

x

x

x

x

cp_custom

wvv

wvx

wvv

wvx

Instruction vwmulsu.vv vwmulsu.vx vdiv.vv vdiv.vx vdivu.vv vdivu.vx vrem.vv vrem.vx vremu.vv vremu.vx vmacc.vv vmacc.vx

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW8

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW16

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW32

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW64

x

x

x

x

x

x

x

x

x

x

cp_asm_count

x

x

x

x

x

x

x

x

x

x

x

x

cp_vd

emul2

emul2

x

x

x

x

x

x

x

x

x

x

cp_vs2

x

x

x

x

x

x

x

x

x

x

x

x

cp_vs1

x

x

x

x

x

x

cp_rs1

x

x

x

x

x

x

cmp_vd_vs2

x

x

x

x

x

x

x

x

x

x

cmp_vd_vs1

x

x

x

x

x

cmp_vs1_vs2

x

x

x

x

x

x

cmp_vd_vs1_vs2

x

x

x

x

x

cp_vs2_edges

x

x

x

x

x

x

x

x

x

x

x

x

cp_vs1_edges

x

x

x

x

x

x

cr_vs2_vs1_edges

x

x

x

x

x

x

cp_rs1_edges

x

x

x

x

x

x

cr_vs2_rs1_edges

x

x

x

x

x

x

cp_masking_edges

x

x

x

x

x

x

x

x

x

x

x

x

cr_vl_lmul

lmul4max

lmul4max

x

x

x

x

x

x

x

x

x

x

cr_vtype_agnostic

lmul4max

lmul4max

x

x

x

x

x

x

x

x

x

x

cp_vl_0

x

x

x

x

x

x

x

x

x

x

x

x

std_vec

x

x

cp_custom

wvv

wvx

Instruction vnmsac.vv vnmsac.vx vmadd.vv vmadd.vx vnmsub.vv vnmsub.vx vwmacc.vv vwmacc.vx vwmaccu.vv vwmaccu.vx vwmaccsu.vv vwmaccsu.vx

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW8

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW16

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW32

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW64

x

x

x

x

x

x

cp_asm_count

x

x

x

x

x

x

x

x

x

x

x

x

cp_vd

x

x

x

x

x

x

emul2

emul2

emul2

emul2

emul2

emul2

cp_vs2

x

x

x

x

x

x

x

x

x

x

x

x

cp_vs1

x

x

x

x

x

x

cp_rs1

x

x

x

x

x

x

cmp_vd_vs2

x

x

x

x

x

x

cmp_vd_vs1

x

x

x

cmp_vs1_vs2

x

x

x

x

x

x

cmp_vd_vs1_vs2

x

x

x

cp_vs2_edges

x

x

x

x

x

x

x

x

x

x

x

x

cp_vs1_edges

x

x

x

x

x

x

cr_vs2_vs1_edges

x

x

x

x

x

x

cp_rs1_edges

x

x

x

x

x

x

cr_vs2_rs1_edges

x

x

x

x

x

x

cp_masking_edges

x

x

x

x

x

x

x

x

x

x

x

x

cr_vl_lmul

x

x

x

x

x

x

lmul4max

lmul4max

lmul4max

lmul4max

lmul4max

lmul4max

cr_vtype_agnostic

x

x

x

x

x

x

lmul4max

lmul4max

lmul4max

lmul4max

lmul4max

lmul4max

cp_vl_0

x

x

x

x

x

x

x

x

x

x

x

x

Instruction vwmaccus.vx vmerge.vvm vmerge.vxm vmerge.vim vmv.v.v vmv.v.x vmv.v.i vsadd.vv vsadd.vx vsadd.vi vsaddu.vv vsaddu.vx

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW8

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW16

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW32

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW64

x

x

x

x

x

x

x

x

x

x

x

cp_asm_count

x

x

x

x

x

x

x

x

x

x

x

x

cp_vd

emul2

nv0

nv0

nv0

x

x

x

x

x

x

x

x

cp_vs2

x

nv0

nv0

nv0

x

x

x

x

x

cp_vs1

nv0

x

x

x

cp_rs1

x

x

x

x

x

cp_imm_5bit

x

x

x

cmp_vd_vs2

nv0

nv0

nv0

x

x

x

x

x

cmp_vd_vs1

nv0

x

x

x

cmp_vs1_vs2

nv0

x

x

cmp_vd_vs1_vs2

nv0

x

x

cp_vs2_edges

x

x

x

x

x

x

x

x

x

cp_vs1_edges

x

x

x

x

cr_vs2_vs1_edges

x

x

x

cp_rs1_edges

x

x

x

x

x

cr_vs2_rs1_edges

x

x

x

x

cr_vs2_imm_edges

x

x

cp_masking_edges

x

x

x

x

x

x

x

x

x

cr_vl_lmul

lmul4max

x

x

x

nomask

nomask

nomask

x

x

x

x

x

cr_vtype_agnostic

lmul4max

x

x

x

nomask

nomask

nomask

x

x

x

x

x

cp_vl_0

x

x

x

x

x

x

x

x

x

x

x

x

cp_csr_vxsat

x

x

x

x

x

Instruction vsaddu.vi vssub.vv vssub.vx vssubu.vv vssubu.vx vaadd.vv vaadd.vx vaaddu.vv vaaddu.vx vasub.vv vasub.vx vasubu.vv

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW8

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW16

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW32

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW64

x

x

x

x

x

x

x

x

x

x

x

x

cp_asm_count

x

x

x

x

x

x

x

x

x

x

x

x

cp_vd

x

x

x

x

x

x

x

x

x

x

x

x

cp_vs2

x

x

x

x

x

x

x

x

x

x

x

x

cp_vs1

x

x

x

x

x

x

cp_rs1

x

x

x

x

x

cp_imm_5bit

x

cmp_vd_vs2

x

x

x

x

x

x

x

x

x

x

x

x

cmp_vd_vs1

x

x

x

x

x

x

cmp_vs1_vs2

x

x

x

x

x

x

cmp_vd_vs1_vs2

x

x

x

x

x

x

cp_vs2_edges

x

x

x

x

x

x

x

x

x

x

x

x

cp_vs1_edges

x

x

x

x

x

x

cr_vs2_vs1_edges

x

x

x

x

x

x

cr_vxrm_vs2_vs1_edges

x

x

x

x

cp_rs1_edges

x

x

x

x

x

cr_vs2_rs1_edges

x

x

x

x

x

cr_vxrm_vs2_rs1_edges

x

x

x

cr_vs2_imm_edges

x

cp_masking_edges

x

x

x

x

x

x

x

x

x

x

x

x

cr_vl_lmul

x

x

x

x

x

x

x

x

x

x

x

x

cr_vtype_agnostic

x

x

x

x

x

x

x

x

x

x

x

x

cp_vl_0

x

x

x

x

x

x

x

x

x

x

x

x

cp_csr_vxsat

x

x

x

x

x

Instruction vasubu.vx vsmul.vv vsmul.vx vssrl.vv vssrl.vx vssrl.vi vssra.vv vssra.vx vssra.vi vnclip.wv vnclip.wx vnclip.wi

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW8

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW16

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW32

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW64

x

x

x

x

x

x

x

x

x

cp_asm_count

x

x

x

x

x

x

x

x

x

x

x

x

cp_vd

x

x

x

x

x

x

x

x

x

x

x

x

cp_vs2

x

x

x

x

x

x

x

x

x

emul2

emul2

emul2

cp_vs1

x

x

x

x

cp_rs1

x

x

x

x

x

cp_imm_5bit

u

u

u

cmp_vd_vs2

x

x

x

x

x

x

x

x

x

cmp_vd_vs1

x

x

x

x

cmp_vs1_vs2

x

x

x

cmp_vd_vs1_vs2

x

x

x

cp_vs2_edges

x

x

x

x

x

x

x

x

x

emul2

emul2

emul2

cp_vs1_edges

x

x

x

x

cr_vs2_vs1_edges

x

x

x

wv

cr_vxrm_vs2_vs1_edges

x

x

x

wv

cp_rs1_edges

x

x

x

x

x

cr_vs2_rs1_edges

x

x

x

x

wx

cr_vxrm_vs2_rs1_edges

x

x

x

x

wx

cr_vs2_imm_edges

u

u

wiu

cr_vxrm_vs2_imm_edges

x

x

wi

cp_masking_edges

x

x

x

x

x

x

x

x

x

x

x

x

cr_vl_lmul

x

x

x

x

x

x

x

x

x

lmul4max

lmul4max

lmul4max

cr_vtype_agnostic

x

x

x

x

x

x

x

x

x

lmul4max

lmul4max

lmul4max

cp_vl_0

x

x

x

x

x

x

x

x

x

x

x

x

cp_csr_vxsat

x

no_rv32_sew64

std_vec

x

x

x

x

x

x

x

cp_custom

shift_vv

shift_vx

shift_vv

shift_vx

shift_wv

shift_wx

shift_wi

cp_custom_shift_wi_all

x

Instruction vnclipu.wv vnclipu.wx vnclipu.wi vredsum.vs vwredsum.vs vwredsumu.vs vredmax.vs vredmaxu.vs vredmin.vs vredminu.vs vredand.vs vredor.vs

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW8

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW16

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW32

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW64

x

x

x

x

x

x

x

cp_asm_count

x

x

x

x

x

x

x

x

x

x

x

x

cp_vd

x

x

x

x

emul2

emul2

x

x

x

x

x

x

cp_vs2

emul2

emul2

emul2

x

x

x

x

x

x

x

x

x

cp_vs1

x

x

emul2

emul2

x

x

x

x

x

x

cp_rs1

x

cp_imm_5bit

u

cmp_vd_vs2

x

x

x

x

x

x

x

cmp_vd_vs1

x

x

emul2

emul2

x

x

x

x

x

x

cmp_vs1_vs2

x

x

x

x

x

x

x

cmp_vd_vs1_vs2

x

x

x

x

x

x

x

cp_vs2_edges

emul2

emul2

emul2

x

x

x

x

x

x

x

x

x

cp_vs1_edges

x

x

emul2

emul2

x

x

x

x

x

x

cr_vs2_vs1_edges

wv

x

wred

wred

x

x

x

x

x

x

cr_vxrm_vs2_vs1_edges

wv

cp_rs1_edges

x

cr_vs2_rs1_edges

wx

cr_vxrm_vs2_rs1_edges

wx

cr_vs2_imm_edges

wiu

cr_vxrm_vs2_imm_edges

wi

cp_masking_edges

x

x

x

x

x

x

x

x

x

x

x

x

cr_vl_lmul

lmul4max

lmul4max

lmul4max

x

lmul4max

lmul4max

x

x

x

x

x

x

cr_vtype_agnostic

lmul4max

lmul4max

lmul4max

x

lmul4max

lmul4max

x

x

x

x

x

x

cp_vl_0

x

x

x

x

x

x

x

x

x

x

x

x

std_vec

x

x

x

x

x

x

x

x

x

x

x

x

cp_custom

shift_wv

shift_wx

shift_wi

red

wred

wred

red

red

red

red

red

red

cp_custom_shift_wi_all

x

cp_custom_vreductionw

x

x

Instruction vredxor.vs vmand.mm vmnand.mm vmandn.mm vmxor.mm vmor.mm vmnor.mm vmorn.mm vmxnor.mm vcpop.m vfirst.m vmsbf.m

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW8

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW16

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW32

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW64

x

x

x

x

x

x

x

x

x

x

x

x

cp_asm_count

x

x

x

x

x

x

x

x

x

x

x

x

cp_vd

x

x

x

x

x

x

x

x

x

x

cp_rd

x

x

cp_vs2

x

x

x

x

x

x

x

x

x

x

x

x

cp_vs1

x

x

x

x

x

x

x

x

x

cmp_vd_vs2

x

x

x

x

x

x

x

x

x

cmp_vd_vs1

x

x

x

x

x

x

x

x

x

cmp_vs1_vs2

x

x

x

x

x

x

x

x

x

cmp_vd_vs1_vs2

x

x

x

x

x

x

x

x

x

cp_vs2_edges

x

eew1

eew1

eew1

eew1

eew1

eew1

eew1

eew1

eew1

eew1

eew1

cp_vs1_edges

x

eew1

eew1

eew1

eew1

eew1

eew1

eew1

eew1

cr_vs2_vs1_edges

x

mm

mm

mm

mm

mm

mm

mm

mm

cp_masking_edges

x

x

x

x

cr_vl_lmul

x

nomask

nomask

nomask

nomask

nomask

nomask

nomask

nomask

x

x

x

cr_vtype_agnostic

x

nomask

nomask

nomask

nomask

nomask

nomask

nomask

nomask

x

x

x

cp_vl_0

x

x

x

x

x

x

x

x

x

x

x

x

std_vec

x

x

x

x

x

x

x

x

x

x

x

x

cp_custom

red

maskwrite_unmasked

maskwrite_unmasked

maskwrite_unmasked

maskwrite_unmasked

maskwrite_unmasked

maskwrite_unmasked

maskwrite_unmasked

maskwrite_unmasked

gprwrite

gprwrite

maskwrite_unmasked

Instruction vmsif.m vmsof.m viota.m vid.v vmv.x.s vmv.s.x vslideup.vx vslideup.vi vslidedown.vx vslidedown.vi vslide1up.vx vslide1down.vx

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW8

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW16

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW32

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW64

x

x

x

x

x

x

x

x

x

x

x

x

cp_asm_count

x

x

x

x

x

x

x

x

x

x

x

x

cp_vd

x

x

x

x

x

x

x

x

x

x

x

cp_rd

x

cp_vs2

x

x

x

x

x

x

x

x

x

x

cp_rs1

x

x

x

x

x

cp_imm_5bit

u

u

cmp_vd_vs2

x

x

x

cp_vs2_edges

eew1

eew1

eew1

x

x

x

x

x

x

x

cp_rs1_edges

x

x

x

x

x

cr_vs2_rs1_edges

x

x

x

x

cr_vs2_imm_edges

u

u

cp_masking_edges

x

x

x

x

x

x

x

x

x

x

cr_vl_lmul

x

x

x

x

nomask

nomask

x

x

x

x

x

x

cr_vtype_agnostic

x

x

x

x

nomask

nomask

x

x

x

x

x

x

cp_vl_0

x

x

x

x

x

x

x

x

x

x

x

x

std_vec

x

x

x

x

x

cp_custom

maskwrite_unmasked

maskwrite_unmasked

vmv_x_s

vmv_s_x

vindexVX

Instruction vrgather.vv vrgather.vx vrgather.vi vrgatherei16.vv vcompress.vm vmv1r.v vmv2r.v vmv4r.v vmv8r.v

RV32

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

EFFEW8

x

x

x

x

x

x

x

x

x

EFFEW16

x

x

x

x

x

x

x

x

x

EFFEW32

x

x

x

x

x

x

x

x

x

EFFEW64

x

x

x

x

x

x

x

x

x

cp_asm_count

x

x

x

x

x

x

x

x

x

cp_vd

x

x

x

x

x

x

emul2

emul4

emul8

cp_vs2

x

x

x

x

x

x

emul2

emul4

emul8

cp_vs1

x

x

x

cp_rs1

x

cp_imm_5bit

u

cmp_vd_vs2

x

emul2

emul4

emul8

cmp_vs1_vs2

x

sew16

cp_vs2_edges

x

x

x

x

x

cp_vs1_edges

x

eew16

x

cr_vs2_vs1_edges

x

vs1_eew16

x

cp_rs1_edges

x

cr_vs2_rs1_edges

x

cr_vs2_imm_edges

u

cp_masking_edges

x

x

x

x

cr_vl_lmul

x

x

x

e16

nomask

nomask

nomask

nomask

nomask

cr_vtype_agnostic

x

x

x

e16

nomask

nomask

nomask

nomask

nomask

cp_vl_0

x

x

x

x

x

x

x

x

x

std_vec

x

x

x

cp_custom

vindexVV

vindexVX

vindexVV_ei16

cp_custom_vindexCorners

x

ei16

Table 127. Vx Normative Rules
Normative Rule Rule Text Coverpoints

elen

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.

Implicit

vlen

The number of bits in a single vector register, VLEN ≥ 8, which must be a power of 2, and must be no greater than 216.

Implicit: a fixed implementation parameter - every other coverpoint’s vl/lmul arithmetic implicitly depends on it being correct

hw_mstatus_vs_dirty_update

Implementations may also change mstatus.⁠VS or vsstatus.⁠VS from Initial or Clean to Dirty at any time, even when there is no change in vector state.

Untestable: whether an implementation opportunistically marks mstatus.VS/vsstatus.VS Dirty is a permissive implementation choice with no single correct answer to assert

reserved_vill_set

Implementations may set VILL in either case.

Untestable: Implementation Specific, Theoretically Implicit with Correct Sail Config

vreg_count

The vector extension adds 32 architectural vector registers, v0-v31 to the base scalar RISC-V ISA.

Vf16_vfmv_f_s_cg/cp_custom_fmv_fs_vs2_all_lmul_regs

mstatus_vs_op

The VS field encodes the status of the vector extension state, including the vector registers v0&#8205;&#8211;&#8205;v31 and the CSRs vcsr, vxrm, vxsat, vstart, vl, vtype, and vlenb.

Sm_V_cg/cp_vcsrs_walking1s, U_V_cg/cp_vcsrs_walking1s, S_V_cg/cp_vcsrs_walking1s, H_V_cg/cp_vcsrs_walking1s

mstatus_vs_sstatus_vs_op

A vector context status field, VS, is added to mstatus[10:9] and shadowed in sstatus[10:9]. It is defined analogously to the floating-point context status field, FS.

Sm_V_cg/{cp_mstatus_vs_set_dirty_arithmetic, cp_mstatus_vs_off_arithmetic}, U_V_cg/{cp_mstatus_vs_set_dirty_arithmetic, cp_mstatus_vs_off_arithmetic}, S_V_cg/{cp_sstatus_vs_set_dirty_arithmetic, cp_sstatus_vs_off_arithmetic}, H_V_cg/{cp_vsstatus_vs_set_dirty_arithmetic, cp_vsstatus_vs_off_arithmetic}

mstatus_vs_op_initial_clean

When mstatus.⁠VS is set to Initial or Clean, executing any instruction that changes vector state, including the vector CSRs, will change mstatus.⁠VS to Dirty. Implementations may also change mstatus.⁠VS from Initial or Clean to Dirty at any time, even when there is no change in vector state.

Sm_V_cg/cp_mstatus_vs_set_dirty_arithmetic, U_V_cg/cp_mstatus_vs_set_dirty_arithmetic, S_V_cg/cp_sstatus_vs_set_dirty_arithmetic, H_V_cg/cp_vsstatus_vs_set_dirty_arithmetic, Sm_V_cg/cp_mstatus_vs_set_dirty_csr, U_V_cg/cp_mstatus_vs_set_dirty_csr, S_V_cg/cp_sstatus_vs_set_dirty_csr, H_V_cg/cp_vsstatus_vs_set_dirty_csr

mstatus_vs_op_off

Attempts to execute any vector instruction, or to access the vector CSRs, raise an illegal-instruction exception when mstatus.⁠VS is set to Off.

Sm_V_cg/cp_mstatus_vs_off_arithmetic, U_V_cg/cp_mstatus_vs_off_arithmetic, S_V_cg/cp_sstatus_vs_off_arithmetic, H_V_cg/cp_vsstatus_vs_off_arithmetic

vsstatus_vs_mstatus_vs_op_active

When V=1 and neither vsstatus.⁠VS nor mstatus.⁠VS is set to Off, executing any instruction that changes vector state, including the vector CSRs, will change both mstatus.⁠VS and vsstatus.⁠VS to Dirty.

Sm_V_cg/cp_mstatus_vs_set_dirty_arithmetic, Sm_V_cg/cp_mstatus_vs_set_dirty_csr

vsstatus_vs_op

Similarly, when V=1, both vsstatus.VS and the HS-level sstatus.VS are in effect. Attempts to execute a vector instruction when either field is 0 (Off) raise an illegal-instruction exception. Modifying the vector state when V=1 causes both fields to be set to 3 (Dirty).

Untestable: requires the H extension configured; see mstatus_vs_op_off for the non-hypervisor form

vsstatus_sd_op_vs

If vsstatus.⁠VS is Dirty, vsstatus.⁠SD is 1; otherwise, vsstatus.⁠SD is set in accordance with existing specifications.

Untestable: vsstatus.SD is a CSR-layout consequence of VS state, not independently observable via a coverpoint

mstatus_sd_summary_op

summarizes whether either the FS, VS, or XS fields signal the presence of some dirty state that will require saving extended user context to memory.

Sm_mstatus_cg/cp_mstatus_sd_write

mstatus_sd_vs_dirty_op

If mstatus.⁠VS is Dirty, mstatus.⁠SD is 1; otherwise, mstatus.⁠SD is set in accordance with existing specifications.

Sm_mstatus_cg/cp_mstatus_sd_write

mstatus_sd_op_vs

If mstatus.⁠VS is Dirty, mstatus.⁠SD is 1; otherwise, mstatus.⁠SD is set in accordance with existing specifications.

Untestable: mstatus.SD is a CSR-layout consequence of VS state, not independently observable via a coverpoint

mutable_misa_v

Implementations may have a writable misa.⁠V field.

Sm_mcsr_cg/cp_misa_v

mstatus_vs_exists

Analogous to the way in which the floating-point unit is handled, the mstatus.⁠VS field may exist even if misa.⁠V is clear.

Untestable: field-existence-independent-of-misa.V is an implementation/config fact, not a runtime coverpoint

vsstatus_vs_exists

For implementations with a writable misa.⁠V field, the vsstatus.⁠VS field may exist even if misa.⁠V is clear.

Untestable: field-existence-independent-of-misa.V is an implementation/config fact, not a runtime coverpoint

vtype_sz_acc_op

The read-only XLEN-wide vector type CSR, vtype provides the default type used to interpret the contents of the vector register file, and can only be updated by VSETVLI, VSETIVLI, and VSETVL instructions.

Sm_V_cg/cp_sew_lmul_vset_i_vli, U_V_cg/cp_sew_lmul_vset_i_vli, S_V_cg/cp_sew_lmul_vset_i_vli, H_V_cg/cp_sew_lmul_vset_i_vli, Sm_V_cg/cp_sew_lmul_vsetvl, U_V_cg/cp_sew_lmul_vsetvl, S_V_cg/cp_sew_lmul_vsetvl, H_V_cg/cp_sew_lmul_vsetvl

vtype_fields_sz

The vtype register has five fields, VILL, VMA, VTA, VSEW, and VLMUL. Bits vtype[XLEN-2:8] should be written with zero, and non-zero values in this field are reserved.

Sm_V_cg/cp_sew_lmul_vsetvl, U_V_cg/cp_sew_lmul_vsetvl, S_V_cg/cp_sew_lmul_vsetvl, H_V_cg/cp_sew_lmul_vsetvl

vtype_vsew_op

The value in VSEW sets the dynamic selected element width (SEW). By default, a vector register is viewed as being divided into VLEN/SEW elements.

Sm_V_cg/cp_sew_lmul_vset_i_vli, U_V_cg/cp_sew_lmul_vset_i_vli, S_V_cg/cp_sew_lmul_vset_i_vli, H_V_cg/cp_sew_lmul_vset_i_vli, Vf16_vfadd_vf_cg/cr_vl_lmul_sew16

vtype_lmul_val

Implementations must support LMUL integer values of 1, 2, 4, and 8.

Vf16_vfadd_vf_cg/cr_vl_lmul_sew16, Sm_V_cg/cp_sew_lmul_vset_i_vli, U_V_cg/cp_sew_lmul_vset_i_vli, S_V_cg/cp_sew_lmul_vset_i_vli, H_V_cg/cp_sew_lmul_vset_i_vli

vtype_lmul_fval

Implementations must provide fractional LMUL settings that allow the narrowest supported type to occupy a fraction of a vector register corresponding to the ratio of the narrowest supported type’s width to the smaller of VLEN and the largest supported type’s width. In general, the requirement is to support LMUL ≥ SEWMIN/min(ELEN, VLEN), where SEWMIN is the narrowest supported SEW value, ELEN is the widest supported SEW value and VLEN is the number of bits in a vector register. In the standard extensions, SEWMIN=8. For vector extensions with ELEN=32, fractional LMULs of 1/2 and 1/4 must be supported. For vector extensions with ELEN=64 and ELEN ≤ VLEN, fractional LMULs of 1/2, 1/4, and 1/8 must be supported. For vector extensions with SEWMIN=8, ELEN=64 and VLEN=32, fractional LMULs of 1/2 and 1/4 must be supported.

Vf16_vfadd_vf_cg/cr_vl_lmul_sew16, Sm_V_cg/cp_sew_lmul_vset_i_vli, U_V_cg/cp_sew_lmul_vset_i_vli, S_V_cg/cp_sew_lmul_vset_i_vli, H_V_cg/cp_sew_lmul_vset_i_vli

vtype_sew_val

For a given supported fractional LMUL setting, implementations must support SEW settings between SEWMIN and LMUL * min(ELEN, VLEN), inclusive.

Sm_V_cg/cp_sew_lmul_vset_i_vli, U_V_cg/cp_sew_lmul_vset_i_vli, S_V_cg/cp_sew_lmul_vset_i_vli, H_V_cg/cp_sew_lmul_vset_i_vli

vtype_lmul_fval_rsv

The use of vtype encodings with LMUL < SEWMIN/min(ELEN, VLEN) is reserved, but implementations can set VILL if they do not support these configurations.

Sm_V_cg/cp_vtype_vill_set_vl_0, U_V_cg/cp_vtype_vill_set_vl_0, S_V_cg/cp_vtype_vill_set_vl_0, H_V_cg/cp_vtype_vill_set_vl_0

lmul

LMUL is set by the signed VLMUL field in vtype (i.e., LMUL = 2csr::[vlmul]).

Vf16_vfadd_vf_cg/cr_vl_lmul_sew16

vlmax

The derived value VLMAX = LMUL*VLEN/SEW represents the maximum number of elements that can be operated on with a single vector instruction given the current SEW and LMUL settings as shown in the table below.

Vx16_vrgather_vv_cg/cp_custom_vindexCorners_index_ge_vlmax, Vx16_vrgather_vv_cg/cp_custom_vindexCorners_index_gt_vl_lt_vlmax

vreg_offgroup_lmul2_rsv

Instructions specifying an LMUL=2 vector register group with an odd-numbered vector register are reserved.

Out-of-Scope: reserved behavior that depends on prior CSR state is unspecified and outside Ssstrict’s encoding-only methodology

vreg_offgroup_lmul4_rsv

instructions specifying an LMUL=4 vector register group using vector register numbers that are not multiples of four are reserved.

Out-of-Scope: reserved behavior that depends on prior CSR state is unspecified and outside Ssstrict’s encoding-only methodology

vreg_offgroup_lmul8_rsv

instructions specifying an LMUL=8 vector register group using register numbers that are not multiples of eight are reserved.

Out-of-Scope: reserved behavior that depends on prior CSR state is unspecified and outside Ssstrict’s encoding-only methodology

vreg_mask_lmul_indp

Mask registers are always contained in a single vector register, regardless of LMUL.

Vls16_vlm_v_cg/cp_custom_maskLS_emul_ge_16, Vx16_vmadc_vi_cg/cp_custom_vmask_write_lmulge1

vtype_vta_vma_op

These two bits modify the behavior of destination tail elements and destination inactive masked-off elements respectively during the execution of vector instructions. The tail and inactive sets contain element positions that are not receiving new results during a vector operation, as defined in sec-inactive-defs.

Vf16_vfadd_vf_cg/cr_vtype_agnostic

vtype_vta_vma_val

All systems must support all four options:

Vf16_vfadd_vf_cg/cr_vtype_agnostic

vreg_mask_tail_agn

Mask destination tail elements are always treated as tail-agnostic, regardless of the setting of VTA.

Vx8_vmor_mm_cg/cr_vtype_agnostic_nomask

vreg_mask_op

When a set is marked undisturbed, the corresponding set of destination elements in a vector register group retain the value they previously held.

Vf16_vfadd_vf_cg/cp_masking_edges

vreg_agnostic_op

When a set is marked agnostic, the corresponding set of destination elements in any vector destination operand can either retain the value they previously held, or are overwritten with 1s. Within a single vector instruction, each destination element can be either left undisturbed or overwritten with 1s, in any combination, and the pattern of undisturbed or overwritten with 1s is not required to be deterministic when the instruction is executed with the same inputs.

Vf16_vfadd_vf_cg/cp_masking_edges

vreg_mask_tail_op

In addition, except for mask load instructions, any element in the tail of a mask result can also be written with the value the mask-producing operation would have calculated with vl=VLMAX. Furthermore, for mask-logical instructions and VMSBF.M, VMSIF.M, VMSOF.M mask-manipulation instructions, any element in the tail of the result can be written with the value the mask-producing operation would have calculated with vl=VLEN, SEW=8, and LMUL=8 (i.e., all bits of the mask register can be overwritten).

Vx16_vmseq_vv_cg/cr_vtype_agnostic

vtype_vill_op

If the VILL bit is set, then any attempt to execute a vector instruction that depends upon vtype will raise an illegal-instruction exception.

ExceptionsVx_vsaddu_vv_cg/cp_vill

vl_acc

The XLEN-bit-wide read-only vl CSR can only be updated by the VSET* instructions, and the fault-only-first vector load instruction variants.

Sm_V_cg/cp_vsetvl_i_rd_nx0_rs1_x0, U_V_cg/cp_vsetvl_i_rd_nx0_rs1_x0, S_V_cg/cp_vsetvl_i_rd_nx0_rs1_x0, H_V_cg/cp_vsetvl_i_rd_nx0_rs1_x0, Vls16_vle16ff_v_cg/cp_custom_ffLS_update_vl

vl_op

The vl register holds an unsigned integer specifying the number of elements to be updated with results from a vector instruction, as further detailed in sec-inactive-defs.

Vf16_vfadd_vf_cg/cr_vl_lmul_sew16, Vf16_vfadd_vf_cg/cp_vl_0

vlenb_acc_op

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

Sm_V_cg/cp_vcsrrswc, U_V_cg/cp_vcsrrswc, S_V_cg/cp_vcsrrswc, H_V_cg/cp_vcsrrswc

vstart_acc_sz

The XLEN-bit-wide read-write vstart CSR specifies the index of the first element to be executed by a vector instruction, as described in sec-inactive-defs.

Sm_V_cg/cp_vcsrs_walking1s, U_V_cg/cp_vcsrs_walking1s, S_V_cg/cp_vcsrs_walking1s, H_V_cg/cp_vcsrs_walking1s, Sm_V_cg/cp_vstart_out_of_bounds, U_V_cg/cp_vstart_out_of_bounds, S_V_cg/cp_vstart_out_of_bounds, H_V_cg/cp_vstart_out_of_bounds

vstart_op

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

Vx16_vcpop_m_cg/cp_custom_gprWriting_vstart_eq_vl, ExceptionsVls_vle8_v_cg/cp_vstart

vstart_update

reset the vstart CSR to zero at the end of execution.

vstart_unmodified

vstart is not modified by vector instructions that raise illegal-instruction exceptions.

vstart_sz_writable

The vstart CSR is defined to have only enough writable bits to hold the largest element index (one less than the maximum VLMAX).

Sm_V_cg/cp_vstart_out_of_bounds, U_V_cg/cp_vstart_out_of_bounds, S_V_cg/cp_vstart_out_of_bounds, H_V_cg/cp_vstart_out_of_bounds

vstart_val_rsv

The use of vstart values greater than the largest element index for the current vtype setting is reserved.

ExceptionsVx_vsaddu_vv_cg/cp_vstart_gt_vl

vstart_vtype_dep

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.

Untestable: implementations are permitted, not required, to raise this exception, so no behavior can be asserted

vxrm_val_sz_acc

The vector fixed-point rounding-mode register holds a two-bit read-write rounding-mode field in the least-significant bits (vxrm[1:0]). The upper bits, vxrm[XLEN-1:2], should be written as zeros.

Sm_V_cg/cp_vcsrs_walking1s, U_V_cg/cp_vcsrs_walking1s, S_V_cg/cp_vcsrs_walking1s, H_V_cg/cp_vcsrs_walking1s, Vx16_vaadd_vv_cg/cr_vxrm_vs2_vs1_edges, Vx16_vaadd_vx_cg/cr_vxrm_vs2_rs1_edges, Vx16_vssra_vi_cg/cr_vxrm_vs2_imm_edges

vcsr_vxrm_op

The vector fixed-point rounding-mode is given a separate CSR address to allow independent access, but is also reflected as a field in vcsr.

Sm_V_cg/cp_vcsrrswc, U_V_cg/cp_vcsrrswc, S_V_cg/cp_vcsrrswc, H_V_cg/cp_vcsrrswc

vxrm_op

The fixed-point rounding algorithm is specified as follows. Suppose the pre-rounding result is v, and d bits of that result are to be rounded off. Then the rounded result is (v >> d) + r, where r depends on the rounding mode as specified in the following table.

Vx16_vaadd_vx_cg/cr_vxrm_vs2_rs1_edges, Vx16_vssra_vi_cg/cr_vxrm_vs2_imm_edges, Vx16_vaadd_vv_cg/cr_vxrm_vs2_vs1_edges

vxsat_op_acc_sz

The vxsat CSR has a single read-write least-significant bit (vxsat[0]) that indicates if a fixed-point instruction has had to saturate an output value to fit into a destination format. The remaining bits, vxsat[XLEN-1:1], should be written as zeros.

Sm_V_cg/cp_vcsrs_walking1s, U_V_cg/cp_vcsrs_walking1s, S_V_cg/cp_vcsrs_walking1s, H_V_cg/cp_vcsrs_walking1s, Vx16_vsaddu_vv_cg/cp_csr_vxsat

vcsr_vxsat_op

The vxsat bit is mirrored in vcsr.

Sm_V_cg/cp_vcsrrswc, U_V_cg/cp_vcsrrswc, S_V_cg/cp_vcsrrswc, H_V_cg/cp_vcsrrswc

vcsr_vxrm_vxsat_acc

The vxrm and vxsat separate CSRs can also be accessed via fields in the XLEN-bit-wide vector control and status CSR, vcsr.

Sm_V_cg/cp_vcsrrswc, U_V_cg/cp_vcsrrswc, S_V_cg/cp_vcsrrswc, H_V_cg/cp_vcsrrswc

vreg_lmul1_op

When LMUL=1, elements are simply packed in order from the least-significant to most-significant bits of the vector register.

Vx16_vadd_vv_cg/cp_vd

vreg_flmul_op

When LMUL < 1, only the first LMUL*VLEN/SEW elements in the vector register are used. The remaining space in the vector register is treated as part of the tail, and hence must obey the vta setting.

Vf16_vfadd_vf_cg/cr_vl_lmul_sew16

vreg_lmulge2_op

When vector registers are grouped, the elements of the vector register group are packed contiguously in element order beginning with the lowest-numbered vector register and moving to the next-highest-numbered vector register in the group once each vector register is filled.

Vx16_vsext_vf2_cg/cp_custom_vext2_overlapping_vd_vs2_lmul4, Vx16_vsext_vf2_cg/cp_custom_vext2_overlapping_vd_vs2_lmul8, Vx64_vsext_vf8_cg/cp_custom_vext8_overlapping_vd_vs2_lmul8, Vx16_vwaddu_vv_cg/cp_custom_vdOverlapTopVs1_vd_vs1_lmul4, Vx16_vwaddu_vv_cg/cp_custom_vdOverlapTopVs2_vd_vs2_lmul4, Vx16_vwadd_vv_cg/cp_custom_allVdOverlapTopVs2_vd_vs2_lmul2, Vf16_vfadd_vf_cg/cr_vl_lmul_sew16

vreg_mask_vtype_indp

A vector mask occupies only one vector register regardless of SEW and LMUL.

Vls16_vlm_v_cg/cp_custom_maskLS_emul_ge_16, Vx16_vmadc_vi_cg/cp_custom_vmask_write_lmulge1

vreg_mask_sz

Each element is allocated a single mask bit in a mask vector register. The mask bit for element i is located in bit i of the mask register, independent of SEW or LMUL.

Vf16_vfadd_vf_cg/cp_masking_edges

vreg_scalar_lmul_indp

Any vector register can be used to hold a scalar regardless of the current LMUL setting.

Vf16_vfmv_s_f_cg/cp_custom_fmv_sf_vd_all_lmul_regs, Vf16_vfmv_f_s_cg/cp_custom_fmv_fs_vs2_all_lmul_regs, Vx16_vmv_s_x_cg/cp_custom_voffgroup_vd_lmul2, Vx16_vredand_vs_cg/cp_custom_voffgroup_vs1_lmul2, Vx16_vmv_x_s_cg/cp_custom_voffgroup_vs2_lmul2, Vx16_vmv_s_x_cg/cp_custom_voffgroup_vd_lmul4, Vx16_vmv_s_x_cg/cp_custom_voffgroup_vd_lmul8, Vx16_vwredsum_vs_cg/cp_custom_vreductionw_vd_vs1_emul_16

eew_emul

Each vector operand has an effective element width (EEW) and an effective LMUL (EMUL) that is used to determine the size and location of all the elements within a vector register group. By default, for most operands of most instructions, EEW=SEW and EMUL=LMUL.

Vx16_vaadd_vv_cg/cp_vs2_edges, Vx16_vwadd_vv_cg/cp_custom_allVdOverlapTopVs2_vd_vs2_lmul2, Vx16_vwadd_wv_cg/cr_vl_lmul_lmul4max_sew16, Vx16_vsext_vf2_cg/cp_custom_vext2_overlapping_vd_vs2_lmul4

eew_emul_sew_lmul_dep

EEW/EMUL = SEW/LMUL.

Vx16_vwadd_wv_cg/cr_vl_lmul_lmul4max_sew16, Vx16_vsext_vf2_cg/cp_custom_vext2_overlapping_vd_vs2_lmul4

vnarrowing_eew_emul

Narrowing instructions have a source operand that has EEW=2*SEW and EMUL=2*LMUL but with a destination where EEW=SEW and EMUL=LMUL.

Vx16_vnclip_wi_cg/cp_custom_vdOverlapBtmVs2_vd_vs2_lmul2, Vx16_vnclip_wi_cg/cp_custom_allVdOverlapBtmVs2_vd_vs2_lmul2, Vx16_vnclip_wi_cg/cr_vl_lmul_lmul4max_sew16

emul_offgroup_rsv

Using other than the lowest-numbered vector register to specify a vector register group is a reserved encoding.

Out-of-Scope: this behavior is unspecified even under Ssstrict, which does not cover CSR-state-dependent reserved conditions

vreg_source_eew_rsv

A vector register cannot be used to provide source operands with more than one EEW for a single instruction. A mask register source is considered to have EEW=1 for this constraint. An encoding that would result in the same vector register being read with two or more different EEWs, including when the vector register appears at different positions within two or more vector register groups, is reserved.

SsstrictV_vwadd_wv_cg/cp_ssstrictv_widening_source_overlap

vreg_overlap_legal

A destination vector register group can overlap a source vector register group only if one of the following holds:

Vx16_vsext_vf2_cg/cp_custom_vext2_overlapping_vd_vs2_lmul4, Vx32_vsext_vf4_cg/cp_custom_vext4_overlapping_vd_vs2_lmul4, Vx64_vsext_vf8_cg/cp_custom_vext8_overlapping_vd_vs2_lmul8, Vx16_vwaddu_vv_cg/cp_custom_vdOverlapTopVs1_vd_vs1_lmul2, Vx16_vwaddu_vv_cg/cp_custom_vdOverlapTopVs2_vd_vs2_lmul2, Vx16_vwadd_vv_cg/cp_custom_allVdOverlapTopVs1_vd_vs1_lmul2, Vx16_vwadd_vv_cg/cp_custom_allVdOverlapTopVs2_vd_vs2_lmul2, Vx16_vnclip_wi_cg/cp_custom_vdOverlapBtmVs2_vd_vs2_lmul2, Vf16_vfadd_vf_cg/cmp_vd_vs2, Vf16_vfadd_vv_cg/cmp_vd_vs1, Vf16_vfadd_vv_cg/cmp_vs1_vs2, Vf16_vfadd_vv_cg/cmp_vd_vs1_vs2, Vls16_vsoxei16_v_cg/cmp_vs3_vs2_eew_eq_sew

vreg_mask_overlap

For the purpose of determining register group overlap constraints, mask elements have EEW=1.

SsstrictV_vwadd_wv_cg/cp_ssstrictv_masking_vd_eq_v0

vreg_overlap_rsv

Any instruction encoding that violates the overlap constraints is reserved.

SsstrictV_vwadd_wv_cg/cp_ssstrictv_widening_source_overlap

vreg_overlap_agn

When source and destination registers overlap and have different EEW, the instruction is mask- and tail-agnostic, regardless of the setting of the VTA and VMA bits in vtype.

Vx16_vnclip_wi_cg/cp_masking_edges

emul_rsv

The largest vector register group used by an instruction can not be greater than 8 vector registers (i.e., EMUL≤8), and if a vector instruction would require greater than 8 vector registers in a group, the instruction encoding is reserved. For example, a widening operation that produces a widened vector register group result when LMUL=8 is reserved as this would imply a result EMUL=16.

Out-of-Scope: reserved behavior that is not covered by Ssstrict

vreg_scalar_emul

Widened scalar values, e.g., input and output to a widening reduction operation, are held in the first element of a vector register and have EMUL=1. If an implementation supports EEW > VLEN, EEW-wide widened scalar values are held in a vector register group with EMUL = EEW/VLEN.

Vx16_vwredsum_vs_cg/cp_custom_vreductionw_vd_vs1_emul_16

vmask_inactive_op

Element operations that are masked off (inactive) never generate exceptions.

Vf16_vfrsqrt7_v_cg/cp_custom_vfp_flags_inactive_not_set, Vf16_vfadd_vf_cg/cp_masking_edges

vmask_agn_op

The destination vector register elements corresponding to masked-off elements are handled with either a mask-undisturbed or mask-agnostic policy depending on the setting of the VMA bit in vtype

Vf16_vfrsqrt7_v_cg/cp_custom_vfp_flags_inactive_not_set, Vf16_vfadd_vf_cg/cp_masking_edges

vmask_vm_enc

Where available, masking is encoded in a single-bit vm field in the instruction (inst[25]).

Implicit: the vm field encoding is exercised by every masked and unmasked vector instruction the suite runs

vreg_vmask

The mask value used to control execution of a masked vector instruction is always supplied by vector register v0.

Vls16_vloxei16_v_cg/cp_masking_edges, Vf16_vfadd_vf_cg/cp_masking_edges

vreg_vmask_rsv

The destination vector register group for a masked vector instruction cannot overlap the source mask register (v0), unless the destination vector register is being written with a mask value (e.g., compares) or the scalar result of a reduction. These instruction encodings are reserved.

SsstrictV_vadd_vv_cg/cp_ssstrictv_masking_vd_eq_v0

vstart_vl_dep

When vstart ≥ vl, there are no body elements, and no elements are updated in any destination vector register group, including that no tail elements are updated with agnostic values.

ExceptionsVx_vsaddu_vv_cg/cp_vstart_gt_vl

vstart_vl_scalar_indp

Instructions that write an x register or f register do so even when vstart ≥ vl, including when vl=0.

Vx16_vcpop_m_cg/cp_custom_gprWriting_vstart_eq_vl

vector_prestart_element

The prestart elements do not raise exceptions and do not update the destination vector register.

ExceptionsVls_vle8_v_cg/cp_vstart

vector_inactive_element

The inactive elements do not raise exceptions and do not update any destination vector register group unless masked agnostic is specified (vtype.⁠VMA=1), in which case inactive elements may be overwritten with 1s.

Vf16_vfadd_vf_cg/cr_vtype_agnostic, Vf16_vfrsqrt7_v_cg/cp_custom_vfp_flags_inactive_not_set, Vx16_vadd_vv_cg/cp_masking_edges

vector_tail_element

The tail elements do not raise exceptions, and do not update any destination vector register group unless tail agnostic is specified (vtype.⁠VTA=1), in which case tail elements may be overwritten with 1s, or with the result of the instruction in the case of mask-producing instructions except for mask loads. When LMUL < 1, the tail includes the elements past VLMAX that are held in the same vector register.

Vf16_vfadd_vf_cg/cp_vl_0, Vf16_vfadd_vf_cg/cp_masking_edges

vset_op

The VSETVLI, VSETIVLI, and VSETVL instructions set the vtype and vl CSRs based on their arguments, and write the new value of vl into rd.

Sm_V_cg/cp_sew_lmul_vsetvl, U_V_cg/cp_sew_lmul_vsetvl, S_V_cg/cp_sew_lmul_vsetvl, H_V_cg/cp_sew_lmul_vsetvl, Sm_V_cg/cp_sew_lmul_vset_i_vli, U_V_cg/cp_sew_lmul_vset_i_vli, S_V_cg/cp_sew_lmul_vset_i_vli, H_V_cg/cp_sew_lmul_vset_i_vli, Sm_V_cg/cp_vsetvl_i_avl_eq_vlmax, U_V_cg/cp_vsetvl_i_avl_eq_vlmax, S_V_cg/cp_vsetvl_i_avl_eq_vlmax, H_V_cg/cp_vsetvl_i_avl_eq_vlmax, Sm_V_cg/cp_vsetivli_avl_edges, U_V_cg/cp_vsetivli_avl_edges, S_V_cg/cp_vsetivli_avl_edges, H_V_cg/cp_vsetivli_avl_edges

vtype_vstart_op

the vl register is also set to zero.

Sm_V_cg/cp_sew_lmul_vset_i_vli, U_V_cg/cp_sew_lmul_vset_i_vli, S_V_cg/cp_sew_lmul_vset_i_vli, H_V_cg/cp_sew_lmul_vset_i_vli, Sm_V_cg/cp_sew_lmul_vsetvl, U_V_cg/cp_sew_lmul_vsetvl, S_V_cg/cp_sew_lmul_vsetvl, H_V_cg/cp_sew_lmul_vsetvl, Sm_V_cg/cp_vtype_vill_set_vl_0, U_V_cg/cp_vtype_vill_set_vl_0, S_V_cg/cp_vtype_vill_set_vl_0, H_V_cg/cp_vtype_vill_set_vl_0

vtype_acc

The new vtype value is encoded in the immediate fields of VSETVLI and VSETIVLI, and in the rs2 register for VSETVL.

Sm_V_cg/cp_sew_lmul_vset_i_vli, U_V_cg/cp_sew_lmul_vset_i_vli, S_V_cg/cp_sew_lmul_vset_i_vli, H_V_cg/cp_sew_lmul_vset_i_vli, Sm_V_cg/cp_sew_lmul_vsetvl, U_V_cg/cp_sew_lmul_vsetvl, S_V_cg/cp_sew_lmul_vsetvl, H_V_cg/cp_sew_lmul_vsetvl

vtype_vill_val

If the vtype value is not supported by the implementation, then the VILL bit is set in vtype, the remaining bits in vtype are set to zero

Vls16_vl1re16_v_cg/cp_custom_vwholeRegLS_vill, Sm_V_cg/cp_vill_vsetvl, U_V_cg/cp_vill_vsetvl, S_V_cg/cp_vill_vsetvl, H_V_cg/cp_vill_vsetvl

vtype_vill_val_vill

A vtype value with VILL set is treated as an unsupported configuration.

Vls16_vl1re16_v_cg/cp_custom_vwholeRegLS_vill, Sm_V_cg/cp_vill_vsetvl, U_V_cg/cp_vill_vsetvl, S_V_cg/cp_vill_vsetvl, H_V_cg/cp_vill_vsetvl

vtype_vill_all_bits

Implementations must consider all bits of the vtype value to determine if the configuration is supported. An unsupported value in any location within the vtype value must result in VILL being set.

Vls16_vl1re16_v_cg/cp_custom_vwholeRegLS_vill, Sm_V_cg/cp_vill_vsetvl, U_V_cg/cp_vill_vsetvl, S_V_cg/cp_vill_vsetvl, H_V_cg/cp_vill_vsetvl

vsetvl_op

When rs1 is not x0, the AVL is an unsigned integer held in the x register specified by rs1, and the new vl value is also written to the x register specified by rd.

Sm_V_cg/cp_vsetvl_i_rd_x0_rs1_x0, U_V_cg/cp_vsetvl_i_rd_x0_rs1_x0, S_V_cg/cp_vsetvl_i_rd_x0_rs1_x0, H_V_cg/cp_vsetvl_i_rd_x0_rs1_x0, Sm_V_cg/cp_vsetvl_i_rd_nx0_rs1_x0, U_V_cg/cp_vsetvl_i_rd_nx0_rs1_x0, S_V_cg/cp_vsetvl_i_rd_nx0_rs1_x0, H_V_cg/cp_vsetvl_i_rd_nx0_rs1_x0, Sm_V_cg/cp_vsetvl_i_avl_eq_zero, U_V_cg/cp_vsetvl_i_avl_eq_zero, S_V_cg/cp_vsetvl_i_avl_eq_zero, H_V_cg/cp_vsetvl_i_avl_eq_zero, Sm_V_cg/cp_vsetvl_i_avl_eq_vlmax, U_V_cg/cp_vsetvl_i_avl_eq_vlmax, S_V_cg/cp_vsetvl_i_avl_eq_vlmax, H_V_cg/cp_vsetvl_i_avl_eq_vlmax, Sm_V_cg/cp_vsetvl_i_avl_lt_2x_vlmax, U_V_cg/cp_vsetvl_i_avl_lt_2x_vlmax, S_V_cg/cp_vsetvl_i_avl_lt_2x_vlmax, H_V_cg/cp_vsetvl_i_avl_lt_2x_vlmax, Sm_V_cg/cp_vsetvl_i_avl_eq_2x_vlmax, U_V_cg/cp_vsetvl_i_avl_eq_2x_vlmax, S_V_cg/cp_vsetvl_i_avl_eq_2x_vlmax, H_V_cg/cp_vsetvl_i_avl_eq_2x_vlmax, Sm_V_cg/cp_vsetvl_i_avl_gt_2x_vlmax, U_V_cg/cp_vsetvl_i_avl_gt_2x_vlmax, S_V_cg/cp_vsetvl_i_avl_gt_2x_vlmax, H_V_cg/cp_vsetvl_i_avl_gt_2x_vlmax

vsetvl_op_rs1_x0_rd_nx0

When rs1=x0 but rd≠x0, the maximum unsigned integer value (~0) is used as the AVL, and the resulting VLMAX is written to vl and also to the x register specified by rd.

Sm_V_cg/cp_vsetvl_i_rd_nx0_rs1_x0, U_V_cg/cp_vsetvl_i_rd_nx0_rs1_x0, S_V_cg/cp_vsetvl_i_rd_nx0_rs1_x0, H_V_cg/cp_vsetvl_i_rd_nx0_rs1_x0

vsetvl_op_rs1_x0_rd_x0

When rs1=x0 and rd=x0, the instructions operate as if the current vector length in vl is used as the AVL, and the resulting value is written to vl, but not to a destination register. This form can only be used when VLMAX and hence vl is not actually changed by the new SEW/LMUL ratio.

Sm_V_cg/cp_vsetvl_i_rd_x0_rs1_x0, U_V_cg/cp_vsetvl_i_rd_x0_rs1_x0, S_V_cg/cp_vsetvl_i_rd_x0_rs1_x0, H_V_cg/cp_vsetvl_i_rd_x0_rs1_x0

vtype_vset_rsv

Use of the instructions with a new SEW/LMUL ratio that would result in a change of VLMAX is reserved. Use of the instructions is also reserved if VILL was 1 beforehand.

Out-of-Scope: we cannot test reserved behavior that depends on prior vill state; outside Ssstrict’s encoding-only methodology

vsetivli_op

For the VSETIVLI instruction, the AVL is encoded as a 5-bit zero-extended immediate (0—​31) in the rs1 field.

Sm_V_cg/cp_vsetivli_avl_edges, U_V_cg/cp_vsetivli_avl_edges, S_V_cg/cp_vsetivli_avl_edges, H_V_cg/cp_vsetivli_avl_edges

vl_val_lead_in

The VSET* instructions first set VLMAX according to their vtype argument, then set vl obeying the following constraints:

Sm_V_cg/cp_vsetvl_i_avl_eq_vlmax, U_V_cg/cp_vsetvl_i_avl_eq_vlmax, S_V_cg/cp_vsetvl_i_avl_eq_vlmax, H_V_cg/cp_vsetvl_i_avl_eq_vlmax, Sm_V_cg/cp_vsetvl_i_avl_lt_2x_vlmax, U_V_cg/cp_vsetvl_i_avl_lt_2x_vlmax, S_V_cg/cp_vsetvl_i_avl_lt_2x_vlmax, H_V_cg/cp_vsetvl_i_avl_lt_2x_vlmax, Sm_V_cg/cp_vsetvl_i_avl_gt_2x_vlmax, U_V_cg/cp_vsetvl_i_avl_gt_2x_vlmax, S_V_cg/cp_vsetvl_i_avl_gt_2x_vlmax, H_V_cg/cp_vsetvl_i_avl_gt_2x_vlmax, Sm_V_cg/cp_vsetvl_i_avl_eq_zero, U_V_cg/cp_vsetvl_i_avl_eq_zero, S_V_cg/cp_vsetvl_i_avl_eq_zero, H_V_cg/cp_vsetvl_i_avl_eq_zero

vl_val_list

vl = AVL if AVL ≤ VLMAX ceil(AVL / 2) ≤ vl ≤ VLMAX if AVL < (2 * VLMAX) vl = VLMAX if AVL ≥ (2 * VLMAX) Deterministic on any given implementation for same input AVL and VLMAX values These specific properties follow from the prior rules: vl = 0 if AVL = 0 vl > 0 if AVL > 0 vl ≤ VLMAX vl ≤ AVL a value read from vl when used as the AVL argument to VSET* results in the same value in vl, provided the resultant VLMAX equals the value of VLMAX at the time that vl was read

Sm_V_cg/cp_vsetvl_i_avl_eq_vlmax, U_V_cg/cp_vsetvl_i_avl_eq_vlmax, S_V_cg/cp_vsetvl_i_avl_eq_vlmax, H_V_cg/cp_vsetvl_i_avl_eq_vlmax, Sm_V_cg/cp_vsetvl_i_avl_lt_2x_vlmax, U_V_cg/cp_vsetvl_i_avl_lt_2x_vlmax, S_V_cg/cp_vsetvl_i_avl_lt_2x_vlmax, H_V_cg/cp_vsetvl_i_avl_lt_2x_vlmax, Sm_V_cg/cp_vsetvl_i_avl_gt_2x_vlmax, U_V_cg/cp_vsetvl_i_avl_gt_2x_vlmax, S_V_cg/cp_vsetvl_i_avl_gt_2x_vlmax, H_V_cg/cp_vsetvl_i_avl_gt_2x_vlmax, Sm_V_cg/cp_vsetvl_i_avl_eq_zero, U_V_cg/cp_vsetvl_i_avl_eq_zero, S_V_cg/cp_vsetvl_i_avl_eq_zero, H_V_cg/cp_vsetvl_i_avl_eq_zero

vector_ls_vstart

All vector loads and stores may generate and accept a non-zero vstart value.

ExceptionsVls_vle8_v_cg/cp_vstart

vector_ls_base_stride_regtype

Vector load/store base registers and strides are taken from the x registers.

Vls16_vlse16_v_cg/cp_rs1_nx0, Vls16_vlse16_v_cg/cp_rs2

vector_ls_base

The base effective address for all vector accesses is given by the contents of the x register named in rs1.

Vls16_vle8_v_cg/cp_rs1_nx0, Vls16_vse8_v_cg/cp_rs1_nx0

vector_ls_unit_stride_op

Vector unit-stride operations access elements stored contiguously in memory starting from the base effective address.

Vls16_vle8_v_cg/cp_vd

vector_ls_constant_stride_op

Vector constant-stride operations access the first memory element at the base effective address, and then access subsequent elements at address increments given by the byte offset contained in the x register specified by rs2.

Vls16_vlse8_v_cg/cp_rs2

vector_ls_strided_eew

Vector memory unit-stride and constant-stride operations directly encode EEW of the data to be transferred statically in the instruction to reduce the number of vtype changes when accessing memory in a mixed-width routine.

{Vls16_vlse16_v_cg,Vls32_vlse32_v_cg,Vls64_vlse64_v_cg}/cp_asm_count

vector_ls_seg_unit_stride_vd_vs3

For loads, the vd register will hold the first field loaded from the segment. For stores, the vs3 register is read to provide the first field to be stored to each segment.

Vls16_vlseg2e8_v_cg/cp_vd_lte30, Vls16_vsseg2e8_v_cg/cp_vs3_lte30

vector_ls_scalar_misaligned_independence

Support for misaligned vector memory accesses is independent of an implementation’s support for misaligned scalar memory accesses.

Untestable: independence from the scalar misaligned-access implementation cannot be observed from a self-checking test

vector_ls_scalar_misaligned_dependence

Vector misaligned memory accesses follow the same rules for atomicity as scalar misaligned memory accesses.

Not Tested: atomicity of misaligned vector accesses is not exercised by this suite

vector_ls_seg_indexed_unordered

However, even for the ordered form, accesses to the fields within an individual segment are not ordered with respect to each other.

Untestable: memory-ordering guarantees are not observable from a single-hart self-checking signature

vector_ff_op

If element 0 raises an exception, vl is not modified, and the trap is taken. If an element > 0 raises an exception, the corresponding trap is not taken, and the vector length vl is reduced to the index of the element that would have raised an exception.

Vls16_vle8ff_v_cg/cp_custom_ffLS_update_vl

vector_ls_indexed_op

Vector indexed operations add the contents of each element of the vector offset operand specified by vs2 to the base effective address to give the effective address of each element. The data vector register group has EEW=SEW, EMUL=LMUL, while the offset vector register group has EEW encoded in the instruction and EMUL=(EEW/SEW)*LMUL.

Vls16_vloxei16_v_cg/cp_vs2, Vls16_vloxei16_v_cg/cp_vs2_edges_ls

vector_ls_indexed_eew

Indexed operations use the explicit EEW encoding in the instruction to set the size of the indices used, and use SEW/LMUL to specify the data width.

{Vls8_vloxei16_v_cg,Vls16_vloxei16_v_cg,Vls32_vloxei16_v_cg,Vls64_vloxei16_v_cg}/cp_asm_count

vector_ls_ins_req

Implementations must provide vector loads and stores with EEWs corresponding to all supported SEW settings.

{Vls8_vle8_v_cg,Vls16_vle16_v_cg,Vls32_vle32_v_cg,Vls64_vle64_v_cg}/cp_asm_count

vector_ls_ins_rsv

Vector load/store encodings for unsupported EEW widths are reserved.

SsstrictV_vle8_v_cg/cp_ssstrictv_ls_eew_lt_sewmin

vector_ls_bytewise

The vector offset operand is treated as a vector of byte-address offsets.

Vls16_vloxei16_v_cg/cp_vs2_edges_ls

vector_ls_xlen_dep

If the vector offset elements are narrower than XLEN, they are zero-extended to XLEN before adding to the base effective address. If the vector offset elements are wider than XLEN, the least-significant XLEN bits are used in the address calculation.

Vls16_vloxei64_v_cg/cp_custom_ls_indexed_truncated

vector_ls_eew_rsv

If the implementation does not support the EEW of the offset elements, the instruction is reserved.

ExceptionsVls_vloxei16_v_cg/cp_exceptionsv_index_eew16

vector_ls_stride_ordered_op

Vector unit-stride and constant-stride memory accesses do not guarantee ordering between individual element accesses. The vector indexed load and store memory operations have two forms, ordered and unordered. The indexed-ordered variants preserve element ordering on memory accesses.

Vls16_vloxei16_v_cg/index_register_data_overlap

vector_ls_stride_unordered_op

For unordered instructions (mop[1:0]!=11) there is no guarantee on element access order. If the accesses are to a strongly ordered IO region, the element accesses can be initiated in any order.

Untestable: memory-ordering guarantees are not observable from a single-hart self-checking signature

vector_ls_stride_unordered_precise

For implementations with precise vector traps, exceptions on indexed-unordered stores must also be precise.

ExceptionsVls_vsoxei16_v_cg/cp_exceptionsv_address_fault

vector_ls_nf_op

The nf[2:0] field encodes the number of fields in each segment. For regular vector loads and stores, nf=0, indicating that a single value is moved between a vector register group and memory at each element position. Larger values in the nf field are used to access multiple contiguous fields within a segment as described below in sec-aos.

Vls16_vlseg2e8_v_cg/cp_asm_count

vector_wholels_nf_op

The nf[2:0] field also encodes the number of whole vector registers to transfer for the whole vector register load/store instructions.

{Vls16_vl1re8_v_cg,Vls16_vl2re8_v_cg,Vls16_vl4re8_v_cg,Vls16_vl8re8_v_cg}/cp_asm_count

vector_ls_eew_emul

Vector loads and stores have an EEW encoded directly in the instruction. The corresponding EMUL is calculated as EMUL = (EEW/SEW)*LMUL.

{Vls8_vle8_v_cg,Vls16_vle8_v_cg,Vls32_vle8_v_cg,Vls64_vle8_v_cg}/cp_asm_count, Vls16_vl2re8_v_cg/cp_vd_emul2

vector_ls_emul_rsv

If the EMUL would be out of range (EMUL>8 or EMUL<1/8), the instruction encoding is reserved.

ExceptionsVls_vloxei16_v_cg/cp_exceptionsv_index_eew16

vector_ls_emul_offgroup_rsv

The vector register groups must have legal register specifiers for the selected EMUL, otherwise the instruction encoding is reserved.

SsstrictV_vl8re8_v_cg/cp_ssstrictv_ls_wr_nreg8_vd_unaligned

vector_ls_indexed_eew_emul

Vector unit-stride and constant-stride use the EEW/EMUL encoded in the instruction for the data values, while vector indexed loads and stores use the EEW/EMUL encoded in the instruction for the index values and the SEW/LMUL encoded in vtype for the data values.

Vls16_vloxei16_v_cg/cp_vd, Vls16_vloxei16_v_cg/cp_vs2_edges_ls

vector_ls_mew_rsv

The mew bit (inst[28]) when set is expected to be used to encode expanded memory sizes of 128 bits and above, but these encodings are currently reserved.

SsstrictV_vle8_v_cg/cp_ssstrictv_ls_mew_reserved

vector_ls_unit_stride_mask

Additional unit-stride mask load and store instructions are provided to transfer mask values to/from memory. These operate similarly to unmasked byte loads or stores (EEW=8), except that the effective vector length is evl = ceil(vl/8) (i.e. EMUL=1), and the destination register is always written with a tail-agnostic policy.

Vls16_vlm_v_cg/cp_custom_maskLS_emul_ge_16

vector_ls_neg_zero_stride

Negative and zero strides are supported.

Vls16_vlse8_v_cg/cp_rs2_edges_ls_e8

vector_ls_constant_stride_unordered

Element accesses within a constant-stride instruction are unordered with respect to each other.

Untestable: memory-ordering guarantees are not observable from a single-hart self-checking signature

vector_ls_constant_stride_x0

When rs2=x0, then an implementation is allowed, but not required, to perform fewer memory operations than the number of active elements, and may perform different numbers of memory operations across different dynamic executions of the same static instruction.

Vls16_vlse8_v_cg/cp_rs2_edges_ls_e8

vector_ff_trigger

The unit-stride fault-only-first load instructions are used to vectorize loops with data-dependent exit conditions (while loops). These instructions execute as a regular load except that they will only take a trap caused by a synchronous exception on element 0.

Vls16_vle8ff_v_cg/cp_custom_ffLS_fault_addr

vector_ls_overwrite_past_trap

Load instructions may overwrite active destination vector register group elements past the element index at which the trap is reported.

ExceptionsVls_vle8_v_cg/cp_exceptionsv_address_fault

vector_ff_past_trap

Similarly, fault-only-first load instructions may update active destination elements past the element that causes trimming of the vector length (but not past the original vector length). The values of these spurious updates do not have to correspond to the values in memory at the addressed memory locations. Non-idempotent memory locations can only be accessed when it is known the corresponding element load operation will not be restarted due to a trap or vector-length trimming.

Untestable: implementation-defined spurious past-trap updates are not observable from a self-checking signature

vector_ff_no_exception

Even when an exception is not raised, implementations are permitted to process fewer than vl elements and reduce vl accordingly, but if vstart=0 and vl>0, then at least one element must be processed.

Vls16_vle8ff_v_cg/cp_custom_ffLS_update_vl

vector_ff_interrupt_behavior

When the fault-only-first instruction takes a trap due to an interrupt, implementations should not reduce vl and should instead set a vstart value.

nfields

The three-bit nf field in the vector instruction encoding is an unsigned integer that contains one less than the number of fields per segment, NFIELDS.

{Vls16_vlseg2e8_v_cg,Vls16_vlseg4e8_v_cg,Vls16_vlseg8e8_v_cg}/cp_asm_count

nfields_op

Each field will be held in successively numbered vector register groups. When EMUL>1, each field will occupy a vector register group held in multiple successively numbered vector registers, and the vector register group for each field must follow the usual vector register alignment constraints (e.g., when EMUL=2 and NFIELDS=4, each field’s vector register group must start at an even vector register, but does not have to start at a multiple of 8 vector register number).

{Vls16_vlseg2e8_v_cg,Vls16_vlseg4e8_v_cg,Vls16_vlseg8e8_v_cg}/cp_asm_count

emul_nfields_rsv

The EMUL setting must be such that EMUL * NFIELDS ≤ 8, otherwise the instruction encoding is reserved.

SsstrictV_vlseg2e8_v_cg/cp_ssstrictv_ls_seg_vd_overflow

vector_ls_seg_rsv

If the vector register numbers accessed by the segment load or store would increment past 31, then the instruction encoding is reserved.

SsstrictV_vlseg2e8_v_cg/cp_ssstrictv_ls_seg_vd_overflow

vector_ls_seg_op

The vl register gives the number of segments to move, which is equal to the number of elements transferred to each vector register group. Masking is also applied at the level of whole segments.

Vls16_vlseg2e8_v_cg/cr_vl_lmul_e8_emul4max_sew16

vector_ls_seg_unordered

For segment loads and stores, the individual memory accesses used to access fields within each segment are unordered with respect to each other even for ordered indexed segment loads and stores.

Untestable: memory-ordering guarantees are not observable from a single-hart self-checking signature

vector_ls_seg_vstart_dep

The vstart value is in units of whole segments.

ExceptionsVls_vlseg2e8_v_cg/cp_vstart

vector_ls_seg_partial_access

If a trap occurs during access to a segment, it is implementation-defined whether a subset of the faulting segment’s accesses are performed before the trap is taken.

Untestable: implementation-defined partial-segment-access behavior is not observable from a self-checking signature

vector_ls_seg_unit_stride_op

The vector unit-stride load and store segment instructions move packed contiguous segments into multiple destination vector register groups.

Vls16_vlseg2e8_v_cg/cp_vd_lte30

vector_ls_seg_ff_unit_stride_op

For fault-only-first segment loads, if an exception is detected partway through accessing the zeroth segment, the trap is taken. If an exception is detected partway through accessing a subsequent segment, vl is reduced to the index of that segment.

ExceptionsVls_vlseg2e8ff_v_cg/cp_exceptionsv_ffLS_first_elm_trap

vector_ff_seg_partial_access

In both cases, it is implementation-defined whether a subset of the segment is loaded.

Untestable: implementation-defined partial-segment-access behavior is not observable from a self-checking signature

vector_ls_seg_ff_overload

These instructions may overwrite destination vector register group elements past the point at which a trap is reported or past the point at which vector length is trimmed.

Untestable: implementation-defined spurious past-trap updates are not observable from a self-checking signature

vector_ls_seg_constant_stride_op

Vector constant-stride segment loads and stores move contiguous segments where each segment is separated by the byte-stride offset given in the rs2 argument.

Vls16_vlsseg2e8_v_cg/cp_rs2

vector_ls_seg_constant_stride_unordered

Accesses to the fields within each segment can occur in any order, including the case where the byte stride is such that segments overlap in memory.

Untestable: memory-ordering guarantees are not observable from a single-hart self-checking signature

vector_ls_seg_indexed_op

Vector indexed segment loads and stores move contiguous segments where each segment is located at an address given by adding the scalar base address in the rs1 field to byte offsets in vector register vs2.

Vls16_vloxseg2ei8_v_cg/cp_vs2

vector_ls_seg_indexed_eew_emul_op

The data vector register group has EEW=SEW, EMUL=LMUL, while the index vector register group has EEW encoded in the instruction with EMUL=(EEW/SEW)*LMUL.

Vls16_vloxseg2ei8_v_cg/cr_vl_lmul_e8_emul4max_sew16

vector_ls_seg_indexed_emul_nfields_val

The EMUL * NFIELDS ≤ 8 constraint applies to the data vector register group.

SsstrictV_vlseg2e8_v_cg/cp_ssstrictv_ls_seg_vd_overflow

vector_ls_seg_indexed_vreg_rsv

For vector indexed segment loads, the destination vector register groups cannot overlap the source vector register group (specified by vs2), else the instruction encoding is reserved.

SsstrictV_vloxseg2ei8_v_cg/cp_ssstrictv_ls_seg_idx_vd_vs2_overlap

vector_ls_seg_wholereg_eew

The load instructions have the element width encoded in the mew and width fields following the pattern of regular unit-stride loads. EEW is computed as EEW=min(VLEN*NFIELDS, EEW_encoded).

Vls16_vl1re16_v_cg/cp_custom_vwholeRegLS_lmul, Vls16_vl1re8_v_cg/cp_asm_count, Vls16_vl1re16_v_cg/cp_asm_count, Vls16_vl1re32_v_cg/cp_asm_count, Vls16_vl1re64_v_cg/cp_asm_count, Vls16_vl2re8_v_cg/cp_asm_count, Vls16_vl2re16_v_cg/cp_asm_count, Vls16_vl2re32_v_cg/cp_asm_count, Vls16_vl2re64_v_cg/cp_asm_count, Vls16_vl4re8_v_cg/cp_asm_count, Vls16_vl4re16_v_cg/cp_asm_count, Vls16_vl4re32_v_cg/cp_asm_count, Vls16_vl4re64_v_cg/cp_asm_count, Vls16_vl8re8_v_cg/cp_asm_count, Vls16_vl8re16_v_cg/cp_asm_count, Vls16_vl8re32_v_cg/cp_asm_count, Vls16_vl8re64_v_cg/cp_asm_count

vector_ls_seg_wholereg_op

NFIELDS indicates the number of vector registers to transfer, numbered successively after the base.

{Vls16_vl1re8_v_cg,Vls16_vl2re8_v_cg,Vls16_vl4re8_v_cg,Vls16_vl8re8_v_cg}/cp_asm_count

vector_ls_seg_wholereg_nf_rsv

Only NFIELDS values of 1, 2, 4, 8 are supported, with other values reserved.

SsstrictV_vl1re8_v_cg/cp_ssstrictv_ls_wr_nf_not_pow2, SsstrictV_vs1r_v_cg/cp_ssstrictv_ls_wr_nf_not_pow2

vector_ls_seg_wholereg_op_cont

When multiple registers are transferred, the lowest-numbered vector register is held in the lowest-numbered memory addresses and successive vector register numbers are placed contiguously in memory.

Vls16_vl2re8_v_cg/cp_custom_vwholeRegLS_lmul

vector_ls_seg_wholereg_evl

The instructions operate with an effective vector length, evl=NFIELDS*VLEN/EEW, regardless of current settings in vtype and vl. The usual property that no elements are written if vstart ≥ vl does not apply to these instructions. Similarly, the property that the instructions are reserved if vstart exceeds the largest element index for the current vtype setting does not apply. Instead, the instructions are reserved if vstart ≥ evl.

Vls16_vl2re8_v_cg/cr_vl_lmul_lmul4max_sew16

vector_ls_wholereg_misaligned_exception

Implementations are allowed to raise a misaligned address exception on whole register loads and stores if the base address is not naturally aligned to the larger of the size of the encoded EEW in bytes (EEW/8) or the implementation’s smallest supported SEW size in bytes (SEWMIN/8).

MisalignV_vl1re16_v_cg/cp_misalignv_ls_wholereg_misaligned, MisalignV_vl1re32_v_cg/cp_misalignv_ls_wholereg_misaligned, MisalignV_vl1re64_v_cg/cp_misalignv_ls_wholereg_misaligned, MisalignV_vl1re8_v_cg/cp_misalignv_ls_wholereg_misaligned, MisalignV_vl2re16_v_cg/cp_misalignv_ls_wholereg_misaligned, MisalignV_vl2re32_v_cg/cp_misalignv_ls_wholereg_misaligned, MisalignV_vl2re64_v_cg/cp_misalignv_ls_wholereg_misaligned, MisalignV_vl2re8_v_cg/cp_misalignv_ls_wholereg_misaligned, MisalignV_vl4re16_v_cg/cp_misalignv_ls_wholereg_misaligned, MisalignV_vl4re32_v_cg/cp_misalignv_ls_wholereg_misaligned, MisalignV_vl4re64_v_cg/cp_misalignv_ls_wholereg_misaligned, MisalignV_vl4re8_v_cg/cp_misalignv_ls_wholereg_misaligned, MisalignV_vl8re16_v_cg/cp_misalignv_ls_wholereg_misaligned, MisalignV_vl8re32_v_cg/cp_misalignv_ls_wholereg_misaligned, MisalignV_vl8re64_v_cg/cp_misalignv_ls_wholereg_misaligned, MisalignV_vl8re8_v_cg/cp_misalignv_ls_wholereg_misaligned, MisalignV_vs1r_v_cg/cp_misalignv_ls_wholereg_misaligned, MisalignV_vs2r_v_cg/cp_misalignv_ls_wholereg_misaligned, MisalignV_vs4r_v_cg/cp_misalignv_ls_wholereg_misaligned, MisalignV_vs8r_v_cg/cp_misalignv_ls_wholereg_misaligned

vector_ls_misaligned_exception

If an element accessed by a vector memory instruction is not naturally aligned to the size of the element, either the element is transferred successfully or an address-misaligned exception is raised on that element.

MisalignV_vle16_v_cg/cp_misalignv_ls_element_misaligned, MisalignV_vle32_v_cg/cp_misalignv_ls_element_misaligned, MisalignV_vle64_v_cg/cp_misalignv_ls_element_misaligned, MisalignV_vle8_v_cg/cp_misalignv_ls_element_misaligned, MisalignV_vse16_v_cg/cp_misalignv_ls_element_misaligned, MisalignV_vse32_v_cg/cp_misalignv_ls_element_misaligned, MisalignV_vse64_v_cg/cp_misalignv_ls_element_misaligned, MisalignV_vse8_v_cg/cp_misalignv_ls_element_misaligned, MisalignV_vlm_v_cg/cp_misalignv_ls_element_misaligned, MisalignV_vlse16_v_cg/cp_misalignv_ls_element_misaligned, MisalignV_vlse32_v_cg/cp_misalignv_ls_element_misaligned, MisalignV_vlse64_v_cg/cp_misalignv_ls_element_misaligned, MisalignV_vlse8_v_cg/cp_misalignv_ls_element_misaligned, MisalignV_vsm_v_cg/cp_misalignv_ls_element_misaligned, MisalignV_vsse16_v_cg/cp_misalignv_ls_element_misaligned, MisalignV_vsse32_v_cg/cp_misalignv_ls_element_misaligned, MisalignV_vsse64_v_cg/cp_misalignv_ls_element_misaligned, MisalignV_vsse8_v_cg/cp_misalignv_ls_element_misaligned, MisalignV_vle16ff_v_cg/cp_misalignv_ls_element_misaligned, MisalignV_vle32ff_v_cg/cp_misalignv_ls_element_misaligned, MisalignV_vle64ff_v_cg/cp_misalignv_ls_element_misaligned, MisalignV_vle8ff_v_cg/cp_misalignv_ls_element_misaligned

vector_ls_program_order

Vector memory instructions appear to execute in program order on the local hart.

Not Tested: RVWMO program-order guarantees would require a concurrent/multi-hart checking methodology this repo doesn’t have yet

vector_ls_rvwmo

Vector memory instructions follow RVWMO at the instruction level.

Not Tested: RVWMO memory-ordering guarantees would require a concurrent/multi-hart checking methodology this repo doesn’t have yet

vector_ls_indexed_ordered_ordered

Except for vector indexed-ordered loads and stores, element operations are unordered within the instruction.

Untestable: memory-ordering guarantees are not observable from a single-hart self-checking signature

vector_ls_indexed_ordered_rvwmo

Vector indexed-ordered loads and stores read and write elements from/to memory in element order respectively, obeying RVWMO at the element level.

Not Tested: RVWMO memory-ordering guarantees would require a concurrent/multi-hart checking methodology this repo doesn’t have yet

vl_control_dependency

Instructions affected by the vector length register vl have a control dependency on vl, rather than a data dependency.

Not Tested: control-dependency timing is not exercised by any suite yet

vmask_control_dependency

Similarly, masked vector instructions have a control dependency on the source mask register, rather than a data dependency.

Not Tested: control-dependency timing is not exercised by any suite yet

V_fp_frm

All vector floating-point operations use the dynamic rounding mode in the frm register.

Vf16_vfadd_vv_cg/cp_csr_frm_v

V_inv_frm_rsv

Use of the frm field when it contains an invalid rounding mode by any vector floating-point instruction—​even those that do not depend on the rounding mode—​is reserved, irrespective of the values of vstart and vl.

Out-of-Scope: Ssstrict does not apply to CSR values

vop-vv_vreg_vs2_vs1

Vector-vector operations take two vectors of operands from vector register groups specified by vs2 and vs1 respectively.

Vx16_vadd_vv_cg/cr_vs2_vs1_edges

vop-vx_vop-vi_vreg_vs2

the vector register group operand is specified by vs2.

{Vx16_vadd_vx_cg,Vx16_vadd_vi_cg}/cp_vs2

vop-vi_imm_5bit

For integer operations, the scalar can be a 5-bit immediate, imm[4:0], encoded in the rs1 field. The value is sign-extended to SEW bits, unless otherwise specified.

Vx16_vadd_vi_cg/cp_imm_edges_5bit

vop-vx_xreg_rs1

For integer operations, the scalar can be taken from the scalar x register specified by rs1.

Vx16_vadd_vx_cg/cp_rs1

vop-vx_rs1_trunc_lsb_sewbits

If XLEN>SEW, the least-significant SEW bits of the x register are used, unless otherwise specified.

Vx16_vadd_vx_cg/cp_rs1_edges

vop-vx_rs1_sext_sewbits

If XLEN<SEW, the value from the x register is sign-extended to SEW bits.

Vx64_vadd_vx_cg/cp_rs1_edges

vfop_freg

For floating-point operations, the scalar can be taken from a scalar f register.

Vf16_vfadd_vf_cg/cp_fs1

vfop_freg_nanbox_lsb_sewbits

If FLEN > SEW, the value in the f registers is checked for a valid NaN-boxed value, in which case the least-significant SEW bits of the f register are used, else the canonical NaN value is used.

V_fp_eew_rsv

Vector instructions where any floating-point vector operand’s EEW is not a supported floating-point type width (which includes when FLEN < SEW) are reserved.

ExceptionsVf16_vfadd_vv_cg/cp_vill

V_masked

Vector arithmetic instructions are masked under control of the vm field.

Vx16_vadd_vv_cg/cp_masking_edges

vwop_vd_eew_emul

A few vector arithmetic instructions are defined to be widening operations where the destination vector register group has EEW=2*SEW and EMUL=2*LMUL.

Vx16_vwaddu_vv_cg/cp_vd_emul2

vnop_vd_vs2_eew_emul

A few instructions are provided to convert double-width source vectors into single-width destination vectors. These instructions convert a vector register group specified by vs2 with EEW/EMUL=2*SEW/2*LMUL to a vector register group with the current SEW/LMUL setting.

Vx16_vnsrl_wv_cg/cp_vs2_emul2

vnop_vs1_eew_emul

Where there is a second source vector register group (specified by vs1), this has the same (narrower) width as the result (i.e., EEW=SEW).

Vx16_vnsrl_wv_cg/cp_vs1_edges

vadd_vsub_op

Vector integer add and subtract are provided.

Vx16_vadd_vv_cg/cp_vd, Vx16_vsub_vv_cg/cp_vd

vrsub_op

Reverse-subtract instructions are also provided for the vector-scalar forms.

Vx16_vrsub_vx_cg/cp_vd

vwaddu_vwadd_vwsubu_vwsub_op

The widening add/subtract instructions are provided in both signed and unsigned variants, depending on whether the narrower source operands are first sign- or zero-extended before forming the double-width sum.

Vx16_vwaddu_vv_cg/cp_vd_emul2

vsext_vzext_op

The vector integer extension instructions zero- or sign-extend a source vector integer operand with EEW less than SEW to fill SEW-sized elements in the destination.

Vx16_vsext_vf2_cg/cp_vd

vsext_vzext_vs_eew_emul

The EEW of the source is 1/2, 1/4, or 1/8 of SEW, while EMUL of the source is (EEW/SEW)*LMUL.

Vx16_vsext_vf2_cg/cp_vs2_edges_emulf2

vsext_vzext_vd_eew_emul

The destination has EEW equal to SEW and EMUL equal to LMUL.

Vx16_vsext_vf2_cg/cp_vd

vsext_vzext_ill_eew_emul_rsv

If the source EEW is not a supported width, or source EMUL would be below the minimum legal LMUL, the instruction encoding is reserved.

ExceptionsVx_vsext_vf2_cg/cp_vill

vmadc_vmsbc_vadc_vsbc_carry_v0

The carry inputs and outputs are represented using the mask register layout as described in sec-mask-register-layout. Due to encoding constraints, the carry input must come from the implicit v0 register,

Vx16_vadc_vvm_cg/cp_masking_edges

vadc_vsbc_op

VADC and VSBC add or subtract the source operands and the carry-in or borrow-in, and write the result to vector register vd.

Vx16_vadc_vvm_cg/cp_vd_nv0

vadc_vsbc_masked_write_all_elem

These instructions are encoded as masked instructions (vm=0), but they operate on and write back all body elements.

Vx16_vadc_vvm_cg/cp_masking_edges

vadc_vsbc_unmasked_rsv

Encodings corresponding to the unmasked versions (vm=1) are reserved.

{SsstrictV_vadc_vvm_cg,SsstrictV_vsbc_vvm_cg}/cp_ssstrictv_vadc_vsbc_vm1_reserved

vmadc_vmsbc_op_masked

VMADC and VMSBC add or subtract the source operands, optionally add the carry-in or subtract the borrow-in if masked (vm=0), and write the resulting carry-out or borrow-out back to mask register vd.

Vx16_vmadc_vi_cg/cp_vd, Vx16_vmsbc_vvm_cg/cp_vd

vmadc_vmsbc_op_unmasked

If unmasked (vm=1), there is no carry-in or borrow-in.

Vx16_vmadc_vv_cg/cr_vs2_vs1_edges, Vx16_vmsbc_vv_cg/cr_vs2_vs1_edges

vmadc_vmsbc_masked_write_all_elem

These instructions operate on and write back all body elements, even if masked.

Vx16_vmadc_vim_cg/cp_masking_edges

vmadc_vmsbc_tail_agnostic

Because these instructions produce a mask value, they always operate with a tail-agnostic policy.

Vx16_vmadc_vim_cg/cr_vtype_agnostic

vmsbc_borrow_neg

For VMSBC, the borrow is defined to be 1 iff the difference, prior to truncation, is negative.

Vx16_vmsbc_vvm_cg/cp_vs2_edges

vadc_vsbc_vd_v0_rsv

For VADC and VSBC, the instruction encoding is reserved if the destination vector register is v0.

SsstrictV_vadc_vim_cg/cp_ssstrictv_masking_vd_eq_v0

vand_vor_vxor_op

# Bitwise logical operations. vand.vv vd, vs2, vs1, vm # Vector-vector vand.vx vd, vs2, rs1, vm # vector-scalar vand.vi vd, vs2, imm, vm # vector-immediate vor.vv vd, vs2, vs1, vm # Vector-vector vor.vx vd, vs2, rs1, vm # vector-scalar vor.vi vd, vs2, imm, vm # vector-immediate vxor.vv vd, vs2, vs1, vm # Vector-vector vxor.vx vd, vs2, rs1, vm # vector-scalar vxor.vi vd, vs2, imm, vm # vector-immediate

Vx16_vand_vv_cg/cp_vd

vsll_vsrl_vsra_op

A full set of vector shift instructions are provided, including logical shift left (SLL), and logical (zero-extending SRL) and arithmetic (sign-extending SRA) shift right. The data to be shifted is in the vector register group specified by vs2 and the shift amount value can come from a vector register group vs1, a scalar integer register rs1, or a zero-extended 5-bit immediate.

Vx16_vsll_vv_cg/cp_vd

vsll_vsrl_vsra_shamt

Only the low lg2(SEW) bits of the shift-amount value are used to control the shift amount.

Vx16_vsll_vv_cg/cp_custom_vshift_upperbits_vs1_ones, Vx16_vsll_vx_cg/cp_custom_vshift_upperbits_rs1_ones

vnsrl_vnsra_op

The narrowing right shifts extract a smaller field from a wider operand and have both zero-extending (SRL) and sign-extending (SRA) forms. The shift amount can come from a vector register group, or a scalar x register, or a zero-extended 5-bit immediate.

{Vx16_vnsrl_wv_cg,Vx16_vnsra_wv_cg}/cp_custom_vshiftn_upperbits_vs1_ones

vnsrl_vnsra_shamt

The low lg2(2*SEW) bits of the shift-amount value are used (e.g., the low 6 bits for a SEW=64-bit to SEW=32-bit narrowing operation).

Vx16_vnsrl_wv_cg/cp_custom_vshiftn_upperbits_vs1_ones

vmseq_vmsne_vmsltu_vmslt_vmsleu_vmsle_vmsgtu_vmsgt_op

The following integer compare instructions write 1 to the destination mask register element if the comparison evaluates to true, and 0 otherwise. The destination mask vector is always held in a single vector register, with a layout of elements as described in sec-mask-register-layout.

Vx16_vmseq_vv_cg/cp_vd

vmseq_vmsne_vmsltu_vmslt_vmsleu_vmsle_vmsgtu_vmsgt_vd_v0_legal

The destination mask vector register may be the same as the source vector mask register (v0).

Vx16_vmseq_vv_cg/cp_custom_vmask_write_v0_masked

vmseq_vmsne_vmsltu_vmslt_vmsleu_vmsle_vmsgtu_vmsgt_maskundisturbed

Compares effectively AND in the mask under a mask-undisturbed policy if the destination register is v0,

Vx16_vmseq_vv_cg/cp_custom_vmask_write_v0_masked

vmseq_vmsne_vmsltu_vmslt_vmsleu_vmsle_vmsgtu_vmsgt_tail_agnostic

Compares write mask registers, and so always operate under a tail-agnostic policy.

Vx16_vmseq_vv_cg/cr_vtype_agnostic

vminu_vmin_vmaxu_vmax_op

Signed and unsigned integer minimum and maximum instructions are supported.

Vx16_vmin_vv_cg/cp_vd

vmul_vmulh_vmulhu_vmulhsu_op

The single-width multiply instructions perform a SEW-bit*SEW-bit multiply to generate a 2*SEW-bit product, then return one half of the product in the SEW-bit-wide destination. The mul versions write the low half of the product to the destination register, while the mulh versions write the high half of the product to the destination register.

Vx16_vmul_vv_cg/cp_vd

vdivu_vdiv_vremu_vrem_op

The divide and remainder instructions are equivalent to the RISC-V standard scalar integer multiply/divides, with the same results for extreme inputs.

Vx16_vdiv_vv_cg/cp_vd

vwmul_vwmulu_vwmulsu_op

The widening integer multiply instructions return the full 2*SEW-bit product from an SEW-bit*SEW-bit multiply.

Vx16_vwmul_vv_cg/cp_vd_emul2

vmacc_vnmsac_vmadd_vnmsub_op

The integer multiply-add instructions are destructive and are provided in two forms, one that overwrites the addend or minuend (VMACC, VNMSAC) and one that overwrites the first multiplicand (VMADD, VNMSUB).

Vx16_vmacc_vv_cg/cp_vd, Vx16_vnmsac_vv_cg/cp_vd, Vx16_vmadd_vv_cg/cp_vd, Vx16_vnmsub_vv_cg/cp_vd

vmacc_vnmsac_vmadd_vnmsub_op_lowhalf

The low half of the product is added or subtracted from the third operand.

Vx16_vmacc_vv_cg/cr_vs2_vs1_edges, Vx16_vnmsac_vv_cg/cr_vs2_vs1_edges, Vx16_vmadd_vv_cg/cr_vs2_vs1_edges, Vx16_vnmsub_vv_cg/cr_vs2_vs1_edges

vwmaccu_vwmacc_vwmaccsu_vwmaccus_op

The widening integer multiply-add instructions add the full 2*SEW-bit product from a SEW-bit*SEW-bit multiply to a 2*SEW-bit value and produce a 2*SEW-bit result.

Vx16_vwmaccu_vv_cg/cp_vd_emul2

vmerge_op

The vector integer merge instructions combine two source operands based on a mask.

Vx16_vmerge_vvm_cg/cp_vd_nv0

vmerge_op_mask

The VMERGE instructions are encoded as masked instructions (vm=0). The instructions combine two sources as follows. At elements where the mask value is zero, the first operand is copied to the destination element, otherwise the second operand is copied to the destination element. The first operand is always a vector register group specified by vs2. The second operand is a vector register group specified by vs1 or a scalar x register specified by rs1 or a 5-bit sign-extended immediate.

Vx16_vmerge_vvm_cg/cp_masking_edges, Vx16_vmerge_vvm_cg/cr_vs2_vs1_edges

vmerge_all_elem

Unlike regular arithmetic instructions, the merge operates on all body elements (i.e., the set of elements from vstart up to the current vector length in vl).

Vx16_vmerge_vvm_cg/cp_masking_edges

vmv_op

The vector integer move instructions copy a source operand to a vector register group. The VMV.V.V variant copies a vector register group, whereas the VMV.V.X and VMV.V.I variants splat a scalar register or immediate to all active elements of the destination vector register group.

{Vx16_vmv_v_v_cg,Vx16_vmv_v_x_cg,Vx16_vmv_v_i_cg}/cp_vd

vmv_vs2_nv0_rsv

The first operand specifier (vs2) must contain v0, and any other vector register number in vs2 is reserved.

SsstrictV_vmv_v_v_cg/cp_ssstrictv_vmv_vs2_not_v0_reserved, SsstrictV_vmv_v_x_cg/cp_ssstrictv_vmv_vs2_not_v0_reserved, SsstrictV_vmv_v_i_cg/cp_ssstrictv_vmv_vs2_not_v0_reserved

vsaddu_vsadd_vssubu_vssub_op

Saturating forms of integer add and subtract are provided, for both signed and unsigned integers.

Vx16_vsaddu_vv_cg/cr_vs2_vs1_edges, Vx16_vsadd_vv_cg/cr_vs2_vs1_edges, Vx16_vssubu_vv_cg/cr_vs2_vs1_edges, Vx16_vssub_vv_cg/cr_vs2_vs1_edges

vsaddu_vsadd_vssubu_vssub_op_overflow_vxsat_op_vsaddsub

If the result would overflow the destination, the result is replaced with the closest representable value, and the vxsat bit is set.

Vx16_vsaddu_vv_cg/cp_csr_vxsat, Vx16_vsadd_vv_cg/cp_csr_vxsat, Vx16_vssubu_vv_cg/cp_csr_vxsat, Vx16_vssub_vv_cg/cp_csr_vxsat

vaaddu_vaadd_vasubu_vasub_op

The averaging add and subtract instructions right shift the result by one bit and round off the result according to the setting in vxrm. Computation is performed in infinite precision before rounding and truncating.

Vx16_vaadd_vv_cg/cr_vxrm_vs2_vs1_edges, Vx16_vasubu_vv_cg/cr_vxrm_vs2_vs1_edges, Vx16_vasub_vv_cg/cr_vxrm_vs2_vs1_edges

vasub_vasubu_op_overflow

For VASUB and VASUBU, overflow is ignored and the result wraps around.

Vx16_vasub_vv_cg/cr_vxrm_vs2_vs1_edges, Vx16_vasubu_vv_cg/cr_vxrm_vs2_vs1_edges

vsmul_op

The signed fractional multiply instruction produces a 2*SEW product of the two SEW inputs, then shifts the result right by SEW-1 bits, rounding these bits according to vxrm, then saturates the result to fit into SEW bits.

Vx16_vsmul_vv_cg/cp_csr_vxrm

vxsat_op_vsmul

If the result causes saturation, the vxsat bit is set.

Vx16_vsmul_vv_cg/cp_csr_vxsat

vssrl_vssra_op

These instructions shift the input value right, and round off the shifted out bits according to vxrm. The scaling right shifts have both zero-extending (VSSRL) and sign-extending (VSSRA) forms. The data to be shifted is in the vector register group specified by vs2 and the shift amount value can come from a vector register group vs1, a scalar integer register rs1, or a zero-extended 5-bit immediate.

Vx16_vssrl_vv_cg/cp_csr_vxrm

vssrl_vssra_shamt

Only the low lg2(SEW) bits of the shift-amount value are used to control the shift amount.

Vx16_vssrl_vv_cg/cp_custom_vshift_upperbits_vs1_ones

vnclipu_vnclip_op

The VNCLIP instructions are used to pack a fixed-point value into a narrower destination. The instructions support rounding, scaling, and saturation into the final destination format. The source data is in the vector register group specified by vs2. The scaling shift amount value can come from a vector register group vs1, a scalar integer register rs1, or a zero-extended 5-bit immediate.

Vx16_vnclipu_wv_cg/cp_vd

vnclipu_vnclip_shamt

The low lg2(2*SEW) bits of the vector or scalar shift-amount value (e.g., the low 6 bits for a SEW=64-bit to SEW=32-bit narrowing operation) are used to control the right shift amount, which provides the scaling.

Vx16_vnclipu_wv_cg/cp_custom_vshiftn_upperbits_vs1_ones

vnclipu_overflow

For VNCLIPU, the shifted rounded source value is treated as an unsigned integer and saturates if the result would overflow the destination viewed as an unsigned integer.

Vx16_vnclipu_wv_cg/cp_vs2_edges_emul2

vnclip_overflow

For VNCLIP, the shifted rounded source value is treated as a signed integer and saturates if the result would overflow the destination viewed as a signed integer.

Vx16_vnclip_wv_cg/cp_vs2_edges_emul2

vxsat_op_vnclip_u

If any destination element is saturated, the least-significant bit is set in the vxsat register.

V_fp_eew_ieee_nsupported_rsv

If the EEW of a vector floating-point operand does not correspond to a supported IEEE floating-point type, the instruction encoding is reserved.

ExceptionsVf16_vfmv_f_s_cg/cp_vill

mstatus_fs_off_V_fp_ill

If the floating-point unit status field mstatus.⁠FS is Off then any attempt to execute a vector floating-point instruction will raise an illegal-instruction exception.

ExceptionsVf16_vfadd_vv_cg/cp_mstatus_fs_off

mstatus_fs_dirty_V_fp

Any vector floating-point instruction that modifies any floating-point extension state (i.e., floating-point CSRs or f registers) must set mstatus.⁠FS to Dirty.

Sm_VF_cg/cp_vectorfp_mstatus_fs_state_affecting_register, U_VF_cg/cp_vectorfp_mstatus_fs_state_affecting_register, S_VF_cg/cp_vectorfp_sstatus_fs_state_affecting_register, H_VF_cg/cp_vectorfp_vsstatus_fs_state_affecting_register

vsstatus_mstatus_fs_off_hypervisor_V_fp_ill

If the hypervisor extension is implemented and V=1, the vsstatus.⁠FS field is additionally in effect for vector floating-point instructions. If vsstatus.⁠FS or mstatus.⁠FS is Off then any attempt to execute a vector floating-point instruction will raise an illegal-instruction exception.

vsstatus_mstatus_fs_dirty_hypervisor_V_fp

Any vector floating-point instruction that modifies any floating-point extension state (i.e., floating-point CSRs or f registers) must set both mstatus.⁠FS and vsstatus.⁠FS to Dirty.

fflags_op_V_fp

A vector floating-point exception at any active floating-point element sets the standard FP exception flags in the fflags register. Inactive elements do not set FP exception flags.

Vf16_vfadd_vv_cg/cp_csr_fflags_vdoun_set, Vf16_vfrsqrt7_v_cg/cp_custom_vfp_flags_inactive_not_set

vfadd_vfsub_vfrsub_op

# Floating-point add vfadd.vv vd, vs2, vs1, vm # Vector-vector vfadd.vf vd, vs2, rs1, vm # vector-scalar # Floating-point subtract vfsub.vv vd, vs2, vs1, vm # Vector-vector vfsub.vf vd, vs2, rs1, vm # Vector-scalar vd[i] = vs2[i] - f[rs1] vfrsub.vf vd, vs2, rs1, vm # Scalar-vector vd[i] = f[rs1] - vs2[i]

Vf16_vfadd_vv_cg/cp_vd

vfwadd_op

# Widening FP add/subtract, 2*SEW = SEW +/- SEW vfwadd.vv vd, vs2, vs1, vm # vector-vector vfwadd.vf vd, vs2, rs1, vm # vector-scalar vfwsub.vv vd, vs2, vs1, vm # vector-vector vfwsub.vf vd, vs2, rs1, vm # vector-scalar # Widening FP add/subtract, 2*SEW = 2*SEW +/- SEW vfwadd.wv vd, vs2, vs1, vm # vector-vector vfwadd.wf vd, vs2, rs1, vm # vector-scalar vfwsub.wv vd, vs2, vs1, vm # vector-vector vfwsub.wf vd, vs2, rs1, vm # vector-scalar

Vf16_vfwadd_vv_cg/cp_vd_emul2

vfmul_vfdiv_vfrdiv_op

# Floating-point multiply vfmul.vv vd, vs2, vs1, vm # Vector-vector vfmul.vf vd, vs2, rs1, vm # vector-scalar # Floating-point divide vfdiv.vv vd, vs2, vs1, vm # Vector-vector vfdiv.vf vd, vs2, rs1, vm # vector-scalar # Reverse floating-point divide vector = scalar / vector vfrdiv.vf vd, vs2, rs1, vm # scalar-vector, vd[i] = f[rs1]/vs2[i]

Vf16_vfmul_vv_cg/cp_vd, Vf16_vfdiv_vv_cg/cp_vd

vfwmul_op

# Widening floating-point multiply vfwmul.vv vd, vs2, vs1, vm # vector-vector vfwmul.vf vd, vs2, rs1, vm # vector-scalar

Vf16_vfwmul_vv_cg/cp_vd_emul2

vfmacc_vfnmacc_vfmsac_vfnmsac_vfmadd_vfnmadd_vfmsub_vfnmsub_op

All four varieties of fused multiply-add are provided, and in two destructive forms that overwrite one of the operands, either the addend or the first multiplicand.

Vf16_vfmacc_vv_cg/cp_vd, Vf16_vfmadd_vv_cg/cp_vd

vfwmacc_vfwnmacc_vfwmsac_vfwnmsac_op

The widening floating-point fused multiply-add instructions all overwrite the wide addend with the result. The multiplier inputs are all SEW wide, while the addend and destination is 2*SEW bits wide.

Vf16_vfwmacc_vv_cg/cp_vd_emul2

vfsqrt_op

The VFSQRT.V instruction is a unary vector-vector instruction.

Vf16_vfsqrt_v_cg/cp_vd

vfrsqrt7_op

This is a unary vector-vector instruction that returns an estimate of 1/sqrt(x) accurate to 7 bits.

Vf16_vfrsqrt7_v_cg/cp_custom_FpRecSqrtEst_edges

vfrsqrt7_op_unex

For the non-exceptional cases, the low bit of the exponent and the six high bits of significand (after the leading one) are concatenated and used to address the following table. The output of the table becomes the seven high bits of the result significand (after the leading one); the remainder of the result significand is zero. Subnormal inputs are normalized and the exponent adjusted appropriately before the lookup. The output exponent is chosen to make the result approximate the reciprocal of the square root of the argument.

Vf16_vfrsqrt7_v_cg/cp_custom_FpRecSqrtEst_edges

vfrsqrt7_op_precise

More precisely, the result is computed as follows. Let the normalized input exponent be equal to the input exponent if the input is normal, or 0 minus the number of leading zeros in the significand otherwise. If the input is subnormal, the normalized input significand is given by shifting the input significand left by 1 minus the normalized input exponent, discarding the leading 1 bit. The output exponent equals floor((3*B - 1 - the normalized input exponent) / 2), where B is the exponent bias. The output sign equals the input sign.

Vf16_vfrsqrt7_v_cg/cp_custom_FpRecSqrtEst_edges

vfrec7_op

This is a unary vector-vector instruction that returns an estimate of 1/x accurate to 7 bits.

Vf16_vfrec7_v_cg/cp_custom_FpRecipEst_edges

vfrec7_op_unex

For the non-exceptional cases, the seven high bits of significand (after the leading one) are used to address the following table. The output of the table becomes the seven high bits of the result significand (after the leading one); the remainder of the result significand is zero. Subnormal inputs are normalized and the exponent adjusted appropriately before the lookup. The output exponent is chosen to make the result approximate the reciprocal of the argument, and subnormal outputs are denormalized accordingly.

Vf16_vfrec7_v_cg/cp_custom_FpRecipEst_edges

vfrec7_op_precise

More precisely, the result is computed as follows. Let the normalized input exponent be equal to the input exponent if the input is normal, or 0 minus the number of leading zeros in the significand otherwise. The normalized output exponent equals (2*B - 1 - the normalized input exponent). If the normalized output exponent is outside the range [-1, 2*B], the result corresponds to one of the exceptional cases in the table above.

Vf16_vfrec7_v_cg/cp_custom_FpRecipEst_edges

vfrec7_op_subnorm

If the input is subnormal, the normalized input significand is given by shifting the input significand left by 1 minus the normalized input exponent, discarding the leading 1 bit. Otherwise, the normalized input significand equals the input significand. The following table gives the seven MSBs of the normalized output significand as a function of the seven MSBs of the normalized input significand; the other bits of the normalized output significand are zero.

Vf16_vfrec7_v_cg/cp_custom_FpRecipEst_edges

vfrec7_op_output

If the normalized output exponent is 0 or -1, the result is subnormal: the output exponent is 0, and the output significand is given by concatenating a 1 bit to the left of the normalized output significand, then shifting that quantity right by 1 minus the normalized output exponent. Otherwise, the output exponent equals the normalized output exponent, and the output significand equals the normalized output significand. The output sign equals the input sign.

Vf16_vfrec7_v_cg/cp_custom_FpRecipEst_edges

vfmin_vfmax_op

The vector floating-point VFMIN and VFMAX instructions have the same behavior as the corresponding scalar floating-point instructions in the F, D, and Q extensions: they perform the IEEE 754-2019 minimumNumber or maximumNumber operation on active elements.

Vf16_vfmax_vv_cg/cp_vd

vfsgnj_vfsgnjn_vfsgnjx_op

Vector versions of the scalar sign-injection instructions. The result takes all bits except the sign bit from the vector vs2 operands.

Vf16_vfsgnj_vv_cg/cp_vd

vmfeq_vmfne_vmflt_vmfle_vmfgt_vmfge_op

These vector FP compare instructions compare two source operands and write the comparison result to a mask register.

Vf16_vmfeq_vv_cg/cp_vd

vmfeq_vmfne_vmflt_vmfle_vmfgt_vmfge_vd_single_vreg

The destination mask vector is always held in a single vector register, with a layout of elements as described in sec-mask-register-layout.

{Vf32_vmfeq_vv_cg, Vf32_vmflt_vv_cg, Vf32_vmfle_vv_cg, Vf32_vmfne_vv_cg}/cr_vl_lmul_sew32

vmfeq_vmfne_vmflt_vmfle_vmfgt_vmfge_vd_eq_v0

The destination mask vector register may be the same as the source vector mask register (v0).

SsstrictV_vmfeq_vv_cg/cp_ssstrictv_masking_vd_eq_v0

vmfeq_vmfne_vmflt_vmfle_vmfgt_vmfge_tail_agnostic

Compares write mask registers, and so always operate under a tail-agnostic policy.

Vf16_vmfeq_vv_cg/cr_vtype_agnostic

vmfeq_vmfne_snan_invalid

VMFEQ and VMFNE raise the invalid operation exception only on signaling NaN inputs.

Vf16_vmfeq_vv_cg/cp_custom_vfp_NaN_input

vmflt_vmfle_vmfgt_vmfge_sqnan_invalid

VMFLT, VMFLE, VMFGT, and VMFGE raise the invalid operation exception on both signaling and quiet NaN inputs.

Vf16_vmflt_vv_cg/cp_custom_vfp_flags_nv

vmfne_vdval1_nan

VMFNE writes 1 to the destination element when either operand is NaN,

Vf16_vmfeq_vv_cg/cp_custom_vfp_NaN_input

vmfeq_vmflt_vmfle_vmfgt_vmfge_vdval0_nan

whereas the other compares write 0 when either operand is NaN.

Vf16_vmfeq_vv_cg/cp_custom_vfp_NaN_input

vfclass_op

This is a unary vector-vector instruction that operates in the same way as the scalar classify instruction.

Vf16_vfclass_v_cg/cp_custom_vfclass_onehot

vfclass_op_result

The 10-bit mask produced by this instruction is placed in the least-significant bits of the result elements. The upper (SEW-10) bits of the result are filled with zeros.

Vf16_vfclass_v_cg/cp_custom_vfclass_onehot

vfclass_sewge16

The instruction is only defined for SEW=16b and above, so the result will always fit in the destination elements.

Vf16_vfclass_v_cg/cp_vd

vfmerge_op

A vector-scalar floating-point merge instruction is provided,

Vf16_vfmerge_vfm_cg/cp_masking_edges

vfmerge_op_mask

At elements where the mask value is zero, the first vector operand is copied to the destination element, otherwise a scalar floating-point register value is copied to the destination element.

Vf16_vfmerge_vfm_cg/cp_masking_edges

vfmerge_all_elem

operates on all body elements from vstart up to the current vector length in vl regardless of mask value.

Vf16_vfmerge_vfm_cg/cp_masking_edges

vfmv_op

The vector floating-point move instruction splats a floating-point scalar operand to a vector register group. The instruction copies a scalar f register value to all active elements of a vector register group.

Vf16_vfmv_v_f_cg/cp_vd

vfmv_vs2_nv0_rsv

The instruction must have the vs2 field set to v0, with all other values for vs2 reserved.

SsstrictV_vfmv_v_f_cg/cp_ssstrictv_vfmv_vs2_not_v0_reserved

vfcvt_op

Conversion operations are provided to convert to and from floating-point values and unsigned and signed integers, where both source and destination are SEW wide.

Vf16_vfcvt_x_f_v_cg/cp_vd

vfcvt_op_exceptions

The conversions follow the same rules on exceptional conditions as the scalar conversion instructions.

Vf16_vfcvt_x_f_v_cg/cp_custom_vfp_flags_nv_nx

vfcvt_op_frm

The conversions use the dynamic rounding mode in frm, except for the rtz variants, which round towards zero.

Vf16_vfcvt_x_f_v_cg/cp_csr_frm_v

vfwcvt_op

A set of conversion instructions is provided to convert between narrower integer and floating-point datatypes to a type of twice the width.

Vf16_vfwcvt_x_f_v_cg/cp_vd_emul2

vfwcvt_vreg_constr

These instructions have the same constraints on vector register overlap as other widening instructions (see sec-widening).

Vf16_vfwadd_vv_cg/cp_custom_allVdOverlapTopVs2_vd_vs2_lmul1

vfncvt_op

A set of conversion instructions is provided to convert wider integer and floating-point datatypes to a type of half the width.

Vf16_vfncvt_x_f_w_cg/cp_vd

vfncvt_vreg_constr

These instructions have the same constraints on vector register overlap as other narrowing instructions (see sec-narrowing).

SsstrictV_vfncvt_x_f_w_cg/cp_ssstrictv_vnarrow_overlapping_vd_vs2

vreduction_scalar_def

Vector reduction operations take a vector register group of elements and a scalar held in element 0 of a vector register group, and perform a reduction using some binary operator, to produce a scalar result in element 0 of a vector register group.

Vx16_vredsum_vs_cg/cp_custom_voffgroup_vs1_lmul2, Vx16_vredsum_vs_cg/cp_custom_element0Masked

vreduction_scalar_disregard_lmul

The scalar input and output operands are held in element 0 of a group with EMUL = ceil(EEW/VLEN), regardless of LMUL setting.

Vx16_vredsum_vs_cg/cp_custom_voffgroup_vs1_lmul2

vreduction_scalar_disregard_maskval

Inactive elements from the source vector register group are excluded from the reduction, but the scalar operand is always included regardless of the mask values.

Vx16_vredsum_vs_cg/cp_custom_element0Masked

vreduction_vd_overlap_vs

The destination vector register can overlap the source operands, including the mask register.

Vx16_vredsum_vs_cg/cmp_vd_vs2

vreduction_tail_policy

The other elements in the destination vector register (0 < index < VLEN/SEW) are considered the tail and are managed with the current tail agnostic/undisturbed policy.

Vx16_vredsum_vs_cg/cr_vtype_agnostic

vreduction_vl_0

If vl=0, no operation is performed and the destination register is not updated.

Vx16_vredsum_vs_cg/cp_vl_0

vreduction_trap

Traps on vector reduction instructions are always reported with a vstart of 0.

vreduction_vstart_n0_ill

Vector reduction operations raise an illegal-instruction exception if vstart is non-zero.

ExceptionsVx_vredsum_vs_cg/cp_vstart, ExceptionsVx_vwredsum_vs_cg/cp_vstart, ExceptionsVf32_vfredosum_vs_cg/cp_vstart, ExceptionsVf32_vfwredosum_vs_cg/cp_vstart

vredsum_vredmaxu_vredmax_vredminu_vredmin_vredand_vredor_vredxor_op

All operands and results of single-width reduction instructions have the same SEW width.

Vx8_vredsum_vs_cg/cp_vd, Vx16_vredsum_vs_cg/cp_vd, Vx32_vredsum_vs_cg/cp_vd, Vx64_vredsum_vs_cg/cp_vd, Vx8_vredmaxu_vs_cg/cp_vd, Vx16_vredmaxu_vs_cg/cp_vd, Vx32_vredmaxu_vs_cg/cp_vd, Vx64_vredmaxu_vs_cg/cp_vd, Vx8_vredmax_vs_cg/cp_vd, Vx16_vredmax_vs_cg/cp_vd, Vx32_vredmax_vs_cg/cp_vd, Vx64_vredmax_vs_cg/cp_vd, Vx8_vredminu_vs_cg/cp_vd, Vx16_vredminu_vs_cg/cp_vd, Vx32_vredminu_vs_cg/cp_vd, Vx64_vredminu_vs_cg/cp_vd, Vx8_vredmin_vs_cg/cp_vd, Vx16_vredmin_vs_cg/cp_vd, Vx32_vredmin_vs_cg/cp_vd, Vx64_vredmin_vs_cg/cp_vd, Vx8_vredand_vs_cg/cp_vd, Vx16_vredand_vs_cg/cp_vd, Vx32_vredand_vs_cg/cp_vd, Vx64_vredand_vs_cg/cp_vd, Vx8_vredor_vs_cg/cp_vd, Vx16_vredor_vs_cg/cp_vd, Vx32_vredor_vs_cg/cp_vd, Vx64_vredor_vs_cg/cp_vd, Vx8_vredxor_vs_cg/cp_vd, Vx16_vredxor_vs_cg/cp_vd, Vx32_vredxor_vs_cg/cp_vd, Vx64_vredxor_vs_cg/cp_vd

vredsum_vredmaxu_vredmax_vredminu_vredmin_vredand_vredor_vredxor_overflow

Overflows wrap around on arithmetic sums.

Vx8_vredsum_vs_cg/cr_vs2_vs1_edges, Vx16_vredsum_vs_cg/cr_vs2_vs1_edges, Vx32_vredsum_vs_cg/cr_vs2_vs1_edges, Vx64_vredsum_vs_cg/cr_vs2_vs1_edges, Vx8_vredmaxu_vs_cg/cr_vs2_vs1_edges, Vx16_vredmaxu_vs_cg/cr_vs2_vs1_edges, Vx32_vredmaxu_vs_cg/cr_vs2_vs1_edges, Vx64_vredmaxu_vs_cg/cr_vs2_vs1_edges, Vx8_vredmax_vs_cg/cr_vs2_vs1_edges, Vx16_vredmax_vs_cg/cr_vs2_vs1_edges, Vx32_vredmax_vs_cg/cr_vs2_vs1_edges, Vx64_vredmax_vs_cg/cr_vs2_vs1_edges, Vx8_vredminu_vs_cg/cr_vs2_vs1_edges, Vx16_vredminu_vs_cg/cr_vs2_vs1_edges, Vx32_vredminu_vs_cg/cr_vs2_vs1_edges, Vx64_vredminu_vs_cg/cr_vs2_vs1_edges, Vx8_vredmin_vs_cg/cr_vs2_vs1_edges, Vx16_vredmin_vs_cg/cr_vs2_vs1_edges, Vx32_vredmin_vs_cg/cr_vs2_vs1_edges, Vx64_vredmin_vs_cg/cr_vs2_vs1_edges, Vx8_vredand_vs_cg/cr_vs2_vs1_edges, Vx16_vredand_vs_cg/cr_vs2_vs1_edges, Vx32_vredand_vs_cg/cr_vs2_vs1_edges, Vx64_vredand_vs_cg/cr_vs2_vs1_edges, Vx8_vredor_vs_cg/cr_vs2_vs1_edges, Vx16_vredor_vs_cg/cr_vs2_vs1_edges, Vx32_vredor_vs_cg/cr_vs2_vs1_edges, Vx64_vredor_vs_cg/cr_vs2_vs1_edges, Vx8_vredxor_vs_cg/cr_vs2_vs1_edges, Vx16_vredxor_vs_cg/cr_vs2_vs1_edges, Vx32_vredxor_vs_cg/cr_vs2_vs1_edges, Vx64_vredxor_vs_cg/cr_vs2_vs1_edges

vwredsumu_op

The unsigned VWREDSUMU.VS instruction zero-extends the SEW-wide vector elements before summing them, then adds the 2*SEW-width scalar element, and stores the result in a 2*SEW-width scalar element.

Vx8_vwredsumu_vs_cg/cr_vs2_vs1_edges_wred, Vx16_vwredsumu_vs_cg/cr_vs2_vs1_edges_wred, Vx32_vwredsumu_vs_cg/cr_vs2_vs1_edges_wred

vwredsumu_vwredsum_op_overflow

For both VWREDSUMU.VS and VWREDSUM.VS, overflows wrap around.

Vx8_vwredsumu_vs_cg/cr_vs2_vs1_edges_wred, Vx16_vwredsumu_vs_cg/cr_vs2_vs1_edges_wred, Vx32_vwredsumu_vs_cg/cr_vs2_vs1_edges_wred, Vx8_vwredsum_vs_cg/cr_vs2_vs1_edges_wred, Vx16_vwredsum_vs_cg/cr_vs2_vs1_edges_wred, Vx32_vwredsum_vs_cg/cr_vs2_vs1_edges_wred

vwredsum_op

The VWREDSUM.VS instruction sign-extends the SEW-wide vector elements before summing them.

Vx8_vwredsum_vs_cg/cr_vs2_vs1_edges_wred, Vx16_vwredsum_vs_cg/cr_vs2_vs1_edges_wred, Vx32_vwredsum_vs_cg/cr_vs2_vs1_edges_wred

vfredosum_op

The VFREDOSUM instruction must sum the floating-point values in element order, starting with the scalar in vs1[0]

Vf16_vfredosum_vs_cg/cp_custom_vfredosum_ordered_sum

vfredosum_op_exceptions

where each addition operates identically to the scalar floating-point instructions in terms of raising exception flags and generating or propagating special values.

Vf16_vfredosum_vs_cg/cp_custom_vfp_flags_nv_nx

vfredosum_maskoff

When the operation is masked (vm=0), the masked-off elements do not affect the result or the exception flags.

Vf16_vfredosum_vs_cg/cp_masking_edges

vfredusum_op

The implementation must produce a result equivalent to a reduction tree composed of binary operator nodes, with the inputs being elements from the source vector register group (vs2) and the source scalar value (vs1[0]). Each operator in the tree accepts two inputs and produces one result. Each operator first computes an exact sum as a RISC-V scalar floating-point addition with infinite exponent range and precision, then converts this exact sum to a floating-point format with range and precision each at least as great as the element floating-point format indicated by SEW, rounding using the currently active floating-point dynamic rounding mode and raising exception flags as necessary. A different floating-point range and precision may be chosen for the result of each operator. A node where one input is derived only from elements masked-off or beyond the active vector length may either treat that input as the additive identity of the appropriate EEW or simply copy the other input to its output. The rounded result from the root node in the tree is converted (rounded again, using the dynamic rounding mode) to the standard floating-point format indicated by SEW.

Vf16_vfredusum_vs_cg/cp_vd

vfredusum_additive_impl

The additive identity is +0.0 when rounding down (towards -∞) or -0.0 for all other rounding modes.

Implicit: the additive-identity sign is whatever the reference model produces and is checked by the ordinary signature comparison, just not isolated by a dedicated coverpoint

vfredusum_redtree

The reduction tree structure must be deterministic for a given value in vtype and vl.

Untestable: reduction-tree determinism across runs is not observable from a single self-checking execution

vfredmin_vfredmax_op

The VFREDMIN and VFREDMAX instructions reduce the scalar argument in vs1[0] and active elements in vs2 using the IEEE 754-2019 minimumNumber and maximumNumber operations, respectively.

Vf16_vfredmin_vs_cg/cp_vd

vfwredosum_vfwredusum_op

Widening forms of the sum reductions are provided that read and write a double-width reduction result.

Vf16_vfwredosum_vs_cg/cp_vd_emul2, Vf16_vfwredusum_vs_cg/cp_vd_emul2

vfwredosum_vfwredusum_op_reduction

The reduction of the SEW-width elements is performed as in the single-width reduction case, with the elements in vs2 promoted to 2*SEW bits before adding to the 2*SEW-bit accumulator.

Vf16_vfwredosum_vs_cg/cp_vd_emul2, Vf16_vfwredusum_vs_cg/cp_vd_emul2

vmask_maskreg_def

Vector mask-register logical operations operate on mask registers. Each element in a mask register is a single bit,

Vx16_vmand_mm_cg/cp_vd

vmask_vd_overlap_vs

The destination vector register may be the same as either source vector register.

Vx16_vmand_mm_cg/cmp_vd_vs1

vmask_vstart

As with other vector instructions, the elements with indices less than vstart are unchanged, and vstart is reset to zero after execution.

ExceptionsVx_vmand_mm_cg/cp_vstart

vmasklogical_unmasked

Vector mask logical instructions are always unmasked,

Vx16_vmand_mm_cg/cr_vtype_agnostic_nomask

vmasklogical_masked_rsv

so there are no inactive elements, and the encodings with vm=0 are reserved.

SsstrictV_vmand_mm_cg/cp_ssstrictv_mask_logical_vm0_reserved, SsstrictV_vmnand_mm_cg/cp_ssstrictv_mask_logical_vm0_reserved, SsstrictV_vmor_mm_cg/cp_ssstrictv_mask_logical_vm0_reserved, SsstrictV_vmxor_mm_cg/cp_ssstrictv_mask_logical_vm0_reserved

vmasklogical_tail_agnostic

Mask elements past vl, the tail elements, are always updated with a tail-agnostic policy.

Vx16_vmand_mm_cg/cr_vtype_agnostic_nomask

vmand_vmnand_vmandn_vmxor_vmor_vmnor_vmorn_vmxnor_op

vmand.mm vd, vs2, vs1 # vd.mask[i] = vs2.mask[i] && vs1.mask[i] vmnand.mm vd, vs2, vs1 # vd.mask[i] = !(vs2.mask[i] && vs1.mask[i]) vmandn.mm vd, vs2, vs1 # vd.mask[i] = vs2.mask[i] && !vs1.mask[i] vmxor.mm vd, vs2, vs1 # vd.mask[i] = vs2.mask[i] ^^ vs1.mask[i] vmor.mm vd, vs2, vs1 # vd.mask[i] = vs2.mask[i] || vs1.mask[i] vmnor.mm vd, vs2, vs1 # vd.mask[i] = !(vs2.mask[i] || vs1.mask[i]) vmorn.mm vd, vs2, vs1 # vd.mask[i] = vs2.mask[i] || !vs1.mask[i] vmxnor.mm vd, vs2, vs1 # vd.mask[i] = !(vs2.mask[i] ^^ vs1.mask[i])

Vx16_vmand_mm_cg/cr_vs2_vs1_edges_mm, Vx16_vmnand_mm_cg/cr_vs2_vs1_edges_mm, Vx16_vmandn_mm_cg/cr_vs2_vs1_edges_mm, Vx16_vmxor_mm_cg/cr_vs2_vs1_edges_mm, Vx16_vmor_mm_cg/cr_vs2_vs1_edges_mm, Vx16_vmnor_mm_cg/cr_vs2_vs1_edges_mm, Vx16_vmorn_mm_cg/cr_vs2_vs1_edges_mm, Vx16_vmxnor_mm_cg/cr_vs2_vs1_edges_mm

vcpop_vs_single_vreg

The source operand is a single vector register holding mask register values as described in sec-mask-register-layout.

Vx16_vcpop_m_cg/cp_vs2_edges_eew1

vcpop_op

The VCPOP.M instruction counts the number of mask elements of the active elements of the vector source mask register that have the value 1 and writes the result to a scalar x register.

Vx16_vcpop_m_cg/cp_rd

vcpop_op_mask

The operation can be performed under a mask, in which case only the masked elements are counted.

Vx16_vcpop_m_cg/cp_masking_edges

vcpop_vl0

The VCPOP.M instruction writes x[rd] even if vl=0 (with the value 0, since no mask elements are active).

Vx16_vcpop_m_cg/cp_vl_0

vcpop_trap

Traps on VCPOP.M are always reported with a vstart of 0.

vcpop_vstart_n0_ill

The VCPOP.M instruction will raise an illegal-instruction exception if vstart is non-zero.

ExceptionsVx_vcpop_m_cg/cp_vstart_gt_vl, ExceptionsVx_vcpop_m_cg/cp_vstart

vfirst_op

The VFIRST instruction finds the lowest-numbered active element of the source mask vector that has the value 1 and writes that element’s index to rd. If no active element has the value 1, -1 is written to rd.

Vx16_vfirst_m_cg/cp_rd

vfirst_vl0

The VFIRST.M instruction writes x[rd] even if vl=0 (with the value -1, since no mask elements are active).

Vx16_vfirst_m_cg/cp_vl_0

vfirst_trap

Traps on VFIRST are always reported with a vstart of 0.

vfirst_vstart_n0_ill

The VFIRST instruction will raise an illegal-instruction exception if vstart is non-zero.

ExceptionsVx_vfirst_m_cg/cp_vstart_gt_vl, ExceptionsVx_vfirst_m_cg/cp_vstart

vmsbf_op

The VMSBF.M instruction takes a mask register as input and writes results to a mask register. The instruction writes a 1 to all active mask elements before the first active source element that is a 1, then writes a 0 to that element and all following active elements. If there is no set bit in the active elements of the source vector, then all active elements in the destination are written with a 1.

Vx16_vmsbf_m_cg/cp_vd

vmsbf_tail_agnostic

The tail elements in the destination mask register are updated under a tail-agnostic policy.

Vx16_vmsbf_m_cg/cr_vtype_agnostic

vmsbf_trap

Traps on VMSBF.M are always reported with a vstart of 0.

vmsbf_vstart_n0_ill

The VMSBF.M instruction will raise an illegal-instruction exception if vstart is non-zero.

ExceptionsVx_vmsbf_m_cg/cp_vstart_gt_vl, ExceptionsVx_vmsbf_m_cg/cp_vstart

vmsbf_vreg_constr

The destination register cannot overlap the source register and, if masked, cannot overlap the mask register (v0).

SsstrictV_vmsbf_m_cg/cp_ssstrictv_masking_vd_eq_v0

vmsif_op

The vector mask set-including-first instruction is similar to set-before-first, except it also includes the element with a set bit.

Vx16_vmsif_m_cg/cp_vd

vmsif_tail_agnostic

The tail elements in the destination mask register are updated under a tail-agnostic policy.

Vx16_vmsif_m_cg/cr_vtype_agnostic

vmsif_trap

Traps on VMSIF.M are always reported with a vstart of 0.

vmsif_vstart_n0_ill

The VMSIF.M instruction will raise an illegal-instruction exception if vstart is non-zero.

ExceptionsVx_vmsif_m_cg/cp_vstart_gt_vl, ExceptionsVx_vmsif_m_cg/cp_vstart

vmsif_vreg_constr

The destination register cannot overlap the source register and, if masked, cannot overlap the mask register (v0).

SsstrictV_vmsif_m_cg/cp_ssstrictv_masking_vd_eq_v0

vmsof_op

The vector mask set-only-first instruction is similar to set-before-first, except it only sets the first element with a bit set, if any.

Vx16_vmsof_m_cg/cp_vd

vmsof_tail_agnostic

The tail elements in the destination mask register are updated under a tail-agnostic policy.

Vx16_vmsof_m_cg/cr_vtype_agnostic

vmsof_trap

Traps on VMSOF.M are always reported with a vstart of 0.

vmsof_vstart_n0_ill

The VMSOF.M instruction will raise an illegal-instruction exception if vstart is non-zero.

ExceptionsVx_vmsof_m_cg/cp_vstart_gt_vl, ExceptionsVx_vmsof_m_cg/cp_vstart

vmsof_vreg_constr

The destination register cannot overlap the source register and, if masked, cannot overlap the mask register (v0).

SsstrictV_vmsof_m_cg/cp_ssstrictv_masking_vd_eq_v0

viota_op

The VIOTA.M instruction reads a source vector mask register and writes to each element of the destination vector register group the sum of all the bits of elements in the mask register whose index is less than the element, e.g., a parallel prefix sum of the mask values.

Vx16_viota_m_cg/cp_vd

viota_op_masked

This instruction can be masked, in which case only the enabled elements contribute to the sum.

Vx16_viota_m_cg/cp_masking_edges

viota_op_zext

The result value is zero-extended to fill the destination element if SEW is wider than the result.

Vx16_viota_m_cg/cr_vl_lmul_sew16, Vx32_viota_m_cg/cr_vl_lmul_sew32, Vx64_viota_m_cg/cr_vl_lmul_sew64

viota_op_overflow

If the result value would overflow the destination SEW, the least-significant SEW bits are retained.

Vx8_viota_m_cg/cr_vl_lmul_sew8

viota_trap

Traps on VIOTA.M are always reported with a vstart of 0,

viota_vstart_n0_ill

An illegal-instruction exception is raised if vstart is non-zero.

ExceptionsVx_viota_m_cg/cp_vstart_gt_vl, ExceptionsVx_viota_m_cg/cp_vstart

viota_vreg_constr

The destination register group cannot overlap the source register and, if masked, cannot overlap the mask register (v0).

SsstrictV_viota_m_cg/cp_exceptionsv_vd_vs2_overlap, SsstrictV_viota_m_cg/cp_ssstrictv_masking_vd_eq_v0

vid_op

The VID.V instruction writes each element’s index to the destination vector register group, from 0 to vl-1.

Vx16_vid_v_cg/cp_vd

vid_op_mask

The instruction can be masked. Masking does not change the index value written to active elements.

Vx16_vid_v_cg/cp_masking_edges

vid_op_zext

The result value is zero-extended to fill the destination element if SEW is wider than the result.

Vx16_vid_v_cg/cr_vl_lmul_sew16, Vx32_vid_v_cg/cr_vl_lmul_sew32, Vx64_vid_v_cg/cr_vl_lmul_sew64

vid_op_overflow

If the result value would overflow the destination SEW, the least-significant SEW bits are retained.

Vx8_vid_v_cg/cr_vl_lmul_sew8

vid_vs2_nv0_rsv

The vs2 field of the instruction must be set to v0, otherwise the encoding is reserved.

SsstrictV_vid_v_cg/cp_ssstrictv_vid_vs2_not_v0_reserved

vmv-x-s_vmv-s-x_ignorelmul

The instructions ignore LMUL; EMUL is computed as ceil(EEW/VLEN).

Vx16_vmv_s_x_cg/cp_custom_voffgroup_vd_lmul2, Vx16_vmv_x_s_cg/cp_custom_voffgroup_vs2_lmul2

vmv-x-s_op

The VMV.X.S instruction copies a single SEW-wide element from index 0 of the source vector register to a destination integer register. If SEW > XLEN, the least-significant XLEN bits are transferred and the upper SEW-XLEN bits are ignored. If SEW < XLEN, the value is sign-extended to XLEN bits.

Vx16_vmv_x_s_cg/cp_rd, Vx16_vmv_x_s_cg/cp_custom_gprWriting_vstart_eq_vl, Vx16_vmv_x_s_cg/cp_vl_0

vmv-s-x_op

The VMV.S.X instruction copies the scalar integer register to element 0 of the destination vector register group with EMUL = ceil(EEW/VLEN). If SEW < XLEN, the least-significant bits are copied and the upper XLEN-SEW bits are ignored. If SEW > XLEN, the value is sign-extended to SEW bits. The other elements in the destination vector register ( 0 < index < VLEN/SEW) are treated as tail elements using the current tail agnostic/undisturbed policy.

Vx16_vmv_s_x_cg/cp_rs1_edges

vmv-s-x_vstart_ge_vl

If vstart ≥ vl, no operation is performed and the destination register is not updated.

ExceptionsVx_vmv_s_x_cg/cp_vstart_gt_vl

vmv-s-x_vmv-x-s_masked_rsv

The encodings corresponding to the masked versions (vm=0) of VMV.X.S and VMV.S.X are reserved.

SsstrictV_vmv_s_x_cg/cp_ssstrictv_vmv_xs_sx_vm0_reserved

vfmv-f-s_vfmv-s-f_ignorelmul

The instructions ignore LMUL; EMUL is computed as ceil(EEW/VLEN).

Vf16_vfmv_f_s_cg/cp_custom_fmv_fs_vs2_all_lmul_regs, Vf16_vfmv_s_f_cg/cp_custom_fmv_sf_vd_all_lmul_regs

vfmv-f-s_op

The VFMV.F.S instruction copies a single SEW-wide element from index 0 of the source vector register to a destination scalar floating-point register.

Vf16_vfmv_f_s_cg/cp_fd

vfmv-s-f_op

The VFMV.S.F instruction copies the scalar floating-point register to element 0 of the destination vector register. The other elements in the destination vector register (0 < index < VLEN/SEW) are treated as tail elements using the current tail agnostic/undisturbed policy.

Vf16_vfmv_s_f_cg/cp_fs1

vfmv-s-f_vstart_ge_vl

If vstart ≥ vl, no operation is performed and the destination register is not updated.

ExceptionsVf16_vfmv_s_f_cg/cp_vstart_gt_vl

vfmv-s-f_masked_rsv

The encodings corresponding to the masked versions (vm=0) of VFMV.F.S and VFMV.S.F are reserved.

SsstrictV_vfmv_s_f_cg/cp_ssstrictv_vfmv_fs_sf_vm0_reserved

vslide_vstart_ge_vl

For all of the VSLIDEUP, VSLIDEDOWN, VSLIDE1UP, VFSLIDE1UP, VSLIDE1DOWN, and VFSLIDE1DOWN instructions, if vstart ≥ vl, the instruction performs no operation and leaves the destination vector register unchanged.

ExceptionsVx_vslideup_vx_cg/cp_vstart_gt_vl, ExceptionsVx_vslidedown_vx_cg/cp_vstart_gt_vl, ExceptionsVx_vslide1up_vx_cg/cp_vstart_gt_vl, ExceptionsVx_vslide1down_vx_cg/cp_vstart_gt_vl, ExceptionsVf16_vfslide1up_vf_cg/cp_vstart_gt_vl, ExceptionsVf16_vfslide1down_vf_cg/cp_vstart_gt_vl

vslide_mask

The slide instructions may be masked, with mask element i controlling whether destination element i is written. The mask undisturbed/agnostic policy is followed for inactive elements.

Vx16_vslideup_vx_cg/cp_masking_edges, Vx16_vslidedown_vx_cg/cp_masking_edges, Vx16_vslide1up_vx_cg/cp_masking_edges, Vx16_vslide1down_vx_cg/cp_masking_edges, Vf16_vfslide1up_vf_cg/cp_masking_edges, Vf16_vfslide1down_vf_cg/cp_masking_edges

vslideup_op

For VSLIDEUP, the value in vl specifies the maximum number of destination elements that are written. The start index (OFFSET) for the destination can be either specified using an unsigned integer in the x register specified by rs1, or a 5-bit immediate, zero-extended to XLEN bits. If XLEN > SEW, OFFSET is not truncated to SEW bits. Destination elements OFFSET through vl-1 are written if unmasked and if OFFSET < vl.

Vx16_vslideup_vx_cg/cr_vs2_rs1_edges

vslideup_vreg_constr

The destination vector register group for VSLIDEUP cannot overlap the source vector register group, otherwise the instruction encoding is reserved.

SsstrictV_vslideup_vx_cg/cp_ssstrictv_vslideup_vd_vs2_overlap, SsstrictV_vslideup_vi_cg/cp_ssstrictv_vslideup_vd_vs2_overlap

vslidedown_op

For VSLIDEDOWN, the value in vl specifies the maximum number of destination elements that are written. The remaining elements past vl are handled according to the current tail policy (sec-agnostic).

Vx16_vslidedown_vx_cg/cr_vs2_rs1_edges

vslidedown_op_src

The start index (OFFSET) for the source can be either specified using an unsigned integer in the x register specified by rs1, or a 5-bit immediate, zero-extended to XLEN bits. If XLEN > SEW, OFFSET is not truncated to SEW bits.

Vx16_vslidedown_vx_cg/cp_rs1_edges, Vx16_vslidedown_vx_cg/cp_custom_vindexVX_rs1_not_truncated_32, Vx16_vslidedown_vx_cg/cp_custom_vindexVX_rs1_not_truncated_64

vslide1up-vx_op

The VSLIDE1UP instruction places the x register argument at location 0 of the destination vector register group, provided that element 0 is active, otherwise the destination element update follows the current mask agnostic/undisturbed policy. If XLEN < SEW, the value is sign-extended to SEW bits. If XLEN > SEW, the least-significant bits are copied over and the high XLEN-SEW bits are ignored.

Vx16_vslide1up_vx_cg/cr_vs2_rs1_edges

vslide1up-vx_op_rem_elem

The remaining active vl-1 elements are copied over from index i in the source vector register group to index i+1 in the destination vector register group.

Vx16_vslide1up_vx_cg/cr_vs2_rs1_edges

vslide1up-vx_op_vl

The vl register specifies the maximum number of destination vector register elements updated with source values, and remaining elements past vl are handled according to the current tail policy (sec-agnostic).

Vx16_vslide1up_vx_cg/cp_csr_vl_edges

vslide1up-vx_vreg_constr

The VSLIDE1UP instruction requires that the destination vector register group does not overlap the source vector register group. Otherwise, the instruction encoding is reserved.

SsstrictV_vslide1up_vx_cg/cp_ssstrictv_vslide1up_vd_vs2_overlap

vslide1up-vf_op

The VFSLIDE1UP instruction is defined analogously to VSLIDE1UP, but sources its scalar argument from an f register.

Vf16_vfslide1up_vf_cg/cr_vs2_fs1_edges_f_sew16

vslide1down-vx_op

The VSLIDE1DOWN instruction copies the first vl-1 active elements values from index i+1 in the source vector register group to index i in the destination vector register group.

Vx16_vslide1down_vx_cg/cr_vs2_rs1_edges

vslide1down-vx_op_vl

The vl register specifies the maximum number of destination vector register elements written with source values, and remaining elements past vl are handled according to the current tail policy (sec-agnostic).

Vx16_vslide1down_vx_cg/cp_csr_vl_edges

vslide1down-vx_op_details

The VSLIDE1DOWN instruction places the x register argument at location vl-1 in the destination vector register, provided that element vl-1 is active, otherwise the destination element update follows the current mask agnostic/undisturbed policy. If XLEN < SEW, the value is sign-extended to SEW bits. If XLEN > SEW, the least-significant bits are copied over and the high SEW-XLEN bits are ignored.

Vx16_vslide1down_vx_cg/cp_masking_edges, Vx16_vslide1down_vx_cg/cr_vl_lmul_sew16

vslide1down-vf_op

The VFSLIDE1DOWN instruction is defined analogously to VSLIDE1DOWN, but sources its scalar argument from an f register.

Vf16_vfslide1down_vf_cg/cr_vs2_fs1_edges_f_sew16

vrgather_vrgatherei16_vs2_uint

The index values in the second vector are treated as unsigned integers.

Vx16_vrgather_vv_cg/cp_vs1_edges, Vx16_vrgatherei16_vv_cg/cp_vs1_edges

vrgather_vrgatherei16_vs_ignore_vl

The source vector can be read at any index < VLMAX regardless of vl.

Vx16_vrgather_vv_cg/cp_custom_vindexCorners_index_gt_vl_lt_vlmax, Vx16_vrgatherei16_vv_cg/cp_custom_vindexCorners_index_gt_vl_lt_vlmax

vrgather_vrgatherei16_vl

The maximum number of elements to write to the destination register is given by vl,

Vx16_vrgather_vv_cg/cr_vl_lmul_sew16, Vx16_vrgatherei16_vv_cg/cr_vl_lmul_sew16

vrgather_vrgatherei16_tail

and the remaining elements past vl are handled according to the current tail policy (sec-agnostic).

Vx16_vrgather_vv_cg/cr_vtype_agnostic, Vx16_vrgatherei16_vv_cg/cr_vtype_agnostic

vrgather_vrgatherei16_mask

The operation can be masked, and the mask undisturbed/agnostic policy is followed for inactive elements.

Vx16_vrgather_vv_cg/cp_masking_edges, Vx16_vrgatherei16_vv_cg/cp_masking_edges

vrgather-vv_sew_lmul

The VRGATHER.VV form uses SEW/LMUL for both the data and indices.

Vx16_vrgather_vv_cg/cr_vl_lmul_sew16

vrgatherei16-vv_sew_lmul

The VRGATHEREI16.VV form uses SEW/LMUL for the data in vs2 but EEW=16 and EMUL = (16/SEW)*LMUL for the indices in vs1.

Vx32_vrgatherei16_vv_cg/cp_vs1_edges

vrgather_vrgatherei16_id_ge_vlmax

If an element index is out of range ( vs1[i] ≥ VLMAX ) then zero is returned for the element value.

{Vx16_vrgather_vv_cg,Vx16_vrgatherei16_vv_cg}/cp_custom_vindexCorners_index_ge_vlmax

vrgather-vx_vrgather-vi_op

Vector-scalar and vector-immediate forms of the register gather are also provided. These read one element from the source vector at the given index, and write this value to the active elements of the destination vector register. The index value in the scalar register and the immediate, zero-extended to XLEN bits, are treated as unsigned integers. If XLEN > SEW, the index value is not truncated to SEW bits.

{Vx16_vrgather_vx_cg,Vx16_vrgather_vi_cg}/cp_vd, Vx16_vrgather_vx_cg/cp_custom_vindexVX_rs1_not_truncated_64

vrgather_vrgatherei16_vreg_constr

For any VRGATHER instruction, the destination vector register group cannot overlap with the source vector register groups, otherwise the instruction encoding is reserved.

{SsstrictV_vrgather_vv_cg,SsstrictV_vrgatherei16_vv_cg}/cp_ssstrictv_vrgather_vd_vs2_overlap

vcompress_op

The vector mask register specified by vs1 indicates which of the first vl elements of vector register group vs2 should be extracted and packed into contiguous elements at the beginning of vector register vd. The remaining elements of vd are treated as tail elements according to the current tail policy (sec-agnostic).

Vx16_vcompress_vm_cg/cr_vs2_vs1_edges

vcompress_enc

VCOMPRESS is encoded as an unmasked instruction (vm=1).

Vx8_vcompress_vm_cg/cp_asm_count, Vx16_vcompress_vm_cg/cp_asm_count, Vx32_vcompress_vm_cg/cp_asm_count, Vx64_vcompress_vm_cg/cp_asm_count, SsstrictV_vcompress_vm_cg/cp_ssstrictv_vcompress_vm0_reserved

vcompress_masked_rsv

The equivalent masked instruction (vm=0) is reserved.

SsstrictV_vcompress_vm_cg/cp_ssstrictv_vcompress_vm0_reserved

vcompress_vreg_constr

The destination vector register group cannot overlap the source vector register group or the source mask register, otherwise the instruction encoding is reserved.

SsstrictV_vcompress_vm_cg/cp_ssstrictv_vcompress_vd_vs2_overlap

vcompress_trap

A trap on a VCOMPRESS instruction is always reported with a vstart of 0.

vcompress_vstart_n0_ill

Executing a VCOMPRESS instruction with a non-zero vstart raises an illegal-instruction exception.

ExceptionsVx_vcompress_vm_cg/cp_vstart_gt_vl, ExceptionsVx_vcompress_vm_cg/cp_vstart

vmv-nr-r_op

The VMV<NR>R.V instructions copy whole vector registers (i.e., all VLEN bits) and can copy whole vector register groups. The nr value in the opcode is the number of individual vector registers, NREG, to copy. The instructions operate as if EMUL = NREG, EEW = min(VLEN*EMUL, SEW), and effective length evl = EMUL * VLEN/EEW.

Vx8_vmv1r_v_cg/cr_vl_lmul_sew8, Vx8_vmv2r_v_cg/cr_vl_lmul_sew8, Vx8_vmv4r_v_cg/cr_vl_lmul_sew8, Vx8_vmv8r_v_cg/cr_vl_lmul_sew8

vmv-nr-r_enc

The instruction is encoded as an OPIVI instruction. The number of vector registers to copy is encoded in the low three bits of the imm field (imm[2:0]) using the same encoding as the nf[2:0] field for memory instructions (Figure fig-nf), i.e., imm[2:0] = NREG-1.

SsstrictV_vmv1r_v_cg/cp_ssstrictv_vmvnr_simm_reserved, Vx8_vmv1r_v_cg/cp_asm_count, Vx8_vmv2r_v_cg/cp_asm_count, Vx8_vmv4r_v_cg/cp_asm_count, Vx8_vmv8r_v_cg/cp_asm_count

vmv-nr-r_nreg_rsv

The value of NREG must be 1, 2, 4, or 8, and values of imm[4:0] other than 0, 1, 3, and 7 are reserved.

SsstrictV_vmv1r_v_cg/cp_ssstrictv_vmvnr_simm_reserved

vmv-nr-r_vreg_constr

The source and destination vector register numbers must be aligned appropriately for the vector register group size,

SsstrictV_vmv2r_v_cg/cp_ssstrictv_vmv2r_both_unaligned

vmv-nr-r_unaligned_rsv

encodings with other vector register numbers are reserved.

SsstrictV_vmv4r_v_cg/cp_ssstrictv_vmv4r_both_unaligned

epc_vstart_op_V_trap

On a trap during a vector instruction (caused by either a synchronous exception or an asynchronous interrupt), the existing *epc CSR is written with a pointer to the trapping vector instruction, while the vstart CSR contains the element index on which the trap was taken.

ExceptionsVx_vsaddu_vv_cg/cp_vstart

Zve_xlen

Zve32x is compatible with all currently defined base ISAs.

Implicit: extension-support requirement exercised by the config simply running under that XLEN

Zve32f_Zve64x_dependent_Zve32x

Zve64x depends upon the Zve32x extension.

Implicit: extension-composition fact exercised implicitly whenever the config runs at all

Zve64f_dependent_Zve32f_Zve64x

Zve64f depends on the Zve64x and Zve32f extensions.

Implicit: extension-composition fact exercised implicitly whenever the config runs at all

Zve64d_dependent_Zve64f

The Zve64d extension depends on the Zve64f and D extensions.

Implicit: extension-composition fact exercised implicitly whenever the config runs at all

Zve_precise_traps

The Zve32x extension has precise traps.

Untestable: trap precision is a cross-cutting property of every exception test, not something one coverpoint can isolate

Zve_eew

Zve32x provides support for EEW of 8, 16, and 32.

Implicit: extension-support requirement exercised implicitly by which EEWs the generated suite runs at all

Zve_nsupport_eew64_xlen32

Zve64x supports all vector load and store instructions (sec-vector-memory), except EEW=64 for index values is not supported when XLEN=32.

Implicit: extension-support exclusion exercised implicitly by config-driven test generation filtering

Zve64_eew64_nsupport_vmulh

Zve64x supports all vector integer instructions (sec-vector-integer), except that the VMULH integer multiply variants that return the high half of the product (VMULH.VV, VMULH.VX, VMULHU.VV, VMULHU.VX, VMULHSU.VV, VMULHSU.VX) are not included for EEW=64.

Implicit: config-driven instruction exclusion exercised implicitly by test generation filtering

Zve64_eew64_nsupport_vsmul

Zve64x supports all vector fixed-point arithmetic instructions (sec-vector-fixed-point), except that VSMUL.VV and VSMUL.VX are not included for EEW=64.

Implicit: config-driven instruction exclusion exercised implicitly by test generation filtering

Zve32x_Zve64x_nsupport_freg

Zve32x supports all vector integer permutation instructions (sec-vector-integer-permute).

Implicit: extension-support requirement exercised implicitly by config-driven test generation filtering

Zve32x_dependent_Zicsr

The Zve32x extension depends on the Zicsr extension.

Sm_V_cg/cp_vcsrrswc, U_V_cg/cp_vcsrrswc, S_V_cg/cp_vcsrrswc, H_V_cg/cp_vcsrrswc

Zve32f_Zve64f_dependent_F

The Zve32f extension depends on the Zve32x and F extensions.

Implicit: extension-composition fact exercised implicitly whenever the config runs at all

misa_v_op

The misa.⁠V bit is set for implementations providing misa and supporting V.

Sm_mcsr_cg/cp_misa_v

V_precise_traps

The V vector extension has precise traps.

Untestable: trap precision is a cross-cutting property of every exception test, not something one coverpoint can isolate

V_dependent_Zvl128b_Zve64d

The V vector extension depends upon the Zvl128b and Zve64d extensions.

Implicit: extension-composition fact exercised implicitly whenever the config runs at all

V_supported_eew

The V extension supports EEW of 8, 16, 32, and 64.

{Vx8_vadd_vv_cg,Vx16_vadd_vv_cg,Vx32_vadd_vv_cg,Vx64_vadd_vv_cg}/cp_asm_count

V_instr_config

The V extension supports the vector configuration instructions (sec-vector-config).

Implicit: extension-support requirement exercised implicitly by which instructions the generated suite runs at all

V_instr_ls_eew64_nsupported_xlen32

The V extension supports all vector load and store instructions (sec-vector-memory), except the V extension does not support EEW=64 for index values when XLEN=32.

Implicit: extension-support requirement exercised implicitly by which instructions the generated suite runs at all

V_instr_int

The V extension supports all vector integer instructions (sec-vector-integer).

Implicit: extension-support requirement exercised implicitly by which instructions the generated suite runs at all

V_instr_fixedpt

The V extension supports all vector fixed-point arithmetic instructions (sec-vector-fixed-point).

Implicit: extension-support requirement exercised implicitly by which instructions the generated suite runs at all

V_instr_red

The V extension supports all vector integer single-width and widening reduction operations (sec-vector-integer-reduce, sec-vector-integer-reduce-widen).

Implicit: extension-support requirement exercised implicitly by which instructions the generated suite runs at all

V_instr_mask

The V extension supports all vector mask instructions (sec-vector-mask).

Implicit: extension-support requirement exercised implicitly by which instructions the generated suite runs at all

V_instr_perm

The V extension supports all vector permutation instructions (sec-vector-integer-permute, sec-vector-float-permute).

Implicit: extension-support requirement exercised implicitly by which instructions the generated suite runs at all

V_dependent_F_D

The V extension depends upon the F and D extensions, and implements all vector floating-point instructions (sec-vector-float) for floating-point operands with EEW=32 or EEW=64 (including widening instructions and conversions between FP32 and FP64).

Implicit: the F and D dependency is satisfied by the configuration under test; the vector floating-point tests cannot run without it

Zvfhmin_dependent_Zve32f

The Zvfhmin extension depends on the Zve32f extension.

Implicit: extension-composition fact exercised implicitly whenever the config runs at all

Zvfh_instr

When the Zvfh extension is implemented, all instructions in sec-vector-float, sec-vector-float-reduce, sec-vector-float-reduce-widen, sec-vector-float-move, sec-vfslide1up, and sec-vfslide1down become defined when SEW=16.

Implicit: extension-support requirement exercised implicitly by which instructions the generated suite runs at all

Zvfh_instr_cvt

Additionally, conversions between 8-bit integers and binary16 values are provided. The floating-point-to-integer narrowing conversions (VFNCVT.X.F.W, VFNCVT.XU.F.W, VFNCVT.RTZ.X.F.W, and VFNCVT.RTZ.XU.F.W) and integer-to-floating-point widening conversions (VFWCVT.F.X.V and VFWCVT.F.XU.V) become defined when SEW=8.

Vf16_vfwcvt_f_x_v_cg/cp_asm_count, Vf16_vfwcvt_f_xu_v_cg/cp_asm_count, Vf16_vfncvt_x_f_w_cg/cp_asm_count, Vf16_vfncvt_xu_f_w_cg/cp_asm_count, Vf16_vfncvt_rtz_x_f_w_cg/cp_asm_count, Vf16_vfncvt_rtz_xu_f_w_cg/cp_asm_count

Zvfh_eew16

The EEW=16 floating-point operands of these instructions use the binary16 format.

Implicit: extension-support requirement exercised implicitly by which EEWs the generated suite runs at all

Zvfh_dependent_Zve32f_Zfhmin

The Zvfh extension depends on the Zve32f and Zfhmin extensions.

Implicit: extension-composition fact exercised implicitly whenever the config runs at all

egs_ge_vlmax_rsv

Vector instructions with EGS > VLMAX are reserved.

Out-of-Scope: no Ssstrict-equivalent suite exists for the vector-crypto (Zvk*) extensions, and this reserved condition depends on CSR state, matching Ssstrict’s own encoding-only scope boundary

egs_vl_rsv

When an operand is a vector of element groups, the vl setting must correspond to an integer multiple of the element group size, with other values of vl reserved.

Out-of-Scope: no Ssstrict-equivalent suite exists for the vector-crypto (Zvk*) extensions, and this reserved condition depends on CSR state, matching Ssstrict’s own encoding-only scope boundary

egs_vl_avl

When element group instructions are present, an additional constraint is placed on the setting of vl based on an AVL value (augmenting constraints-on-setting-vl). EGSMAX is the largest EGS supported by the implementation. When AVL > VLMAX, the value of vl must be set to either VLMAX or a positive integer multiple of EGSMAX.

Untestable: AVL-to-vl rounding under EGSMAX is not exercised by any suite and depends on an implementation-chosen EGSMAX

egs_sew_eew

The vtype SEW can be used to indicate or calculate the effective element size (EEW) of one or more operands of an element group instruction. Where the operand is an element group, SEW and EEW refer to the number of bits in each individual element within a group not the number of bits in the group as a whole.

Zvknha_vsha2ch_vv_cg/cp_csr_vtype_lmul_egs4_sew32

egs_lmul_emul

The vtype LMUL setting can be used to indicate or calculate the effective length multiplier (EMUL) for one or more operands. Element group instructions tend to exhibit a much wider range of relationships between various operand EEW/EMUL values. For example, an instruction might take a vector of length N of 4-element groups with EEW=8b and reduce each group to produce a vector length N of 1-element groups with EEW=32b. In this case, the input and output EMUL values are equal even though the EEW settings differ by a factor of 4.

Zvknha_vsha2ch_vv_cg/cr_vl_lmul_egs4_sew32

egs_egw

The element group width (EGW) is the number of bits in the element group as a whole. For example, the SHA-256 instructions in the Zvknha extension operate on an EGW of 128, with EGS=4 and EEW=32. It is possible to use LMUL to concatenate multiple vector registers together to support larger EGW>VLEN.

Zvknha_vsha2ch_vv_cg/cp_vd_egs4

vector_active_element

The active elements can raise exceptions and update the destination vector register group.

Vx16_vadd_vv_cg/cp_masking_edges

vector_ls_rvtso

If the Ztso extension is implemented, vector memory instructions additionally follow RVTSO at the instruction level.

Not Tested: no Ztso-configured vector test config exists yet to exercise RVTSO ordering

vnclipu_vnclip_rounding

For VNCLIPU and VNCLIP, the rounding mode is specified in the vxrm CSR. Rounding occurs around the least-significant bit of the destination and before saturation.

{Vx16_vnclip_wv_cg,Vx16_vnclipu_wv_cg}/cr_vxrm_vs2_vs1_edges_wv

vf_requires_vx

Vector floating-point instructions require the presence of base scalar floating-point extensions corresponding to the supported vector floating-point element widths.

Implicit: the vector floating-point tests cannot run unless the scalar floating-point extensions are present

instrgrp_vmask_disregard_vlmul

so these instructions all operate on single vector registers regardless of the setting of the VLMUL field in vtype. They do not change the value of VLMUL.

Vx16_vmseq_vv_cg/cp_custom_vmask_write_lmulge1

viota_restart

execution is always restarted from the beginning when resuming after a trap handler.

Not Tested: restart-from-vstart-after-trap sequencing is not generated by this suite yet

vrgather-vv_op_vrgatherei16-vv_op

vrgather.vv vd, vs2, vs1, vm # vd[i] = (vs1[i] >= VLMAX) ? 0 : vs2[vs1[i]]; vrgatherei16.vv vd, vs2, vs1, vm # vd[i] = (vs1[i] >= VLMAX) ? 0 : vs2[vs1[i]];

Vx16_vrgather_vv_cg/cp_custom_vindexCorners_index_gt_vl_lt_vlmax

vector_reset_state

The vector extension must have a consistent state at reset. In particular, vtype and vl must have values that can be read and then restored with a single vsetvl instruction.

Untestable: reset-time CSR state is not observable via a coverpoint in a self-checking test that boots past reset

Zve32f_instr_perm

Zve32f supports all vector floating-point permutation instructions (sec-vector-float-permute) for floating-point operands with EEW=32.

Implicit: extension-support requirement exercised implicitly by which instructions the generated suite runs at all

Zve64d_instr_perm

Zve64d supports all vector floating-point permutation instructions (sec-vector-float-permute) for floating-point operands with EEW=32 or EEW=64.

Implicit: extension-support requirement exercised implicitly by which instructions the generated suite runs at all

vset_vstart

The configuration-setting instructions do not depend on vstart; they reset vstart to zero.

TODO: vset* with nonzero vstart; result unaffected and vstart reset to 0

vec_store_nonidempotent_no_update

Non-idempotent memory regions must not have been updated for indices equal to or greater than the element that caused a synchronous trap during a vector store instruction.

Untestable: no I/O devices defined in profile

UDB Parameters: None.

A.11.5. Vls

Table 128. Vls Instruction Coverpoints
Instruction vle8.v vle16.v vle32.v vle64.v vlseg2e8.v vlseg2e16.v vlseg2e32.v vlseg2e64.v vlseg3e8.v vlseg3e16.v vlseg3e32.v vlseg3e64.v

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW8

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW16

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW32

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW64

x

x

x

x

x

x

x

x

x

x

x

x

cp_asm_count

x

x

x

x

x

x

x

x

x

x

x

x

cp_vd

x

x

x

x

lte30

lte30

lte30

lte30

lte29

lte29

lte29

lte29

cp_rs1

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

cp_masking_edges

x

x

x

x

x

x

x

x

x

x

x

x

cr_vl_lmul

e8

e16

e32

e64

e8_emul4max

e16_emul4max

e32_emul4max

e64_emul4max

e8_emul2max

e16_emul2max

e32_emul2max

e64_emul2max

cr_vtype_agnostic

e8

e16

e32

e64

e8_emul4max

e16_emul4max

e32_emul4max

e64_emul4max

e8_emul2max

e16_emul2max

e32_emul2max

e64_emul2max

cp_vl_0

x

x

x

x

x

x

x

x

x

x

x

x

std_vec

x

x

x

x

x

x

x

x

x

x

x

Instruction vlseg4e8.v vlseg4e16.v vlseg4e32.v vlseg4e64.v vlseg5e8.v vlseg5e16.v vlseg5e32.v vlseg5e64.v vlseg6e8.v vlseg6e16.v vlseg6e32.v vlseg6e64.v

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW8

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW16

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW32

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW64

x

x

x

x

x

x

x

x

x

x

x

x

cp_asm_count

x

x

x

x

x

x

x

x

x

x

x

x

cp_vd

lte28

lte28

lte28

lte28

lte27

lte27

lte27

lte27

lte26

lte26

lte26

lte26

cp_rs1

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

cp_masking_edges

x

x

x

x

x

x

x

x

x

x

x

x

cr_vl_lmul

e8_emul2max

e16_emul2max

e32_emul2max

e64_emul2max

e8_emul1max

e16_emul1max

e32_emul1max

e64_emul1max

e8_emul1max

e16_emul1max

e32_emul1max

e64_emul1max

cr_vtype_agnostic

e8_emul2max

e16_emul2max

e32_emul2max

e64_emul2max

e8_emul1max

e16_emul1max

e32_emul1max

e64_emul1max

e8_emul1max

e16_emul1max

e32_emul1max

e64_emul1max

cp_vl_0

x

x

x

x

x

x

x

x

x

x

x

x

std_vec

x

x

x

x

x

x

x

x

x

x

x

Instruction vlseg7e8.v vlseg7e16.v vlseg7e32.v vlseg7e64.v vlseg8e8.v vlseg8e16.v vlseg8e32.v vlseg8e64.v vle8ff.v vle16ff.v vle32ff.v vle64ff.v

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW8

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW16

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW32

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW64

x

x

x

x

x

x

x

x

x

x

x

x

cp_asm_count

x

x

x

x

x

x

x

x

x

x

x

x

cp_vd

lte25

lte25

lte25

lte25

lte24

lte24

lte24

lte24

x

x

x

x

cp_rs1

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

cp_masking_edges

x

x

x

x

x

x

x

x

x

x

x

x

cr_vl_lmul

e8_emul1max

e16_emul1max

e32_emul1max

e64_emul1max

e8_emul1max

e16_emul1max

e32_emul1max

e64_emul1max

e8

e16

e32

e64

cr_vtype_agnostic

e8_emul1max

e16_emul1max

e32_emul1max

e64_emul1max

e8_emul1max

e16_emul1max

e32_emul1max

e64_emul1max

e8

e16

e32

e64

cp_vl_0

x

x

x

x

x

x

x

x

x

x

x

x

std_vec

x

x

x

x

x

x

x

x

x

x

x

x

cp_custom_ffLS_update_vl

x

x

x

sew_ge16

cp_custom_ffLS

x

x

x

x

Instruction vlseg2e8ff.v vlseg2e16ff.v vlseg2e32ff.v vlseg2e64ff.v vlseg3e8ff.v vlseg3e16ff.v vlseg3e32ff.v vlseg3e64ff.v vlseg4e8ff.v vlseg4e16ff.v vlseg4e32ff.v vlseg4e64ff.v

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW8

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW16

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW32

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW64

x

x

x

x

x

x

x

x

x

x

x

x

cp_asm_count

x

x

x

x

x

x

x

x

x

x

x

x

cp_vd

lte30

lte30

lte30

lte30

lte29

lte29

lte29

lte29

lte28

lte28

lte28

lte28

cp_rs1

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

cp_masking_edges

x

x

x

x

x

x

x

x

x

x

x

x

cr_vl_lmul

e8_emul4max

e16_emul4max

e32_emul4max

e64_emul4max

e8_emul2max

e16_emul2max

e32_emul2max

e64_emul2max

e8_emul2max

e16_emul2max

e32_emul2max

e64_emul2max

cr_vtype_agnostic

e8_emul4max

e16_emul4max

e32_emul4max

e64_emul4max

e8_emul2max

e16_emul2max

e32_emul2max

e64_emul2max

e8_emul2max

e16_emul2max

e32_emul2max

e64_emul2max

cp_vl_0

x

x

x

x

x

x

x

x

x

x

x

x

std_vec

x

x

x

x

x

x

x

x

x

x

x

cp_custom_ffLS_update_vl

x

x

sew_ge16

sew_ge32

x

sew_ge16

sew_ge64

x

sew_ge16

sew_ge32

sew_ge64

cp_custom_ffLS

x

x

x

x

x

x

x

x

x

x

x

x

Instruction vlseg5e8ff.v vlseg5e16ff.v vlseg5e32ff.v vlseg5e64ff.v vlseg6e8ff.v vlseg6e16ff.v vlseg6e32ff.v vlseg6e64ff.v vlseg7e8ff.v vlseg7e16ff.v vlseg7e32ff.v vlseg7e64ff.v

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW8

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW16

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW32

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW64

x

x

x

x

x

x

x

x

x

x

x

x

cp_asm_count

x

x

x

x

x

x

x

x

x

x

x

x

cp_vd

lte27

lte27

lte27

lte27

lte26

lte26

lte26

lte26

lte25

lte25

lte25

lte25

cp_rs1

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

cp_masking_edges

x

x

x

x

x

x

x

x

x

x

x

x

cr_vl_lmul

e8_emul1max

e16_emul1max

e32_emul1max

e64_emul1max

e8_emul1max

e16_emul1max

e32_emul1max

e64_emul1max

e8_emul1max

e16_emul1max

e32_emul1max

e64_emul1max

cr_vtype_agnostic

e8_emul1max

e16_emul1max

e32_emul1max

e64_emul1max

e8_emul1max

e16_emul1max

e32_emul1max

e64_emul1max

e8_emul1max

e16_emul1max

e32_emul1max

e64_emul1max

cp_vl_0

x

x

x

x

x

x

x

x

x

x

x

x

std_vec

x

x

x

x

x

x

x

x

x

x

x

x

cp_custom_ffLS_update_vl

sew_ge16

sew_ge32

sew_ge64

sew_ge16

sew_ge32

sew_ge64

sew_ge16

sew_ge32

sew_ge64

cp_custom_ffLS

x

x

x

x

x

x

x

x

x

x

x

x

Instruction vlseg8e8ff.v vlseg8e16ff.v vlseg8e32ff.v vlseg8e64ff.v vlse8.v vlse16.v vlse32.v vlse64.v vlsseg2e8.v vlsseg2e16.v vlsseg2e32.v vlsseg2e64.v

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW8

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW16

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW32

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW64

x

x

x

x

x

x

x

x

x

x

x

x

cp_asm_count

x

x

x

x

x

x

x

x

x

x

x

x

cp_vd

lte24

lte24

lte24

lte24

x

x

x

x

lte30

lte30

lte30

lte30

cp_rs1

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

cp_rs2

x

x

x

x

x

x

x

x

cp_rs2_edges

ls_e8

ls_e16

ls_e32

ls_e64

ls_e8

ls_e16

ls_e32

ls_e64

cp_masking_edges

x

x

x

x

x

x

x

x

x

x

x

x

cr_vl_lmul

e8_emul1max

e16_emul1max

e32_emul1max

e64_emul1max

e8

e16

e32

e64

e8_emul4max

e16_emul4max

e32_emul4max

e64_emul4max

cr_vtype_agnostic

e8_emul1max

e16_emul1max

e32_emul1max

e64_emul1max

e8

e16

e32

e64

e8_emul4max

e16_emul4max

e32_emul4max

e64_emul4max

cp_vl_0

x

x

x

x

x

x

x

x

x

x

x

x

std_vec

x

x

x

x

x

x

x

x

x

x

x

x

cp_custom_ffLS_update_vl

sew_ge16

sew_ge32

sew_ge64

cp_custom_ffLS

x

x

x

x

Instruction vlsseg3e8.v vlsseg3e16.v vlsseg3e32.v vlsseg3e64.v vlsseg4e8.v vlsseg4e16.v vlsseg4e32.v vlsseg4e64.v vlsseg5e8.v vlsseg5e16.v vlsseg5e32.v vlsseg5e64.v

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW8

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW16

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW32

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW64

x

x

x

x

x

x

x

x

x

x

x

x

cp_asm_count

x

x

x

x

x

x

x

x

x

x

x

x

cp_vd

lte29

lte29

lte29

lte29

lte28

lte28

lte28

lte28

lte27

lte27

lte27

lte27

cp_rs1

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

cp_rs2

x

x

x

x

x

x

x

x

x

x

x

x

cp_rs2_edges

ls_e8

ls_e16

ls_e32

ls_e64

ls_e8

ls_e16

ls_e32

ls_e64

ls_e8

ls_e16

ls_e32

ls_e64

cp_masking_edges

x

x

x

x

x

x

x

x

x

x

x

x

cr_vl_lmul

e8_emul2max

e16_emul2max

e32_emul2max

e64_emul2max

e8_emul2max

e16_emul2max

e32_emul2max

e64_emul2max

e8_emul1max

e16_emul1max

e32_emul1max

e64_emul1max

cr_vtype_agnostic

e8_emul2max

e16_emul2max

e32_emul2max

e64_emul2max

e8_emul2max

e16_emul2max

e32_emul2max

e64_emul2max

e8_emul1max

e16_emul1max

e32_emul1max

e64_emul1max

cp_vl_0

x

x

x

x

x

x

x

x

x

x

x

x

std_vec

x

x

x

x

x

x

x

x

x

x

x

x

Instruction vlsseg6e8.v vlsseg6e16.v vlsseg6e32.v vlsseg6e64.v vlsseg7e8.v vlsseg7e16.v vlsseg7e32.v vlsseg7e64.v vlsseg8e8.v vlsseg8e16.v vlsseg8e32.v vlsseg8e64.v

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW8

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW16

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW32

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW64

x

x

x

x

x

x

x

x

x

x

x

x

cp_asm_count

x

x

x

x

x

x

x

x

x

x

x

x

cp_vd

lte26

lte26

lte26

lte26

lte25

lte25

lte25

lte25

lte24

lte24

lte24

lte24

cp_rs1

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

cp_rs2

x

x

x

x

x

x

x

x

x

x

x

x

cp_rs2_edges

ls_e8

ls_e16

ls_e32

ls_e64

ls_e8

ls_e16

ls_e32

ls_e64

ls_e8

ls_e16

ls_e32

ls_e64

cp_masking_edges

x

x

x

x

x

x

x

x

x

x

x

x

cr_vl_lmul

e8_emul1max

e16_emul1max

e32_emul1max

e64_emul1max

e8_emul1max

e16_emul1max

e32_emul1max

e64_emul1max

e8_emul1max

e16_emul1max

e32_emul1max

e64_emul1max

cr_vtype_agnostic

e8_emul1max

e16_emul1max

e32_emul1max

e64_emul1max

e8_emul1max

e16_emul1max

e32_emul1max

e64_emul1max

e8_emul1max

e16_emul1max

e32_emul1max

e64_emul1max

cp_vl_0

x

x

x

x

x

x

x

x

x

x

x

x

std_vec

x

x

x

x

x

x

x

x

x

x

x

x

Instruction vluxei8.v vluxei16.v vluxei32.v vluxei64.v vluxseg2ei8.v vluxseg2ei16.v vluxseg2ei32.v vluxseg2ei64.v vluxseg3ei8.v vluxseg3ei16.v vluxseg3ei32.v vluxseg3ei64.v

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW8

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW16

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW32

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW64

x

x

x

x

x

x

x

x

x

x

x

x

cp_asm_count

x

x

x

x

x

x

x

x

x

x

x

x

cp_vd

x

x

x

x

lte30

lte30

lte30

lte30

lte29

lte29

lte29

lte29

cp_vs2

x

x

x

x

x

x

x

x

x

x

x

x

cp_vs2_edges

ls

ls

ls

ls

ls

ls

ls

ls

ls

ls

ls

ls

cmp_vd_vs2

eew_eq_sew

eew_eq_sew

eew_eq_sew

eew_eq_sew

cp_rs1

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

cp_masking_edges

x

x

x

x

x

x

x

x

x

x

x

x

cr_vl_lmul

e8

e16

e32

e64

e8_emul4max

e16_emul4max

e32_emul4max

e64_emul4max

e8_emul2max

e16_emul2max

e32_emul2max

e64_emul2max

cr_vtype_agnostic

e8

e16

e32

e64

e8_emul4max

e16_emul4max

e32_emul4max

e64_emul4max

e8_emul2max

e16_emul2max

e32_emul2max

e64_emul2max

cp_vl_0

x

x

x

x

x

x

x

x

x

x

x

x

std_vec

x

x

x

x

x

x

x

x

x

x

x

x

cp_custom_ls_indexed_truncated

x

x

x

cp_custom_indexed_emul_data_only

x

x

sew_ge16

sew_ge32

cp_custom_indexed_overlap

eew8

eew16

eew32

eew64

Instruction vluxseg4ei8.v vluxseg4ei16.v vluxseg4ei32.v vluxseg4ei64.v vluxseg5ei8.v vluxseg5ei16.v vluxseg5ei32.v vluxseg5ei64.v vluxseg6ei8.v vluxseg6ei16.v vluxseg6ei32.v vluxseg6ei64.v

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW8

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW16

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW32

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW64

x

x

x

x

x

x

x

x

x

x

x

x

cp_asm_count

x

x

x

x

x

x

x

x

x

x

x

x

cp_vd

lte28

lte28

lte28

lte28

lte27

lte27

lte27

lte27

lte26

lte26

lte26

lte26

cp_vs2

x

x

x

x

x

x

x

x

x

x

x

x

cp_vs2_edges

ls

ls

ls

ls

ls

ls

ls

ls

ls

ls

ls

ls

cp_rs1

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

cp_masking_edges

x

x

x

x

x

x

x

x

x

x

x

x

cr_vl_lmul

e8_emul2max

e16_emul2max

e32_emul2max

e64_emul2max

e8_emul1max

e16_emul1max

e32_emul1max

e64_emul1max

e8_emul1max

e16_emul1max

e32_emul1max

e64_emul1max

cr_vtype_agnostic

e8_emul2max

e16_emul2max

e32_emul2max

e64_emul2max

e8_emul1max

e16_emul1max

e32_emul1max

e64_emul1max

e8_emul1max

e16_emul1max

e32_emul1max

e64_emul1max

cp_vl_0

x

x

x

x

x

x

x

x

x

x

x

x

std_vec

x

x

x

x

x

x

x

x

x

x

x

x

cp_custom_ls_indexed_truncated

x

x

x

cp_custom_indexed_emul_data_only

x

x

x

sew_ge16

Instruction vluxseg7ei8.v vluxseg7ei16.v vluxseg7ei32.v vluxseg7ei64.v vluxseg8ei8.v vluxseg8ei16.v vluxseg8ei32.v vluxseg8ei64.v vloxei8.v vloxei16.v vloxei32.v vloxei64.v

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW8

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW16

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW32

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW64

x

x

x

x

x

x

x

x

x

x

x

x

cp_asm_count

x

x

x

x

x

x

x

x

x

x

x

x

cp_vd

lte25

lte25

lte25

lte25

lte24

lte24

lte24

lte24

x

x

x

x

cp_vs2

x

x

x

x

x

x

x

x

x

x

x

x

cp_vs2_edges

ls

ls

ls

ls

ls

ls

ls

ls

ls

ls

ls

ls

cmp_vd_vs2

eew_eq_sew

eew_eq_sew

eew_eq_sew

eew_eq_sew

cp_rs1

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

cp_masking_edges

x

x

x

x

x

x

x

x

x

x

x

x

cr_vl_lmul

e8_emul1max

e16_emul1max

e32_emul1max

e64_emul1max

e8_emul1max

e16_emul1max

e32_emul1max

e64_emul1max

e8

e16

e32

e64

cr_vtype_agnostic

e8_emul1max

e16_emul1max

e32_emul1max

e64_emul1max

e8_emul1max

e16_emul1max

e32_emul1max

e64_emul1max

e8

e16

e32

e64

cp_vl_0

x

x

x

x

x

x

x

x

x

x

x

x

std_vec

x

x

x

x

x

x

x

x

x

x

x

x

cp_custom_ls_indexed_truncated

x

x

x

cp_custom_indexed_emul_data_only

x

x

x

x

cp_custom_indexed_overlap

eew8

eew16

eew32

eew64

cp_custom_ordered_index_overlap

x

x

x

x

Instruction vloxseg2ei8.v vloxseg2ei16.v vloxseg2ei32.v vloxseg2ei64.v vloxseg3ei8.v vloxseg3ei16.v vloxseg3ei32.v vloxseg3ei64.v vloxseg4ei8.v vloxseg4ei16.v vloxseg4ei32.v vloxseg4ei64.v

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW8

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW16

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW32

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW64

x

x

x

x

x

x

x

x

x

x

x

x

cp_asm_count

x

x

x

x

x

x

x

x

x

x

x

x

cp_vd

lte30

lte30

lte30

lte30

lte29

lte29

lte29

lte29

lte28

lte28

lte28

lte28

cp_vs2

x

x

x

x

x

x

x

x

x

x

x

x

cp_vs2_edges

ls

ls

ls

ls

ls

ls

ls

ls

ls

ls

ls

ls

cp_rs1

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

cp_masking_edges

x

x

x

x

x

x

x

x

x

x

x

x

cr_vl_lmul

e8_emul4max

e16_emul4max

e32_emul4max

e64_emul4max

e8_emul2max

e16_emul2max

e32_emul2max

e64_emul2max

e8_emul2max

e16_emul2max

e32_emul2max

e64_emul2max

cr_vtype_agnostic

e8_emul4max

e16_emul4max

e32_emul4max

e64_emul4max

e8_emul2max

e16_emul2max

e32_emul2max

e64_emul2max

e8_emul2max

e16_emul2max

e32_emul2max

e64_emul2max

cp_vl_0

x

x

x

x

x

x

x

x

x

x

x

x

std_vec

x

x

x

x

x

x

x

x

x

x

x

x

cp_custom_ls_indexed_truncated

x

x

x

cp_custom_indexed_emul_data_only

x

x

sew_ge16

sew_ge32

x

x

x

sew_ge16

cp_custom_ordered_index_overlap

x

x

x

x

x

x

x

x

x

x

x

x

Instruction vloxseg5ei8.v vloxseg5ei16.v vloxseg5ei32.v vloxseg5ei64.v vloxseg6ei8.v vloxseg6ei16.v vloxseg6ei32.v vloxseg6ei64.v vloxseg7ei8.v vloxseg7ei16.v vloxseg7ei32.v vloxseg7ei64.v

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW8

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW16

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW32

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW64

x

x

x

x

x

x

x

x

x

x

x

x

cp_asm_count

x

x

x

x

x

x

x

x

x

x

x

x

cp_vd

lte27

lte27

lte27

lte27

lte26

lte26

lte26

lte26

lte25

lte25

lte25

lte25

cp_vs2

x

x

x

x

x

x

x

x

x

x

x

x

cp_vs2_edges

ls

ls

ls

ls

ls

ls

ls

ls

ls

ls

ls

ls

cp_rs1

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

cp_masking_edges

x

x

x

x

x

x

x

x

x

x

x

x

cr_vl_lmul

e8_emul1max

e16_emul1max

e32_emul1max

e64_emul1max

e8_emul1max

e16_emul1max

e32_emul1max

e64_emul1max

e8_emul1max

e16_emul1max

e32_emul1max

e64_emul1max

cr_vtype_agnostic

e8_emul1max

e16_emul1max

e32_emul1max

e64_emul1max

e8_emul1max

e16_emul1max

e32_emul1max

e64_emul1max

e8_emul1max

e16_emul1max

e32_emul1max

e64_emul1max

cp_vl_0

x

x

x

x

x

x

x

x

x

x

x

x

std_vec

x

x

x

x

x

x

x

x

x

x

x

x

cp_custom_ls_indexed_truncated

x

x

x

cp_custom_ordered_index_overlap

x

x

x

x

x

x

x

x

x

x

x

x

Instruction vloxseg8ei8.v vloxseg8ei16.v vloxseg8ei32.v vloxseg8ei64.v vse8.v vse16.v vse32.v vse64.v vsseg2e8.v vsseg2e16.v vsseg2e32.v vsseg2e64.v

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW8

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW16

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW32

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW64

x

x

x

x

x

x

x

x

x

x

x

x

cp_asm_count

x

x

x

x

x

x

x

x

x

x

x

x

cp_vd

lte24

lte24

lte24

lte24

cp_vs3

x

x

x

x

lte30

lte30

lte30

lte30

cp_vs2

x

x

x

x

cp_vs2_edges

ls

ls

ls

ls

cp_rs1

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

cp_masking_edges

x

x

x

x

x

x

x

x

x

x

x

x

cr_vl_lmul

e8_emul1max

e16_emul1max

e32_emul1max

e64_emul1max

e8

e16

e32

e64

e8_emul4max

e16_emul4max

e32_emul4max

e64_emul4max

cr_vtype_agnostic

e8_emul1max

e16_emul1max

e32_emul1max

e64_emul1max

e8

e16

e32

e64

e8_emul4max

e16_emul4max

e32_emul4max

e64_emul4max

cp_vl_0

x

x

x

x

x

x

x

x

x

x

x

x

std_vec

x

x

x

x

x

x

x

x

x

x

x

x

cp_custom_ls_indexed_truncated

x

cp_custom_indexed_emul_data_only

x

x

x

x

cp_custom_ordered_index_overlap

x

x

x

x

Instruction vsseg3e8.v vsseg3e16.v vsseg3e32.v vsseg3e64.v vsseg4e8.v vsseg4e16.v vsseg4e32.v vsseg4e64.v vsseg5e8.v vsseg5e16.v vsseg5e32.v vsseg5e64.v

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW8

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW16

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW32

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW64

x

x

x

x

x

x

x

x

x

x

x

x

cp_asm_count

x

x

x

x

x

x

x

x

x

x

x

x

cp_vs3

lte29

lte29

lte29

lte29

lte28

lte28

lte28

lte28

lte27

lte27

lte27

lte27

cp_rs1

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

cp_masking_edges

x

x

x

x

x

x

x

x

x

x

x

x

cr_vl_lmul

e8_emul2max

e16_emul2max

e32_emul2max

e64_emul2max

e8_emul2max

e16_emul2max

e32_emul2max

e64_emul2max

e8_emul1max

e16_emul1max

e32_emul1max

e64_emul1max

cr_vtype_agnostic

e8_emul2max

e16_emul2max

e32_emul2max

e64_emul2max

e8_emul2max

e16_emul2max

e32_emul2max

e64_emul2max

e8_emul1max

e16_emul1max

e32_emul1max

e64_emul1max

cp_vl_0

x

x

x

x

x

x

x

x

x

x

x

x

std_vec

x

x

x

x

x

x

x

x

x

x

Instruction vsseg6e8.v vsseg6e16.v vsseg6e32.v vsseg6e64.v vsseg7e8.v vsseg7e16.v vsseg7e32.v vsseg7e64.v vsseg8e8.v vsseg8e16.v vsseg8e32.v vsseg8e64.v

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW8

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW16

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW32

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW64

x

x

x

x

x

x

x

x

x

x

x

x

cp_asm_count

x

x

x

x

x

x

x

x

x

x

x

x

cp_vs3

lte26

lte26

lte26

lte26

lte25

lte25

lte25

lte25

lte24

lte24

lte24

lte24

cp_rs1

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

cp_masking_edges

x

x

x

x

x

x

x

x

x

x

x

x

cr_vl_lmul

e8_emul1max

e16_emul1max

e32_emul1max

e64_emul1max

e8_emul1max

e16_emul1max

e32_emul1max

e64_emul1max

e8_emul1max

e16_emul1max

e32_emul1max

e64_emul1max

cr_vtype_agnostic

e8_emul1max

e16_emul1max

e32_emul1max

e64_emul1max

e8_emul1max

e16_emul1max

e32_emul1max

e64_emul1max

e8_emul1max

e16_emul1max

e32_emul1max

e64_emul1max

cp_vl_0

x

x

x

x

x

x

x

x

x

x

x

x

std_vec

x

x

x

x

x

x

x

x

x

x

x

x

Instruction vsse8.v vsse16.v vsse32.v vsse64.v vssseg2e8.v vssseg2e16.v vssseg2e32.v vssseg2e64.v vssseg3e8.v vssseg3e16.v vssseg3e32.v vssseg3e64.v

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW8

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW16

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW32

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW64

x

x

x

x

x

x

x

x

x

x

x

x

cp_asm_count

x

x

x

x

x

x

x

x

x

x

x

x

cp_vs3

x

x

x

x

lte30

lte30

lte30

lte30

lte29

lte29

lte29

lte29

cp_rs1

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

cp_rs2

x

x

x

x

x

x

x

x

x

x

x

x

cp_rs2_edges

ls_e8

ls_e16

ls_e32

ls_e64

ls_e8

ls_e16

ls_e32

ls_e64

ls_e8

ls_e16

ls_e32

ls_e64

cp_masking_edges

x

x

x

x

x

x

x

x

x

x

x

x

cr_vl_lmul

e8

e16

e32

e64

e8_emul4max

e16_emul4max

e32_emul4max

e64_emul4max

e8_emul2max

e16_emul2max

e32_emul2max

e64_emul2max

cr_vtype_agnostic

e8

e16

e32

e64

e8_emul4max

e16_emul4max

e32_emul4max

e64_emul4max

e8_emul2max

e16_emul2max

e32_emul2max

e64_emul2max

cp_vl_0

x

x

x

x

x

x

x

x

x

x

x

x

std_vec

x

x

x

x

x

x

x

x

x

x

x

x

Instruction vssseg4e8.v vssseg4e16.v vssseg4e32.v vssseg4e64.v vssseg5e8.v vssseg5e16.v vssseg5e32.v vssseg5e64.v vssseg6e8.v vssseg6e16.v vssseg6e32.v vssseg6e64.v

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW8

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW16

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW32

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW64

x

x

x

x

x

x

x

x

x

x

x

x

cp_asm_count

x

x

x

x

x

x

x

x

x

x

x

x

cp_vs3

lte28

lte28

lte28

lte28

lte27

lte27

lte27

lte27

lte26

lte26

lte26

lte26

cp_rs1

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

cp_rs2

x

x

x

x

x

x

x

x

x

x

x

x

cp_rs2_edges

ls_e8

ls_e16

ls_e32

ls_e64

ls_e8

ls_e16

ls_e32

ls_e64

ls_e8

ls_e16

ls_e32

ls_e64

cp_masking_edges

x

x

x

x

x

x

x

x

x

x

x

x

cr_vl_lmul

e8_emul2max

e16_emul2max

e32_emul2max

e64_emul2max

e8_emul1max

e16_emul1max

e32_emul1max

e64_emul1max

e8_emul1max

e16_emul1max

e32_emul1max

e64_emul1max

cr_vtype_agnostic

e8_emul2max

e16_emul2max

e32_emul2max

e64_emul2max

e8_emul1max

e16_emul1max

e32_emul1max

e64_emul1max

e8_emul1max

e16_emul1max

e32_emul1max

e64_emul1max

cp_vl_0

x

x

x

x

x

x

x

x

x

x

x

x

std_vec

x

x

x

x

x

x

x

x

x

x

x

x

Instruction vssseg7e8.v vssseg7e16.v vssseg7e32.v vssseg7e64.v vssseg8e8.v vssseg8e16.v vssseg8e32.v vssseg8e64.v vsuxei8.v vsuxei16.v vsuxei32.v vsuxei64.v

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW8

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW16

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW32

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW64

x

x

x

x

x

x

x

x

x

x

x

x

cp_asm_count

x

x

x

x

x

x

x

x

x

x

x

x

cp_vs3

lte25

lte25

lte25

lte25

lte24

lte24

lte24

lte24

x

x

x

x

cp_vs2

x

x

x

x

cp_vs2_edges

ls

ls

ls

ls

cmp_vs3_vs2

eew_eq_sew

eew_eq_sew

eew_eq_sew

eew_eq_sew

cp_rs1

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

cp_rs2

x

x

x

x

x

x

x

x

cp_rs2_edges

ls_e8

ls_e16

ls_e32

ls_e64

ls_e8

ls_e16

ls_e32

ls_e64

cp_masking_edges

x

x

x

x

x

x

x

x

x

x

x

x

cr_vl_lmul

e8_emul1max

e16_emul1max

e32_emul1max

e64_emul1max

e8_emul1max

e16_emul1max

e32_emul1max

e64_emul1max

e8

e16

e32

e64

cr_vtype_agnostic

e8_emul1max

e16_emul1max

e32_emul1max

e64_emul1max

e8_emul1max

e16_emul1max

e32_emul1max

e64_emul1max

e8

e16

e32

e64

cp_vl_0

x

x

x

x

x

x

x

x

x

x

x

x

std_vec

x

x

x

x

x

x

x

x

x

x

x

x

cp_custom_ls_indexed_truncated

x

Instruction vsuxseg2ei8.v vsuxseg2ei16.v vsuxseg2ei32.v vsuxseg2ei64.v vsuxseg3ei8.v vsuxseg3ei16.v vsuxseg3ei32.v vsuxseg3ei64.v vsuxseg4ei8.v vsuxseg4ei16.v vsuxseg4ei32.v vsuxseg4ei64.v

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW8

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW16

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW32

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW64

x

x

x

x

x

x

x

x

x

x

x

x

cp_asm_count

x

x

x

x

x

x

x

x

x

x

x

x

cp_vs3

lte30

lte30

lte30

lte30

lte29

lte29

lte29

lte29

lte28

lte28

lte28

lte28

cp_vs2

x

x

x

x

x

x

x

x

x

x

x

x

cp_vs2_edges

ls

ls

ls

ls

ls

ls

ls

ls

ls

ls

ls

ls

cmp_vs3_vs2

eew_eq_sew_lte30

eew_eq_sew_lte30

eew_eq_sew_lte30

eew_eq_sew_lte30

eew_eq_sew_lte29

eew_eq_sew_lte29

eew_eq_sew_lte29

eew_eq_sew_lte29

eew_eq_sew_lte28

eew_eq_sew_lte28

eew_eq_sew_lte28

eew_eq_sew_lte28

cp_rs1

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

cp_masking_edges

x

x

x

x

x

x

x

x

x

x

x

x

cr_vl_lmul

e8_emul4max

e16_emul4max

e32_emul4max

e64_emul4max

e8_emul2max

e16_emul2max

e32_emul2max

e64_emul2max

e8_emul2max

e16_emul2max

e32_emul2max

e64_emul2max

cr_vtype_agnostic

e8_emul4max

e16_emul4max

e32_emul4max

e64_emul4max

e8_emul2max

e16_emul2max

e32_emul2max

e64_emul2max

e8_emul2max

e16_emul2max

e32_emul2max

e64_emul2max

cp_vl_0

x

x

x

x

x

x

x

x

x

x

x

x

std_vec

x

x

x

x

x

x

x

x

x

x

x

x

cp_custom_ls_indexed_truncated

x

x

x

cp_custom_indexed_emul_data_only

x

x

sew_ge16

sew_ge32

x

x

x

sew_ge16

Instruction vsuxseg5ei8.v vsuxseg5ei16.v vsuxseg5ei32.v vsuxseg5ei64.v vsuxseg6ei8.v vsuxseg6ei16.v vsuxseg6ei32.v vsuxseg6ei64.v vsuxseg7ei8.v vsuxseg7ei16.v vsuxseg7ei32.v vsuxseg7ei64.v

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW8

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW16

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW32

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW64

x

x

x

x

x

x

x

x

x

x

x

x

cp_asm_count

x

x

x

x

x

x

x

x

x

x

x

x

cp_vs3

lte27

lte27

lte27

lte27

lte26

lte26

lte26

lte26

lte25

lte25

lte25

lte25

cp_vs2

x

x

x

x

x

x

x

x

x

x

x

x

cp_vs2_edges

ls

ls

ls

ls

ls

ls

ls

ls

ls

ls

ls

ls

cmp_vs3_vs2

eew_eq_sew_lte27

eew_eq_sew_lte27

eew_eq_sew_lte27

eew_eq_sew_lte27

eew_eq_sew_lte26

eew_eq_sew_lte26

eew_eq_sew_lte26

eew_eq_sew_lte26

eew_eq_sew_lte25

eew_eq_sew_lte25

eew_eq_sew_lte25

eew_eq_sew_lte25

cp_rs1

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

cp_masking_edges

x

x

x

x

x

x

x

x

x

x

x

x

cr_vl_lmul

e8_emul1max

e16_emul1max

e32_emul1max

e64_emul1max

e8_emul1max

e16_emul1max

e32_emul1max

e64_emul1max

e8_emul1max

e16_emul1max

e32_emul1max

e64_emul1max

cr_vtype_agnostic

e8_emul1max

e16_emul1max

e32_emul1max

e64_emul1max

e8_emul1max

e16_emul1max

e32_emul1max

e64_emul1max

e8_emul1max

e16_emul1max

e32_emul1max

e64_emul1max

cp_vl_0

x

x

x

x

x

x

x

x

x

x

x

x

std_vec

x

x

x

x

x

x

x

x

x

x

x

x

cp_custom_ls_indexed_truncated

x

x

x

Instruction vsuxseg8ei8.v vsuxseg8ei16.v vsuxseg8ei32.v vsuxseg8ei64.v vsoxei8.v vsoxei16.v vsoxei32.v vsoxei64.v vsoxseg2ei8.v vsoxseg2ei16.v vsoxseg2ei32.v vsoxseg2ei64.v

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW8

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW16

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW32

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW64

x

x

x

x

x

x

x

x

x

x

x

x

cp_asm_count

x

x

x

x

x

x

x

x

x

x

x

x

cp_vs3

lte24

lte24

lte24

lte24

x

x

x

x

lte30

lte30

lte30

lte30

cp_vs2

x

x

x

x

x

x

x

x

x

x

x

x

cp_vs2_edges

ls

ls

ls

ls

ls

ls

ls

ls

ls

ls

ls

ls

cmp_vs3_vs2

eew_eq_sew_lte24

eew_eq_sew_lte24

eew_eq_sew_lte24

eew_eq_sew_lte24

eew_eq_sew

eew_eq_sew

eew_eq_sew

eew_eq_sew

eew_eq_sew_lte30

eew_eq_sew_lte30

eew_eq_sew_lte30

eew_eq_sew_lte30

cp_rs1

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

cp_masking_edges

x

x

x

x

x

x

x

x

x

x

x

x

cr_vl_lmul

e8_emul1max

e16_emul1max

e32_emul1max

e64_emul1max

e8

e16

e32

e64

e8_emul4max

e16_emul4max

e32_emul4max

e64_emul4max

cr_vtype_agnostic

e8_emul1max

e16_emul1max

e32_emul1max

e64_emul1max

e8

e16

e32

e64

e8_emul4max

e16_emul4max

e32_emul4max

e64_emul4max

cp_vl_0

x

x

x

x

x

x

x

x

x

x

x

x

std_vec

x

x

x

x

x

x

x

x

x

x

x

x

cp_custom_ls_indexed_truncated

x

x

x

cp_custom_indexed_emul_data_only

x

x

x

x

x

x

sew_ge16

sew_ge32

cp_custom_ordered_index_overlap

x

x

x

x

x

x

x

x

Instruction vsoxseg3ei8.v vsoxseg3ei16.v vsoxseg3ei32.v vsoxseg3ei64.v vsoxseg4ei8.v vsoxseg4ei16.v vsoxseg4ei32.v vsoxseg4ei64.v vsoxseg5ei8.v vsoxseg5ei16.v vsoxseg5ei32.v vsoxseg5ei64.v

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW8

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW16

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW32

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW64

x

x

x

x

x

x

x

x

x

x

x

x

cp_asm_count

x

x

x

x

x

x

x

x

x

x

x

x

cp_vs3

lte29

lte29

lte29

lte29

lte28

lte28

lte28

lte28

lte27

lte27

lte27

lte27

cp_vs2

x

x

x

x

x

x

x

x

x

x

x

x

cp_vs2_edges

ls

ls

ls

ls

ls

ls

ls

ls

ls

ls

ls

ls

cmp_vs3_vs2

eew_eq_sew_lte29

eew_eq_sew_lte29

eew_eq_sew_lte29

eew_eq_sew_lte29

eew_eq_sew_lte28

eew_eq_sew_lte28

eew_eq_sew_lte28

eew_eq_sew_lte28

eew_eq_sew_lte27

eew_eq_sew_lte27

eew_eq_sew_lte27

eew_eq_sew_lte27

cp_rs1

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

cp_masking_edges

x

x

x

x

x

x

x

x

x

x

x

x

cr_vl_lmul

e8_emul2max

e16_emul2max

e32_emul2max

e64_emul2max

e8_emul2max

e16_emul2max

e32_emul2max

e64_emul2max

e8_emul1max

e16_emul1max

e32_emul1max

e64_emul1max

cr_vtype_agnostic

e8_emul2max

e16_emul2max

e32_emul2max

e64_emul2max

e8_emul2max

e16_emul2max

e32_emul2max

e64_emul2max

e8_emul1max

e16_emul1max

e32_emul1max

e64_emul1max

cp_vl_0

x

x

x

x

x

x

x

x

x

x

x

x

std_vec

x

x

x

x

x

x

x

x

x

x

x

x

cp_custom_ls_indexed_truncated

x

x

x

cp_custom_indexed_emul_data_only

x

x

x

sew_ge16

cp_custom_ordered_index_overlap

x

x

x

x

x

x

x

x

x

x

x

x

Instruction vsoxseg6ei8.v vsoxseg6ei16.v vsoxseg6ei32.v vsoxseg6ei64.v vsoxseg7ei8.v vsoxseg7ei16.v vsoxseg7ei32.v vsoxseg7ei64.v vsoxseg8ei8.v vsoxseg8ei16.v vsoxseg8ei32.v vsoxseg8ei64.v

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW8

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW16

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW32

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW64

x

x

x

x

x

x

x

x

x

x

x

x

cp_asm_count

x

x

x

x

x

x

x

x

x

x

x

x

cp_vs3

lte26

lte26

lte26

lte26

lte25

lte25

lte25

lte25

lte24

lte24

lte24

lte24

cp_vs2

x

x

x

x

x

x

x

x

x

x

x

x

cp_vs2_edges

ls

ls

ls

ls

ls

ls

ls

ls

ls

ls

ls

ls

cmp_vs3_vs2

eew_eq_sew_lte26

eew_eq_sew_lte26

eew_eq_sew_lte26

eew_eq_sew_lte26

eew_eq_sew_lte25

eew_eq_sew_lte25

eew_eq_sew_lte25

eew_eq_sew_lte25

eew_eq_sew_lte24

eew_eq_sew_lte24

eew_eq_sew_lte24

eew_eq_sew_lte24

cp_rs1

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

cp_masking_edges

x

x

x

x

x

x

x

x

x

x

x

x

cr_vl_lmul

e8_emul1max

e16_emul1max

e32_emul1max

e64_emul1max

e8_emul1max

e16_emul1max

e32_emul1max

e64_emul1max

e8_emul1max

e16_emul1max

e32_emul1max

e64_emul1max

cr_vtype_agnostic

e8_emul1max

e16_emul1max

e32_emul1max

e64_emul1max

e8_emul1max

e16_emul1max

e32_emul1max

e64_emul1max

e8_emul1max

e16_emul1max

e32_emul1max

e64_emul1max

cp_vl_0

x

x

x

x

x

x

x

x

x

x

x

x

std_vec

x

x

x

x

x

x

x

x

x

x

x

x

cp_custom_ls_indexed_truncated

x

x

x

cp_custom_indexed_emul_data_only

x

x

x

x

cp_custom_ordered_index_overlap

x

x

x

x

x

x

x

x

x

x

x

x

Instruction vl1re8.v vl2re8.v vl4re8.v vl8re8.v vl1re16.v vl2re16.v vl4re16.v vl8re16.v vl1re32.v vl2re32.v vl4re32.v vl8re32.v

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW8

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW16

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW32

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW64

x

x

x

x

x

x

x

x

x

x

x

x

cp_asm_count

x

x

x

x

x

x

x

x

x

x

x

x

cp_vd

x

emul2

emul4

emul8

x

emul2

emul4

emul8

x

emul2

emul4

emul8

cp_rs1

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

cr_vl_lmul

x

lmul4max

lmul2max

lmul1max

x

lmul4max

lmul2max

lmul1max

x

lmul4max

lmul2max

lmul1max

cr_vtype_agnostic

nomask

lmul4max_nomask

lmul2max_nomask

lmul1max_nomask

nomask

lmul4max_nomask

lmul2max_nomask

lmul1max_nomask

nomask

lmul4max_nomask

lmul2max_nomask

lmul1max_nomask

cp_vl_0

x

x

x

x

x

x

x

x

x

x

x

x

std_vec

x

x

x

x

x

x

x

x

x

x

x

x

cp_custom_vwholeRegLS_vill

x

x

x

x

x

x

x

x

x

x

x

x

cp_custom_vwholeRegLS_lmul

x

x

x

x

x

x

x

x

x

x

x

x

Instruction vl1re64.v vl2re64.v vl4re64.v vl8re64.v vs1r.v vs2r.v vs4r.v vs8r.v vsm.v vlm.v

RV32

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

EFFEW8

x

x

x

x

x

x

x

x

x

x

EFFEW16

x

x

x

x

x

x

x

x

x

x

EFFEW32

x

x

x

x

x

x

x

x

x

x

EFFEW64

x

x

x

x

x

x

x

x

x

x

cp_asm_count

x

x

x

x

x

x

x

x

x

x

cp_vd

x

emul2

emul4

emul8

x

cp_vs3

x

emul2

emul4

emul8

x

cp_rs1

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

cr_vl_lmul

x

lmul4max

lmul2max

lmul1max

x

x

x

x

nomask

nomask

cr_vtype_agnostic

nomask

lmul4max_nomask

lmul2max_nomask

lmul1max_nomask

nomask

nomask

nomask

nomask

nomask

nomask

cp_vl_0

x

x

x

x

x

x

x

x

x

x

std_vec

x

x

x

x

x

x

x

x

x

x

cp_custom_vwholeRegLS_vill

x

x

x

x

x

x

x

x

cp_custom_vwholeRegLS_lmul

x

x

x

x

x

x

x

x

cp_custom_maskLS

sew_ge16

sew_ge16

Table 129. Vls Normative Rules
Normative Rule Rule Text Coverpoints

vector_load_store_semantics

Vector loads and stores move values between vector registers and memory.

Vls16_vle8_v_cg/cp_vd, Vls8_vle8_v_cg/cr_vl_lmul_e8_sew8, Vls8_vse8_v_cg/cr_vl_lmul_e8_sew8, Vls64_vle64_v_cg/cr_vl_lmul_e64_sew64, Vls64_vse64_v_cg/cr_vl_lmul_e64_sew64

vector_masked_memory_access

Vector loads and stores can be masked, and they only access memory or raise exceptions for active elements.

Vls16_vle8_v_cg/cp_masking_edges

vector_ls_strided_eew

Vector memory unit-stride and constant-stride operations directly encode EEW of the data to be transferred statically in the instruction to reduce the number of vtype changes when accessing memory in a mixed-width routine.

{Vls16_vlse16_v_cg,Vls32_vlse32_v_cg,Vls64_vlse64_v_cg}/cp_asm_count

vector_ls_ins_req

Implementations must provide vector loads and stores with EEWs corresponding to all supported SEW settings.

{Vls8_vle8_v_cg,Vls16_vle16_v_cg,Vls32_vle32_v_cg,Vls64_vle64_v_cg}/cp_asm_count

vector_ls_ins_rsv

Vector load/store encodings for unsupported EEW widths are reserved.

SsstrictV_vle8_v_cg/cp_ssstrictv_ls_eew_lt_sewmin

vector_ls_eew_rsv

If the implementation does not support the EEW of the offset elements, the instruction is reserved.

ExceptionsVls_vloxei16_v_cg/cp_exceptionsv_index_eew16

vector_ls_nf_op

The nf[2:0] field encodes the number of fields in each segment. For regular vector loads and stores, nf=0, indicating that a single value is moved between a vector register group and memory at each element position. Larger values in the nf field are used to access multiple contiguous fields within a segment as described below in sec-aos.

Vls16_vlseg2e8_v_cg/cp_asm_count

vector_ls_emul_rsv

If the EMUL would be out of range (EMUL>8 or EMUL<1/8), the instruction encoding is reserved.

ExceptionsVls_vloxei16_v_cg/cp_exceptionsv_index_eew16

vector_ls_mew_rsv

The mew bit (inst[28]) when set is expected to be used to encode expanded memory sizes of 128 bits and above, but these encodings are currently reserved.

SsstrictV_vle8_v_cg/cp_ssstrictv_ls_mew_reserved

emul_nfields_rsv

The EMUL setting must be such that EMUL * NFIELDS ≤ 8, otherwise the instruction encoding is reserved.

SsstrictV_vlseg2e8_v_cg/cp_ssstrictv_ls_seg_vd_overflow

vector_ls_seg_indexed_emul_nfields_val

The EMUL * NFIELDS ≤ 8 constraint applies to the data vector register group.

SsstrictV_vlseg2e8_v_cg/cp_ssstrictv_ls_seg_vd_overflow

vector_ls_seg_wholereg_eew

The load instructions have the element width encoded in the mew and width fields following the pattern of regular unit-stride loads. EEW is computed as EEW=min(VLEN*NFIELDS, EEW_encoded).

Vls16_vl1re16_v_cg/cp_custom_vwholeRegLS_lmul, Vls16_vl1re8_v_cg/cp_asm_count, Vls16_vl1re16_v_cg/cp_asm_count, Vls16_vl1re32_v_cg/cp_asm_count, Vls16_vl1re64_v_cg/cp_asm_count, Vls16_vl2re8_v_cg/cp_asm_count, Vls16_vl2re16_v_cg/cp_asm_count, Vls16_vl2re32_v_cg/cp_asm_count, Vls16_vl2re64_v_cg/cp_asm_count, Vls16_vl4re8_v_cg/cp_asm_count, Vls16_vl4re16_v_cg/cp_asm_count, Vls16_vl4re32_v_cg/cp_asm_count, Vls16_vl4re64_v_cg/cp_asm_count, Vls16_vl8re8_v_cg/cp_asm_count, Vls16_vl8re16_v_cg/cp_asm_count, Vls16_vl8re32_v_cg/cp_asm_count, Vls16_vl8re64_v_cg/cp_asm_count

vector_masked_inactive_behavior

Masked vector loads do not update inactive elements in the destination vector register group, unless masked agnostic is specified (vtype.⁠VMA=1).

Vls8_vle8_v_cg/cr_vtype_agnostic_e8, Vls16_vle16_v_cg/cr_vtype_agnostic_e16, Vls32_vle32_v_cg/cr_vtype_agnostic_e32, Vls64_vle64_v_cg/cr_vtype_agnostic_e64

UDB Parameters: None.

A.11.6. Vf

Table 130. Vf Instruction Coverpoints
Instruction vfadd.vv vfadd.vf vfwadd.vv vfwadd.vf vfwadd.wv vfwadd.wf vfsub.vv vfsub.vf vfwsub.vv vfwsub.vf vfwsub.wv vfwsub.wf

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW16

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW32

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW64

x

x

x

x

cp_asm_count

x

x

x

x

x

x

x

x

x

x

x

x

cp_vd

x

x

emul2

emul2

emul2

emul2

x

x

emul2

emul2

emul2

emul2

cp_vs2

x

x

x

x

emul2

emul2

x

x

x

x

emul2

emul2

cp_vs1

x

x

x

x

x

x

cp_fs1

x

x

x

x

x

x

cmp_vd_vs2

x

x

emul2

emul2

x

x

emul2

emul2

cmp_vd_vs1

x

x

cmp_vs1_vs2

x

x

x

x

cmp_vd_vs1_vs2

x

x

cp_vs2_edges

f

f

f

f

f_emul2

f_emul2

f

f

f

f

f_emul2

f_emul2

cp_vs1_edges

f

f

f

f

f

f

cr_vs2_vs1_edges

f

f

fwv

f

f

fwv

cp_fs1_edges

v

v

v

v

v

v

cr_vs2_fs1_edges

x

x

wf

x

x

wf

cp_masking_edges

x

x

x

x

x

x

x

x

x

x

x

x

cr_vl_lmul

x

x

lmul4max

lmul4max

lmul4max

lmul4max

x

x

lmul4max

lmul4max

lmul4max

lmul4max

cr_vtype_agnostic

x

x

lmul4max

lmul4max

lmul4max

lmul4max

x

x

lmul4max

lmul4max

lmul4max

lmul4max

cp_vl_0

x

x

x

x

x

x

x

x

x

x

x

x

cp_csr_fflags

von

von

vn

vn

vn

vn

von

von

vn

vn

vn

vn

cp_csr_frm

v

v

v

v

v

v

v

v

v

v

v

v

std_vec

x

x

x

x

x

x

x

x

x

x

x

x

cp_custom_vfp_NaN_input

x

x

x

x

w

w

x

x

x

x

w

w

cp_custom_vfp_flags_set

x

x

x

x

x

x

x

x

x

x

x

x

cp_custom_vfp_flags

nv_nx_of

nv_nx_of

nv

nv

nv_nx

nv_nx

nv_nx

nv_nx

nv

nv

nv_nx

nv_nx

cp_custom

wvv_all

wvx_all

wwv_all

wvv_all

wvx_all

wwv_all

Instruction vfrsub.vf vfmul.vv vfmul.vf vfwmul.vv vfwmul.vf vfdiv.vv vfdiv.vf vfrdiv.vf vfmacc.vv vfmacc.vf vfnmacc.vv vfnmacc.vf

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW16

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW32

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW64

x

x

x

x

x

x

x

x

x

x

cp_asm_count

x

x

x

x

x

x

x

x

x

x

x

x

cp_vd

x

x

x

emul2

emul2

x

x

x

x

x

x

x

cp_vs2

x

x

x

x

x

x

x

x

x

x

x

x

cp_vs1

x

x

x

x

x

cp_fs1

x

x

x

x

x

x

x

cmp_vd_vs2

x

x

x

x

x

x

x

x

x

x

cmp_vd_vs1

x

x

x

x

cmp_vs1_vs2

x

x

x

x

x

cmp_vd_vs1_vs2

x

x

x

x

cp_vs2_edges

f

f

f

f

f

f

f

f

f

f

f

f

cp_vs1_edges

f

f

f

f

f

cr_vs2_vs1_edges

f

f

f

f

f

cp_fs1_edges

v

v

v

v

v

v

v

cr_vs2_fs1_edges

x

x

x

x

x

x

x

cp_masking_edges

x

x

x

x

x

x

x

x

x

x

x

x

cr_vl_lmul

x

x

x

lmul4max

lmul4max

x

x

x

x

x

x

x

cr_vtype_agnostic

x

x

x

lmul4max

lmul4max

x

x

x

x

x

x

x

cp_vl_0

x

x

x

x

x

x

x

x

x

x

x

x

cp_csr_fflags

von

voun

voun

v

v

vdoun

vdoun

vdoun

voun

voun

voun

voun

cp_csr_frm

v

v

v

v

v

v

v

v

v

v

v

v

std_vec

x

x

x

x

x

x

x

x

x

x

x

x

cp_custom_vfp_NaN_input

x

x

x

x

x

x

x

x

x

x

x

x

cp_custom_vfp_flags_set

x

x

x

x

x

x

x

x

x

x

x

x

cp_custom_vfp_flags

nv_nx

nv_nx_of_uf

nv_nx_of_uf

nv

nv

nv_nx_dz

nv_nx_dz

nv_nx_dz

nv_nx

nv_nx

nv_nx

nv_nx

cp_custom

wvv_all

wvx_all

Instruction vfmsac.vv vfmsac.vf vfnmsac.vv vfnmsac.vf vfmadd.vv vfmadd.vf vfnmadd.vv vfnmadd.vf vfmsub.vv vfmsub.vf vfnmsub.vv vfnmsub.vf

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW16

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW32

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW64

x

x

x

x

x

x

x

x

x

x

x

x

cp_asm_count

x

x

x

x

x

x

x

x

x

x

x

x

cp_vd

x

x

x

x

x

x

x

x

x

x

x

x

cp_vs2

x

x

x

x

x

x

x

x

x

x

x

x

cp_vs1

x

x

x

x

x

x

cp_fs1

x

x

x

x

x

x

cmp_vd_vs2

x

x

x

x

x

x

x

x

x

x

x

x

cmp_vd_vs1

x

x

x

x

x

x

cmp_vs1_vs2

x

x

x

x

x

x

cmp_vd_vs1_vs2

x

x

x

x

x

x

cp_vs2_edges

f

f

f

f

f

f

f

f

f

f

f

f

cp_vs1_edges

f

f

f

f

f

f

cr_vs2_vs1_edges

f

f

f

f

f

f

cp_fs1_edges

v

v

v

v

v

v

cr_vs2_fs1_edges

x

x

x

x

x

x

cp_masking_edges

x

x

x

x

x

x

x

x

x

x

x

x

cr_vl_lmul

x

x

x

x

x

x

x

x

x

x

x

x

cr_vtype_agnostic

x

x

x

x

x

x

x

x

x

x

x

x

cp_vl_0

x

x

x

x

x

x

x

x

x

x

x

x

cp_csr_fflags

voun

voun

voun

voun

voun

voun

voun

voun

voun

voun

voun

voun

cp_csr_frm

v

v

v

v

v

v

v

v

v

v

v

v

std_vec

x

x

x

x

x

x

x

x

x

x

x

x

cp_custom_vfp_NaN_input

x

x

x

x

x

x

x

x

x

x

x

x

cp_custom_vfp_flags_set

x

x

x

x

x

x

x

x

x

x

x

x

cp_custom_vfp_flags

nv_nx

nv_nx

nv_nx

nv_nx

nv_nx

nv_nx

nv_nx

nv_nx

nv_nx

nv_nx

nv_nx

nv_nx

Instruction vfwmacc.vv vfwmacc.vf vfwnmacc.vv vfwnmacc.vf vfwmsac.vv vfwmsac.vf vfwnmsac.vv vfwnmsac.vf vfsqrt.v vfrsqrt7.v vfrec7.v vfmin.vv

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW16

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW32

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW64

x

x

x

x

cp_asm_count

x

x

x

x

x

x

x

x

x

x

x

x

cp_vd

emul2

emul2

emul2

emul2

emul2

emul2

emul2

emul2

x

x

x

x

cp_vs2

x

x

x

x

x

x

x

x

x

x

x

x

cp_vs1

x

x

x

x

x

cp_fs1

x

x

x

x

cmp_vd_vs2

x

x

x

x

cmp_vd_vs1

x

cmp_vs1_vs2

x

x

x

x

x

cmp_vd_vs1_vs2

x

cp_vs2_edges

f

f

f

f

f

f

f

f

f

f

f

f

cp_vs1_edges

f

f

f

f

f

cr_vs2_vs1_edges

f

f

f

f

f

cp_fs1_edges

v

v

v

v

cr_vs2_fs1_edges

x

x

x

x

cp_masking_edges

x

x

x

x

x

x

x

x

x

x

x

x

cr_vl_lmul

lmul4max

lmul4max

lmul4max

lmul4max

lmul4max

lmul4max

lmul4max

lmul4max

x

x

x

x

cr_vtype_agnostic

lmul4max

lmul4max

lmul4max

lmul4max

lmul4max

lmul4max

lmul4max

lmul4max

x

x

x

x

cp_vl_0

x

x

x

x

x

x

x

x

x

x

x

x

cp_csr_fflags

vn

vn

vn

vn

vn

vn

vn

vn

vn

vd

vdon

v

cp_csr_frm

v

v

v

v

v

v

v

v

v

v

v

std_vec

x

x

x

x

x

x

x

x

x

x

x

x

cp_custom_FpRecSqrtEst_flag_edges

x

cp_custom_FpRecipEst_flag_edges

x

cp_custom_FpRecSqrtEst_edges

x

cp_custom_FpRecipEst_edges

x

cp_custom_vfp_NaN_input

x

x

x

x

x

x

x

x

x

x

x

x

cp_custom_vfp_flags_set

x

x

x

x

x

x

x

x

x

x

x

x

cp_custom_vfp_flags

nv_nx

nv_nx

nv_nx

nv_nx

nv_nx

nv_nx

nv_nx

nv_nx

nv_nx

nv_dz

nv_dz

nv

cp_custom_vfp_flags_inactive_not_set

x

Instruction vfmin.vf vfmax.vv vfmax.vf vfsgnj.vv vfsgnj.vf vfsgnjn.vv vfsgnjn.vf vfsgnjx.vv vfsgnjx.vf vfredosum.vs vfwredosum.vs vfredusum.vs

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW16

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW32

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW64

x

x

x

x

x

x

x

x

x

x

x

cp_asm_count

x

x

x

x

x

x

x

x

x

x

x

x

cp_vd

x

x

x

x

x

x

x

x

x

x

emul2

x

cp_vs2

x

x

x

x

x

x

x

x

x

x

x

x

cp_vs1

x

x

x

x

x

emul2

x

cp_fs1

x

x

x

x

x

cmp_vd_vs2

x

x

x

x

x

x

x

x

x

x

x

cmp_vd_vs1

x

x

x

x

x

emul2

x

cmp_vs1_vs2

x

x

x

x

x

x

cmp_vd_vs1_vs2

x

x

x

x

x

x

cp_vs2_edges

f

f

f

f

f

f

f

f

f

f

f

f

cp_vs1_edges

f

f

f

f

f

f_emul2

f

cr_vs2_vs1_edges

f

f

f

f

f

fwred

f

cp_fs1_edges

v

v

v

v

v

cr_vs2_fs1_edges

x

x

x

x

x

cp_masking_edges

x

x

x

x

x

x

x

x

x

x

x

x

cr_vl_lmul

x

x

x

x

x

x

x

x

x

x

lmul4max

x

cr_vtype_agnostic

x

x

x

x

x

x

x

x

x

x

lmul4max

x

cp_vl_0

x

x

x

x

x

x

x

x

x

x

x

x

cp_csr_fflags

v

v

v

von

vn

von

cp_csr_frm

v

v

v

std_vec

x

x

x

x

x

x

x

x

x

x

x

x

cp_custom_vfp_NaN_input

x

x

x

x

x

x

x

x

x

x

x

x

cp_custom_vfredosum_ordered_sum

x

cp_custom_vfredosum_NAN_vl0

x

x

cp_custom_vfp_flags_set

x

x

x

x

x

x

cp_custom_vfp_flags

nv

nv

nv

nv_nx

nv_nx

nv_nx

cp_custom

wred

Instruction vfwredusum.vs vfredmax.vs vfredmin.vs vmfeq.vv vmfeq.vf vmfne.vv vmfne.vf vmflt.vv vmflt.vf vmfle.vv vmfle.vf vmfgt.vf

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW16

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW32

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW64

x

x

x

x

x

x

x

x

x

x

x

cp_asm_count

x

x

x

x

x

x

x

x

x

x

x

x

cp_vd

emul2

x

x

x

x

x

x

x

x

x

x

x

cp_vs2

x

x

x

x

x

x

x

x

x

x

x

x

cp_vs1

emul2

x

x

x

x

x

x

cp_fs1

x

x

x

x

x

cmp_vd_vs2

x

x

cmp_vd_vs1

emul2

x

x

cmp_vs1_vs2

x

x

x

x

x

x

cmp_vd_vs1_vs2

x

x

cp_vs2_edges

f

f

f

f

f

f

f

f

f

f

f

f

cp_vs1_edges

f_emul2

f

f

f

f

f

f

cr_vs2_vs1_edges

fwred

f

f

f

f

f

f

cp_fs1_edges

v

v

v

v

v

cr_vs2_fs1_edges

x

x

x

x

x

cp_masking_edges

x

x

x

x

x

x

x

x

x

x

x

x

cr_vl_lmul

lmul4max

x

x

x

x

x

x

x

x

x

x

x

cr_vtype_agnostic

lmul4max

x

x

x

x

x

x

x

x

x

x

x

cp_vl_0

x

x

x

x

x

x

x

x

x

x

x

x

cp_csr_fflags

vn

v

v

v

v

v

v

v

v

v

v

v

cp_csr_frm

v

std_vec

x

x

x

x

x

x

x

x

x

x

x

x

cp_custom_vfp_NaN_input

x

x

x

x

x

x

x

x

x

x

x

x

cp_custom_vfp_flags_set

x

x

x

x

x

x

x

x

x

x

x

x

cp_custom_vfp_flags

nv_nx

nv

nv

nv

nv

nv

nv

nv

nv

nv

nv

nv

cp_custom

wred

Instruction vmfge.vf vfmerge.vfm vfmv.v.f vfmv.f.s vfmv.s.f vfslide1up.vf vfslide1down.vf vfcvt.xu.f.v vfwcvt.xu.f.v vfncvt.xu.f.w vfcvt.x.f.v vfwcvt.x.f.v

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW8

x

EFFEW16

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW32

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW64

x

x

x

x

x

x

x

x

x

cp_asm_count

x

x

x

x

x

x

x

x

x

x

x

x

cp_vd

x

nv0

x

x

x

x

x

emul2

x

x

emul2

cp_fd

x

cp_vs2

x

nv0

x

x

x

x

x

emul2

x

x

cp_fs1

x

x

x

x

x

x

cmp_vd_vs2

nv0

x

x

x

cp_vs2_edges

f

f

f

f

f

f

f

f_emul2

f

f

cp_fs1_edges

v

v

v

v

v

v

cr_vs2_fs1_edges

x

x

x

x

cp_masking_edges

x

x

x

x

x

x

x

x

x

cr_vl_lmul

x

x

nomask

nomask

nomask

x

x

x

lmul4max

lmul4max

x

lmul4max

cr_vtype_agnostic

x

x

nomask

nomask

nomask

x

x

x

lmul4max

lmul4max

x

lmul4max

cp_vl_0

x

x

x

x

x

x

x

x

x

x

x

x

cp_csr_fflags

v

vn

vn

vn

vn

vn

cp_csr_frm

v

v

v

v

v

std_vec

x

x

x

x

x

x

x

x

x

x

x

x

cp_custom_vfp_state

x

cp_custom_vfp_NaN_input

x

x

x

x

x

x

x

w

x

x

cp_custom_fmv_sf_vd_all_lmul

x

cp_custom_fmv_fs_vs2_all_lmul

x

cp_custom_vfp_flags_set

x

x

x

x

x

x

cp_custom_vfp_flags

nv

nv_nx

nv_nx

nv_nx

nv_nx

nv_nx

cp_custom

shift_wi

Instruction vfncvt.x.f.w vfcvt.rtz.xu.f.v vfwcvt.rtz.xu.f.v vfncvt.rtz.xu.f.w vfcvt.rtz.x.f.v vfwcvt.rtz.x.f.v vfncvt.rtz.x.f.w vfcvt.f.xu.v vfwcvt.f.xu.v vfncvt.f.xu.w vfcvt.f.x.v vfwcvt.f.x.v

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW8

x

x

x

x

x

EFFEW16

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW32

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW64

x

x

x

x

cp_asm_count

x

x

x

x

x

x

x

x

x

x

x

x

cp_vd

x

x

emul2

x

x

emul2

x

x

emul2

x

x

emul2

cp_vs2

emul2

x

x

emul2

x

x

emul2

x

x

emul2

x

x

cmp_vd_vs2

x

x

x

x

cp_vs2_edges

f_emul2

f

f

f_emul2

f

f

f_emul2

x

x

emul2

x

x

cp_masking_edges

x

x

x

x

x

x

x

x

x

x

x

x

cr_vl_lmul

lmul4max

x

lmul4max

lmul4max

x

lmul4max

lmul4max

x

lmul4max

lmul4max

x

lmul4max

cr_vtype_agnostic

lmul4max

x

lmul4max

lmul4max

x

lmul4max

lmul4max

x

lmul4max

lmul4max

x

lmul4max

cp_vl_0

x

x

x

x

x

x

x

x

x

x

x

x

cp_csr_fflags

vn

vn

vn

vn

vn

vn

vn

n

n

n

cp_csr_frm

v

v

v

v

std_vec

x

x

x

x

x

x

x

x

x

x

x

x

cp_custom_vfp_NaN_input

w

x

x

w

x

x

w

cp_custom_vfp_flags_set

x

x

x

x

x

x

x

cp_custom_vfp_flags

nv_nx

nv_nx

nv_nx

nv_nx

nv_nx

nv_nx

nv_nx

nx

nx

nx

cp_custom

shift_wi

shift_wi

shift_wi

shift_wi

Instruction vfncvt.f.x.w vfwcvt.f.f.v vfncvt.f.f.w vfncvt.rod.f.f.w vfclass.v

RV32

x

x

x

x

x

RV64

x

x

x

x

x

EFFEW16

x

x

x

x

EFFEW32

x

x

x

x

x

EFFEW64

x

cp_asm_count

x

x

x

x

x

cp_vd

x

emul2

x

x

x

cp_vs2

emul2

x

emul2

emul2

x

cmp_vd_vs2

x

cp_vs2_edges

emul2

f

f_emul2

f_emul2

f

cp_masking_edges

x

x

x

x

x

cr_vl_lmul

lmul4max

lmul4max

lmul4max

lmul4max

x

cr_vtype_agnostic

lmul4max

lmul4max

lmul4max

lmul4max

x

cp_vl_0

x

x

x

x

x

cp_csr_fflags

n

v

voun

voun

cp_csr_frm

v

v

std_vec

x

x

x

x

x

cp_custom_vfncvt_rup_overflow

x

x

cp_custom_vfp_NaN_input

x

w

w

x

cp_custom_vfclass_onehot

x

cp_custom_vfncvt_rod_overflow

x

cp_custom_vfp_flags_set

x

x

x

cp_custom_vfp_flags

nx

nv

nv_nx

nv_nx

cp_custom

shift_wi

shift_wi

shift_wi

Table 131. Vf Normative Rules
Normative Rule Rule Text Coverpoints

vmfeq_vmfne_vmflt_vmfle_vmfgt_vmfge_vd_eq_v0

The destination mask vector register may be the same as the source vector mask register (v0).

SsstrictV_vmfeq_vv_cg/cp_ssstrictv_masking_vd_eq_v0

vmflt_vmfle_vmfgt_vmfge_sqnan_invalid

VMFLT, VMFLE, VMFGT, and VMFGE raise the invalid operation exception on both signaling and quiet NaN inputs.

Vf16_vmflt_vv_cg/cp_custom_vfp_flags_nv

vmfne_vdval1_nan

VMFNE writes 1 to the destination element when either operand is NaN,

Vf16_vmfeq_vv_cg/cp_custom_vfp_NaN_input

vmfeq_vmflt_vmfle_vmfgt_vmfge_vdval0_nan

whereas the other compares write 0 when either operand is NaN.

Vf16_vmfeq_vv_cg/cp_custom_vfp_NaN_input

vfmv_vs2_nv0_rsv

The instruction must have the vs2 field set to v0, with all other values for vs2 reserved.

SsstrictV_vfmv_v_f_cg/cp_ssstrictv_vfmv_vs2_not_v0_reserved

vfmv-s-f_masked_rsv

The encodings corresponding to the masked versions (vm=0) of VFMV.F.S and VFMV.S.F are reserved.

SsstrictV_vfmv_s_f_cg/cp_ssstrictv_vfmv_fs_sf_vm0_reserved

V_dependent_F_D

The V extension depends upon the F and D extensions, and implements all vector floating-point instructions (sec-vector-float) for floating-point operands with EEW=32 or EEW=64 (including widening instructions and conversions between FP32 and FP64).

Implicit: the F and D dependency is satisfied by the configuration under test; the vector floating-point tests cannot run without it

vf_requires_vx

Vector floating-point instructions require the presence of base scalar floating-point extensions corresponding to the supported vector floating-point element widths.

Implicit: the vector floating-point tests cannot run unless the scalar floating-point extensions are present

V_fp_reductions

Vector single-width floating-point reductions (sec-vector-float-reduce) for EEW=32 and EEW=64 are supported as well as widening reductions from FP32 to FP64.

Vf32_vfredosum_vs_cg/cp_asm_count, Vf64_vfredosum_vs_cg/cp_asm_count, Vf32_vfwredosum_vs_cg/cp_asm_count, Vf32_vfwredusum_vs_cg/cp_asm_count

Zve32f_instr_perm

Zve32f supports all vector floating-point permutation instructions (sec-vector-float-permute) for floating-point operands with EEW=32.

Vf32_vfmv_f_s_cg/cp_asm_count, Vf32_vfmv_s_f_cg/cp_asm_count, Vf32_vfslide1up_vf_cg/cp_asm_count, Vf32_vfslide1down_vf_cg/cp_asm_count

Zve64d_instr_perm

Zve64d supports all vector floating-point permutation instructions (sec-vector-float-permute) for floating-point operands with EEW=32 or EEW=64.

Vf64_vfmv_f_s_cg/cp_asm_count, Vf64_vfmv_s_f_cg/cp_asm_count, Vf64_vfslide1up_vf_cg/cp_asm_count, Vf64_vfslide1down_vf_cg/cp_asm_count

UDB Parameters: None.

vfredusum.vs is difficult to test because the results depend on the ordering. It may eventually need to exclude testing for multi-element vectors, but is presently passing multi-element vectors on the simulators tested.

A.11.7. Temporarily Skipped Vector Tests

Some vector tests are currently skipped pending fixes to the Sail RISC-V reference model. These can be restored by uncommenting the corresponding generation lines or removing the hardcoded skips once the upstream issues are resolved:

Both upstream fixes have since landed (sail-riscv PR #1703 was merged in June 2026 and issue #1709 was closed in May 2026), but the skips have not yet been removed. The vstart generation lines and the vmv<nr>r.v tests should be re-enabled once they have been verified against a Sail build that includes those fixes.

A.11.8. Zvfh Vector Half-Precision Floating-Point Extension

Half-precision vector floating-point is part of the Zvfh and Zvfhmin extensions, not the base V extension. Nevertheless, Zvfh tests are in the same directory structure as V, under Vf16. Zvfh uses Vf16 Table 130 to exercise all floating-point instructions with SEW=16. Zvfh’s conversions between 8-bit integers and binary16 (vfwcvt.f.x[u].v, vfncvt.x[u].f.w and vfncvt.rtz.x[u].f.w at SEW=8) are in Vf8. The Vf16 conversions between 16-bit integers and binary32 (vfwcvt.f.x[u].v, vfncvt.x[u].f.w and vfncvt.rtz.x[u].f.w at SEW=16) need only Zve32f, so they also run on harts without Zvfh.

A.11.9. Zvfhmin Half-Precision Conversions

Zvfhmin only exercises the widening and narrowing conversions: vfwcvt.f.f.v and vfncvt.f.f.w.

Table 132. Zvfhmin Instruction Coverpoints
Instruction vfwcvt.f.f.v vfncvt.f.f.w

RV32

x

x

RV64

x

x

EFFEW16

x

x

cp_asm_count

x

x

cp_vd

emul2

x

cp_vs2

x

emul2

cp_vs2_edges

f

f_emul2

cp_masking_edges

x

x

cr_vl_lmul

lmul4max

lmul4max

cr_vtype_agnostic

lmul4max

lmul4max

cp_vl_0

x

x

cp_csr_fflags

v

voun

cp_csr_frm

v

Zvfhmin Normative Rules

No normative rules found for this section.

UDB Parameters: None.

A.11.10. Zvfbfmin BF16 Conversions

Table 133. Zvfbfmin Instruction Coverpoints
Instruction vfwcvtbf16.f.f.v vfncvtbf16.f.f.w

RV32

x

x

RV64

x

x

EFFEW16

x

x

cp_asm_count

x

x

cp_vd

emul2

x

cp_vs2

x

emul2

cp_vs2_edges

f_bf16

f_emul2

cp_masking_edges

x

x

cr_vl_lmul

lmul4max

lmul4max

cr_vtype_agnostic

lmul4max

lmul4max

cp_vl_0

x

x

cp_csr_fflags

v

voun

cp_csr_frm

v

std_vec

x

cp_custom

vfncvt_rup_overflow_bf16

Table 134. Zvfbfmin Normative Rules
Normative Rule Rule Text Coverpoints

Zvfbfmin_depends_Zve32f

This extension depends upon the Zve32f extension.

Definition, checked through UDB

vfwcvtbf16-f-f-v_op

Widening convert from BF16 to FP32. The conversion is exact.

Zvfbfmin_vfwcvtbf16_f_f_v_cg/{cp_vd_emul2, cp_vs2, cp_vs2_edges_f_bf16_sew16, cp_masking_edges, cr_vl_lmul_lmul4max_sew16, cr_vtype_agnostic_lmul4max, cp_vl_0, cp_csr_fflags_v}

vfwcvtbf16-f-f-v_enc

Encoding

Zvfbfmin_vfwcvtbf16_f_f_v_cg/cp_asm_count

vfwcvtbf16-f-f-v_sew_rsv

SEW is any value other than 16

TODO: SsstrictV test with SEW other than 16

vfncvtbf16-f-f-w_op

Narrowing convert from FP32 to BF16. Round according to the frm register.

Zvfbfmin_vfncvtbf16_f_f_w_cg/{cp_vd, cp_vs2_emul2, cp_vs2_edges_f_emul2_sew16, cp_masking_edges, cr_vl_lmul_lmul4max_sew16, cr_vtype_agnostic_lmul4max, cp_vl_0, cp_csr_fflags_voun, cp_csr_frm_v}

vfncvtbf16-f-f-w_enc

Encoding

Zvfbfmin_vfncvtbf16_f_f_w_cg/cp_asm_count

vfncvtbf16-f-f-w_sew_rsv

SEW is any value other than 16

TODO: SsstrictV test with SEW other than 16

UDB Parameters: None.

A.11.11. Zvfbfwma BF16 MAC

Table 135. Zvfbfwma Instruction Coverpoints
Instruction vfwmaccbf16.vv vfwmaccbf16.vf

RV32

x

x

RV64

x

x

EFFEW16

x

x

cp_asm_count

x

x

cp_vd

emul2

emul2

cp_vs2

x

x

cp_vs1

x

cp_fs1

x

cmp_vs1_vs2

x

cp_vs2_edges

f_bf16

f_bf16

cp_vs1_edges

f_bf16

cr_vs2_vs1_edges

f_bf16

cp_fs1_edges

v_bf16

cr_vs2_fs1_edges

bf16

cp_masking_edges

x

x

cr_vl_lmul

lmul4max

lmul4max

cr_vtype_agnostic

lmul4max

lmul4max

cp_vl_0

x

x

cp_csr_fflags

voun

voun

cp_csr_frm

v

v

Table 136. Zvfbfwma Normative Rules
Normative Rule Rule Text Coverpoints

vfwmaccbf16_op

This instruction performs a widening fused multiply-accumulate operation, where each pair of BF16 values are multiplied and their unrounded product is added to the corresponding FP32 accumulate value. The sum is rounded according to the frm register.

Zvfbfwma_vfwmaccbf16_vv_cg/cr_vs2_vs1_edges_f_bf16_sew16, Zvfbfwma_vfwmaccbf16_vf_cg/cr_vs2_fs1_edges_f_bf16_sew16

vfwmaccbf16-vf

The vector-scalar version is similar, but instead of reading elements from vs1, a scalar BF16 value is read from the FPU register rs1.

Zvfbfwma_vfwmaccbf16_vf_cg/cr_vs2_fs1_edges_f_bf16_sew16

bf16_subnorm

BF16 computational instructions defined in this chapter support all IEEE 754-2008 features, including all rounding modes, subnormal inputs and outputs, overflow and underflow, and default exception handling. Tininess is detected after rounding.

Zvfbfwma_vfwmaccbf16_vv_cg/cr_vs2_vs1_edges_f_bf16_sew16, Zvfbfwma_vfwmaccbf16_vf_cg/cr_vs2_fs1_edges_f_bf16_sew16

vfwmaccbf16_sew_rsv

SEW is any value other than 16

vfwmaccbf16-vv

In the vector-vector version, the BF16 elements are read from vs1 and vs2 and FP32 accumulate value is read from vd. The FP32 result is written to the destination register vd.

Zvfbfwma_vfwmaccbf16_vv_cg/cr_vs2_vs1_edges_f_bf16_sew16

Zvfbfwma_depends

This extension depends upon the Zvfbfmin and Zfbfmin extensions.

Definition, checked through UDB

vfwmaccbf16_encoding_vv

Zvfbfwma_vfwmaccbf16_vv_cg/cp_asm_count

vfwmaccbf16_encoding_vf

Zvfbfwma_vfwmaccbf16_vf_cg/cp_asm_count

UDB Parameters: None.

A.12. Zvb* Vector Bit Manipulation Extension

Vector bit manipulation extensions include Zvbb and Zvbc. They use the same coverpoint definitions as Vx.

A.12.1. Zvbb Vector Basic Bit Manipulation Extension

Zvbb is organized by SEW like other unprivileged vector extensions.

Table 137. Zvbb Instruction Coverpoints
Instruction vandn.vv vandn.vx vbrev.v vbrev8.v vrev8.v vclz.v vctz.v vcpop.v vrol.vv vrol.vx vror.vv vror.vx

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW8

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW16

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW32

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW64

x

x

x

x

x

x

x

x

x

x

x

x

cp_asm_count

x

x

x

x

x

x

x

x

x

x

x

x

cp_vd

x

x

x

x

x

x

x

x

x

x

x

x

cp_vs2

x

x

x

x

x

x

x

x

x

x

x

x

cp_vs1

x

x

x

cp_rs1

x

x

x

cmp_vd_vs2

x

x

x

x

x

x

x

x

x

x

x

x

cmp_vd_vs1

x

x

x

cmp_vs1_vs2

x

x

x

cmp_vd_vs1_vs2

x

x

x

cp_vs2_edges

x

x

x

x

x

x

x

x

x

x

x

x

cp_vs1_edges

x

x

x

cr_vs2_vs1_edges

x

x

x

cp_rs1_edges

x

x

x

cr_vs2_rs1_edges

x

x

x

cp_masking_edges

x

x

x

x

x

x

x

x

x

x

x

x

cr_vl_lmul

x

x

x

x

x

x

x

x

x

x

x

x

cr_vtype_agnostic

x

x

x

x

x

x

x

x

x

x

x

x

cp_vl_0

x

x

x

x

x

x

x

x

x

x

x

x

Instruction vror.vi vwsll.vv vwsll.vx vwsll.vi

RV32

x

x

x

x

RV64

x

x

x

x

EFFEW8

x

x

x

x

EFFEW16

x

x

x

x

EFFEW32

x

x

x

x

EFFEW64

x

cp_asm_count

x

x

x

x

cp_vd

x

emul2

emul2

emul2

cp_vs2

x

x

x

x

cp_vs1

x

cp_rs1

x

cp_imm_5bit

u

cp_uimm

6bit_v

cmp_vd_vs2

x

cmp_vs1_vs2

x

cp_vs2_edges

x

x

x

x

cp_vs1_edges

x

cr_vs2_vs1_edges

x

cp_rs1_edges

x

cr_vs2_rs1_edges

x

cr_vs2_imm_edges

6bit_u

u

cp_masking_edges

x

x

x

x

cr_vl_lmul

x

lmul4max

lmul4max

lmul4max

cr_vtype_agnostic

x

lmul4max

lmul4max

lmul4max

cp_vl_0

x

x

x

x

std_vec

x

x

x

cp_custom

wvv_all

wvx_all

wvx_all

Table 138. Zvbb Normative Rules
Normative Rule Rule Text Coverpoints

Zvbb_dependent_Zve32x

Zvbb depends upon the Zve32x extension.

Definition, checked through UDB

Zvbb_eew

Zvbb provides support for EEW of 8, 16, and 32.

Zvbb8_vclz_v_cg/cp_asm_count, Zvbb16_vclz_v_cg/cp_asm_count, Zvbb32_vclz_v_cg/cp_asm_count

vandn_op

Each bit of Op1 is inverted and logically ANDed with the corresponding bits in vs2.

Zvbb16_vandn_vv_cg/cp_vd

vandn-vx_rs1

In the vector-scalar version, Op1 is the sign-extended or truncated value in scalar register rs1.

Zvbb16_vandn_vx_cg/cp_rs1_edges

vandn-vv_vs1

In the vector-vector version, Op1 is vs1.

Zvbb16_vandn_vv_cg/cp_vs1

vbrev-v_op

A bit reversal is performed on the bits of each element.

Zvbb8_vbrev_v_cg/cp_vs2_edges, Zvbb8_vbrev_v_cg/cr_vl_lmul_sew8, Zvbb64_vbrev_v_cg/cp_vs2_edges, Zvbb64_vbrev_v_cg/cr_vl_lmul_sew64

vbrev8-v_op

A bit reversal is performed on the bits of each byte.

Zvbb16_vbrev8_v_cg/cp_vd

vclz-v_op

A leading zero count is performed on each element.

Zvbb16_vclz_v_cg/cp_vs2_edges, Zvbb8_vclz_v_cg/cp_vs2_edges, Zvbb8_vclz_v_cg/cr_vl_lmul_sew8, Zvbb64_vclz_v_cg/cp_vs2_edges, Zvbb64_vclz_v_cg/cr_vl_lmul_sew64

vcpop-v_op

A population count is performed on each element.

Zvbb16_vcpop_v_cg/cp_vd, Zvbb8_vcpop_v_cg/cp_vs2_edges, Zvbb8_vcpop_v_cg/cr_vl_lmul_sew8, Zvbb64_vcpop_v_cg/cp_vs2_edges, Zvbb64_vcpop_v_cg/cr_vl_lmul_sew64

vctz-v_op

A trailing zero count is performed on each element.

Zvbb16_vctz_v_cg/cp_vd, Zvbb8_vctz_v_cg/cp_vs2_edges, Zvbb8_vctz_v_cg/cr_vl_lmul_sew8, Zvbb64_vctz_v_cg/cp_vs2_edges, Zvbb64_vctz_v_cg/cr_vl_lmul_sew64

vrev8-v_op

A byte reversal is performed on each element of vs2, effectively performing an endian swap.

Zvbb16_vrev8_v_cg/cp_vd

vrol_op

The elements in vs2 are rotated left by the rotate amount specified by either the corresponding elements of vs1 (vector-vector), or integer register rs1 (vector-scalar). Only the low log2(SEW) bits of the rotate-amount value are used, all other bits are ignored.

Zvbb16_vrol_vv_cg/cp_vs1_edges, Zvbb16_vrol_vx_cg/cp_rs1_edges

vror_op

The elements in vs2 are rotated right by the rotate amount specified by either the corresponding elements of vs1 (vector-vector), integer register rs1 (vector-scalar), or an immediate value (vector-immediate). Only the low log2(SEW) bits of the rotate-amount value are used, all other bits are ignored.

Zvbb16_vror_vx_cg/cp_rs1_edges

vwsll_op

The elements in vs2 are zero-extended to 2×SEW bits, then shifted left by the shift amount specified by either the corresponding elements of vs1 (vector-vector), integer register rs1 (vector-scalar), or an immediate value (vector-immediate). Only the low log2(2×SEW) bits of the shift-amount value are used, all other bits are ignored.

Zvbb16_vwsll_vx_cg/cp_rs1_edges, Zvbb8_vwsll_vv_cg/cr_vs2_vs1_edges, Zvbb8_vwsll_vx_cg/cr_vs2_rs1_edges, Zvbb8_vwsll_vi_cg/cr_vs2_imm_edges, Zvbb32_vwsll_vv_cg/cr_vs2_vs1_edges

Zvbb_eew_Zve64x

If Zve64x is supported then Zvbb also adds support for EEW=64.

Zvbb64_vclz_v_cg/cp_asm_count

vclz-v_op_zeroinput

The result for zero-valued inputs is the value SEW.

Zvbb8_vclz_v_cg/cp_vs2_edges, Zvbb16_vclz_v_cg/cp_vs2_edges, Zvbb32_vclz_v_cg/cp_vs2_edges, Zvbb64_vclz_v_cg/cp_vs2_edges

UDB Parameters: None.

A.12.2. Zvbc Vector Carryless Multiplication Extension

Zvbc only applies to SEW=64.

Table 139. Zvbc Instruction Coverpoints
Instruction vclmul.vv vclmul.vx vclmulh.vv vclmulh.vx

RV32

x

x

x

x

RV64

x

x

x

x

EFFEW64

x

x

x

x

cp_asm_count

x

x

x

x

cp_vd

x

x

x

x

cp_vs2

x

x

x

x

cp_vs1

x

x

cp_rs1

x

x

cmp_vd_vs2

x

x

x

x

cmp_vd_vs1

x

x

cmp_vs1_vs2

x

x

cmp_vd_vs1_vs2

x

x

cp_vs2_edges

x

x

x

x

cp_vs1_edges

x

x

cr_vs2_vs1_edges

x

x

cp_rs1_edges

x

x

cr_vs2_rs1_edges

x

x

cp_masking_edges

x

x

x

x

cr_vl_lmul

x

x

x

x

cr_vtype_agnostic

x

x

x

x

cp_vl_0

x

x

x

x

Table 140. Zvbc Normative Rules
Normative Rule Rule Text Coverpoints

Zvbc_dependent_Zve64x

Zvbc depends upon the Zve64x extension.

Definition, checked through UDB

Zvbc_sew64only

The instructions in Zvbc are only defined for SEW=64.

Zvbc64_vclmul_vv_cg/cp_asm_count, Zvbc64_vclmul_vx_cg/cp_asm_count, Zvbc64_vclmulh_vv_cg/cp_asm_count, Zvbc64_vclmulh_vx_cg/cp_asm_count

vclmul_sewn64_rsv

SEW is any value other than 64

Out-of-Scope: reserved because of CSR state (vtype.sew); no Ssstrict-equivalent suite exists for Zvbc to exercise this reserved SEW encoding

vclmul_op

Each 64-bit element in the vs2 vector register is carry-less multiplied by either each 64-bit element in vs1 (vector-vector), or the 64-bit value from integer register rs1 (vector-scalar). The result is the least significant 64 bits of the carry-less product.

Zvbc64_vclmul_vv_cg/cp_vs2_edges, Zvbc64_vclmul_vv_cg/cr_vs2_vs1_edges, Zvbc64_vclmul_vv_cg/cr_vl_lmul_sew64, Zvbc64_vclmul_vx_cg/cr_vs2_rs1_edges, Zvbc64_vclmul_vx_cg/cr_vl_lmul_sew64

vclmulh_sewn64_rsv

SEW is any value other than 64

Out-of-Scope: reserved because of CSR state (vtype.sew); no Ssstrict-equivalent suite exists for Zvbc to exercise this reserved SEW encoding

vclmulh_op

Each 64-bit element in the vs2 vector register is carry-less multiplied by either each 64-bit element in vs1 (vector-vector), or the 64-bit value from integer register rs1 (vector-scalar). The result is the most significant 64 bits of the carry-less product.

Zvbc64_vclmulh_vv_cg/cp_vs2_edges, Zvbc64_vclmulh_vv_cg/cr_vs2_vs1_edges, Zvbc64_vclmulh_vv_cg/cr_vl_lmul_sew64, Zvbc64_vclmulh_vx_cg/cr_vs2_rs1_edges, Zvbc64_vclmulh_vx_cg/cr_vl_lmul_sew64

UDB Parameters: None.

A.13. Zvk* Vector Cryptography Extension

There are several Zvk* vector cryptography extensions.

A.13.1. Zvkb Vector Crypto Bit Manipulation Extension

Each SEW has its own suite.

Table 141. Zvkb Instruction Coverpoints
Instruction vandn.vv vandn.vx vbrev8.v vrev8.v vrol.vv vrol.vx vror.vv vror.vx vror.vi

RV32

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

EFFEW8

x

x

x

x

x

x

x

x

x

EFFEW16

x

x

x

x

x

x

x

x

x

EFFEW32

x

x

x

x

x

x

x

x

x

EFFEW64

x

x

x

x

x

x

x

x

x

cp_asm_count

x

x

x

x

x

x

x

x

x

cp_vd

x

x

x

x

x

x

x

x

x

cp_vs2

x

x

x

x

x

x

x

x

x

cp_vs1

x

x

x

cp_rs1

x

x

x

cp_uimm

6bit_v

cmp_vd_vs2

x

x

x

x

x

x

x

x

x

cmp_vd_vs1

x

x

x

cmp_vs1_vs2

x

x

x

cmp_vd_vs1_vs2

x

x

x

cp_vs2_edges

x

x

x

x

x

x

x

x

x

cp_vs1_edges

x

x

x

cr_vs2_vs1_edges

x

x

x

cp_rs1_edges

x

x

x

cr_vs2_rs1_edges

x

x

x

cr_vs2_imm_edges

6bit_u

cp_masking_edges

x

x

x

x

x

x

x

x

x

cr_vl_lmul

x

x

x

x

x

x

x

x

x

cr_vtype_agnostic

x

x

x

x

x

x

x

x

x

cp_vl_0

x

x

x

x

x

x

x

x

x

Table 142. Zvkb Normative Rules
Normative Rule Rule Text Coverpoints

zvk_dataindep_timing

All instructions shall be implemented with data-independent timing. That is, the latency of the execution of these instructions shall not vary with different input values.

TODO: data-independent execution timing (a side-channel-resistance property) cannot be observed from a final-state signature comparison

veccrypto_eeweqsew

For all of the vector crypto instructions in this specification, EEW=SEW.

TODO: EEW=SEW is inherent in every vector-crypto instruction’s encoding; no dedicated coverpoint isolates it

veccrypto_vl_vstart_egsconstr

Since vl and vstart refer to elements, Vector Crypto instructions that use elements groups (See crypto-vector-element-groups) require that these values are an integer multiple of the Element Group Size (EGS).

TODO: no coverpoint verifies vl/vstart are rejected when not a multiple of EGS - the functional suites only ever generate compliant values

veccrypto_vl_vstart_rsv

Instructions that violate the vl or vstart requirements are reserved.

TODO: no Ssstrict-equivalent suite exists for the vector-crypto extensions to exercise vl/vstart values that violate the EGS constraint

veccrypto_lmul_egwconstr

For element-group instructions, LMUL×VLEN must always be at least as large as EGW, otherwise an illegal-instruction exception is raised, even if vl=0.

TODO: no ExceptionsZvk-style suite exists yet to exercise the LMUL*VLEN<EGW illegal-instruction condition

veccrypto_sew_rsv

Some Vector Crypto instructions are only defined for a specific SEW. In such a case all other SEW values are reserved.

Out-of-Scope: reserved because of CSR state (vtype.sew); no Ssstrict-equivalent suite exists to exercise these reserved SEW encodings; see the per-instruction _sewn32_rsv/_sewn64_rsv rules in each extension’s own file

veccrypto_vsins_vs2

In the case of the *.VS instructions defined in this specification, vs2 holds a 128-bit scalar element group.

Zvkned_vaesdf_vs_cg/cp_vs2_egs4

veccrypto_vsins_vdvs2overlap

For implementations with VLEN ≥ 128, vs2 refers to a single register. Thus, the vd register group must not overlap the vs2 register. However, in implementations where VLEN < 128, vs2 refers to a register group comprised of the number of registers needed to hold the 128-bit scalar element group. In this case, the vd register group must not overlap this vs2 register group.

TODO: this is an SsstrictV-style reserved-encoding test; no register-overlap coverpoint exists yet for the *.vs instruction forms (e.g. Zvkned_vaesdf_vs_cg has no cmp_vd_vs2-style coverpoint)

veccrypto_vsins_vd

they return vector results to vd, which is also a source vector operand.

Zvkg_vghsh_vv_cg/cp_vd_egs4

Zvknhb_Zvkn_Zvknc_Zvkng_Zvksc_depZve64x

The Zvknhb, Zvkn, Zvknc, Zvkng, and Zvksc depend on Zve64x.

TODO: extension-composition fact; no dedicated coverpoint exists for it (Zvkn/Zvknc/Zvkng/Zvksc are not separate suites in this repo)

Zvkb_Zvkg_Zvkned_Zvknha_Zvksed_Zvksh_Zvks_Zvksc_Zvksg_Zvkt_depZve32x

All of the other Vector Crypto Extensions depend on Zve32x.

TODO: extension-composition fact; no dedicated coverpoint exists for it (Zvks/Zvksc/Zvksg/Zvkt are not separate suites in this repo)

veccrypto_indepZkt

It is important to note that the Vector Crypto instructions are independent of the implementation of the Zkt extension and do not require that Zkt is implemented.

TODO: independence from an unrelated extension’s implementation is not something a coverpoint can assert one way or the other

vandn_op

Each bit of Op1 is inverted and logically ANDed with the corresponding bits in vs2.

Zvkb8_vandn_vv_cg/cr_vs2_vs1_edges, Zvkb8_vandn_vx_cg/cr_vs2_rs1_edges, Zvkb64_vandn_vv_cg/cr_vs2_vs1_edges, Zvkb64_vandn_vx_cg/cr_vs2_rs1_edges

vandn-vx_rs1

In the vector-scalar version, Op1 is the sign-extended or truncated value in scalar register rs1.

Zvkb8_vandn_vx_cg/cr_vs2_rs1_edges, Zvkb16_vandn_vx_cg/cr_vs2_rs1_edges, Zvkb32_vandn_vx_cg/cr_vs2_rs1_edges, Zvkb64_vandn_vx_cg/cr_vs2_rs1_edges

vandn-vv_vs1

In the vector-vector version, Op1 is vs1.

Zvkb8_vandn_vv_cg/cr_vs2_vs1_edges, Zvkb16_vandn_vv_cg/cr_vs2_vs1_edges, Zvkb32_vandn_vv_cg/cr_vs2_vs1_edges, Zvkb64_vandn_vv_cg/cr_vs2_vs1_edges

vbrev8-v_op

A bit reversal is performed on the bits of each byte.

Zvkb8_vbrev8_v_cg/{cp_vs2_edges, cr_vl_lmul_sew8}, Zvkb64_vbrev8_v_cg/{cp_vs2_edges, cr_vl_lmul_sew64}

vrev8-v_op

A byte reversal is performed on each element of vs2, effectively performing an endian swap.

Zvkb8_vrev8_v_cg/{cp_vs2_edges, cr_vl_lmul_sew8}, Zvkb64_vrev8_v_cg/{cp_vs2_edges, cr_vl_lmul_sew64}

vrol_op

The elements in vs2 are rotated left by the rotate amount specified by either the corresponding elements of vs1 (vector-vector), or integer register rs1 (vector-scalar). Only the low log2(SEW) bits of the rotate-amount value are used, all other bits are ignored.

Zvkb8_vrol_vv_cg/cr_vs2_vs1_edges, Zvkb8_vrol_vx_cg/cr_vs2_rs1_edges, Zvkb64_vrol_vv_cg/cr_vs2_vs1_edges, Zvkb64_vrol_vx_cg/cr_vs2_rs1_edges

vror_op

The elements in vs2 are rotated right by the rotate amount specified by either the corresponding elements of vs1 (vector-vector), integer register rs1 (vector-scalar), or an immediate value (vector-immediate). Only the low log2(SEW) bits of the rotate-amount value are used, all other bits are ignored.

Zvkb8_vror_vv_cg/cr_vs2_vs1_edges, Zvkb8_vror_vx_cg/cr_vs2_rs1_edges, Zvkb8_vror_vi_cg/cr_vs2_imm_edges, Zvkb64_vror_vi_cg/cr_vs2_imm_edges, TODO: vror.vi with i5=1 (rotate amounts 32-63 at SEW=64)

Zvkt_req

The Zvkt extension requires all implemented instructions from the following list to be executed with data-independent execution latency as defined in the RISC-V Scalar Cryptography Extensions specification.

Untestable: microarchitectural timing

Zvkt_diel_def

Data-independent execution latency (DIEL) applies to all data operands of an instruction, even those that are not a part of the body or that are inactive. However, DIEL does not apply to other values such as vl, vtype, and the mask (when used to control execution of a masked vector instruction).

Untestable: microarchitectural timing

Zvkt_diel_constants_exempt

Also, DIEL does not apply to constant values specified in the instruction encoding such as the use of the zero register (x0), and, in the case of immediate forms of an instruction, the values in the immediate fields (i.e., imm and uimm).

Untestable: microarchitectural timing

Zvkt_diel_control_exempt

In some cases—​which are explicitly specified in the lists below—​operands that are used as control rather than data are exempt from DIEL.

Untestable: microarchitectural timing

UDB Parameters: None.

A.13.2. Zvkg Vector Crypto Galois Field Extension

Only SEW=32 is defined.

Table 143. Zvkg Instruction Coverpoints
Instruction vghsh.vv vgmul.vv

RV32

x

x

RV64

x

x

EFFEW32

x

x

cp_asm_count

x

x

cp_vd

egs4

egs4

cp_vs2

egs4

egs4

cp_vs1

egs4

cmp_vd_vs2

egs4

egs4

cmp_vd_vs1

egs4

cmp_vs1_vs2

egs4

cmp_vd_vs1_vs2

egs4

cp_vs2_edges

egs4

egs4

cp_vs1_edges

egs4

cp_vd_edges

egs4

egs4

cr_vs2_vs1_edges

egs4

cr_vs1_vd_edges

egs4

cr_vs2_vd_edges

egs4

egs4

cr_vl_lmul

egs4

egs4

cr_vtype_agnostic

egs4

egs4

cp_custom

nist_gcm

nist_gcm

Table 144. Zvkg Normative Rules
Normative Rule Rule Text Coverpoints

Zvkg_egw128b_elem32b

All of these instructions work on 128-bit element groups comprised of four 32-bit elements.

Zvkg_vghsh_vv_cg/cp_csr_vtype_lmul_egs4_sew32, Zvkg_vghsh_vv_cg/cr_vl_lmul_egs4_sew32, Zvkg_vgmul_vv_cg/cr_vl_lmul_egs4_sew32

Zvkg_dataindeptiming

To help avoid side-channel timing attacks, these instructions shall be implemented with data-independent timing.

Untestable: microarchitectural timing

Zvkg_vl

The number of element groups to be processed is vl/EGS. vl must be set to the number of SEW=32 elements to be processed and therefore must be a multiple of EGS=4.

Zvkg_vghsh_vv_cg/cr_vl_lmul_egs4_sew32, Zvkg_vgmul_vv_cg/cr_vl_lmul_egs4_sew32

Zvkg_vstart

Likewise, vstart must be a multiple of EGS=4.

TODO: no coverpoint samples vstart for this suite yet; nothing wired in coverpoints/unpriv/Zvkg_coverage.svh

vghsh-vv_sewn32_rsv

SEW is any value other than 32

Out-of-Scope: reserved because of CSR state (vtype.sew); Zvkg only generates SEW=32 tests and there is no Ssstrict-equivalent suite for vector-crypto

vghsh-vv_op

This instruction treats all of the inputs and outputs as 128-bit polynomials and performs operations over GF[2]. It produces the next partial hash (Yi+1) by adding the current partial hash (Yi) to the cipher text block (Xi) and then multiplying (over GF(2128)) this sum by the Hash Subkey (H).

Zvkg_vghsh_vv_cg/cp_vd_egs4, Zvkg_vghsh_vv_cg/cr_vs2_vs1_edges_egs4, Zvkg_vghsh_vv_cg/cr_vs1_vd_edges_egs4, Zvkg_vghsh_vv_cg/cr_vs2_vd_edges_egs4, Zvkg_vghsh_vv_cg/cr_vl_lmul_egs4_sew32

vghsh-vv_exeindepdata

This instruction must always be implemented such that its execution latency does not depend on the data being operated upon.

Untestable: microarchitectural timing

vgmul-vv_sewn32_rsv

SEW is any value other than 32

Out-of-Scope: reserved because of CSR state (vtype.sew); Zvkg only generates SEW=32 tests and there is no Ssstrict-equivalent suite for vector-crypto

vgmul-vv_op

This instruction treats all of the inputs and outputs as 128-bit polynomials and performs operations over GF[2]. It produces the product over GF(2128) of the two 128-bit inputs.

Zvkg_vgmul_vv_cg/cp_vd_egs4, Zvkg_vgmul_vv_cg/cr_vs2_vd_edges_egs4, Zvkg_vgmul_vv_cg/cr_vl_lmul_egs4_sew32

vgmul-vv_exeindepdata

This instruction must always be implemented such that its execution latency does not depend on the data being operated upon.

Untestable: microarchitectural timing

vghsh-vv_op_gf

The multiplication over GF(2128) is a carry-less multiply of two 128-bit polynomials modulo GHASH’s irreducible polynomial (x128 + x7 + x2 + x + 1).

Zvkg_vghsh_vv_cg/{cr_vs2_vs1_edges_egs4, cr_vs1_vd_edges_egs4, cr_vs2_vd_edges_egs4}

vghsh-vv_op_coeff

The NIST specification (see Zvkg) orders the coefficients from left to right x0x1x2…​x127 for a polynomial x0 + x1u +x2 u2 + …​ + x127u127. This can be viewed as a collection of byte elements in memory with the byte containing the lowest coefficients (i.e., 0,1,2,3,4,5,6,7) residing at the lowest memory address. Since the bits in the bytes are reversed, this instruction internally performs bit swaps within bytes to put the bits in the standard ordering (e.g., 7,6,5,4,3,2,1,0).

Zvkg_vghsh_vv_cg/{cr_vs2_vs1_edges_egs4, cr_vs1_vd_edges_egs4, cr_vs2_vd_edges_egs4}

vgmul-vv_op_gf

The multiplication over GF(2128) is a carry-less multiply of two 128-bit polynomials modulo GHASH’s irreducible polynomial (x128 + x7 + x2 + x + 1).

Zvkg_vgmul_vv_cg/cr_vs2_vd_edges_egs4

vgmul-vv_op_coeff

The NIST specification (see Zvkg) orders the coefficients from left to right x0x1x2…​x127 for a polynomial x0 + x1u +x2 u2 + …​ + x127u127. This can be viewed as a collection of byte elements in memory with the byte containing the lowest coefficients (i.e., 0,1,2,3,4,5,6,7) residing at the lowest memory address. Since the bits in the bytes are reversed, This instruction internally performs bit swaps within bytes to put the bits in the standard ordering (e.g., 7,6,5,4,3,2,1,0).

Zvkg_vgmul_vv_cg/cr_vs2_vd_edges_egs4

UDB Parameters: None.

A.13.3. Zvkned Vector NIST Encryption and Decryption

Only SEW=32 is defined.

Table 145. Zvkned Instruction Coverpoints
Instruction vaesef.vv vaesef.vs vaesem.vv vaesem.vs vaesdf.vv vaesdf.vs vaesdm.vv vaesdm.vs vaeskf1.vi vaeskf2.vi vaesz.vs

RV32

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

EFFEW32

x

x

x

x

x

x

x

x

x

x

x

cp_asm_count

x

x

x

x

x

x

x

x

x

x

x

cp_vd

egs4

egs4

egs4

egs4

egs4

egs4

egs4

egs4

egs4

egs4

egs4

cp_vs2

egs4

egs4

egs4

egs4

egs4

egs4

egs4

egs4

egs4

egs4

egs4

cp_imm_5bit

u

u

cmp_vd_vs2

egs4

egs4

egs4

egs4

egs4

egs4

cp_vs2_edges

egs4

egs4

egs4

egs4

egs4

egs4

egs4

egs4

egs4_subbytes

egs4_subbytes

egs4

cp_vd_edges

egs4_subbytes

egs4_subbytes

egs4_subbytes

egs4_subbytes

egs4_subbytes

egs4_subbytes

egs4_subbytes

egs4_subbytes

egs4

egs4

cr_vs2_vd_edges

egs4_subbytes

egs4_subbytes

egs4_subbytes

egs4_subbytes

egs4_subbytes

egs4_subbytes

egs4_subbytes

egs4_subbytes

egs4_subbytes_vs2

egs4

cr_vl_lmul

egs4

egs4

egs4

egs4

egs4

egs4

egs4

egs4

egs4

egs4

egs4

cr_vtype_agnostic

egs4

egs4

egs4

egs4

egs4

egs4

egs4

egs4

egs4

egs4

egs4

cp_vl_0

egs4

egs4

cp_custom

act3_crypto

act3_crypto

act3_crypto

act3_crypto

act3_crypto

act3_crypto

act3_crypto

act3_crypto

act3_crypto

act3_crypto

act3_crypto

Table 146. Zvkned Normative Rules
Normative Rule Rule Text Coverpoints

Zvkned_egw128b_elem32b

All of these instructions work on 128-bit element groups comprised of four 32-bit elements.

Zvkned_vaesef_vv_cg/cp_csr_vtype_lmul_egs4_sew32, Zvkned_vaesef_vv_cg/cr_vl_lmul_egs4_sew32, Zvkned_vaeskf1_vi_cg/cr_vl_lmul_egs4_sew32, Zvkned_vaesz_vs_cg/cr_vl_lmul_egs4_sew32

Zvkned_dataindeptiming

To help avoid side-channel timing attacks, these instructions shall be implemented with data-independent timing.

Untestable: microarchitectural timing

Zvkned_vl

The number of element groups to be processed is vl/EGS. vl must be set to the number of SEW=32 elements to be processed and therefore must be a multiple of EGS=4.

Zvkned_vaesef_vv_cg/cr_vl_lmul_egs4_sew32, Zvkned_vaeskf1_vi_cg/cr_vl_lmul_egs4_sew32, Zvkned_vaesz_vs_cg/cr_vl_lmul_egs4_sew32

Zvkned_vstart

Likewise, vstart must be a multiple of EGS=4.

TODO: no coverpoint samples a vstart-multiple-of-EGS constraint for Zvkned; only vl is exercised

vaesdf_final

A final-round AES block cipher decryption is performed.

Zvkned_vaesdf_vv_cg/cp_vd_egs4, Zvkned_vaesdf_vv_cg/cr_vs2_vd_edges_egs4_subbytes_0, Zvkned_vaesdf_vv_cg/cr_vl_lmul_egs4_sew32, Zvkned_vaesdf_vs_cg/cr_vs2_vd_edges_egs4_subbytes_0, Zvkned_vaesdf_vs_cg/cr_vl_lmul_egs4_sew32

vaesdf_ops

The InvShiftRows and InvSubBytes steps are applied to each round state element group from vd.

Zvkned_vaesdf_vv_cg/cp_vd_egs4, Zvkned_vaesdf_vv_cg/cp_vd_edges_egs4_byte_0, Zvkned_vaesdf_vv_cg/cp_vd_edges_egs4_byte_15, Zvkned_vaesdf_vs_cg/cp_vd_edges_egs4_byte_0, Zvkned_vaesdf_vs_cg/cp_vd_edges_egs4_byte_15

vaesdf_xor_form

This is then XORed with the round key in either the corresponding element group in vs2 (vector-vector form) or scalar element group in vs2 (vector-scalar form).

{Zvkned_vaesdf_vv_cg,Zvkned_vaesdf_vs_cg}/cp_vs2_egs4, Zvkned_vaesdf_vv_cg/cp_vs2_edges_egs4, Zvkned_vaesdf_vv_cg/cr_vs2_vd_edges_egs4_subbytes_0, Zvkned_vaesdf_vs_cg/cp_vs2_edges_egs4, Zvkned_vaesdf_vs_cg/cr_vs2_vd_edges_egs4_subbytes_0

vaesdm_mid

A middle-round AES block cipher decryption is performed.

Zvkned_vaesdm_vv_cg/cp_vd_egs4, Zvkned_vaesdm_vv_cg/cr_vs2_vd_edges_egs4_subbytes_0, Zvkned_vaesdm_vv_cg/cr_vl_lmul_egs4_sew32, Zvkned_vaesdm_vs_cg/cr_vs2_vd_edges_egs4_subbytes_0, Zvkned_vaesdm_vs_cg/cr_vl_lmul_egs4_sew32

vaesdm_ops

The InvShiftRows and InvSubBytes steps are applied to each round state element group from vd.

Zvkned_vaesdm_vv_cg/cp_vd_egs4, Zvkned_vaesdm_vv_cg/cp_vd_edges_egs4_byte_0, Zvkned_vaesdm_vv_cg/cp_vd_edges_egs4_byte_15, Zvkned_vaesdm_vs_cg/cp_vd_edges_egs4_byte_0, Zvkned_vaesdm_vs_cg/cp_vd_edges_egs4_byte_15

vaesdm_xor_form

This is then XORed with the round key in either the corresponding element group in vs2 (vector-vector form) or the scalar element group in vs2 (vector-scalar form).

{Zvkned_vaesdm_vv_cg,Zvkned_vaesdm_vs_cg}/cp_vs2_egs4, Zvkned_vaesdm_vv_cg/cp_vs2_edges_egs4, Zvkned_vaesdm_vv_cg/cr_vs2_vd_edges_egs4_subbytes_0, Zvkned_vaesdm_vs_cg/cp_vs2_edges_egs4, Zvkned_vaesdm_vs_cg/cr_vs2_vd_edges_egs4_subbytes_0

vaesdm_invmix

InvMixColumns step.

Zvkned_vaesdm_vv_cg/cp_vd_egs4, Zvkned_vaesdm_vv_cg/cr_vs2_vd_edges_egs4_subbytes_0, Zvkned_vaesdm_vs_cg/cr_vs2_vd_edges_egs4_subbytes_0

vaesef_final

A final-round encryption function of the AES block cipher is performed.

Zvkned_vaesef_vv_cg/cp_vd_egs4, Zvkned_vaesef_vv_cg/cr_vs2_vd_edges_egs4_subbytes_0, Zvkned_vaesef_vv_cg/cr_vl_lmul_egs4_sew32, Zvkned_vaesef_vs_cg/cr_vs2_vd_edges_egs4_subbytes_0, Zvkned_vaesef_vs_cg/cr_vl_lmul_egs4_sew32

vaesef_ops

The SubBytes and ShiftRows steps are applied to each round state element group from vd.

Zvkned_vaesef_vv_cg/cp_vd_egs4, Zvkned_vaesef_vv_cg/cp_vd_edges_egs4_byte_0, Zvkned_vaesef_vv_cg/cp_vd_edges_egs4_byte_15, Zvkned_vaesef_vs_cg/cp_vd_edges_egs4_byte_0, Zvkned_vaesef_vs_cg/cp_vd_edges_egs4_byte_15

vaesef_xor_form

This is then XORed with the round key in either the corresponding element group in vs2 (vector-vector form) or the scalar element group in vs2 (vector-scalar form).

{Zvkned_vaesef_vv_cg,Zvkned_vaesef_vs_cg}/cp_vs2_egs4, Zvkned_vaesef_vv_cg/cp_vs2_edges_egs4, Zvkned_vaesef_vv_cg/cr_vs2_vd_edges_egs4_subbytes_0, Zvkned_vaesef_vs_cg/cp_vs2_edges_egs4, Zvkned_vaesef_vs_cg/cr_vs2_vd_edges_egs4_subbytes_0

vaesem_mid

A middle-round encryption function of the AES block cipher is performed.

Zvkned_vaesem_vv_cg/cp_vd_egs4, Zvkned_vaesem_vv_cg/cr_vs2_vd_edges_egs4_subbytes_0, Zvkned_vaesem_vv_cg/cr_vl_lmul_egs4_sew32, Zvkned_vaesem_vs_cg/cr_vs2_vd_edges_egs4_subbytes_0, Zvkned_vaesem_vs_cg/cr_vl_lmul_egs4_sew32

vaesem_ops

The SubBytes, ShiftRows, and MixColumns steps are applied to each round state element group from vd.

Zvkned_vaesem_vv_cg/cp_vd_egs4, Zvkned_vaesem_vv_cg/cp_vd_edges_egs4_byte_0, Zvkned_vaesem_vv_cg/cp_vd_edges_egs4_byte_15, Zvkned_vaesem_vs_cg/cp_vd_edges_egs4_byte_0, Zvkned_vaesem_vs_cg/cp_vd_edges_egs4_byte_15

vaesem_xor_form

This is then XORed with the round key in either the corresponding element group in vs2 (vector-vector form) or the scalar element group in vs2 (vector-scalar form).

{Zvkned_vaesem_vv_cg,Zvkned_vaesem_vs_cg}/cp_vs2_egs4, Zvkned_vaesem_vv_cg/cp_vs2_edges_egs4, Zvkned_vaesem_vv_cg/cr_vs2_vd_edges_egs4_subbytes_0, Zvkned_vaesem_vs_cg/cp_vs2_edges_egs4, Zvkned_vaesem_vs_cg/cr_vs2_vd_edges_egs4_subbytes_0

vaeskf1_round

A single round of the forward AES-128 KeySchedule is performed.

Zvkned_vaeskf1_vi_cg/cp_vd_egs4, Zvkned_vaeskf1_vi_cg/cp_imm_5bit_u, Zvkned_vaeskf1_vi_cg/cp_vs2_edges_egs4_byte_0, Zvkned_vaeskf1_vi_cg/cp_vs2_edges_egs4_byte_15, Zvkned_vaeskf1_vi_cg/cr_vl_lmul_egs4_sew32

vaeskf1_wordgen

The next round key is generated word by word from the current round key element group in vs2 and the immediately previous word of the round key.

Zvkned_vaeskf1_vi_cg/cp_vs2_egs4, Zvkned_vaeskf1_vi_cg/cp_vs2_edges_egs4_byte_0, Zvkned_vaeskf1_vi_cg/cp_vs2_edges_egs4_byte_15

vaeskf1_uimm_src

ranges from 1 to 10, comes from uimm[3:0]; uimm[4] is ignored.

Zvkned_vaeskf1_vi_cg/cp_imm_5bit_u

vaeskf1_uimm_map

The out-of-range uimm[3:0] values of 0 and 11&#8205;&#8211;&#8205;15 are mapped to in-range values by inverting uimm[3].

Zvkned_vaeskf1_vi_cg/cp_imm_5bit_u

vaeskf2_round

A single round of the forward AES-256 KeySchedule is performed.

Zvkned_vaeskf2_vi_cg/cp_vd_egs4, Zvkned_vaeskf2_vi_cg/cp_imm_5bit_u, Zvkned_vaeskf2_vi_cg/cr_vs2_vd_edges_egs4_subbytes_vs2_0, Zvkned_vaeskf2_vi_cg/cr_vs2_vd_edges_egs4_subbytes_vs2_15, Zvkned_vaeskf2_vi_cg/cr_vl_lmul_egs4_sew32

vaeskf2_wordgen

The next round key is generated word by word from the previous round key element group in vd and the immediately previous word of the round key.

Zvkned_vaeskf2_vi_cg/cp_vd_edges_egs4, Zvkned_vaeskf2_vi_cg/cr_vs2_vd_edges_egs4_subbytes_vs2_0

vaeskf2_rcon_lsw

least significant word of the next round key is generated by applying a function to the most significant word of the current round key and then XORing the result with the round constant.

Zvkned_vaeskf2_vi_cg/cp_vs2_egs4, Zvkned_vaeskf2_vi_cg/cp_imm_5bit_u, Zvkned_vaeskf2_vi_cg/cp_vs2_edges_egs4_byte_12, Zvkned_vaeskf2_vi_cg/cp_vs2_edges_egs4_byte_15

vaeskf2_rcon_func

The round number is used to select the round constant as well as the function.

Zvkned_vaeskf2_vi_cg/cp_imm_5bit_u

vaeskf2_uimm_src

ranges from 2 to 14, comes from uimm[3:0]; uimm[4] is ignored.

Zvkned_vaeskf2_vi_cg/cp_imm_5bit_u

vaeskf2_uimm_map

The out-of-range uimm[3:0] values of 0&#8205;&#8211;&#8205;1 and 15 are mapped to in-range values by inverting uimm[3].

Zvkned_vaeskf2_vi_cg/cp_imm_5bit_u

vaesz_round0

A round-0 AES block cipher operation is performed.

Zvkned_vaesz_vs_cg/cp_vd_egs4, Zvkned_vaesz_vs_cg/cr_vs2_vd_edges_egs4, Zvkned_vaesz_vs_cg/cr_vl_lmul_egs4_sew32

vaesz-vs_only

There is only a *.VS form of the instruction.

Zvkned_vaesz_vs_cg/cp_asm_count

vaesz_vs2_rk

vs2 holds a scalar element group that is used as the round key for all of the round state element groups.

Zvkned_vaesz_vs_cg/cp_vs2_egs4, Zvkned_vaesz_vs_cg/cp_vs2_edges_egs4, Zvkned_vaesz_vs_cg/cr_vl_lmul_egs4_sew32

zvk_dataindep_timing

All instructions shall be implemented with data-independent timing. That is, the latency of the execution of these instructions shall not vary with different input values.

Untestable: microarchitectural timing

veccrypto_eeweqsew

For all of the vector crypto instructions in this specification, EEW=SEW.

Zvkned_vaesef_vv_cg/cr_vl_lmul_egs4_sew32, Zvkg_vghsh_vv_cg/cr_vl_lmul_egs4_sew32, Zvknhb64_vsha2ch_vv_cg/cr_vl_lmul_egs4_sew64, Zvksh_vsm3c_vi_cg/cr_vl_lmul_egs8_sew32

veccrypto_vl_vstart_egsconstr

Since vl and vstart refer to elements, Vector Crypto instructions that use elements groups (See crypto-vector-element-groups) require that these values are an integer multiple of the Element Group Size (EGS).

Zvkned_vaesef_vv_cg/cr_vl_lmul_egs4_sew32, Zvksh_vsm3me_vv_cg/cr_vl_lmul_egs8_sew32, TODO: vstart set to a nonzero multiple of EGS

veccrypto_lmul_egwconstr

For element-group instructions, LMUL×VLEN must always be at least as large as EGW, otherwise an illegal-instruction exception is raised, even if vl=0.

TODO: LMUL×VLEN < EGW, even with vl=0, raises an illegal-instruction exception

veccrypto_vsins_vs2

In the case of the *.VS instructions defined in this specification, vs2 holds a 128-bit scalar element group.

Zvkned_vaesef_vs_cg/cp_vs2_edges_egs4, Zvkned_vaesz_vs_cg/cp_vs2_edges_egs4, Zvksed_vsm4r_vs_cg/cp_vs2_edges_egs4

veccrypto_vsins_vd

they return vector results to vd, which is also a source vector operand.

Zvkned_vaesef_vs_cg/{cp_vd_edges_egs4_byte_0, cr_vl_lmul_egs4_sew32}, Zvksed_vsm4r_vs_cg/{cp_vd_edges_egs4_sm_byte_0, cr_vl_lmul_egs4_sew32}

veccrypto_vsins_vs2function

These instructions enable a single key, specified as a scalar element group in vs2, to be applied to each element group of register group vd.

Zvkned_vaesef_vs_cg/cr_vl_lmul_egs4_sew32, Zvkned_vaesdf_vs_cg/cr_vl_lmul_egs4_sew32, Zvkned_vaesz_vs_cg/cr_vl_lmul_egs4_sew32, Zvksed_vsm4r_vs_cg/cr_vl_lmul_egs4_sew32

veccrypto_indepZkt

It is important to note that the Vector Crypto instructions are independent of the implementation of the Zkt extension and do not require that Zkt is implemented.

Definition, checked through UDB

Zvkn_def

Included Extension|Description === Zvkned|extzvkned¶Zvknhb|extzvknhb¶Zvkb|extzvkb¶Zvkt|extzvkt ===

Definition, checked through UDB

Zvknc_def

Included Extension|Description === Zvkn|extzvkn¶Zvbc|extzvbc ===

Definition, checked through UDB

Zvkng_def

Included Extension|Description === Zvkn|extzvkn¶Zvkg|extzvkg ===

Definition, checked through UDB

UDB Parameters: None.

A.13.4. Zvknh{a/b} Vector NIST Hashing

Both Zvknha32 and Zvknhb64 are defined.

Table 147 and Table 148 list the vector hashing instructions for Zvknha and Zvknhb respectively.

Table 147. Zvknha Instruction Coverpoints
Instruction vsha2ms.vv vsha2ch.vv vsha2cl.vv

RV32

x

x

x

RV64

x

x

x

EFFEW32

x

x

x

cp_asm_count

x

x

x

cp_vd

egs4

egs4

egs4

cp_vs2

egs4

egs4

egs4

cp_vs1

egs4

egs4

egs4

cmp_vs1_vs2

egs4

egs4

egs4

cp_vs2_edges

egs4

egs4

egs4

cp_vs1_edges

egs4

egs4

egs4

cp_vd_edges

egs4

egs4

egs4

cr_vs2_vs1_edges

egs4

egs4

egs4

cr_vs2_vd_edges

egs4

egs4

egs4

cr_vs1_vd_edges

egs4

egs4

egs4

cr_vl_lmul

egs4

egs4

egs4

cr_vtype_agnostic

egs4

egs4

egs4

cp_custom

nist_sha

nist_sha

nist_sha

Table 148. Zvknhb Instruction Coverpoints
Instruction vsha2ms.vv vsha2ch.vv vsha2cl.vv

RV32

x

x

x

RV64

x

x

x

EFFEW32

x

x

x

EFFEW64

x

x

x

cp_asm_count

x

x

x

cp_vd

egs4

egs4

egs4

cp_vs2

egs4

egs4

egs4

cp_vs1

egs4

egs4

egs4

cmp_vs1_vs2

egs4

egs4

egs4

cp_vs2_edges

egs4

egs4

egs4

cp_vs1_edges

egs4

egs4

egs4

cp_vd_edges

egs4

egs4

egs4

cr_vs2_vs1_edges

egs4

egs4

egs4

cr_vs2_vd_edges

egs4

egs4

egs4

cr_vs1_vd_edges

egs4

egs4

egs4

cr_vl_lmul

egs4

egs4

egs4

cr_vtype_agnostic

egs4

egs4

egs4

cp_custom

nist_sha

nist_sha

nist_sha

Table 149. Zvknh Normative Rules
Normative Rule Rule Text Coverpoints

Zvknhb_impZvknha

Zvknhb implies Zvknha.

Zvknhb32_vsha2ch_vv_cg/cp_asm_count

Zvknhb_sha512_egw256b_elem64b

SHA-512: these instructions work on 256-bit element groups comprised of four 64-bit elements.

Zvknhb64_vsha2ch_vv_cg/cp_csr_vtype_lmul_egs4_sew64, Zvknhb64_vsha2ch_vv_cg/cr_vl_lmul_egs4_sew64, Zvknhb64_vsha2cl_vv_cg/cr_vl_lmul_egs4_sew64, Zvknhb64_vsha2ms_vv_cg/cr_vl_lmul_egs4_sew64

Zvknhb_sha256_sha512

Zvknhb supports SHA-256 and SHA-512.

Zvknhb32_vsha2ch_vv_cg/cp_asm_count, Zvknhb32_vsha2ms_vv_cg/cp_asm_count, Zvknhb64_vsha2ch_vv_cg/cp_asm_count, Zvknhb64_vsha2ms_vv_cg/cp_asm_count

Zvknha_sha256

Zvknha supports only SHA-256.

Zvknha_vsha2ch_vv_cg/cp_asm_count, Zvknha_vsha2cl_vv_cg/cp_asm_count, Zvknha_vsha2ms_vv_cg/cp_asm_count

Zvknha_Zvknhb_vstart

Likewise, vstart must be a multiple of EGS=4.

TODO: no coverpoint samples vstart for this suite and no ExceptionsZvk-style suite exists to exercise a non-multiple-of-EGS vstart value

vsha2chl-vv_Zvknha_sewn32_rsv

Zvknha: SEW is any value other than 32

Out-of-Scope: reserved because of CSR state (vtype.sew); no suite drives it to a reserved value under Zvknha and there is no Ssstrict-equivalent suite for vector-crypto

vsha2chl-vv_Zvknhb_sewn32or64_rsv

Zvknhb: SEW is any value other than 32 or 64

Out-of-Scope: reserved because of CSR state (vtype.sew); no suite drives it to a reserved value under Zvknhb and there is no Ssstrict-equivalent suite for vector-crypto

vsha2chl-vv_vdoverlapvs1vs2_rsv

The vd register group overlaps with either vs1 or vs2

TODO: this is an SsstrictV-style reserved-encoding test; no cmp_vd_vs1/cmp_vd_vs2-style register-aliasing coverpoint exists for this suite and no SsstrictV-equivalent suite exists for vector crypto

vsha2ms-vv_Zvknha_sewn32_rsv

Zvknha: SEW is any value other than 32

Out-of-Scope: reserved because of CSR state (vtype.sew); no suite drives it to a reserved value under Zvknha and there is no Ssstrict-equivalent suite for vector-crypto

vsha2ms-vv_Zvknhb_sewn32or64_rsv

Zvknhb: SEW is any value other than 32 or 64

Out-of-Scope: reserved because of CSR state (vtype.sew); no suite drives it to a reserved value under Zvknhb and there is no Ssstrict-equivalent suite for vector-crypto

vsha2ms-vv_vdoverlapvs1vs2_rsv

The vd register group overlaps with either vs1 or vs2

TODO: this is an SsstrictV-style reserved-encoding test; no cmp_vd_vs1/cmp_vd_vs2-style register-aliasing coverpoint exists for this suite and no SsstrictV-equivalent suite exists for vector crypto

vsha2ms-vv_op

Eleven of the last 16 SEW-sized message-schedule words from vd (oldest), vs2, and vs1 (most recent) are processed to produce the next 4 message-schedule words.

Zvknha_vsha2ms_vv_cg/cp_vd_egs4, Zvknha_vsha2ms_vv_cg/cr_vs2_vs1_edges_egs4, Zvknha_vsha2ms_vv_cg/cr_vs1_vd_edges_egs4, Zvknha_vsha2ms_vv_cg/cr_vs2_vd_edges_egs4, Zvknhb64_vsha2ms_vv_cg/cr_vs2_vs1_edges_egs4

Zvknhb_Zvkn_Zvknc_Zvkng_Zvksc_depZve64x

The Zvknhb, Zvkn, Zvknc, Zvkng, and Zvksc depend on Zve64x.

Definition, checked through UDB

Zvknha_Zvknhb_sha256_egw128b_elem32b

SHA-256: these instructions work on 128-bit element groups comprised of four 32-bit elements.

Zvknha_vsha2ch_vv_cg/cp_csr_vtype_lmul_egs4_sew32, Zvknha_vsha2ch_vv_cg/cr_vl_lmul_egs4_sew32, Zvknha_vsha2ms_vv_cg/cr_vl_lmul_egs4_sew32, Zvknhb32_vsha2ch_vv_cg/cr_vl_lmul_egs4_sew32, Zvknhb32_vsha2ms_vv_cg/cr_vl_lmul_egs4_sew32

Zvknha_Zvknhb_dataindeptiming

To help avoid side-channel timing attacks, these instructions shall be implemented with data-independent timing.

Untestable: microarchitectural timing

Zvknha_Zvknhb_vl

The number of element groups to be processed is vl/EGS. vl must be set to the number of SEW elements to be processed and therefore must be a multiple of EGS=4.

Zvknha_vsha2ch_vv_cg/cr_vl_lmul_egs4_sew32, Zvknhb32_vsha2ch_vv_cg/cr_vl_lmul_egs4_sew32, Zvknhb64_vsha2ch_vv_cg/cr_vl_lmul_egs4_sew64

vsha2chl-vv_op_sew32

riscv.github.io/riscv-isa-manual/snapshot/spec/index.html#norm%3Avsha2chl-vv_op_sew32

Zvknha_vsha2ch_vv_cg/cr_vs2_vd_edges_egs4, Zvknha_vsha2cl_vv_cg/cr_vs2_vd_edges_egs4, Zvknhb32_vsha2ch_vv_cg/cr_vs2_vd_edges_egs4, Zvknhb32_vsha2cl_vv_cg/cr_vs2_vd_edges_egs4

vsha2chl-vv_op_sew64

riscv.github.io/riscv-isa-manual/snapshot/spec/index.html#norm%3Avsha2chl-vv_op_sew64

Zvknhb64_vsha2ch_vv_cg/{cr_vs2_vd_edges_egs4, cr_vs2_vs1_edges_egs4}, Zvknhb64_vsha2cl_vv_cg/{cr_vs2_vd_edges_egs4, cr_vs2_vs1_edges_egs4}

vsha2chl-vv_op

Two words of vs1 are processed with the 8 words of current state held in vd and vs2 to perform two rounds of hash computation producing four words of the next state.

Zvknha_vsha2ch_vv_cg/cp_vd_egs4, Zvknha_vsha2ch_vv_cg/{cr_vs2_vs1_edges_egs4, cr_vs1_vd_edges_egs4}, Zvknha_vsha2cl_vv_cg/{cr_vs2_vs1_edges_egs4, cr_vs1_vd_edges_egs4}

vsha2ms-vv_op_sew32

riscv.github.io/riscv-isa-manual/snapshot/spec/index.html#norm%3Avsha2ms-vv_op_sew32

Zvknha_vsha2ms_vv_cg/{cr_vs2_vs1_edges_egs4, cr_vs1_vd_edges_egs4}, Zvknhb32_vsha2ms_vv_cg/{cr_vs2_vs1_edges_egs4, cr_vs1_vd_edges_egs4}

vsha2ms-vv_op_sew64

riscv.github.io/riscv-isa-manual/snapshot/spec/index.html#norm%3Avsha2ms-vv_op_sew64

Zvknhb64_vsha2ms_vv_cg/{cr_vs2_vs1_edges_egs4, cr_vs1_vd_edges_egs4, cr_vs2_vd_edges_egs4}

UDB Parameters: None.

A.13.5. Zvksed Vector ShangMi SM4 Block Cipher

Only Zvksed32 is defined.

Table 150. Zvksed Instruction Coverpoints
Instruction vsm4k.vi vsm4r.vv vsm4r.vs

RV32

x

x

x

RV64

x

x

x

EFFEW32

x

x

x

cp_asm_count

x

x

x

cp_vd

egs4

egs4

egs4

cp_vs2

egs4

egs4

egs4

cp_imm_5bit

u

cmp_vd_vs2

egs4

egs4

cp_vs2_edges

egs4_subbytes_sm

egs4

egs4

cp_vd_edges

egs4_subbytes_sm

egs4_subbytes_sm

cr_vs2_vd_edges

egs4_subbytes_sm

egs4_subbytes_sm

cr_vl_lmul

egs4

egs4

egs4

cr_vtype_agnostic

egs4

egs4

egs4

cp_vl_0

egs4

Table 151. Zvksed Normative Rules
Normative Rule Rule Text Coverpoints

Zvksed_egw128b_elem32b

All of these instructions work on 128-bit element groups comprised of four 32-bit elements.

Zvksed_vsm4k_vi_cg/cp_csr_vtype_lmul_egs4_sew32, Zvksed_vsm4k_vi_cg/cr_vl_lmul_egs4_sew32, Zvksed_vsm4r_vv_cg/cr_vl_lmul_egs4_sew32, Zvksed_vsm4r_vs_cg/cr_vl_lmul_egs4_sew32

Zvksed_dataindeptiming

To help avoid side-channel timing attacks, these instructions shall be implemented with data-independent timing.

Untestable: microarchitectural timing

Zvksed_vl

The number of element groups to be processed is vl/EGS. vl must be set to the number of SEW=32 elements to be processed and therefore must be a multiple of EGS=4.

Zvksed_vsm4k_vi_cg/cr_vl_lmul_egs4_sew32, Zvksed_vsm4r_vv_cg/cr_vl_lmul_egs4_sew32, Zvksed_vsm4r_vs_cg/cr_vl_lmul_egs4_sew32

Zvksed_vstart

Likewise, vstart must be a multiple of EGS=4.

TODO: no coverpoint samples vstart for this suite yet; nothing wired in coverpoints/unpriv/Zvksed_coverage.svh

vsm4k-vi_sewn32_rsv

SEW is any value other than 32

Out-of-Scope: reserved because of CSR state (vtype.sew); Zvksed only generates SEW=32 tests and there is no Ssstrict-equivalent suite for vector-crypto

vsm4k-vi_op

Four rounds of the SM4 Key Expansion are performed.

Zvksed_vsm4k_vi_cg/cp_vd_egs4, Zvksed_vsm4k_vi_cg/cp_imm_5bit_u, Zvksed_vsm4k_vi_cg/cp_vs2_edges_egs4_sm_byte_0, Zvksed_vsm4k_vi_cg/cp_vs2_edges_egs4_sm_byte_3, Zvksed_vsm4k_vi_cg/cr_vl_lmul_egs4_sew32

vsm4r_sewn32_rsv

SEW is any value other than 32

Out-of-Scope: reserved because of CSR state (vtype.sew); Zvksed only generates SEW=32 tests and there is no Ssstrict-equivalent suite for vector-crypto

vsm4r-vs_vdoverlapvs2_rsv

Only for the *.VS form: the vd register group overlaps the vs2 register

TODO: this is an SsstrictV-style reserved-encoding test; Zvksed_vsm4r_vs_cg has no vd/vs2 register-aliasing coverpoint and there is no Ssstrict-equivalent suite for vector-crypto

vsm4r_op

Four rounds of SM4 Encryption/Decryption are performed.

Zvksed_vsm4r_vv_cg/cp_vd_egs4, Zvksed_vsm4r_vv_cg/cr_vs2_vd_edges_egs4_subbytes_sm_0, Zvksed_vsm4r_vv_cg/cr_vl_lmul_egs4_sew32, Zvksed_vsm4r_vs_cg/cr_vs2_vd_edges_egs4_subbytes_sm_0, Zvksed_vsm4r_vs_cg/cr_vl_lmul_egs4_sew32

Zvks_def

Included Extension|Description === Zvksed|extzvksed¶Zvksh|extzvksh¶Zvkb|extzvkb¶Zvkt|extzvkt ===

Definition, checked through UDB

Zvksc_def

Included Extension|Description === Zvks|extzvks¶Zvbc|extzvbc ===

Definition, checked through UDB

Zvksg_def

Included Extension|Description === Zvks|extzvks¶Zvkg|extzvkg ===

Definition, checked through UDB

vsm4k-vi_op_sm4k

Four round keys are read in as a 4-element group from vs2. Each of the next four round keys are generated by iteratively XORing the last three round keys with a constant that is indexed by the Round Group Number, performing a byte-wise substitution, and then performing XORs between rotated versions of this value and the corresponding current round key.

Zvksed_vsm4k_vi_cg/{cp_vs2_edges_egs4_sm_byte_0, cp_vs2_edges_egs4_sm_byte_1, cp_vs2_edges_egs4_sm_byte_2, cp_vs2_edges_egs4_sm_byte_3}

vsm4k-vi_op_rnd

The Round group number comes from uimm[2:0]; the bits in uimm[4:3] are ignored. Round group numbers range from 0 to 7 and indicate which group of four round keys are being generated. Round Keys range from 0&#8205;&#8211;&#8205;31. For example, if uimm=1, then round keys 4, 5, 6, and 7 are being generated.

Zvksed_vsm4k_vi_cg/cp_imm_5bit_u

vsm4r_op_sm4encdec

The four words of current state are read as a 4-element group from vd and the round keys are read from either the corresponding 4-element group in vs2 (vector-vector form) or the scalar element group in vs2 (vector-scalar form). The next four words of state are generated by iteratively XORing the last three words of the state with the corresponding round key, performing a byte-wise substitution, and then performing XORs between rotated versions of this value and the corresponding current state.

Zvksed_vsm4r_vv_cg/{cp_vd_edges_egs4_sm_byte_0, cr_vs2_vd_edges_egs4_subbytes_sm_0}, Zvksed_vsm4r_vs_cg/{cp_vd_edges_egs4_sm_byte_0, cr_vs2_vd_edges_egs4_subbytes_sm_0}

UDB Parameters: None.

A.13.6. Zvksh Vector ShangMi SM3 Hashing

Only Zvksh32 is defined.

Table 152. Zvksh Instruction Coverpoints
Instruction vsm3me.vv vsm3c.vi

RV32

x

x

RV64

x

x

EFFEW32

x

x

cp_asm_count

x

x

cp_vd

egs8

egs8

cp_vs2

egs8

egs8

cp_vs1

egs8

cp_imm_5bit

u

cmp_vd_vs1

egs8

cmp_vs1_vs2

egs8

cp_vs2_edges

egs8

egs8

cp_vd_edges

egs8

cp_vs1_edges

egs8

cr_vs2_vs1_edges

egs8

cr_vs2_vd_edges

egs8

cr_vl_lmul

egs8

egs8

cr_vtype_agnostic

egs8

egs8

cp_vl_0

egs8

egs8

Table 153. Zvksh Normative Rules
Normative Rule Rule Text Coverpoints

Zvksh_egw256b_elem32b

All of these instructions work on 256-bit element groups comprised of eight 32-bit elements.

Zvksh_vsm3c_vi_cg/cp_csr_vtype_lmul_egs8_sew32, Zvksh_vsm3c_vi_cg/cr_vl_lmul_egs8_sew32, Zvksh_vsm3me_vv_cg/cr_vl_lmul_egs8_sew32

Zvksh_dataindeptiming

To help avoid side-channel timing attacks, these instructions shall be implemented with data-independent timing.

Untestable: microarchitectural timing

Zvksh_vl

The number of element groups to be processed is vl/EGS. vl must be set to the number of SEW=32 elements to be processed and therefore must be a multiple of EGS=8.

Zvksh_vsm3c_vi_cg/cr_vl_lmul_egs8_sew32, Zvksh_vsm3me_vv_cg/cr_vl_lmul_egs8_sew32

Zvksh_vstart

Likewise, vstart must be a multiple of EGS=8.

TODO: no coverpoint samples vstart for this suite yet; nothing wired in coverpoints/unpriv/Zvksh_coverage.svh

vsm3c-vi_sewn32_rsv

SEW is any value other than 32

Out-of-Scope: reserved because of CSR state (vtype.sew); Zvksh only generates SEW=32 tests and there is no Ssstrict-equivalent suite for vector-crypto

vsm3c-vi_vdoverlapvs2_rsv

The vd register group overlaps with the vs2 register group

TODO: this is an SsstrictV-style reserved-encoding test; Zvksh_vsm3c_vi_cg has no vd/vs2 register-aliasing coverpoint and there is no Ssstrict-equivalent suite for vector-crypto

vsm3c-vi_op

Two rounds of SM3 compression are performed.

Zvksh_vsm3c_vi_cg/cp_vd_egs8, Zvksh_vsm3c_vi_cg/cp_imm_5bit_u, Zvksh_vsm3c_vi_cg/cr_vs2_vd_edges_egs8, Zvksh_vsm3c_vi_cg/cr_vl_lmul_egs8_sew32

vsm3me-vv_sewn32_rsv

SEW is any value other than 32

Out-of-Scope: reserved because of CSR state (vtype.sew); Zvksh only generates SEW=32 tests and there is no Ssstrict-equivalent suite for vector-crypto

vsm3me-vv_vdoverlapvs2_rsv

The vd register group overlaps with the vs2 register group.

TODO: this is an SsstrictV-style reserved-encoding test; Zvksh_vsm3me_vv_cg has no vd/vs2 register-aliasing coverpoint (only vd/vs1 and vs1/vs2) and there is no Ssstrict-equivalent suite for vector-crypto

vsm3me-vv_op

Eight rounds of SM3 message expansion are performed.

Zvksh_vsm3me_vv_cg/cp_vd_egs8, Zvksh_vsm3me_vv_cg/cr_vs2_vs1_edges_egs8, Zvksh_vsm3me_vv_cg/cr_vl_lmul_egs8_sew32

vsm3c-vi_op_sm3

The current state of eight 32-bit words is read in as an element group from vd. Eight 32-bit message words are read in as an element group from vs2, although only four of them are used. All of the 32-bit input words are byte-swapped from big endian to little endian. These inputs are processed somewhat differently based on the round group (as specified in uimm), and the next state is generated as an element group of eight 32-bit words. The next state of eight 32-bit words are generated, swapped from little endian to big endian, and are returned in an eight-element group.

Zvksh_vsm3c_vi_cg/{cp_vd_edges_egs8, cp_vs2_edges_egs8, cr_vs2_vd_edges_egs8, cp_imm_5bit_u}

vsm3c-vi_op_rnd

The round number is provided by the 5-bit uimm unsigned immediate. Legal values are 0&#8205;&#8211;&#8205;31 and indicate which group of two rounds are being performed. For example, if uimm=1, then rounds 2 and 3 are being performed.

Zvksh_vsm3c_vi_cg/cp_imm_5bit_u

vsm3me-vv_op_sm3

The sixteen most recent 32-bit message words are read in as two eight-element groups from vs1 and vs2. Each of these words is swapped from big endian to little endian. The next eight 32-bit message words are generated, swapped from little endian to big endian, and are returned in an eight-element group.

Zvksh_vsm3me_vv_cg/{cp_vs1_edges_egs8, cp_vs2_edges_egs8, cr_vs2_vs1_edges_egs8}

UDB Parameters: None.

A.13.7. Zvkt Constant-Time Vector Instructions

Not tested yet.

A.14. Miscellaneous RV23 Unprivileged Extensions

A.14.1. Zacas Atomic Compare-and-Swap

Table 154 summarizes the coverpoints for the Zacas extension. The rows with Zabha in the ExtraExtensions column, amocas.b and amocas.h, apply only when Zabha is also supported.

Table 154. Zacas Instruction Coverpoints
Instruction amocas.w amocas.d amocas.d amocas.q amocas.h amocas.b

RV32

x

x

x

x

RV64

x

x

x

x

x

ExtraExtensions

Zabha

Zabha

cp_asm_count

x

x

x

x

x

x

cp_rs1

nx0

nx0

nx0

nx0

nx0

nx0

cp_rs2

x

x

pair

pair

x

x

cp_rd

x

x

pair

pair

x

x

cp_rs2_edges

x

x

x

x

x

x

cmp_rs1_rs2

nx0

nx0

nx0_pair

nx0_pair

nx0

nx0

cmp_rd_rs1

nx0

nx0

nx0_pair

nx0_pair

nx0

nx0

cmp_rd_rs2

x

x

pair

pair

x

x

cmp_rd_rs1_rs2

nx0

nx0

nx0_pair

nx0_pair

nx0

nx0

cp_align

word

hword

byte

cmp_rd_rs1_val_eq

x

x

x

x

cmp_rd_rs1_val_lsb

x

x

x

x

cmp_rd_rs1_val_hw

x

x

x

x

cmp_rd_rs1_val_w

x

x

cmp_rd_rs1_pair_partial_val

x

x

cmp_rd_sign_ext

x

cp_custom

amo_aqrl

amo_aqrl

amo_aqrl

amo_aqrl

amo_aqrl

amo_aqrl

Table 155. Zacas Coverpoint Definitions
Coverpoint Bins Definition

Zacas Value Comparison Coverpoints

cmp_rd_rs1_val_eq

2

original rd value and rs1 value are equal/not equal.

cmp_rd_rs1_val_lsb

2

Least significant byte of original rd and rs1 are equal/not equal.

cmp_rd_rs1_val_hw

2

Lowest 16 bits of original rd and rs1 are equal/not equal.

cmp_rd_rs1_val_w

2

Lowest 32 bits of original rd and rs1 are equal/not equal.

cmp_rd_rs1_pair_partial_val

2

For register pairs, original rd and rs1 have matching high or low halves, but not both.

cmp_rd_sign_ext

2

Value loaded into rd by amocas.w is sign-extended from bit 31 or not.

Table 156. Zacas Normative Rules
Normative Rule Rule Text Coverpoints

Zacas_rv32_amocas-w_op

For RV32, AMOCAS.W atomically loads a 32-bit data value from address in rs1, compares the loaded value to the 32-bit value held in rd, and if the comparison is bitwise equal, then stores the 32-bit value held in rs2 to the original address in rs1. The value loaded from memory is placed into register rd.

Zacas_amocas_w_cg/{cp_rs1_nx0, cp_rs2, cp_rd, cmp_rd_rs1_val_eq}

Zacas_rv32_amocas-d_op

For RV32, AMOCAS.D atomically loads 64-bits of a data value from address in rs1, compares the loaded value to a 64-bit value held in a register pair consisting of rd and rd+1, and if the comparison is bitwise equal, then stores the 64-bit value held in the register pair rs2 and rs2+1 to the original address in rs1. The value loaded from memory is placed into the register pair rd and rd+1.

Zacas_amocas_d_cg/{cp_rs2_pair, cp_rd_pair, cmp_rd_rs1_val_eq, cmp_rd_rs1_pair_partial_val}

Zacas_rv32_amocas-d_frst_pair_entry_reg_even

The instruction requires the first register in the pair to be even numbered; encodings with odd numbered registers specified in rs2 and rd are reserved.

Zacas_amocas_d_cg/{cp_rs2_pair, cp_rd_pair}

Zacas_rv32_amocas-d_rs2_frst_reg_x0

When the first register of a source register pair is x0, then both halves of the pair read as zero.

Zacas_amocas_d_cg/cp_rs2_pair

Zacas_rv32_amocas-d_rd_frst_reg_x0

When the first register of a destination register pair is x0, then the entire register result is discarded and neither destination register is written.

Zacas_amocas_d_cg/cp_rd_pair

Zacas_rv64_amocas-w_op

For RV64, AMOCAS.W atomically loads a 32-bit data value from address in rs1, compares the loaded value to the lower 32 bits of the value held in rd, and if the comparison is bitwise equal, then stores the lower 32 bits of the value held in rs2 to the original address in rs1. The 32-bit value loaded from memory is sign-extended and is placed into register rd.

Zacas_amocas_w_cg/{cp_rs2, cp_rd, cmp_rd_rs1_val_eq, cmp_rd_sign_ext}

Zacas_rv64_amocas-d_op

For RV64, AMOCAS.D atomically loads 64-bits of a data value from address in rs1, compares the loaded value to a 64-bit value held in rd, and if the comparison is bitwise equal, then stores the 64-bit value held in rs2 to the original address in rs1. The value loaded from memory is placed into register rd.

Zacas_amocas_d_cg/{cp_rs1_nx0, cp_rs2, cp_rd, cmp_rd_rs1_val_eq}

Zacas_rv64_amocas-q_op

AMOCAS.Q (RV64 only) atomically loads 128-bits of a data value from address in rs1, compares the loaded value to a 128-bit value held in a register pair consisting of rd and rd+1, and if the comparison is bitwise equal, then stores the 128-bit value held in the register pair rs2 and rs2+1 to the original address in rs1. The value loaded from memory is placed into the register pair rd and rd+1.

Zacas_amocas_q_cg/{cp_rs2_pair, cp_rd_pair, cmp_rd_rs1_val_eq, cmp_rd_rs1_pair_partial_val}

Zacas_rv64_amocas-q_frst_pair_entry_reg_even

The instruction requires the first register in the pair to be even numbered; encodings with odd numbered registers specified in rs2 and rd are reserved.

Zacas_amocas_q_cg/{cp_rs2_pair, cp_rd_pair}

Zacas_rv64_amocas-q_rs2_frst_reg_x0

When the first register of a source register pair is x0, then both halves of the pair read as zero.

Zacas_amocas_q_cg/cp_rs2_pair

Zacas_rv64_amocas-q_rd_frst_reg_x0

When the first register of a destination register pair is x0, then the entire register result is discarded and neither destination register is written.

Zacas_amocas_q_cg/cp_rd_pair

Zacas_amocas_rs1_addr_alignment

AMOCAS.W/D/Q requires that the address held in rs1 be naturally aligned to the size of the operand (i.e., 16-byte aligned for quadwords, eight-byte aligned for doublewords, and four-byte aligned for words).

Exceptions_Zaamo_cg/{cp_amo_address_misaligned}

Zacas_amocas_mem_op_success_aq_rl

The memory operation performed by an AMOCAS.W/D/Q, when successful, has acquire semantics if aq bit is 1 and has release semantics if rl bit is 1.

{Zacas_amocas_w_cg, Zacas_amocas_d_cg, Zacas_amocas_q_cg}/cp_custom_aqrl, Ordering OUT-OF-SCOPE for single hart

Zacas_amocas_mem_op_fail_aq_rl

The memory operation performed by an AMOCAS.W/D/Q, when not successful, has acquire semantics if aq bit is 1 but does not have release semantics, regardless of rl.

{Zacas_amocas_w_cg, Zacas_amocas_d_cg, Zacas_amocas_q_cg}/cp_custom_aqrl, Ordering OUT-OF-SCOPE for single hart

Zacas_amocas_w_permission

An AMOCAS.W/D/Q instruction always requires write permissions.

Zabha_amocas-bh_ignore_bits

The AMOCAS.B/H instructions similarly ignore the –1— bits of the original value in rd.

UDB Parameters: None.

A.14.2. Zabha Subword Atomics

Table 157. Zabha Instruction Coverpoints
Instruction amoadd.b amoadd.h amoand.b amoand.h amomax.b amomax.h amomaxu.b amomaxu.h amomin.b amomin.h amominu.b amominu.h

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

cp_asm_count

x

x

x

x

x

x

x

x

x

x

x

x

cp_rs1

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

cp_rs2

x

x

x

x

x

x

x

x

x

x

x

x

cp_rd

x

x

x

x

x

x

x

x

x

x

x

x

cp_rs2_edges

x

x

x

x

x

x

x

x

x

x

x

x

cmp_rs1_rs2

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

cmp_rd_rs1

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

cmp_rd_rs2

x

x

x

x

x

x

x

x

x

x

x

x

cmp_rd_rs1_rs2

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

nx0

cp_align

byte

hword

byte

hword

byte

hword

byte

hword

byte

hword

byte

hword

cp_memval

byte

hword

byte

hword

byte

hword

byte

hword

byte

hword

byte

hword

cp_custom

amo_aqrl

amo_aqrl

amo_aqrl

amo_aqrl

amo_aqrl

amo_aqrl

amo_aqrl

amo_aqrl

amo_aqrl

amo_aqrl

amo_aqrl

amo_aqrl

Instruction amoor.b amoor.h amoswap.b amoswap.h amoxor.b amoxor.h

RV32

x

x

x

x

x

x

RV64

x

x

x

x

x

x

cp_asm_count

x

x

x

x

x

x

cp_rs1

nx0

nx0

nx0

nx0

nx0

nx0

cp_rs2

x

x

x

x

x

x

cp_rd

x

x

x

x

x

x

cp_rs2_edges

x

x

x

x

x

x

cmp_rs1_rs2

nx0

nx0

nx0

nx0

nx0

nx0

cmp_rd_rs1

nx0

nx0

nx0

nx0

nx0

nx0

cmp_rd_rs2

x

x

x

x

x

x

cmp_rd_rs1_rs2

nx0

nx0

nx0

nx0

nx0

nx0

cp_align

byte

hword

byte

hword

byte

hword

cp_memval

byte

hword

byte

hword

byte

hword

cp_custom

amo_aqrl

amo_aqrl

amo_aqrl

amo_aqrl

amo_aqrl

amo_aqrl

Table 158. Zabha Normative Rules
Normative Rule Rule Text Coverpoints

Zabha_rd_sign_extension

Byte and halfword AMOs always sign-extend the value placed in rd, and ignore the –0— bits of the original value in rs2.

{Zabha_amoswap_b_cg, Zabha_amoswap_h_cg}/cp_rs2_edges, Zabha_amoswap_b_cg/cp_memval_byte, Zabha_amoswap_h_cg/cp_memval_hword

Zabha_rs1_align_addr

Similar to the AMOs specified in the Zaamo extension, the Zabha extension mandates that the address contained in the rs1 register must be naturally aligned to the size of the operand.

Zabha_amoswap_b_cg/cp_align_byte, Zabha_amoswap_h_cg/cp_align_hword, Exceptions_Zaamo_cg/cp_amo_address_misaligned

pma_amo_sz_support

For each level of support, naturally aligned AMOs of a given width are supported if the underlying memory region supports reads and writes of that width.

{Zabha_amoadd_b_cg, Zabha_amoadd_h_cg}/cp_asm_count

UDB Parameters: None.

A.14.3. Zimop Maybe-Ops

Should write 0 to rd unless an extension redefines them.

Table 159. Zimop Instruction Coverpoints
Instruction mop.r.0 mop.r.1 mop.r.2 mop.r.3 mop.r.4 mop.r.5 mop.r.6 mop.r.7 mop.r.8 mop.r.9 mop.r.10 mop.r.11

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

cp_asm_count

x

x

x

x

x

x

x

x

x

x

x

x

cp_rd

x

x

x

x

x

x

x

x

x

x

x

x

cp_rs1

x

x

x

x

x

x

x

x

x

x

x

x

cp_rs1_edges

x

x

x

x

x

x

x

x

x

x

x

x

cmp_rd_rs1

x

x

x

x

x

x

x

x

x

x

x

x

Instruction mop.r.12 mop.r.13 mop.r.14 mop.r.15 mop.r.16 mop.r.17 mop.r.18 mop.r.19 mop.r.20 mop.r.21 mop.r.22 mop.r.23

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

cp_asm_count

x

x

x

x

x

x

x

x

x

x

x

x

cp_rd

x

x

x

x

x

x

x

x

x

x

x

x

cp_rs1

x

x

x

x

x

x

x

x

x

x

x

x

cp_rs1_edges

x

x

x

x

x

x

x

x

x

x

x

x

cmp_rd_rs1

x

x

x

x

x

x

x

x

x

x

x

x

Instruction mop.r.24 mop.r.25 mop.r.26 mop.r.27 mop.r.28 mop.r.29 mop.r.30 mop.r.31 mop.rr.0 mop.rr.1 mop.rr.2 mop.rr.3

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

cp_asm_count

x

x

x

x

x

x

x

x

x

x

x

x

cp_rd

x

x

x

x

x

x

x

x

x

x

x

x

cp_rs1

x

x

x

x

x

x

x

x

x

x

x

x

cp_rs2

x

x

x

x

cp_rs1_edges

x

x

x

x

x

x

x

x

x

x

x

x

cp_rs2_edges

x

x

x

x

cmp_rd_rs1

x

x

x

x

x

x

x

x

x

x

x

x

cmp_rs1_rs2

x

x

x

x

cmp_rd_rs2

x

x

x

x

cmp_rd_rs1_rs2

x

x

x

x

Instruction mop.rr.4 mop.rr.5 mop.rr.6 mop.rr.7

RV32

x

x

x

x

RV64

x

x

x

x

cp_asm_count

x

x

x

x

cp_rd

x

x

x

x

cp_rs1

x

x

x

x

cp_rs2

x

x

x

x

cp_rs1_edges

x

x

x

x

cp_rs2_edges

x

x

x

x

cmp_rd_rs1

x

x

x

x

cmp_rs1_rs2

x

x

x

x

cmp_rd_rs2

x

x

x

x

cmp_rd_rs1_rs2

x

x

x

x

Table 160. Zimop Normative Rules
Normative Rule Rule Text Coverpoints

Zimop_mop-r_op

The Zimop extension defines 32 MOP instructions named MOP.R.n, where n is an integer between 0 and 31, inclusive. Unless redefined by another extension, these instructions simply write 0 to x[rd].

{Zimop_mop_r_0_cg, Zimop_mop_r_31_cg}/{cp_rd, cp_rs1_edges}

Zimop_mop-rr_op

The Zimop extension additionally defines 8 MOP instructions named MOP.RR.n, where n is an integer between 0 and 7, inclusive. Unless redefined by another extension, these instructions simply write 0 to x[rd].

{Zimop_mop_rr_0_cg, Zimop_mop_rr_7_cg}/{cp_rd, cp_rs1_edges}

Zimop_mop-r_enc

{Zimop_mop_r_0_cg, Zimop_mop_r_1_cg, Zimop_mop_r_30_cg, Zimop_mop_r_31_cg}/cp_asm_count

Zimop_mop-rr_enc

{Zimop_mop_rr_0_cg, Zimop_mop_rr_1_cg, Zimop_mop_rr_6_cg, Zimop_mop_rr_7_cg}/cp_asm_count

UDB Parameters: None.

A.14.4. Zcmop Compressed Maybe-Ops

Should write 0 to rd unless an extension redefines them.

Table 161. Zcmop Instruction Coverpoints
Instruction c.mop.1 c.mop.3 c.mop.5 c.mop.7 c.mop.9 c.mop.11 c.mop.13 c.mop.15

RV32

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

cp_asm_count

x

x

x

x

x

x

x

x

cp_custom

mop_no_write

mop_no_write

mop_no_write

mop_no_write

mop_no_write

mop_no_write

mop_no_write

mop_no_write

Table 162. Zcmop Normative Rules
Normative Rule Rule Text Coverpoints

Zcmop_op

This section defines the Zcmop extension, which defines eight 16-bit MOP instructions named C.MOP.N, where N is an odd integer between 1 and 15, inclusive.

{Zcmop_c_mop_1_cg, Zcmop_c_mop_3_cg, Zcmop_c_mop_5_cg, Zcmop_c_mop_7_cg}/cp_asm_count

Zcmop_enc

C.MOP.N is encoded in the reserved encoding space corresponding to C.LUI xN, 0, as shown in norm:c-mop_enc.

{Zcmop_c_mop_1_cg, Zcmop_c_mop_3_cg, Zcmop_c_mop_5_cg, Zcmop_c_mop_7_cg}/cp_asm_count

c-mop_enc

Mnemonic|Encoding|Redefinable to read register === C.MOP.1|0110000010000001|x1¶C.MOP.3|0110000110000001|x3¶C.MOP.5|0110001010000001|x5¶C.MOP.7|0110001110000001|x7¶C.MOP.9|0110010010000001|x9¶C.MOP.11|0110010110000001|x11¶C.MOP.13|0110011010000001|x13¶C.MOP.15|0110011110000001|x15 ===

{Zcmop_c_mop_1_cg, Zcmop_c_mop_3_cg, Zcmop_c_mop_5_cg, Zcmop_c_mop_7_cg}/cp_asm_count

Zcmop_instr_write

Unlike the MOPs defined in the Zimop extension, the C.MOP.N instructions are defined to not write any register.

{Zcmop_c_mop_1_cg, Zcmop_c_mop_3_cg, Zcmop_c_mop_5_cg, Zcmop_c_mop_7_cg}/cp_custom_mop_no_write

UDB Parameters: None.

A.15. Miscellaneous Non-RV23 Unprivileged Extensions

A.15.1. Zfinx Float in Integer Regs

Zfinx replaces the F extension with a similar set of instructions that operate on x registers instead of f registers. Zdinx and Zhinx are similar.

A.15.2. Zdinx Double in Integer Regs

A.15.3. Zhinx Half in Integer Regs

A.15.4. Zhinxmin Half Converts in Integer Regs

A.15.5. Q Quad-Precision Floating-Point

A.15.6. ZfhQ Half-Quad Instructions

A.15.7. ZfhminQ Half-Quad Conversion Instructions

ZfhQ Coverpoints

Note that ZfhminQ is the same as ZfhQ

A.15.8. ZfaQ Additional Quad-Precision Floating-Point Instructions

A.15.9. ZfaZfhQ Additional Half-Quad Conversion Instructions

A.15.11. Zcmt Compressed Jump Tables

Table 164. Zcmt Normative Rules
Normative Rule Rule Text Coverpoints

cm-jalt_op

CM.JALT reads an entry from the jump vector table in memory and jumps to the address that was read, linking to ra.

TODO

cm-jt_op

CM.JT reads an entry from the jump vector table in memory and jumps to the address that was read.

TODO

cm-mva01s_op

moves r1s' into a0 and r2s' into a1.

TODO

cm-mva01s_sreg

The encoding uses sreg number specifiers instead of xreg number specifiers to save encoding space.

TODO

cm-mvsa01_op

moves a0 into r1s' and a1 into r2s'. r1s' and r2s' must be different.

TODO

cm-mvsa01_sreg

The encoding uses sreg number specifiers instead of xreg number specifiers to save encoding space.

TODO

cm-pop_op

This instruction pops (loads) the registers in reg_list from stack memory, and then adjusts the stack pointer by stack_adj.

TODO

cm-popret_op

pops (loads) the registers in reg_list from stack memory, adjusts the stack pointer by stack_adj and then returns to ra.

TODO

cm-popretz_op

pops (loads) the registers in reg_list from stack memory, adjusts the stack pointer by stack_adj, moves zero into a0 and then returns to ra.

TODO

cm-push_op

pushes (stores) the registers in reg_list to the memory below the stack pointer, and then creates the stack frame by decrementing the stack pointer by stack_adj, including any additional stack space requested by the value of spimm.

TODO

jvt_base_vm

jvt.⁠BASE is a virtual address, whenever virtual memory is enabled.

TODO

jvt_mode_acc

jvt.⁠MODE is a WARL field, so can only be programmed to modes which are implemented.

TODO

jvt_op

If Zcmt is implemented then jvt must also be implemented, but can contain a read-only value.

TODO

jvt_reg

The jvt register is an XLEN-bit WARL read/write register that holds the jump table configuration, consisting of the jump table base address (BASE) and the jump table mode (MODE).

TODO

Zcmt_endian

Table entries follow the current data endianness. This is different from normal instruction fetch which is always little-endian.

TODO

Zcmt_entry_sz

The base of the table is in the jvt CSR (see csrs-jvt), each table entry is XLEN bits.

TODO

Zcmt_fetch

For a table jump instruction, the table entry that the instruction selects is considered an extension of the instruction itself.

TODO

Zcmt_table

Table jump uses a 256-entry XLEN wide table in instruction memory to contain function addresses. The table must be a minimum of 64-byte aligned.

TODO

Zcmt_trap

If an exception occurs on either instruction fetch, xEPC is set to the PC of the table jump instruction, xCAUSE is set as expected for the type of fault and xTVAL (if not set to zero) contains the fetch address which caused the fault.

TODO

UDB Parameters: None.

A.15.12. Zilsd Load/Store Double

A.15.13. Zclsd Compressed Load/Store Double

A.16. E Base Embedded Extension

Zclsd Coverpoints

The E Base ISA is a variant of I with 16 general purpose registers. This test plan also includes tests restricted to these 16 registers for simple extensions most likely to be implemented on an embedded core.

All unprivileged tests for RV32 and RV64 can have E equivalents. They are distinguished in the tests directory by rv32i, rv64i, rv32e, and rv64e subdirectories. By default, the test generator only creates rv32e/rv64e tests for the following extensions because embedded cores are most likely to implement these extensions. However, embedded tests for more extensions can be generated by editing the E_EXTENSION_TESTS variable in the riscv-arch-test generators/testgen/src/testgen/testgen.py script.

  • E (base ISA)

  • M (multiply/divide)

  • Zmmul (multiply)

  • Zca (compressed)

  • Zcb (more compressed)

  • Zcmp (compressed push/pop)

  • Zcmt (compressed table jumps)

  • Zba (bitmanip address)

  • Zbb (bitmanip basic)

  • Zbs (bitmanip single-bit)

The normative rule specific to the E base ISA is given in Table 165. Each instruction also has normative rules inherited from its extension.

Table 165. E Normative Rules
Normative Rule Rule Text Coverpoints

diff_rv32e_rv32i

RV32E and RV64E use the same instruction-set encoding as RV32I and RV64I respectively, except that only registers x0‍–‍x15 are provided. All encodings specifying the other registers x16‍–‍x31 are reserved.

E_add_cg/{cp_rs1, cp_rs2, cp_rd}, Ssstrict_Sm_instr_cg/cp_upperreg_rs1

UDB Parameters: None.

The E base ISA and other extensions based on it use the same coverpoints as the I base ISA. However, the register coverpoints such as cp_rd, cpr_rs1, cp_rs2, cmp_rd_rs1, etc. only exercise the 16 registers x0 through x15 when E is enabled. (See the get_gpr_reg function in framework/src/act/fcov/coverage/RISCV_instruction_base.svh, which is controlled by the COVER_E symbol).

Privileged tests are written using only x0-x15, so they work for both E and I base ISAs. One exception is that Ssstrict tests using the upper registers, which should be reserved and trap in E.

Appendix B: Privileged Test Plan

Privileged test plan spreadsheets are available. They need to be edited into a more standardized format. Each test plan spreadsheet contains multiple columns for the applicable configurations. For example, Sm applies to any configuration with machine mode, S applies to any configuration with supervisor mode, and the Sm_F tests within Sm apply to any configuration that also has floating-point.

The privileged testplan is organized by major categories of behaviors or extensions in the following sections. Each of these categories has multiple coverage files with suffixes indicating the circumstances to which they apply. For example, InterruptsSm applies to any configuration with Zicsr and M-mode, and InterruptsS applies to any configuration with Zicsr and S-mode. Each test boots to the mode in its suffix and then runs in every supported privilege mode at or below that mode: InterruptsSm exercises M-, S-, U-, VS- and VU-mode, while InterruptsS boots to S-mode and exercises S-, U-, VS- and VU-mode with mideleg left at its boot value, so a delegated interrupt taken in U-mode is checked to arrive in S-mode.

B.1. Priv

The privileged tests exercise CSRs that are mandatory in each privilege mode. They also test mandatory privileged instructions: ecall, ebreak, mret, and sret. The CSR read/write/set/clear instructions themselves are tested in the unprivileged Zicsr tests of Section A.10.2.

wfi is tested in Section B.3 and sfence.vma is tested in Section B.7.

Privileged tests do not test reserved or custom instructions or CSRs because their behavior is UNSPECIFIED. Reserved instructions and CSRs are tested in the Section B.5 Ssstrict tests, where they should throw an Illegal Instruction exception if not implemented.

B.1.1. Sm Machine-Mode CSRs and Instructions

These test CSRs and privileged instructions in machine mode. The Sm suite also contains the Sm_F, Sm_V, and Sm_VF tests of the floating-point and vector CSRs and mstatus.FS/mstatus.VS, which run only when F, Zve32x, or Zve32f is also supported. The Sm_Zicntr group runs when Zicntr is also supported. It reads cycle, time, instret and hpmcounter[31:3] from M-mode under walking mcounteren and scounteren values, and checks instret across retiring instructions, exceptions and interrupts. The Sm_H group runs when H is also supported. It tests the hypervisor CSRs and instructions from M-mode, mret with mstatus.MPV, and the mstatus.TVM tests of HS-mode and VS-mode, whose traps are taken in M-mode because the HS-mode trap handler reads satp and hgatp. The Sm_Zicntr_H tests of the hypervisor counter enables are described with the H suite.

Table 166. Sm Coverpoints
Coverpoint Goal Feature Description Expectation Bins Normative Rule Status Notes

cp_mcsr_access

Access to all M-mode CSRs

csr read, write all 1s, write all 0s, set all 1s, clear all 1s, write back initial value of each register below plus read-only mvendorid, marchid, mimpid, mhartid, mconfigptr

Traps on writes to read-only registers. Otherwise writable bits match reference model.

(14+5) regs * 6 ops

m_mode_first_at_reset
medelegh_sz_acc_enc_xlen32
medeleg_sz_acc
mideleg_sz_acc
medeleg_mideleg_mandatory_s_mode
medeleg_mideleg_warl
medeleg_no_rd1
mideleg_no_rd1
mideleg_rd1_lower_level
medeleg_when_rd0
medeleg_16_rdonly0
mip_sz_acc
mip_mandatory
mie_sz_acc
mie_mandatory
mhpmcounter_mhpmevent_rdonly0
mhpmevent_sz_warl_op
mcounteren_sz
mcounteren_enc_img
mcounteren_flds_mandatory_warl
mcounteren_flds_rdonly0
mcountinhibit_enc_img
mcountinhibit_sz_warl
mscratch_sz_acc
mscratch_enc_img
mepc_sz_acc
mepc_align
mepc_warl
mepc_enc_img
mtval_sz_acc
mtval_rdonly0
mtval_enc_img
mtval_warl
Zicsr_write_ro
Zicsr_warl
m_mode_priv_at_reset
mcause (WLRL), mstatus/h (WPRI), menvcfg/h (WPRI), mseccfg/h (WPRI) could be weird/hard to model

cp_mcsrwalk

Walking 1s and 0s in each writeable M-mode CSR

Set and clear each bit of each writable M-mode CSR to exercise bitfields: mstatus, medeleg, mideleg, mie, mtvec, mcounteren, mscratch, mepc, mcause, mtval, mip, menvcfg, mseccfg. For RV32 also mstatush, medelegh, menvcfgh, mseccfgh, mcountinhibit, mhpmevent31:3.. misa is fussy to model and is tested in cp_misa* instead. Iterations that write a reserved mstatus.MPP, menvcfg.CBIE, or menvcfg/mseccfg.PMM value check the other bits exactly and only check that the field reads back a legal value.

Writable bits match reference model.

14 regs * (64 set + 64 clear)

mip_meip_rdonly
mip_mtip_rdonly
mip_msip_rdonly
mip_mandatory
mip_bits_wr_or_rdonly
mie_bits_wr
mie_bits_rdonly0
mip_msip_mie_msie_maybe_rdonly0
std_mach_intr_impl
mip_sxip_mie_sxie_rdonly0
mip_lcofip_acc
mip_lcofip_mie_lcofie_rdonly0
Zicsr_warl_def

cp_misa_mxl

misa.MXL

Attempt to write all four values to misa.MXL, clear, set.. Read back

matches MXLEN and does not change

7

misa_acc
misa_always_rd
misa_csr_implemented
misa_enc_img
misa_mxl_op_isa
misa_mxl_op_nz
xlen_le_mxlen
misa_mxl_acc
misa_mxl_enc
misa_sz
misa_extensions_reset_maximal
misa_extensions_reset_ref
misa_extensions_rsv_ret_0
misa_i_op
misa_e_op
misa_m_op
misa_s_op
misa_u_op
misa_e_not_i
Zicsr_write_ro
Other MISA bits are unpredictable and thus not tested.

cp_misa_dependencies

Attempt to write I, E = 1. E should read 0 if I reads 1
Attempt to write I, E = 0. One should read 1
Attempt to write F=0, D=1. D should read 0 if F reads 0
Attempt to write F = 1, D = 0, Q = 1. Q should read 0 if D reads 0
Attempt to write S = 1, U = 0. S should read 0 if U = 0
Attempt to write H = 1, S = 0. H should read 0 if S = 0
Attempt to write H = 1, S = 1, U = 0. H should read 0 if U = 0

See tests

7

misa_acc
misa_enc_img
misa_extensions_enc_txt
misa_extensions_enc_tbl
misa_extensions_warl_op
misa_extensions_dependencies
misa_extensions_collective_warl

cp_misa_clear_c

Attempt to clear C when subsequent instruction is not a multiple of 2. C should not change.

C should not change

1

misa_inc_ialign

cp_mepc_ialign32_read
cp_mepc_ialign32_mret

mepc[1] is masked on reads, including mret’s, while IALIGN = 32

Only with Zca and a writable misa.C (MUTABLE_MISA_C). Clear misa.C, write mepc with bit 1 set, execute mret with mstatus.MPP = M, then read mepc; then set misa.C again and read mepc.

While misa.C = 0, mepc reads with bit 1 clear and mret returns to the masked address; after misa.C is set again, mepc reads with bit 1 set. Match reference model.

2

mepc_bit1_dyn_ialign_op

cp_sepc_ialign32_read
cp_sepc_ialign32_sret

sepc[1] is masked on reads, including sret’s, while IALIGN = 32

Only with Zca, S and a writable misa.C (MUTABLE_MISA_C). Clear misa.C in M-mode. Write sepc with bit 1 set and execute sret with sstatus.SPP = S, from M-mode and then from S-mode (entered with T-SBI); write sepc with bit 1 set again and read it, in M-mode and in S-mode. Then set misa.C again in M-mode and read sepc.

While misa.C = 0, sepc reads with bit 1 clear and sret returns to the masked address; after misa.C is set again, sepc reads with bit 1 set. Match reference model.

2 modes * 2

sepc_op_mask_ialign32

cp_csr_insufficient_priv

Debug registers should be inaccessible from M-mode

Read Debug CSRS 7B0-7BF

Illegal Instruction

16

Zicsr_illegal_mode
Zicsr_debug_illegal

cp_csr_ro

Read-only registers should trap when written

Write read-only CSRs (C00-FFF)

Illegal Instruction

1024 CSRs

cycle_instret_hpmcounter_op_rdonly
time_op_rdonly
cycleh_instreth_hpmcounternh_op_rdonly
timeh_op_rdonly
Zicsr_illegal_acc

cp_cntr_access

Access to all 32 counters

csr_read, write nonzero, write 0, set nonzero, clear all for each of for mcycle, minstret, mhpmcounter31…​3. If RV32 is supported, also do mcycleh, minstreth, mhpmcounterh31…​3. Read back value and check if it is within some threshold of the written value (because counters will continue to increment).

Writable bits match reference model.

32 regs * 6 ops

mcycle_op
mcycle_minstret_sz
mcycle_minstret_rst
mcycle_minstret_wr
mcycleh_minstreth_mhpmh_op
minstret_op
mhpmcounter_num
mhpmcounter_warl
mhpmcounter_mandatory
mhpmcounter_mhpmevent_rdonly0
mhpmcounter_sz

cp_mtime_write

Writing memory-mapped MTIME shows up in time CSR

If Zicntr is supported, Write walking 1s and 0s to memory-mapped mtime, read back from time CSR

Time reflects memory-mapped mtime. Difference should be small.

time_op_rdonly
mtime_acc
mtime_enc_img
time_timeh_visibility_mtime
Presently just writing one value

cp_inhibit

mcountinhibit prevents counting

With mcountinhibit[2/0] = {0, 1}, read mcycle and minstret multiple times and check whether they increment.

Count when not inhibited, remain constant when inhibited

2

mcountinhibit_sz_warl
mcountinhibit_clear_op

cp_mcause_write

Legal values can be written to mcause

with interrupt = 1: 0-13
with interrupt = 0: 0-23

writes mcause

81 values

mcause_sz_acc
mcause_mandatory
mcause_enc_img
mcause_exccode_wlrl
Zicsr_wlrl
mcause_exccode_enc_img

cp_mstatus_sd_write

FS/VS/XS combinations can be written and SD is true when any are dirty.

Write 1 and 0 to SD with FS/VS/XS all 0. Write cross-product of all bits of SD/ FS/ VS/XS. 128 bins of writes.

FS =1 iff any of FS/VS/XS are dirty.

2 SD * 4 FS * 4 VS * 4 XS = 128

mstatus_sd_acc
mstatus_sd_summary_op
mstatus_sd_vs_dirty_op
mstatus_sd_rdonly0
mstatus_sd_formula

cp_mprivinst

ecall and ebreak cause traps

Execute ecall and ebreak in machine mode

ecall and breakpoint exceptions

2

ecall_ebreak_epc_value

cp_mret

mret returns and affects status bits

Execute mret in machine mode with cross-product of values written to mstatus.MPP/ MPRV/ MPIE/MIE. Return to machine mode and MIE = 1 after each mret.

2 MPRV * 2 MIPE * 2 MIE = 8

mstatus_xret_op
mstatus_mprv_clr_mret_sret_less_priv
xret_op
xret_enc_img
mret_presence
priv_levels_tbl
Zicsr_implicit_read

cp_sret

sret returns and affects status bits

Execute sret in machine mode with cross-product of mstatus.SPP/MPRV/TSR/SPIE/SIE

Illegal instruction if TSR

2 SPP * 2 MPRV * 2 TSR * 2 SPIE * 2 SIE = 32

mstatus_xret_op
mstatus_mprv_clr_mret_sret_less_priv
sret_presence
xret_in_higher_mode
xret_enc_img

cp_sret_s

If S_SUPPORTED:
Execute sret in supervisor mode with cross-product of all values of sstatus.SPP/SPIE/SIE, mstatus.TSR. Return to supervisor mode after each sret. This differs from cp_sret_s in S that doesn’t turn on mstatus.TSR (which would require illegal instructions not to be delegated in S mode to avoid a sret trap loop).

sstatus_spp
sstatus_spie
sret_ill_inst_exc_rst
mstatus_xret_op
mstatus_mprv_clr_mret_sret_less_priv
mstatus_tsr_op
sepc should be pointing two instructions ahead.

cp_scsr_from_m

If S supported, read/write/set/clear each S-mode CSR: sstatus, sie, stvec, scounteren, senvcfg, sscratch, sepc, stval, sip. stvec is WARL with complex legal values, so only MODE[1], which must read 0, is checked. scause is tested in cp_scause_from_m.

Zicsr_higher_priv
m_access_all_lower_priv_csrs

cp_scause_from_m

If S supported, write scause from M-mode with each Exception Code 0-9, 12, 13 and 15 and read it back. If Ss1p12 or later is supported, also write codes 10, 11, 14 and 16-31; otherwise also write 18 if Zicfilp or Zicfiss is supported and 10 and 20-23 if H is supported.

The Exception Code is WLRL. Ss1p12 and later must hold the values 0-31, so each reads back as written. Ss1p11 need only hold the codes of supported causes, such as software check (18) with Zicfilp or Zicfiss and the H causes (10 and 20-23) with H.

13, plus 1 with Zicfilp or Zicfiss and 5 with H (32 on Ss1p12 or later)

scause_exception_code_sz

cp_satp_from_m

If S is supported, read satp with mstatus.TVM=0/1

shouldn’t trap on either TVM. Value is not predictable.

cp_satp_from_s

If S is supported, read satp with mstatus.TVM=0/1 from S mode

cp_shadow

Check subset

If S_supported:
Write all zeros and all 1s to mstatus, mie, mip. Read back sstatus, sie, sip. Write all 0s and all 1s to sstatus, sie, sip. Read back mstatus/mie/mip.

sstatus_subset_mstatus

cp_shadow_deleg

Delegation affects shadowing

With delegation on and off, write mip/mie, read back sip/sie. Write sip/sie, read back mip/mie

cp_shadow_deleg_walk

With walking 1s in mideleg, mip/mie = 1s, read back sip/sie

Sm does not access unsupported lower privilege mode CSRs because they are reserved if not implemented, and their behavior is UNSPECIFIED.

If F is mutable, zeroing it should also zero D and Q and V. Same with D zeroing Q and V. Zeroing U should zero S.

Writing misa may increase IALIGN, e.g., by disabling the "C" extension. If an instruction that would write misa increases IALIGN, and the subsequent instruction’s address is not IALIGN-bit aligned, the write to misa is suppressed, leaving misa unchanged."

Sm_F tests (Sm_F-NN.S): the floating-point CSRs and mstatus.FS, run when F is also supported.

cp_fcsr_access

Writing to the CSR field
(WARL)

Write 0s and 1s to fcsr, frm, fflags cross with mstatus.FS init/clean/dirty

Zicsr_higher_priv
m_access_all_lower_priv_csrs
mstatus_fs_vs_xs_off_op
mstatus_fs_vs_xs_dirty_op

cp_mstatus_FS_transition

Writing to the CSR field
(WARL)

Each different type of floating-point instruction crossed with four values of FS. Includes integer-result instructions that raise a flag after fflags is cleared (feq.s with a signaling NaN, fcvt.w.s of an inexact value, fcvt.wu.s of an out-of-range value, fcvtmod.w.d of a NaN).

mstatus_fs_op
mstatus_fs_vs_xs_enc
mstatus_fs_acc1
mstatus_sd_summary_op
mstatus_sd_formula
mstatus_fs_vs_xs_off_op
mstatus_fs_vs_xs_dirty_op
mstatus_fs_no_dirty_track
mstatus_fs_vs_xs_update_indep_priv
check FS becomes dirty where appropriate
instructions that set fflags must set FS to dirty even if they write no floating-point register

cp_mstatus_FS_transition_nondeterministic

Writing to the CSR field
(WARL)

Floating-point instructions that need not modify floating-point state (fsw, fmv.x.w, fclass.s, csrr of the FP CSRs, fmvh.x.d) crossed with mstatus.FS = Off and Dirty

Illegal-instruction trap when FS = Off; FS stays Dirty when Dirty. Initial and Clean are omitted because these instructions may dirty FS imprecisely.

mstatus_fs_imprecise

Sm_V tests (Sm_V_vcsr-NN.S, Sm_V_vset-NN.S, Sm_V_vl_walk-NN.S): the vector CSRs, vset{i}vl{i}, vstart and mstatus.VS, run when Zve32x is also supported.

cp_vcsrrswc

Confirm that all vector CSR properties are properly set with regards to read write, clear, and set privileges with the csr instructions

With each of the vector CSRs conduct a read, write, clear, and set operation on the CSR

Will abide by spec’s read and write permissions for each csr

3 csr instructions * 7 CSRs

Zicsr_higher_priv
m_access_all_lower_priv_csrs
vlenb_acc_op
vcsr_vxrm_op
vcsr_vxsat_op
vcsr_vxrm_vxsat_acc
Zve32x_dependent_Zicsr

test written: yes
spec: The vector extension adds 32 vector registers, and seven unprivileged CSRs (vstart, vxsat, vxrm, vcsr, vtype, vl, vlenb) to a base scalar RISC-V ISA.
read-only CSR vlenb
The XLEN-bit-wide read-only vl CSR can only be updated by the vset{i}vl{i} instructions, and the fault-only-first vector load instruction variants.
read-only XLEN-wide vector type CSR, vtype provides the default type used to interpret the contents of the vector register file, and can only be updated by vset{i}vl{i}

cp_vcsrs_walking1s

Confirm that that all writable vector CSRs have the correct bits writeable

With each of the vector CSRs that are writable, write all XLEN 1-hot values to the csr

csrs will be updated based on which bits they support to be writable

4 CSRs * XLEN 1-hot values

mstatus_vs_op
vstart_acc_sz
vxrm_val_sz_acc
vxsat_op_acc_sz

test written: yes
spec: vstart, vxrm, vxsat, vcsr are all writable

cp_mstatus_vs_set_dirty_arithmetic

Confirm that after running an arithmetic vector instruction that mstatus.VS is set to dirty when set to "clean" or "initial"

Run a .vv vector arithmetic instruction with mstatus.VS = {clean, initial}

mstatus.VS is set to dirty

2 mstatus.VS bins

mstatus_vs_sstatus_vs_op
mstatus_fs_vs_xs_update_indep_priv
mstatus_vs_op_initial_clean
vsstatus_vs_mstatus_vs_op_active

test written: yes
spec: When mstatus.VS is set to Initial or Clean, executing any instruction that changes vector state, including the vector CSRs, will change mstatus.VS to Dirty.

cp_mstatus_vs_set_dirty_csr

Confirm that after running a vsetvli instruction that mstatus.VS is set to dirty when set to "clean" or "initial"

Run a vsetvli instruction with mstatus.VS = {clean, initial}

mstatus.VS is set to dirty

2 mstatus.VS bins

mstatus_vs_op
mstatus_vs_op_initial_clean
vsstatus_vs_mstatus_vs_op_active

test written: yes
spec: When mstatus.VS is set to Initial or Clean, executing any instruction that changes vector state, including the vector CSRs, will change mstatus.VS to Dirty.

Analogous to the way in which the floating-point unit is handled, the mstatus.VS field may exist even if misa.V is clear.

feature (coverpoint written): Untestable

cp_mstatus_vs_off_arithmetic

Confirm that when misa.V is 1 and mstatus.VS is off, an arithmetic vector instruction raises an illegal instruction exception

With misa.V = 1 (its reset value), set mstatus.VS = {00} and run a .vv vector instruction

illegal instruction exception

1

mstatus_vs_sstatus_vs_op
mstatus_fs_vs_xs_off_op
mstatus_vs_op_off

test written: yes, confirm sig
spec: Attempts to execute any vector instruction, or to access the vector CSRs, raise an illegal-instruction exception when mstatus.VS is set to Off.

cp_mstatus_vs_off_csr

Confirm that when misa.V is 1 and mstatus.VS is off, an csr vector instruction raises an illegal instruction exception

With misa.V = 1 (its reset value), set mstatus.VS = {00} and run a vsetvli

illegal instruction exception

1

mstatus_fs_vs_xs_off_op

test written: yes, confirm sig
spec: Attempts to execute any vector instruction, or to access the vector CSRs, raise an illegal-instruction exception when mstatus.VS is set to Off.

For implementations with a writable misa.V field, the vsstatus.VS field may exist even if misa.V is clear.

feature (coverpoint written): Untestable

Vset{i}vl{i}

cp_sew_lmul_vset_i_vli

Confirm that all combinations of lmul crossed with sew correctly set the vtype register in accordance with the vill field

Use all vset{i}vli instructions to cross eSEW={8/16/32/64} with mLMUL = {f8/f4/f2/1/2/4/8} rd and uimm can be any nonzero value

vtype.vill becomes 1 and other bits become 0 on illegal combinations, such as sew = 1xx.

2 instructions * 7 lmul bins * 4 sew bins

vtype_sz_acc_op
vtype_vsew_op
vtype_lmul_val
vtype_lmul_fval
vtype_sew_val
vset_op
vtype_vstart_op
vtype_acc

test written: yes
spec: Implementations must consider all bits of the vtype value to determine if the configuration is supported. An unsupported value in any location within the vtype value must result in vill being set. In particular, all XLEN bits of the register vtype argument to the vsetvl instruction must be checked. Implementations cannot ignore fields they do not implement. All bits must be checked to ensure that new code assuming unsupported vector features in vtype traps instead of executing incorrectly on an older implementation…​.The supported element width may vary with LMUL
The use of vtype encodings with LMUL < SEWMIN/ELEN is reserved, but implementations can set vill if they do not support these configurations.

cp_sew_lmul_vsetvl

Confirm that all combinations of lmul crossed with sew correctly set the type register in accordance with the vill field

Use vsetvl to cross rs2.sew= [3’b000:3’b011] with rs2.lmul = [000, 001, 010, 011, 101, 110, 111]. rd and uimm can be any nonzero value. Make sure rs2_val[`XLEN-1:8] = 0
rs2 must be this way to be a legal setting

vtype.vill becomes 1 and other bits become 0 on illegal combinations, such as sew = 1xx.

7 lmul bins * 4 sew bins

vtype_sz_acc_op
vtype_fields_sz
vset_op
vtype_vstart_op
vtype_acc

test written: yes
spec: Implementations must consider all bits of the vtype value to determine if the configuration is supported. An unsupported value in any location within the vtype value must result in vill being set. In particular, all XLEN bits of the register vtype argument to the vsetvl instruction must be checked. Implementations cannot ignore fields they do not implement. All bits must be checked to ensure that new code assuming unsupported vector features in vtype traps instead of executing incorrectly on an older implementation…​.The supported element width may vary with LMUL
The use of vtype encodings with LMUL < SEWMIN/ELEN is reserved, but implementations can set vill if they do not support these configurations.

cp_sew_lmul_vset_i_vli / cp_sew_lmul_vsetvl

Confirm on the supported values of lmul are recognized as legal

Use vsetivli rd, 1, sew={supported}, vlmul={supported(mf8/mf4/mf2/)m1/m2/m4/m8}, tu, mu to attempt to set all values of lmul

Expect vill is set for all values of lmul that aren’t legal, otherwise the correct lmul is set

0

feature (coverpoint written): Covered by coverpoint above
spec: Implementations must support LMUL integer values of 1, 2, 4, and 8…​.Implementations must provide fractional LMUL settings that allow the narrowest supported type to occupy a fraction of a vector register corresponding to the ratio of the narrowest supported type’s width to that of the largest supported type’s width

cp_sew_lmul_vset_i_vli / cp_sew_lmul_vsetvl

Check all values of sew to Confirm only correctly supported values are recognized as legal

Use vsetivli rd, 1, sew={e8/e16/e32/e64}, vlmul={m1}, tu, mu to attempt to set all values of lmul

Expect vill will be set when an attempted unsupported sew values are attempted to be written, otherwise vtype will contain supported sew

0

feature (coverpoint written): Covered by coverpoint above
spec: Implementations must support LMUL integer values of 1, 2, 4, and 8…​.Implementations must provide fractional LMUL settings that allow the narrowest supported type to occupy a fraction of a vector register corresponding to the ratio of the narrowest supported type’s width to that of the largest supported type’s width

cp_vill_vset_i_vli

Check that vset{i}vli instructions properly clear the vill bit when writing a valid vtype configuration

Run vsetvli and vsetivli with eSEW = {8/16/32/64} with mLMUL = {8} and vtype.vill = {1}
we set lmul to 8 to write a non-zero value to the CSR

expect vill bit is cleared and vtype written when sew is legal

2 instructions * 4 sew bins

test written: yes
spec: If the vill bit is set, then any attempt to execute a vector instruction that depends upon vtype will raise an illegal-instruction exception [except]…​.vset{i}vl{i} …​. [does] not depend upon vtype

cp_vill_vsetvl

Check that vsetvl instruction properly clears the vill bit when writing a valid vtype configuration

Run vsetvl with rs2.sew = {8/16/32/64} with rs2.lmul = {8} and vtype.vill = {1} making sure rs2_val[`XLEN-1:8] = 0
we set lmul to 8 to write a non-zero value to the CSR. rs2 must be in this manner to be a legal setting

expect vill bit is cleared and vtype written when sew is legal

4 sew bins

vtype_vill_val
vtype_vill_val_vill
vtype_vill_all_bits

test written: yes
spec: If the vill bit is set, then any attempt to execute a vector instruction that depends upon vtype will raise an illegal-instruction exception [except]…​.vset{i}vl{i} …​. [does] not depend upon vtype

cp_vill_vsetvl_rs2_vill

Check that when attempting to set a valid configuration but with the rs2.vill bit set, and the vtype.vill bit set, that the register remains all zeros besides the vill bit

Run vsetvl with rs2.sew = {8/16/32/64} with vtype.lmul = {8} and vtype.vill = {1} making sure rs2_val[`XLEN-2:8] = 0 and rs2[XLEN-1] = 1
we set lmul to 8 to attempt to write a non-zero value to the CSR. rs2 must be in this manner to be a legal setting.

vtype register remains unchanged

4 sew bins

test written: yes
spec: If the vill bit is set, then any attempt to execute a vector instruction that depends upon vtype will raise an illegal-instruction exception [except]…​.vset{i}vl{i} …​. [does] not depend upon vtype

cp_vsetvl_rs2_vill

Confirm that with vsetvl if rs2 has the vill bit set that it is treated as an unsupported configuration

run a vsetvl with rs2[XLEN-1] = 1, rs2[XLEN-2:8]=0 and rs2.sew = {supported} and rs2.lmul = 1 and vtype.vill = {0}
sew must be supported and rs2[XLEN-2:8] zero to verify the configuration is illegal due to the vill bit being set

vill bit should be set

spec: A vtype value with vill set is treated as an unsupported configuration.

cp_vset_vill

Confirm that writing 1 to vill clears other bits of vtype

Set rs1 nonzero, rs1 = 1 in XLEN-1, 11 in 7:6 (vma/vta). vsetvl rd, rs1, rs2 and vtype.vill = {0}

vtype.vill becomes 1 and other bits become 0

1

feature (coverpoint written): covered by coverpoint above
spec: When the vill bit is set, the other XLEN-1 bits in vtype shall be zero.

cp_vtype_vill_set_vl_0

Confirm that if an unsupported configuration is set, that vl is set to zero

Run vsetvl with rs1 non-zero and rs2 vill bit set and vl =! 0

vl should be set to zero

1

vtype_lmul_fval_rsv
vtype_vstart_op

test written: yes
spec: If the vtype value is not supported by the implementation, then the vill bit is set in vtype, the remaining bits in vtype are set to zero, and the vl register is also set to zero.

cp_vsetvl_i_rd_nx0_rs1_x0

Confirm that when running a vsetvl or vsetvli instruction with rd != x0 and rs1 = x0 that vl is set to vlmax

with vl != vlmax, conduct vsetvl and vsetvli with rd != x0 and rs1 = x0. Cross with sew = {8/16/32/64} and respective supported lmul {supported(f8,f4,f2,)1,2,4,8}
we want vl != vlmax since similar syntax leaves vl unmodified.

vl csr is set to vlmax

2 instructions * 4 sew bins * 7 lmul bins

vl_acc
vsetvl_op
vsetvl_op_rs1_x0_rd_nx0

test written: yes
spec: When rs1=x0 but rd≠x0, the maximum unsigned integer value (~0) is used as the AVL, and the resulting VLMAX is written to vl and also to the x register specified by rd.

cp_vsetvl_i_rd_x0_rs1_x0

Confirm that when running a vsetvl or vsetvli instruction with rd = x0 and rs1 = x0 that vl is unchanged

with vl != 0, conduct vsetvl and vsetvli with rd = x0 and rs1 = x0. sew and lmul must be such that vlmax does not change
vlmax must not change for the instruction to not be reserved.

vl is unchanged

2

vsetvl_op
vsetvl_op_rs1_x0_rd_x0

test written: yes
spec: When rs1=x0 and rd=x0, the instruction operates as if the current vector length in vl is used as the AVL, and the resulting value is written to vl, but not to a destination register. This form can only be used when VLMAX and hence vl is not actually changed by the new SEW/LMUL ratio.

AVL

cp_vsetvl_i_avl_eq_zero

Confirm that vsetvl{i} instructions follow vl requirements when avl is zero

Run vsetvli and vsetvl with rs1 = 0

vl = 0

1

vsetvl_op
vl_val_lead_in
vl_val_list

test written: yes
spec: The vset{i}vl{i} instructions first set VLMAX according to their vtype argument, then set vl obeying the following constraints:
These specific properties follow from the prior rules: vl = 0 if AVL = 0

cp_vsetvl_i_avl_eq_vlmax

Confirm that vsetvl{i} instructions follow avl requirements when equal to vlmax

Run vsetvli and vsetvl with rs1 = vlmax

vl = avl

1

vset_op
vsetvl_op
vl_val_lead_in
vl_val_list

test written: yes
spec: The vset{i}vl{i} instructions first set VLMAX according to their vtype argument, then set vl obeying the following constraints:
vl = AVL if AVL ≤ VLMAX

cp_vsetvl_i_avl_lt_2x_vlmax

Confirm that vsetvl{i} instructions follow avl requirements when greater than vlmax and less than equal to 2*vlmax (if avl is less than 2* vlmax)

Run vsetvli and vsetvl with vlmax < rs1 < 2 *vlmax

ceil(AVL / 2) ≤ vl ≤ VLMAX

1

vsetvl_op
vl_val_lead_in
vl_val_list

test written: yes, is a chance that sig don’t match
spec: The vset{i}vl{i} instructions first set VLMAX according to their vtype argument, then set vl obeying the following constraints:
ceil(AVL / 2) ≤ vl ≤ VLMAX if AVL < (2 * VLMAX)

cp_vsetvl_i_avl_eq_2x_vlmax

Confirm that vsetvl{i} instructions follow avl requirements when greater than 2 * vlmax (when avl is greater than equal to 2 * vlmax)

Run vsetvli and vsetvl with rs1 ≥ 2 *vlmax

vl = VLMAX

1

vsetvl_op

test written: yes
spec: The vset{i}vl{i} instructions first set VLMAX according to their vtype argument, then set vl obeying the following constraints:
vl = VLMAX if AVL ≥ (2 * VLMAX)

cp_vsetvl_i_avl_gt_2x_vlmax

Confirm that vsetvl{i} instructions follow avl requirements when greater than 2 * vlmax (when avl is greater than equal to 2 * vlmax)

Run vsetvli and vsetvl with rs1 ≥ 2 *vlmax

vl = VLMAX

1

vsetvl_op
vl_val_lead_in
vl_val_list

test written: yes
spec: The vset{i}vl{i} instructions first set VLMAX according to their vtype argument, then set vl obeying the following constraints:
vl = VLMAX if AVL ≥ (2 * VLMAX)

cp_vsetivli_avl_edges

Confirm that vsetivli abides by the avl corners

Run vsetivli with all values of imm = {[0:31]} with sew = {all_supported} and lmul = 1

Abides by avl rules depending on

4 sew bins * 32 imm bins

vset_op
vsetivli_op

test written: yes
spec: The vset{i}vl{i} instructions first set VLMAX according to their vtype argument, then set vl obeying the following constraints:

vstart

cp_vstart_out_of_bounds

Confirm that the vstart CSR only has enough writeable bits to hold the largest element index (2^16-1)

conduct a csr write with rs1 = 2^16 on the vstart register

Not defined in spec, either vstart takes the bottom bits or sets to vlmax-1

1

vstart_acc_sz
vstart_sz_writable

test written: yes
spec: The vstart CSR is defined to have only enough writable bits to hold the largest element index (one less than the maximum VLMAX). Try to write a number greater than what is legal

cp_sew_illegal

Cannot set SEW < 8, all set SEW must be powers of 2 (can accomplish this by looping and setting sew of 2x until vill bit is set and then confirm that vill bit is set whenever setting a non power of 2 sew in that range)

feature (coverpoint written): can’t be tested

cp_vl_walking1s_sew_lmul

Confirm that all vl CSR bit fields are correctly set for all combinations of sew and lmul (thus all VLMAX)

Running the vsetvli instruction, cross all sew = {8/16/32/64} lmul = {f8, f4,f2, 1, 2, 4, 8} with rs1 ={XLEN 1-hot values}
This is done by conducting a vsetivli every time followed by a walking one csr write to ensure the target sew and lmul were attempted to be written

vl register will be set in accordance with vlmax

4sew * 7 lmul * XLEN 1-hot values

cp_vlen_illegal

Cannot set VLEN greater than 2^16, can check vl with eew = 8

vsetvli rs1={0, 1, 2, 3, 4, 7, 8, 9, 16, 32, 64…​ 2^16}
corners: (rs1 - 1)

feature (coverpoint written): covered by csr writing tests

The vector extension must have a consistent state at reset. In particular, vtype and vl must have values that can be read and then restored with a single vsetvl instruction. (make sure reset is called)

feature (coverpoint written): untestable

Sm_VF tests (Sm_VF-NN.S): vector floating-point instructions and mstatus.FS, run when Zve32f is also supported.

It should be understood that for most coverpoints that are based on arithmetic instructions, the coverpoints will check to make sure they’re non-trivial, meaning that vl != 0, vstart=0, vill=0, and they do not trap. It may be useful to know that when using vsetvl{i} instructions if rd != x0 and rs1 = x0, vl = vlmax

cp_vectorfp_mstatus_fs_state_affecting_register

Confirm vector floating point instructions set mstatus.FS to dirty when modifying floating point register state

Set mstatus.FS = {initial/clean} and run a fd writing instruction

mstatus.FS is set to dirty

1

mstatus_fs_dirty_V_fp

spec: Any vector floating-point instruction that modifies any floating-point extension state (i.e., floating-point CSRs or f registers) must set mstatus.FS to Dirty.

cp_vectorfp_mstatus_fs_state_affecting_csr

Confirm vector floating point instructions set mstatus.FS to dirty when modifying floating point csr state

Set mstatus.FS = {initial/clean} and run an instruction that would raise a fp flag after clearing the fp flags (vfdiv.vv divide by zero, vfadd.vv inf + -inf, and vmflt.vv with a NaN operand, which writes only a mask register)

mstatus.FS is set to dirty

1

spec: Any vector floating-point instruction that modifies any floating-point extension state (i.e., floating-point CSRs or f registers) must set mstatus.FS to Dirty.

cp_vectorfp_mstatus_fs_state_nonaffecting

Confirm vector floating point instructions properly set mstatus.FS when not modifying floating point state

Set mstatus.FS = {initial/clean} and run a vector fp instruction that does not affect floating point state (chosen situation for coverpoint is a .vv ins where vs1 = vs2 = 0)

mstatus.FS may be set to dirty or not depending on implementation

1

spec: Any vector floating-point instruction that modifies any floating-point extension state (i.e., floating-point CSRs or f registers) must set mstatus.FS to Dirty.

cp_vectorfp_mstatus_fs_off

Confirm that vector floating point instructions (even if they dont modify fp state) raise an illegal instruction exception if mstatus.FS is set to off

Set mstatus.FS = {off} and run a vector fp instruction that does not affect floating point state (chosen situation for coverpoint is a .vv ins where vs1 = vs2 = 0)

illegal instruction exception

1

spec: If the floating-point unit status field mstatus.FS is Off then any attempt to execute a vector floating-point instruction will raise an illegal instruction exception.

Sm_H tests (Sm_H_*-NN.S): the hypervisor CSRs and instructions from M-mode, and the mstatus.TVM tests of HS-mode and VS-mode, whose traps are taken in M-mode because the HS-mode trap handler reads satp and hgatp. They run when H is also supported. The CSR lists are those of the H suite.

Tests executed in M-mode (Sm_H_mcsr_cg)

cp_hcsr_access
cp_hcsr_access_zero
cp_hcsr_access_masked
cp_hcsr_access_ro

All H-extension CSRs are able to read, write, set, and clear

Write all 1s and all 0s, then set all bits, then clear all bits, then read each {Machine/HS/VS} H-Extension CSR.
cp_hcsr_access_zero: mtval2, mtinst, htval, htinst, hgatp, vsatp and (RV32, Priv 1.13) hedelegh need only hold zero, so their readback is checked only after writing 0 and after clearing every bit.
cp_hcsr_access_masked: hstatus and henvcfg (and henvcfgh on RV32) are written only with their checked fields, because the others are WLRL, WARL with reserved encodings, or change the endianness or XLEN.
cp_hcsr_access_ro: hgeip is read-only.
With Priv 1.13, writing all 1s to hedeleg also checks that bits 18 and 19 are writable; without Zca (IALIGN = 32), that bit 0 is writable.

All registers are accessible, and checked fields read back as written. Writes to hgeip raise illegal instruction.

5 * (2 + 14-17 + 9-11)

hedeleg_bits_required
hedeleg_bit0_ialign32
m_access_all_lower_priv_csrs
H_vscsrs_acc_m_hs
mtval2_sz_acc_op
mtval2_val
mtinst_sz_acc_op
mtinst_val
hstatus_sz_acc_op
hedeleg_sz_acc
hideleg_sz_acc
hip_hie_sz_acc
htimedelta_sz_acc_op
hcounteren_sz
hgeie_sz_acc_op
henvcfg_sz_acc_op
htval_sz_acc_op
hvip_sz_op
htinst_sz_acc_op
hgatp_sz_acc_op
hgeip_sz_acc_op
hedelegh_sz_acc_op
htimedeltah_sz_acc_op
henvcfgh_sz_acc_op
vsstatus_sz_acc_op
vsip_vsie_sz_acc_op
vstval_sz_acc_op
vstvec_sz_acc_op
vsscratch_sz_acc_op
vsepc_sz_acc_op
vscause_sz_acc_op
vsatp_sz_acc_op
Zicsr_higher_priv
Zicsr_rw

cp_hcsrwalk
cp_hcsrwalk_masked

Exercise each bit of H-extension CSRs

Set and clear each bit of each {Machine/HS/VS} H-Extension CSR that holds more than zero. hstatus is walked over GVA, SPV, SPVP, HU, VTVM, VTW and VTSR, and henvcfg over FIOM, LPE, SSE, CBIE, CBCFE, CBZE, PMM, ADUE, PBMTE and STCE (cp_hcsrwalk_masked). The CSRs of cp_hcsr_access_zero are not walked, and hgatp and vsatp are walked by cp_atpwalk1/0. vsepc and vstval are not walked, because an invalid address may legally be converted; cp_vsepc_vaddr_* and cp_vstval_vaddr_* write them with valid addresses.

All registers are accessible. Some fields are WARL and will not change.

64*2*(13-16 + 8-10)

H_vscsrs_acc_m_hs

cp_atpwalk1
cp_atpwalk0

hgatp and vsatp hold each PPN, VMID and ASID bit

With MODE = Sv39x4/Sv39 (RV64) or Sv32x4/Sv32 (RV32), write hgatp and vsatp with a walking 1 and a walking 0 through every non-MODE bit. MODE = Bare with nonzero fields is UNSPECIFIED and unsupported MODEs are legalized in an implementation-defined way, so MODE is held at a paged mode.

Each bit reads back as written, except PPN bits at and above the physical address width, which are not checked, VMID and ASID bits above VMIDLEN and ASIDLEN, and hgatp.PPN[1:0], which may be read-only zero.

2 CSRs * (60 (RV64) or 31 (RV32)) each

hgatp_vmid_lsbs
H_vscsrs_acc_m_hs

cp_vsepc_vaddr_walk1
cp_vsepc_vaddr_walk0
cp_vsepc_vaddr_pc
cp_vsepc_vaddr_scratch
cp_vstval_vaddr_walk1
cp_vstval_vaddr_walk0
cp_vstval_vaddr_pc
cp_vstval_vaddr_scratch

vsepc and vstval hold every valid address

csrrw vsepc and vstval with each canonical virtual address with a walking 1 (0s in the msbs) and a walking 0 (1s in the msbs) through bits 0 to VALEN-2 of the largest supported Sv mode, and with two physical addresses, the current pc and the scratch area. Only valid addresses are written, because an invalid address may legally be converted.

Each value reads back as written (vsepc bit 0 reads 0, and bit 1 reads 0 unless 2-byte instruction alignment is allowed).

walk1, walk0: 2 CSRs * (32 (Sv32), 38 (Sv39), 47 (Sv48) or 56 (Sv57)) each
pc, scratch: 2 CSRs * 1 each

cp_replica

Writing to S/VS-mode CSRs doesn’t affect replica

Write different values into S-mode CSRs and their VS-mode replicas (satp and vsatp only when both support Sv39 (RV64) or Sv32 (RV32)). Read back both.

Each CSR should have value written.

9

H_vscsrs_v0

cp_replica_vs

In VS, writing to S-mode CSRs affects replica instead

In M-mode, write different values into S-mode CSRs and their VS-mode replicas (satp and vsatp only when vsatp supports Sv39 (RV64) or Sv32 (RV32)). Switch to VS-mode and write and read back the S CSRs. VS-mode ecalls go to M-mode, so no trap changes the S CSRs. Back in M-mode, read both the S CSRs and the VS replicas. vsatp stays Bare while VS-mode runs; satp holds a paged value.

VS replica should have changed but S CSR does not change.

9

H_vscsrs_sub
H_vscsrs_v1

cp_mtvala

mtval must not be read-only zero

Write 1s to mtval

nonzero

1

H_mtval_nrz

cp_vsepc_ialign32_read
cp_vsepc_ialign32_vs_read
cp_vsepc_ialign32_sret

vsepc[1] is masked on reads, including sret’s in VS-mode, while IALIGN = 32

Only with Zca and a writable misa.C (MUTABLE_MISA_C). Clear misa.C in M-mode. In VS-mode (entered with T-SBI), write sepc (vsepc) with bit 1 set, execute sret with sstatus.SPP = S, then write and read sepc. Write and read vsepc in M-mode and in HS-mode. Then set misa.C again in M-mode and read vsepc.

While misa.C = 0, vsepc reads with bit 1 clear in every mode and sret returns to the masked address; after misa.C is set again, vsepc reads with bit 1 set. Match reference model.

2 modes + 1 + 1

vsepc_sz_acc_op

mstatus.TVM and hstatus.VTVM (Sm_H_tvm_cg)

cp_tvm_hs

TVM traps access to satp and hgatp, but not vsatp; VTVM does not affect HS-mode

With mstatus.TVM = {0/1} cross hstatus.VTVM = {0/1}, in HS-mode read and write satp, hgatp and vsatp

Illegal instruction fault for satp and hgatp if TVM = 1. vsatp accesses never trap. VTVM has no effect.

3 regs * 2 accesses * 2 TVM * 2 VTVM

mstatus_tvm_hs
hgatp_tvm_illegal

cp_tvm_vs

VTVM traps access to satp

With mstatus.TVM = {0/1} cross hstatus.VTVM = {0/1}, in VS-mode read and write satp

Virtual instruction fault if VTVM = 1. TVM does not affect VS-mode.

2 TVM * 2 VTVM * 2 accesses

mstatus_modes
hstatus_vtvm_op
H_virtinst_vs_sfence_sinval_satp_vtvm1

cp_hfence

Basic fence

Execute hfence.vvma, hfence.gvma in {M, HS, VS, U, VU mode} cross with mstatus.TVM = {0,1} and with hstatus.VTVM = {0,1}

Executes in M-mode and HS-mode, except illegal instruction for HFENCE.GVMA in HS-mode with mstatus.TVM = 1. Illegal instruction in U-mode and virtual instruction in VS-mode and VU-mode.

5 modes * 2 instr * 2 TVM * 2 VTVM

mstatus_tvm_hs
hfence-vvma_hfence-gvma_op
hfence-vvma_mode
hfence-gvma_mode
hfence-vvma_tvm
hfence-vvma_hfence-gvma_exceptions
hfence-gvma_op

cp_sfence

Basic fence

Execute sfence.vma in {M, HS, VS, U, VU mode} cross with mstatus.TVM = {0,1} and with hstatus.VTVM = {0,1}

Executes in M-mode, in HS-mode when TVM = 0 and in VS-mode when VTVM = 0. Illegal instruction in HS-mode when TVM = 1 and in U-mode; virtual instruction in VS-mode when VTVM = 1 and in VU-mode.

5 modes * 2 TVM * 2 VTVM

hstatus_vtvm_op
H_virtinst_vs_sfence_sinval_satp_vtvm1

Instructions (Sm_H_inst_cg)

cp_hlv

Basic load

Set up non-identity G and VS-stage page tables (Sv39x4 and Sv39, or Sv32x4 and Sv32). In M-mode: Write a value with the sign bit of every access size set to scratch. hlv.b, hlv.bu, hlv.h, hlv.hu, hlv.w from scratch. For rv64, also test hlv.wu, hlv.d. Random source and destination registers.

Read and sign/zero extend

5 instr (7 on RV64)

hlsv_mode
hlsv_op
hlvx-wu_valid32

cp_hlvx

Basic load

Set up non-identity G and VS-stage page tables. In M-mode: Write a value to scratch. hlvx.hu, hlvx.wu from scratch. Random source and destination registers.

Read and sign/zero extend

2 instr

hlsv_mode
hlsv_op
hlvx-wu_valid32

cp_hsv

Basic store

Set up non-identity G and VS-stage page tables. In M-mode: hsv.b, hsv.h, hsv.w to scratch, and read scratch through its physical address. For rv64, also test hsv.d. Random source and destination registers.

Stores the low bytes of the source register

3 instr (4 on RV64)

hlsv_mode
hlsv_op
hlvx-wu_valid32

cp_guest_page_fault

hlv and hsv guest-page faults record mtval2 and mtinst

In M-mode with an empty G-stage root table, hlv.w and hsv.w with vsatp = Bare (a fault on the final translation) and with the VS-stage root table at an unmapped guest physical address (a fault on an implicit VS-stage access).

Load or store guest-page fault into M-mode. mtval2 holds zero or the guest physical address >> 2. mtinst holds zero or the transformed instruction on the final translation, and the pseudoinstruction on the implicit access when mtval2 is nonzero.

2 instr * 2 vsatp

mtval2_sz_acc_op
mtinst_sz_acc_op
H_guest_page_fault
H_trap_xtinst
H_trap_xtinst_exception_lead_in
H_trap_xtinst_exception_list
H_trap_xtinst_val
H_trap_xtinst_guestpage

cp_mret_m

mret uses MPV

Execute mret in machine mode with cross-product of mstatus.MPP = {M, S, U} / MPV / MPIE. In a lower mode, a read of mscratch traps and the trap record shows the mode reached. Then record mstatus (and mstatush on RV32).

Goes to appropriate mode. With MPP = M, mret stays in M-mode with V = 0. mret clears MPV.

3 MPP * 2 MPV * 2 MPIE

mstatus_mpv_op
mret_H

cp_sret_m

sret from M mode

Execute sret in machine mode with cross-product of mstatus.SPP / hstatus.SPV / SPIE. After the sret, a read of mscratch traps and the trap record shows the mode reached. Then check mstatus.SPP, SIE, SPIE and hstatus.SPV.

Goes to appropriate mode

2 SPP * 2 SPV * 2 SPIE

sret_H
sret_v0
hstatus_spv_sret

Not tested

misa.H enables the hypervisor extension

With MUTABLE_MISA_H, clear misa.H, check that hypervisor CSRs and instructions raise illegal instruction, and set it again.

misa_H_op

Not tested

Blocked on the reference model: Sail’s writable_misa makes every misa bit writable, and no sail.json of a config with MUTABLE_MISA_H enables it.

Ssdbltrp requires mtval2

mtval2_Ssdbltrp

Not tested

An implementation requirement; with H, cp_hcsr_access_zero accesses mtval2. A hart with Ssdbltrp and without H belongs to an Ssdbltrp suite.

TODO: Plan how to check WARL, WPRI, WLRL fields. It seems every CSR needs parameters, either to tell the reference model how they should behave (to generate expected values), or to tell the tests and coverpoints which values are legal to test.

Table 167. Sm Normative Rules
Normative Rule Rule Text Coverpoints

m_highest_priv_mode

machine-mode (M-mode), which is the highest privilege mode in a RISC-V hart.

Implicit

m_mode_first_at_reset

M-mode is used for low-level access to a hardware platform and is the first mode entered at reset.

Sm_mcsr_cg/cp_mcsr_access

m_access_all_lower_priv_csrs

M-mode code can access all CSRs at lower privilege levels.

Sm_mcsr_cg/cp_scsr_from_m, Sm_F_cg/cp_fcsr_access, Sm_V_cg/cp_vcsrrswc, Sm_H_mcsr_cg/cp_hcsr_access

misa_acc

The misa CSR is a WARL read-write register

Sm_mcsr_cg/{cp_misa_mxl, cp_misa_dependencies}

misa_always_rd

This register must be readable in any implementation

Sm_mcsr_cg/cp_misa_mxl

misa_csr_implemented

a value of zero can be returned to indicate this feature has not been implemented

Sm_mcsr_cg/cp_misa_mxl

misa_enc_img

Sm_mcsr_cg/{cp_misa_mxl, cp_misa_dependencies}

misa_mxl_op_isa

The MXL (Machine XLEN) field encodes the native base integer ISA width as shown in norm:misa_mxl_enc.

Sm_mcsr_cg/cp_misa_mxl

misa_mxl_op_nz

If misa is nonzero, the MXL field indicates the effective XLEN in M-mode, a constant termed MXLEN.

Sm_mcsr_cg/cp_misa_mxl

xlen_le_mxlen

XLEN is never greater than MXLEN, but XLEN might be smaller than MXLEN in less-privileged modes.

Sm_mcsr_cg/cp_misa_mxl

misa_mxl_acc

The MXL field is read-only.

Sm_mcsr_cg/cp_misa_mxl

misa_mxl_enc

MXL|XLEN === 1|32¶2|64¶3|Reserved ===

Sm_mcsr_cg/cp_misa_mxl

misa_sz

The misa CSR is MXLEN bits wide.

Sm_mcsr_cg/cp_misa_mxl

misa_extensions_enc_txt

The Extensions field encodes the presence of the standard extensions, with a single bit per letter of the alphabet (bit 0 encodes presence of extension A, bit 1 encodes presence of extension B, through to bit 25 which encodes Z).

Sm_mcsr_cg/{cp_misa_dependencies, cp_misa_b, cp_misa_v}

misa_extensions_enc_tbl

Bit|Character|Description === 0|`A`|Atomic extension¶1|`B`|B extension¶2|`C`|Compressed extension¶3|`D`|Double-precision floating-point extension¶4|`E`|RV32E/64E base ISA¶5|`F`|Single-precision floating-point extension¶6|`G`|Reserved¶7|`H`|Hypervisor extension¶8|`I`|RV32I/64I base ISA¶9|`J`|Reserved¶10|`K`|Reserved¶11|`L`|Reserved¶12|`M`|Integer Multiply/Divide extension¶13|`N`|Tentatively reserved for User-Level Interrupts extension¶14|`O`|Reserved¶15|`P`|Tentatively reserved for Packed-SIMD extension¶16|`Q`|Quad-precision floating-point extension¶17|`R`|Reserved¶18|`S`|Supervisor mode implemented¶19|`T`|Reserved¶20|`U`|User mode implemented¶21|`V`|Vector extension¶22|`W`|Reserved¶23|`X`|Non-standard extensions implemented¶24|`Y`|Reserved¶25|`Z`|Reserved ===

Sm_mcsr_cg/{cp_misa_dependencies, cp_misa_b, cp_misa_v}

misa_extensions_warl_op

The Extensions field is a WARL field that can contain writable bits where the implementation allows the supported ISA to be modified.

Sm_mcsr_cg/{cp_misa_dependencies, cp_misa_b, cp_misa_v}

misa_extensions_reset_maximal

At reset, the Extensions field shall contain the maximal set of supported extensions, and I shall be selected over E if both are available.

Sm_mcsr_cg/cp_misa_mxl

misa_extensions_reset_ref

The misa register is reset to enable the maximal set of supported extensions, as described in misa.

Sm_mcsr_cg/cp_misa_mxl

misa_extensions_disabling

When a standard extension is disabled by clearing its bit in misa, the instructions and CSRs defined or modified by the extension revert to their defined or reserved behaviors as if the extension is not implemented.

Out of scope; also untestable without Ssstrict because reserved instructions behavior is UNSPECIFIED

misa_extensions_rsv_ret_0

All bits that are reserved for future use must return zero when read.

Sm_mcsr_cg/cp_misa_mxl

misa_i_op

The I bit will be set for the RV32I and RV64I base ISAs

Sm_mcsr_cg/cp_misa_mxl

misa_e_op

the E bit will be set for RV32E and RV64E.

Sm_mcsr_cg/cp_misa_mxl

misa_x_op

The X bit will be set if there are any non-standard extensions.

Non-standard extensions are not certified

misa_B_op

When the B bit is 1, the implementation supports the instructions provided by the Zba, Zbb, and Zbs extensions.

Sm_mcsr_cg/cp_misa_b

misa_m_op

When the M bit is 1, the implementation supports all multiply and division instructions defined by the M extension.

Sm_mcsr_cg/cp_misa_mxl

misa_s_op

When the S bit is 1, the implementation supports supervisor mode.

Sm_mcsr_cg/cp_misa_mxl

misa_u_op

When the U bit is 1, the implementation supports user mode.

Sm_mcsr_cg/cp_misa_mxl

misa_e_not_i

Unless misa is all read-only zero, the E bit always reads as the complement of the I bit.

Sm_mcsr_cg/cp_misa_mxl

Zmmul_misa_m

if the Zmmul extension is supported then the multiply instructions it specifies are supported irrespective of the value of the M bit.

TODO: execute Zmmul multiply instructions with misa.M cleared

misa_e_acc

The E bit is read-only.

TODO: write misa.E and check that it does not change

misa_extensions_dependencies

If an ISA feature x depends on an ISA feature y, then attempting to enable feature x but disable feature y results in both features being disabled.

Sm_mcsr_cg/cp_misa_dependencies

misa_extensions_collective_warl

An implementation may impose additional constraints on the collective setting of two or more misa fields, in which case they function collectively as a single WARL field. An attempt to write an unsupported combination causes those bits to be set to some supported combination.

Sm_mcsr_cg/cp_misa_dependencies

misa_inc_ialign

Writing misa may increase IALIGN, e.g., by disabling the C extension. If an instruction that would write misa increases IALIGN, and the subsequent instruction’s address is not IALIGN-bit aligned, the write to misa is suppressed, leaving misa unchanged.

Sm_mcsr_cg/cp_misa_clear_c

misa_extensions_reenable_unspec

When software enables an extension that was previously disabled, then all state uniquely associated with that extension is UNSPECIFIED, unless otherwise specified by that extension.

Behavior is UNSPECIFIED by the specification; not tested

mvendorid_sz_acc_op

The mvendorid CSR is a 32-bit read-only register providing the JEDEC manufacturer ID of the provider of the core.

Sm_mcsr_cg/cp_mcsr_access_ro/mvendorid

mvendorid_always_rd

This register must be readable in any implementation, but a value of 0 can be returned to indicate the field is not implemented or that this is a non-commercial implementation.

Sm_mcsr_cg/cp_mcsr_access_ro/mvendorid

mvendorid_enc

JEDEC manufacturer IDs are ordinarily encoded as a sequence of one-byte continuation codes 0x7f, terminated by a one-byte ID not equal to 0x7f, with an odd parity bit in the most-significant bit of each byte. mvendorid encodes the number of one-byte continuation codes in the Bank field, and encodes the final byte in the Offset field, discarding the parity bit.

Sm_mcsr_cg/cp_mcsr_access_ro/mvendorid

marchid_sz_acc_op

The marchid CSR is an MXLEN-bit read-only register encoding the base microarchitecture of the hart.

Sm_mcsr_cg/cp_mcsr_access_ro/marchid

marchid_always_rd

This register must be readable in any implementation, but a value of 0 can be returned to indicate the field is not implemented.

Sm_mcsr_cg/cp_mcsr_access_ro/marchid

mimpid_op

The mimpid CSR provides a unique encoding of the version of the processor implementation.

Sm_mcsr_cg/cp_mcsr_access_ro/mimpid

mimpid_always_rd

This register must be readable in any implementation, but a value of 0 can be returned to indicate that the field is not implemented.

Sm_mcsr_cg/cp_mcsr_access_ro/mimpid

mhartid_sz_acc_op

The mhartid CSR is an MXLEN-bit read-only register containing the integer ID of the hardware thread running the code.

Sm_mcsr_cg/cp_mcsr_access_ro/mhartid

mhartid_always_rd

This register must be readable in any implementation.

Sm_mcsr_cg/cp_mcsr_access_ro/mhartid

mhartid_one_is_zero

one hart must have a hart ID of zero.

Sm_mcsr_cg/cp_mcsr_access_ro/mhartid

mhartid_unique

Hart IDs must be unique within the execution environment.

Sm_mcsr_cg/cp_mcsr_access_ro/mhartid

mstatus_sz_acc

The mstatus register is an MXLEN-bit read/write register formatted as shown in mstatusreg-rv32 for RV32 and mstatusreg for RV64. mstatus must be implemented.

Sm_mcsr_cg/cp_mcsr_access_masked/mstatus

mstatush_sz_acc

For RV32 only, mstatush is a 32-bit read/write register formatted as shown in mstatushreg.

Sm_mcsr_cg/cp_mcsr_access_masked/mstatush

mstatus_xret_op

When executing an xRET instruction, supposing xPP holds the value y, xIE is set to xPIE; the privilege mode is changed to y; xPIE is set to 1; and xPP is set to the least-privileged supported mode (U if U-mode is implemented, else M). If y≠M, xRET also sets MPRV=0.

Sm_mprivinst_cg/{cp_mret, cp_sret, cp_sret_s}, S_sprivinst_cg/cp_sret_s

mstatush_enc

Bits 30:4 of mstatush generally contain the same fields found in bits 62:36 of mstatus for RV64. Fields SD, SXL, and UXL do not exist in mstatush.

Sm_mcsr_cg/cp_mcsr_access_masked/mstatush

mstatus_sie_spie_rdonly0

MIE and MPIE must be writable. If supervisor mode is not implemented, then SIE and SPIE are read-only 0; otherwise, they must be writable.

Sm_mcsr_cg/cp_mcsr_access_masked/mstatush

mstatus_xpp_enc

The xPP fields can only hold privilege modes up to x

Sm_mcsr_cg/cp_mcsr_access_masked/mstatus

mstatus_mpp_sz

MPP is two bits wide

Sm_mcsr_cg/cp_mcsr_access_masked/mstatus

mstatus_xpp_warl

xPP fields are WARL fields that can hold only privilege mode x and any implemented privilege mode lower than x.

Sm_mcsr_cg/{cp_mcsr_access_masked,cp_mcsrwalk_masked}/mstatus

mstatus_xpp_rdonly0

If privilege mode x is not implemented, then xPP must be read-only 0.

Sm_mcsr_cg/cp_mcsr_access_masked/mstatus

mstatus_spp_sz

SPP is one bit wide.

Sm_mcsr_cg/cp_mcsr_access_masked/mstatus

mstatus_mdt_sz_warl

The M-mode-disable-trap (MDT) bit is a WARL field introduced by the Smdbltrp extension.

Sm_mcsr_cg/cp_mcsr_access_masked/mstatus, Sm_mcsr_cg/cp_mcsrwalk_masked/mstatus

mstatus_sxl_uxl_warl_op

For RV64 harts, the SXL and UXL fields are WARL fields that control the value of XLEN for S-mode and U-mode, respectively.

Sm_mcsr_cg/cp_mcsr_access_masked/mstatus

mstatus_sxl_uxl_enc

The encoding of these fields is the same as the MXL field of misa, shown in norm:misa_mxl_enc.

Out of scope

mstatus_sxl_uxl_sxlen_uxlen_mxlen32

When MXLEN=32, the SXL and UXL fields do not exist, and SXLEN=32 and UXLEN=32.

Sm_mcsr_cg/cp_mcsr_access_masked/mstatus

mstatus_sxl_acc_mxlen64

When MXLEN=64, if S-mode is not supported, then SXL is read-only zero. Otherwise, it is a WARL field that encodes the current value of SXLEN.

Sm_mcsr_cg/cp_mcsr_access_masked/mstatus

mstatus_sxl_rdonly_mxlen64

an implementation may make SXL be a read-only field whose value always ensures that SXLEN=MXLEN.

Sm_mcsr_cg/cp_mcsr_access_masked/mstatus

mstatus_uxl_acc_mxlen64

When MXLEN=64, if U-mode is not supported, then UXL is read-only zero. Otherwise, it is a WARL field that encodes the current value of UXLEN.

Sm_mcsr_cg/cp_mcsr_access_masked/mstatus

mstatus_uxl_rdonly_mxlen64

an implementation may make UXL be a read-only field whose value always ensures that UXLEN=MXLEN or UXLEN=SXLEN.

Sm_mcsr_cg/cp_mcsr_access_masked/mstatus

mstatus_uxl_legal_vals_smode

If S-mode is implemented, the set of legal values that the UXL field may assume excludes those that would cause UXLEN to be greater than SXLEN.

Sm_mcsr_cg/cp_mcsr_access_masked/mstatus

mstatus_mprv_ldst_op

When MPRV=0, explicit memory accesses behave as normal, using the translation and protection mechanisms of the current privilege mode. When MPRV=1, load and store memory addresses are translated and protected, and endianness is applied, as though the current privilege mode were set to MPP.

Sv_Sm_mstatus_mprv_cg/{cp_mprv_load, cp_mprv_store}, PMP_S_cg/cp_mprv_lw, PMP_U_cg/cp_mprv_sw

mstatus_mprv_inst_xlat_op

Instruction address-translation and protection are unaffected by the setting of MPRV.

Sv_Sm_mstatus_mprv_cg/{cp_mprv_ins, cp_mprv_upage_smode_sumset_exec}, PMP_S_cg/cp_mprv_jalr, PMP_U_cg/cp_mprv_jalr

mstatus_mprv_rdonly0_no_umode

MPRV is read-only 0 if U-mode is not supported; otherwise, it must be writable.

Sm_mcsr_cg/cp_mcsr_access_masked/mstatus

mstatus_mprv_clr_mret_sret_less_priv

An MRET or SRET instruction that changes the privilege mode to a mode less privileged than M also sets MPRV=0.

Sm_mprivinst_cg/{cp_mret, cp_sret, cp_sret_s}, S_sprivinst_cg/cp_sret_s

xret_op

In addition to manipulating the privilege stack as described in privstack, xRET sets the pc to the value stored in the xepc register.

Sm_mprivinst_cg/cp_mret

sret_presence

SRET must be provided if supervisor mode is supported, and should raise an illegal-instruction exception otherwise.

Sm_mprivinst_cg/cp_sret

sret_ill_inst_exc_rst

SRET should also raise an illegal-instruction exception when TSR=1 in mstatus, as described in virt-control.

TODO

xret_in_higher_mode

An xRET instruction can be executed in privilege mode x or higher, where executing a lower-privilege xRET instruction will pop the relevant lower-privilege interrupt enable and privilege mode stack.

Sm_mprivinst_cg/cp_sret

mstatus_mxr_op

When MXR=0, only loads from pages marked readable (R=1 in sv32pte) will succeed. When MXR=1, loads from pages marked either readable or executable (R=1 or X=1) will succeed. MXR only affects loads whose effective privilege mode is less than M.

Sv_vm_permissions_cg/{cp_xpage_mxrunset_read_s, cp_xpage_mxrunset_read_u}, Sv_vm_permissions_cg/{cp_xpage_mxrset_read_s, cp_xpage_mxrset_read_u}

mstatus_mxr_rdonly0_no_smode

MXR is read-only 0 if S-mode is not supported or if satp.⁠MODE is read-only 0; otherwise, it must be writable.

Sm_mcsr_cg/cp_mcsr_access_masked/mstatus

mstatus_sum_op

When SUM=0, S-mode memory accesses to pages that are accessible by U-mode (U=1 in sv32pte) will fault. When SUM=1, these accesses are permitted.

Sv_vm_permissions_cg/{cp_upage_smode_sumunset_noread_s, cp_upage_smode_sumunset_nowrite_s}, Sv_vm_permissions_cg/{cp_upage_smode_sumset_read_s, cp_upage_smode_sumset_write_s}

mstatus_sum_op_no_vm

SUM has no effect when page-based virtual memory is not in effect.

TODO

mstatus_sum_op_mprv_mpp

while SUM is ordinarily ignored when not executing in S-mode, it is in effect when MPRV=1 and MPP=S.

Sv_Sm_mstatus_mprv_cg/{cp_mprv_upage_smode_sumunset_noread, cp_mprv_upage_smode_sumunset_nowrite}, Sv_Sm_mstatus_mprv_cg/{cp_mprv_upage_smode_sumset_read, cp_mprv_upage_smode_sumset_write}

mstatus_sum_rdonly0

SUM is read-only 0 if S-mode is not supported or if satp.⁠MODE is read-only 0; otherwise, it must be writable.

Sm_mcsr_cg/cp_mcsr_access_masked/mstatus

mstatus_mxr_sum_op_acc_fault

The MXR and SUM mechanisms only affect the interpretation of permissions encoded in page-table entries. In particular, they have no impact on whether access-fault exceptions are raised due to PMAs or PMP.

mstatus_mstatush_xbe_warl

The MBE, SBE, and UBE bits in mstatus and mstatush are WARL fields that control the endianness of memory accesses other than instruction fetches. Each may be read/write or read-only.

Sm_mcsr_cg/cp_mcsr_access_masked/mstatus, Sm_mcsr_cg/cp_mcsr_access_masked/mstatush

mstatus_tvm_warl

The TVM (Trap Virtual Memory) bit is a WARL field that supports intercepting supervisor virtual-memory management operations.

Sm_mcsr_cg/cp_mcsr_access_masked/mstatus

mstatus_tvm_op

When TVM=1, attempts to read or write the satp CSR or execute an SFENCE.VMA or SINVAL.VMA instruction while executing in S-mode will raise an illegal-instruction exception. When TVM=0, these operations are permitted in S-mode.

Sv_Sm_mstatus_mprv_cg/cp_tvm_exception_s, Svinval_cg/cp_svinval

mstatus_tvm_acc

TVM is read-only 0 when S-mode is not supported or if satp.⁠MODE is read-only 0; otherwise, it must be writable.

Sm_mcsr_cg/cp_mcsr_access_masked/mstatus, Sm_mcsr_cg/cp_mcsrwalk_masked/mstatus

mstatus_tw_acc

TW is read-only 0 when there are no modes less privileged than M; otherwise, it must be writable.

Sm_mcsr_cg/cp_mcsr_access_masked/mstatus

mstatus_tsr_warl

The TSR (Trap SRET) bit is a WARL field that supports intercepting the supervisor exception return instruction, SRET.

Sm_mcsr_cg/cp_mcsr_access_masked/mstatus

mstatus_tsr_op

When TSR=1, attempts to execute SRET while executing in S-mode will raise an illegal-instruction exception. When TSR=0, this operation is permitted in S-mode.

Sm_mprivinst_cg/cp_sret_s

mstatus_tsr_acc

TSR is read-only 0 when S-mode is not supported; otherwise, it must be writable.

Sm_mcsr_cg/cp_mcsr_access_masked/mstatus

mstatus_fs_vs_warl

The FS[1:0] and VS[1:0] WARL fields and the XS[1:0] read-only field are used to reduce the cost of context save and restore by setting and tracking the current state of the floating-point unit and any other user-mode extensions respectively.

Sm_mcsr_cg/cp_mcsr_access_masked/mstatus, Sm_mcsr_cg/cp_mcsrwalk_masked/mstatus

mstatus_fs_op

The FS field encodes the status of the floating-point unit state, including the floating-point registers f0&#8205;&#8211;&#8205;f31 and the CSRs fcsr, frm, and fflags.

Sm_F_cg/cp_mstatus_FS_transition, U_F_cg/cp_mstatus_FS_transition, S_F_cg/cp_sstatus_FS_transition, H_F_cg/cp_vsstatus_FS_transition

mstatus_vs_op

The VS field encodes the status of the vector extension state, including the vector registers v0&#8205;&#8211;&#8205;v31 and the CSRs vcsr, vxrm, vxsat, vstart, vl, vtype, and vlenb.

Sm_V_cg/{cp_mstatus_vs_set_dirty_vcsr, cp_mstatus_vs_set_dirty_csr}, U_V_cg/{cp_mstatus_vs_set_dirty_vcsr, cp_mstatus_vs_set_dirty_csr}, S_V_cg/{cp_sstatus_vs_set_dirty_vcsr, cp_sstatus_vs_set_dirty_csr}, H_V_cg/{cp_vsstatus_vs_set_dirty_vcsr, cp_vsstatus_vs_set_dirty_csr}

mstatus_vs_sstatus_vs_op

A vector context status field, VS, is added to mstatus[10:9] and shadowed in sstatus[10:9]. It is defined analogously to the floating-point context status field, FS.

Sm_V_cg/{cp_mstatus_vs_set_dirty_arithmetic, cp_mstatus_vs_off_arithmetic}, U_V_cg/{cp_mstatus_vs_set_dirty_arithmetic, cp_mstatus_vs_off_arithmetic}, S_V_cg/{cp_sstatus_vs_set_dirty_arithmetic, cp_sstatus_vs_off_arithmetic}, H_V_cg/{cp_vsstatus_vs_set_dirty_arithmetic, cp_vsstatus_vs_off_arithmetic}

mstatus_xs_encodes_op

The XS field encodes the status of additional user-mode extensions and associated state.

Untested

mstatus_xs_summary_op

The XS field represents a summary of all extensions' status as shown in norm:mstatus_fs_vs_xs_enc.

Untested

mstatus_fs_vs_xs_enc

Status|FS and VS Meaning|XS Meaning === 0|Off|All off¶1|Initial|None dirty or clean, some on¶2|Clean|None dirty, some clean¶3|Dirty|Some dirty ===

Sm_F_cg/cp_mstatus_FS_transition, U_F_cg/cp_mstatus_FS_transition, S_F_cg/cp_sstatus_FS_transition, H_F_cg/cp_vsstatus_FS_transition

mstatus_fs_acc1

If the F extension is implemented, the FS field shall not be read-only zero.

Sm_F_cg/cp_mstatus_FS_transition, U_F_cg/cp_mstatus_FS_transition, S_F_cg/cp_sstatus_FS_transition, H_F_cg/cp_vsstatus_FS_transition

mstatus_fs_acc2

If neither the F extension nor S-mode is implemented, then FS is read-only zero.

Sm_mcsr_cg/cp_mcsr_access_masked/mstatus

mstatus_fs_rdonly0_s_no_F

If S-mode is implemented but the F extension is not, FS may optionally be read-only zero.

Sm_mcsr_cg/cp_mcsr_access_masked/mstatus

mstatus_vs_acc1

If the v registers are implemented, the VS field shall not be read-only zero.

Sm_mcsr_cg/cp_mcsr_access_masked/mstatus

mstatus_vs_acc2

If neither the v registers nor S-mode is implemented, then VS is read-only zero.

Sm_mcsr_cg/cp_mcsr_access_masked/mstatus

mstatus_vs_rdonly0_s_no_V

If S-mode is implemented but the v registers are not, VS may optionally be read-only zero.

TODO

mstatus_xs_acc

In harts without additional user extensions requiring new state, the XS field is read-only zero.

Sm_mcsr_cg/cp_mcsr_access_masked/mstatus

mstatus_xs_equiv

Every additional extension with state provides a CSR field that encodes the equivalent of the XS states.

Out of scope

mstatus_sd_acc

The SD bit is a read-only bit

Sm_mstatus_cg/cp_mstatus_sd_write

mstatus_sd_summary_op

summarizes whether either the FS, VS, or XS fields signal the presence of some dirty state that will require saving extended user context to memory.

Sm_mstatus_cg/cp_mstatus_sd_write, Sm_F_cg/cp_mstatus_FS_transition, U_F_cg/cp_mstatus_FS_transition, S_F_cg/cp_sstatus_FS_transition, H_F_cg/cp_vsstatus_FS_transition

mstatus_sd_vs_dirty_op

If mstatus.⁠VS is Dirty, mstatus.⁠SD is 1; otherwise, mstatus.⁠SD is set in accordance with existing specifications.

Sm_mstatus_cg/cp_mstatus_sd_write

mstatus_sd_rdonly0

If FS, VS, and XS are all read-only zero, then SD is also always zero.

Sm_mstatus_cg/cp_mstatus_sd_write

mstatus_sd_formula

The SD bit is read-only and is set when either the FS, VS, or XS bits encode a Dirty state (i.e., SD=(FS==0b11 OR XS==0b11 OR VS==0b11)).

Sm_mstatus_cg/cp_mstatus_sd_write, Sm_F_cg/cp_mstatus_FS_transition, U_F_cg/cp_mstatus_FS_transition, S_F_cg/cp_sstatus_FS_transition, H_F_cg/cp_vsstatus_FS_transition

mstatus_fs_vs_xs_off_op

When an extension’s status is set to Off, any instruction that attempts to read or write the corresponding state will cause an illegal-instruction exception.

Sm_F_cg/{cp_fcsr_access, cp_mstatus_FS_transition}, U_F_cg/{cp_fcsr_access, cp_mstatus_FS_transition}, S_F_cg/{cp_fcsr_access, cp_sstatus_FS_transition}, H_F_cg/{cp_fcsr_access, cp_vsstatus_FS_transition}, Sm_V_cg/{cp_mstatus_vs_off_arithmetic, cp_mstatus_vs_off_csr}, U_V_cg/{cp_mstatus_vs_off_arithmetic, cp_mstatus_vs_off_csr}, S_V_cg/{cp_sstatus_vs_off_arithmetic, cp_sstatus_vs_off_csr}, H_V_cg/{cp_vsstatus_vs_off_arithmetic, cp_vsstatus_vs_off_csr}

mstatus_fs_vs_xs_initial_op

When the status is Initial, the corresponding state should have an initial constant value.

Not tested: the initial constant value is not specified and software can change it

mstatus_fs_vs_xs_clean_op

When the status is Clean, the corresponding state is potentially different from the initial value, but matches the last value stored on a context swap.

Not tested: whether the state matches the last context save depends on software

mstatus_fs_vs_xs_dirty_op

When the status is Dirty, the corresponding state has potentially been modified since the last context save.

Sm_F_cg/{cp_mstatus_FS_transition, cp_fcsr_access}, U_F_cg/{cp_mstatus_FS_transition, cp_fcsr_access}, S_F_cg/{cp_sstatus_FS_transition, cp_fcsr_access}, H_F_cg/{cp_vsstatus_FS_transition, cp_fcsr_access}

mstatus_vs_wr

the setting of VS has no effect on the contents of the vector register state.

TODO: test with vector

mstatus_fs_no_dirty_track

dirtiness might not be tracked at all, in which case the valid FS states are Off and Dirty, and an attempt to set FS to Initial or Clean causes it to be set to Dirty.

Sm_F_cg/cp_mstatus_FS_transition, U_F_cg/cp_mstatus_FS_transition, S_F_cg/cp_sstatus_FS_transition, H_F_cg/cp_vsstatus_FS_transition, Sm_mcsr_cg/cp_mcsrwalk_masked/mstatus

mstatus_fs_no_change_dirty

If an instruction explicitly or implicitly writes a floating-point register or the fcsr but does not alter its contents, and FS=Initial or FS=Clean, it is implementation-defined whether FS transitions to Dirty.

Not tested: implementation-defined whether FS becomes Dirty when the contents do not change, and no UDB parameter controls this behavior in the ref model

mstatus_fs_imprecise

Implementations may choose to track the dirtiness of the floating-point register state imprecisely by reporting the state to be dirty even when it has not been modified. On some implementations, some instructions that do not mutate the floating-point state may cause the state to transition from Initial or Clean to Dirty.

Sm_F_cg/cp_mstatus_FS_transition_nondeterministic, U_F_cg/cp_mstatus_FS_transition_nondeterministic, S_F_cg/cp_sstatus_FS_transition_nondeterministic, H_F_cg/cp_vsstatus_FS_transition_nondeterministic

mstatus_vs_imprecise

Implementations may choose to track the dirtiness of the vector register state in an analogous imprecise fashion, including possibly setting VS to Dirty when software attempts to set VS=Initial or VS=Clean.

Untestable

mstatus_vs_no_change_dirty

When VS=Initial or VS=Clean, it is implementation-defined whether an instruction that writes a vector register or vector CSR but does not alter its contents causes VS to transition to Dirty.

Untestable

mtvec_enc

TODO: Sm_mcsr_cg has no mtvec bin; Sm.py writes mtvec but checks only bit 1

mtvec_sz_warl_acc

The mtvec register is an MXLEN-bit WARL read/write register that holds trap vector configuration, consisting of a vector base address (BASE) and a vector mode (MODE).

TODO: Sm_mcsr_cg has no mtvec bin; Sm.py writes mtvec but checks only bit 1

mtvec_mandatory

The mtvec register must always be implemented

TODO: Sm_mcsr_cg has no mtvec bin; Sm.py writes mtvec but checks only bit 1

mtvec_rdonly

can contain a read-only value.

TODO: Sm_mcsr_cg has no mtvec bin; Sm.py writes mtvec but checks only bit 1

mtvec_base_align_4b

The value in the BASE field must always be aligned on a 4-byte boundary

TODO: Sm_mcsr_cg has no mtvec bin; Sm.py writes mtvec but checks only bit 1

mtvec_base_align_func_mode

the MODE setting may impose additional alignment constraints on the value in the BASE field.

TODO: Sm_mcsr_cg has no mtvec bin; Sm.py writes mtvec but checks only bit 1

medelegh_sz_acc_enc_xlen32

When XLEN=32, medelegh is a 32-bit read/write register that aliases bits 63:32 of medeleg.

Sm_mcsr_cg/cp_mcsr_access/medelegh

medelegh_omit_xlen64

The medelegh register does not exist when XLEN=64.

Ssstrict_Sm_mcsr_cg/cp_csrr

medeleg_sz_acc

The machine exception delegation register (medeleg) is a 64-bit read/write register.

Sm_mcsr_cg/cp_mcsr_access/medeleg

mideleg_sz_acc

The machine interrupt delegation (mideleg) register is an MXLEN-bit read/write register.

Sm_mcsr_cg/cp_mcsr_access/mideleg

medeleg_mideleg_mandatory_s_mode

In harts with S-mode, the medeleg and mideleg registers must exist

Sm_mcsr_cg/cp_mcsr_access/{medeleg, mideleg}

medeleg_mideleg_omit_wo_s_mode

In harts without S-mode, the medeleg and mideleg registers should not exist.

Ssstrict_Sm_mcsr_cg/cp_csrr

medeleg_mideleg_warl

An implementation can choose to subset the delegatable traps, with the supported delegatable bits found by writing one to every bit location, then reading back the value in medeleg or mideleg to see which bit positions hold a one.

Sm_mcsr_cg/cp_mcsr_access/mideleg

medeleg_no_rd1

An implementation shall not have any bits of medeleg be read-only one

Sm_mcsr_cg/cp_mcsr_access/medeleg

mideleg_no_rd1

an implementation shall not fix as read-only one any bits of mideleg corresponding to machine-level interrupts

Sm_mcsr_cg/cp_mcsr_access/mideleg

mideleg_rd1_lower_level

may do so for lower-level interrupts

Sm_mcsr_cg/cp_mcsr_access/mideleg

medeleg_when_rd0

For exceptions that cannot occur in less privileged modes, the corresponding medeleg bits should be read-only zero. In particular, medeleg[11] is read-only zero.

Sm_mcsr_cg/cp_mcsr_access/medeleg

medeleg_16_rdonly0

The medeleg[16] is read-only zero as double trap is not delegatable.

Sm_mcsr_cg/cp_mcsr_access/medeleg

mip_sz_acc

The mip register is an MXLEN-bit read/write register containing information on pending interrupts

Sm_mcsr_cg/cp_mcsr_access/mip

mip_mandatory

The mip register must always be implemented, but can contain read-only zeros in any position, indicating that interrupt can never become pending.

Sm_mcsr_cg/cp_mcsr_access/mip, Sm_mcsr_cg/cp_mcsrwalk/mip

mie_sz_acc

mie is the corresponding MXLEN-bit read/write register containing interrupt enable bits.

Sm_mcsr_cg/cp_mcsr_access/mie

mie_mandatory

The mie register must always be implemented.

Sm_mcsr_cg/cp_mcsr_access/mie

mip_bits_wr_or_rdonly

Each individual bit in register mip may be writable or may be read-only.

Sm_mcsr_cg/cp_mcsrwalk/mip

mie_bits_wr

A bit in mie must be writable if the corresponding interrupt can ever become pending.

Sm_mcsr_cg/cp_mcsrwalk/mie

mie_bits_rdonly0

Bits of mie that are not writable must be read-only zero.

Sm_mcsr_cg/cp_mcsrwalk/mie

mip_msip_mie_msie_maybe_rdonly0

If a system has only one hart, or if a platform standard supports the delivery of machine-level interprocessor interrupts through external interrupts (MEI) instead, then mip.⁠MSIP and mie.⁠MSIE may both be read-only zeros.

Sm_mcsr_cg/cp_mcsrwalk/{mip,mie}

std_mach_intr_impl

Each standard machine interrupt type (MEI, MTI, MSI) might not be implemented, in which case the corresponding interrupt-pending and interrupt-enable bits are read-only zeros.

Sm_mcsr_cg/cp_mcsrwalk/{mip,mie}

mip_sxip_mie_sxie_rdonly0

If supervisor mode is not implemented, bits SEIP, STIP, and SSIP of mip and SEIE, STIE, and SSIE of mie are read-only zeros.

Sm_mcsr_cg/cp_mcsrwalk/{mip,mie}

mip_lcofip_acc

LCOFIP is read-write in mip

Sm_mcsr_cg/cp_mcsrwalk/{mip,mie}

mip_lcofip_mie_lcofie_rdonly0

If the Sscofpmf extension is not implemented, mip.⁠LCOFIP and mie.⁠LCOFIE are read-only zeros.

Sm_mcsr_cg/cp_mcsrwalk/{mip,mie}

menvcfg_sz_acc

The menvcfg CSR is a 64-bit read/write register, formatted as shown in norm:menvcfg_enc_img

Sm_mcsr_cg/cp_mcsr_access_masked/menvcfg, Sm_mcsr_cg/cp_mcsr_access_masked/menvcfgh

menvcfg_op

controls certain characteristics of the execution environment for modes less privileged than M.

Descriptive spec text with no separately testable behavior

menvcfg_enc_img

Sm_mcsr_cg/cp_mcsrwalk_masked/menvcfg

menvcfg_fiom_fence_op

If bit FIOM (Fence of I/O implies Memory) is set to one in menvcfg, FENCE instructions executed in modes less privileged than M are modified so the requirement to order accesses to device I/O implies also the requirement to order main memory accesses. norm:menvcfg_fiom_fence_presuc_op details the modified interpretation of FENCE instruction bits PI, PO, SI, and SO for modes less privileged than M when FIOM=1.

Untestable: no I/O devices defined in profile

menvcfg_fiom_atomic_op

for modes less privileged than M when FIOM=1, if an atomic instruction that accesses a region ordered as device I/O has its aq and/or rl bit set, then that instruction is ordered as though it accesses both device I/O and memory.

Untestable: no I/O devices defined in profile

menvcfg_fiom_rdonly0_ok

If S-mode is not supported, or if satp.MODE is read-only zero (always Bare), the implementation may make FIOM read-only zero.

Sm_mcsr_cg/cp_mcsrwalk_masked/menvcfg

menvcfg_fiom_fence_presuc_op

Instruction bit|Meaning when set === PI PO|Predecessor device input and memory reads (PR implied) Predecessor device output and memory writes (PW implied)¶SI SO|Successor device input and memory reads (SR implied) Successor device output and memory writes (SW implied) ===

Untestable: no I/O devices defined in profile

menvcfg_cde_rdonly0

If Smcdeleg is not implemented, CDE is read-only zero.

TODO: check menvcfg.CDE in the Sm walk once Sail supports Smcdeleg

menvcfg_stce_exists

The Sstc extension adds the STCE (STimecmp Enable) bit to menvcfg CSR.

Sm_mcsr_cg/cp_mcsrwalk_masked/menvcfg

menvcfg_stce_rdonly0

When the Sstc extension is not implemented, STCE is read-only zero.

Sm_mcsr_cg/cp_mcsrwalk_masked/menvcfg

menvcfg_cbze_op

The Zicboz extension adds the CBZE (Cache Block Zero instruction enable) field to menvcfg. When the CBZE field is set to 1, it enables execution of the cache block zero instruction, CBO.ZERO, in modes less privileged than M. Otherwise, the instruction raises an illegal-instruction exception in modes less privileged than M.

Sm_mcsr_cg/cp_mcsrwalk_masked/menvcfg, Exceptions_ZicboS_cg/cp_cbze, Exceptions_ZicboU_cg/cp_cbze

menvcfg_cbze_rdonly0

When the Zicboz extension is not implemented, CBZE is read-only zero.

Sm_mcsr_cg/cp_mcsrwalk_masked/menvcfg

menvcfg_cbcfe_op

The Zicbom extension adds the CBCFE (Cache Block Clean and Flush instruction Enable) field to menvcfg. When the CBCFE field is set to 1, it enables execution of the cache block clean instruction (CBO.CLEAN) and the cache block flush instruction (CBO.FLUSH) in modes less privileged than M. Otherwise, these instructions raise an illegal-instruction exception in modes less privileged than M.

Sm_mcsr_cg/cp_mcsrwalk_masked/menvcfg, Exceptions_ZicboS_cg/cp_cbcfe, Exceptions_ZicboU_cg/cp_cbcfe

menvcfg_cbcfe_rdonly0

When the Zicbom extension is not implemented, CBCFE is read-only zero.

Sm_mcsr_cg/cp_mcsrwalk_masked/menvcfg

menvcfg_cbie_warl_op

The Zicbom extension adds the CBIE (Cache Block Invalidate instruction Enable) WARL field to menvcfg to control execution of the cache block invalidate instruction (CBO.INVAL) in modes less privileged than M. When CBIE is set to 0b00, the instruction raises an illegal-instruction exception in modes less privileged than M.

Sm_mcsr_cg/cp_mcsrwalk_masked/menvcfg, Exceptions_ZicboS_cg/cp_cbie, Exceptions_ZicboU_cg/cp_cbie

menvcfg_cbie_rdonly0

When the Zicbom extension is not implemented, CBIE is read-only zero.

Sm_mcsr_cg/cp_mcsrwalk_masked/menvcfg

menvcfg_cbie_cbo-inval_op_lead_in

When CBIE is set to 0b01 or 0b11, and when enabled for execution in modes less privileged than M, it behaves as follows:

Exceptions_ZicboS_cg/cp_cbie, Exceptions_ZicboU_cg/cp_cbie

menvcfg_cbie_cbo-inval_op_list

0b01 — The instruction is executed and performs a flush operation, even if configured by a mode less privileged than M to perform an invalidate operation. 0b11 — The instruction is executed and performs an invalidate operation, unless configured by a mode less privileged than M to perform a flush operation.

Exceptions_ZicboS_cg/cp_cbie, Exceptions_ZicboU_cg/cp_cbie

menvcfg_pmm_op

If the Smnpm extension is implemented, the PMM field enables or disables pointer masking (see Zpm) for the next-lower privilege mode (S-/HS-mode if S-mode is implemented, or U-mode otherwise), according to the values in norm:menvcfg_pmm_enc.

Smnpm_S_cg/cp_pmlen_masking, Smnpm_U_cg/cp_pmlen_masking

menvcfg_pmm_rdonly0

If Smnpm is not implemented, PMM is read-only zero. The PMM field is read-only zero for RV32.

Sm_mcsr_cg/cp_mcsrwalk_masked/menvcfg, Sm_mcsr_cg/cp_mcsrwalk_masked/menvcfgh

menvcfg_pmm_enc

Value|Description === 00|Pointer masking is disabled (PMLEN = 0)¶01|Reserved¶10|Pointer masking is enabled with PMLEN = XLEN - 57 (PMLEN = 7 on RV64)¶11|Pointer masking is enabled with PMLEN = XLEN - 48 (PMLEN = 16 on RV64) ===

Smnpm_S_cg/cp_pmlen_masking, Smnpm_U_cg/cp_pmlen_masking, Sm_mcsr_cg/cp_mcsrwalk_masked/menvcfg

menvcfg_dte_sdt_rdonly0

When Ssdbltrp is not implemented sstatus.SDT, vsstatus.SDT, and henvcfg.DTE bits are read-only zero.

Sm_mcsr_cg/cp_mcsrwalk_masked/mstatus

menvcfg_mandatory_u_mode

In harts with U-mode, menvcfg must be implemented, but all WARL fields may be read-only zero.

Sm_mcsr_cg/cp_mcsr_access_masked/menvcfg

menvcfgh_mandatory_s_mode_rv32

For harts with S-mode and XLEN=32, menvcfgh must be similarly implemented.

Sm_mcsr_cg/cp_mcsr_access_masked/menvcfgh

mseccfg_sz_acc

mseccfg is a 64-bit read/write register, formatted as shown in norm:mseccfg_enc_img, that controls security features.

Sm_mcsr_cg/cp_mcsr_access_masked/mseccfg, Sm_mcsr_cg/cp_mcsr_access_masked/mseccfgh

mseccfg_presence

It exists if any extension that adds a field to mseccfg is implemented. Otherwise, it is reserved.

Sm_mcsr_cg/cp_mcsr_access_masked/mseccfg, TODO: check that mseccfg is reserved when no extension adds a field to it

mseccfg_enc_img

Sm_mcsr_cg/cp_mcsrwalk_masked/mseccfg

mseccfg_sseed_useed_presence

The Zkr extension adds the SSEED and USEED fields to the mseccfg CSR to control access to the seed CSR from modes less privileged than M.

Sm_mcsr_cg/cp_mcsrwalk_masked/mseccfg

mseccfg_useed_rdonly0

If Zkr or U-mode is not implemented, USEED is read-only zero.

Sm_mcsr_cg/cp_mcsrwalk_masked/mseccfg

mseccfg_sseed_rdonly0

If Zkr or S-mode is not implemented, SSEED is read-only zero.

Sm_mcsr_cg/cp_mcsrwalk_masked/mseccfg

mseccfg_rlb_mmwp_mml_presence

The Smepmp extension adds the RLB, MMWP, and the MML fields in mseccfg.

TODO: check MML, MMWP, and RLB in the Sm mseccfg walk once Sail supports Smepmp

mseccfg_rlb_op_warl

mseccfg.RLB (Rule Locking Bypass) is a WARL field that provides a mechanism to temporarily modify Locked PMP rules. When mseccfg.RLB is 1, locked PMP rules may be removed or modified. When mseccfg.RLB is 0 and pmpcfg.L is 1 in any rule or entry (including disabled entries), then mseccfg.RLB remains 0 and any further modifications to mseccfg.RLB are ignored until a PMP reset.

TODO: Smepmp is not yet tested

mseccfg_mmwp_op_warl

The mseccfg.MMWP (Machine-Mode Allowlist Policy) is a WARL field. This field changes the default PMP policy for Machine mode when accessing memory regions that don’t have a matching PMP rule. This is a sticky bit, meaning that once set it cannot be unset until a PMP reset. When set it changes the default PMP policy for M-mode when accessing memory regions that don’t have a matching PMP rule, to denied instead of ignored.

TODO: Smepmp is not yet tested

mseccfg_mml_warl

The mseccfg.MML (Machine Mode Lockdown) is a WARL field.

TODO: Smepmp is not yet tested

mseccfg_mml_sticky

This is a sticky bit, meaning that once set it cannot be unset until a PMP reset.

TODO: Smepmp is not yet tested

mseccfg_mml_set

When mseccfg.MML is set the system’s behavior changes in the following way:

TODO: Smepmp is not yet tested

mseccfg_mml_pmpcfg_l_op

The meaning of pmpcfg.L changes: Instead of marking a rule as locked and enforced in all modes, it now marks a rule as M-mode-only when set and S/U-mode-only when unset. The formerly reserved encoding of pmpcfg.RW=01, and the encoding pmpcfg.LRWX=1111, now encode a Shared-Region.

TODO: Smepmp is not yet tested

mseccfg_mml_m_rule_op

An M-mode-only rule is enforced on accesses whose effective privilege mode is Machine and denied to accesses whose effective privilege mode is Supervisor or User. It also remains locked so that any further modifications to its associated configuration or address registers are ignored until a PMP reset, unless mseccfg.RLB is set.

TODO: Smepmp is not yet tested

mseccfg_mml_soru_rule_op

An S/U-mode-only rule is enforced on accesses whose effective privilege mode is Supervisor or User and denied to accesses whose effective privilege mode is Machine.

TODO: Smepmp is not yet tested

mseccfg_mml_shared_rule_op

A Shared-Region rule is enforced on all modes, with restrictions depending on the pmpcfg.L and pmpcfg.X bits:

TODO: Smepmp is not yet tested

mseccfg_mml_shared_l0_op

A Shared-Region rule where pmpcfg.L is not set can be used for sharing data between M-mode and S/U-mode, so is not executable. M-mode has read/write access to that region, and S/U-mode has read access if pmpcfg.X is not set, or read/write access if pmpcfg.X is set.

TODO: Smepmp is not yet tested

mseccfg_mml_shared_l1_op

A Shared-Region rule where pmpcfg.L is set can be used for sharing code between M-mode and S/U-mode, so is not writable. Both M-mode and S/U-mode have execute access on the region, and M-mode also has read access if pmpcfg.X is set. The rule remains locked so that any further modifications to its associated configuration or address registers are ignored until a PMP reset, unless mseccfg.RLB is set.

TODO: Smepmp is not yet tested

mseccfg_mml_shared_lrwx_1111_op

The encoding pmpcfg.LRWX=1111 can be used for sharing data between M-mode and S/U mode, where both modes only have read-only access to the region. The rule remains locked so that any further modifications to its associated configuration or address registers are ignored until a PMP reset, unless mseccfg.RLB is set.

TODO: Smepmp is not yet tested

mseccfg_mml_x_restrict

Adding a rule with executable privileges that either is M-mode-only or a locked Shared-Region is not possible and such pmpcfg writes are ignored, leaving pmpcfg unchanged. This restriction can be temporarily lifted by setting mseccfg.RLB

TODO: Smepmp is not yet tested

mseccfg_mml_exec_code

Executing code with Machine mode privileges is only possible from memory regions with a matching M-mode-only rule or a locked Shared-Region rule with executable privileges. Executing code from a region without a matching rule or with a matching S/U-mode-only rule is denied.

TODO: Smepmp is not yet tested

pmp_rw01_rsv

If mseccfg.MML is not set, the combination of pmpcfg.RW=01 remains reserved for future standard use.

Reserved encoding for future use; nothing to test

mseccfg_pmm_presence_op

If the Smmpm extension is implemented, the PMM field enables or disables pointer masking (see Zpm) for M-mode according to the values in norm:mseccfg_pmm_enc.

Smmpm_cg/cp_pmlen_masking

mseccfg_pmm_rdonly0

If Smmpm is not implemented, PMM is read-only zero. The PMM field is read-only zero for RV32.

Sm_mcsr_cg/cp_mcsrwalk_masked/mseccfg, Sm_mcsr_cg/cp_mcsrwalk_masked/mseccfgh

mseccfg_pmm_enc

Value|Description === 00|Pointer masking is disabled (PMLEN = 0)¶01|Reserved¶10|Pointer masking is enabled with PMLEN = XLEN - 57 (PMLEN = 7 on RV64)¶11|Pointer masking is enabled with PMLEN = XLEN - 48 (PMLEN = 16 on RV64) ===

Smmpm_cg/cp_pmlen_masking, Sm_mcsr_cg/cp_mcsrwalk_masked/mseccfg

mseccfgh_sz_acc_op

When XLEN=32 only, mseccfgh is a 32-bit read/write register that aliases bits 63:32 of mseccfg.

Sm_mcsr_cg/cp_mcsr_access_masked/mseccfgh, Sm_mcsr_cg/cp_mcsrwalk_masked/mseccfgh

mcycle_op

The mcycle CSR counts the number of clock cycles executed by the processor core on which the hart is running.

Sm_mcsr_cg/cp_cntr_access/mcycle, Sm_mcsr_cg/cp_mcycle_wraparound

mcycle_minstret_sz

The mcycle and minstret registers have 64-bit precision on all RV32 and RV64 harts.

Sm_mcsr_cg/cp_cntr_access/mcycle, Sm_mcsr_cg/cp_cntr_access

mcycle_minstret_rst

The counter registers have an arbitrary value after the hart is reset, and can be written with a given value.

Sm_mcsr_cg/cp_cntr_access/mcycle, Sm_mcsr_cg/cp_cntr_access/minstret

mcycle_minstret_wr

Any CSR write takes effect after the writing instruction has otherwise completed.

Sm_mcsr_cg/cp_cntr_access

mcycle_shared

The mcycle CSR may be shared between harts on the same core, in which case writes to mcycle will be visible to those harts.

Not tested; requires multi-hart core

mcycleh_minstreth_mhpmh_op

reads of the mcycleh, minstreth, mhpmcounternh, and mhpmeventnh CSRs return bits 63-32 of the corresponding register, and writes change only bits 63-32.

Sm_mcsr_cg/cp_cntr_access/{mcycleh, minstreth, mhpmcounter3h}, Sscofpmf_Sm_cg/cp_sscofpmf_access

minstret_op

The minstret CSR counts the number of instructions the hart has retired.

Sm_mcsr_cg/cp_cntr_access/minstret, Sm_mcsr_cg/cp_minstret_wraparound, Sm_Zicntr_cg/cp_instret_add, Sm_Zicntr_cg/cp_instret_mret, Sm_Zicntr_cg/cp_instret_sret

mhpmcounter_num

The hardware performance monitor includes 29 additional 64-bit event counters, mhpmcounter3&#8205;&#8211;&#8205;`mhpmcounter31`.

Sm_mcsr_cg/cp_cntr_access

mhpmcounter_warl

The mhpmcounters are WARL registers

Sm_mcsr_cg/cp_cntr_access

mhpmcounter_mandatory

All counters should be implemented

Sm_mcsr_cg/cp_cntr_access

mhpmcounter_mhpmevent_rdonly0

a legal implementation is to make both the counter and its corresponding event selector be read-only 0.

Sm_mcsr_cg/cp_cntr_access, Sm_mcsr_cg/cp_mcsr_access

mhpmcounter_sz

support up to 64 bits of precision on RV32 and RV64.

Sm_mcsr_cg/cp_cntr_access

mhpmevent_sz_warl_op

The event selector CSRs, mhpmevent3&#8205;&#8211;&#8205;`mhpmevent31`, are 64-bit WARL registers that control which event causes the corresponding counter to increment.

Sm_mcsr_cg/cp_mcsr_access

mhpmevent_enc

The meaning of these events is defined by the platform, but event 0 is defined to mean no event.

TODO: check no counting on event 0

mcounteren_sz

The counter-enable mcounteren register is a 32-bit register

Sm_mcsr_cg/cp_mcsr_access/mcounteren

mcounteren_enc_img

Sm_mcsr_cg/cp_mcsr_access/mcounteren

mcounteren_flds_mandatory_warl

In harts with U-mode, the mcounteren must be implemented, but all fields are WARL

Sm_mcsr_cg/cp_mcsr_access/mcounteren

mcounteren_flds_rdonly0

may be read-only zero, indicating reads to the corresponding counter will cause an illegal-instruction exception when executing in a less-privileged mode.

Sm_mcsr_cg/cp_mcsr_access/mcounteren

mcounteren_presence

In harts without U-mode, the mcounteren register should not exist.

Ssstrict_Sm_mcsr_cg/cp_csrr

cycle_instret_hpmcounter_op_rdonly

The cycle, instret, and hpmcountern CSRs are read-only shadows of mcycle, minstret, and mhpmcountern, respectively.

Zicntr_csrrs_cg/cp_cntr, Zihpm_csrrs_cg/cp_cntr_hpm, Sm_mcsr_cg/cp_csr_ro

time_op_rdonly

The time CSR is a read-only shadow of the memory-mapped mtime register.

Zicntr_csrrs_cg/cp_cntr/csr_time, Sm_mcsr_cg/{cp_mtime_write, cp_mtime_wraparound, cp_csr_ro}

cycleh_instreth_hpmcounternh_op_rdonly

when XLEN=32, the cycleh, instreth and hpmcounternh CSRs are read-only shadows of mcycleh, minstreth and mhpmcounternh, respectively.

Zicntr_csrrs_cg/cp_cntr, Zihpm_csrrs_cg/cp_cntr_hpm, Sm_mcsr_cg/cp_csr_ro

timeh_op_rdonly

When XLEN=32, the timeh CSR is a read-only shadow of the upper 32 bits of the memory-mapped mtime register

Zicntr_csrrs_cg/cp_cntr/csr_timeh, Sm_mcsr_cg/{cp_mtimeh_write, cp_csr_ro}

mcountinhibit_enc_img

Sm_mcsr_cg/cp_mcsr_access/mcountinhibit

mcountinhibit_sz_warl

The counter-inhibit register mcountinhibit is a 32-bit WARL register that controls which of the hardware performance-monitoring counters increment.

Sm_mcsr_cg/cp_mcsr_access/mcountinhibit, Sm_mcsr_cg/{cp_inhibit_mcycle, cp_inhibit_minstret}, Other counters do not increment predictably and are not tested

mcountinhibit_only_inc

The settings in this register only control whether the counters increment; their accessibility is not affected by the setting of this register.

TODO

mcountinhibit_clear_op

When the CY, IR, or HPMn bit in the mcountinhibit register is clear, the mcycle, minstret, or mhpmcountern register increments as usual. When the CY, IR, or HPMn bit is set, the corresponding counter does not increment.

Sm_mcsr_cg/{cp_inhibit_mcycle, cp_inhibit_minstret}, Other counters do not increment predictably and are not tested

mcountinhibit_cy_shared

The mcycle CSR may be shared between harts on the same core, in which case the mcountinhibit.⁠CY field is also shared between those harts, and so writes to mcountinhibit.⁠CY will be visible to those harts.

Untested because requires multi-hart core

mcountinhibit_not_impl

If the mcountinhibit register is not implemented, the implementation behaves as though the register were set to zero.

Sm_mcsr_cg/{cp_mcycle_wraparound, cp_minstret_wraparound}

mscratch_sz_acc

The mscratch register is an MXLEN-bit read/write register dedicated for use by machine mode. The mscratch register must be implemented.

Sm_mcsr_cg/cp_mcsr_access/mscratch

mscratch_enc_img

Sm_mcsr_cg/cp_mcsr_access/mscratch

mepc_sz_acc

mepc is an MXLEN-bit read/write register

Sm_mcsr_cg/cp_mcsr_access/mepc

mepc_align

The low bit of mepc (mepc[0]) is always zero. On implementations that support only IALIGN=32, the two low bits (mepc[1:0]) are always zero.

Sm_mcsr_cg/cp_mcsr_access/mepc

mepc_bit1_dyn_ialign_op

If an implementation allows IALIGN to be either 16 or 32 (by changing CSR misa, for example), then, whenever IALIGN=32, bit mepc[1] is masked on reads so that it appears to be 0. This masking occurs also for the implicit read by the MRET instruction. Though masked, mepc[1] remains writable when IALIGN=32.

Sm_mcsr_cg/{cp_mepc_ialign32_read, cp_mepc_ialign32_mret}

mepc_warl

mepc is a WARL register that must be implemented and must be able to hold all valid virtual addresses. It need not be capable of holding all possible invalid addresses.

Sm_mcsr_cg/cp_mcsr_access/mepc

mepc_inv_addr_conv

Prior to writing mepc, implementations may convert an invalid address into some other invalid address that mepc is capable of holding.

Sm_mcsr_cg/cp_mepc_vaddr_walk1, Sm_mcsr_cg/cp_mepc_vaddr_walk0

mepc_enc_img

Sm_mcsr_cg/cp_mcsr_access/mepc

mcause_sz_acc

The mcause register is an MXLEN-bit read-write register

Sm_mcause_cg/{cp_mcause_write_exception, cp_mcause_write_interrupt}

mcause_mandatory

The mcause register must be implemented.

Sm_mcause_cg/{cp_mcause_write_exception, cp_mcause_write_interrupt}

mcause_enc_img

Sm_mcause_cg/{cp_mcause_write_exception, cp_mcause_write_interrupt}

mcause_exccode_enc_img

Interrupt|Exception Code|Description === 1 1 1 1|0 1 2 3|Reserved Supervisor software interrupt Reserved Machine software interrupt¶1 1 1 1|4 5 6 7|Reserved Supervisor timer interrupt Reserved Machine timer interrupt¶1 1 1 1|8 9 10 11|Reserved Supervisor external interrupt Reserved Machine external interrupt¶1 1 1 1|12 13 14-15 ≥16|Reserved Counter-overflow interrupt Reserved Designated for platform use¶0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0|0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20-23 24-31 32-47 48-63 ≥64|Instruction address misaligned Instruction access fault Illegal instruction Breakpoint Load address misaligned Load access fault Store/AMO address misaligned Store/AMO access fault Environment call from U-mode Environment call from S-mode Reserved Environment call from M-mode Instruction page fault Load page fault Reserved Store/AMO page fault Double trap Reserved Software check Hardware error Reserved Designated for custom use Reserved Designated for custom use Reserved ===

See mcause_op

mcause_exccode_wlrl

The Exception Code is a WLRL field, so is only guaranteed to hold supported exception codes.

Sm_mcause_cg/{cp_mcause_write_exception, cp_mcause_write_interrupt}

custom_exc_priority

The priority of any custom synchronous exceptions is implementation-defined.

Custom exceptions are non-standard and not certified

mtval_sz_acc

The mtval register is an MXLEN-bit read-write register formatted as shown in norm:mtval_enc_img

Sm_mcsr_cg/cp_mcsr_access/mtval

mtval_per_exc_behavior

The hardware platform will specify which exceptions must set mtval informatively, which may unconditionally set it to zero, and which may exhibit either behavior, depending on the underlying event that caused the exception.

Definition, checked through UDB

mtval_rdonly0

The mtval register must always be implemented. If the hardware platform specifies that no exceptions set mtval to a nonzero value, then mtval is read-only zero.

Sm_mcsr_cg/cp_mcsr_access/mtval

mtval_enc_img

Sm_mcsr_cg/cp_mcsr_access/mtval

mtval_vaddr_wr_misaligned_addr

If mtval is written with a nonzero value when a misaligned load or store causes an access-fault, page-fault, or hardware-error exception, then mtval will contain the virtual address of the portion of the access that caused the fault.

TODO: misaligned loads and stores that straddle a PMA, PMP, or page boundary and fault on the upper part

mtval_other_traps_zero

For other traps, mtval is set to zero

Exceptions_Sm_cg/cp_ecall_m, InterruptsSm_cg/cp_trigger

mtval_vaddr_and_0_sz

must be able to hold all valid virtual addresses and the value zero.

Sm_mcsr_cg/{cp_mtval_zero, cp_mtval_vaddr_walk1, cp_mtval_vaddr_walk0}

mtval_instr_bits_sz

If the feature to return the faulting instruction bits is implemented, mtval must also be able to hold all values less than 2N, where N is the smaller of MXLEN and ILEN.

Sm_mcsr_cg/cp_mtval_ilen_walk1, Sm_mcsr_cg/cp_mtval_ilen_ones

mtval_warl

If mtval is not read-only zero, it is a WARL register

Sm_mcsr_cg/cp_mcsr_access/mtval

mtval_inv_addr_conv

Prior to writing mtval, implementations may convert an invalid address into some other invalid address that mtval is capable of holding.

Sm_mcsr_cg/cp_mtval_vaddr_walk1, Sm_mcsr_cg/cp_mtval_vaddr_walk0

mconfigptr_sz_acc

The mconfigptr register is an MXLEN-bit read-only CSR formatted as shown in norm:mconfigptr_enc_img

Sm_mcsr_cg/cp_mcsr_access_ro/mconfigptr

mconfigptr_op

holds the physical address of a configuration data structure.

Definition, checked through UDB

mconfigptr_enc_img

Sm_mcsr_cg/cp_mcsr_access_ro/mconfigptr

mconfigptr_align

The pointer alignment in bits must be no smaller than MXLEN: i.e., if MXLEN is 8×n, then mconfigptr[log2n-1:0] must be zero.

TODO: check that mconfigptr[log2(MXLEN/8)-1:0] reads as zero

mconfigptr_mandatory

The mconfigptr register must be implemented

Sm_mcsr_cg/cp_mcsr_access_ro/mconfigptr

mconfigptr_val

it may be zero to indicate the configuration data structure does not exist or that an alternative mechanism must be used to locate it.

Sm_mcsr_cg/cp_mcsr_access_ro/mconfigptr

sxlen_uxlen

The effective XLEN in S-mode and U-mode are termed SXLEN and UXLEN, respectively.

Sm_mcsr_cg/cp_mcsr_access_masked/mstatus

xlen_reduction_op

Whenever XLEN in any mode is set to a value less than the widest supported XLEN, all operations must ignore source operand register bits above the configured XLEN, and must sign-extend results to fill the entire widest supported XLEN in the destination register. Similarly, pc bits above XLEN are ignored, and when the pc is written, it is sign-extended to fill the widest supported XLEN.

NOT TESTED

xlen_reduction_hint_op

Some HINT instructions are encoded as integer computational instructions that overwrite their destination register with its current value, e.g., C.ADDI x8, 0. When such a HINT is executed with XLEN < MXLEN and bits MXLEN..XLEN of the destination register not all equal to bit XLEN-1, it is implementation-defined whether bits MXLEN..XLEN of the destination register are unchanged or are overwritten with copies of bit XLEN-1.

Out of scope

endianness_inst_fetch_little

Instruction fetches are always little-endian.

Tested by executing instructions

trap_del_s_mode_no_m_mode

The mcause, mepc, and mtval registers and the MPP and MPIE fields of mstatus are not written.

Untested; S-mode handler does not have access to M-mode CSRs and changing to M-mode disturbs CSRs

Zicsr_illegal_acc

Attempts to write a read-only CSR address raise illegal-instruction exceptions.

Sm_mcsr_cg/cp_csr_ro

Zicsr_illegal_mode

Attempts to access a CSR address without sufficient privilege raise illegal-instruction exceptions or, as described in sec:hcauses, virtual-instruction exceptions.

Sm_mcsr_cg/cp_csr_insufficient_priv

Zicsr_debug_illegal

0x7B0&#8205;&#8211;&#8205;0x7BF are only visible to debug mode. Implementations must raise illegal-instruction exceptions on machine-mode access to the latter set of registers.

Sm_mcsr_cg/cp_csr_insufficient_priv

Zicsr_write_ro

A read/write register might also contain some bits that are read-only, in which case writes to the read-only bits are ignored.

Sm_mcsr_cg/{cp_mcsr_access, cp_misa_mxl}

Zicsr_wpri_roz

For forward compatibility, implementations that do not furnish these fields must make them read-only zero. These fields are labeled WPRI in the register descriptions.

Sm_mcsr_cg/cp_mcsr_access_masked/mstatus

Zicsr_wlrl

Software should not write anything other than legal values to such a field, and should not assume a read will return a legal value unless the last write was of a legal value, or the register has not been written since another operation (e.g., reset) set the register to a legal value. These fields are labeled WLRL in the register descriptions.

Sm_mcause_cg/{cp_mcause_write_exception, cp_mcause_write_interrupt}

Zicsr_warl

Implementations will not raise an exception on writes of unsupported values to a WARL field.

Sm_mcsr_cg/cp_mcsr_access

mtime_acc

Platforms provide a real-time counter, exposed as a memory-mapped machine-mode read-write register, mtime.

Sm_mcsr_cg/{cp_mtime_write, cp_mtime_wraparound}

mtime_op

mtime must increment at constant frequency

Sm_mcsr_cg/cp_mtime_wraparound, Constant frequency is untestable without an independent time reference

mtime_tick_period

the platform must provide a mechanism for determining the period of an mtime tick.

Platform requirement outside the ISA; not tested

mtime_wrap

The mtime register will wrap around if the count overflows.

Sm_mcsr_cg/cp_mtime_wraparound

mtime_sz

The mtime register has a 64-bit precision on all RV32 and RV64 systems.

Sm_mcsr_cg/{cp_mtimeh_write, cp_mtimeh_wraparound}, TODO: on RV64, check that mtime bits 63:32 are writable

mtimecmp_sz

Platforms provide a 64-bit memory-mapped machine-mode timer compare register (mtimecmp).

TODO: write and read back all 64 bits of mtimecmp

mtime_enc_img

Sm_mcsr_cg/{cp_mtime_write, cp_mtime_wraparound}

mtimecmp_enc_img

TODO: write and read back all 64 bits of mtimecmp

mtimecmp_rv32_wr

In RV32, memory-mapped writes to mtimecmp modify only one 32-bit part of the register.

TODO: on RV32, write each half of mtimecmp and read back both halves

mtime_mtimecmp_rv64_wr

For RV64, naturally aligned 64-bit memory accesses to the mtime and mtimecmp registers are additionally supported and are atomic.

Sm_mcsr_cg/cp_mtime_wraparound, Zawrs_Sm_cg/cp_wrs_resume, Atomicity is not observable in a single-hart test

time_timeh_visibility_mtime

When mtime changes, it is guaranteed to be reflected in time and timeh eventually, but not necessarily immediately.

Sm_mcsr_cg/{cp_mtime_write, cp_mtimeh_write}

ecall_ebreak_epc_value

ECALL and EBREAK cause the receiving privilege mode’s epc register to be set to the address of the ECALL or EBREAK instruction itself, not the address of the following instruction.

Sm_mprivinst_cg/cp_mprivinst, Exceptions_Sm_cg/{cp_ecall_m, cp_breakpoint}

xret_enc_img

Sm_mprivinst_cg/{cp_mret, cp_sret}

mret_presence

MRET is always provided.

Sm_mprivinst_cg/cp_mret

xret_clr_lr_resv

If the Zalrsc extension is supported, the xRET instruction is allowed to clear any outstanding LR address reservation but is not required to.

Either behavior is legal; not tested

m_mode_priv_at_reset

Upon reset, a hart’s privilege mode is set to M.

Sm_mcsr_cg/cp_mcsr_access

mstatus_mie_mprv_rst

The mstatus fields MIE and MPRV are reset to 0.

TODO: record mstatus.MIE and MPRV before the boot code writes mstatus

mstatus_mstatush_mbe_rst

If little-endian memory accesses are supported, the mstatus/mstatush field MBE is reset to 0.

TODO: record mstatus/mstatush.MBE before the boot code writes it

ld_rsv_rst

For implementations with the Zalrsc standard extension, there is no valid load reservation.

TODO: execute an SC before any LR after reset and check that it fails

pc_rst

The pc is set to an implementation-defined reset vector.

Tested with linker script

mcause_rst1_val

The mcause register is set to a value indicating the cause of the reset.

Implementation-specific reset cause; not tested

pmp_a_l_rst

Writable PMP registers’ A and L fields are set to 0, unless the platform mandates a different reset value for some PMP registers’ A and L fields.

TODO: record the writable pmpcfg A and L fields before the boot code writes them

hgatp_vsatp_mode_rst

If the hypervisor extension is implemented, the hgatp.MODE and vsatp.MODE fields are reset to 0.

TODO: record hgatp.MODE and vsatp.MODE after reset, before any write

warl_rst

No WARL field contains an illegal value.

TODO: check that WARL fields hold legal values before the boot code writes them

rst_other_state_unspec

All other hart state is UNSPECIFIED.

Behavior is UNSPECIFIED by the specification; not tested

mseccfg_mml_mmwp_rlb_rst

The MML, MMWP, and RLB fields of the mseccfg register are set to 0, unless the platform mandates a different reset value.

TODO: record mseccfg.MML, MMWP, and RLB after reset, before any write

mcause_rst2_val

The mcause values after reset have implementation-specific interpretation

Implementation-specific reset cause; not tested

mcause_rst_zero

the value 0 should be returned on implementations that do not distinguish different reset conditions. Implementations that distinguish different reset conditions should only use 0 to indicate the most complete reset.

Implementation-specific reset cause; not tested

mseccfg_useed_sseed_rst

The USEED and SSEED fields of the mseccfg CSR must have defined reset values. The system must not allow them to be in an undefined state after reset.

TODO: record mseccfg.USEED and SSEED after reset, before any write

nmi_op

cause an immediate jump to an implementation-defined NMI vector running in M-mode regardless of the state of a hart’s interrupt enable bits. The mepc register is written with the virtual address of the instruction that was interrupted,

TODO: needs a platform mechanism (RVMODEL macro) to raise an NMI

nmi_mcause_source

mcause is set to a value indicating the source of the NMI.

TODO: needs a platform mechanism (RVMODEL macro) to raise an NMI

nmi_mcause_impl_def

The values written to mcause on an NMI are implementation-defined.

Implementation-defined; not tested

nmi_mcause_restrictions

The high Interrupt bit of mcause should be set to indicate that this was an interrupt. An Exception Code of 0 is reserved to mean unknown cause and implementations that do not distinguish sources of NMIs via the mcause register should return 0 in the Exception Code.

TODO: needs a platform mechanism (RVMODEL macro) to raise an NMI

nmi_no_rst

NMIs do not reset processor state

TODO: needs a platform mechanism (RVMODEL macro) to raise an NMI

mcounteren_op

controls the availability of the hardware performance-monitoring counters to the next-lower privileged mode.

Sm_Zicntr_cg/cp_mcounteren_access_m, Sm_Zicntr_H_cg/cp_mhscounteren_access_m (M-mode reads succeed for every counter-enable value)

scounteren_op

When the CY, TM, IR, or HPMn bit in the scounteren register is clear, attempts to read the cycle, time, instret, or hpmcountern register while executing in U-mode will cause an illegal-instruction exception. When one of these bits is set, access to the corresponding register is permitted.

Sm_Zicntr_cg/cp_scounteren_access_m, Sm_Zicntr_H_cg/cp_mhscounteren_access_m (M-mode reads succeed for every counter-enable value)

hcounteren_op

When the CY, TM, IR, or HPMn bit in the hcounteren register is clear, attempts to read the cycle, time, instret, or hpmcounter n register while V=1 will cause a virtual-instruction exception if the same bit in mcounteren is 1.

Sm_Zicntr_H_cg/cp_mhscounteren_access_m (M-mode reads succeed for every counter-enable value)

Zihpm_op_sz_mode_acc_priv

accessible via unprivileged XLEN-bit read-only CSR registers 0xC00–0xC1F

Sm_Zicntr_cg/{cp_mcounteren_access_m, cp_scounteren_access_m}, Sm_Zicntr_H_cg/cp_mhscounteren_access_m

ecall_ebreak_no_minstret_inc

As ECALL and EBREAK cause synchronous exceptions, they are not considered to retire, and should not increment the minstret CSR.

Sm_Zicntr_cg/{cp_instret_ecall, cp_instret_ebreak}

mtval2_sz_acc_op

The mtval2 register is an MXLEN-bit read/write register formatted as shown in mtval2reg. When a trap is taken into M-mode, mtval2 is written with additional exception-specific information, alongside mtval, to assist software in handling the trap.

Sm_H_mcsr_cg/cp_hcsr_access_zero/mtval2, Sm_H_inst_cg/cp_guest_page_fault

mtval2_val

mtval2 is a WARL register that must be able to hold zero and may be capable of holding only an arbitrary subset of other 2-bit-shifted guest physical addresses, if any.

Sm_H_mcsr_cg/cp_hcsr_access_zero/mtval2

mtinst_sz_acc_op

The mtinst register is an MXLEN-bit read/write register formatted as shown in mtinstreg. When a trap is taken into M-mode, mtinst is written with a value that, if nonzero, provides information about the instruction that trapped, to assist software in handling the trap. The values that may be written to mtinst on a trap are documented in tinst-vals.

Sm_H_mcsr_cg/cp_hcsr_access_zero/mtinst, Sm_H_inst_cg/cp_guest_page_fault

mtinst_val

mtinst is a WARL register that need only be able to hold the values that the implementation may automatically write to it on a trap.

Sm_H_mcsr_cg/cp_hcsr_access_zero/mtinst

H_vscsrs_acc_m_hs

The VS CSRs can be accessed as themselves only from M-mode or HS-mode.

Sm_H_mcsr_cg/cp_hcsr_access, Sm_H_mcsr_cg/cp_hcsrwalk, Sm_H_mcsr_cg/cp_hcsr_access_zero/vsatp, Sm_H_mcsr_cg/cp_atpwalk1/vsatp

H_vscsrs_v0

when V=0, the VS CSRs do not ordinarily affect the behavior of the machine other than being readable and writable by CSR instructions.

Sm_H_mcsr_cg/cp_replica

H_vscsrs_sub, H_vscsrs_v1

H_vscsrs_sub: When V=1, the VS CSRs substitute for the corresponding supervisor CSRs, taking over all functions of the usual supervisor CSRs except as specified otherwise. Instructions that normally read or modify a supervisor CSR shall instead access the corresponding VS CSR. H_vscsrs_v1: While V=1, the normal HS-level supervisor CSRs that are replaced by VS CSRs retain their values but do not affect the behavior of the machine unless specifically documented to do so.

Sm_H_mcsr_cg/cp_replica_vs

H_mtval_nrz

CSR mtval must not be read-only zero

Sm_H_mcsr_cg/cp_mtvala

mstatus_tvm_hs

Setting TVM=1 prevents HS-mode from accessing hgatp or executing HFENCE.GVMA or HINVAL.GVMA, but has no effect on accesses to vsatp or instructions HFENCE.VVMA or HINVAL.VVMA.

Sm_H_tvm_cg/cp_tvm_hs, Sm_H_tvm_cg/cp_hfence

hgatp_tvm_illegal

When mstatus.TVM=1, attempts to read or write hgatp while executing in HS-mode will raise an illegal-instruction exception.

Sm_H_tvm_cg/cp_tvm_hs/hgatp

mstatus_modes

The TSR and TVM fields of mstatus affect execution only in HS-mode, not in VS-mode. The TW field affects execution in all modes except M-mode.

Sm_H_tvm_cg/cp_tvm_vs

hstatus_vtvm_op, H_virtinst_vs_sfence_sinval_satp_vtvm1

hstatus_vtvm_op: When VTVM=1, an attempt in VS-mode to execute SFENCE.VMA or SINVAL.VMA or to access CSR satp raises a virtual-instruction exception. H_virtinst_vs_sfence_sinval_satp_vtvm1: in VS-mode, attempts to execute an SFENCE.VMA or SINVAL.VMA instruction or to access satp, when hstatus.VTVM=1.

Sm_H_tvm_cg/cp_tvm_vs, Sm_H_tvm_cg/cp_sfence

hfence-vvma_hfence-gvma_op, hfence-vvma_mode

hfence-vvma_hfence-gvma_op: The hypervisor memory-management fence instructions, HFENCE.VVMA and HFENCE.GVMA, perform a function similar to SFENCE.VMA (sfence.vma), except applying to the VS-level memory-management data structures controlled by CSR vsatp (HFENCE.VVMA) or the guest-physical memory-management data structures controlled by CSR hgatp (HFENCE.GVMA). Instruction SFENCE.VMA applies only to the memory-management data structures controlled by the current satp (either the HS-level satp when V=0 or vsatp when V=1). hfence-vvma_mode: HFENCE.VVMA is valid only in M-mode or HS-mode. Its effect is much the same as temporarily entering VS-mode and executing SFENCE.VMA. Executing an HFENCE.VVMA guarantees that any previous stores already visible to the current hart are ordered before all implicit reads by that hart done for VS-stage address translation for instructions that

Sm_H_tvm_cg/cp_hfence, Sv_H_fence_cg/cp_hfence_vvma, Sv_H_fence_cg/cp_hfence_gvma

hfence-gvma_mode, hfence-vvma_tvm, hfence-vvma_hfence-gvma_exceptions

hfence-gvma_mode: If hgatp.MODE is changed for a given VMID, an HFENCE.GVMA with rs1=x0 (and rs2 set to either x0 or the VMID) must be executed to order subsequent guest translations with the MODE change—even if the old MODE or new MODE is Bare. hfence-vvma_tvm: Neither mstatus.TVM nor hstatus.VTVM causes HFENCE.VVMA to trap. hfence-vvma_hfence-gvma_exceptions: Attempts to execute HFENCE.VVMA or HFENCE.GVMA when V=1 cause a virtual-instruction exception, while attempts to do the same in U-mode cause an illegal-instruction exception. Attempting to execute HFENCE.GVMA in HS-mode when mstatus.TVM=1 also causes an illegal-instruction exception.

Sm_H_tvm_cg/cp_hfence

mstatus_mpv_op, mret_H

mstatus_mpv_op: The MPV bit (Machine Previous Virtualization Mode) is written by the implementation whenever a trap is taken into M-mode. Just as the MPP field is set to the (nominal) privilege mode at the time of the trap, the MPV bit is set to the value of the virtualization mode V at the time of the trap. When an MRET instruction is executed, the virtualization mode V is set to MPV, unless MPP=3, in which case V remains 0. mret_H: The MRET instruction is used to return from a trap taken into M-mode. MRET first determines what the new privilege mode will be according to the values of MPP and MPV in mstatus or mstatush, as encoded in norm:H_trap_m_mpv_mpp_tbl. MRET then in mstatus/mstatush sets MPV=0, MPP=0, MIE=MPIE, and MPIE=1. Lastly, MRET sets the privilege mode as previously determined, and sets pc=mepc.

Sm_H_inst_cg/cp_mret_m

sret_H, sret_v0, hstatus_spv_sret

sret_H: The SRET instruction is used to return from a trap taken into HS-mode or VS-mode. Its behavior depends on the current virtualization mode. sret_v0: When executed in M-mode or HS-mode (i.e., V=0), SRET first determines what the new privilege mode will be according to the values in hstatus.SPV and sstatus.SPP, as encoded in norm:H_trap_hs_spv_spp_tbl. SRET then sets hstatus.SPV=0, and in sstatus sets SPP=0, SIE=SPIE, and SPIE=1. Lastly, SRET sets the privilege mode as previously determined, and sets pc=sepc. hstatus_spv_sret: When an SRET instruction is executed when V=0, V is set to SPV.

Sm_H_inst_cg/cp_sret_m

hlsv_mode, hlsv_op, hlvx-wu_valid32

hlsv_mode: The hypervisor virtual-machine load and store instructions are valid only in M-mode or HS-mode, or in U-mode when hstatus.HU=1. hlsv_op: For every RV32I or RV64I load instruction, LB, LBU, LH, LHU, LW, LWU, and LD, there is a corresponding virtual-machine load instruction: HLV.B, HLV.BU, HLV.H, HLV.HU, HLV.W, HLV.WU, and HLV.D. For every RV32I or RV64I store instruction, SB, SH, SW, and SD, there is a corresponding virtual-machine store instruction: HSV.B, HSV.H, HSV.W, and HSV.D. Instructions HLV.WU, HLV.D, and HSV.D are not valid for RV32, of course. hlvx-wu_valid32: HLVX.WU is valid for RV32, even though LWU and HLV.WU are not.

Sm_H_inst_cg/cp_hlv, Sm_H_inst_cg/cp_hlvx, Sm_H_inst_cg/cp_hsv

H_guest_page_fault

Guest-page-fault traps may be delegated from M-mode to HS-mode under the control of CSR medeleg, but cannot be delegated to other privilege modes. On a guest-page fault, CSR mtval or stval is written with the faulting guest virtual address as usual, and mtval2 or htval is written either with zero or with the faulting guest physical address, shifted right by 2 bits. CSR mtinst or htinst may also be written with information about the faulting instruction or other reason for the access, as explained in tinst-vals.

Sm_H_inst_cg/cp_guest_page_fault

H_trap_xtinst

On any trap into M-mode or HS-mode, one of these values is written automatically into the appropriate trap instruction CSR, mtinst or htinst:

Sm_H_inst_cg/cp_guest_page_fault

H_trap_xtinst_exception_lead_in

On a synchronous exception, if a nonzero value is written, one of the following shall be true about the value:

Sm_H_inst_cg/cp_guest_page_fault

H_trap_xtinst_exception_list

Bit 0 is 1, and replacing bit 1 with 1 makes the value into a valid encoding of a standard instruction. In this case, the instruction that trapped is the same kind as indicated by the register value, and the register value is the transformation of the trapping instruction, as defined later. For example, if bits 1:0 are binary 11 and the register value is the encoding of a standard LW (load word) instruction, then the trapping instruction is LW, and the register value is the transformation of the trapping LW instruction. Bit 0 is 1, and replacing bit 1 with 1 makes the value into an instruction encoding that is explicitly designated for a custom instruction (not an unused reserved encoding). This is a custom value. The instruction that trapped is a non-standard instruction. The interpretation of a custom value is not otherwise specified by this standard. The value is one of the special pseudoinstructions defined later, all of which have bits 1:0 equal to 00.

Sm_H_inst_cg/cp_guest_page_fault

H_trap_xtinst_val

norm:H_trap_xtinst_val_tbl shows the values that may be automatically written to the trap instruction register for each standard exception cause. For exceptions that prevent the fetching of an instruction, only zero or a pseudoinstruction value may be written. A custom value may be automatically written only if the instruction that traps is non-standard. A future standard or extension may permit other values to be written, chosen from the set of allowed values established earlier.

Sm_H_inst_cg/cp_guest_page_fault

H_trap_xtinst_guestpage

For guest-page faults, the trap instruction register is written with a special pseudoinstruction value if: (a) the fault is caused by an implicit memory access for VS-stage address translation, and (b) a nonzero value (the faulting guest physical address) is written to mtval2 or htval. If both conditions are met, the value written to mtinst or htinst must be taken from norm:H_trap_xtinst_pseudoinst_tbl; zero is not allowed.

Sm_H_inst_cg/cp_guest_page_fault

mtval2_Ssdbltrp

The Ssdbltrp extension (See ssdbltrp) requires the implementation of the mtval2 CSR.

Not tested: an implementation requirement; with H, the Sm_H CSR access tests access mtval2

misa_H_op

The hypervisor extension is enabled by setting bit 7 in the misa CSR

Not tested: clearing misa.H needs a reference model with writable misa.H; Sail’s writable_misa makes every misa bit writable and no config with MUTABLE_MISA_H enables it

hfence-gvma_op

HFENCE.GVMA is valid only in HS-mode when mstatus.⁠TVM=0, or in M-mode (irrespective of mstatus.⁠TVM). Executing an HFENCE.GVMA instruction guarantees that any previous stores already visible to the current hart are ordered before all implicit reads by that hart done for G-stage address translation for instructions that follow the HFENCE.GVMA. If operand rs1≠x0, it specifies a single guest physical address, shifted right by 2 bits, and if operand rs2≠x0, it specifies a single virtual machine identifier (VMID).

Sm_H_tvm_cg/cp_hfence, Sv_H_fence_cg/cp_hfence_gvma

hfence-gvma_vmid

When rs2≠x0, bits XLEN-1:VMIDMAX of the value held in rs2 are reserved for future standard use. Until their use is defined by a standard extension, they should be zeroed by software and ignored by current implementations. Furthermore, if VMIDLEN < VMIDMAX, the implementation shall ignore bits VMIDMAX-1:VMIDLEN of the value held in rs2.

Sv_H_fence_cg/cp_hfence_gvma_vmid (rs2 with every VMIDMAX bit set; ignoring bits above VMIDMAX is only a should)

hfence-vvma_asid

When rs2≠x0, bits XLEN-1:ASIDMAX of the value held in rs2 are reserved for future standard use. Until their use is defined by a standard extension, they should be zeroed by software and ignored by current implementations. Furthermore, if ASIDLEN < ASIDMAX, the implementation shall ignore bits ASIDMAX-1:ASIDLEN of the value held in rs2.

Sv_H_fence_cg/cp_hfence_vvma_asid (rs2 with every ASIDMAX bit set; ignoring bits above ASIDMAX is only a should)

hfence-vvma_limits

Implicit reads need not be ordered when hgatp.VMID is different than at the time HFENCE.VVMA executed. If operand rs1≠x0, it specifies a single guest virtual address, and if operand rs2≠x0, it specifies a single guest address-space identifier (ASID).

Sv_H_fence_cg/cp_hfence_vvma

htimedelta_sz_acc_op, htimedeltah_sz_acc_op

htimedelta_sz_acc_op: The htimedelta CSR is a 64-bit read/write register that contains the delta between the value of the time CSR and the value returned in VS-mode or VU-mode. That is, reading the time CSR in VS or VU mode returns the sum of the contents of htimedelta and the actual value of time. htimedeltah_sz_acc_op: When XLEN=32, htimedeltah is a 32-bit read/write register that aliases bits 63:32 of htimedelta. Register htimedeltah does not exist when XLEN=64.

Sm_Zicntr_H_cg/cp_delta_m (M-mode reads of time ignore htimedelta)

Table 168. Sm UDB Parameters
Parameter Description Coverpoint Effect

MXLEN

XLEN in machine mode, specified in bits

all tests

Implicitly tested by all the XLEN-dependent tests (e.g. add would fail if XLEN is wrong)

MISA_CSR_IMPLEMENTED

Options:

true:: The misa CSR returns a non-zero value.

false:: The misa CSR is read-only-0.

cp_mcsr_access

misa bin results depend on parameter

TIME_CSR_IMPLEMENTED

Whether or not a real hardware time CSR exists. Implementations can either provide a real CSR or emulate access at M-mode.

Possible values:

true:: time/timeh exists, and accessing it will not cause an IllegalInstruction trap

false:: time/timeh does not exist. Accessing the CSR will cause an IllegalInstruction trap or enter an unpredictable state, depending on TRAP_ON_UNIMPLEMENTED_CSR. Privileged software may emulate the time CSR, or may pass the exception to a lower level.

cp_mtime_write

coverpoint only applies if parameter is True

COUNTINHIBIT_EN

Indicates which hardware performance monitor counters can be disabled from mcountinhibit.

COUNTINHIBIT_EN[n] controls whether mcountinhibit.HPM<n> is writable. It does not depend on whether hpmcounter<n>/mhpmcounter<n> is read-only zero.

COUNTINHIBIT_EN[1] can never be true, since it corresponds to mcountinhibit.TM, which is always read-only-0.

cp_inhibit

bins 0 and 2 for mcycle and minstret are affected by this parameter. Other bins are OUT-OF-SCOPE and not tested because HPM behavior is UNSPECIFIED

MARCHID_IMPLEMENTED

* false: marchid is not implemented, and must be read-only-0 * true: marchid is implemented, and the value is determined by ARCH_ID_VALUE

cp_mcsr_access

if false, marchid bin is read-only zero

ARCH_ID_VALUE

The value of marchid The combination of mvendorid and marchid should uniquely identify the type of hart microarchitecture that is implemented.

cp_mcsr_access

marchid value

MIMPID_IMPLEMENTED

* false: mimpid is not implemented, and must be read-only-0 * true: mimpid is implemented, and the value is determined by IMP_ID_VALUE

cp_mcsr_access

if false, mimpid is read-only zero.

IMP_ID_VALUE

A unique encoding of the version of the processor implementation.

cp_mcsr_access

mimpid value

VENDOR_ID_BANK

Encodes the number of one-byte continuation codes in the Bank field of mvendorid.

iN JEDEC’s parlance, the bank number is one greater than the number of continuation codes; hence, the mvendorid Bank field encodes a value that is one less than the JEDEC bank number.

cp_mcsr_access

mvendorid value

VENDOR_ID_OFFSET

Encodes the final byte of a JEDEC manufactor ID, discarding the parity bit.

cp_mcsr_access

mvendorid value

TODO: Many new normative rules have been added since this was written. Update Sm.yaml.

B.1.2. S Supervisor-Mode CSRs and Instructions

These test additional CSRs that exist in supervisor mode, and privileged instructions in supervisor mode. The S suite also contains the S_F, S_V, and S_VF tests, which repeat the Sm_F, Sm_V, and Sm_VF tests from supervisor mode using sstatus.FS and sstatus.VS when F, Zve32x, or Zve32f is also supported. The S_Zicntr group runs when Zicntr is also supported. It reads the counters from S-mode and U-mode under walking mcounteren and scounteren values, and checks instret across retiring instructions, exceptions, wfi and wrs in S-mode.

Table 169. S Coverpoints
Coverpoint Goal Feature Description Expectation Bins Normative Rule Notes

cp_scsr_access

csr read, write all 1s, write all 0s, set all 1s, clear all 1s, write back initial value of each register below

sstatus
std_super_intr_impl
sip_sie_warl
sscratch
sepc
stval
senvcfg
senvcfg_fiom
senvcfg_fiom_acc
Zicsr_write_ro
Zicsr_wpri_roz
Zicsr_warl
scounteren
csrrs and csrrc to each bit

cp_scsrwalk

Walking 1s of legal supervisor CSRs

Set and clear each bit of each writable S-mode CSR to exercise bitfields: sstatus, scause, sie, stvec, scounteren, senvcfg, sscratch, sip. Iterations that write a reserved senvcfg.CBIE (0b10) or senvcfg.PMM (0b01) value check the other bits exactly and only check that the field reads back a legal value. sepc and stval are not tested because it is hard to express what values are legal.

sstatus
sstatus_sum_satp_mode
sip_sie
sip_acc
sie_acc
sip_sie_bits_sz
sip_seip_sie_seie
sip_stip_sie_stie
mip_sip_stip_op
sip_ssip_sie_ssie
sip_sie_warl
senvcfg_cbze_rdonly0
senvcfg_cbcfe_rdonly0
senvcfg_cbie_rsv
senvcfg_cbie_rdonly0
senvcfg_pmm_ssnpm
senvcfg_pmm_enc
Zicsr_warl_def
pmlen_future_reserved
pmlen_illegal_warl
Illegal Instruction

cp_csr_ro

Write read-only CSRs (C00-EFF)

Zicsr_rw
Zicsr_illegal_acc
Turning on satp.mode without having page tables will hang the system

cp_satp

Read satp

Read satp

Reads when 0, illegal instruction when 1. Value is unpredictable because it is not reset and has WARL fields that might not even support Bare.

cp_ucsr_from_s

In supervisor mode, read/write/set/clear from each U-mode CSR if F/V are supported

Zicsr_higher_priv

cp_csr_insufficient_priv

Read Machine CSRS 300-3FF, 700-7FF, B00-BFF, F000-FFF, excluding 7AA (mscontext)

mtval2_sz_acc_op
mtinst_sz_acc_op
Zicsr_access
Zicsr_illegal_mode

cp_scause_write

Write scause values
(WLRL)

Write scause values:
with interrupt = 1: 0-15
with interrupt = 0: 0-64

scause
scause_interrupt
scause_exception_code_acc
scause_exception_code_sz
scause_exccode_enc_tbl
Zicsr_wlrl

cp_sstatus_sd_write

Writing to the CSR field
(WARL)

Write 1 and 0 to SD with FS/VS/XS all 0. Write cross-product of all bits of SD/ FS/ VS/XS. 128 bins of writes.

Illegal instruction exception

cp_sprivinst

Execute ecall and ebreak and mret and and sfence.vma in supervisor mode

Changes affecting coverpoints:
moved scsr accesses from M to Sm
duplicated cp_sret_s to Sm and stripped TSR out of the S version.

ecall_service_request_op
ecall_priv_mode_op
ebreak_debug_env_op
ebreak_debugger_transfer_op
xret_in_lower_mode
sfence_vma_op
sepc should be pointing two instructions ahead.

cp_sret_s

Execute sret in supervisor mode with cross-product of all values of sstatus.SPP/SPIE/SIE. Return to supervisor mode after each sret.

sstatus_spp
sstatus_spie
sret_presence
xret_op
mstatus_xret_op
mstatus_mprv_clr_mret_sret_less_priv
sepc should be pointing two instructions ahead.

SXL tested with EndianS

* if other supervisor extensions are supported, ifdef them in to run in M-mode, such as sstc to test access to stimecmp.

S_F tests (S_F-NN.S): the floating-point CSRs and sstatus.FS from S-mode, run when F is also supported.

cp_fcsr_access

Writing to the CSR field
(WARL)

Write 0s and 1s to fcsr, frm, fflags cross with sstatus.FS init/clean/dirty

Zicsr_higher_priv
mstatus_fs_vs_xs_off_op
mstatus_fs_vs_xs_dirty_op

cp_sstatus_FS_transition

Writing to the CSR field
(WARL)

Each different type of floating-point instruction crossed with four values of FS. Includes integer-result instructions that raise a flag after fflags is cleared (feq.s with a signaling NaN, fcvt.w.s of an inexact value, fcvt.wu.s of an out-of-range value, fcvtmod.w.d of a NaN).

mstatus_fs_op
mstatus_fs_vs_xs_enc
mstatus_fs_acc1
mstatus_sd_summary_op
mstatus_sd_formula
mstatus_fs_vs_xs_off_op
mstatus_fs_vs_xs_dirty_op
mstatus_fs_no_dirty_track
mstatus_fs_vs_xs_update_indep_priv
check FS becomes dirty where appropriate
instructions that set fflags must set FS to dirty even if they write no floating-point register

cp_sstatus_FS_transition_nondeterministic

Writing to the CSR field
(WARL)

Floating-point instructions that need not modify floating-point state (fsw, fmv.x.w, fclass.s, csrr of the FP CSRs, fmvh.x.d) crossed with sstatus.FS = Off and Dirty

Illegal-instruction trap when FS = Off; FS stays Dirty when Dirty. Initial and Clean are omitted because these instructions may dirty FS imprecisely.

mstatus_fs_imprecise

S_V tests (S_V_vcsr-NN.S, S_V_vset-NN.S, S_V_vl_walk-NN.S): the vector CSRs, vset{i}vl{i}, vstart and sstatus.VS from S-mode, run when Zve32x is also supported.

cp_vcsrrswc

Confirm that all vector CSR properties are properly set with regards to read write, clear, and set privileges with the csr instructions

With each of the vector CSRs conduct a read, write, clear, and set operation on the CSR

Will abide by spec’s read and write permissions for each csr

3 csr instructions * 7 CSRs

Zicsr_higher_priv
vlenb_acc_op
vcsr_vxrm_op
vcsr_vxsat_op
vcsr_vxrm_vxsat_acc
Zve32x_dependent_Zicsr

test written: yes
spec: The vector extension adds 32 vector registers, and seven unprivileged CSRs (vstart, vxsat, vxrm, vcsr, vtype, vl, vlenb) to a base scalar RISC-V ISA.
read-only CSR vlenb
The XLEN-bit-wide read-only vl CSR can only be updated by the vset{i}vl{i} instructions, and the fault-only-first vector load instruction variants.
read-only XLEN-wide vector type CSR, vtype provides the default type used to interpret the contents of the vector register file, and can only be updated by vset{i}vl{i}

cp_vcsrs_walking1s

Confirm that that all writable vector CSRs have the correct bits writeable

With each of the vector CSRs that are writable, write all XLEN 1-hot values to the csr

csrs will be updated based on which bits they support to be writable

4 CSRs * XLEN 1-hot values

mstatus_vs_op
vstart_acc_sz
vxrm_val_sz_acc
vxsat_op_acc_sz

test written: yes
spec: vstart, vxrm, vxsat, vcsr are all writable

cp_sstatus_vs_set_dirty_arithmetic

Confirm that after running an arithmetic vector instruction that sstatus.VS is set to dirty when set to "clean" or "initial"

Run a .vv vector arithmetic instruction with sstatus.VS = {clean, initial}

sstatus.VS is set to dirty

2 sstatus.VS bins

mstatus_vs_sstatus_vs_op
mstatus_fs_vs_xs_update_indep_priv
mstatus_vs_op_initial_clean

test written: yes
spec: When mstatus.VS is set to Initial or Clean, executing any instruction that changes vector state, including the vector CSRs, will change mstatus.VS to Dirty.

cp_sstatus_vs_set_dirty_csr

Confirm that after running a vsetvli instruction that sstatus.VS is set to dirty when set to "clean" or "initial"

Run a vsetvli instruction with sstatus.VS = {clean, initial}

sstatus.VS is set to dirty

2 sstatus.VS bins

mstatus_vs_op
mstatus_vs_op_initial_clean

test written: yes
spec: When mstatus.VS is set to Initial or Clean, executing any instruction that changes vector state, including the vector CSRs, will change mstatus.VS to Dirty.

Analogous to the way in which the floating-point unit is handled, the sstatus.VS field may exist even if misa.V is clear.

feature (coverpoint written): Untestable

cp_sstatus_vs_off_arithmetic

Confirm that when misa.V is 1 and sstatus.VS is off, an arithmetic vector instruction raises an illegal instruction exception

With misa.V = 1 (its reset value), set sstatus.VS = {00} and run a .vv vector instruction

illegal instruction exception

1

mstatus_vs_sstatus_vs_op
mstatus_fs_vs_xs_off_op
mstatus_vs_op_off

test written: yes, confirm sig
spec: Attempts to execute any vector instruction, or to access the vector CSRs, raise an illegal-instruction exception when mstatus.VS is set to Off.

cp_sstatus_vs_off_csr

Confirm that when misa.V is 1 and sstatus.VS is off, an csr vector instruction raises an illegal instruction exception

With misa.V = 1 (its reset value), set sstatus.VS = {00} and run a vsetvli

illegal instruction exception

1

mstatus_fs_vs_xs_off_op

test written: yes, confirm sig
spec: Attempts to execute any vector instruction, or to access the vector CSRs, raise an illegal-instruction exception when mstatus.VS is set to Off.

For implementations with a writable misa.V field, the vsstatus.VS field may exist even if misa.V is clear.

feature (coverpoint written): Untestable

Vset{i}vl{i}

cp_sew_lmul_vset_i_vli

Confirm that all combinations of lmul crossed with sew correctly set the vtype register in accordance with the vill field

Use all vset{i}vli instructions to cross eSEW={8/16/32/64} with mLMUL = {f8/f4/f2/1/2/4/8} rd and uimm can be any nonzero value

vtype.vill becomes 1 and other bits become 0 on illegal combinations, such as sew = 1xx.

2 instructions * 7 lmul bins * 4 sew bins

vtype_sz_acc_op
vtype_vsew_op
vtype_lmul_val
vtype_lmul_fval
vtype_sew_val
vset_op
vtype_vstart_op
vtype_acc

test written: yes
spec: Implementations must consider all bits of the vtype value to determine if the configuration is supported. An unsupported value in any location within the vtype value must result in vill being set. In particular, all XLEN bits of the register vtype argument to the vsetvl instruction must be checked. Implementations cannot ignore fields they do not implement. All bits must be checked to ensure that new code assuming unsupported vector features in vtype traps instead of executing incorrectly on an older implementation…​.The supported element width may vary with LMUL
The use of vtype encodings with LMUL < SEWMIN/ELEN is reserved, but implementations can set vill if they do not support these configurations.

cp_sew_lmul_vsetvl

Confirm that all combinations of lmul crossed with sew correctly set the type register in accordance with the vill field

Use vsetvl to cross rs2.sew= [3’b000:3’b011] with rs2.lmul = [000, 001, 010, 011, 101, 110, 111]. rd and uimm can be any nonzero value. Make sure rs2_val[`XLEN-1:8] = 0
rs2 must be this way to be a legal setting

vtype.vill becomes 1 and other bits become 0 on illegal combinations, such as sew = 1xx.

7 lmul bins * 4 sew bins

vtype_sz_acc_op
vtype_fields_sz
vset_op
vtype_vstart_op
vtype_acc

test written: yes
spec: Implementations must consider all bits of the vtype value to determine if the configuration is supported. An unsupported value in any location within the vtype value must result in vill being set. In particular, all XLEN bits of the register vtype argument to the vsetvl instruction must be checked. Implementations cannot ignore fields they do not implement. All bits must be checked to ensure that new code assuming unsupported vector features in vtype traps instead of executing incorrectly on an older implementation…​.The supported element width may vary with LMUL
The use of vtype encodings with LMUL < SEWMIN/ELEN is reserved, but implementations can set vill if they do not support these configurations.

cp_sew_lmul_vset_i_vli / cp_sew_lmul_vsetvl

Confirm on the supported values of lmul are recognized as legal

Use vsetivli rd, 1, sew={supported}, vlmul={supported(mf8/mf4/mf2/)m1/m2/m4/m8}, tu, mu to attempt to set all values of lmul

Expect vill is set for all values of lmul that aren’t legal, otherwise the correct lmul is set

0

feature (coverpoint written): Covered by coverpoint above
spec: Implementations must support LMUL integer values of 1, 2, 4, and 8…​.Implementations must provide fractional LMUL settings that allow the narrowest supported type to occupy a fraction of a vector register corresponding to the ratio of the narrowest supported type’s width to that of the largest supported type’s width

cp_sew_lmul_vset_i_vli / cp_sew_lmul_vsetvl

Check all values of sew to Confirm only correctly supported values are recognized as legal

Use vsetivli rd, 1, sew={e8/e16/e32/e64}, vlmul={m1}, tu, mu to attempt to set all values of lmul

Expect vill will be set when an attempted unsupported sew values are attempted to be written, otherwise vtype will contain supported sew

0

feature (coverpoint written): Covered by coverpoint above
spec: Implementations must support LMUL integer values of 1, 2, 4, and 8…​.Implementations must provide fractional LMUL settings that allow the narrowest supported type to occupy a fraction of a vector register corresponding to the ratio of the narrowest supported type’s width to that of the largest supported type’s width

cp_vill_vset_i_vli

Check that vset{i}vli instructions properly clear the vill bit when writing a valid vtype configuration

Run vsetvli and vsetivli with eSEW = {8/16/32/64} with mLMUL = {8} and vtype.vill = {1}
we set lmul to 8 to write a non-zero value to the CSR

expect vill bit is cleared and vtype written when sew is legal

2 instructions * 4 sew bins

test written: yes
spec: If the vill bit is set, then any attempt to execute a vector instruction that depends upon vtype will raise an illegal-instruction exception [except]…​.vset{i}vl{i} …​. [does] not depend upon vtype

cp_vill_vsetvl

Check that vsetvl instruction properly clears the vill bit when writing a valid vtype configuration

Run vsetvl with rs2.sew = {8/16/32/64} with rs2.lmul = {8} and vtype.vill = {1} making sure rs2_val[`XLEN-1:8] = 0
we set lmul to 8 to write a non-zero value to the CSR. rs2 must be in this manner to be a legal setting

expect vill bit is cleared and vtype written when sew is legal

4 sew bins

vtype_vill_val
vtype_vill_val_vill
vtype_vill_all_bits

test written: yes
spec: If the vill bit is set, then any attempt to execute a vector instruction that depends upon vtype will raise an illegal-instruction exception [except]…​.vset{i}vl{i} …​. [does] not depend upon vtype

cp_vill_vsetvl_rs2_vill

Check that when attempting to set a valid configuration but with the rs2.vill bit set, and the vtype.vill bit set, that the register remains all zeros besides the vill bit

Run vsetvl with rs2.sew = {8/16/32/64} with vtype.lmul = {8} and vtype.vill = {1} making sure rs2_val[`XLEN-2:8] = 0 and rs2[XLEN-1] = 1
we set lmul to 8 to attempt to write a non-zero value to the CSR. rs2 must be in this manner to be a legal setting.

vtype register remains unchanged

4 sew bins

test written: yes
spec: If the vill bit is set, then any attempt to execute a vector instruction that depends upon vtype will raise an illegal-instruction exception [except]…​.vset{i}vl{i} …​. [does] not depend upon vtype

cp_vsetvl_rs2_vill

Confirm that with vsetvl if rs2 has the vill bit set that it is treated as an unsupported configuration

run a vsetvl with rs2[XLEN-1] = 1, rs2[XLEN-2:8]=0 and rs2.sew = {supported} and rs2.lmul = 1 and vtype.vill = {0}
sew must be supported and rs2[XLEN-2:8] zero to verify the configuration is illegal due to the vill bit being set

vill bit should be set

spec: A vtype value with vill set is treated as an unsupported configuration.

cp_vset_vill

Confirm that writing 1 to vill clears other bits of vtype

Set rs1 nonzero, rs1 = 1 in XLEN-1, 11 in 7:6 (vma/vta). vsetvl rd, rs1, rs2 and vtype.vill = {0}

vtype.vill becomes 1 and other bits become 0

1

feature (coverpoint written): covered by coverpoint above
spec: When the vill bit is set, the other XLEN-1 bits in vtype shall be zero.

cp_vtype_vill_set_vl_0

Confirm that if an unsupported configuration is set, that vl is set to zero

Run vsetvl with rs1 non-zero and rs2 vill bit set and vl =! 0

vl should be set to zero

1

vtype_lmul_fval_rsv
vtype_vstart_op

test written: yes
spec: If the vtype value is not supported by the implementation, then the vill bit is set in vtype, the remaining bits in vtype are set to zero, and the vl register is also set to zero.

cp_vsetvl_i_rd_nx0_rs1_x0

Confirm that when running a vsetvl or vsetvli instruction with rd != x0 and rs1 = x0 that vl is set to vlmax

with vl != vlmax, conduct vsetvl and vsetvli with rd != x0 and rs1 = x0. Cross with sew = {8/16/32/64} and respective supported lmul {supported(f8,f4,f2,)1,2,4,8}
we want vl != vlmax since similar syntax leaves vl unmodified.

vl csr is set to vlmax

2 instructions * 4 sew bins * 7 lmul bins

vl_acc
vsetvl_op
vsetvl_op_rs1_x0_rd_nx0

test written: yes
spec: When rs1=x0 but rd≠x0, the maximum unsigned integer value (~0) is used as the AVL, and the resulting VLMAX is written to vl and also to the x register specified by rd.

cp_vsetvl_i_rd_x0_rs1_x0

Confirm that when running a vsetvl or vsetvli instruction with rd = x0 and rs1 = x0 that vl is unchanged

with vl != 0, conduct vsetvl and vsetvli with rd = x0 and rs1 = x0. sew and lmul must be such that vlmax does not change
vlmax must not change for the instruction to not be reserved.

vl is unchanged

2

vsetvl_op
vsetvl_op_rs1_x0_rd_x0

test written: yes
spec: When rs1=x0 and rd=x0, the instruction operates as if the current vector length in vl is used as the AVL, and the resulting value is written to vl, but not to a destination register. This form can only be used when VLMAX and hence vl is not actually changed by the new SEW/LMUL ratio.

AVL

cp_vsetvl_i_avl_eq_zero

Confirm that vsetvl{i} instructions follow vl requirements when avl is zero

Run vsetvli and vsetvl with rs1 = 0

vl = 0

1

vsetvl_op
vl_val_lead_in
vl_val_list

test written: yes
spec: The vset{i}vl{i} instructions first set VLMAX according to their vtype argument, then set vl obeying the following constraints:
These specific properties follow from the prior rules: vl = 0 if AVL = 0

cp_vsetvl_i_avl_eq_vlmax

Confirm that vsetvl{i} instructions follow avl requirements when equal to vlmax

Run vsetvli and vsetvl with rs1 = vlmax

vl = avl

1

vset_op
vsetvl_op
vl_val_lead_in
vl_val_list

test written: yes
spec: The vset{i}vl{i} instructions first set VLMAX according to their vtype argument, then set vl obeying the following constraints:
vl = AVL if AVL ≤ VLMAX

cp_vsetvl_i_avl_lt_2x_vlmax

Confirm that vsetvl{i} instructions follow avl requirements when greater than vlmax and less than equal to 2*vlmax (if avl is less than 2* vlmax)

Run vsetvli and vsetvl with vlmax < rs1 < 2 *vlmax

ceil(AVL / 2) ≤ vl ≤ VLMAX

1

vsetvl_op
vl_val_lead_in
vl_val_list

test written: yes, is a chance that sig don’t match
spec: The vset{i}vl{i} instructions first set VLMAX according to their vtype argument, then set vl obeying the following constraints:
ceil(AVL / 2) ≤ vl ≤ VLMAX if AVL < (2 * VLMAX)

cp_vsetvl_i_avl_eq_2x_vlmax

Confirm that vsetvl{i} instructions follow avl requirements when greater than 2 * vlmax (when avl is greater than equal to 2 * vlmax)

Run vsetvli and vsetvl with rs1 ≥ 2 *vlmax

vl = VLMAX

1

vsetvl_op

test written: yes
spec: The vset{i}vl{i} instructions first set VLMAX according to their vtype argument, then set vl obeying the following constraints:
vl = VLMAX if AVL ≥ (2 * VLMAX)

cp_vsetvl_i_avl_gt_2x_vlmax

Confirm that vsetvl{i} instructions follow avl requirements when greater than 2 * vlmax (when avl is greater than equal to 2 * vlmax)

Run vsetvli and vsetvl with rs1 ≥ 2 *vlmax

vl = VLMAX

1

vsetvl_op
vl_val_lead_in
vl_val_list

test written: yes
spec: The vset{i}vl{i} instructions first set VLMAX according to their vtype argument, then set vl obeying the following constraints:
vl = VLMAX if AVL ≥ (2 * VLMAX)

cp_vsetivli_avl_edges

Confirm that vsetivli abides by the avl corners

Run vsetivli with all values of imm = {[0:31]} with sew = {all_supported} and lmul = 1

Abides by avl rules depending on

4 sew bins * 32 imm bins

vset_op
vsetivli_op

test written: yes
spec: The vset{i}vl{i} instructions first set VLMAX according to their vtype argument, then set vl obeying the following constraints:

vstart

cp_vstart_out_of_bounds

Confirm that the vstart CSR only has enough writeable bits to hold the largest element index (2^16-1)

conduct a csr write with rs1 = 2^16 on the vstart register

Not defined in spec, either vstart takes the bottom bits or sets to vlmax-1

1

vstart_acc_sz
vstart_sz_writable

test written: yes
spec: The vstart CSR is defined to have only enough writable bits to hold the largest element index (one less than the maximum VLMAX). Try to write a number greater than what is legal

cp_sew_illegal

Cannot set SEW < 8, all set SEW must be powers of 2 (can accomplish this by looping and setting sew of 2x until vill bit is set and then confirm that vill bit is set whenever setting a non power of 2 sew in that range)

feature (coverpoint written): can’t be tested

cp_vl_walking1s_sew_lmul

Confirm that all vl CSR bit fields are correctly set for all combinations of sew and lmul (thus all VLMAX)

Running the vsetvli instruction, cross all sew = {8/16/32/64} lmul = {f8, f4,f2, 1, 2, 4, 8} with rs1 ={XLEN 1-hot values}
This is done by conducting a vsetivli every time followed by a walking one csr write to ensure the target sew and lmul were attempted to be written

vl register will be set in accordance with vlmax

4sew * 7 lmul * XLEN 1-hot values

cp_vlen_illegal

Cannot set VLEN greater than 2^16, can check vl with eew = 8

vsetvli rs1={0, 1, 2, 3, 4, 7, 8, 9, 16, 32, 64…​ 2^16}
corners: (rs1 - 1)

feature (coverpoint written): covered by csr writing tests

The vector extension must have a consistent state at reset. In particular, vtype and vl must have values that can be read and then restored with a single vsetvl instruction. (make sure reset is called)

feature (coverpoint written): untestable

S_VF tests (S_VF-NN.S): vector floating-point instructions and sstatus.FS from S-mode, run when Zve32f is also supported.

It should be understood that for most coverpoints that are based on arithmetic instructions, the coverpoints will check to make sure they’re non-trivial, meaning that vl != 0, vstart=0, vill=0, and they do not trap. It may be useful to know that when using vsetvl{i} instructions if rd != x0 and rs1 = x0, vl = vlmax

cp_vectorfp_sstatus_fs_state_affecting_register

Confirm vector floating point instructions set sstatus.FS to dirty when modifying floating point register state

Set sstatus.FS = {initial/clean} and run a fd writing instruction

sstatus.FS is set to dirty

1

mstatus_fs_dirty_V_fp

spec: Any vector floating-point instruction that modifies any floating-point extension state (i.e., floating-point CSRs or f registers) must set mstatus.FS to Dirty.

cp_vectorfp_sstatus_fs_state_affecting_csr

Confirm vector floating point instructions set sstatus.FS to dirty when modifying floating point csr state

Set sstatus.FS = {initial/clean} and run an instruction that would raise a fp flag after clearing the fp flags (vfdiv.vv divide by zero, vfadd.vv inf + -inf, and vmflt.vv with a NaN operand, which writes only a mask register)

sstatus.FS is set to dirty

1

spec: Any vector floating-point instruction that modifies any floating-point extension state (i.e., floating-point CSRs or f registers) must set mstatus.FS to Dirty.

cp_vectorfp_sstatus_fs_state_nonaffecting

Confirm vector floating point instructions properly set sstatus.FS when not modifying floating point state

Set sstatus.FS = {initial/clean} and run a vector fp instruction that does not affect floating point state (chosen situation for coverpoint is a .vv ins where vs1 = vs2 = 0)

sstatus.FS may be set to dirty or not depending on implementation

1

spec: Any vector floating-point instruction that modifies any floating-point extension state (i.e., floating-point CSRs or f registers) must set mstatus.FS to Dirty.

cp_vectorfp_sstatus_fs_off

Confirm that vector floating point instructions (even if they dont modify fp state) raise an illegal instruction exception if sstatus.FS is set to off

Set sstatus.FS = {off} and run a vector fp instruction that does not affect floating point state (chosen situation for coverpoint is a .vv ins where vs1 = vs2 = 0)

illegal instruction exception

1

spec: If the floating-point unit status field mstatus.FS is Off then any attempt to execute a vector floating-point instruction will raise an illegal instruction exception.

Table 170. S Normative Rules
Normative Rule Rule Text Coverpoints

sstatus

The sstatus register is an SXLEN-bit read/write register formatted as shown in sstatusreg-rv32 when SXLEN=32 and sstatusreg when SXLEN=64. The sstatus register keeps track of the processor’s current operating state.

S_scsr_cg/cp_scsr_access/sstatus, S_scsr_cg/cp_scsrwalk/sstatus

sstatus_spp

The SPP bit indicates the privilege level at which a hart was executing before entering supervisor mode. When a trap is taken, SPP is set to 0 if the trap originated from user mode, or 1 otherwise. When an SRET instruction (see otherpriv) is executed to return from the trap handler, the privilege level is set to user mode if the SPP bit is 0, or supervisor mode if the SPP bit is 1; SPP is then set to 0.

S_sprivinst_cg/cp_sret_s, Sm_mprivinst_cg/cp_sret_s (sweep with mstatus.TSR, runs in Sm)

sstatus_sie

The SIE bit enables or disables all interrupts in supervisor mode. When SIE is clear, interrupts are not taken while in supervisor mode. When the hart is running in user-mode, the value in SIE is ignored, and supervisor-level interrupts are enabled. The supervisor can disable individual interrupt sources using the sie CSR.

InterruptsS_cg/{cp_trigger, cp_enable_zero}

sstatus_spie

The SPIE bit indicates whether supervisor interrupts were enabled prior to trapping into supervisor mode. When a trap is taken into supervisor mode, SPIE is set to SIE, and SIE is set to 0. When an SRET instruction is executed, SIE is set to SPIE, then SPIE is set to 1.

InterruptsS_cg/cp_trigger_tsbi, Exceptions_Sm_cg/cp_medeleg_msu_illegalinstruction, S_sprivinst_cg/cp_sret_s, Sm_mprivinst_cg/cp_sret_s

sstatus_subset_mstatus

The sstatus register is a subset of the mstatus register.

Sm_mcsr_cg/cp_shadow

sstatus_uxl

The UXL field controls the value of XLEN for U-mode, termed UXLEN, which may differ from the value of XLEN for S-mode, termed SXLEN. The encoding of UXL is the same as that of the MXL field of misa, shown in norm:misa_mxl_enc.

Ssu64xl_cg/cp_ssu64xl

sstatus_uxl_sz

When SXLEN=32, the UXL field does not exist, and UXLEN=32. When SXLEN=64, it is a WARL field that encodes the current value of UXLEN. In particular, an implementation may make UXL be a read-only field whose value always ensures that UXLEN=SXLEN.

S_sstatus_cg/cp_sxlen_ge_uxlen

sstatus_uxl_behavior

If UXLEN≠SXLEN, instructions executed in the narrower mode must ignore source register operand bits above the configured XLEN, and must sign-extend results to fill the widest supported XLEN in the destination register.

Not tested: ACT does not run U-mode with UXLEN different from SXLEN

sstatus_uxl_addr_modulo

If UXLEN < SXLEN, user-mode instruction-fetch addresses and load and store effective addresses are taken modulo 2UXLEN.

Not tested: ACT does not run U-mode with UXLEN different from SXLEN

hint_sxlen

Some HINT instructions are encoded as integer computational instructions that overwrite their destination register with its current value, e.g., c.addi x8, 0. When such a HINT is executed with XLEN < SXLEN and bits SXLEN..XLEN of the destination register not all equal to bit XLEN-1, it is implementation-defined whether bits SXLEN..XLEN of the destination register are unchanged or are overwritten with copies of bit XLEN-1.

Not tested: ACT does not run U-mode with UXLEN different from SXLEN

sstatus_sum_satp_mode

SUM is read-only 0 if satp.MODE is read-only 0.

S_scsr_cg/cp_scsrwalk

stvec

The stvec register is an SXLEN-bit read/write register that holds trap vector configuration, consisting of a vector base address (BASE) and a vector mode (MODE).

S_scsr_cg/{cp_stvec_vaddr_pc, cp_stvec_vaddr_scratch}

stvec_img

S_scsr_cg/{cp_stvec_vaddr_walk1, cp_stvec_vaddr_walk0}

stvec_op

The BASE field in stvec is a WARL field that can hold any valid virtual or physical address, subject to the following alignment constraints: the address must be 4-byte aligned, and MODE settings other than Direct might impose additional alignment constraints on the value in the BASE field.

S_scsr_cg/cp_stvec_vaddr_walk1, S_scsr_cg/cp_stvec_vaddr_walk0, S_scsr_cg/cp_stvec_vaddr_pc, S_scsr_cg/cp_stvec_vaddr_scratch

stvec_sz_base

Note that the CSR contains only bits XLEN-1 through 2 of the address BASE. When used as an address, the lower two bits are filled with zeroes to obtain an XLEN-bit address that is always aligned on a 4-byte boundary.

S_scsr_cg/{cp_stvec_vaddr_walk1, cp_stvec_vaddr_walk0}, Exceptions_S_cg/cp_stvec

stvec_mode_enc

Value|Name|Description === 0 1 ≥2|Direct Vectored|All exceptions set pc to BASE. Asynchronous interrupts set pc to BASE+4×cause. Reserved ===

Exceptions_S_cg/cp_stvec (Direct), TODO: S-mode interrupts with stvec.MODE=Vectored, and a write of a reserved MODE value

sip_sie

The sip register is an SXLEN-bit read/write register containing information on pending interrupts, while sie is the corresponding SXLEN-bit read/write register containing interrupt enable bits. Interrupt cause number i (as reported in CSR scause, scause) corresponds with bit i in both sip and sie. Bits 15:0 are allocated to standard interrupt causes only, while bits 16 and above are designated for platform use.

S_scsr_cg/cp_scsrwalk, InterruptsS_cg/cp_priority_sip

sie_sip_supervisor_strap

An interrupt i will trap to S-mode if both of the following are true: (a) either the current privilege mode is S and the SIE bit in the sstatus register is set, or the current privilege mode has less privilege than S-mode; and (b) bit i is set in both sip and sie.

InterruptsS_cg/{cp_trigger, cp_enable_one, cp_enable_zero}

sie_sip_strap_time_constraint

These conditions for an interrupt trap to occur must be evaluated in a bounded amount of time from when an interrupt becomes, or ceases to be, pending in sip, and must also be evaluated immediately following the execution of an SRET instruction or an explicit write to a CSR on which these interrupt trap conditions expressly depend (including sip, sie and sstatus).

TODO

s_interrupt_priority

Interrupts to S-mode take priority over any interrupts to lower privilege modes.

TODO: move to hypervisor VS interrupts

sip_acc

Each individual bit in register sip may be writable or may be read-only.

S_scsr_cg/cp_scsrwalk/sip

sip_op

When bit i in sip is writable, a pending interrupt i can be cleared by writing 0 to this bit. If interrupt i can become pending but bit i in sip is read-only, the implementation must provide some other mechanism for clearing the pending interrupt (which may involve a call to the execution environment).

InterruptsS_cg/cp_trigger_reg_sip_ssip

sie_acc

A bit in sie must be writable if the corresponding interrupt can ever become pending. Bits of sie that are not writable are read-only zero.

S_scsr_cg/cp_scsrwalk/sie, InterruptsS_cg/cp_priority_sie

sip_sie_bits_sz

The standard portions (bits 15:0) of registers sip and sie are formatted as shown in Figures sipreg-standard and siereg-standard respectively.

S_scsr_cg/cp_scsrwalk/sie

sip_seip_sie_seie

Bits sip.SEIP and sie.SEIE are the interrupt-pending and interrupt-enable bits for supervisor-level external interrupts. If implemented, SEIP is read-only in sip, and is set and cleared by the execution environment, typically through a platform-specific interrupt controller.

S_scsr_cg/cp_scsrwalk/sip, InterruptsS_cg/cp_trigger

sip_stip_sie_stie

Bits sip.STIP and sie.STIE are the interrupt-pending and interrupt-enable bits for supervisor-level timer interrupts. If implemented, STIP is read-only in sip. When the Sstc extension is not implemented, STIP is set and cleared by the execution environment. When the Sstc extension is implemented, STIP reflects the timer interrupt signal resulting from stimecmp. The sip.STIP bit, in response to timer interrupts generated by stimecmp, is set by writing stimecmp with a value that is less than or equal to time, and is cleared by writing stimecmp with a value greater than time.

S_scsr_cg/cp_scsrwalk/sip, InterruptsS_cg/{cp_trigger, cp_trigger_sti_sstc}

mip_sip_stip_op

A supervisor timer interrupt becomes pending, as reflected in the STIP bit in the mip and sip registers whenever time contains a value greater than or equal to stimecmp, treating the values as unsigned integers. If the result of this comparison changes, it is guaranteed to be reflected in STIP eventually, but not necessarily immediately. The interrupt remains posted until stimecmp becomes greater than time, typically as a result of writing stimecmp. The interrupt will be taken based on the standard interrupt enable and delegation rules.

S_scsr_cg/cp_scsrwalk/sip, InterruptsS_cg/cp_trigger_sti_sstc

sip_ssip_sie_ssie

Bits sip.SSIP and sie.SSIE are the interrupt-pending and interrupt-enable bits for supervisor-level software interrupts. If implemented, SSIP is writable in sip and may also be set to 1 by a platform-specific interrupt controller.

S_scsr_cg/cp_scsrwalk/sip, InterruptsS_cg/{cp_trigger, cp_trigger_reg_sip_ssip}

std_super_intr_impl

Each standard interrupt type (SEI, STI, SSI, or LCOFI) might not be implemented, in which case the corresponding interrupt-pending and interrupt-enable bits are read-only zeros.

S_scsr_cg/cp_scsr_access/{sie, sip}

sip_sie_warl

All bits in sip and sie are WARL fields.

S_scsr_cg/{cp_scsr_access, cp_scsrwalk}

sip_sie_priority_bit_order

Multiple simultaneous interrupts destined for supervisor mode are handled in the following decreasing priority order: SEI, SSI, STI, LCOFI.

InterruptsS_cg/{cp_priority_sip, cp_priority_sie}

supervisor_timer_scheduling

The implementation must provide a facility for scheduling timer interrupts in terms of the real-time counter, time.

OUT-OF-SCOPE: too vague if handled by software setting STIP. Tested by InterruptsS_cg/cp_trigger_sti_sstc when Sstc implemented

sscratch

The sscratch CSR is an SXLEN-bit read/write register, dedicated for use by the supervisor.

S_scsr_cg/cp_scsr_access/sscratch

sepc

sepc is an SXLEN-bit read/write CSR formatted as shown in epcreg. The low bit of sepc (sepc[0]) is always zero. On implementations that support only IALIGN=32, the two low bits (sepc[1:0]) are always zero.

S_scsr_cg/cp_scsr_access/sepc

sepc_op_mask_ialign32

If an implementation allows IALIGN to be either 16 or 32 (by changing CSR misa, for example), then, whenever IALIGN=32, bit sepc[1] is masked on reads so that it appears to be 0. This masking occurs also for the implicit read by the SRET instruction. Though masked, sepc[1] remains writable when IALIGN=32.

Sm_mcsr_cg/{cp_sepc_ialign32_read, cp_sepc_ialign32_sret}

sepc_acc_invalid_addr

sepc is a WARL register that must be able to hold all valid virtual addresses. It need not be capable of holding all possible invalid addresses. Prior to writing sepc, implementations may convert an invalid address into some other invalid address that sepc is capable of holding.

S_scsr_cg/cp_sepc_vaddr_walk1, S_scsr_cg/cp_sepc_vaddr_walk0

sepc_op_trap_write

When a trap is taken into S-mode, sepc is written with the virtual address of the instruction that was interrupted or that encountered the exception. Otherwise, sepc is never written by the implementation, though it may be explicitly written by software.

Exceptions_S_cg/cp_illegal_instruction, InterruptsS_cg/cp_trigger

scause

The scause CSR is an SXLEN-bit read-write register formatted as shown in scausereg. When a trap is taken into S-mode, scause is written with a code indicating the event that caused the trap. Otherwise, scause is never written by the implementation, though it may be explicitly written by software.

S_scause_cg/{cp_scause_write_exception, cp_scause_write_interrupt}, Exceptions_S_cg/cp_illegal_instruction, InterruptsS_cg/cp_trigger

scause_interrupt

The Interrupt bit in the scause register is set if the trap was caused by an interrupt. The Exception Code field contains a code identifying the last exception or interrupt. norm:scause_exccode_enc_tbl lists the possible exception codes for the current supervisor ISAs. The Exception Code is a WLRL field. It is required to hold the values 0–31 (i.e., bits 4–0 must be implemented), but otherwise it is only guaranteed to hold supported exception codes.

S_scause_cg/cp_scause_write_{interrupt, exception}, Exceptions_S_cg/cp_illegal_instruction, InterruptsS_cg/cp_trigger

scause_exception_code_acc

The Exception Code is a WLRL field.

S_scause_cg/cp_scause_write_{interrupt, exception}

scause_exception_code_sz

It is required to hold the values 0–31 (i.e., bits 4–0 must be implemented), but otherwise it is only guaranteed to hold supported exception codes.

S_scause_cg/cp_scause_write_{interrupt, exception}, Sm_mcsr_cg/cp_scause_from_m

scause_exccode_enc_tbl

Interrupt|Exception Code|Description === 1 1 1 1 1 1 1 1 1 1|0 1 2-4 5 6-8 9 10-12 13 14-15 ≥16|Reserved Supervisor software interrupt Reserved Supervisor timer interrupt Reserved Supervisor external interrupt Reserved Counter-overflow interrupt Reserved Designated for platform use¶0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0|0 1 2 3 4 5 6 7 8 9 10-11 12 13 14 15 16-17 18 19 20-23 24-31 32-47 48-63 ≥64|Instruction address misaligned Instruction access fault Illegal instruction Breakpoint Load address misaligned Load access fault Store/AMO address misaligned Store/AMO access fault Environment call from U-mode Environment call from S-mode Reserved Instruction page fault Load page fault Reserved Store/AMO page fault Reserved Software check Hardware error Reserved Designated for custom use Reserved Designated for custom use Reserved ===

S_scause_cg/{cp_scause_write_exception, cp_scause_write_interrupt}, Exceptions_S_cg/{cp_illegal_instruction, cp_breakpoint}

stval

The stval CSR is an SXLEN-bit read-write register formatted as shown in stvalreg. When a trap is taken into S-mode, stval is written with exception-specific information to assist software in handling the trap. Otherwise, stval is never written by the implementation, though it may be explicitly written by software. The hardware platform will specify which exceptions must set stval informatively, which may unconditionally set it to zero, and which may exhibit either behavior, depending on the underlying event that caused the exception.

S_scsr_cg/cp_scsr_access/stval, Exceptions_S_cg/cp_illegal_instruction

stval_op_faulting_addr

If stval is written with a nonzero value when a breakpoint, address-misaligned, access-fault, page-fault, or hardware-error exception occurs on an instruction fetch, load, or store, then stval will contain the faulting virtual address.

Exceptions_S_cg/{cp_breakpoint, cp_load_address_misaligned, cp_instr_access_fault, cp_store_access_fault}

stval_op_breakpoint

On a breakpoint exception raised by an EBREAK or C.EBREAK instruction, stval is written with either zero or the virtual address of the instruction.

Exceptions_S_cg/cp_breakpoint

stval_op_load_store_fault

If stval is written with a nonzero value when a misaligned load or store causes an access-fault, page-fault, or hardware-error exception, then stval will contain the virtual address of the portion of the access that caused the fault.

TODO: write coverpoints for misaligned loads that wrap PMA/PMP/page boundaries to cause faults on upper part of access

stval_faulting_address_variable_instr

If stval is written with a nonzero value when an instruction access-fault, page-fault, or hardware-error exception occurs on a hart with variable-length instructions, then stval will contain the virtual address of the portion of the instruction that caused the fault, while sepc will point to the beginning of the instruction.

stval_op_illegal_instr

The stval register can optionally also be used to return the faulting instruction bits on an illegal-instruction exception (sepc points to the faulting instruction in memory). If stval is written with a nonzero value when an illegal-instruction exception occurs, then stval will contain the shortest of:

Exceptions_S_cg/cp_illegal_instruction

stval_op_illegal_instr_format

On an illegal-instruction exception, the instruction bits are zero-extended and loaded into stval.

Exceptions_Zc_cg/cp_illegal_instruction, Ssstrict_S_comp_instr_cg/cp_compressed00

stval_op_other_traps

For other traps, stval is set to zero, but a future standard may redefine stval’s setting for other traps.

InterruptsS_cg/cp_trigger

stval_acc

stval is a WARL register that must be able to hold all valid virtual addresses and the value 0. It need not be capable of holding all possible invalid addresses.

S_scsr_cg/cp_stval_vaddr_walk1, S_scsr_cg/cp_stval_vaddr_walk0

stval_inv_addr_conv

Prior to writing stval, implementations may convert an invalid address into some other invalid address that stval is capable of holding.

Not tested: the tests write only valid addresses to stval

stval_instr_bits_sz

If the feature to return the faulting instruction bits is implemented, stval must also be able to hold all values less than 2N, where N is the smaller of SXLEN and ILEN.

S_scsr_cg/{cp_stval_ilen_walk1, cp_stval_ilen_ones}

senvcfg

The senvcfg CSR is an SXLEN-bit read/write register, formatted as shown in senvcfg, that controls certain characteristics of the U-mode execution environment.

S_scsr_cg/cp_scsr_access/senvcfg

senvcfg_fiom

If bit FIOM (Fence of I/O implies Memory) is set to one in senvcfg, FENCE instructions executed in U-mode are modified so the requirement to order accesses to device I/O implies also the requirement to order main memory accesses. norm:senvcfg_fiom_fence_presuc_op details the modified interpretation of FENCE instruction bits PI, PO, SI, and SO in U-mode when FIOM=1.

S_scsr_cg/cp_scsr_access/senvcfg

senvcfg_fiom_op_atomic

Similarly, for U-mode when FIOM=1, if an atomic instruction that accesses a region ordered as device I/O has its aq and/or rl bit set, then that instruction is ordered as though it accesses both device I/O and memory.

Not tested: I/O ordering is not observable in single-hart signature tests

senvcfg_fiom_acc

If satp.MODE is read-only zero (always Bare), the implementation may make FIOM read-only zero.

S_scsr_cg/cp_scsr_access/senvcfg

senvcfg_fiom_fence_presuc_op

Instruction bit|Meaning when set === PI PO|Predecessor device input and memory reads (PR implied) Predecessor device output and memory writes (PW implied)¶SI SO|Successor device input and memory reads (SR implied) Successor device output and memory writes (SW implied) ===

Not tested: I/O ordering is not observable in single-hart signature tests

senvcfg_cbze_rdonly0

When the Zicboz extension is not implemented, CBZE is read-only zero.

S_scsr_cg/cp_scsrwalk/senvcfg (configurations without Zicboz)

senvcfg_cbcfe_rdonly0

When the Zicbom extension is not implemented, CBCFE is read-only zero.

S_scsr_cg/cp_scsrwalk/senvcfg (configurations without Zicbom)

senvcfg_cbie_rsv

The encoding 0b10 is reserved.

S_scsr_cg/cp_scsrwalk/senvcfg (the walk writes CBIE=0b10)

senvcfg_cbie_rdonly0

When the Zicbom extension is not implemented, CBIE is read-only zero.

S_scsr_cg/cp_scsrwalk/senvcfg (configurations without Zicbom)

Zicsr_higher_priv

although CSRs and instructions are associated with one privilege level, they are also accessible at all higher privilege levels.

Sm_mcsr_cg/cp_scsr_from_m, S_scsr_cg/cp_ucsr_from_s, Sm_F_cg/cp_fcsr_access, S_F_cg/cp_fcsr_access, H_F_cg/cp_fcsr_access, Sm_V_cg/cp_vcsrrswc, S_V_cg/cp_vcsrrswc, H_V_cg/cp_vcsrrswc

Zicsr_rw

The top two bits (csr[11:10]) indicate whether the register is read/write (00,01, or 10) or read-only (11).

S_scsr_cg/cp_csr_ro

Zicsr_access

The next two bits (csr[9:8]) encode the lowest privilege level that can access the CSR, with the pattern 10 representing hypervisor CSRs.

S_scsr_cg/cp_csr_insufficient_priv

Zicsr_illegal_mode

Attempts to access a CSR address without sufficient privilege raise illegal-instruction exceptions or, as described in sec:hcauses, virtual-instruction exceptions.

S_scsr_cg/cp_csr_insufficient_priv

Zicsr_illegal_acc

Attempts to write a read-only CSR address raise illegal-instruction exceptions.

S_scsr_cg/cp_csr_ro

Zicsr_write_ro

A read/write register might also contain some bits that are read-only, in which case writes to the read-only bits are ignored.

S_scsr_cg/cp_scsr_access checks this if applicable

Zicsr_wpri_roz

For forward compatibility, implementations that do not furnish these fields must make them read-only zero. These fields are labeled WPRI in the register descriptions.

S_scsr_cg/cp_scsr_access (e.g. sstatus)

Zicsr_wlrl

Software should not write anything other than legal values to such a field, and should not assume a read will return a legal value unless the last write was of a legal value, or the register has not been written since another operation (e.g., reset) set the register to a legal value. These fields are labeled WLRL in the register descriptions.

S_scause_cg/{cp_scause_write_exception, cp_scause_write_interrupt}

Zicsr_wlrl_exception

Implementations are permitted but not required to raise an illegal-instruction exception if an instruction attempts to write a non-supported value to a WLRL field.

Not tested: the exception is optional, so no result is wrong

Zicsr_warl

Implementations will not raise an exception on writes of unsupported values to a WARL field.

S_scsr_cg/cp_scsr_access

ecall_service_request_op

The ECALL instruction is used to make a service request to the execution environment.

S_sprivinst_cg/cp_sprivinst ecall bin

ecall_priv_mode_op

The ECALL instruction is used to make a request to the supporting execution environment. When executed in U-mode, S-mode, or M-mode, it generates an environment-call-from-U-mode exception, environment-call-from-S-mode exception, or environment-call-from-M-mode exception, respectively, and performs no other operation.

S_sprivinst_cg/cp_sprivinst ecall bin

ebreak_debug_env_op

The EBREAK instruction is used to return control to a debugging environment.

S_sprivinst_cg/cp_sprivinst ebreak bin

ebreak_debugger_transfer_op

The EBREAK instruction is used by debuggers to cause control to be transferred back to a debugging environment. Unless overridden by an external debug environment, EBREAK raises a breakpoint exception and performs no other operation.

S_sprivinst_cg/cp_sprivinst ebreak bin

xret_in_lower_mode

Attempting to execute an xRET instruction in a mode less privileged than x will raise an illegal-instruction exception.

S_sprivinst_cg/cp_sprivinst mret bin

sret_presence

SRET must be provided if supervisor mode is supported, and should raise an illegal-instruction exception otherwise.

S_sprivinst_cg/cp_sret_s

sret_ill_inst_exc_rst

SRET should also raise an illegal-instruction exception when TSR=1 in mstatus, as described in virt-control.

Sm_mprivinst_cg/cp_sret_s

xret_op

In addition to manipulating the privilege stack as described in privstack, xRET sets the pc to the value stored in the xepc register.

S_sprivinst_cg/cp_sret_s

sfence_vma_op

The supervisor memory-management fence instruction SFENCE.VMA is used to synchronize updates to in-memory memory-management data structures with current execution. Instruction execution causes implicit reads and writes to these data structures; however, these implicit references are ordinarily not ordered with respect to explicit loads and stores.

S_sprivinst_cg/cp_sprivinst sfence_vma bin

scounteren

The counter-enable (scounteren) CSR is a 32-bit register that controls the availability of the hardware performance monitoring counters to U-mode.

S_scsr_cg/cp_scsr_access

scounteren_acc

scounteren must be implemented. However, any of the bits may be read-only zero, indicating reads to the corresponding counter will cause an exception when executing in U-mode. Hence, they are effectively WARL fields.

S_Zicntr_cg/cp_scounteren_access_u

scounteren_op

When the CY, TM, IR, or HPMn bit in the scounteren register is clear, attempts to read the cycle, time, instret, or hpmcountern register while executing in U-mode will cause an illegal-instruction exception. When one of these bits is set, access to the corresponding register is permitted.

S_Zicntr_cg/{cp_scounteren_access_u, cp_mscounteren_access_u}

mcounteren_inc_inaccessible

The settings in this register only control accessibility. The act of reading or writing this register does not affect the underlying counters, which continue to increment even when not accessible.

S_Zicntr_cg/cp_mcounter_inc_inaccessible

ecall_ebreak_no_minstret_inc

As ECALL and EBREAK cause synchronous exceptions, they are not considered to retire, and should not increment the minstret CSR.

S_Zicntr_cg/{cp_instret_ecall, cp_instret_ebreak}

UDB Parameters: None.

sie_sip_strap_time_constraint is not tested yet. How to handle timing constraints in certification? How to handle interrupts that don’t get evaluated immediately after the macro sets them? The macro could spin until they fire, but needs to know if they should fire (e.g. not blocked by xstatus.xIE).

B.1.3. U User-Mode CSRs and Instructions

These test additional CSRs that exist in user mode, and privileged instructions in user mode. The U suite also contains the U_F, U_V, and U_VF tests, which repeat the Sm_F, Sm_V, and Sm_VF tests from user mode when F, Zve32x, or Zve32f is also supported, setting and reading sstatus.FS and sstatus.VS through T-SBI calls (mstatus when S-mode is not supported). The U_Zicntr group runs when Zicntr is also supported. It reads the counters from U-mode under walking mcounteren values, and checks instret across retiring instructions, exceptions and interrupts.

Table 171. U Coverpoints
Coverpoint Goal Feature Description Expectation Bins Normative Rule Notes

cp_uprivinst

Execute ecall and ebreak, mret, uret in user mode

non_priv_exc
ecall_service_request_op
ecall_priv_mode_op
ebreak_debug_env_op
ebreak_debugger_transfer_op
xret_in_lower_mode
sret_presence
ecall throws environment call. ebreak throws breakpoint. mret and sret throw illegal instructions.

cp_csr_insufficient_priv

Read Machine, Hypervisor, Supervisor CSRS100-3FF, 500-7FF, 900-BFF, D000-FFF

H_vscsrs_acc_m_hs
mtval2_sz_acc_op
mtinst_sz_acc_op
H_vscsrs_acc_u
non_priv_exc
Zicsr_access
Zicsr_illegal_mode

cp_csr_ro

Write User read-only CSRs C00-CFF

Zicsr_rw
Zicsr_illegal_acc

User-mode access to the F and V CSRs is tested in the U_F and U_V rows below, and to the counters in Zicntr and Zihpm.

U_F tests (U_F-NN.S): the floating-point CSRs and xstatus.FS from U-mode, run when F is also supported. xstatus.FS is written and read through T-SBI, in sstatus when S-mode is supported and otherwise in mstatus.

cp_fcsr_access

Writing to the CSR field
(WARL)

Write 0s and 1s to fcsr, frm, fflags cross with mstatus.FS init/clean/dirty

mstatus_fs_vs_xs_off_op
mstatus_fs_vs_xs_dirty_op

cp_mstatus_FS_transition

Writing to the CSR field
(WARL)

Each different type of floating-point instruction crossed with four values of FS. Includes integer-result instructions that raise a flag after fflags is cleared (feq.s with a signaling NaN, fcvt.w.s of an inexact value, fcvt.wu.s of an out-of-range value, fcvtmod.w.d of a NaN).

mstatus_fs_op
mstatus_fs_vs_xs_enc
mstatus_fs_acc1
mstatus_sd_summary_op
mstatus_sd_formula
mstatus_fs_vs_xs_off_op
mstatus_fs_vs_xs_dirty_op
mstatus_fs_no_dirty_track
mstatus_fs_vs_xs_update_indep_priv
check FS becomes dirty where appropriate
instructions that set fflags must set FS to dirty even if they write no floating-point register

cp_mstatus_FS_transition_nondeterministic

Writing to the CSR field
(WARL)

Floating-point instructions that need not modify floating-point state (fsw, fmv.x.w, fclass.s, csrr of the FP CSRs, fmvh.x.d) crossed with mstatus.FS = Off and Dirty

Illegal-instruction trap when FS = Off; FS stays Dirty when Dirty. Initial and Clean are omitted because these instructions may dirty FS imprecisely.

mstatus_fs_imprecise

U_V tests (U_V_vcsr-NN.S, U_V_vset-NN.S, U_V_vl_walk-NN.S): the vector CSRs, vset{i}vl{i}, vstart and xstatus.VS from U-mode, run when Zve32x is also supported. xstatus.VS is written and read through T-SBI, in sstatus when S-mode is supported and otherwise in mstatus.

cp_vcsrrswc

Confirm that all vector CSR properties are properly set with regards to read write, clear, and set privileges with the csr instructions

With each of the vector CSRs conduct a read, write, clear, and set operation on the CSR

Will abide by spec’s read and write permissions for each csr

3 csr instructions * 7 CSRs

vlenb_acc_op
vcsr_vxrm_op
vcsr_vxsat_op
vcsr_vxrm_vxsat_acc
Zve32x_dependent_Zicsr

test written: yes
spec: The vector extension adds 32 vector registers, and seven unprivileged CSRs (vstart, vxsat, vxrm, vcsr, vtype, vl, vlenb) to a base scalar RISC-V ISA.
read-only CSR vlenb
The XLEN-bit-wide read-only vl CSR can only be updated by the vset{i}vl{i} instructions, and the fault-only-first vector load instruction variants.
read-only XLEN-wide vector type CSR, vtype provides the default type used to interpret the contents of the vector register file, and can only be updated by vset{i}vl{i}

cp_vcsrs_walking1s

Confirm that that all writable vector CSRs have the correct bits writeable

With each of the vector CSRs that are writable, write all XLEN 1-hot values to the csr

csrs will be updated based on which bits they support to be writable

4 CSRs * XLEN 1-hot values

mstatus_vs_op
vstart_acc_sz
vxrm_val_sz_acc
vxsat_op_acc_sz

test written: yes
spec: vstart, vxrm, vxsat, vcsr are all writable

cp_mstatus_vs_set_dirty_arithmetic

Confirm that after running an arithmetic vector instruction that mstatus.VS is set to dirty when set to "clean" or "initial"

Run a .vv vector arithmetic instruction with mstatus.VS = {clean, initial}

mstatus.VS is set to dirty

2 mstatus.VS bins

mstatus_vs_sstatus_vs_op
mstatus_fs_vs_xs_update_indep_priv
mstatus_vs_op_initial_clean

test written: yes
spec: When mstatus.VS is set to Initial or Clean, executing any instruction that changes vector state, including the vector CSRs, will change mstatus.VS to Dirty.

cp_mstatus_vs_set_dirty_csr

Confirm that after running a vsetvli instruction that mstatus.VS is set to dirty when set to "clean" or "initial"

Run a vsetvli instruction with mstatus.VS = {clean, initial}

mstatus.VS is set to dirty

2 mstatus.VS bins

mstatus_vs_op
mstatus_vs_op_initial_clean

test written: yes
spec: When mstatus.VS is set to Initial or Clean, executing any instruction that changes vector state, including the vector CSRs, will change mstatus.VS to Dirty.

Analogous to the way in which the floating-point unit is handled, the mstatus.VS field may exist even if misa.V is clear.

feature (coverpoint written): Untestable

cp_mstatus_vs_off_arithmetic

Confirm that when misa.V is 1 and mstatus.VS is off, an arithmetic vector instruction raises an illegal instruction exception

With misa.V = 1 (its reset value), set mstatus.VS = {00} and run a .vv vector instruction

illegal instruction exception

1

mstatus_vs_sstatus_vs_op
mstatus_fs_vs_xs_off_op
mstatus_vs_op_off

test written: yes, confirm sig
spec: Attempts to execute any vector instruction, or to access the vector CSRs, raise an illegal-instruction exception when mstatus.VS is set to Off.

cp_mstatus_vs_off_csr

Confirm that when misa.V is 1 and mstatus.VS is off, an csr vector instruction raises an illegal instruction exception

With misa.V = 1 (its reset value), set mstatus.VS = {00} and run a vsetvli

illegal instruction exception

1

mstatus_fs_vs_xs_off_op

test written: yes, confirm sig
spec: Attempts to execute any vector instruction, or to access the vector CSRs, raise an illegal-instruction exception when mstatus.VS is set to Off.

For implementations with a writable misa.V field, the vsstatus.VS field may exist even if misa.V is clear.

feature (coverpoint written): Untestable

Vset{i}vl{i}

cp_sew_lmul_vset_i_vli

Confirm that all combinations of lmul crossed with sew correctly set the vtype register in accordance with the vill field

Use all vset{i}vli instructions to cross eSEW={8/16/32/64} with mLMUL = {f8/f4/f2/1/2/4/8} rd and uimm can be any nonzero value

vtype.vill becomes 1 and other bits become 0 on illegal combinations, such as sew = 1xx.

2 instructions * 7 lmul bins * 4 sew bins

vtype_sz_acc_op
vtype_vsew_op
vtype_lmul_val
vtype_lmul_fval
vtype_sew_val
vset_op
vtype_vstart_op
vtype_acc

test written: yes
spec: Implementations must consider all bits of the vtype value to determine if the configuration is supported. An unsupported value in any location within the vtype value must result in vill being set. In particular, all XLEN bits of the register vtype argument to the vsetvl instruction must be checked. Implementations cannot ignore fields they do not implement. All bits must be checked to ensure that new code assuming unsupported vector features in vtype traps instead of executing incorrectly on an older implementation…​.The supported element width may vary with LMUL
The use of vtype encodings with LMUL < SEWMIN/ELEN is reserved, but implementations can set vill if they do not support these configurations.

cp_sew_lmul_vsetvl

Confirm that all combinations of lmul crossed with sew correctly set the type register in accordance with the vill field

Use vsetvl to cross rs2.sew= [3’b000:3’b011] with rs2.lmul = [000, 001, 010, 011, 101, 110, 111]. rd and uimm can be any nonzero value. Make sure rs2_val[`XLEN-1:8] = 0
rs2 must be this way to be a legal setting

vtype.vill becomes 1 and other bits become 0 on illegal combinations, such as sew = 1xx.

7 lmul bins * 4 sew bins

vtype_sz_acc_op
vtype_fields_sz
vset_op
vtype_vstart_op
vtype_acc

test written: yes
spec: Implementations must consider all bits of the vtype value to determine if the configuration is supported. An unsupported value in any location within the vtype value must result in vill being set. In particular, all XLEN bits of the register vtype argument to the vsetvl instruction must be checked. Implementations cannot ignore fields they do not implement. All bits must be checked to ensure that new code assuming unsupported vector features in vtype traps instead of executing incorrectly on an older implementation…​.The supported element width may vary with LMUL
The use of vtype encodings with LMUL < SEWMIN/ELEN is reserved, but implementations can set vill if they do not support these configurations.

cp_sew_lmul_vset_i_vli / cp_sew_lmul_vsetvl

Confirm on the supported values of lmul are recognized as legal

Use vsetivli rd, 1, sew={supported}, vlmul={supported(mf8/mf4/mf2/)m1/m2/m4/m8}, tu, mu to attempt to set all values of lmul

Expect vill is set for all values of lmul that aren’t legal, otherwise the correct lmul is set

0

feature (coverpoint written): Covered by coverpoint above
spec: Implementations must support LMUL integer values of 1, 2, 4, and 8…​.Implementations must provide fractional LMUL settings that allow the narrowest supported type to occupy a fraction of a vector register corresponding to the ratio of the narrowest supported type’s width to that of the largest supported type’s width

cp_sew_lmul_vset_i_vli / cp_sew_lmul_vsetvl

Check all values of sew to Confirm only correctly supported values are recognized as legal

Use vsetivli rd, 1, sew={e8/e16/e32/e64}, vlmul={m1}, tu, mu to attempt to set all values of lmul

Expect vill will be set when an attempted unsupported sew values are attempted to be written, otherwise vtype will contain supported sew

0

feature (coverpoint written): Covered by coverpoint above
spec: Implementations must support LMUL integer values of 1, 2, 4, and 8…​.Implementations must provide fractional LMUL settings that allow the narrowest supported type to occupy a fraction of a vector register corresponding to the ratio of the narrowest supported type’s width to that of the largest supported type’s width

cp_vill_vset_i_vli

Check that vset{i}vli instructions properly clear the vill bit when writing a valid vtype configuration

Run vsetvli and vsetivli with eSEW = {8/16/32/64} with mLMUL = {8} and vtype.vill = {1}
we set lmul to 8 to write a non-zero value to the CSR

expect vill bit is cleared and vtype written when sew is legal

2 instructions * 4 sew bins

test written: yes
spec: If the vill bit is set, then any attempt to execute a vector instruction that depends upon vtype will raise an illegal-instruction exception [except]…​.vset{i}vl{i} …​. [does] not depend upon vtype

cp_vill_vsetvl

Check that vsetvl instruction properly clears the vill bit when writing a valid vtype configuration

Run vsetvl with rs2.sew = {8/16/32/64} with rs2.lmul = {8} and vtype.vill = {1} making sure rs2_val[`XLEN-1:8] = 0
we set lmul to 8 to write a non-zero value to the CSR. rs2 must be in this manner to be a legal setting

expect vill bit is cleared and vtype written when sew is legal

4 sew bins

vtype_vill_val
vtype_vill_val_vill
vtype_vill_all_bits

test written: yes
spec: If the vill bit is set, then any attempt to execute a vector instruction that depends upon vtype will raise an illegal-instruction exception [except]…​.vset{i}vl{i} …​. [does] not depend upon vtype

cp_vill_vsetvl_rs2_vill

Check that when attempting to set a valid configuration but with the rs2.vill bit set, and the vtype.vill bit set, that the register remains all zeros besides the vill bit

Run vsetvl with rs2.sew = {8/16/32/64} with vtype.lmul = {8} and vtype.vill = {1} making sure rs2_val[`XLEN-2:8] = 0 and rs2[XLEN-1] = 1
we set lmul to 8 to attempt to write a non-zero value to the CSR. rs2 must be in this manner to be a legal setting.

vtype register remains unchanged

4 sew bins

test written: yes
spec: If the vill bit is set, then any attempt to execute a vector instruction that depends upon vtype will raise an illegal-instruction exception [except]…​.vset{i}vl{i} …​. [does] not depend upon vtype

cp_vsetvl_rs2_vill

Confirm that with vsetvl if rs2 has the vill bit set that it is treated as an unsupported configuration

run a vsetvl with rs2[XLEN-1] = 1, rs2[XLEN-2:8]=0 and rs2.sew = {supported} and rs2.lmul = 1 and vtype.vill = {0}
sew must be supported and rs2[XLEN-2:8] zero to verify the configuration is illegal due to the vill bit being set

vill bit should be set

spec: A vtype value with vill set is treated as an unsupported configuration.

cp_vset_vill

Confirm that writing 1 to vill clears other bits of vtype

Set rs1 nonzero, rs1 = 1 in XLEN-1, 11 in 7:6 (vma/vta). vsetvl rd, rs1, rs2 and vtype.vill = {0}

vtype.vill becomes 1 and other bits become 0

1

feature (coverpoint written): covered by coverpoint above
spec: When the vill bit is set, the other XLEN-1 bits in vtype shall be zero.

cp_vtype_vill_set_vl_0

Confirm that if an unsupported configuration is set, that vl is set to zero

Run vsetvl with rs1 non-zero and rs2 vill bit set and vl =! 0

vl should be set to zero

1

vtype_lmul_fval_rsv
vtype_vstart_op

test written: yes
spec: If the vtype value is not supported by the implementation, then the vill bit is set in vtype, the remaining bits in vtype are set to zero, and the vl register is also set to zero.

cp_vsetvl_i_rd_nx0_rs1_x0

Confirm that when running a vsetvl or vsetvli instruction with rd != x0 and rs1 = x0 that vl is set to vlmax

with vl != vlmax, conduct vsetvl and vsetvli with rd != x0 and rs1 = x0. Cross with sew = {8/16/32/64} and respective supported lmul {supported(f8,f4,f2,)1,2,4,8}
we want vl != vlmax since similar syntax leaves vl unmodified.

vl csr is set to vlmax

2 instructions * 4 sew bins * 7 lmul bins

vl_acc
vsetvl_op
vsetvl_op_rs1_x0_rd_nx0

test written: yes
spec: When rs1=x0 but rd≠x0, the maximum unsigned integer value (~0) is used as the AVL, and the resulting VLMAX is written to vl and also to the x register specified by rd.

cp_vsetvl_i_rd_x0_rs1_x0

Confirm that when running a vsetvl or vsetvli instruction with rd = x0 and rs1 = x0 that vl is unchanged

with vl != 0, conduct vsetvl and vsetvli with rd = x0 and rs1 = x0. sew and lmul must be such that vlmax does not change
vlmax must not change for the instruction to not be reserved.

vl is unchanged

2

vsetvl_op
vsetvl_op_rs1_x0_rd_x0

test written: yes
spec: When rs1=x0 and rd=x0, the instruction operates as if the current vector length in vl is used as the AVL, and the resulting value is written to vl, but not to a destination register. This form can only be used when VLMAX and hence vl is not actually changed by the new SEW/LMUL ratio.

AVL

cp_vsetvl_i_avl_eq_zero

Confirm that vsetvl{i} instructions follow vl requirements when avl is zero

Run vsetvli and vsetvl with rs1 = 0

vl = 0

1

vsetvl_op
vl_val_lead_in
vl_val_list

test written: yes
spec: The vset{i}vl{i} instructions first set VLMAX according to their vtype argument, then set vl obeying the following constraints:
These specific properties follow from the prior rules: vl = 0 if AVL = 0

cp_vsetvl_i_avl_eq_vlmax

Confirm that vsetvl{i} instructions follow avl requirements when equal to vlmax

Run vsetvli and vsetvl with rs1 = vlmax

vl = avl

1

vset_op
vsetvl_op
vl_val_lead_in
vl_val_list

test written: yes
spec: The vset{i}vl{i} instructions first set VLMAX according to their vtype argument, then set vl obeying the following constraints:
vl = AVL if AVL ≤ VLMAX

cp_vsetvl_i_avl_lt_2x_vlmax

Confirm that vsetvl{i} instructions follow avl requirements when greater than vlmax and less than equal to 2*vlmax (if avl is less than 2* vlmax)

Run vsetvli and vsetvl with vlmax < rs1 < 2 *vlmax

ceil(AVL / 2) ≤ vl ≤ VLMAX

1

vsetvl_op
vl_val_lead_in
vl_val_list

test written: yes, is a chance that sig don’t match
spec: The vset{i}vl{i} instructions first set VLMAX according to their vtype argument, then set vl obeying the following constraints:
ceil(AVL / 2) ≤ vl ≤ VLMAX if AVL < (2 * VLMAX)

cp_vsetvl_i_avl_eq_2x_vlmax

Confirm that vsetvl{i} instructions follow avl requirements when greater than 2 * vlmax (when avl is greater than equal to 2 * vlmax)

Run vsetvli and vsetvl with rs1 ≥ 2 *vlmax

vl = VLMAX

1

vsetvl_op

test written: yes
spec: The vset{i}vl{i} instructions first set VLMAX according to their vtype argument, then set vl obeying the following constraints:
vl = VLMAX if AVL ≥ (2 * VLMAX)

cp_vsetvl_i_avl_gt_2x_vlmax

Confirm that vsetvl{i} instructions follow avl requirements when greater than 2 * vlmax (when avl is greater than equal to 2 * vlmax)

Run vsetvli and vsetvl with rs1 ≥ 2 *vlmax

vl = VLMAX

1

vsetvl_op
vl_val_lead_in
vl_val_list

test written: yes
spec: The vset{i}vl{i} instructions first set VLMAX according to their vtype argument, then set vl obeying the following constraints:
vl = VLMAX if AVL ≥ (2 * VLMAX)

cp_vsetivli_avl_edges

Confirm that vsetivli abides by the avl corners

Run vsetivli with all values of imm = {[0:31]} with sew = {all_supported} and lmul = 1

Abides by avl rules depending on

4 sew bins * 32 imm bins

vset_op
vsetivli_op

test written: yes
spec: The vset{i}vl{i} instructions first set VLMAX according to their vtype argument, then set vl obeying the following constraints:

vstart

cp_vstart_out_of_bounds

Confirm that the vstart CSR only has enough writeable bits to hold the largest element index (2^16-1)

conduct a csr write with rs1 = 2^16 on the vstart register

Not defined in spec, either vstart takes the bottom bits or sets to vlmax-1

1

vstart_acc_sz
vstart_sz_writable

test written: yes
spec: The vstart CSR is defined to have only enough writable bits to hold the largest element index (one less than the maximum VLMAX). Try to write a number greater than what is legal

cp_sew_illegal

Cannot set SEW < 8, all set SEW must be powers of 2 (can accomplish this by looping and setting sew of 2x until vill bit is set and then confirm that vill bit is set whenever setting a non power of 2 sew in that range)

feature (coverpoint written): can’t be tested

cp_vl_walking1s_sew_lmul

Confirm that all vl CSR bit fields are correctly set for all combinations of sew and lmul (thus all VLMAX)

Running the vsetvli instruction, cross all sew = {8/16/32/64} lmul = {f8, f4,f2, 1, 2, 4, 8} with rs1 ={XLEN 1-hot values}
This is done by conducting a vsetivli every time followed by a walking one csr write to ensure the target sew and lmul were attempted to be written

vl register will be set in accordance with vlmax

4sew * 7 lmul * XLEN 1-hot values

cp_vlen_illegal

Cannot set VLEN greater than 2^16, can check vl with eew = 8

vsetvli rs1={0, 1, 2, 3, 4, 7, 8, 9, 16, 32, 64…​ 2^16}
corners: (rs1 - 1)

feature (coverpoint written): covered by csr writing tests

The vector extension must have a consistent state at reset. In particular, vtype and vl must have values that can be read and then restored with a single vsetvl instruction. (make sure reset is called)

feature (coverpoint written): untestable

U_VF tests (U_VF-NN.S): vector floating-point instructions and xstatus.FS from U-mode, run when Zve32f is also supported. xstatus.FS and xstatus.VS are written and read through T-SBI, in sstatus when S-mode is supported and otherwise in mstatus.

It should be understood that for most coverpoints that are based on arithmetic instructions, the coverpoints will check to make sure they’re non-trivial, meaning that vl != 0, vstart=0, vill=0, and they do not trap. It may be useful to know that when using vsetvl{i} instructions if rd != x0 and rs1 = x0, vl = vlmax

cp_vectorfp_mstatus_fs_state_affecting_register

Confirm vector floating point instructions set mstatus.FS to dirty when modifying floating point register state

Set mstatus.FS = {initial/clean} and run a fd writing instruction

mstatus.FS is set to dirty

1

mstatus_fs_dirty_V_fp

spec: Any vector floating-point instruction that modifies any floating-point extension state (i.e., floating-point CSRs or f registers) must set mstatus.FS to Dirty.

cp_vectorfp_mstatus_fs_state_affecting_csr

Confirm vector floating point instructions set mstatus.FS to dirty when modifying floating point csr state

Set mstatus.FS = {initial/clean} and run an instruction that would raise a fp flag after clearing the fp flags (vfdiv.vv divide by zero, vfadd.vv inf + -inf, and vmflt.vv with a NaN operand, which writes only a mask register)

mstatus.FS is set to dirty

1

spec: Any vector floating-point instruction that modifies any floating-point extension state (i.e., floating-point CSRs or f registers) must set mstatus.FS to Dirty.

cp_vectorfp_mstatus_fs_state_nonaffecting

Confirm vector floating point instructions properly set mstatus.FS when not modifying floating point state

Set mstatus.FS = {initial/clean} and run a vector fp instruction that does not affect floating point state (chosen situation for coverpoint is a .vv ins where vs1 = vs2 = 0)

mstatus.FS may be set to dirty or not depending on implementation

1

spec: Any vector floating-point instruction that modifies any floating-point extension state (i.e., floating-point CSRs or f registers) must set mstatus.FS to Dirty.

cp_vectorfp_mstatus_fs_off

Confirm that vector floating point instructions (even if they dont modify fp state) raise an illegal instruction exception if mstatus.FS is set to off

Set mstatus.FS = {off} and run a vector fp instruction that does not affect floating point state (chosen situation for coverpoint is a .vv ins where vs1 = vs2 = 0)

illegal instruction exception

1

spec: If the floating-point unit status field mstatus.FS is Off then any attempt to execute a vector floating-point instruction will raise an illegal instruction exception.

Table 172. U Normative Rules
Normative Rule Rule Text Coverpoints

always_priv_level

At any time, a RISC-V hardware thread (hart) is running at some privilege level encoded as a mode in one or more CSRs (control and status registers).

Descriptive spec text with no separately testable behavior

priv_levels_txt

Three RISC-V privilege levels are currently defined

Descriptive spec text with no separately testable behavior

priv_levels_tbl

Level|Encoding|Name|Abbreviation === 0|00|User/Application|U¶1|01|Supervisor|S¶2|10|Reserved| ¶3|11|Machine|M ===

Sm_mprivinst_cg/cp_mret, Sm_mcsr_cg/cp_mcsrwalk_masked

non_priv_exc

attempts to perform operations not permitted by the current privilege mode will cause an exception to be raised.

U_ucsr_cg/cp_csr_insufficient_priv, U_uprivinst_cg/cp_uprivinst

m_level_high_priv_only_mandatory

The machine level has the highest privileges and is the only mandatory privilege level for a RISC-V hardware platform.

Definition, checked through UDB

priv_combs_txt

Implementations might provide anywhere from 1 to 3 privilege modes

Definition, checked through UDB

priv_combs_tbl

Number of levels|Supported Modes|Intended Usage === 1|M|Simple embedded systems¶2|M, U|Secure embedded systems¶3|M, S, U|Systems running Unix-like operating systems ===

Definition, checked through UDB

m_mode_mandatory

All hardware implementations must provide M-mode

Definition, checked through UDB

Zicsr_rw

The top two bits (csr[11:10]) indicate whether the register is read/write (00,01, or 10) or read-only (11).

U_ucsr_cg/cp_csr_ro

Zicsr_access

The next two bits (csr[9:8]) encode the lowest privilege level that can access the CSR, with the pattern 10 representing hypervisor CSRs.

U_ucsr_cg/cp_csr_insufficient_priv

Zicsr_illegal_mode

Attempts to access a CSR address without sufficient privilege raise illegal-instruction exceptions or, as described in sec:hcauses, virtual-instruction exceptions.

U_ucsr_cg/cp_csr_insufficient_priv

Zicsr_illegal_acc

Attempts to write a read-only CSR address raise illegal-instruction exceptions.

U_ucsr_cg/cp_csr_ro

ecall_service_request_op

The ECALL instruction is used to make a service request to the execution environment.

U_uprivinst_cg/cp_uprivinst/ecall

ecall_priv_mode_op

The ECALL instruction is used to make a request to the supporting execution environment. When executed in U-mode, S-mode, or M-mode, it generates an environment-call-from-U-mode exception, environment-call-from-S-mode exception, or environment-call-from-M-mode exception, respectively, and performs no other operation.

U_uprivinst_cg/cp_uprivinst/ecall

ebreak_debug_env_op

The EBREAK instruction is used to return control to a debugging environment.

U_uprivinst_cg/cp_uprivinst/ebreak

ebreak_debugger_transfer_op

The EBREAK instruction is used by debuggers to cause control to be transferred back to a debugging environment. Unless overridden by an external debug environment, EBREAK raises a breakpoint exception and performs no other operation.

U_uprivinst_cg/cp_uprivinst/ebreak

xret_in_lower_mode

Attempting to execute an xRET instruction in a mode less privileged than x will raise an illegal-instruction exception.

U_uprivinst_cg/cp_uprivinst/mret, U_uprivinst_cg/cp_uprivinst/sret

sret_presence

SRET must be provided if supervisor mode is supported, and should raise an illegal-instruction exception otherwise.

U_uprivinst_cg/cp_uprivinst/sret

mstatus_fs_vs_xs_update_indep_priv

The status fields are also updated during execution of instructions, regardless of privilege mode.

Sm_F_cg/cp_mstatus_FS_transition, S_F_cg/cp_sstatus_FS_transition, H_F_cg/cp_vsstatus_FS_transition, U_F_cg/cp_mstatus_FS_transition, Sm_V_cg/cp_mstatus_vs_set_dirty_arithmetic, S_V_cg/cp_sstatus_vs_set_dirty_arithmetic, H_V_cg/cp_vsstatus_vs_set_dirty_arithmetic, U_V_cg/cp_mstatus_vs_set_dirty_arithmetic

mcounteren_op

controls the availability of the hardware performance-monitoring counters to the next-lower privileged mode.

S_Zicntr_cg/cp_mcounteren_access_s, U_Zicntr_cg/cp_mcounteren_access_u, Sm_Zicntr_cg/cp_mcounteren_access_m, H_Zicntr_cg/cp_mcounteren_access_vs

mcounteren_inc_inaccessible

The settings in this register only control accessibility. The act of reading or writing this register does not affect the underlying counters, which continue to increment even when not accessible.

U_Zicntr_cg/cp_mcounter_inc_inaccessible

mcounteren_clr_ill_inst_exc

When the CY, TM, IR, or HPMn bit in the mcounteren register is clear, attempts to read the cycle, time, instret, or hpmcountern register while executing in S-mode or U-mode will cause an illegal-instruction exception.

S_Zicntr_cg/cp_mcounteren_access_s, U_Zicntr_cg/cp_mcounteren_access_u

mcounteren_set_nxt_priv

When one of these bits is set, access to the corresponding register is permitted in the next implemented privilege mode (S-mode if implemented, otherwise U-mode).

S_Zicntr_cg/cp_mcounteren_access_s, U_Zicntr_cg/cp_mcounteren_access_u

ecall_ebreak_no_minstret_inc

As ECALL and EBREAK cause synchronous exceptions, they are not considered to retire, and should not increment the minstret CSR.

U_Zicntr_cg/{cp_instret_ecall, cp_instret_ebreak}

UDB Parameters: None.

B.1.4. Zkr Entropy CSR

These test CSRs when the Zkr entropy extension is supported. The seed CSR tests run once per privilege mode: Zkr_Sm in M-mode, Zkr_S in S-mode, and Zkr_U in U-mode. With the H extension, Zkr_H repeats the seed accesses from VS-mode and VU-mode.

Zkr_Sm
Table 173. Zkr_Sm Coverpoints
Coverpoint Goal Feature Description Expectation Bins Normative Rule

cp_zkr_seed_csrrw

seed CSR is readable and writable across allowed privilege modes

Execute csrrw rd, seed, rs1 crossed with {privilege mode = M, S, U for supported modes} crossed with {mseccfg.sseed = 0/1, mseccfg.useed = 0/1.

No exception when access is allowed

3 modes * 4 mseccfg = 12 bins

Zkr_seed_addr
seed_write_ignore
seed_exec_mode_control
mseccfg_sseed_useed_op_tbl

cp_zkr_seed_illegal_csr_op

Non-CSRRW CSR instructions on seed cause illegal instruction

For each op in {CSRRS, CSRRC, CSRRW, CSRRWI, CSRRSI, CSRRCI} crossed with rs1/imm in {0/1} crossed with {mode = M, S (sseed=1), U (useed=1)} for supported modes: attempt the instruction on the seed CSR.

An illegal instruction exception is raised for every effective read (CSRRS/C with x0 or imm 0), regardless of privilege mode or access control settings.

6 ops * 2 rs1 * 3 modes = 30 bins

seed_ro_illegal
mseccfg_sseed_useed_op_tbl

cp_zkr_seed_entropy_zero_non_es16

# When OPST is not ES16, entropy must be 0.

Execute csrrw rd, seed, rs1
Execute csrrw rd, seed, rs1 again
check that if OPST is not ES16, sigupd entropy
if OPST is ES16, sigupd 0x0BADBEEF

entropy is 0 if OPST is not ES16

1

seed_entropy_zero_non_es16

Zkr_S
Table 174. Zkr_S Coverpoints
Coverpoint Goal Feature Description Expectation Bins Normative Rule

cp_zkr_seed_csrrw

seed CSR is readable and writable across allowed privilege modes

Execute csrrw rd, seed, rs1 crossed with {privilege mode = M, S, U for supported modes} crossed with {mseccfg.sseed = 0/1, mseccfg.useed = 0/1.

No exception when access is allowed

3 modes * 4 mseccfg = 12 bins

Zkr_seed_addr
seed_write_ignore
seed_exec_mode_control
mseccfg_sseed_sorhs_mode_op
mseccfg_sseed_useed_op_tbl

cp_zkr_seed_illegal_csr_op

Non-CSRRW CSR instructions on seed cause illegal instruction

For each op in {CSRRS, CSRRC, CSRRW, CSRRWI, CSRRSI, CSRRCI} crossed with rs1/imm in {0/1} crossed with {mode = M, S (sseed=1), U (useed=1)} for supported modes: attempt the instruction on the seed CSR.

An illegal instruction exception is raised for every effective read (CSRRS/C with x0 or imm 0), regardless of privilege mode or access control settings.

6 ops * 2 rs1 * 3 modes = 30 bins

seed_ro_illegal
mseccfg_sseed_sorhs_mode_op
mseccfg_sseed_useed_op_tbl

cp_zkr_seed_entropy_zero_non_es16

# When OPST is not ES16, entropy must be 0.

Execute csrrw rd, seed, rs1
Execute csrrw rd, seed, rs1 again
check that if OPST is not ES16, sigupd entropy
if OPST is ES16, sigupd 0x0BADBEEF

entropy is 0 if OPST is not ES16

1

seed_entropy_zero_non_es16

Zkr_U
Table 175. Zkr_U Coverpoints
Coverpoint Goal Feature Description Expectation Bins Normative Rule

cp_zkr_seed_csrrw

seed CSR is readable and writable across allowed privilege modes

Execute csrrw rd, seed, rs1 crossed with {privilege mode = M, S, U for supported modes} crossed with {mseccfg.sseed = 0/1, mseccfg.useed = 0/1.

No exception when access is allowed

3 modes * 4 mseccfg = 12 bins

Zkr_seed_addr
seed_write_ignore
seed_csr_unpriv
seed_exec_mode_control
mseccfg_useed_u_mode_op
mseccfg_sseed_useed_op_tbl

cp_zkr_seed_illegal_csr_op

Non-CSRRW CSR instructions on seed cause illegal instruction

For each op in {CSRRS, CSRRC, CSRRW, CSRRWI, CSRRSI, CSRRCI} crossed with rs1/imm in {0/1} crossed with {mode = M, S (sseed=1), U (useed=1)} for supported modes: attempt the instruction on the seed CSR.

An illegal instruction exception is raised for every effective read (CSRRS/C with x0 or imm 0), regardless of privilege mode or access control settings.

6 ops * 2 rs1 * 3 modes = 30 bins

seed_ro_illegal
mseccfg_useed_u_mode_op
mseccfg_sseed_useed_op_tbl

cp_zkr_seed_entropy_zero_non_es16

# When OPST is not ES16, entropy must be 0.

Execute csrrw rd, seed, rs1
Execute csrrw rd, seed, rs1 again
check that if OPST is not ES16, sigupd entropy
if OPST is ES16, sigupd 0x0BADBEEF

entropy is 0 if OPST is not ES16

1

seed_entropy_zero_non_es16

Zkr_H

covergroup Zkr_H The tests boot to HS-mode, enter VS-mode and then VU-mode, and write mseccfg through T-SBI. At V=1 every seed access traps, and only mseccfg.SSEED decides which exception.

Table 176. Zkr_H Coverpoints
Coverpoint Goal Feature Description Expectation Bins Normative Rule

cp_zkr_seed_access_h

seed accesses from VS-mode and VU-mode raise virtual instruction when HS-qualified, otherwise illegal instruction

For each op in {CSRRS, CSRRC, CSRRW, CSRRWI, CSRRSI, CSRRCI} crossed with rs1/imm in {0/nonzero} crossed with {mseccfg.sseed = 0/1, mseccfg.useed = 0/1} crossed with {mode = VS, VU}: attempt the instruction on the seed CSR, then record rd.

sseed = 0: illegal-instruction exception for every access. sseed = 1: virtual-instruction exception for the read-write forms (CSRRW, CSRRWI, and CSRRS/C, CSRRSI/CI with nonzero rs1/imm), illegal-instruction exception for the read-only forms (CSRRS/C with x0, CSRRSI/CI with imm 0). useed has no effect. rd is not written.

6 ops * 2 rs1 * 4 mseccfg * 2 modes = 96 bins

seed_ro_illegal
seed_exec_mode_control
mseccfg_sseed_vsorvu_mode_op
mseccfg_sseed_useed_op_tbl

Table 177. Zkr Normative Rules
Normative Rule Rule Text Coverpoints

Zkr_seed_addr

The entropy source extension defines the seed CSR at address 0x015. This CSR provides up to 16 physical ENTROPY bits that can be used to seed cryptographic random bit generators.

{Zkr_Sm_cg,Zkr_S_cg,Zkr_U_cg}/{cp_zkr_seed_csrrw}

seed_ro_illegal

Attempts to access the seed CSR using a read-only CSR-access instruction (CSRRS/CSRRC with rs1=x0 or CSRRSI/CSRRCI with uimm=0) raise an illegal-instruction exception; any other CSR-access instruction may be used to access seed.

{Zkr_Sm_cg,Zkr_S_cg,Zkr_U_cg}/{cp_zkr_seed_illegal_csr_op}, Zkr_H_cg/cp_zkr_seed_access_h

seed_write_ignore

The write value (in rs1 or uimm) must be ignored by implementations.

{Zkr_Sm_cg,Zkr_S_cg,Zkr_U_cg}/{cp_zkr_seed_csrrw}

seed_csr_unpriv

seed is an unprivileged CSR located at address 0x015.

Zkr_U_cg/cp_zkr_seed_csrrw

seed_exec_mode_control

The seed CSR is also access controlled by execution mode, and attempted read or write access will raise an illegal-instruction exception outside M-mode unless access is explicitly granted. See crypto_scalar_es_access for more details.

{Zkr_Sm_cg,Zkr_S_cg,Zkr_U_cg}/{cp_zkr_seed_csrrw}, Zkr_H_cg/cp_zkr_seed_access_h

seed_entropy_unique

Each returned seed[15:0] = ENTROPY value represents unique randomness when OPST=ES16 (seed[31:30] = 10), even if its numerical value is the same as that of a previously polled ENTROPY value.

Not tested: randomness quality is not observable in an architectural signature test

seed_entropy_zero_non_es16

When OPST is not ES16, ENTROPY must be set to 0.

{Zkr_Sm_cg,Zkr_S_cg,Zkr_U_cg}/{cp_zkr_seed_entropy_zero_non_es16}

seed_wipe_on_read

For security reasons, the interface guarantees that secret ENTROPY words are not made available multiple times. Hence polling (reading) must also have the side effect of clearing (wipe-on-read) the ENTROPY contents and changing the state to WAIT (unless there is ENTROPY immediately available for ES16). Other states (BIST, WAIT, and DEAD) may be unaffected by polling.

Not tested: entropy values and OPST sequencing are nondeterministic, so they cannot be compared against a reference model

seed_bist_latch

Such a BIST alarm must be latched until polled at least once to enable software to record its occurrence.

Not tested: needs a platform mechanism to force a BIST alarm

seed_min_security_256

Any implementation of the seed CSR that limits the security strength shall not reduce it to less than 256 bits.

Not tested: security strength is not architecturally observable

seed_disable_if_weak

If the security level is under 256 bits, then the interface must not be available.

Not tested: security strength is not architecturally observable

mseccfg_useed_u_mode_op

When USEED is 0, access to the seed CSR in U-mode raises an illegal-instruction exception. When USEED is 1, read-write access to the seed CSR from U-mode is allowed; all other types of accesses raise an illegal-instruction exception.

Zkr_U_cg/{cp_zkr_seed_csrrw, cp_zkr_seed_illegal_csr_op}

mseccfg_sseed_sorhs_mode_op

When SSEED is 0, access to the seed CSR from S-/HS-mode raises an illegal-instruction exception. When SSEED is 1, read-write access to the seed CSR from S-/HS-mode is allowed; all other types of accesses raise an illegal-instruction exception.

Zkr_S_cg/{cp_zkr_seed_csrrw, cp_zkr_seed_illegal_csr_op}

mseccfg_sseed_vsorvu_mode_op

When the H extension is also implemented, access to the seed CSR from an HS-qualified instruction leads to a virtual-instruction exception in VS and VU modes; all other types of accesses raise an illegal-instruction exception.

Zkr_H_cg/cp_zkr_seed_access_h

mseccfg_sseed_useed_op_tbl

Mode|SSEED|USEED|Description === M|-|-|The seed CSR is always available in machine mode as normal (with a CSR read-write instruction.) Attempted read without a write raises an illegal-instruction exception regardless of mode and access control bits.¶U|-|0|Any seed CSR access raises an illegal-instruction exception.¶U|-|1|The seed CSR is accessible as normal. No exception is raised for read-write.¶S/HS|0|-|Any seed CSR access raises an illegal-instruction exception.¶S/HS|1|-|The seed CSR is accessible as normal. No exception is raised for read-write.¶VS/VU|0|-|Any seed CSR access raises an illegal-instruction exception.¶VS/VU|1|-|A read-write seed access raises a virtual-instruction exception, while other access conditions raise an illegal-instruction exception. ===

{Zkr_Sm_cg,Zkr_S_cg,Zkr_U_cg}/{cp_zkr_seed_csrrw, cp_zkr_seed_illegal_csr_op}, Zkr_H_cg/cp_zkr_seed_access_h

UDB Parameters: None.

B.2. Exceptions

The Exceptions suite has one covergroup and test plan per privilege mode or extension supported, named Exceptions_<group>_cg. For example, a configuration with Machine, Supervisor, User, and Floating-Point supported should run Exceptions_Sm, Exceptions_S, Exceptions_U, and Exceptions_F. Note that vector exceptions are in Section B.9.

B.2.1. Exceptions_Sm Machine-Mode Exceptions

These tests are run on any configuration with machine mode that supports exceptions.

exceptionsm covergroup

Table 178. Exceptions_Sm Coverpoints
Coverpoint Goal Feature Description Expectation Bins Normative Rule

cp_instr_adr_misaligned_branch

Instruction Address Misaligned

Branch taken to an address that is an odd multiple of 2
PC[1] = 0 and imm[1]=1

Instruction Misaligned Exception if C is not supported

6 branches

taken_cti_misaligned_exc
branch_misaligned_taken_exception
Zca_no_misaligned

cp_instr_adr_misaligned_branch_nottaken

Instruction Address Misaligned

Each type of branch not taken to an address that is an odd multiple of 2

No exception

6 branches

cond_br_no_ia_misaligned_exc_not_taken
branch_misaligned_untaken_exception

cp_instr_adr_misaligned_jal

Instruction Address Misaligned

jal to an address that is an odd multiple of 2
PC[1] = 0 and imm[1]=1
Instruction at multiple of 4. Offset is an odd multiple of 2.

Instruction Misaligned Exception if C is not supported

1

taken_cti_misaligned_exc
jump_misaligned_exception
Zca_no_misaligned

cp_instr_adr_misaligned_jalr

Instruction Address Misaligned

jalr to an address that is an odd multiple of 2 and odd multiple of 2 + 1.
Every combination of rs1_val[1:0] and offset[1:0]

Instruction Misaligned Exception if C is not supported

4 rs1[1:0] * 4 offset[1:0]

taken_cti_misaligned_exc
jump_misaligned_exception
Zca_no_misaligned

cp_instr_access_fault

Instruction Access Fault

Fetch instruction from unimplemented memory

Instruction Access Fault

1

mcause_exccode_op
ia_fault_exc_on_target
mepc_op
mcause_op
mcause_exccode_enc_img
mtvec_mode_enc
trap_def_m_mode
pma_precise_recom

cp_illegal_instruction

Illegal Instruction

Executing instruction 0x00000000 and 0xFFFFFFFF throws an illegal instruction exception.

Illegal Instruction Exception

2 instr

mcause_exccode_op
mepc_op
mcause_op
mcause_exccode_enc_img
mtvec_mode_enc
trap_def_m_mode
mtval_op
mtval_instr_bits_lead_in
mtval_instr_bits_list
mtval_ill_instr_exc_in_low_bits

cp_illegal_instruction_seed

Illegal Read-only access to a CSR

csrrs x*, seed, x0 throws illegal instruction in machine mode, as do
csrrc x*, seed, x0
csrrsi x*, seed, 0
csrrci x*, seed, 0

Illegal Instruction Exception

4 csr ops

cp_breakpoint

Breakpoint

ebreak throws breakpoint exception
also test when straddling 64B boundary

Breakpoint Exception

1

mcause_exccode_op
ebreak_debug_env_op
ebreak_debugger_transfer_op
mepc_op
mcause_op
mcause_exccode_enc_img
mtvec_mode_enc
trap_def_m_mode
mtval_op
mtval_ebreak_op
ebreak_enc
ecall_ebreak_epc_value

cp_load_address_misaligned

Load Misaligned

Attempt lb, lbu, lh, lhu, lw, lwu, ld with every combination of three address lsbs: 000 - 111

Possible Load Misaligned Instruction

7 ops * 8 lsbs

ldst_no_exc_aligned
misaligned_ldst_exc_type
mcause_exccode_ld_ldrsv
misaligned_ldst_eei_dependent_behavior
misaligned_ldst_hw_support
misaligned_ldst_contained_or_fatal_trap
ldst_atomicity_for_aligned
pma_mm_rw
pma_mag_exc
mtval_op

cp_load_access_fault

Load Access Fault

Attempt lb, lbu, lh, lhu, lw, lwu, ld from an illegal address (parameterized). Also exercised in PMP, VM.

Load Access Fault

7 ops

mcause_exccode_op
mcause_exccode_ld_ldrsv
mcause_op
mcause_exccode_enc_img
mtvec_mode_enc
trap_def_m_mode
pma_precise_recom

cp_store_address_misaligned

Store Misaligned

Attempt sb, sh, sw, (sd) with every combination of three lsbs: 000-111

Possible Store Misaligned Instruction

4 ops * 8 lsbs

ldst_no_exc_aligned
misaligned_ldst_exc_type
misaligned_ldst_eei_dependent_behavior
misaligned_ldst_hw_support
misaligned_ldst_contained_or_fatal_trap
ldst_atomicity_for_aligned
pma_mm_rw
pma_mag_exc
mtval_op

cp_store_access_fault

Store Access Fault

Attempt sb, sh, sw, sd from an illegal address (parameterized). Also exercised in PMP, VM.

Store Access Fault

4 ops

pma_precise_recom

cp_ecall_m

ecall

ecall from machine mode

Ecall from M Exception

1

mepc_op
ecall_service_request_op
ecall_priv_mode_op
ecall_enc
mtval_other_traps_zero
ecall_ebreak_epc_value

cp_misaligned_priority_load

Priority of exceptions

Attempt lb, lbu, lh, lhu, lw, (lwu, ld) from memory location causing access fault and misaligned. Also exercised in PMP, VM.

Highest priority exception should be taken.

7 ops * 8 lsbs

mcause_exccode_priority_misaligned
mcause_exccode_priority_order
exc_priority

cp_misaligned_priority_store

Priority of exceptions

Attempt sb, sh, sw, (sd) to memory location causing access fault and misaligned. Also exercised in PMP, VM.

Highest priority exception should be taken.

4 ops * 8 lsbs

mcause_exccode_priority_misaligned
mcause_exccode_priority_order
exc_priority

cp_misaligned_priority_fetch

Priority of exceptions

Attempt fetch from aligned and misaligned legal and access-fault addresses. Also exercised in PMP, VM.

Highest priority exception should be taken.

2 alignments * 2 addresses

exc_priority

cp_mstatus_ie

Interrupt Enables

ecall with mstatus.MIE = {0/1}

mpie gets mie, mie gets 0

2 MIE

cp_xstatus_ie

Interrupt Enables

if S_SUPPORTED:
ecall cross {mode = user/supervisor, medeleg[8] = {0/1}, mstatus.mie = {0/1}, mstatus.sie = {0/1}}

xpie gets xie, xie gets 0

3 modes * 2 medleg * 2 mie * 2 sie

cp_medeleg_msu

Delegation to supervisor mode

If S_SUPPORTED:
Attempt instruction/load/store access fault, instruction/load/store misaligned fault, illegal instruction, ebreak, ecall, crossed with privilege mode S/U/M crossed with medeleg = [ {1011_0001_1111_1111}, {0}, and 12 different walking 1s]

Should delegate from user/supervisor but not machine when a 1 is in the appropriate column. Note medeleg[11] is hardwired to 0 because ecall from M cannot be delegated, and medeleg[9] is 0 because delegating an ecall from supervisor mode makes it impossible to get back to machine mode.

9 ops * 3 modes * 14 medeleg

trap_del_s_mode_op
sstatus_spp
mstatus_xpie_xie_xpp_trap_op
medeleg_enc_img
medeleg_enc_txt
trap_never_trans_lower
trap_horiz
sstatus_spie
pma_indep_exec_context

Notes: xepc, xcause, xtval, xtvec, mstatus.xpp are inherently tested with exceptions taking place

Note: load/store misaligned, access fault, page fault for Zaamo, Zalrsc, Zicbo* are exercised in PMA, PMP, VM

menvcfg.STCE = 0 causes access to stimecmp outside of M mode to illegal instruction

B.2.2. Exceptions_S Supervisor-Mode Exceptions

These additional exception tests are run on configurations with supervisor mode.

The following exceptions should be exercised in supervisor mode unless otherwise noted. All inherently require Zicsr.

Table 179. Exceptions_S Coverpoints
Coverpoint Goal Feature Description Expectation Bins Normative Rule Notes

cp_instr_adr_misaligned_branch

Instruction Address Misaligned

Each type of branch taken to an address that is an odd multiple of 2
PC[1] = 0 and imm[1]=1

Only throws an exception if C is not supported.

6 branches

taken_cti_misaligned_exc
branch_misaligned_taken_exception

cp_instr_adr_misaligned_branch_nottaken

Instruction Address Misaligned

Each type of branch not taken to an address that is an odd multiple of 2

No exception

6 branches

cond_br_no_ia_misaligned_exc_not_taken
branch_misaligned_untaken_exception

cp_instr_adr_misaligned_jal

Instruction Address Misaligned

jal to an address that is an odd multiple of 2
PC[1] = 0 and imm[1]=1

Instruction at multiple of 4. Offset is an odd multiple of 2.

1

taken_cti_misaligned_exc
jump_misaligned_exception

cp_instr_adr_misaligned_jalr

Instruction Address Misaligned

jalr to an address that is an odd multiple of 2 and odd multiple of 2 + 1.
Every combination of rs1_val[1:0] and offset[1:0]

Only throws an exception if C is not supported.

4 rs1[1:0] * 4 offset[1:0]

taken_cti_misaligned_exc
jump_misaligned_exception

cp_instr_access_fault

Instruction Access Fault

Fetch instruction from unimplemented memory

Access fault

1

ia_fault_exc_on_target
stval_op_faulting_addr

cp_illegal_instruction

Illegal Instruction

Executing instruction 0x00000000 and 0xFFFFFFFF

throws an illegal instruction exception (trap and mcause)

2 instr

sstatus_spp
mstatus_xpie_xie_xpp_trap_op
sepc_op_trap_write
scause
scause_interrupt
scause_exccode_enc_tbl
stval
stval_op_illegal_instr

cp_illegal_instruction_seed

Illegal Read-only access to a CSR

csrrs x*, seed, x0 throws illegal instruction as do
csrrc x*, seed, x0
csrrsi x*, seed, 0
csrrci x*, seed, 0

Illegal instruction exception

4 csr ops

* this could be reserved and should be moved to an Zkr spreadsheet for all priv modes

cp_breakpoint

Breakpoint

ebreak throws breakpoint exception
also test when straddling 64B boundary

throws breakpoint exception (trap and mcause)

1

ebreak_debug_env_op
ebreak_debugger_transfer_op
ecall_ebreak_epc_value
trap_del_s_mode_op
sstatus_spp
mstatus_xpie_xie_xpp_trap_op
scause_exccode_enc_tbl
stval_op_faulting_addr
stval_op_breakpoint

cp_load_address_misaligned

Load Misaligned

Attempt lh, lhu, lw, lwu, ld with every combination of three address lsbs: 000 - 111

Might not cause exception

7 ops * 8 lsbs

ldst_no_exc_aligned
stval_op_faulting_addr

cp_load_access_fault

Load Access Fault

Attempt lb, lbu, lh, lhu, lw, lwu, ld from an illegal address (parameterized)

Load access fault

7 ops

mcause_exccode_ld_ldrsv
trap_del_s_mode_op

cp_store_address_misaligned

Store Misaligned

Attempt sh, sw, sd with every combination of three lsbs: 000-111

Might not cause exception

4 ops * 8 lsbs

ldst_no_exc_aligned

cp_store_access_fault

Store Access Fault

Attempt sb, sh, sw, sd from an illegal address (parameterized)

Store access fault

4 ops

mcause_exccode_st_sc_amo
trap_del_s_mode_op
stval_op_faulting_addr

cp_ecall_s

ecall

ecall from supervisor mode throws ecall supervisor exception (trap and mcause)

ecall to M-mode (should not be delegated to S-mode because there would be no path to M-mode)

1

ecall_ebreak_epc_value

cp_misaligned_priority_load
cp_misaligned_priority_store
cp_misaligned_priority_fetch

Priority of exceptions

Attempt lw and sw and fetch from memory location causing access fault and misaligned

System-dependent

3 ops

mcause_exccode_priority_misaligned

cp_stvec

Cause delegated exception in s and u mode with stvec != mtvec

Delegates to stvec handler

2 modes

stvec_sz_base
stvec_mode_enc

cp_xstatus_ie

Interrupt Enables

ecall cross {mode = user/supervisor, mstatus.mie = {0/1}, mstatus.sie = {0/1}}

xpie gets xie, xie gets 0

3 modes * 2 medleg * 2 mie * 2 sie

Note: instruction/load/store fault pages are being tested in Sv_Exceptions

Note: tests that differ from Exceptions_Sm are cp_medeleg_mu and cp_stvec. cp_misaligned_priority is split by access type.

B.2.3. Exceptions_U User-Mode Exceptions

These additional exception tests are run on configurations with user mode.

Table 180. Exceptions_U Coverpoints
Coverpoint Goal Feature Description Expectation Bins Normative Rule

cp_instr_adr_misaligned_branch

Instruction Address Misaligned

Branch taken to an address that is an odd multiple of 2
PC[1] = 0 and imm[1]=1

Only throws an exception if C is not supported.

6 branches

taken_cti_misaligned_exc
branch_misaligned_taken_exception

cp_instr_adr_misaligned_branch_nottaken

Instruction Address Misaligned

Branch not taken to an address that is an odd multiple of 2

No exception

6 branches

cond_br_no_ia_misaligned_exc_not_taken
branch_misaligned_untaken_exception

cp_instr_adr_misaligned_jal

Instruction Address Misaligned

jal to an address that is an odd multiple of 2
PC[1] = 0 and imm[1]=1

Instruction at multiple of 4. Offset is an odd multiple of 2.

1

taken_cti_misaligned_exc
jump_misaligned_exception

cp_instr_adr_misaligned_jalr

Instruction Address Misaligned

jalr to an address that is an odd multiple of 2 and odd multiple of 2 + 1.
Every combination of rs1_val[1:0] and offset[1:0]

Only throws an exception if C is not supported.

4 rs1[1:0] * 4 offset[1:0]

taken_cti_misaligned_exc
jump_misaligned_exception

cp_instr_access_fault

Instruction Access Fault

Jump to access fault address

Instruction access fault is raised (trap and mcause)

1

ia_fault_exc_on_target

cp_illegal_instruction

Illegal Instruction

Executing instruction 0x00000000 and 0xFFFFFFFF

throws an illegal instruction exception (trap and mcause)

2 instr

sstatus_spp
mstatus_xpie_xie_xpp_trap_op

cp_illegal_instruction_seed

Illegal Read-only access to a CSR

csrrs x*, seed, x0 throws illegal instruction, as do
csrrc x*, seed, x0
csrrsi x*, seed, 0
csrrci x*, seed, 0

illegal instruction exception

4 csr ops

* move to Zkr

cp_breakpoint

Breakpoint

ebreak throws breakpoint exception
also test when straddling 64B boundary

throws breakpoint exception (trap and mcause)

1

ebreak_debug_env_op
ebreak_debugger_transfer_op
ecall_ebreak_epc_value
trap_del_s_mode_op
sstatus_spp
mstatus_xpie_xie_xpp_trap_op

cp_load_address_misaligned

Load Misaligned

Attempt lh, lhu, lw, lwu, ld with every combination of three address lsbs: 000 - 111

Might not cause exception

7 ops * 8 lsbs

ldst_no_exc_aligned

cp_load_access_fault

Load Access Fault

Attempt lb, lbu, lh, lhu, lw, lwu, ld from an illegal address (parameterized)

load access fault

7 ops

mcause_exccode_ld_ldrsv
trap_del_s_mode_op

cp_store_address_misaligned

Store Misaligned

Attempt sh, sw, sd with every combination of three lsbs: 000-111

Might not cause exception

4 ops * 8 lsbs

ldst_no_exc_aligned

cp_store_access_fault

Store Access Fault

Attempt sb, sh, sw, sd from an illegal address (parameterized)

store access fault

4 ops

mcause_exccode_st_sc_amo
trap_del_s_mode_op

cp_ecall_u

ecall

ecall from user mode

throws ecall user exception (trap and mcause)

1

ecall_ebreak_epc_value
ecall_priv_mode_op

cp_misaligned_priority_load

Priority of exceptions

Attempt lb, lbu, lh, lhu, lw, (lwu, ld) from memory location causing access fault and misaligned

priority may vary.

7 ops * 8 lsbs

mcause_exccode_priority_misaligned
mcause_exccode_priority_order

cp_misaligned_priority_store

Priority of exceptions

Attempt sb, sh, sw, (sd) to memory location causing access fault and misaligned

priority may vary.

4 ops * 8 lsbs

mcause_exccode_priority_misaligned
mcause_exccode_priority_order

cp_mstatus_ie

Interrupt Enables

ecall to machine cross mie = {0/1}

mpie gets xie, mie gets 0

2 mie

B.2.4. Exceptions_F Floating-Point Exceptions

These additional exception tests are run on configurations with floating-point (at least the F extension).

Table 181. Exceptions_F Coverpoints
Coverpoint Goal Feature Description Expectation Bins Normative Rule

cp_mstatus_fs_illegal_instr

Illegal Instruction

Executing a floating-point instruction when mstatus.FS=00

causes illegal instruction exception.

19 instructions selected for testing

mstatus_fs_vs_xs_off_op

cp_mstatus_fs_csr_access

Illegal Instruction

Access (read, write, set, clear) fcsr, fflags, frm when mstatus.FS=00

causes illegal instruction exception.

3 instructions * 3 CSRs

mstatus_fs_vs_xs_off_op

cp_mstatus_fs_legal

legal instruction

Executing a floating-point instruction when mstatus.FS=01, 10, 11
cross with legal frm values

does not cause an illegal instruction exception

3 FS * 19 instructions * 5 legal frm values

mstatus_fs_wr

cp_load_address_misaligned

misaligned load

Execute flw with all 4 lsbs in address. If supported, also do flh, fld, flq.

might cause misaligned load fault

16 addresses * up to 4 instructions

ldst_no_exc_aligned
misaligned_ldst_exc_type
mcause_exccode_op
mcause_exccode_ld_ldrsv

cp_load_access_fault

load access fault

Execute flw from access fault address. If supported, also do flh, fld, flq

load access fault

up to 4 instructions

misaligned_ldst_exc_type
mcause_exccode_op
mcause_exccode_ld_ldrsv

cp_store_address_misaligned

misaligned store

Execute fsw with all 4 lsbs in address. If supported, also do fsh, fsd, fsq.

might cause misaligned load fault

16 addresses * up to 4 instructions

ldst_no_exc_aligned
misaligned_ldst_exc_type
mcause_exccode_op

cp_store_access_fault

store access fault

Execute fsw from access fault address. If supported, also do fsh, fsd, fsq.

load access fault

up to 4 instructions

misaligned_ldst_exc_type
mcause_exccode_op

B.2.5. Exceptions_Zalrsc Atomic LR/SC Exceptions

Table 182. Exceptions_Zalrsc Coverpoints
Coverpoint Goal Feature Description Expectation Bins Normative Rule

cp_load_address_misaligned

Load Misaligned

Misaligned lr.w, lr.d (8 bins for bottom 3 bits of address)

8 lsbs * 2 instr

ldst_no_exc_aligned
mcause_exccode_ld_ldrsv
lr_sc_alignment

cp_load_access_fault

Load Access Fault

Access fault of lr.w, lr.d

Access fault

2 instructions

mcause_exccode_ld_ldrsv

cp_load_access_misaligned_priority

Load with both faults

Access fault of lr.w and lr.d with misaligned address

2 instr

mcause_exccode_priority_misaligned

cp_store_address_misaligned

Store Misaligned

Misaligned sc.w, sc.d cross match lr address (8 bins for bottom 3 bits of address) cross rd having an initial value > 1

Faulting sc should not change rd

8 lsbs * 2 instr

lr_sc_alignment
mcause_exccode_st_sc_amo
ldst_no_exc_aligned

cp_store_access_fault

Store Access Fault

Access fault of sc.w, sc.d cross match lr address cross rd having an initial value > 1

Faulting sc should not change rd

2 instr

mcause_exccode_st_sc_amo
sc_retire_permission
sc_failed_as_store

cp_store_access_misaligned_priority

Store with both faults

Access fault and missalign of sc.w and sc.d cross match lr address cross rd having an initial value > 1

Faulting sc should not change rd

2 instr

mcause_exccode_priority_misaligned

B.2.6. Exceptions_Zaamo Atomic Memory Operation Exceptions

Table 183. Exceptions_Zaamo Coverpoints
Coverpoint Goal Feature Description Expectation Bins Normative Rule

cp_amo_address_misaligned

AMO Misaligned

Misaligned amoswap.w, amoadd.w, amoxor.w, amoand.w, amoor.w, amomin.w, amomax.w, amominu.w, amomaxu.w. RV64: also .d. Zabha: also .h, .b.
Use all offsets up to MISALIGNED_MAX_ATOMICITY_GRANULE_SIZE+1. This inherently tests Zama16b if it is supported.

May produce misaligned or access fault or may succeed

up to (9*4) instr * 32 lsbs

mcause_exccode_st_sc_amo
pma_mag_exc
amo_alignment
pma_mag_op_amo
misaligned_atomicity_granule_size
pma_mag_insts
Zabha_rs1_align_addr
Zacas_amocas_rs1_addr_alignment

cp_amo_access_fault

AMO Access Fault

Access fault on amoswap.w, amoadd.w, amoxor.w, amoand.w, amoor.w, amomin.w, amomax.w, amominu.w, amomaxu.w. RV64: also .d. Zabha: also .h, .b.

Access Fault.

up to (9*4) instr

mcause_exccode_st_sc_amo

B.2.7. Exceptions_Zc Compressed Instruction Exceptions

These additional exception tests are run on configurations with compressed instructions (C, Zca, Zcb, etc.). They attempt to test all compressed loads and stores, but may throw an illegal instruction fault on compressed subword load/store if Zcb is not supported.

Table 184. Exceptions_Zc Coverpoints
Coverpoint Goal Feature Description Expectation Bins Normative Rule

cp_breakpoint

Compressed breakpoint

c.ebreak

Breakpoint exception

1

mtval_ebreak_op
c-ebreak_op
c-jalr_ebreak

cp_load_address_misaligned

Compressed loads with misaligned addresses

Attempt c.lw, c.lwsp, c.ld, c.ldsp with every combination of three lsbs:000-111.
If Zcb supported, also c.lbu,c.lh, c.lhu
If Zcf supported, also c.flw, c.flwsp
If Zcd supported, also c.fld, c.fldsp

If misaligned not supported, accesses that are not naturally aligned will throw load misaligned fault.

up to 11 instructions * 8 addresses

cp_load_access_fault

Compressed loads to nonexistent address

Attempt instructions above from an illegal address (parameterized)

Load access fault

up to 11 instructions

cp_store_address_misaligned

Compressed stores with misaligned addresses

Attempt c.sw, c.swsp, c.sd,c.sdsp with every combination of three lsbs: 000-111
If Zcb supported, also c.sb, c.sh
If Zcf supported, also c.fsw, c.fswsp
If Zcd supported, also c.fsd, c.fsdsp

If misaligned not supported, accesses that are not naturally aligned will throw store misaligned fault.

up to 10 instructions * 8 addresses

cp_store_access_fault

Compressed stores to nonexistent address

Attempt instructions above to an illegal address (parameterized)

Store access fault

up to 10 instructions

cp_illegal_instruction

CompressedIllegal Instruction

c.illegal (0x0000)

Illegal instruction fault.

1

mtval_instr_bits_list
mtval_ill_instr_exc_in_low_bits
Zca_illegal
stval_op_illegal_instr_format

B.2.8. Exceptions_ZicboS Supervisor-Mode CBO Exceptions

Tests done in supervisor and user mode. Configure menvcfg via T-SBI.

Table 185. Exceptions_ZicboS Coverpoints
Coverpoint Goal Feature Description Expectation Bins Normative Rule

cp_cbie

cbo.inval

If ZICBOM_SUPPORTED & SM1P12P0_OR_LATER_SUPPORTED:
Execute cbo.inval in {supervisor/user} mode with {menvcfg x senvcfg}.cbie = {00/01/11 x 00/01/11}

Trap when prohibited

2 modes * 3 menvcfg * 3 senvcfg

menvcfg_cbie_warl_op
menvcfg_cbie_cbo-inval_op_lead_in
menvcfg_cbie_cbo-inval_op_list
senvcfg_cbie
senvcfg_cbie_umode_op
cbo-inval_s_mode_enabled_op
cbo-inval_s_mode_flush_enc
cbo-inval_s_mode_inval_enc
cbo-inval

cp_cbcfe

cbo.flushclean

If ZICBOM_SUPPORTED & SM1P12P0_OR_LATER_SUPPORTED:
Execute cbo.{clean, flush} in {supervisor/user} mode with {menvcfg x senvcfg}.cbcfe = {0/1 x 0/1}

Trap when prohibited

2 instr * 2 modes * 2 menvcfg * 2 senvcfg

menvcfg_cbcfe_op
senvcfg_cbcfe
senvcfg_cbcfe_umode_op
cbo-clean_cbo-flush

cp_cbze

cbo.zero

If ZICBOZ_SUPPORTED & SM1P12P0_OR_LATER_SUPPORTED:
Execute cbo.zero in {supervisor/user} mode with {menvcfg x senvcfg}.cbze = {0/1 x 0/1}

Trap when prohibited

2 modes * 2 menvcfg * 2 senvcfg

menvcfg_cbze_op
senvcfg_cbze
senvcfg_cbze_op
senvcfg_cbze_umode_op
cbo-zero_basedon_xenvcfg_cbze

cp_cbo_access_fault

Access fault

For each supported cbo op {inval, clean, flush, zero, prefetch.{i/w/r}}
Execute op to RVMODEL_ACCESS_FAULT_ADDRESS_STORE with menvcfg and senvcfg enabled

CBO: Store access fault
Prefetch: no access fault

7 instr * 2 modes

fault_excep_csr
cbm_unperm_fault
cbz_unperm_fault
cbp_unperm_noexcep
cbo-zero_unaligned
cbo-flush_unaligned
cbo-inval_unaligned

cp_cbo_address_misaligned

No misaligned fault

For each supported cbo op {inval, clean, flush, zero, prefetch.{i/w/r}}
Execute op to valid address + 1 with menvcfg and senvcfg enabled

No misaligned faults

7 instr * 2 modes

no_addr_misaligned_excep
cbo-zero_unaligned
cbo-flush_unaligned
cbo-inval_unaligned

B.2.9. Exceptions_ZicboU User-Mode CBO Exceptions

Tests done in user mode. Configure menvcfg via T-SBI.

Table 186. Exceptions_ZicboU Coverpoints
Coverpoint Goal Feature Description Expectation Bins Normative Rule

cp_cbie

cbo.inval

If ZICBOM_SUPPORTED & SM1P12P0_OR_LATER_SUPPORTED:
Execute cbo.inval with menvcfg.cbie = {00/01/11}

Trap when prohibited

3 vals

menvcfg_cbie_warl_op
menvcfg_cbie_cbo-inval_op_lead_in
menvcfg_cbie_cbo-inval_op_list
cbo-inval

cp_cbcfe

cbo.flushclean

If ZICBOM_SUPPORTED & SM1P12P0_OR_LATER_SUPPORTED:
Execute cbo.{clean, flush} with menvcfg.cbcfe = {0/1}

Trap when prohibited

2 instr * 2 vals

menvcfg_cbcfe_op
cbo-clean_cbo-flush

cp_cbze

cbo.zero

If ZICBOM_SUPPORTED & SM1P12P0_OR_LATER_SUPPORTED:
Execute cbo.zero with menvcfg.cbze = {0/1}

Trap when prohibited

2 vals

menvcfg_cbze_op
cbo-zero_basedon_xenvcfg_cbze

cp_cbo_access_fault

Access fault

For each supported cbo op {inval, clean, flush, zero, prefetch.{i/w/r}}
Execute op to RVMODEL_ACCESS_FAULT_ADDRESS_STORE with menvcfg enabled

CBO: Store access fault
Prefetch: no access fault

7 instr

fault_excep_csr
cbm_unperm_fault
cbz_unperm_fault
cbp_unperm_noexcep
cbo-zero_unaligned
cbo-flush_unaligned
cbo-inval_unaligned

cp_cbo_address_misaligned

No misaligned fault

For each supported cbo op {inval, clean, flush, zero, prefetch.{i/w/r}}
Execute op to valid address + 1 with menvcfg enabled

No misaligned faults

7 instr

no_addr_misaligned_excep
cbo-zero_unaligned
cbo-flush_unaligned
cbo-inval_unaligned

B.2.10. Exceptions_ZicboSm Machine-Mode CBO Exceptions

Tests done in machine mode. Only touch menvcfg if U is supported

Table 187. Exceptions_ZicboSm Coverpoints
Coverpoint Goal Feature Description Expectation Bins Normative Rule

cp_cbie

cbo.inval

If ZICBOM_SUPORTED & U_SUPPORTED & SM1P12P0_OR_LATER_SUPPORTED:
Execute cbo.inval with menvcfg.cbie = {00/01/11}

No trap

3 vals

menvcfg_cbie_warl_op

cp_cbcfe

cbo.flushclean

If ZICBOM_SUPORTED & U_SUPPORTED & SM1P12P0_OR_LATER_SUPPORTED:
Execute cbo.{clean, flush} with menvcfg.cbcfe = {0/1}

No trap

2 instr * 2 vals

menvcfg_cbcfe_op

cp_cbze

cbo.zero

If ZICBOZ_SUPORTED & U_SUPPORTED & SM1P12P0_OR_LATER_SUPPORTED:
Execute cbo.zero with menvcfg.cbze = {0/1}

No trap

2 vals

menvcfg_cbze_op

cp_cbo_access_fault

Access fault

For each supported cbo op {inval, clean, flush, zero, prefetch.{i/w/r}}
Execute op to RVMODEL_ACCESS_FAULT_ADDRESS_STORE with menvcfg enabled

CBO: Store access fault
Prefetch: no access fault

7 instr

fault_excep_csr
cbm_unperm_fault
cbz_unperm_fault
cbp_unperm_noexcep
cbo-zero_unaligned
cbo-flush_unaligned
cbo-inval_unaligned

cp_cbo_address_misaligned

No misaligned fault

For each supported cbo op {inval, clean, flush, zero, prefetch.{i/w/r}}
Execute op to valid address + 1 with menvcfg enabled

No misaligned faults

7 instr

no_addr_misaligned_excep
cbo-zero_unaligned
cbo-flush_unaligned
cbo-inval_unaligned

B.2.11. Exceptions_HSm and Exceptions_H Hypervisor Exceptions

Exceptions_HSm boots to M-mode with nothing delegated and checks that exceptions from VS and VU reach M-mode whatever hedeleg holds, ecall and ebreak from every mode, sret in VS-mode with mstatus.TSR = 1, HLV/HSV misaligned and access faults taken in M-mode, and mtval2/mtinst. Exceptions_H boots to HS-mode, walks hedeleg for exceptions from VS and VU, checks that exceptions from HS and U ignore hedeleg, ecalls into HS-mode and VS-mode, vstvec, the virtual-instruction exceptions, HLV/HSV privilege and priority, and hstatus.GVA, htval and htinst. The trap handlers check htinst and mtinst on every recorded trap. The misaligned cp_xtinst cases run only on harts that trap misaligned accesses.

The group boots to M-mode and delegates nothing (medeleg = 0), so the M-mode handler takes every trap. Its record holds mcause, mepc, mtval, mtval2, mtinst, mstatus.MPP/MPIE and mstatus.MPV/GVA. With medeleg = 0, hedeleg has no effect, so it is set only to 0 and to all of its writable bits. Each checked ecall is the T-SBI call RVTEST_TSBI_ECALL_TEST, which the M-mode handler records like any other exception. mtinst is checked on every trap as in Exceptions_H.

Table 188. Exceptions_HSm Coverpoints
Coverpoint Goal Feature Description Expectation Bins Normative Rule Notes

cp_hedeleg

hedeleg has no effect with medeleg = 0

In VS-mode and VU-mode with medeleg = 0 and hedeleg = {0, all writable bits}, raise the exceptions of Exceptions_H cp_hedeleg: {jalr to a misaligned target at the access-fault address, jalr to the access-fault address, illegal instruction all 0s and all 1s, ebreak, each load and store at scratch + 0-7, each load and store at the access-fault address, ecall}.
Each access-fault case needs RVMODEL_ACCESS_FAULT_ADDRESS_{FETCH/LOAD/STORE} for its access type.

Every exception traps to M-mode with mstatus.MPV = 1 and mstatus.MPP = the nominal privilege. Misaligned fetches, loads and stores trap or complete as the reference model does.

9 exceptions * 2 modes * 2 hedeleg (* 8 offsets for misaligned loads and stores)

hedeleg_op
H_trap_deleg

cp_ecall_to_m

ecall to M sets status bits

With medeleg = 0, ecall from M/VS/VU.

Trap to M-mode with mcause = 11, 10 or 8, mstatus.MPP = the nominal privilege, MPV = the old V, MPIE = the old MIE, MIE = 0 and GVA = 0.

3

H_trap_m_csrwrites
mstatus_mpv_op
mstatus_gva_op

cp_ebreak_to_m

ebreak to M sets status bits

With medeleg = 0, ebreak from M/VS/VU.

Trap to M-mode with mcause = 3, mstatus.MPP = the nominal privilege, MPV = the old V, MPIE = the old MIE and MIE = 0. GVA = 1 exactly when a trap from VS or VU writes the guest virtual address of the ebreak to mtval.

3

H_trap_m_csrwrites
mstatus_mpv_op
mstatus_gva_op

cp_tsr_vs_sret

mstatus.TSR does not affect VS-mode

With mstatus.TSR = 1 and hstatus.VTSR = {0/1}, execute sret in VS-mode with vsstatus.SPP = 1 and SPIE = 0

sret executes and stays in VS-mode when VTSR = 0; virtual instruction exception when VTSR = 1

2 VTSR

H_cause_virtual_instruction
H_virtinst_vs_sret_vtsr1
hstatus_vtsr_op

cp_loadstore_priv

Hypervisor load/store in M-mode

In M-mode with hstatus.HU = {0/1}, attempt {HLV.W, HLVX.WU, HSV.W} on scratch memory. vsatp and hgatp are Bare.

Succeeds; HU has no effect outside U-mode. The hsv.w result is read back.

3 instr * 2 HU

cp_priority_hlv
cp_priority_hsv

priority of misaligned and access fault in M-mode

In M-mode with hstatus.HU = {0/1}, execute {hlv.w / hsv.w} x {scratch / access-fault address} x {addr[1:0] = 00/01}. vsatp and hgatp are Bare.

An aligned access to scratch completes; the other accesses raise the access fault or address-misaligned exception the reference model raises (misaligned accesses to scratch may complete; the order of address-misaligned and access faults is implementation-defined). HU has no effect.

2 instr * 2 access * 2 misaligned * 2 HU

H_exception_priority

cp_hlv_address_misaligned

Hypervisor Load Misaligned

In M-mode with vsatp and hgatp Bare, attempt hlv.{b, bu, h, hu, w} and hlvx.{hu, wu} at scratch + each offset 0-7. For RV64, also hlv.wu and hlv.d.

Success, or for a misaligned address the load address-misaligned or access fault the reference model raises (implementation-defined). A trap sets mstatus.GVA = 1 and MPV = 0.

7 instr * 8 addr, + 2 instr on RV64

mstatus_gva_op
hlsv_op

cp_hlv_access_fault

Hypervisor Load Access Fault

In M-mode with vsatp and hgatp Bare, attempt hlv.{b, bu, h, hu, w} and hlvx.{hu, wu} at the access-fault address. For RV64, also hlv.wu and hlv.d.

Load access fault with mtval = the guest virtual address and mstatus.GVA = 1

7 instr, + 2 on RV64

hlsv_op

cp_hsv_address_misaligned

Hypervisor Store Misaligned

In M-mode with vsatp and hgatp Bare, attempt hsv.{b, h, w} at scratch + each offset 0-7, then read back scratch. For RV64, also hsv.d.

Success, or for a misaligned address the store address-misaligned or access fault the reference model raises (implementation-defined). A trap sets mstatus.GVA = 1 and MPV = 0.

3 instr * 8 addr, + 1 instr on RV64

hlsv_op

cp_hsv_access_fault

Hypervisor Store Access Fault

In M-mode with vsatp and hgatp Bare, attempt hsv.{b, h, w} at the access-fault address. For RV64, also hsv.d.

Store access fault with mtval = the guest virtual address and mstatus.GVA = 1

3 instr, + 1 on RV64

mstatus_gva_op
hlsv_op

cp_xtinst_instr_access
cp_xtinst_illegalinstr
cp_xtinst_breakpoint
cp_xtinst_virtinstr
cp_xtinst_load_access
cp_xtinst_store_access
cp_xtinst_ecall

Exceptions taken into M-mode write mtval2 and mtinst

From VS-mode with medeleg = hedeleg = 0, after M-mode writes a nonzero value to mtval2 and mtinst and enters VS-mode with mret (a T-SBI call would overwrite them), attempt each of:
jump to the access-fault address
illegal instruction all 0s
ebreak
csrr vstval
lw from the access-fault address
sw to the access-fault address
ecall

The exception traps to M-mode with mtval2 = 0 and mtinst = 0, or for lw and sw the transformed instruction.

7

H_trap_xtinst
H_trap_xtinst_exception_lead_in
H_trap_xtinst_exception_list
H_trap_xtinst_val
H_trap_xtinst_zero_ok
mtval2_sz_acc_op
mtinst_sz_acc_op

cp_xtinst_instr_misaligned
cp_xtinst_load_misaligned
cp_xtinst_store_misaligned

Misaligned exceptions taken into M-mode write mtval2 and mtinst

As above, attempt a jump to a misaligned address, a misaligned lw and a misaligned sw.

The exception traps to M-mode with mtval2 = 0 and mtinst = 0, or for lw and sw the transformed instruction.

3

H_trap_xtinst
H_trap_xtinst_exception_lead_in
H_trap_xtinst_exception_list
H_trap_xtinst_val
H_trap_xtinst_zero_ok
mtval2_sz_acc_op
mtinst_sz_acc_op

cp_xtinst_instr_misaligned is compiled only without Zca, and the load and store cases only when the hart does not perform misaligned loads and stores (UDB MISALIGNED_LDST = false). Of the current H configurations only sargantana-rv64imafdb assembles them.

The group boots to HS-mode. medeleg delegates to HS-mode every exception but the ecalls from HS-mode and M-mode (bits 9 and 11 are 0, so T-SBI calls from HS-mode reach M-mode). hedeleg is 0 except where a test delegates to VS-mode. Traps that must be taken in M-mode are in Exceptions_HSm. The trap handlers record every trap. An HS-mode record holds scause, sepc, stval, htval, htinst, sstatus.SPP/SPIE and hstatus.SPVP/SPV/GVA. An M-mode record holds mcause, mepc, mtval, mtval2, mtinst, mstatus.MPP/MPIE and mstatus.MPV/GVA. A VS-mode record holds vscause, vsepc, vstval and vsstatus.SPP/SPIE/SIE. Each checked ecall is the T-SBI call RVTEST_TSBI_ECALL_TEST, which the handler that takes it records like any other exception. htinst and mtinst are checked on every trap: zero, or for a load, store, AMO, HLV, HLVX or HSV exception (causes 4-7, 13, 15, 21, 23) the transformed instruction with Addr. Offset equal to xtval minus the original address. A required pseudoinstruction must match the reference model exactly.

Table 189. Exceptions_H Coverpoints
Coverpoint Goal Feature Description Expectation Bins Normative Rule Notes

cp_hedeleg_instr_misaligned_jalr
cp_hedeleg_instr_access_fault
cp_hedeleg_illegal_instruction
cp_hedeleg_breakpoint
cp_hedeleg_load_misaligned
cp_hedeleg_load_access_fault
cp_hedeleg_store_misaligned
cp_hedeleg_store_access_fault
cp_hedeleg_ecall

Delegation to HS or VS

In VS-mode and VU-mode, attempt {jalr to a misaligned target at the access-fault address, jalr to the access-fault address, illegal instruction all 0s and all 1s, ebreak, each load and store at scratch + 0-7, each load and store at the access-fault address, ecall} with medeleg as set by the boot, crossed with hedeleg = {0, each of bits 0-8 alone, all writable bits}.
hedeleg bit 0 is a bin only when IALIGN = 32; bits 16 and 20-23 are read-only 0. Each access-fault case needs RVMODEL_ACCESS_FAULT_ADDRESS_{FETCH/LOAD/STORE} for its access type.

An exception goes to VS-mode when its bit is set in both medeleg and hedeleg, and otherwise to HS-mode. An ecall from VS-mode always goes to HS-mode (hedeleg[10] is read-only 0). Misaligned fetches, loads and stores trap or complete as the reference model does.
The trap record holds xcause, xepc, xtval, the status fields written by the trap and, in HS-mode, htval and htinst.

9 exceptions * 2 modes * 11 hedeleg (* 8 offsets for misaligned loads and stores)

hedeleg_bits_required
hedeleg_bit0_ialign32
hedeleg_op
H_trap_deleg

Also covers hstatus.GVA, which these traps set when they write a guest virtual address to stval. Page-fault and guest-page-fault delegation is in Sv_H_twostage_cg cp_hedeleg_page_fault and cp_hedeleg_guest_page_fault.

cp_hedeleg_hs_u

Traps from HS and U ignore hedeleg

In HS-mode and U-mode with hedeleg = all writable bits, raise the same exceptions as cp_hedeleg.

Only traps from V = 1 consult hedeleg. Each exception goes to HS-mode, except an ecall from HS-mode, which goes to M-mode (medeleg[9] = 0).

9 exceptions * 2 modes

hedeleg_bits_required
hedeleg_bit0_ialign32
hedeleg_op
H_trap_deleg

cp_ecall_to_vs

ecall to VS sets status bits

With medeleg[8] = hedeleg[8] = 1 and vsstatus.SIE = {0/1}, ecall from VU-mode.

Trap to VS-mode with vscause = 8, vsstatus.SPP = 0, vsstatus.SPIE = the old SIE and vsstatus.SIE = 0.

2 vsstatus.SIE

H_trap_vs_csrwrites
vstvec_sz_acc_op

cp_ecall_to_hs

ecall to HS sets status bits

With hedeleg = 0 and medeleg delegating ecalls from U and VS, ecall from {U, VS, VU} crossed with hstatus.SPVP = {0/1}, set before the ecall.

Trap to HS-mode with scause = 8 (U, VU) or 10 (VS), sstatus.SPP = the nominal privilege, sstatus.SPIE = the old SIE, sstatus.SIE = 0, hstatus.SPV = the old V and hstatus.GVA = 0.
hstatus.SPVP becomes the nominal privilege for traps from VS and VU, and is unchanged for traps from U.

3 modes * 2 SPVP

H_trap_hs_csrwrites
hstatus_spv_op
hstatus_spvp_op
H_cause
hstatus_gva_op

cp_vstvec

Traps delegated to VS use vstvec

With hedeleg[3] = hedeleg[8] = 1 and vstvec pointing to a different trap handler than stvec, ebreak from VS-mode and ebreak and ecall from VU-mode.

Each trap goes to the vstvec handler. An ecall from VS-mode is never delegated to VS-mode (hedeleg[10] is read-only 0), so it is not part of this coverpoint.

3

H_trap_vs_csrwrites
vstvec_sz_acc_op

cp_priority_hlv
cp_priority_hsv

priority of illegal/virtual instruction, misaligned, access fault

In each of HS, VS, U and VU modes with hstatus.HU = {0/1}, execute {hlv.w / hsv.w} x {scratch / access-fault address} x {addr[1:0] = 00/01}. vsatp and hgatp are Bare.

Virtual instruction in VS and VU. Illegal instruction in U with HU = 0. Otherwise an aligned access to scratch completes, and the other accesses raise the access fault or address-misaligned exception the reference model raises (misaligned accesses to scratch may complete; the order of address-misaligned and access faults is implementation-defined).
HU has no effect outside U-mode.

4 priv * 2 instr * 2 access * 2 misaligned * 2 HU

hlsv_virtinst
hstatus_hu_op
hlsv_illegalinst
H_exception_priority

cp_virtual_instr_vs_execute_hypervisor
cp_virtual_instr_vs_read_vstval_htval
cp_virtual_instr_vs_mstatus_vsatp
cp_virtual_instr_vs_mstatus_hgatp
cp_virtual_instr_vs_sret
cp_virtual_instr_vs_s_vma_instr
cp_virtual_instr_vs_satp
cp_virtual_instr_vs_rv32_hedelegh

exercise all ways to trigger virtual-instruction exceptions from VS

In VS-mode with mstatus.TW = 0:
execute hlv.w, hlvx.wu, hsv.w, hfence.vvma, hfence.gvma
read vstval, htval, vsatp, hgatp
sret with hstatus.VTSR = 1
{sfence.vma, sinval.vma (Svinval), read satp} with hstatus.VTVM = 1
RV32 only:
read hedelegh (Priv 1.13)

virtual instruction exception; rd keeps its value and hsv.w does not write memory

13, + 1 on RV32

H_cause
H_cause_virtual_instruction
H_virtinst_xtval
H_virtinst_vu_vs_hinst
hlsv_virtinst
hfence-vvma_hfence-gvma_exceptions
H_virtinst_vu_vs_nonhigh_allowedhs_tvm0
H_virtinst_vs_sret_vtsr1
hstatus_vtsr_op
H_virtinst_vs_sfence_sinval_satp_vtvm1
hstatus_vtvm_op
H_virtinst_vu_vs32_high_allowedhs_tvm0

wfi with hstatus.VTW = 1 is in InterruptsH cp_wfi_vs. Some of these cases are also sampled by H, HSm and H_Zicntr.

cp_virtual_instr_vu_execute_h
cp_virtual_instr_vu_read_vstval_htval
cp_virtual_instr_vu_read_stval
cp_virtual_instr_vu_satp
cp_virtual_instr_vu_vsatp
cp_virtual_instr_vu_wfi
cp_virtual_instr_vu_sret
cp_virtual_instr_vu_sfence_vma
cp_virtual_instr_vu_rv32_hedelegh

exercise all ways to trigger virtual-instruction exceptions from VU

In VU-mode with mstatus.TW = 0:
execute hlv.w, hlvx.wu, hsv.w, hfence.vvma, hfence.gvma
read vstval, htval
read stval, satp, vsatp
wfi
sret, sfence.vma
RV32 only:
read hedelegh (Priv 1.13)

virtual instruction exception; rd keeps its value and hsv.w does not write memory

13, + 1 on RV32

H_cause_virtual_instruction
H_virtinst_xtval
H_virtinst_vu_vs_hinst
hlsv_virtinst
hfence-vvma_hfence-gvma_exceptions
H_virtinst_vu_vs_nonhigh_allowedhs_tvm0
H_virtinst_vu_nonhigh_supervisor_allowedhs_tvm0
H_virtinst_vu_wfi_tw0
H_virtinst_vu_sret_sfence
H_virtinst_vu_vs32_high_allowedhs_tvm0

Some of these cases are also sampled by H, HSm and H_Zicntr.

cp_loadstore_priv

Valid privilege modes of hypervisor load/store

In each privilege mode {HS/VS/U/VU} with hstatus.HU = {0/1}, attempt {HLV.W, HLVX.WU, HSV.W} on scratch memory. vsatp and hgatp are Bare.

Succeeds in HS, and in U with HU = 1; virtual instruction in VS and VU; illegal instruction in U with HU = 0. The hsv.w result is read back.

4 priv * 3 instr * 2 HU

hlsv_virtinst
hstatus_hu_op
hlsv_illegalinst
hlsv_mode
hlsv_op
hlvx-wu_valid32

cp_hstatus_gva_hlv
cp_hstatus_gva_hsv

An HLV or HSV fault taken into HS-mode sets hstatus.GVA

In HS-mode, and in U-mode with hstatus.HU = 1, execute hlv.w and hsv.w at the access-fault address (part of the cp_priority_hlv and cp_priority_hsv tests).

Access fault into HS-mode with stval = the guest virtual address and hstatus.GVA = 1.

2 modes * 2 instr

hstatus_gva_op

cp_xtinst_instr_misaligned

Instruction address misaligned writes xtinst

From VS mode with hedeleg = 0, after HS-mode writes a nonzero value to htval and htinst, jump to a misaligned address.

Instruction misaligned trap into HS-mode with htval = 0 and htinst = 0.

1

htval_sz_acc_op
htinst_sz_acc_op
H_trap_xtinst
H_trap_xtinst_exception_lead_in
H_trap_xtinst_exception_list
H_trap_xtinst_val
H_trap_xtinst_zero_ok

Compiled only without Zca, when misaligned fetches trap. Of the current H configurations only sargantana-rv64imafdb assembles it.

cp_xtinst_instr_access

Instruction access fault writes xtinst

From VS mode with hedeleg = 0, after HS-mode writes a nonzero value to htval and htinst, jump to the access-fault address.

Instruction access fault into HS-mode with htval = 0 and htinst = 0.

1

htval_sz_acc_op
htinst_sz_acc_op
H_trap_xtinst
H_trap_xtinst_exception_lead_in
H_trap_xtinst_exception_list
H_trap_xtinst_val
H_trap_xtinst_zero_ok

cp_xtinst_illegalinstr

Illegal instruction writes xtinst

From VS mode with hedeleg = 0, after HS-mode writes a nonzero value to htval and htinst, execute illegal instruction all 0s.

Illegal instruction fault into HS-mode with htval = 0 and htinst = 0.

1

htval_sz_acc_op
htinst_sz_acc_op
H_trap_xtinst
H_trap_xtinst_exception_lead_in
H_trap_xtinst_exception_list
H_trap_xtinst_val
H_trap_xtinst_zero_ok

cp_xtinst_breakpoint

breakpoint writes xtinst

From VS mode with hedeleg = 0, after HS-mode writes a nonzero value to htval and htinst, execute ebreak.

Breakpoint exception into HS-mode with htval = 0 and htinst = 0.

1

htval_sz_acc_op
htinst_sz_acc_op
H_trap_xtinst
H_trap_xtinst_exception_lead_in
H_trap_xtinst_exception_list
H_trap_xtinst_val
H_trap_xtinst_zero_ok

cp_xtinst_virtinstr

Virtual instruction writes xtinst

From VS mode with hedeleg = 0, after HS-mode writes a nonzero value to htval and htinst, csrr vstval.

Virtual instruction exception into HS-mode with htval = 0 and htinst = 0.

1

htval_sz_acc_op
htinst_sz_acc_op
H_trap_xtinst
H_trap_xtinst_exception_lead_in
H_trap_xtinst_exception_list
H_trap_xtinst_val
H_trap_xtinst_zero_ok

cp_xtinst_load_misaligned

load misaligned writes xtinst

From VS mode with hedeleg = 0, after HS-mode writes a nonzero value to htval and htinst, misaligned lw.

Load misaligned exception into HS-mode with htval = 0 and htinst = 0 or the transformed lw.

1

htval_sz_acc_op
htinst_sz_acc_op
H_trap_xtinst
H_trap_xtinst_exception_lead_in
H_trap_xtinst_exception_list
H_trap_xtinst_val
H_trap_xtinst_zero_ok

Compiled only when the hart does not perform misaligned loads and stores (UDB MISALIGNED_LDST = false). Of the current H configurations only sargantana-rv64imafdb assembles it.

cp_xtinst_load_access

load access fault writes xtinst

From VS mode with hedeleg = 0, after HS-mode writes a nonzero value to htval and htinst, lw from the access-fault address.

Load access fault into HS-mode with htval = 0 and htinst = 0 or the transformed lw.

1

htval_sz_acc_op
htinst_sz_acc_op
H_trap_xtinst
H_trap_xtinst_exception_lead_in
H_trap_xtinst_exception_list
H_trap_xtinst_val
H_trap_xtinst_zero_ok

cp_xtinst_store_misaligned

store misaligned writes xtinst

From VS mode with hedeleg = 0, after HS-mode writes a nonzero value to htval and htinst, misaligned sw.

Store misaligned exception into HS-mode with htval = 0 and htinst = 0 or the transformed sw.

1

htval_sz_acc_op
htinst_sz_acc_op
H_trap_xtinst
H_trap_xtinst_exception_lead_in
H_trap_xtinst_exception_list
H_trap_xtinst_val
H_trap_xtinst_zero_ok

Compiled only when the hart does not perform misaligned loads and stores (UDB MISALIGNED_LDST = false). Of the current H configurations only sargantana-rv64imafdb assembles it.

cp_xtinst_store_access

store access fault writes xtinst

From VS mode with hedeleg = 0, after HS-mode writes a nonzero value to htval and htinst, sw to the access-fault address.

Store access fault into HS-mode with htval = 0 and htinst = 0 or the transformed sw.

1

htval_sz_acc_op
htinst_sz_acc_op
H_trap_xtinst
H_trap_xtinst_exception_lead_in
H_trap_xtinst_exception_list
H_trap_xtinst_val
H_trap_xtinst_zero_ok

cp_xtinst_ecall

ecall writes xtinst

From VS mode with hedeleg = 0, after HS-mode writes a nonzero value to htval and htinst, ecall.

Environment call from VS-mode (cause 10) into HS-mode with htval = 0 and htinst = 0.

1

htval_sz_acc_op
htinst_sz_acc_op
H_trap_xtinst
H_trap_xtinst_exception_lead_in
H_trap_xtinst_exception_list
H_trap_xtinst_val
H_trap_xtinst_zero_ok

B.2.12. Exceptions Normative Rules

The rules apply to all Exceptions groups.

Table 190. Exceptions Normative Rules
Normative Rule Rule Text Coverpoints

ldst_no_exc_aligned

loads and stores whose effective addresses are naturally aligned shall not raise an address-misaligned exception.

Exceptions_F_cg/cp_{load_address_misaligned, store_address_misaligned}, Exceptions_S_cg/cp_{load, store}_address_misaligned, Exceptions_Sm_cg/{cp_load_address_misaligned, cp_store_address_misaligned}, Exceptions_U_cg/cp_{load, store}_address_misaligned, Exceptions_Zalrsc_cg/{cp_load_address_misaligned, cp_store_address_misaligned_legal_w}

misaligned_ldst_exc_type

loads and stores that are not naturally aligned may either complete execution successfully or raise an exception. The exception raised can be either an address-misaligned exception or an access-fault exception. For a memory access that would otherwise be able to complete except for the misalignment, an access-fault exception can be raised instead of an address-misaligned exception if the misaligned access should not be emulated, e.g., if accesses to the memory region have side effects.

Exceptions_F_cg/cp_{load_address_misaligned, store_address_misaligned, load_access_fault, store_access_fault}, Exceptions_Sm_cg/{cp_load_address_misaligned, cp_store_address_misaligned}

mstatus_fs_vs_xs_off_op

When an extension’s status is set to Off, any instruction that attempts to read or write the corresponding state will cause an illegal-instruction exception.

Exceptions_F_cg/{cp_mstatus_fs_illegal_instr, cp_mstatus_fs_csr_access}

mstatus_fs_wr

Changing the setting of FS has no effect on the contents of the floating-point register state. In particular, setting FS=Off does not destroy the state, nor does setting FS=Initial clear the contents.

Exceptions_F_cg/cp_mstatus_fs_legal

mcause_exccode_op

The Exception Code field contains a code identifying the last exception or interrupt.

Exceptions_F_cg/cp_{load_address_misaligned, store_address_misaligned, load_access_fault, store_access_fault}, Exceptions_Sm_cg/{cp_instr_access_fault, cp_illegal_instruction, cp_breakpoint, cp_load_access_fault}

mcause_exccode_ld_ldrsv

Note that load and load-reserved instructions generate load exceptions

Exceptions_F_cg/cp_{load_address_misaligned, load_access_fault}, Exceptions_S_cg/cp_load_access_fault, Exceptions_Sm_cg/{cp_load_address_misaligned, cp_load_access_fault}, Exceptions_Zalrsc_cg/{cp_load_address_misaligned, cp_load_access_fault}, Exceptions_U_cg/cp_load_access_fault

taken_cti_misaligned_exc

An instruction-address-misaligned exception is generated on a taken branch or unconditional jump if the target address is not IALIGN-bit aligned. This exception is reported on the branch or jump instruction, not on the target instruction.

Exceptions_S_cg/cp_instr_adr_misaligned_{branch, jal, jalr}, Exceptions_Sm_cg/{cp_instr_adr_misaligned_branch, cp_instr_adr_misaligned_jal, cp_instr_adr_misaligned_jalr}, Exceptions_U_cg/cp_instr_adr_misaligned_{branch, jal, jalr}

branch_misaligned_taken_exception

The conditional branch instructions will generate an instruction-address-misaligned exception if the target address is not aligned to a four-byte boundary and the branch condition evaluates to true.

Exceptions_S_cg/cp_instr_adr_misaligned_branch, Exceptions_Sm_cg/cp_instr_adr_misaligned_branch, Exceptions_U_cg/cp_instr_adr_misaligned_branch

jump_misaligned_exception

The JAL and JALR instructions will generate an instruction-address-misaligned exception if the target address is not aligned to a four-byte boundary.

Exceptions_S_cg/cp_instr_adr_misaligned_{jal, jalr}, Exceptions_Sm_cg/{cp_instr_adr_misaligned_jal, cp_instr_adr_misaligned_jalr}, Exceptions_U_cg/cp_instr_adr_misaligned_{jal, jalr}

cond_br_no_ia_misaligned_exc_not_taken

No instruction-address-misaligned exception is generated for a conditional branch that is not taken.

Exceptions_S_cg/cp_instr_adr_misaligned_branch_nottaken, Exceptions_Sm_cg/cp_instr_adr_misaligned_branch_nottaken, Exceptions_U_cg/cp_instr_adr_misaligned_branch_nottaken

branch_misaligned_untaken_exception

If the branch condition evaluates to false, the instruction-address-misaligned exception will not be raised.

Exceptions_S_cg/cp_instr_adr_misaligned_branch_nottaken, Exceptions_Sm_cg/cp_instr_adr_misaligned_branch_nottaken, Exceptions_U_cg/cp_instr_adr_misaligned_branch_nottaken

ia_fault_exc_on_target

If an instruction access-fault or instruction page-fault exception occurs on the target of a jump or taken branch, the exception is reported on the target instruction, not on the jump or branch instruction.

Exceptions_S_cg/cp_instr_access_fault, Exceptions_Sm_cg/cp_instr_access_fault, ExceptionsSv_cg/cp_instr_page_fault_s, Exceptions_U_cg/cp_instr_access_fault

ebreak_debug_env_op, ebreak_debugger_transfer_op

ebreak_debug_env_op: The EBREAK instruction is used to return control to a debugging environment. ebreak_debugger_transfer_op: The EBREAK instruction is used by debuggers to cause control to be transferred back to a debugging environment. Unless overridden by an external debug environment, EBREAK raises a breakpoint exception and performs no other operation.

Exceptions_S_cg/cp_breakpoint, Exceptions_Sm_cg/cp_breakpoint, Exceptions_U_cg/cp_breakpoint

ecall_ebreak_epc_value

ECALL and EBREAK cause the receiving privilege mode’s epc register to be set to the address of the ECALL or EBREAK instruction itself, not the address of the following instruction.

Exceptions_S_cg/{cp_ecall_s, cp_breakpoint}, Exceptions_U_cg/{cp_ecall_u, cp_breakpoint}

mcause_exccode_st_sc_amo

store, store-conditional, and AMO instructions generate store/AMO exceptions.

Exceptions_S_cg/cp_store_access_fault, Exceptions_U_cg/cp_store_access_fault, Exceptions_Zaamo_cg/cp_amo_{address_misaligned, access_fault}, Exceptions_Zalrsc_cg/{cp_store_access_fault, cp_store_address_misaligned_illegal_w}

mcause_exccode_priority_misaligned

Load/store/AMO address-misaligned exceptions may have either higher or lower priority than load/store/AMO page-fault and access-fault exceptions.

Exceptions_S_cg/cp_misaligned_priority_{load, store, fetch}, Exceptions_Sm_cg/{cp_misaligned_priority_load, cp_misaligned_priority_store}, Sv_ExceptionsSm_cg/cp_misaligned_priority_{load, store}_m, Exceptions_U_cg/cp_misaligned_priority_{load, store}, Exceptions_Zalrsc_cg/{cp_load_access_misaligned_priority, cp_store_access_misaligned_priority}

trap_del_s_mode_op

When a trap is delegated to S-mode, the scause register is written with the trap cause; the sepc register is written with the virtual address of the instruction that took the trap; the stval register is written with an exception-specific datum; the SPP field of mstatus is written with the active privilege mode at the time of the trap; the SPIE field of mstatus is written with the value of the SIE field at the time of the trap; and the SIE field of mstatus is cleared.

Exceptions_S_cg/{cp_breakpoint, cp_load_access_fault, cp_store_access_fault}, Exceptions_Sm_cg/{cp_medeleg_msu_illegalinstruction, cp_medeleg_msu_ebreak, cp_medeleg_msu_loadaccessfault}, Exceptions_U_cg/{cp_breakpoint, cp_load_access_fault, cp_store_access_fault}

sstatus_spp

The SPP bit indicates the privilege level at which a hart was executing before entering supervisor mode. When a trap is taken, SPP is set to 0 if the trap originated from user mode, or 1 otherwise. When an SRET instruction (see otherpriv) is executed to return from the trap handler, the privilege level is set to user mode if the SPP bit is 0, or supervisor mode if the SPP bit is 1; SPP is then set to 0.

Exceptions_S_cg/{cp_illegal_instruction, cp_breakpoint}, Exceptions_Sm_cg/{cp_medeleg_msu_illegalinstruction, cp_medeleg_msu_ebreak, cp_medeleg_msu_loadaccessfault}, Exceptions_U_cg/{cp_illegal_instruction, cp_breakpoint}

mstatus_xpie_xie_xpp_trap_op

When a trap is taken from privilege mode y into privilege mode x, xPIE is set to the value of xIE; xIE is set to 0; and xPP is set to y.

Exceptions_S_cg/{cp_illegal_instruction, cp_breakpoint}, Exceptions_Sm_cg/{cp_medeleg_msu_illegalinstruction, cp_medeleg_msu_ebreak, cp_medeleg_msu_loadaccessfault}, Exceptions_U_cg/{cp_illegal_instruction, cp_breakpoint}

mepc_op

When a trap is taken into M-mode, mepc is written with the virtual address of the instruction that was interrupted or that encountered the exception. Otherwise, mepc is never written by the implementation, though it may be explicitly written by software.

Exceptions_Sm_cg/{cp_instr_access_fault, cp_illegal_instruction, cp_breakpoint, cp_ecall_m}

mcause_op

When a trap is taken into M-mode, mcause is written with a code indicating the event that caused the trap. Otherwise, mcause is never written by the implementation, though it may be explicitly written by software.

Exceptions_Sm_cg/{cp_instr_access_fault, cp_illegal_instruction, cp_breakpoint, cp_load_access_fault}

mcause_exccode_enc_img

Interrupt|Exception Code|Description === 1 1 1 1|0 1 2 3|Reserved Supervisor software interrupt Reserved Machine software interrupt¶1 1 1 1|4 5 6 7|Reserved Supervisor timer interrupt Reserved Machine timer interrupt¶1 1 1 1|8 9 10 11|Reserved Supervisor external interrupt Reserved Machine external interrupt¶1 1 1 1|12 13 14-15 ≥16|Reserved Counter-overflow interrupt Reserved Designated for platform use¶0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0|0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20-23 24-31 32-47 48-63 ≥64|Instruction address misaligned Instruction access fault Illegal instruction Breakpoint Load address misaligned Load access fault Store/AMO address misaligned Store/AMO access fault Environment call from U-mode Environment call from S-mode Reserved Environment call from M-mode Instruction page fault Load page fault Reserved Store/AMO page fault Double trap Reserved Software check Hardware error Reserved Designated for custom use Reserved Designated for custom use Reserved ===

Exceptions_Sm_cg/{cp_instr_access_fault, cp_illegal_instruction, cp_breakpoint, cp_load_access_fault}

mtvec_mode_enc

Value|Name|Description === 0|Direct|All traps set pc to BASE.¶1|Vectored|Asynchronous interrupts set pc to BASE+4×cause.¶≥2| — |Reserved ===

Exceptions_Sm_cg/{cp_instr_access_fault, cp_illegal_instruction, cp_breakpoint, cp_load_access_fault}

mtvec_mode_direct_op

When MODE=Direct, all traps into machine mode cause the pc to be set to the address in the BASE field.

TODO: add a coverpoint for exceptions using mtvec direct and vectored

mtvec_mode_vectored_op

When MODE=Vectored, all synchronous exceptions into machine mode cause the pc to be set to the address in the BASE field, whereas interrupts cause the pc to be set to the address in the BASE field plus four times the interrupt cause number.

TODO: add a coverpoint for exceptions using mtvec direct and vectored

trap_def_m_mode

By default, all traps at any privilege level are handled in machine mode

Exceptions_Sm_cg/{cp_instr_access_fault, cp_illegal_instruction, cp_breakpoint, cp_load_access_fault}

load_exc_x0

Loads with a destination of x0 must still raise any exceptions and cause any other side effects even though the load value is discarded.

TODO: currently have no cp in Exceptions_Sm that tests for load with rd = x0

misaligned_ldst_eei_dependent_behavior

Loads and stores whose effective address is not naturally aligned to the referenced datatype (i.e., the effective address is not divisible by the size of the access in bytes) have behavior dependent on the EEI.

Exceptions_Sm_cg/{cp_load_address_misaligned, cp_store_address_misaligned}

misaligned_ldst_hw_support

misaligned loads and stores can be handled in hardware, or via an invisible trap into the execution environment implementation, or possibly a combination of hardware and invisible trap depending on address.

Exceptions_Sm_cg/{cp_load_address_misaligned, cp_store_address_misaligned}

misaligned_ldst_contained_or_fatal_trap

When an EEI does not guarantee misaligned loads and stores are handled invisibly, the EEI must define if exceptions caused by address misalignment result in a contained trap (allowing software running inside the execution environment to handle the trap) or a fatal trap (terminating execution).

Exceptions_Sm_cg/{cp_load_address_misaligned, cp_store_address_misaligned}

ldst_atomicity_for_aligned

naturally aligned loads and stores are guaranteed to execute atomically

Exceptions_Sm_cg/{cp_load_address_misaligned, cp_store_address_misaligned}

ecall_service_request_op

The ECALL instruction is used to make a service request to the execution environment.

Exceptions_Sm_cg/cp_ecall_m

ecall_priv_mode_op

The ECALL instruction is used to make a request to the supporting execution environment. When executed in U-mode, S-mode, or M-mode, it generates an environment-call-from-U-mode exception, environment-call-from-S-mode exception, or environment-call-from-M-mode exception, respectively, and performs no other operation.

Exceptions_Sm_cg/cp_ecall_m, Exceptions_U_cg/cp_ecall_u

mcause_exccode_priority_order

If an instruction may raise multiple synchronous exceptions, the decreasing priority order of norm:exc_priority indicates which exception is taken and reported in mcause.

Exceptions_Sm_cg/{cp_misaligned_priority_load, cp_misaligned_priority_store}, Exceptions_U_cg/cp_misaligned_priority_{load, store}

exc_priority

Priority|Exc.Code|Description === Highest|3|Instruction address breakpoint¶|12, 1|During instruction address translation: First encountered page fault or access fault¶|1|With physical address for instruction: Instruction access fault¶|2 0 8,9,11 3 3|Illegal instruction Instruction address misaligned Environment call Environment break Load/store/AMO address breakpoint¶|4,6|Optionally: Load/store/AMO address misaligned¶|13, 15, 5, 7|During address translation for an explicit memory access: First encountered page fault or access fault¶|5,7|With physical address for an explicit memory access: Load/store/AMO access fault¶Lowest|4,6|If not higher priority: Load/store/AMO address misaligned ===

Exceptions_Sm_cg/{cp_misaligned_priority_load, cp_misaligned_priority_store, cp_misaligned_priority_fetch}

medeleg_enc_img

Exceptions_Sm_cg/{cp_medeleg_msu_illegalinstruction, cp_medeleg_msu_ecall, cp_medeleg_msu_ebreak, cp_medeleg_msu_loadaccessfault}

medeleg_enc_txt

medeleg has a bit position allocated for every synchronous exception shown in norm:mcause_exccode_enc_img, with the index of the bit position equal to the value returned in the mcause register

Exceptions_Sm_cg/{cp_medeleg_msu_illegalinstruction, cp_medeleg_msu_ecall, cp_medeleg_msu_ebreak, cp_medeleg_msu_loadaccessfault}

trap_never_trans_lower

Traps never transition from a more-privileged mode to a less-privileged mode. For example, if M-mode has delegated illegal-instruction exceptions to S-mode, and M-mode software later executes an illegal instruction, the trap is taken in M-mode, rather than being delegated to S-mode.

Exceptions_Sm_cg/{cp_medeleg_msu_illegalinstruction, cp_medeleg_msu_ecall, cp_medeleg_msu_ebreak, cp_medeleg_msu_loadaccessfault}

trap_horiz

traps may be taken horizontally. Using the same example, if M-mode has delegated illegal-instruction exceptions to S-mode, and S-mode software later executes an illegal instruction, the trap is taken in S-mode.

Exceptions_Sm_cg/{cp_medeleg_msu_illegalinstruction, cp_medeleg_msu_ecall, cp_medeleg_msu_ebreak, cp_medeleg_msu_loadaccessfault}

pma_indep_exec_context

PMAs do not vary by execution context.

Exceptions_Sm_cg/{cp_medeleg_msu_instraccessfault, cp_medeleg_msu_loadaccessfault, cp_medeleg_msu_storeaccessfault}

pma_precise_recom

Precisely trapped PMA violations manifest as instruction, load, or store access-fault exceptions, distinct from virtual-memory page-fault exceptions.

Exceptions_Sm_cg/{cp_instr_access_fault, cp_load_access_fault, cp_store_access_fault}

pma_imprecise_ok

Precise PMA traps might not always be possible, for example, when probing a legacy bus architecture that uses access failures as part of the discovery mechanism. In this case, error responses from peripheral devices will be reported as imprecise bus-error interrupts.

Untestable: no I/O devices defined in profile

pma_mm_vs_io_def

The most important characterization of a given memory address range is whether it holds regular main memory or I/O devices. Regular main memory is required to have a number of properties, specified below, whereas I/O devices can have a much broader range of attributes. Memory regions that do not fit into regular main memory, for example, device scratchpad RAMs, are categorized as I/O regions.

Descriptive spec text with no separately testable behavior

pma_mm_rw

Main memory regions always support read and write of all access widths required by the attached devices

Exceptions_Sm_cg/{cp_load_address_misaligned, cp_store_address_misaligned}

pma_mm_ifetch

can specify whether instruction fetch is supported.

Untestable: profile defines no main-memory region without instruction fetch

pma_io_rwx_per_sz

I/O regions can specify which combinations of read, write, or execute accesses to which data widths are supported.

Untestable: no I/O devices defined in profile

pma_vm_hw_tbl_acc

For systems with page-based virtual memory, I/O and memory regions can specify which combinations of hardware page-table reads and hardware page-table writes are supported.

TODO: walk a page table at RVMODEL_ACCESS_FAULT_ADDRESS_LOAD and check for an access fault

pma_amo_levels

Within AMOs, there are four levels of support: AMONone, AMOSwap, AMOLogical, and AMOArithmetic. AMONone indicates that no AMO operations are supported. AMOSwap indicates that only amoswap instructions are supported in this address range. AMOLogical indicates that swap instructions plus all the logical AMOs (amoand, amoor, amoxor) are supported. AMOArithmetic indicates that all RISC-V AMOs defined by the A extension are supported.

Untestable: no I/O devices defined in profile

pma_amo_far_subset_proc

Main memory and I/O regions may only support a subset or none of the processor-supported atomic operations.

Untestable: no I/O devices defined in profile

pma_amo_Zacas_levels1

The Zacas extension defines three additional levels of support: AMOCASW, AMOCASD, and AMOCASQ.

Descriptive spec text with no separately testable behavior

pma_amo_Zacas_levels2

AMOCASW indicates that in addition to instructions indicated by AMOArithmetic-level support, the AMOCAS.W instruction is supported. AMOCASD indicates that in addition to instructions indicated by AMOCASW-level support, the AMOCAS.D instruction is supported. AMOCASQ indicates that in addition to instructions indicated by AMOCASD-level support, the AMOCAS.Q instruction is supported.

Untestable: no I/O devices defined in profile

pma_amo_Zabha_req

The AMOs specified by the Zabha extension require the same level of support as the corresponding instructions in the Zaamo standard extension or the Zacas extension.

Untestable: no I/O devices defined in profile

pma_rsrv_levels

For LR/SC, there are three levels of support indicating combinations of the reservability and eventuality properties: RsrvNone, RsrvNonEventual, and RsrvEventual. RsrvNone indicates that no LR/SC operations are supported (the location is non-reservable). RsrvNonEventual indicates that the operations are supported (the location is reservable), but without the eventual success guarantee described in the unprivileged ISA specification. RsrvEventual indicates that the operations are supported and provide the eventual success guarantee.

Untestable: no I/O devices defined in profile

pma_mag_exc

Implementations may raise access-fault exceptions instead of address-misaligned exceptions for some misaligned accesses, indicating the instruction should not be emulated by a trap handler.

Exceptions_Sm_cg/{cp_load_address_misaligned, cp_store_address_misaligned}, Exceptions_Zaamo_cg/cp_amo_address_misaligned

pma_mo_io_chan_def

Each strongly ordered I/O region specifies a numbered ordering channel, which is a mechanism by which ordering guarantees can be provided between different I/O regions.

Untestable: no I/O devices defined in profile

pma_mo_io_chan_0

Channel 0 is used to indicate point-to-point strong ordering only, where only accesses by the hart to the single associated I/O region are strongly ordered.

Untestable: no I/O devices defined in profile

pma_mo_io_chan_1

Channel 1 is used to provide global strong ordering across all I/O regions. Any accesses by a hart to any I/O region associated with channel 1 can only be observed to have occurred in program order by all other harts and I/O devices, including relative to accesses made by that hart to relaxed I/O regions or strongly ordered I/O regions with different channel numbers. In other words, any access to a region in channel 1 is equivalent to executing a fence io,io instruction before and after the instruction.

Untestable: no I/O devices defined in profile

pma_mo_io_chan_other

Other larger channel numbers provide program ordering to accesses by that hart across any regions with the same channel number

Untestable: no I/O devices defined in profile

pma_mo_dyn

Systems might support dynamic configuration of ordering properties on each memory region.

Descriptive spec text with no separately testable behavior

pma_non_cacheable

If a PMA indicates non-cacheability, then accesses to that region must be satisfied by the memory itself, not by any caches.

Untestable: no non-cacheable PMA region defined in profile

pma_idp_mm

Main memory regions are assumed to be idempotent.

Descriptive spec text with no separately testable behavior

pma_idp_no_spec

If accesses are non-idempotent, i.e., there is potentially a side effect on any read or write access, then speculative or redundant accesses must be avoided.

Untestable: no I/O devices defined in profile

pma_idp_implicit_ok

For non-idempotent regions, implicit reads and writes must not be performed early or speculatively, with the following exceptions. When a non-speculative implicit read is performed, an implementation is permitted to additionally read any of the bytes within a naturally aligned power-of-2 region containing the address of the non-speculative implicit read. Furthermore, when a non-speculative instruction fetch is performed, an implementation is permitted to additionally read any of the bytes within the next naturally aligned power-of-2 region of the same size (with the address of the region taken modulo 2XLEN).

Untestable: no I/O devices defined in profile

pma_idp_implicit_sz

The size of these naturally aligned power-of-2 regions is implementation-defined, but, for systems with page-based virtual memory, must not exceed the smallest supported page size.

Untestable: no I/O devices defined in profile

mtval_op

When a trap is taken into M-mode, mtval is either set to zero or written with exception-specific information to assist software in handling the trap. Otherwise, mtval is never written by the implementation, though it may be explicitly written by software.

Exceptions_Sm_cg/{cp_illegal_instruction, cp_breakpoint, cp_load_address_misaligned, cp_store_address_misaligned}

mtval_ebreak_op

On a breakpoint exception raised by an EBREAK or C.EBREAK instruction, mtval is written with either zero or the virtual address of the instruction.

Exceptions_Sm_cg/{cp_breakpoint, cp_ebreak_straddle64}, Exceptions_Zc_cg/cp_breakpoint

mtval_instr_bits_lead_in

The mtval register can optionally also be used to return the faulting instruction bits on an illegal-instruction exception

Exceptions_Sm_cg/cp_illegal_instruction

mtval_instr_bits_list

the actual faulting instruction the first ILEN bits of the faulting instruction the first MXLEN bits of the faulting instruction

Exceptions_Sm_cg/cp_illegal_instruction, Exceptions_Zc_cg/cp_illegal_instruction

mtval_ill_instr_exc_in_low_bits

On an illegal-instruction exception, the instruction bits are zero-extended and loaded into mtval.

Exceptions_Sm_cg/cp_illegal_instruction, Exceptions_Zc_cg/cp_illegal_instruction

amo_alignment

For AMOs, the Zaamo extension requires that the address held in rs1 be naturally aligned to the size of the operand (i.e., eight-byte aligned for doublewords and four-byte aligned for words).

Exceptions_Zaamo_cg/cp_amo_address_misaligned

pma_mag_op_amo

If a misaligned AMO accesses a region that does not specify a misaligned atomicity granule PMA, or if not all accessed bytes lie within the same misaligned atomicity granule, then an exception is raised.

Exceptions_Zaamo_cg/cp_amo_address_misaligned

misaligned_atomicity_granule_size, pma_mag_insts

misaligned_atomicity_granule_size: The misaligned atomicity granule PMA, defined in sec:misaligned-atomicity-granule, optionally relaxes this alignment requirement. If present, the misaligned atomicity granule PMA specifies the size of a misaligned atomicity granule, a power-of-two number of bytes. The misaligned atomicity granule PMA applies only to AMOs defined in the Zaamo, Zabha, and Zacas extensions; loads and stores defined in the base ISAs; loads and stores of no more than XLEN bits defined in the F, D, and Q extensions; the load-acquire and store-release instructions defined in the Zalasr extension; and compressed encodings of the foregoing loads and stores. For an instruction in that set, if all accessed bytes lie within the same misaligned atomicity granule, the instruction will not raise an exception for reasons of address alignment, and the instruction will give rise to only one memory operation for the purposes of RVWMO—​i.e., it will execute atomically. pma_mag_insts: The misaligned atomicity granule PMA applies only to AMOs defined in the Zaamo, Zabha, and Zacas extensions; loads and stores defined in the base ISAs; loads and stores of no more than XLEN bits defined in the F, D, and Q extensions; the load-acquire and store-release instructions defined in the Zalasr extension; and compressed encodings of the foregoing loads and stores.

Exceptions_Zaamo_cg/cp_amo_address_misaligned

sc_retire_permission

No SC.W instruction shall retire unless it passes memory permission checks,

Exceptions_Zalrsc_cg/cp_store_access_fault

sc_failed_as_store

For the purposes of memory protection, a failed SC.W may be treated like a store.

Exceptions_Zalrsc_cg/cp_store_access_fault

lr_sc_alignment

For LR and SC, the Zalrsc extension requires that the address held in rs1 be naturally aligned to the size of the operand (i.e., eight-byte aligned for doublewords and four-byte aligned for words). If the address is not naturally aligned, an address-misaligned exception or an access-fault exception will be generated. The access-fault exception can be generated for a memory access that would otherwise be able to complete except for the misalignment, if the misaligned access should not be emulated.

Exceptions_Zalrsc_cg/{cp_load_address_misaligned, cp_store_address_misaligned_illegal_w, cp_store_address_misaligned_illegal_d}

Zca_no_misaligned

With the addition of the Zca extension, no instructions can raise instruction-address-misaligned exceptions.

Exceptions_Sm_cg/{cp_instr_adr_misaligned_branch, cp_instr_adr_misaligned_jal, cp_instr_adr_misaligned_jalr}

Zca_illegal

A 16-bit instruction with all bits zero is permanently reserved as an illegal instruction.

Exceptions_Zc_cg/cp_illegal_instruction

c-ebreak_op

Debuggers can use the C.EBREAK instruction, which expands to EBREAK, to cause control to be transferred back to the debugging environment. C.EBREAK shares the opcode with the C.ADD instruction, but with rd and rs2 both zero, thus can also use the CR format.

Exceptions_Zc_cg/cp_breakpoint

c-jalr_ebreak

C.JALR is valid only when rs1≠x0; the code point with rs1=x0 corresponds to the C.EBREAK instruction.

Exceptions_Zc_cg/cp_breakpoint

Zca_align16

The Zca extension allows 16-bit instructions to be freely intermixed with 32-bit instructions, with the latter now able to start on any 16-bit boundary, i.e., IALIGN=16.

Exceptions_Sm_cg/cp_ebreak_straddle64

menvcfg_cbze_op

The Zicboz extension adds the CBZE (Cache Block Zero instruction enable) field to menvcfg. When the CBZE field is set to 1, it enables execution of the cache block zero instruction, CBO.ZERO, in modes less privileged than M. Otherwise, the instruction raises an illegal-instruction exception in modes less privileged than M.

Exceptions_ZicboS_cg/cp_cbze, Exceptions_ZicboSm_cg/cp_cbze, Exceptions_ZicboU_cg/cp_cbze

menvcfg_cbcfe_op

The Zicbom extension adds the CBCFE (Cache Block Clean and Flush instruction Enable) field to menvcfg. When the CBCFE field is set to 1, it enables execution of the cache block clean instruction (CBO.CLEAN) and the cache block flush instruction (CBO.FLUSH) in modes less privileged than M. Otherwise, these instructions raise an illegal-instruction exception in modes less privileged than M.

Exceptions_ZicboS_cg/cp_cbcfe, Exceptions_ZicboSm_cg/cp_cbcfe, Exceptions_ZicboU_cg/cp_cbcfe

menvcfg_cbie_warl_op

The Zicbom extension adds the CBIE (Cache Block Invalidate instruction Enable) WARL field to menvcfg to control execution of the cache block invalidate instruction (CBO.INVAL) in modes less privileged than M. When CBIE is set to 0b00, the instruction raises an illegal-instruction exception in modes less privileged than M.

Exceptions_ZicboS_cg/cp_cbie, Exceptions_ZicboSm_cg/cp_cbie, Exceptions_ZicboU_cg/cp_cbie

menvcfg_cbie_cbo-inval_op_lead_in

When CBIE is set to 0b01 or 0b11, and when enabled for execution in modes less privileged than M, it behaves as follows:

Exceptions_ZicboS_cg/cp_cbie, Exceptions_ZicboS_cg/cp_cbo_inval_data, Exceptions_ZicboU_cg/cp_cbie, Exceptions_ZicboU_cg/cp_cbo_inval_data

menvcfg_cbie_cbo-inval_op_list

0b01 — The instruction is executed and performs a flush operation, even if configured by a mode less privileged than M to perform an invalidate operation. 0b11 — The instruction is executed and performs an invalidate operation, unless configured by a mode less privileged than M to perform a flush operation.

Exceptions_ZicboS_cg/cp_cbie, Exceptions_ZicboS_cg/cp_cbo_inval_data, Exceptions_ZicboU_cg/cp_cbie, Exceptions_ZicboU_cg/cp_cbo_inval_data

senvcfg_cbcfe

The Zicbom extension adds the CBCFE (Cache Block Clean and Flush instruction Enable) field to senvcfg to control execution of the CBO.CLEAN and CBO.FLUSH instructions in U-mode.

Exceptions_ZicboS_cg/cp_cbcfe

senvcfg_cbcfe_umode_op

Execution of these instructions in U-mode is enabled only if execution of these instructions is enabled for use in S-mode and CBCFE is set to 1; otherwise, an illegal-instruction exception is raised.

Exceptions_ZicboS_cg/cp_cbcfe

senvcfg_cbie

The Zicbom extension adds the CBIE (Cache Block Invalidate instruction Enable) WARL field to senvcfg to control execution of the CBO.INVAL instruction in U-mode.

Exceptions_ZicboS_cg/cp_cbie, Exceptions_ZicboS_cg/cp_cbo_inval_data

senvcfg_cbie_umode_op

Execution of CBO.INVAL in U-mode is enabled only if execution of the instruction is enabled for use in S-mode and CBIE is set to 0b01 or 0b11; otherwise, an illegal-instruction exception is raised.

Exceptions_ZicboS_cg/cp_cbie

cbo-inval_s_mode_enabled_op

If CBO.INVAL is enabled in S-mode to perform a flush operation, then when the instruction is enabled in U-mode it performs a flush operation, even if CBIE is set to 0b11. Otherwise, the instruction behaves as follows, depending on the CBIE encoding:

Exceptions_ZicboS_cg/cp_cbie, Exceptions_ZicboS_cg/cp_cbo_inval_data

cbo-inval_s_mode_flush_enc

0b01 — The instruction is executed and performs a flush operation.

Exceptions_ZicboS_cg/cp_cbie, Exceptions_ZicboS_cg/cp_cbo_inval_data

cbo-inval_s_mode_inval_enc

0b11 — The instruction is executed and performs an invalidate operation.

Exceptions_ZicboS_cg/cp_cbie, Exceptions_ZicboS_cg/cp_cbo_inval_data

senvcfg_cbze

The Zicboz extension adds the CBZE (Cache Block Zero instruction enable) field to senvcfg.

Exceptions_ZicboS_cg/cp_cbze

senvcfg_cbze_op

The CBZE field controls execution of the cache block zero instruction (CBO.ZERO) in U-mode.

Exceptions_ZicboS_cg/cp_cbze

senvcfg_cbze_umode_op

Execution of CBO.ZERO in U-mode is enabled only if execution of the instruction is enabled for use in S-mode and CBZE is set to 1; otherwise, an illegal-instruction exception is raised.

Exceptions_ZicboS_cg/cp_cbze

cbxe_unaffected

The CBIE/CBCFE/CBZE fields in each envcfg register do not affect the read and write behavior of the same fields in the other envcfg registers.

cbo-inval

A CBO.INVAL instruction executes or raises either an illegal-instruction exception or a virtual-instruction exception based on the state of the envcfg.⁠CBIE fields:

Exceptions_ZicboS_cg/cp_cbie, Exceptions_ZicboU_cg/cp_cbie

cbo-clean_cbo-flush

A CBO.CLEAN or CBO.FLUSH instruction executes or raises an illegal-instruction or virtual-instruction exception based on the state of the envcfg.⁠CBCFE bits:

Exceptions_ZicboS_cg/cp_cbcfe, Exceptions_ZicboU_cg/cp_cbcfe

cbo-zero_basedon_xenvcfg_cbze

Finally, a CBO.ZERO instruction executes or raises an illegal-instruction or virtual-instruction exception based on the state of the envcfg.⁠CBZE bits:

Exceptions_ZicboS_cg/cp_cbze, Exceptions_ZicboU_cg/cp_cbze

fault_excep_csr

When a page-fault, guest-page-fault, or access-fault exception is taken, the relevant *tval CSR is written with the faulting effective address (i.e. the value of rs1).

Exceptions_ZicboS_cg/cp_cbo_access_fault, Exceptions_ZicboSm_cg/cp_cbo_access_fault, Exceptions_ZicboU_cg/cp_cbo_access_fault

no_addr_misaligned_excep

CMO instructions do not generate address-misaligned exceptions.

Exceptions_ZicboS_cg/cp_cbo_address_misaligned, Exceptions_ZicboSm_cg/cp_cbo_address_misaligned, Exceptions_ZicboU_cg/cp_cbo_address_misaligned

cbm_access

A cache-block management instruction is permitted to access the specified cache block whenever a load instruction or store instruction is permitted to access the corresponding physical addresses.

Zicbom_cbo_clean_cg/cp_custom_cbo

cbm_unperm_fault

If access to the cache block is not permitted, a cache-block management instruction raises a store page-fault or store guest-page-fault exception if address translation does not permit any access or raises a store access-fault exception otherwise.

Exceptions_ZicboS_cg/cp_cbo_access_fault, Exceptions_ZicboSm_cg/cp_cbo_access_fault, Exceptions_ZicboU_cg/cp_cbo_access_fault

cbz_access

A cache-block zero instruction is permitted to access the specified cache block whenever a store instruction is permitted to access the corresponding physical addresses and when the PMAs indicate that cache-block zero instructions are a supported access type.

Zicboz_cbo_zero_cg/cp_custom_cbo

cbz_unperm_fault

If access to the cache block is not permitted, a cache-block zero instruction raises a store page-fault or store guest-page-fault exception if address translation does not permit write access or raises a store access-fault exception otherwise.

Exceptions_ZicboS_cg/cp_cbo_access_fault, Exceptions_ZicboSm_cg/cp_cbo_access_fault, Exceptions_ZicboU_cg/cp_cbo_access_fault

cbp_unperm_noexcep

If access to the cache block is not permitted, a cache-block prefetch instruction does not raise any exceptions and shall not access any caches or memory.

Exceptions_ZicboS_cg/cp_cbo_access_fault, Exceptions_ZicboSm_cg/cp_cbo_access_fault, Exceptions_ZicboU_cg/cp_cbo_access_fault

cbo-zero_unaligned

It is not required that rs1 is aligned to the size of a cache block.

Exceptions_ZicboS_cg/{cp_cbo_access_fault, cp_cbo_address_misaligned}, Exceptions_ZicboSm_cg/{cp_cbo_access_fault, cp_cbo_address_misaligned}, Exceptions_ZicboU_cg/{cp_cbo_access_fault, cp_cbo_address_misaligned}

cbo-flush_unaligned

It is not required that rs1 is aligned to the size of a cache block.

Exceptions_ZicboS_cg/{cp_cbo_access_fault, cp_cbo_address_misaligned}, Exceptions_ZicboSm_cg/{cp_cbo_access_fault, cp_cbo_address_misaligned}, Exceptions_ZicboU_cg/{cp_cbo_access_fault, cp_cbo_address_misaligned}

cbo-inval_unaligned

It is not required that rs1 is aligned to the size of a cache block.

Exceptions_ZicboS_cg/{cp_cbo_access_fault, cp_cbo_address_misaligned}, Exceptions_ZicboSm_cg/{cp_cbo_access_fault, cp_cbo_address_misaligned}, Exceptions_ZicboU_cg/{cp_cbo_access_fault, cp_cbo_address_misaligned}

hedeleg_bits_required, hedeleg_bit0_ialign32

hedeleg_bits_required: Many bits of hedeleg are required specifically to be writable or zero, as enumerated in norm:hedeleg_bits_acc_tbl. hedeleg_bit0_ialign32: Bit 0, corresponding to instruction address-misaligned exceptions, must be writable if IALIGN=32.

Exceptions_H_cg/cp_hedeleg_{breakpoint, ecall, hs_u_breakpoint, hs_u_ecall, hs_u_illegal_instruction, hs_u_instr_access_fault, hs_u_instr_misaligned_jalr, hs_u_load_access_fault, hs_u_load_misaligned, hs_u_store_access_fault, hs_u_store_misaligned, illegal_instruction, instr_access_fault, instr_misaligned_jalr, load_access_fault, load_misaligned, store_access_fault, store_misaligned}

hedeleg_op, H_trap_deleg

hedeleg_op: A synchronous trap that has been delegated to HS-mode (using medeleg) is further delegated to VS-mode if V=1 before the trap and the corresponding hedeleg bit is set. H_trap_deleg: When a trap occurs in HS-mode or U-mode, it goes to M-mode, unless delegated by medeleg or mideleg, in which case it goes to HS-mode. When a trap occurs in VS-mode or VU-mode, it goes to M-mode, unless delegated by medeleg or mideleg, in which case it goes to HS-mode, unless further delegated by hedeleg or hideleg, in which case it goes to VS-mode.

Exceptions_H_cg/cp_hedeleg_{breakpoint, ecall, hs_u_breakpoint, hs_u_ecall, hs_u_illegal_instruction, hs_u_instr_access_fault, hs_u_instr_misaligned_jalr, hs_u_load_access_fault, hs_u_load_misaligned, hs_u_store_access_fault, hs_u_store_misaligned, illegal_instruction, instr_access_fault, instr_misaligned_jalr, load_access_fault, load_misaligned, store_access_fault, store_misaligned}, Exceptions_HSm_cg/cp_hedeleg_{breakpoint, ecall, illegal_instruction, instr_access_fault, instr_misaligned_jalr, load_access_fault, load_misaligned, store_access_fault, store_misaligned}

H_trap_hs_csrwrites, hstatus_spv_op, hstatus_spvp_op

H_trap_hs_csrwrites: When a trap is taken into HS-mode, virtualization mode V is set to 0, and hstatus.SPV and sstatus.SPP are set according to norm:H_trap_hs_spv_spp_tbl. If V was 1 before the trap, field SPVP in hstatus is set the same as sstatus.SPP; otherwise, SPVP is left unchanged. A trap into HS-mode also writes field GVA in hstatus, fields SPIE and SIE in sstatus, and CSRs sepc, scause, stval, htval, and htinst. hstatus_spv_op: The SPV bit (Supervisor Previous Virtualization mode) is written by the implementation whenever a trap is taken into HS-mode. Just as the SPP bit in sstatus is set to the (nominal) privilege mode at the time of the trap, the SPV bit in hstatus is set to the value of the virtualization mode V at the time of the trap. hstatus_spvp_op: When V=1 and a trap is taken into HS-mode, bit SPVP (Supervisor Previous Virtual Privilege) is set to the nominal privilege mode at the time of the trap, the same as sstatus.SPP. But if V=0 before a trap, SPVP is left unchanged on trap entry.

Exceptions_H_cg/cp_ecall_to_hs

H_trap_vs_csrwrites, vstvec_sz_acc_op

H_trap_vs_csrwrites: When a trap is taken into VS-mode, vsstatus.SPP is set according to norm:H_trap_vs_spp_tbl. Register hstatus and the HS-level sstatus are not modified, and the virtualization mode V remains 1. A trap into VS-mode also writes fields SPIE and SIE in vsstatus and writes CSRs vsepc, vscause, and vstval. vstvec_sz_acc_op: The vstvec register is a VSXLEN-bit read/write register that is VS-mode’s version of supervisor register stvec, formatted as shown in norm:vstvec_img. When V=1, vstvec substitutes for the usual stvec, so instructions that normally read or modify stvec actually access vstvec instead. When V=0, vstvec does not directly affect the behavior of the machine.

Exceptions_H_cg/cp_ecall_to_vs, Exceptions_H_cg/cp_vstvec

H_cause

The hypervisor extension augments the trap cause encoding. norm:H_cause_enc_tbl lists the possible M-mode and HS-mode trap cause codes when the hypervisor extension is implemented. Codes are added for VS-level interrupts (interrupts 2, 6, 10), for supervisor-level guest external interrupts (interrupt 12), for virtual-instruction exceptions (exception 22), and for guest-page faults (exceptions 20, 21, 23). Furthermore, environment calls from VS-mode are assigned cause 10, whereas those from HS-mode or S-mode use cause 9 as usual.

Exceptions_H_cg/cp_ecall_to_hs, Exceptions_H_cg/cp_virtual_instr_vs_execute_hypervisor

H_cause_virtual_instruction

When V=1, a virtual-instruction exception (code 22) is normally raised instead of an illegal-instruction exception if the attempted instruction is HS-qualified but is prevented from executing when V=1 either due to insufficient privilege or because the instruction is expressly disabled by a supervisor or hypervisor CSR such as scounteren or hcounteren. An instruction is HS-qualified if it would be valid to execute in HS-mode (for some values of the instruction’s register operands), assuming fields TSR and TVM of CSR mstatus are both zero.

Exceptions_H_cg/cp_virtual_instr_vs_{execute_hypervisor, mstatus_hgatp, mstatus_vsatp, read_vstval_htval, rv32_hedelegh, s_vma_instr, satp, sret}, Exceptions_H_cg/cp_virtual_instr_vu_{execute_h, read_stval, read_vstval_htval, rv32_hedelegh, satp, sfence_vma, sret, vsatp, wfi}, Exceptions_HSm_cg/cp_tsr_vs_sret

H_virtinst_xtval

On a virtual-instruction trap, mtval or stval is written the same as for an illegal-instruction trap.

Exceptions_H_cg/cp_virtual_instr_vs_{execute_hypervisor, mstatus_hgatp, mstatus_vsatp, read_vstval_htval, rv32_hedelegh, s_vma_instr, satp, sret}, Exceptions_H_cg/cp_virtual_instr_vu_{execute_h, read_stval, read_vstval_htval, rv32_hedelegh, satp, sfence_vma, sret, vsatp, wfi}

H_virtinst_vu_vs_hinst

in VS-mode or VU-mode, attempts to execute a hypervisor instruction (HLV, HLVX, HSV, or HFENCE);

Exceptions_H_cg/cp_virtual_instr_vs_execute_hypervisor, Exceptions_H_cg/cp_virtual_instr_vu_execute_h

H_virtinst_vu_vs_nonhigh_allowedhs_tvm0

in VS-mode or VU-mode, attempts to access an implemented non-high-half hypervisor CSR or VS CSR when the same access (read/write) would be allowed in HS-mode, assuming mstatus.TVM=0;

Exceptions_H_cg/cp_virtual_instr_vs_{read_vstval_htval, mstatus_hgatp}, Exceptions_H_cg/cp_virtual_instr_vu_{read_vstval_htval, vsatp}

H_virtinst_vu_vs32_high_allowedhs_tvm0

in VS-mode or VU-mode, if XLEN=32, attempts to access an implemented high-half hypervisor CSR or high-half VS CSR when the same access (read/write) to the CSR’s low-half partner would be allowed in HS-mode, assuming mstatus.TVM=0;

Exceptions_H_cg/cp_virtual_instr_{vs, vu}_rv32_hedelegh

H_virtinst_vu_wfi_tw0

in VU-mode, attempts to execute WFI when mstatus.TW=0

Exceptions_H_cg/cp_virtual_instr_vu_wfi

H_virtinst_vu_sret_sfence

or to execute a supervisor instruction (SRET or SFENCE);

Exceptions_H_cg/cp_virtual_instr_vu_{sret, sfence_vma}

H_virtinst_vu_nonhigh_supervisor_allowedhs_tvm0

in VU-mode, attempts to access an implemented non-high-half supervisor CSR when the same access (read/write) would be allowed in HS-mode, assuming mstatus.TVM=0;

Exceptions_H_cg/cp_virtual_instr_vu_{read_stval, satp}

H_virtinst_vs_sret_vtsr1, hstatus_vtsr_op

H_virtinst_vs_sret_vtsr1: in VS-mode, attempts to execute SRET when hstatus.VTSR=1 hstatus_vtsr_op: When VTSR=1, an attempt in VS-mode to execute SRET raises a virtual-instruction exception.

Exceptions_H_cg/cp_virtual_instr_vs_sret, Exceptions_HSm_cg/cp_tsr_vs_sret

H_virtinst_vs_sfence_sinval_satp_vtvm1

in VS-mode, attempts to execute an SFENCE.VMA or SINVAL.VMA instruction or to access satp, when hstatus.VTVM=1.

Exceptions_H_cg/cp_virtual_instr_vs_{s_vma_instr, satp}

hstatus_vtvm_op

When VTVM=1, an attempt in VS-mode to execute SFENCE.VMA or SINVAL.VMA or to access CSR satp raises a virtual-instruction exception.

Exceptions_H_cg/cp_virtual_instr_vs_{s_vma_instr, satp}

hlsv_virtinst

Attempts to execute a virtual-machine load/store instruction (HLV, HLVX, or HSV) when V=1 cause a virtual-instruction exception.

Exceptions_H_cg/cp_virtual_instr_vs_execute_hypervisor, Exceptions_H_cg/cp_virtual_instr_vu_execute_h, Exceptions_H_cg/cp_loadstore_priv, Exceptions_H_cg/cp_priority_{hlv, hsv}

hfence-vvma_hfence-gvma_exceptions

Attempts to execute HFENCE.VVMA or HFENCE.GVMA when V=1 cause a virtual-instruction exception, while attempts to do the same in U-mode cause an illegal-instruction exception. Attempting to execute HFENCE.GVMA in HS-mode when mstatus.TVM=1 also causes an illegal-instruction exception.

Exceptions_H_cg/cp_virtual_instr_vs_execute_hypervisor, Exceptions_H_cg/cp_virtual_instr_vu_execute_h

hstatus_hu_op

Field HU (Hypervisor in U-mode) controls whether the virtual-machine load/store instructions, HLV, HLVX, and HSV, can be used also in U-mode. When HU=1, these instructions can be executed in U-mode the same as in HS-mode. When HU=0, all hypervisor instructions cause an illegal-instruction exception in U-mode.

Exceptions_H_cg/cp_loadstore_priv, Exceptions_H_cg/cp_priority_{hlv, hsv}

hlsv_illegalinst

Attempts to execute one of these same instructions from U-mode when hstatus.HU=0 cause an illegal-instruction exception.

Exceptions_H_cg/cp_loadstore_priv, Exceptions_H_cg/cp_priority_{hlv, hsv}

H_exception_priority

If an instruction raises multiple synchronous exceptions, the decreasing priority order of norm:H_exc_priority_tbl indicates which exception is taken and reported in mcause or scause.

Exceptions_H_cg/cp_priority_{hlv, hsv}, Exceptions_HSm_cg/cp_priority_{hlv, hsv}

hstatus_gva_op

Field GVA (Guest Virtual Address) is written by the implementation whenever a trap is taken into HS-mode. For any trap (breakpoint, address misaligned, access fault, page fault, or guest-page fault) that writes a guest virtual address to stval, GVA is set to 1. For any other trap into HS-mode, GVA is set to 0.

Exceptions_H_cg/cp_hstatus_gva_{hlv, hsv}, Exceptions_H_cg/cp_ecall_to_hs

htval_sz_acc_op

The htval register is an HSXLEN-bit read/write register formatted as shown in htvalreg. When a trap is taken into HS-mode, htval is written with additional exception-specific information, alongside stval, to assist software in handling the trap.

Exceptions_H_cg/cp_xtinst_{breakpoint, ecall, illegalinstr, instr_access, instr_misaligned, load_access, load_misaligned, store_access, store_misaligned, virtinstr}

htinst_sz_acc_op

The htinst register is an HSXLEN-bit read/write register formatted as shown in htinstreg. When a trap is taken into HS-mode, htinst is written with a value that, if nonzero, provides information about the instruction that trapped, to assist software in handling the trap. The values that may be written to htinst on a trap are documented in tinst-vals.

Exceptions_H_cg/cp_xtinst_{breakpoint, ecall, illegalinstr, instr_access, instr_misaligned, load_access, load_misaligned, store_access, store_misaligned, virtinstr}

H_trap_xtinst, H_trap_xtinst_exception_lead_in, H_trap_xtinst_exception_list, H_trap_xtinst_val, H_trap_xtinst_zero_ok

H_trap_xtinst: On any trap into M-mode or HS-mode, one of these values is written automatically into the appropriate trap instruction CSR, mtinst or htinst: H_trap_xtinst_exception_lead_in: On a synchronous exception, if a nonzero value is written, one of the following shall be true about the value: H_trap_xtinst_exception_list: Bit 0 is 1, and replacing bit 1 with 1 makes the value into a valid encoding of a standard instruction. In this case, the instruction that trapped is the same kind as indicated by the register value, and the register value is the transformation of the trapping instruction, as defined later. For example, if bits 1:0 are binary 11 and the register value is the encoding of a standard LW (load word) instruction, then the trapping instruction is LW, and the register value is the transformation of the trapping LW instruction. Bit 0 is 1, and replacing bit 1 with 1 makes the value into an instruction encoding that is explicitly designated for a custom instruction (not an unused reserved encoding). This is a custom value. The instruction that trapped is a non-standard instruction. The interpretation of a custom value is not otherwise specified by this standard. The value is one of the special pseudoinstructions defined later, all of which have bits 1:0 equal to 00. H_trap_xtinst_val: norm:H_trap_xtinst_val_tbl shows the values that may be automatically written to the trap instruction register for each standard exception cause. For exceptions that prevent the fetching of an instruction, only zero or a pseudoinstruction value may be written. A custom value may be automatically written only if the instruction that traps is non-standard. A future standard or extension may permit other values to be written, chosen from the set of allowed values established earlier. H_trap_xtinst_zero_ok: Except when a pseudoinstruction value is required (described later), the value written to mtinst or htinst may always be zero, indicating that the hardware is providing no information in the register for this particular trap.

Exceptions_H_cg/cp_xtinst_{breakpoint, ecall, illegalinstr, instr_access, instr_misaligned, load_access, load_misaligned, store_access, store_misaligned, virtinstr}, Exceptions_HSm_cg/cp_xtinst_{breakpoint, ecall, illegalinstr, instr_access, instr_misaligned, load_access, load_misaligned, store_access, store_misaligned, virtinstr}

H_trap_m_csrwrites

When a trap is taken into M-mode, virtualization mode V gets set to 0, and fields MPV and MPP in mstatus (or mstatush) are set according to norm:H_trap_m_mpv_mpp_tbl. A trap into M-mode also writes fields GVA, MPIE, and MIE in mstatus/mstatush and writes CSRs mepc, mcause, mtval, mtval2, and mtinst.

Exceptions_HSm_cg/cp_ecall_to_m, Exceptions_HSm_cg/cp_ebreak_to_m

mstatus_mpv_op

The MPV bit (Machine Previous Virtualization Mode) is written by the implementation whenever a trap is taken into M-mode. Just as the MPP field is set to the (nominal) privilege mode at the time of the trap, the MPV bit is set to the value of the virtualization mode V at the time of the trap. When an MRET instruction is executed, the virtualization mode V is set to MPV, unless MPP=3, in which case V remains 0.

Exceptions_HSm_cg/cp_ecall_to_m, Exceptions_HSm_cg/cp_ebreak_to_m

mstatus_gva_op

Field GVA (Guest Virtual Address) is written by the implementation whenever a trap is taken into M-mode. For any trap (breakpoint, address misaligned, access fault, page fault, or guest-page fault) that writes a guest virtual address to mtval, GVA is set to 1. For any other trap into M-mode, GVA is set to 0.

Exceptions_HSm_cg/cp_ecall_to_m, Exceptions_HSm_cg/cp_ebreak_to_m, Exceptions_HSm_cg/cp_hlv_address_misaligned, Exceptions_HSm_cg/cp_hsv_access_fault

hlsv_op

For every RV32I or RV64I load instruction, LB, LBU, LH, LHU, LW, LWU, and LD, there is a corresponding virtual-machine load instruction: HLV.B, HLV.BU, HLV.H, HLV.HU, HLV.W, HLV.WU, and HLV.D. For every RV32I or RV64I store instruction, SB, SH, SW, and SD, there is a corresponding virtual-machine store instruction: HSV.B, HSV.H, HSV.W, and HSV.D. Instructions HLV.WU, HLV.D, and HSV.D are not valid for RV32, of course.

Exceptions_HSm_cg/cp_{hlv_address_misaligned, hsv_address_misaligned, hlv_access_fault, hsv_access_fault}

mtval2_sz_acc_op

The mtval2 register is an MXLEN-bit read/write register formatted as shown in mtval2reg. When a trap is taken into M-mode, mtval2 is written with additional exception-specific information, alongside mtval, to assist software in handling the trap.

Exceptions_HSm_cg/cp_xtinst_{breakpoint, ecall, illegalinstr, instr_access, instr_misaligned, load_access, load_misaligned, store_access, store_misaligned, virtinstr}

mtinst_sz_acc_op

The mtinst register is an MXLEN-bit read/write register formatted as shown in mtinstreg. When a trap is taken into M-mode, mtinst is written with a value that, if nonzero, provides information about the instruction that trapped, to assist software in handling the trap. The values that may be written to mtinst on a trap are documented in tinst-vals.

Exceptions_HSm_cg/cp_xtinst_{breakpoint, ecall, illegalinstr, instr_access, instr_misaligned, load_access, load_misaligned, store_access, store_misaligned, virtinstr}

UDB Parameters: None.

B.2.13. Sv Virtual Memory Exceptions

The Sv suite contains the virtual-memory exception tests, in the Sv_Exceptions* groups. See Section B.7.

B.3. Interrupts

Interrupt tests are organized according to the privilege mode or extension supported. InterruptsSm boots to M-mode and exercises interrupts in every supported privilege mode; InterruptsS boots to S-mode and exercises only the interrupts visible to supervisor software. The Sstc tests check access to the stimecmp register; the timer interrupts that stimecmp generates are covered by the cp_trigger_sti_sstc and cp_write_stip_sstc coverpoints of the Interrupts tests.

B.3.1. InterruptsSm Machine-Mode Interrupts

These tests are run on any configuration with machine mode that supports interrupts.

Tests if Sm exists (not run for RVA23 certification) Boot to MMODE, run tests in each supported priv mode of <M,S,U,VS,VU> Reference model needs to know if each of the 10 types of interrupts are supported menvcfg.STCE = 0 unless otherwise stated mideleg = 0s unless otherwise stated. mtvec.MODE uses boot value RVTEST_SET_MTI_INT writes mtimecmp = 0 (with tsbi if necessary) Define ways to cause all of the interrupts that are standard as much as possible, only need RV macros for special stuff

Table 191. InterruptsSm Test Setup
Step Sm S U VS VU

setup_interrupts_sm

write mstatus.MIE = {0/1}, SIE = {0/1}
write mideleg = {0s/1s}
write mie = 1s
write mtvec.MODE = {00, 01} if each supported

Same as Sm

Same as Sm

Same as Sm
mideleg.VS*I are read-only 1 and hideleg boots with 0s, so VS-level interrupts trap to HS

Same as VS

trigger_interrupts <type>

RVTEST_SET_<type>_INT_<priv>
RVTEST_IDLE_FOR_INTERRUPT to wait for interrupt
RVTEST_CLR_<type>_INT_<priv>

Same as Sm but with priv = S

Same as S but with priv = U

Coverpoint

mideleg<typ> = {0, 1 if UDB_<TYPE>_DELEGATION_SUPPORTED}
mie<type> = 1 if UDB_<TYPE>_SUPPORTED}
mstatus.MIE = {0/1}, SIE = 1 if S_SUPPORTED

Same as Sm

Same as S

Expectation

<type> pending if UDB_<TYPE>_SUPPORTED and mideleg = 0, trap if MIE=1

<type> pending if UDB_<TYPE>_SUPPORTED, trap if SIE = 1

pending and trap if UDB_<TYPE>_SUPPORTED

Table 192. InterruptsSm Coverpoints
Coverpoint Goal Feature Description Expectation Bins Normative Rule

cp_trigger

Assert each interrupt

For <type> = {LCOFI, MTI, MSI, MEI, STI, SSI, SEI, VSTI, VSEI, VSSI}
setup_interrupts_sm
trigger_interrupts_<type>

supported interrupts will fire if
- not delegted to a lower priv mode than the current mode
- enabled by MIE if running in M mode and not delegated

10 int * 5 priv * 2 MIE * 2 SIE * 2 vecMODE * 2 mideleg

trap_never_trans_lower
trap_del_intr_priv_lvl
mepc_op
mcause_op
mcause_intr_op
mcause_exccode_op
mcause_exccode_enc_img
trap_def_m_mode
mtvec_mode_enc
mtvec_mode_direct_op
mtvec_mode_vectored_op
mstatus_mie_sie_exist
mstatus_mie_sie_op
mstatus_xie_intr_en_dis
mstatus_xpie_xpp_op
mstatus_xpie_xie_xpp_trap_op
mip_mie_enc_txt
mip_enc_img
mip_mie_std_enc_txt
mip_std_enc_img
mideleg_enc_img
mideleg_enc_txt
mip_bits_rdonly_op
mip_meip_mie_meie_op
mip_meip_rdonly
mip_mtip_mie_mtie_op
mip_mtip_rdonly
mip_msip_mie_msie_op
mip_msip_rdonly
msip_sz_acc
msip_update_max_time
mtime_intr_pending
mtime_intr_taken
mtime_intr_mtip_visibility
mip_seip_mie_seie_op
intr_sei_op
mip_stip_mie_stie_op
mip_stip_no_stimecmp_acc
mip_stip_no_stimecmp_mmode_write
mip_ssip_mie_ssie_op
mip_ssip_intr_ctrl
intr_mip_mie_op
intr_mip_mie_bounded_time
mtval_other_traps_zero
mstatus_mie_op
mstatus_sie_op
mstatus_xpie_op
mstatus_xpp_op
mstatus_xpie_trap_op
mstatus_xie_trap_op

cp_trigger_reg

Same as cp_trigger, but use mip.SEIP, mip.SSIP, and sip.SSIP rather than macros.

same as above

3 int * 5 priv * 2 MIE * 2 SIE * 2 vecMODE * 2 mideleg

mip_seip_rdcsr
mip_seip_wrcsr

cp_trigger_sti_sstc

STI with SSTC

if SSTC_SUPPORTED:
setup_interrupts_sm
write menvcfg.STCE = {0/1}
trigger_interrupts_SSTC

STI should trigger if
STCE = 1
- when mideleg = 0, MIE = 1, running in M mode,
anytime running in non M mode,

5 priv * 2 STCE * 2 MIE * 2 SIE * 2 vecMODE * 2 mideleg

mip_stip_mie_stie_op
mip_stip_reflects_stimecmp
mip_stip_stimecmp_clr
menvcfg_stce_enable_op
menvcfg_stce_zero_op
menvcfg_stce_zero_vstip
menvcfg_stce_exists
menvcfg_stce_rdonly0
mip_sip_stip_op
sip_stip_sie_stie

cp_trigger_vsti_sstc

VSTI with Sstc

if H_SUPPORTED and SSTC_SUPPORTED:
In M-mode with menvcfg.STCE = henvcfg.STCE = 1, hie.VSTIE = 1, vsstatus.SIE = 1 and hideleg.VSTI = {0/1}, write vstimecmp = 0 and change to VS-mode

VS-mode takes STI (cause 5) when hideleg.VSTI = 1; HS-mode takes VSTI (cause 6) otherwise

2 hideleg

hip_vstip_enable
hideleg_op

cp_enable

Enables control interrupts

mideleg = 0 (if S_SUPPORTED)
write mstatus.MIE = 1
For <type> in <types above>:
mie = {1 in type, 1s everywhere except type}
RVTEST_SET_<type>_INT
RVTEST_IDLE_FOR_INT
RVTEST_CLR_<type>_INT

Interrupt if mie and mip match

10 int * 5 priv * 2 mie

mip_mie_enc_txt
mie_enc_img
mip_mie_std_enc_txt
mie_std_enc_img
mip_meip_mie_meie_op
mip_mtip_mie_mtie_op
mip_msip_mie_msie_op
mip_seip_mie_seie_op
mip_stip_mie_stie_op
mip_ssip_mie_ssie_op
intr_mip_mie_op
intr_mip_mie_xret_csrwr
mtime_intr_taken

cp_priority_mip

Priority of pending interrupts

mideleg = 0 (if S_SUPPORTED)
write mstatus.MIE = 1
write mie = 0s
RVTEST_SET_<type>_INT (10 choose 2) pairs of mip.<TYPE1, TYPE2>
write mie = 1s
RVTEST_IDLE_FOR_INT
RVTEST_CLR_<type>_INT for both

if supported - higher priority interrupt will fire

45 int * 5 priv

mip_enc_img
mip_std_enc_img
intr_m_mode_pri

cp_priority_mie

Priority of enabled interrupts

mideleg = 0 (if S_SUPPORTED)
write mstatus.MIE = 1
write mie = 0s
RVTEST_SET_<type>_INT for all 10 types
write mie with two ones for all (10 choose 2) pairs
RVTEST_IDLE_FOR_INT
RVTEST_CLR_<type>_INT for all

if supported - higher priority enabled interrupt will fire

45 int * 5 priv

mie_enc_img
mie_std_enc_img
intr_m_mode_pri

cp_priority_mideleg

Priority of delegated interrupts

if S_SUPPORTED:
write mstatus.MIE = 1
write mie = 0s
RVTEST_SET_<type>_INT (10 choose 2) pairs of mip.<TYPE1, TYPE2>
mideleg = 0s except {1 in TYPE1, 1 in TYPE2} (one at a time)
write mie = 1s
RVTEST_IDLE_FOR_INT
RVTEST_CLR_<type>_INT for both

if supported - undelegated interrupt takes priority

21 int * 2 mideleg * 5 priv

medeleg_mideleg_per_bit_rw
medeleg_mideleg_delegate_op
mideleg_enc_img
mideleg_enc_txt
intr_m_mode_highest_pri
trap_del_intr_priv_lvl
intr_mip_mie_op

cp_wfi

WFI waits until timer interrupt

Only test if machine timer interrupts are supported
Do not test in U mode if S_SUPPORTED
mideleg = 0 (if S_SUPPORTED)
write mstatus.TW = 0 (also 1 in M-mode)
write mstatus.MIE = {0/1}
write mie.MTIE = 1
RVTEST_SET_MTI_SOON to set MTIMECMP = TIME + RVMODEL_TIMER_INT_SOON_DELAY
do {
WFI instruction
} until MTI has fired (see Zawrs)
RVTEST_CLR_MTI_INT

Wait for timer interrupt. MIE, SIE and TW should not affect results.

4priv * 2 MIE + M mode * 2 MIE * 2 TW

mstatus_tw_op
wfi_op
wfi_all_privileged_modes
wfi_opt_u_mode
wfi_mepc_val
wfi_resume_reason
wfi_unaffected_conditions
wfi_resume_any_priv

cp_wfi_timeout

WFI waits until timeout

Only applies to modes < M
write mstatus.TW = 1 (also 0 in U-mode if S_SUPPORTED)
write mstatus.MIE = {0/1}
write mie.MTIE = {0/1}
WFI instruction

Note: may need sufficient Sail parameter to determine if we get illegal instruction or if WFI just retires. Or may need to accept both behaviors.

4 priv * 2 MIE * 2 MTIE

mstatus_tw_warl
mstatus_tw_op
mstatus_tw_umode_op
wfi_ill_exc
MSTATUS_TW_TIME_LIMIT
MSTATUS_TW_ALWAYS_ILLEGAL

cp_wfi_vs

WFI waits in VS-mode until timer interrupt

As cp_wfi, in VS-mode, with mstatus.TW = 0 and hstatus.VTW = 0

Wait for timer interrupt. mstatus.MIE does not affect results.

2 MIE

mstatus_tw_op
hstatus_vtw_op
H_virtinst_wfi_vtw1_tw0
vtw_virtinstr

cp_wfi_timeout_vs
cp_wfi_timeout_vs_vtw_one

WFI in VS-mode follows mstatus.TW and hstatus.VTW

As cp_wfi_timeout, in VS-mode, with (mstatus.TW, hstatus.VTW) = (1, 0), (1, 1), (0, 1)

TW = 1 raises illegal instruction. TW = 0, VTW = 1 raises virtual instruction. Either may instead complete within a bounded time.

3 TW/VTW * 2 MIE * 2 mie.MTIE

mstatus_tw_op
hstatus_vtw_op
H_virtinst_wfi_vtw1_tw0
vtw_virtinstr

cp_wfi_vs_tw_vtw

WFI in VS-mode with every mstatus.TW and hstatus.VTW

The full cross of mstatus.TW and hstatus.VTW for VS-mode WFI with MIE = {0/1}: the waiting WFI of cp_wfi_vs (TW = VTW = 0) and the trapping WFIs of cp_wfi_timeout_vs and cp_wfi_timeout_vs_vtw_one.

As cp_wfi_vs, cp_wfi_timeout_vs and cp_wfi_timeout_vs_vtw_one

2 TW * 2 VTW * 2 MIE

mstatus_tw_op
hstatus_vtw_op
H_virtinst_wfi_vtw1_tw0
vtw_virtinstr

cp_wfi_timeout_vu

WFI in VU-mode follows mstatus.TW, not hstatus.VTW

As cp_wfi_timeout, in VU-mode, with mstatus.TW = {0/1} and hstatus.VTW = {0/1}

TW = 1 raises illegal instruction (or completes within a bounded time). TW = 0 raises virtual instruction whatever VTW is.

2 TW * 2 VTW * 2 MIE * 2 mie.MTIE

mstatus_tw_op
H_virtinst_vu_wfi_tw0

cp_write_stip_sstc

test STIP writability when SSTC supported

if SSTC_SUPPORTED:
In M mode
mideleg = 0
mie = 0s
Write menvcfg.STCE = 1
Write stimecmp = 0s/1s x mip.STIP = {0/1}
Read back STIP & sigupd
Clear STIP through stimecmp

mip.STIP is controlled by stimecmp, ignores writes.

2 stimecmp x 2 STIP

menvcfg_stce_enable_op
menvcfg_stce_zero_op
menvcfg_stce_zero_vstip
menvcfg_stce_exists
menvcfg_stce_rdonly0
mip_sip_stip_op
sip_stip_sie_stie

Table 193. InterruptsSm Normative Rules
Normative Rule Rule Text Coverpoints

mepc_op

When a trap is taken into M-mode, mepc is written with the virtual address of the instruction that was interrupted or that encountered the exception. Otherwise, mepc is never written by the implementation, though it may be explicitly written by software.

InterruptsSm_cg/{cp_trigger, cp_trigger_tsbi}

mcause_op

When a trap is taken into M-mode, mcause is written with a code indicating the event that caused the trap. Otherwise, mcause is never written by the implementation, though it may be explicitly written by software.

InterruptsSm_cg/{cp_trigger, cp_trigger_tsbi}

mcause_intr_op

The Interrupt bit in the mcause register is set if the trap was caused by an interrupt.

InterruptsSm_cg/{cp_trigger, cp_trigger_tsbi}

mcause_exccode_op

The Exception Code field contains a code identifying the last exception or interrupt.

InterruptsSm_cg/{cp_trigger, cp_trigger_tsbi}

mcause_exccode_enc_img

Interrupt|Exception Code|Description === 1 1 1 1|0 1 2 3|Reserved Supervisor software interrupt Reserved Machine software interrupt¶1 1 1 1|4 5 6 7|Reserved Supervisor timer interrupt Reserved Machine timer interrupt¶1 1 1 1|8 9 10 11|Reserved Supervisor external interrupt Reserved Machine external interrupt¶1 1 1 1|12 13 14-15 ≥16|Reserved Counter-overflow interrupt Reserved Designated for platform use¶0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0|0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20-23 24-31 32-47 48-63 ≥64|Instruction address misaligned Instruction access fault Illegal instruction Breakpoint Load address misaligned Load access fault Store/AMO address misaligned Store/AMO access fault Environment call from U-mode Environment call from S-mode Reserved Environment call from M-mode Instruction page fault Load page fault Reserved Store/AMO page fault Double trap Reserved Software check Hardware error Reserved Designated for custom use Reserved Designated for custom use Reserved ===

InterruptsSm_cg/{cp_trigger, cp_trigger_tsbi}

trap_def_m_mode

By default, all traps at any privilege level are handled in machine mode

InterruptsSm_cg/{cp_trigger, cp_trigger_tsbi}

mtvec_mode_enc

Value|Name|Description === 0|Direct|All traps set pc to BASE.¶1|Vectored|Asynchronous interrupts set pc to BASE+4×cause.¶≥2| — |Reserved ===

InterruptsSm_cg/cp_trigger

mtvec_mode_direct_op

When MODE=Direct, all traps into machine mode cause the pc to be set to the address in the BASE field.

InterruptsSm_cg/{cp_trigger, cp_trigger_tsbi}

mtvec_mode_vectored_op

When MODE=Vectored, all synchronous exceptions into machine mode cause the pc to be set to the address in the BASE field, whereas interrupts cause the pc to be set to the address in the BASE field plus four times the interrupt cause number.

InterruptsSm_cg/{cp_trigger, cp_trigger_tsbi}

mstatus_mie_sie_exist

Global interrupt-enable bits, MIE and SIE, are provided for M-mode and S-mode respectively.

InterruptsSm_cg/cp_trigger

mstatus_mie_sie_op

When a hart is executing in privilege mode x, interrupts are globally enabled when xIE=1 and globally disabled when xIE=0.

InterruptsSm_cg/{cp_trigger, cp_wfi_m}

mstatus_xie_intr_en_dis

Interrupts for lower-privilege modes, w<x, are always globally disabled regardless of the setting of any global wIE bit for the lower-privilege mode. Interrupts for higher-privilege modes, y>x, are always globally enabled regardless of the setting of the global yIE bit for the higher-privilege mode.

InterruptsSm_cg/{cp_trigger, cp_trigger_tsbi}

mstatus_xpie_xpp_op

each privilege mode x that can respond to interrupts has a two-level stack of interrupt-enable bits and privilege modes. xPIE holds the value of the interrupt-enable bit active prior to the trap, and xPP holds the previous privilege mode.

InterruptsSm_cg/{cp_trigger, cp_trigger_tsbi}

mstatus_xpie_xie_xpp_trap_op

When a trap is taken from privilege mode y into privilege mode x, xPIE is set to the value of xIE; xIE is set to 0; and xPP is set to y.

InterruptsSm_cg/{cp_trigger, cp_trigger_tsbi}

mstatus_tw_warl

The TW (Timeout Wait) bit is a WARL field that supports intercepting the WFI instruction (see wfi).

InterruptsSm_cg/{cp_wfi_m, cp_wfi_timeout}

mstatus_tw_op

When TW=0, the WFI instruction may execute in modes less privileged than M when not prevented for some other reason. When TW=1, then if WFI is executed in any less-privileged mode, and it does not complete within an implementation-specific, bounded time limit, the WFI instruction causes an illegal-instruction exception.

InterruptsSm_cg/{cp_wfi, cp_wfi_vs, cp_wfi_timeout, cp_wfi_timeout_vs, cp_wfi_timeout_vu, cp_wfi_vs_tw_vtw}

hstatus_vtw_op, H_virtinst_wfi_vtw1_tw0, vtw_virtinstr

hstatus_vtw_op: When VTW=1 (and assuming mstatus.TW=0), an attempt in VS-mode to execute WFI raises a virtual-instruction exception if the WFI does not complete within an implementation-specific, bounded time limit. H_virtinst_wfi_vtw1_tw0: in VS-mode, attempts to execute WFI when hstatus.VTW=1 and mstatus.TW=0, unless the instruction completes within an implementation-specific, bounded time; vtw_virtinstr: An implementation may have WFI always raise a virtual-instruction exception in VS-mode when VTW=1 (and mstatus.TW=0), even if there are pending globally-disabled interrupts when the instruction is executed.

InterruptsSm_cg/{cp_wfi_vs, cp_wfi_timeout_vs, cp_wfi_timeout_vs_vtw_one, cp_wfi_vs_tw_vtw}

H_virtinst_vu_wfi_tw0

in VU-mode, attempts to execute WFI when mstatus.TW=0

InterruptsSm_cg/cp_wfi_timeout_vu

mstatus_tw_umode_op

When S-mode is implemented, then executing WFI in U-mode causes an illegal-instruction exception, regardless of the value of the TW bit, unless the instruction completes within an implementation-specific, bounded time limit.

InterruptsSm_cg/{cp_wfi_timeout, cp_wfi_timeout_tw_zero}

mstatus_tw_always_illegal

An implementation may have WFI always raise an illegal-instruction exception in modes less privileged than M when TW=1, even if there are pending globally-disabled interrupts when the instruction is executed.

Not tested: permission; no test executes WFI below M-mode with TW=1 while an interrupt is pending, so both behaviors pass

mip_mie_enc_txt

Interrupt cause number i (as reported in CSR mcause, mcause) corresponds with bit i in both mip and mie. Bits 15:0 are allocated to standard interrupt causes only, while bits 16 and above are designated for platform use.

InterruptsSm_cg/{cp_trigger, cp_enable_one}

mip_enc_img

InterruptsSm_cg/{cp_trigger, cp_priority_mip}

mie_enc_img

InterruptsSm_cg/{cp_enable_one, cp_priority_mie}

mip_mie_std_enc_txt

The standard portions (bits 15:0) of the mip and mie registers are formatted as shown in norm:mip_std_enc_img and norm:mie_std_enc_img respectively.

InterruptsSm_cg/{cp_trigger, cp_enable_one}

mip_std_enc_img

InterruptsSm_cg/{cp_trigger, cp_priority_mip}

mie_std_enc_img

InterruptsSm_cg/{cp_enable_one, cp_priority_mie}

mideleg_enc_img

InterruptsSm_cg/cp_trigger, InterruptsSm_cg/cp_priority_mideleg

mideleg_enc_txt

mideleg holds trap delegation bits for individual interrupts, with the layout of bits matching those in the mip register

InterruptsSm_cg/cp_trigger, InterruptsSm_cg/cp_priority_mideleg

mip_bits_rdonly_op

If interrupt i can become pending but bit i in mip is read-only, the implementation must provide some other mechanism for clearing the pending interrupt.

InterruptsSm_cg/cp_trigger

mip_bits_wr_op

When bit i in mip is writable, a pending interrupt i can be cleared by writing 0 to this bit.

InterruptsSm_cg/{cp_trigger_reg_mip_ssip, cp_trigger_reg_mip_seip}

mip_meip_mie_meie_op

Bits mip.⁠MEIP and mie.⁠MEIE are the interrupt-pending and interrupt-enable bits for machine-level external interrupts.

InterruptsSm_cg/{cp_trigger, cp_enable_one, cp_enable_zero}

mip_meip_rdonly

MEIP is read-only in mip, and is set and cleared by a platform-specific interrupt controller.

Sm_mcsr_cg/cp_mcsrwalk/mip, InterruptsSm_cg/cp_trigger

mip_mtip_mie_mtie_op

Bits mip.⁠MTIP and mie.⁠MTIE are the interrupt-pending and interrupt-enable bits for machine timer interrupts.

InterruptsSm_cg/{cp_trigger, cp_enable_one, cp_enable_zero}

mip_mtip_rdonly

MTIP is read-only in the mip register, and is cleared by writing to the memory-mapped machine-mode timer compare register.

Sm_mcsr_cg/cp_mcsrwalk/mip, InterruptsSm_cg/cp_trigger

mip_msip_mie_msie_op

Bits mip.⁠MSIP and mie.⁠MSIE are the interrupt-pending and interrupt-enable bits for machine-level software interrupts.

InterruptsSm_cg/{cp_trigger, cp_enable_one, cp_enable_zero}

mip_msip_rdonly

MSIP is read-only in mip, and is written by accesses to memory-mapped control registers, which are used to provide machine-level interprocessor interrupts.

Sm_mcsr_cg/cp_mcsrwalk/mip, Sm_mcsr_cg/cp_msip, InterruptsSm_cg/cp_trigger

msip_sz_acc

A hart’s memory-mapped msip register is a 32-bit read/write register

Sm_mcsr_cg/cp_msip, InterruptsSm_cg/cp_trigger

msip_enc

bits 31&#8205;&#8211;&#8205;1 read as zero and bit 0 contains the MSIP bit.

Sm_mcsr_cg/cp_msip

msip_update_max_time

When the memory-mapped msip register changes, it is guaranteed to be reflected in mip.⁠MSIP eventually, but not necessarily immediately.

Sm_mcsr_cg/cp_msip, InterruptsSm_cg/cp_trigger

mtime_intr_pending

A machine timer interrupt becomes pending whenever mtime contains a value greater than or equal to mtimecmp, treating the values as unsigned integers. The interrupt remains posted until mtimecmp becomes greater than mtime

InterruptsSm_cg/{cp_trigger, cp_wfi_m}

mtime_intr_taken

The interrupt will only be taken if interrupts are enabled and the MTIE bit is set in the mie register.

InterruptsSm_cg/{cp_trigger, cp_enable_zero, cp_wfi_m}

mtime_intr_mtip_visibility

If the result of the comparison between mtime and mtimecmp changes, it is guaranteed to be reflected in MTIP eventually, but not necessarily immediately.

InterruptsSm_cg/{cp_trigger, cp_wfi_m}

mip_seip_mie_seie_op

If supervisor mode is implemented, bits mip.⁠SEIP and mie.⁠SEIE are the interrupt-pending and interrupt-enable bits for supervisor-level external interrupts.

InterruptsSm_cg/{cp_trigger, cp_trigger_reg_mip_seip, cp_enable_one}

mip_seip_acc

SEIP is writable in mip

InterruptsSm_cg/cp_trigger_reg_mip_seip

mip_seip_rdcsr

When mip is read with a CSR instruction, the value of the SEIP bit returned in the rd destination register is the logical-OR of the software-writable bit and the interrupt signal from the interrupt controller

InterruptsSm_cg/cp_trigger_reg

mip_seip_wrcsr

the signal from the interrupt controller is not used to calculate the value written to SEIP. Only the software-writable SEIP bit participates in the read-modify-write sequence of a CSRRS or CSRRC instruction.

InterruptsSm_cg/cp_trigger_reg

intr_sei_op

Supervisor-level external interrupts are made pending based on the logical-OR of the software-writable SEIP bit and the signal from the external interrupt controller.

InterruptsSm_cg/{cp_trigger, cp_trigger_reg_mip_seip}

mip_stip_mie_stie_op

If supervisor mode is implemented, its mip.⁠STIP and mie.⁠STIE are the interrupt-pending and interrupt-enable bits for supervisor-level timer interrupts.

InterruptsSm_cg/{cp_trigger, cp_trigger_sti_sstc, cp_enable_one}

mip_stip_no_stimecmp_acc, mip_stip_no_stimecmp_mmode_write

mip_stip_no_stimecmp_acc: If the stimecmp register is not implemented, STIP is writable in mip mip_stip_no_stimecmp_mmode_write: may be written by M-mode software to deliver timer interrupts to S-mode.

InterruptsSm_cg/cp_trigger

mip_stip_stimecmp_acc

If the stimecmp (supervisor-mode timer compare) register is implemented, STIP is read-only in mip

InterruptsSm_cg/{cp_write_stip_sstc_csrrs, cp_write_stip_sstc_csrrc}

mip_stip_reflects_stimecmp, mip_stip_stimecmp_clr

mip_stip_reflects_stimecmp: reflects the supervisor-level timer interrupt signal resulting from stimecmp. mip_stip_stimecmp_clr: This timer interrupt signal is cleared by writing stimecmp with a value greater than the current time value.

InterruptsSm_cg/{cp_trigger_sti_sstc, cp_trigger_sti_sstc_tsbi}

mip_ssip_mie_ssie_op

If supervisor mode is implemented, bits mip.⁠SSIP and mie.⁠SSIE are the interrupt-pending and interrupt-enable bits for supervisor-level software interrupts.

InterruptsSm_cg/{cp_trigger, cp_trigger_reg_mip_ssip, cp_enable_one}

mip_ssip_acc

SSIP is writable in mip

InterruptsSm_cg/{cp_trigger_reg_mip_ssip, cp_trigger_reg_sip_ssip}

mip_ssip_intr_ctrl

may also be set to 1 by a platform-specific interrupt controller.

InterruptsSm_cg/cp_trigger

intr_mip_mie_op

An interrupt i will trap to M-mode (causing the privilege mode to change to M-mode) if all of the following are true: (a) either the current privilege mode is M and the MIE bit in the mstatus register is set, or the current privilege mode has less privilege than M-mode; (b) bit i is set in both mip and mie; and (c) if register mideleg exists, bit i is not set in mideleg.

InterruptsSm_cg/{cp_trigger, cp_enable_one, cp_enable_zero, cp_priority_mideleg}

intr_mip_mie_bounded_time

These conditions for an interrupt trap to occur must be evaluated in a bounded amount of time from when an interrupt becomes, or ceases to be, pending in mip,

InterruptsSm_cg/{cp_trigger, cp_wfi_m}

intr_mip_mie_xret_csrwr

be evaluated immediately following the execution of an xRET instruction or an explicit write to a CSR on which these interrupt trap conditions expressly depend (including mip, mie, mstatus, and mideleg).

InterruptsSm_cg/{cp_trigger_tsbi, cp_trigger_reg_mip_ssip, cp_trigger_reg_mip_seip, cp_enable_one_tsbi}

intr_m_mode_pri

Multiple simultaneous interrupts destined for M-mode are handled in the following decreasing priority order: MEI, MSI, MTI, SEI, SSI, STI, LCOFI.

InterruptsSm_cg/{cp_priority_mip, cp_priority_mie, cp_priority_mip_tsbi, cp_priority_mie_tsbi}

trap_del_intr_priv_lvl

Delegated interrupts result in the interrupt being masked at the delegator privilege level. For example, if the supervisor timer interrupt (STI) is delegated to S-mode by setting mideleg[5], STIs will not be taken when executing in M-mode. By contrast, if mideleg[5] is clear, STIs can be taken in any mode and regardless of current mode will transfer control to M-mode.

InterruptsSm_cg/cp_trigger, InterruptsSm_cg/cp_priority_mideleg

intr_m_mode_highest_pri

Interrupts to M-mode take priority over any interrupts to lower privilege modes.

InterruptsSm_cg/{cp_priority_mideleg, cp_priority_mideleg_tsbi}

wfi_op

The Wait for Interrupt instruction (WFI) informs the implementation that the current hart can be stalled until an interrupt might need servicing.

InterruptsSm_cg/{cp_wfi_m, cp_wfi}

wfi_enc_img

InterruptsSm_cg/cp_wfi_m

wfi_all_privileged_modes

WFI is available in all privileged modes

InterruptsSm_cg/{cp_wfi_m, cp_wfi}

wfi_opt_u_mode

optionally available to U-mode.

InterruptsSm_cg/{cp_wfi, cp_wfi_timeout_tw_zero}

wfi_ill_exc

This instruction may raise an illegal-instruction exception when TW=1 in mstatus, as described in virt-control.

InterruptsSm_cg/cp_wfi_timeout

wfi_mepc_val

If an enabled interrupt is present or later becomes present while the hart is stalled, the interrupt trap will be taken on the following instruction, i.e., execution resumes in the trap handler and mepc = pc + 4.

InterruptsSm_cg/{cp_wfi_m, cp_wfi}

wfi_resume_reason

Implementations are permitted to resume execution for any reason, even if an enabled interrupt has not become pending. Hence, a legal implementation is to simply implement the WFI instruction as a NOP.

InterruptsSm_cg/{cp_wfi_m, cp_wfi}

wfi_intr_dis

The WFI instruction can also be executed when interrupts are disabled.

InterruptsSm_cg/cp_wfi_m

wfi_unaffected_conditions

The operation of WFI must be unaffected by the global interrupt bits in mstatus (MIE and SIE) and the delegation register mideleg (i.e., the hart must resume if a locally enabled interrupt becomes pending, even if it has been delegated to a less-privileged mode), but should honor the individual interrupt enables (e.g, MTIE) (i.e., implementations should avoid resuming the hart if the interrupt is pending but not locally enabled).

InterruptsSm_cg/{cp_wfi_m, cp_wfi}, S_Zicntr_cg/{cp_instret_wfi_pending, cp_instret_wfi_wake}

wfi_resume_any_priv

WFI is also required to resume execution for locally enabled interrupts pending at any privilege level, regardless of the global interrupt enable at each privilege level.

InterruptsSm_cg/{cp_wfi_m, cp_wfi}

wfi_no_intr_pc

If the event that causes the hart to resume execution does not cause an interrupt to be taken, execution will resume at pc + 4

InterruptsSm_cg/cp_wfi_m, S_Zicntr_cg/{cp_instret_wfi_pending, cp_instret_wfi_wake}

Table 194. InterruptsSm UDB Parameters
Parameter Description Coverpoint Effect

MTVEC_ACCESS

Options:

ro:: mtvec is read-only.

rw:: mtvec is read-write, but may not accept all values.

all exception coverpoints

If 'ro', tests cannot set mtvec and generate a trap signature

MTVEC_BASE_ALIGNMENT_DIRECT

Minimum alignment of the base pointer. Because mtvec excludes the two least-significant bits of the base, the minimum alignment cannot be less than 4.

all exception coverpoints

Trap handler is aligned to the appropriate boundary

MTVEC_BASE_ALIGNMENT_VECTORED

Because mtvec excludes the two least-significant bits of the base, the minimum alignment cannot be less than 4.

all

Trap handler is aligned to the appropriate boundary

MTVEC_ILLEGAL_WRITE_BEHAVIOR

Options:

retain:: When either mtvec.MODE or mtvec.BASE is illegal, mtvec will retain its current value

custom:: When either mtvec.MODE or mtvec.BASE is illegal, mtvec will obtain an unpredictable value

Other values may be added over time once other common behaviors are identified.

all

If mtvec cannot be written with trap handler, tests will not operate

MTVEC_MODES

Options:

0:: Direct; All traps set pc to mtvec.BASE 1:: Vectored; Asynchronous interrupts set pc to mtvec.BASE + 4 x cause.

If only one mode is given, mtvec.MODE is assumed to be read-only with that value. Otherwise, mtvec.MODE is read-write.

TODO

If direct or vectored are not supported, tests relying on those modes will not operate TODO should not be run

TODO: coverpoints will need to ignore bins with mie.msie nonzero: # If a system has only one hart, or if a platform standard supports the delivery # of machine-level interprocessor interrupts through external interrupts (MEI) # instead, then mip.MSIP and mie.MSIE may both be read-only zeros. - name: mip_msip_mie_msie_maybe_rdonly0 TODO: mip.MSIP update time # When the memory-mapped msip register changes, it is guaranteed to be reflected # in mip.MSIP eventually, but not necessarily immediately. - name: msip_update_max_time

B.3.2. InterruptsS Supervisor-Mode Interrupts

These tests are run on any configuration with supervisor mode that supports interrupts. They boot to S-mode and also run in U-mode (and VS/VU-mode when the H extension is supported); mideleg keeps its boot value with all supervisor-level interrupts delegated.

Tests run if S exists (and don’t use MTI/MSI/MEI that are outside supervisor-mode spec) Boot to SMODE, run tests in each supported priv mode of <S,U,VS,VU> Reference model needs to know if each of the types of interrupts are supported menvcfg.STCE = 0 unless otherwise stated mideleg boots with 1s below M-mode and does not change stvec.MODE uses boot value RVTEST_SET_MTI_INT writes mtimecmp = 0 (with tsbi if necessary) Define ways to cause all of the interrupts that are standard as much as possible, only need RV macros for special stuff

Table 195. InterruptsS Test Setup
Step S U VS VU

setup_interrupts_s

mideleg boots with all non-M interrupts delegated
write sstatus.SIE= {0/1}
write sie = 1s
write stvec.MODE = {00, 01} if each supported

Same as S

Same as S, and also write hie = 1s
hideleg boots with 0s, so every interrupt traps to HS

Same as VS

trigger_interrupts <type>

RVTEST_SET_<type>_INT
RVTEST_IDLE_FOR_INTERRUPT to wait for interrupt
RVTEST_CLR_<type>_INT

Same as but with priv = U

Coverpoint

mideleg<typ> = 1 if UDB_<TYPE>_DELEGATION_SUPPORTED
sie<type> = 1 if UDB_<TYPE>_SUPPORTED
sstatus.SIE = {0/1}

Same as S

Expectation

<type> pending if UDB_<TYPE>_SUPPORTED, trap if SIE = 1

pending and trap if UDB_<TYPE>_SUPPORTED

Table 196. InterruptsS Coverpoints
Coverpoint Goal Feature Description Expectation Bins Normative Rule

cp_trigger

Assert each interrupt

For <type> = {LCOFI, STI, SSI, SEI, VSTI, VSEI, VSSI}
setup_interrupts_s
trigger_interrupts_<type>

in S mode, supported interrupt will fire if SIE = 1
SIE should not affect result in lower modes

4 priv * 7 int * 2 SIE * 2 vecMODE

trap_del_s_mode_op
medeleg_mideleg_per_bit_rw
medeleg_mideleg_delegate_op
mideleg_enc_img
mideleg_enc_txt
mstatus_mie_sie_exist
mstatus_mie_sie_op
mstatus_xie_intr_en_dis
mstatus_xpie_xpp_op
mstatus_xpie_xie_xpp_trap_op
intr_mip_mie_op
intr_sei_op
trap_horiz
mip_seip_mie_seie_op
mip_stip_no_stimecmp_acc
mip_stip_mie_stie_op
mip_stip_no_stimecmp_mmode_write
mip_ssip_mie_ssie_op
mip_ssip_intr_ctrl
sstatus_spp
sstatus_sie
sie_sip_supervisor_strap
sip_seip_sie_seie
sip_stip_sie_stie
sip_ssip_sie_ssie
sepc_op_trap_write
scause
scause_interrupt
stval_op_other_traps
mstatus_xpie_op

cp_trigger_reg

Same as cp_trigger, but use mip.SEIP, mip.SSIP, and sip.SSIP rather than macros.

same as above

4 priv * 3 int * 2 SIE * 2 vecMODE

mip_bits_wr_op
intr_sei_op
mip_seip_acc
mip_ssip_acc
mip_ssip_intr_ctrl
sip_op
sip_ssip_sie_ssie

cp_trigger_sti_sstc

STI with SSTC

if SSTC_SUPPORTED:
setup_interrupts_s
write menvcfg.STCE = {0/1}
trigger_interrupts_SSTC

STI trigger if
in S mode, all 3 enables are true
in lower mode, STCE and STIE are true (SIE does not matter)

4 priv * 2 STCE * 2 SIE * 2 vecMODE

mip_stip_mie_stie_op
mip_stip_reflects_stimecmp
mip_stip_stimecmp_clr
sip_stip_sie_stie
mip_sip_stip_op
supervisor_timer_scheduling

cp_trigger_vsti_sstc

VSTI with Sstc

if H_SUPPORTED and SSTC_SUPPORTED:
In HS-mode with menvcfg.STCE = henvcfg.STCE = 1, hie.VSTIE = 1, vsstatus.SIE = 1 and hideleg.VSTI = {0/1}, write vstimecmp = 0; with hideleg.VSTI = 0, set sstatus.SIE, else change to VS-mode

HS-mode takes VSTI (cause 6) when hideleg.VSTI = 0; VS-mode takes STI (cause 5) when hideleg.VSTI = 1

2 hideleg

hip_vstip_enable
hideleg_op
hip_vstip_defined_v0

cp_trigger_vsti_sstc_vs

VS-mode sets its own timer

if H_SUPPORTED and SSTC_SUPPORTED:
With menvcfg.STCE = henvcfg.STCE = 1, hie.VSTIE = 1, vsstatus.SIE = 1 and hideleg.VSTI = {0/1}, in VS-mode write stimecmp = 0, which writes vstimecmp

HS-mode takes VSTI (cause 6) when hideleg.VSTI = 0; VS-mode takes STI (cause 5) when hideleg.VSTI = 1

2 hideleg

hip_vstip_enable
hideleg_op

cp_trigger_vsti_sstc_tsbi

VSTI with Sstc in U-mode and VU-mode

if H_SUPPORTED and SSTC_SUPPORTED:
With menvcfg.STCE = henvcfg.STCE = 1, hie.VSTIE = 1, vsstatus.SIE = 1 and hideleg.VSTI = {0/1}, in HS-mode write vstimecmp = 0 and change to {U, VU} mode through the T-SBI mret

HS-mode takes VSTI (cause 6) on entry when hideleg.VSTI = 0. When hideleg.VSTI = 1, VS-mode takes STI (cause 5) on entry to VU-mode, and U-mode does not take it

2 modes (U, VU) * 2 hideleg

hip_vstip_enable
hideleg_op

cp_enable

Enables control interrupts

write sstatus.SIE = 1
For <type> in <types above>:
sie = {1 in type, 1s everywhere except type}
RVTEST_SET_<type>_INT
RVTEST_IDLE_FOR_INT
RVTEST_CLR_<type>_INT

Interrupt if sie and sip match

4 priv * 2 sie * 7 int

mip_mie_enc_txt
mip_enc_img
intr_mip_mie_op
mip_seip_mie_seie_op
mip_ssip_mie_ssie_op
sie_sip_supervisor_strap
intr_mip_mie_xret_csrwr
mip_stip_mie_stie_op
sstatus_sie

cp_priority_sip

Priority of pending interrupts

write sstatus.SIE = 1
write sie = 0s
RVTEST_SET_<type>_INT (7 choose 2) pairs of sip.<TYPE1, TYPE2>
write sie = 1s
RVTEST_IDLE_FOR_INT
RVTEST_CLR_<type>_INT for both

highest priority pending interrupt will fire

21 int * 4 priv

mip_mie_enc_txt
mip_enc_img
sip_sie
sip_sie_priority_bit_order

cp_priority_sie

Priority of enabled interrupts

write sstatus.SIE = 1
write sie = 0s
RVTEST_SET_<type>_INT for all 7 types
write sie with two ones for all (7 choose 2) pairs
RVTEST_IDLE_FOR_INT
RVTEST_CLR_<type>_INT for all

highest priority enabled interrupt will fire

21 int * 4 priv

mip_mie_enc_txt
mip_enc_img
intr_mip_mie_xret_csrwr
sie_acc
sip_sie_priority_bit_order

cp_wfi

WFI waits until timer interrupt

Do not test in U mode.
if SSTC_SUPPORTED:
write mstatus.TW = 0
write sstatus.SIE = {0/1}
write sie.STIE = 1
RVTEST_SET_SSTC_INT_SOON
do {
WFI instruction
} until STI has fired (see Zawrs)
RVTEST_CLR_SSTC_INT

Wait for timer interrupt. MIE and SIE not affect results.

4 priv * 2 SIE

mstatus_tw_op
mip_stip_stimecmp_clr

cp_wfi_timeout

WFI waits until timeout

write mstatus.TW = 1 (also 0 in U-mode if S_SUPPORTED)
write sie.STIE = {0/1}
write sstatus.SIE = {0/1}
WFI instruction

mstatus_tw_op
mstatus_tw_umode_op
mstatus_tw_always_illegal

cp_wfi_vs

WFI waits in VS-mode until timer interrupt

As cp_wfi, in VS-mode, with mstatus.TW = 0 and hstatus.VTW = 0

Wait for timer interrupt. sstatus.SIE does not affect results.

2 SIE

mstatus_tw_op
hstatus_vtw_op
H_virtinst_wfi_vtw1_tw0
vtw_virtinstr

cp_wfi_timeout_vs
cp_wfi_timeout_vs_vtw_one

WFI in VS-mode follows mstatus.TW and hstatus.VTW

As cp_wfi_timeout, in VS-mode, with (mstatus.TW, hstatus.VTW) = (1, 0), (1, 1), (0, 1)

TW = 1 raises illegal instruction. TW = 0, VTW = 1 raises virtual instruction. Either may instead complete within a bounded time.

3 TW/VTW * 2 SIE * 2 sie.STIE

mstatus_tw_op
hstatus_vtw_op
H_virtinst_wfi_vtw1_tw0
vtw_virtinstr

cp_wfi_vs_tw_vtw

WFI in VS-mode with every mstatus.TW and hstatus.VTW

The full cross of mstatus.TW and hstatus.VTW for VS-mode WFI with SIE = {0/1}: the waiting WFI of cp_wfi_vs (TW = VTW = 0) and the trapping WFIs of cp_wfi_timeout_vs and cp_wfi_timeout_vs_vtw_one. Needs Sstc, as cp_wfi_vs does.

As cp_wfi_vs, cp_wfi_timeout_vs and cp_wfi_timeout_vs_vtw_one

2 TW * 2 VTW * 2 SIE

mstatus_tw_op
hstatus_vtw_op
H_virtinst_wfi_vtw1_tw0
vtw_virtinstr

cp_wfi_timeout_vu

WFI in VU-mode follows mstatus.TW, not hstatus.VTW

As cp_wfi_timeout, in VU-mode, with mstatus.TW = {0/1} and hstatus.VTW = {0/1}

TW = 1 raises illegal instruction (or completes within a bounded time). TW = 0 raises virtual instruction whatever VTW is.

2 TW * 2 VTW * 2 SIE * 2 sie.STIE

mstatus_tw_op
H_virtinst_vu_wfi_tw0

Table 197. InterruptsS Normative Rules
Normative Rule Rule Text Coverpoints

trap_del_s_mode_op

When a trap is delegated to S-mode, the scause register is written with the trap cause; the sepc register is written with the virtual address of the instruction that took the trap; the stval register is written with an exception-specific datum; the SPP field of mstatus is written with the active privilege mode at the time of the trap; the SPIE field of mstatus is written with the value of the SIE field at the time of the trap; and the SIE field of mstatus is cleared.

InterruptsS_cg/cp_trigger

medeleg_mideleg_per_bit_rw

implementations can provide individual read/write bits within medeleg and mideleg to indicate that certain exceptions and interrupts should be processed directly by a lower privilege level.

InterruptsS_cg/cp_trigger, InterruptsSm_cg/cp_priority_mideleg

medeleg_mideleg_delegate_op

setting a bit in medeleg or mideleg will delegate the corresponding trap, when occurring in S-mode or U-mode, to the S-mode trap handler.

InterruptsS_cg/cp_trigger, InterruptsSm_cg/cp_priority_mideleg

mideleg_enc_img

InterruptsS_cg/cp_trigger, InterruptsSm_cg/cp_priority_mideleg

mideleg_enc_txt

mideleg holds trap delegation bits for individual interrupts, with the layout of bits matching those in the mip register

InterruptsS_cg/cp_trigger, InterruptsSm_cg/cp_priority_mideleg

mstatus_mie_sie_exist

Global interrupt-enable bits, MIE and SIE, are provided for M-mode and S-mode respectively.

InterruptsS_cg/cp_trigger

mstatus_mie_sie_op

When a hart is executing in privilege mode x, interrupts are globally enabled when xIE=1 and globally disabled when xIE=0.

InterruptsS_cg/cp_trigger

mstatus_xie_intr_en_dis

Interrupts for lower-privilege modes, w<x, are always globally disabled regardless of the setting of any global wIE bit for the lower-privilege mode. Interrupts for higher-privilege modes, y>x, are always globally enabled regardless of the setting of the global yIE bit for the higher-privilege mode.

InterruptsS_cg/cp_trigger

mstatus_xpie_xpp_op

each privilege mode x that can respond to interrupts has a two-level stack of interrupt-enable bits and privilege modes. xPIE holds the value of the interrupt-enable bit active prior to the trap, and xPP holds the previous privilege mode.

InterruptsS_cg/cp_trigger

mstatus_xpie_xie_xpp_trap_op

When a trap is taken from privilege mode y into privilege mode x, xPIE is set to the value of xIE; xIE is set to 0; and xPP is set to y.

InterruptsS_cg/cp_trigger

mstatus_tw_op

When TW=0, the WFI instruction may execute in modes less privileged than M when not prevented for some other reason. When TW=1, then if WFI is executed in any less-privileged mode, and it does not complete within an implementation-specific, bounded time limit, the WFI instruction causes an illegal-instruction exception.

InterruptsS_cg/{cp_wfi, cp_wfi_vs, cp_wfi_timeout, cp_wfi_timeout_vs, cp_wfi_timeout_vu, cp_wfi_vs_tw_vtw}

hstatus_vtw_op, H_virtinst_wfi_vtw1_tw0, vtw_virtinstr

hstatus_vtw_op: When VTW=1 (and assuming mstatus.TW=0), an attempt in VS-mode to execute WFI raises a virtual-instruction exception if the WFI does not complete within an implementation-specific, bounded time limit. H_virtinst_wfi_vtw1_tw0: in VS-mode, attempts to execute WFI when hstatus.VTW=1 and mstatus.TW=0, unless the instruction completes within an implementation-specific, bounded time; vtw_virtinstr: An implementation may have WFI always raise a virtual-instruction exception in VS-mode when VTW=1 (and mstatus.TW=0), even if there are pending globally-disabled interrupts when the instruction is executed.

InterruptsS_cg/{cp_wfi_vs, cp_wfi_timeout_vs, cp_wfi_timeout_vs_vtw_one, cp_wfi_vs_tw_vtw}

H_virtinst_vu_wfi_tw0

in VU-mode, attempts to execute WFI when mstatus.TW=0

InterruptsS_cg/cp_wfi_timeout_vu

mstatus_tw_umode_op

When S-mode is implemented, then executing WFI in U-mode causes an illegal-instruction exception, regardless of the value of the TW bit, unless the instruction completes within an implementation-specific, bounded time limit.

InterruptsS_cg/cp_wfi_timeout

mstatus_tw_always_illegal

An implementation may have WFI always raise an illegal-instruction exception in modes less privileged than M when TW=1, even if there are pending globally-disabled interrupts when the instruction is executed.

InterruptsS_cg/cp_wfi_timeout

mip_mie_enc_txt

Interrupt cause number i (as reported in CSR mcause, mcause) corresponds with bit i in both mip and mie. Bits 15:0 are allocated to standard interrupt causes only, while bits 16 and above are designated for platform use.

InterruptsS_cg/{cp_enable_one, cp_priority_sip, cp_priority_sie}

mip_enc_img

InterruptsS_cg/{cp_enable_one, cp_priority_sip, cp_priority_sie}

mip_bits_wr_op

When bit i in mip is writable, a pending interrupt i can be cleared by writing 0 to this bit.

InterruptsS_cg/{cp_trigger_reg_mip_ssip, cp_trigger_reg_mip_seip}

intr_mip_mie_op

An interrupt i will trap to M-mode (causing the privilege mode to change to M-mode) if all of the following are true: (a) either the current privilege mode is M and the MIE bit in the mstatus register is set, or the current privilege mode has less privilege than M-mode; (b) bit i is set in both mip and mie; and (c) if register mideleg exists, bit i is not set in mideleg.

InterruptsS_cg/{cp_trigger, cp_enable_one, cp_enable_zero}

intr_mip_mie_xret_csrwr

be evaluated immediately following the execution of an xRET instruction or an explicit write to a CSR on which these interrupt trap conditions expressly depend (including mip, mie, mstatus, and mideleg).

InterruptsS_cg/{cp_trigger_tsbi, cp_enable_one_tsbi, cp_priority_sie}

intr_m_mode_highest_pri

Interrupts to M-mode take priority over any interrupts to lower privilege modes.

InterruptsSm_cg/cp_priority_mideleg

intr_sei_op

Supervisor-level external interrupts are made pending based on the logical-OR of the software-writable SEIP bit and the signal from the external interrupt controller.

InterruptsS_cg/{cp_trigger, cp_trigger_reg_mip_seip}

trap_never_trans_lower

Traps never transition from a more-privileged mode to a less-privileged mode. For example, if M-mode has delegated illegal-instruction exceptions to S-mode, and M-mode software later executes an illegal instruction, the trap is taken in M-mode, rather than being delegated to S-mode.

InterruptsSm_cg/cp_trigger

trap_horiz

traps may be taken horizontally. Using the same example, if M-mode has delegated illegal-instruction exceptions to S-mode, and S-mode software later executes an illegal instruction, the trap is taken in S-mode.

InterruptsS_cg/cp_trigger

trap_del_intr_priv_lvl

Delegated interrupts result in the interrupt being masked at the delegator privilege level. For example, if the supervisor timer interrupt (STI) is delegated to S-mode by setting mideleg[5], STIs will not be taken when executing in M-mode. By contrast, if mideleg[5] is clear, STIs can be taken in any mode and regardless of current mode will transfer control to M-mode.

InterruptsSm_cg/cp_trigger, InterruptsSm_cg/cp_priority_mideleg

mip_seip_mie_seie_op

If supervisor mode is implemented, bits mip.⁠SEIP and mie.⁠SEIE are the interrupt-pending and interrupt-enable bits for supervisor-level external interrupts.

InterruptsS_cg/{cp_trigger, cp_enable_one}

mip_seip_acc

SEIP is writable in mip

InterruptsS_cg/cp_trigger_reg_mip_seip

mip_seip_rdcsr

When mip is read with a CSR instruction, the value of the SEIP bit returned in the rd destination register is the logical-OR of the software-writable bit and the interrupt signal from the interrupt controller

TODO: read mip while software SEIP is clear and the interrupt controller asserts SEI

mip_seip_wrcsr

the signal from the interrupt controller is not used to calculate the value written to SEIP. Only the software-writable SEIP bit participates in the read-modify-write sequence of a CSRRS or CSRRC instruction.

TODO: csrrs/csrrc mip with the SEIP bit clear in rs1 while the interrupt controller asserts SEI

mip_stip_no_stimecmp_acc

If the stimecmp register is not implemented, STIP is writable in mip

InterruptsS_cg/cp_trigger

mip_stip_mie_stie_op

If supervisor mode is implemented, its mip.⁠STIP and mie.⁠STIE are the interrupt-pending and interrupt-enable bits for supervisor-level timer interrupts.

InterruptsS_cg/{cp_trigger, cp_trigger_sti_sstc, cp_enable_one_tsbi}

mip_stip_no_stimecmp_mmode_write

may be written by M-mode software to deliver timer interrupts to S-mode.

InterruptsS_cg/cp_trigger

mip_stip_reflects_stimecmp

reflects the supervisor-level timer interrupt signal resulting from stimecmp.

InterruptsS_cg/cp_trigger_sti_sstc

mip_stip_stimecmp_clr

This timer interrupt signal is cleared by writing stimecmp with a value greater than the current time value.

InterruptsS_cg/cp_trigger_sti_sstc, InterruptsS_cg/cp_wfi

mip_ssip_acc

SSIP is writable in mip

InterruptsS_cg/cp_trigger_reg_mip_ssip

mip_ssip_mie_ssie_op

If supervisor mode is implemented, bits mip.⁠SSIP and mie.⁠SSIE are the interrupt-pending and interrupt-enable bits for supervisor-level software interrupts.

InterruptsS_cg/{cp_trigger, cp_enable_one}

mip_ssip_intr_ctrl

may also be set to 1 by a platform-specific interrupt controller.

InterruptsS_cg/{cp_trigger_reg_mip_ssip, cp_trigger}

sstatus_spp

The SPP bit indicates the privilege level at which a hart was executing before entering supervisor mode. When a trap is taken, SPP is set to 0 if the trap originated from user mode, or 1 otherwise. When an SRET instruction (see otherpriv) is executed to return from the trap handler, the privilege level is set to user mode if the SPP bit is 0, or supervisor mode if the SPP bit is 1; SPP is then set to 0.

InterruptsS_cg/cp_trigger

Table 198. InterruptsS UDB Parameters
Parameter Description Coverpoint Effect

STVEC_MODES

Options:

0:: Direct; All traps set pc to stvec.BASE 1:: Vectored; Asynchronous interrupts set pc to stvec.BASE + 4 x cause.

If only one mode is given, stvec.MODE is assumed to be read-only with that value. Otherwise, stvec.MODE is read-write.

TODO

If direct or vectored are not supported, tests relying on those modes will not operate TODO should not be run

STVEC_BASE_ALIGNMENT_VECTORED

Minimum alignment of the base pointer when stvec.MODE is Vectored. Because stvec excludes the two least-significant bits of the base, the minimum alignment cannot be less than 4 bytes.

all

Trap handler is aligned to the appropriate boundary

B.3.3. Sstc Supervisor Timer Compare

The Sstc suite has one covergroup per group of tests: Sstc_Sm_cg (M-mode), Sstc_cg (S-mode and U-mode), and, with the hypervisor extension, Sstc_HSm_cg (M-mode) and Sstc_H_cg (HS, VS, VU and U modes). The Sstc_Sm and Sstc_HSm tests require Sm, so they are not part of a certificate without Sm, such as RVA23. The Sstc suite takes no interrupts: timer interrupts raised through stimecmp and vstimecmp are tested by cp_trigger_sti_sstc and cp_trigger_vsti_sstc in InterruptsS and InterruptsSm.

Sstc Supervisor-Mode Supervisor Timer Compare

These tests are run on any configuration with supervisor mode when the Sstc supervisor timer compare extension is supported.

  • for RV32, also access stimcmph Boot to S-mode. Run S and U-mode tests.

Table 199. Sstc Coverpoints
Coverpoint Goal Feature Description Expectation Pass/Fail Criteria Normative Rule Status Coverage

In supervisor mode

cp_supervisor_tm

Access stimecmp

Read stimecmp with mcounteren.TM = {0/1} for RV32, also access stimcmph

stimecmp only readable in supervisor mode if mcounteren.TM = 1

Check against RM

stimecmp_exist
mcounteren_tm_clr
mcounteren_tm_set
stimecmp_stimecmph_sz_acc

To be Done

Uncovered

cp_supervisor_stce

Access stimecmp

Read stimecmp with menvcfg.stce (menvcfgh in RV32) = {0/1} for RV32, also access stimcmph

stimecmp only readable in supervisor mode if menvcfg.STCE = 1

Check against RM

stimecmp_exist
stce_bit_exist
menvcfg_stce_enable_op
menvcfg_stce_zero_op
stimecmp_stimecmph_sz_acc
menvcfg_stce_exists

To be Done

Uncovered

In user mode

cp_user_tm

Access stimecmp

Read stimecmp with mcounteren.TM = {0/1} * scounteren.TM = {0/1} (if S_SUPPORTED) for RV32, also access stimcmph

stimecmp never readable in user mode

Check against RM

To be Done

Uncovered

cp_user_stce

Access stimecmp

Read stimecmp with menvcfg.stce (menvcfgh in RV32) = {0/1} for RV32, also access stimcmph

stimecmp never readable in user mode (too little privilege)

Check against RM

stce_bit_exist
menvcfg_stce_zero_op

To be Done

Uncovered

Sstc_Sm Machine-Mode Supervisor Timer Compare

These tests are run on any configuration with machine mode when the Sstc supervisor timer compare extension is supported.

  • for RV32, also access stimcmph

Table 200. Sstc_Sm Coverpoints
Coverpoint Goal Feature Description Expectation Pass/Fail Criteria Normative Rule Status Coverage

In machine mode

cp_machine_tm

Access stimecmp

Read stimecmp with mcounteren.TM = {0/1} * for RV32, also access stimcmph

stimecmp always readable in machine mode

Check against RM

To be Done

Uncovered

cp_machine_stce

Access stimecmp

Read stimecmp with menvcfg.stce (menvcfgh in RV32) = {0/1} * for RV32, also access stimcmph

stimecmp always readable in machine mode

Check against RM

menvcfg_stce_enable_op
menvcfg_stce_zero_op
menvcfg_stce_zero_vstip
menvcfg_stce_exists
menvcfg_stce_rdonly0

To be Done

Uncovered

Sstc_H Hypervisor Timer Compare

These tests are run on any configuration with the hypervisor extension when the Sstc supervisor timer compare extension is supported. They check vstimecmp and stimecmp access from HS, VS, VU and U modes, and from HS-mode hip.VSTIP as hvip.VSTIP OR the vstimecmp comparison with each menvcfg.STCE and henvcfg.STCE, and htimedelta (including 64-bit wrap).

The suite boots to HS-mode and writes menvcfg and mcounteren through T-SBI. An access that menvcfg.STCE or mcounteren.TM forbids raises illegal instruction; one that only henvcfg.STCE or hcounteren.TM forbids raises virtual instruction. henvcfg.STCE = 1 with menvcfg.STCE = 0 is skipped in every cross because henvcfg.STCE is read-only zero then. time has no reset value, so a check whose result depends on time compares hip.VSTIP with the comparison computed from a read of time, after waiting RVMODEL_INTERRUPT_LATENCY for a change of the comparison to reach hip.VSTIP. Sstc_HSm repeats cp_vstip and cp_htimedelta from M-mode and adds the M-mode vstimecmp accesses. H cp_hcsrwalk walks vstimecmp and vstimecmph.

Table 201. Sstc_H Coverpoints
Coverpoint Goal Feature Description Expectation Bins Normative Rule Status Notes

In HS-Mode

cp_hs_vstimecmp_accessible

TM and STCE control access depending on priv level

With cross of menvcfg.STCE = {0/1}, henvcfg.STCE = {0/1} mcounteren.TM = {0/1}, hcounteren.TM = {0/1} read vstimecmp. For RV32, also vstimecmph

illegal instruction if menvcfg.STCE = 0 or mcounteren.TM = 0

3 STCE * 2 mTM * 2 hTM * up to 2 regs

menvcfg_stce_zero_op
mcounteren_tm_clr
mcounteren_tm_set
vstimecmp_exist
vstimecmp_sz
vstimecmp_acc

cp_hs_vstimecmp_accesses

All types of access

With cross of menvcfg.STCE = 1, henvcfg.STCE = 0 mcounteren.TM = 1, hcounteren.TM = 0, read/write (0s,1s)/set/clear vstimecmp. For RV32, also vstimecmph

success

5 accesses * up to 2 regs

mcounteren_tm_set
vstimecmp_exist
vstimecmp_sz
vstimecmp_acc

cp_vstip

OR of vstimecmp and hvip

Cross of menvcfg.STCE = {0/1}, henvcfg.STCE = {0/1}, hvip.VSTIP = {0/1}, htimedelta = 0, vstimecmp = {0, all 1s}. Check hip.VSTIP. henvcfg.STCE = 1 with menvcfg.STCE = 0 is skipped because henvcfg.STCE is read-only zero then. For RV32, htimedeltah and vstimecmph are also written.

If both STCE = 1 and vstimecmp = 0, hip.VSTIP = 1. Else hip.VSTIP = hvip.VSTIP.

3 STCE * 2 hvip * 2 vstimecmp

menvcfg_stce_zero_op
menvcfg_stce_zero_vstip
henvcfg_stce_op
henvcfg_stce_zero_op
hip_vstip_defined_v0
hip_vstip_acc

cp_htimedelta

htimedelta affects vstimecmp

menvcfg.STCE = 1, henvcfg.STCE = 1, hvip.VSTIP = 0, htimedelta = {0, 2^30, 2^32-1, 2^60, -1, -2^30, -2^60}, vstimecmp = {0, 2^29, 2^31, 2^61, -2^29, -2^31, -2^61}. Check hip.VSTIP against the value computed from a read of time. For RV32, htimedeltah and vstimecmph are involved; htimedelta = 2^32-1 exercises the carry into the high half and -1 the 64-bit wrap.

hip.VSTIP = ((time + htimedelta) mod 2^64 >= vstimecmp), unsigned

7 htimedelta * 7 vstimecmp

hip_vstip_op
hip_vstip_vstimecmp_op
hip_vstip_clear
htimedelta_sz_acc_op
htimedeltah_sz_acc_op

In VS-Mode

cp_vs_stimecmp_accessible

TM and STCE control access depending on priv level

Put different values in stimecmp and vstimecmp. With cross of menvcfg.STCE = {0/1}, henvcfg.STCE = {0/1} mcounteren.TM = {0/1}, hcounteren.TM = {0/1} read stimecmp (not vstimecmp). For RV32, also stimecmph

illegal instruction if menvcfg.STCE = 0 or mcounteren.TM = 0. virtual instruction trap if menvcfg.STCE = mcounteren.TM = 1 but henvcfg.STCE = 0 or hcounteren.TM = 0. Otherwise the read returns vstimecmp.

3 STCE * 2 mTM * 2 hTM * up to 2 regs

stce_bit_exist
menvcfg_stce_zero_op
mcounteren_tm_clr
mcounteren_tm_set
henvcfg_stce_op
henvcfg_stce_zero_op
hcounteren_acc
henvcfg_stce

cp_vs_stimecmp_accesses

All types of access

Put different values in stimecmp and vstimecmp before entering VS-mode. With cross of menvcfg.STCE = 1, henvcfg.STCE = 1 mcounteren.TM = 1, hcounteren.TM = 1, read/write (0s,1s)/set/clear stimecmp. For RV32, also stimecmph. Then write stimecmp and check from HS-mode that the writes are reflected in vstimecmp/vstimecmph but not stimecmp/h.

Changes should show up in vstimecmp/h

5 accesses * up to 2 regs, and the HS-mode check

mcounteren_tm_set
henvcfg_stce_op
hcounteren_acc

cp_vs_vstimecmp_inaccessible

With cross of menvcfg.STCE = {0/1}, henvcfg.STCE = {0/1} mcounteren.TM = {0/1}, hcounteren.TM = {0/1} read vstimecmp. For RV32, also vstimecmph

Illegal instruction when HS-mode could not access it (menvcfg.STCE = 0 or mcounteren.TM = 0), else virtual instruction

3 STCE * 2 mTM * 2 hTM * up to 2 regs

H_vscsrs_acc_vs
H_virtinst_vu_vs_nonhigh_allowedhs_tvm0
H_virtinst_vu_vs32_high_allowedhs_tvm0

In VU-Mode

cp_vu_timecmp_inaccessible

With cross of menvcfg.STCE = {0/1}, henvcfg.STCE = {0/1} mcounteren.TM = {0/1}, hcounteren.TM = {0/1} read stimecmp, vstimecmp. For RV32, also stimecmph, vstimecmph

Illegal instruction when HS-mode could not access them (menvcfg.STCE = 0 or mcounteren.TM = 0), else virtual instruction

3 STCE * 2 mTM * 2 hTM * up to 4 regs

menvcfg_stce_zero_op
mcounteren_tm_clr
H_virtinst_vu_vs_nonhigh_allowedhs_tvm0
H_virtinst_vu_vs32_high_allowedhs_tvm0
H_virtinst_vu_nonhigh_supervisor_allowedhs_tvm0
H_virtinst_vu32_high_supervisor_allowedhs_tvm0

In U-Mode

cp_u_timecmp_inaccessible

With cross of menvcfg.STCE = {0/1}, henvcfg.STCE = {0/1} mcounteren.TM = {0/1}, hcounteren.TM = {0/1} read stimecmp, vstimecmp. For RV32, also stimecmph, vstimecmph

Illegal instruction trap

3 STCE * 2 mTM * 2 hTM * up to 4 regs

H_vscsrs_acc_u

Without Sstc

henvcfg.STCE is read-only zero when Sstc is not implemented

On an H implementation without Sstc, write henvcfg.STCE = 1 and read it

henvcfg.STCE reads 0

henvcfg_stce_rdonly0

Not tested

Sstc_H requires Sstc, and every configuration with H also implements Sstc.
The check belongs in the H suite’s henvcfg walk on a configuration without Sstc.

Sstc_HSm Machine-Mode Hypervisor Timer Compare

These tests are run on any configuration with machine mode and the hypervisor extension when the Sstc supervisor timer compare extension is supported. They check vstimecmp access from M-mode, and repeat the hip.VSTIP and htimedelta checks from M-mode.

The suite boots to M-mode, where vstimecmp is always accessible. time has no reset value, so a check whose result depends on time compares hip.VSTIP with the comparison computed from a read of time. A change of the comparison reaches hip.VSTIP eventually, so hip is read after waiting RVMODEL_INTERRUPT_LATENCY. cp_vstip and cp_htimedelta are also in Sstc_H, from HS-mode.

Table 202. Sstc_HSm Coverpoints
Coverpoint Goal Feature Description Expectation Bins Normative Rule

In M-Mode

cp_vstip

OR of vstimecmp and hvip

Cross of menvcfg.STCE = {0/1}, henvcfg.STCE = {0/1}, hvip.VSTIP = {0/1}, htimedelta = 0, vstimecmp = {0, all 1s}. Check hip.VSTIP. henvcfg.STCE = 1 with menvcfg.STCE = 0 is skipped because henvcfg.STCE is read-only zero then. For RV32, htimedeltah and vstimecmph are also written.

If both STCE = 1 and vstimecmp = 0, hip.VSTIP = 1. Else hip.VSTIP = hvip.VSTIP.

3 STCE * 2 hvip * 2 vstimecmp

cp_htimedelta

htimedelta affects vstimecmp

menvcfg.STCE = 1, henvcfg.STCE = 1, hvip.VSTIP = 0, htimedelta = {0, 2^30, 2^32-1, 2^60, -1, -2^30, -2^60}, vstimecmp = {0, 2^29, 2^31, 2^61, -2^29, -2^31, -2^61}. Check hip.VSTIP against the value computed from a read of time. For RV32, htimedeltah and vstimecmph are involved; htimedelta = 2^32-1 exercises the carry into the high half and -1 the 64-bit wrap.

hip.VSTIP = ((time + htimedelta) mod 2^64 >= vstimecmp), unsigned

7 htimedelta * 7 vstimecmp

cp_m_vstimecmp_accessible

TM and STCE control access depending on priv level

With cross of menvcfg.STCE = {0/1}, henvcfg.STCE = {0/1} mcounteren.TM = {0/1}, hcounteren.TM = {0/1} read vstimecmp. For RV32, also vstimecmph. henvcfg.STCE = 1 with menvcfg.STCE = 0 is skipped.

success

3 STCE * 2 mTM * 2 hTM * up to 2 regs

vstimecmp_exist
vstimecmp_sz
vstimecmp_acc

cp_m_vstimecmp_accesses

All types of access

With cross of menvcfg.STCE = 1, henvcfg.STCE = 0 mcounteren.TM = 0, hcounteren.TM =0, read/write (0s,1s)/set/clear vstimecmp. For RV32, also vstimecmph

success

5 accesses * up to 2 regs

vstimecmp_exist
vstimecmp_sz
vstimecmp_acc

Sstc Normative Rules
Table 203. Sstc Normative Rules
Normative Rule Rule Text Coverpoints

stimecmp_exist

This extension adds the S-level stimecmp CSR (stimecmp)

Sstc_cg/{cp_supervisor_stce, cp_supervisor_tm}

stce_bit_exist

This extension adds the STCE bit to the menvcfg (sec:menvcfg) and henvcfg (sec:henvcfg) CSRs.

Sstc_cg/{cp_supervisor_stce, cp_user_stce}, Sstc_H_cg/cp_vs_stimecmp_accessible

menvcfg_stce_enable_op

The STCE bit enables stimecmp for S-mode when set to one.

Sstc_cg/cp_supervisor_stce, Sstc_Sm_cg/cp_machine_stce, InterruptsSm_cg/cp_trigger_sti_sstc, InterruptsSm_cg/cp_write_stip_sstc

menvcfg_stce_zero_op

When this extension is implemented and STCE in menvcfg is zero, an attempt to access stimecmp or vstimecmp in a mode other than M-mode raises an illegal-instruction exception, STCE in henvcfg is read-only zero, and STIP in mip and sip reverts to its defined behavior as if this extension is not implemented.

Sstc_cg/{cp_supervisor_stce, cp_user_stce}, Sstc_Sm_cg/cp_machine_stce, Sstc_H_cg/{cp_hs_vstimecmp_accessible, cp_vs_stimecmp_accessible, cp_vu_timecmp_inaccessible}, Sstc_H_cg/cp_vstip, InterruptsSm_cg/cp_trigger_sti_sstc, InterruptsSm_cg/cp_write_stip_sstc

menvcfg_stce_zero_vstip

Further, if the H extension is implemented, then hip.VSTIP also reverts its defined behavior as if this extension is not implemented.

Sstc_Sm_cg/cp_machine_stce, Sstc_H_cg/cp_vstip, InterruptsSm_cg/cp_trigger_sti_sstc, InterruptsSm_cg/cp_write_stip_sstc

mcounteren_tm_clr

when the TM bit in the mcounteren register is clear, attempts to access the stimecmp or vstimecmp register while executing in a mode less privileged than M will cause an illegal-instruction exception.

Sstc_cg/cp_supervisor_tm, Sstc_H_cg/{cp_hs_vstimecmp_accessible, cp_vs_stimecmp_accessible, cp_vu_timecmp_inaccessible}

mcounteren_tm_set

When this bit is set, access to the stimecmp or vstimecmp register is permitted in S-mode if implemented, and access to the vstimecmp register (via stimecmp) is permitted in VS-mode if implemented and not otherwise prevented by the TM bit in hcounteren.

Sstc_cg/cp_supervisor_tm, Sstc_H_cg/cp_hs_vstimecmp_{accessible, accesses}, Sstc_H_cg/cp_vs_stimecmp_{accessible, accesses}

stimecmp_stimecmph_sz_acc

The stimecmp CSR is a 64-bit register and has 64-bit precision on all RV32 and RV64 systems. In RV32 only, accesses to the stimecmp CSR access the low 32 bits, while accesses to the stimecmph CSR access the high 32 bits of stimecmp.

Sstc_cg/cp_supervisor_tm, Sstc_cg/cp_supervisor_tm_h, Sstc_cg/cp_supervisor_stce

menvcfg_stce_exists

The Sstc extension adds the STCE (STimecmp Enable) bit to menvcfg CSR.

Sstc_Sm_cg/cp_machine_stce, Sstc_cg/cp_supervisor_stce, InterruptsSm_cg/cp_trigger_sti_sstc, InterruptsSm_cg/cp_write_stip_sstc

menvcfg_stce_rdonly0

When the Sstc extension is not implemented, STCE is read-only zero.

Sstc_Sm_cg/cp_machine_stce, InterruptsSm_cg/cp_trigger_sti_sstc, InterruptsSm_cg/cp_write_stip_sstc

mip_sip_stip_op

A supervisor timer interrupt becomes pending, as reflected in the STIP bit in the mip and sip registers whenever time contains a value greater than or equal to stimecmp, treating the values as unsigned integers. If the result of this comparison changes, it is guaranteed to be reflected in STIP eventually, but not necessarily immediately. The interrupt remains posted until stimecmp becomes greater than time, typically as a result of writing stimecmp. The interrupt will be taken based on the standard interrupt enable and delegation rules.

InterruptsS_cg/cp_trigger_sti_sstc, InterruptsSm_cg/cp_trigger_sti_sstc, InterruptsSm_cg/cp_write_stip_sstc

sip_stip_sie_stie

Bits sip.STIP and sie.STIE are the interrupt-pending and interrupt-enable bits for supervisor-level timer interrupts. If implemented, STIP is read-only in sip. When the Sstc extension is not implemented, STIP is set and cleared by the execution environment. When the Sstc extension is implemented, STIP reflects the timer interrupt signal resulting from stimecmp. The sip.STIP bit, in response to timer interrupts generated by stimecmp, is set by writing stimecmp with a value that is less than or equal to time, and is cleared by writing stimecmp with a value greater than time.

InterruptsS_cg/cp_trigger_sti_sstc, InterruptsSm_cg/cp_trigger_sti_sstc, InterruptsSm_cg/cp_write_stip_sstc

henvcfg_stce_op

The STCE bit enables vstimecmp for VS-mode when set to one.

Sstc_H_cg/cp_vs_stimecmp_{accessible, accesses}, Sstc_H_cg/cp_vstip

henvcfg_stce_zero_op

When STCE bit in henvcfg is zero, an attempt to access stimecmp (really vstimecmp) when V=1 raises a virtual-instruction exception, and VSTIP in hip reverts to its defined behavior as if this extension is not implemented.

Sstc_H_cg/cp_vs_stimecmp_accessible, Sstc_H_cg/cp_vstip

hcounteren_acc

In addition, when the TM bit in the hcounteren register is clear, attempts to access the vstimecmp register (via stimecmp) while executing in VS-mode will cause a virtual-instruction exception if the same bit in mcounteren is set. When this bit and the same bit in mcounteren are both set, access to the vstimecmp register (if implemented) is permitted in VS-mode.

Sstc_H_cg/cp_vs_stimecmp_{accessible, accesses}

H_vscsrs_acc_vs

When V=1, an attempt to read or write a VS CSR directly by its own separate CSR address causes a virtual-instruction exception.

Sstc_H_cg/cp_vs_vstimecmp_inaccessible

H_virtinst_vu_vs_nonhigh_allowedhs_tvm0

in VS-mode or VU-mode, attempts to access an implemented non-high-half hypervisor CSR or VS CSR when the same access (read/write) would be allowed in HS-mode, assuming mstatus.TVM=0;

Sstc_H_cg/{cp_vs_vstimecmp_inaccessible, cp_vu_timecmp_inaccessible}

H_virtinst_vu_vs32_high_allowedhs_tvm0

in VS-mode or VU-mode, if XLEN=32, attempts to access an implemented high-half hypervisor CSR or high-half VS CSR when the same access (read/write) to the CSR’s low-half partner would be allowed in HS-mode, assuming mstatus.TVM=0;

Sstc_H_cg/{cp_vs_vstimecmp_inaccessible, cp_vu_timecmp_inaccessible}

H_virtinst_vu_nonhigh_supervisor_allowedhs_tvm0

in VU-mode, attempts to access an implemented non-high-half supervisor CSR when the same access (read/write) would be allowed in HS-mode, assuming mstatus.TVM=0;

Sstc_H_cg/cp_vu_timecmp_inaccessible

H_virtinst_vu32_high_supervisor_allowedhs_tvm0

in VU-mode, if XLEN=32, attempts to access an implemented high-half supervisor CSR when the same access to the CSR’s low-half partner would be allowed in HS-mode, assuming mstatus.TVM=0;

Sstc_H_cg/cp_vu_timecmp_inaccessible

H_vscsrs_acc_u

Attempts from U-mode cause an illegal-instruction exception as usual.

Sstc_H_cg/cp_u_timecmp_inaccessible

hip_vstip_enable, hideleg_op

hip_vstip_enable: The interrupt will be taken based on the standard interrupt enable and delegation rules while V=1. hideleg_op: An interrupt that has been delegated to HS-mode (using mideleg) is further delegated to VS-mode if the corresponding hideleg bit is set.

InterruptsS_cg/{cp_trigger_vsti_sstc, cp_trigger_vsti_sstc_vs, cp_trigger_vsti_sstc_tsbi}, InterruptsSm_cg/cp_trigger_vsti_sstc

hip_vstip_defined_v0

The hip.⁠VSTIP bit remains defined while V=0 as well as V=1.

InterruptsS_cg/cp_trigger_vsti_sstc, Sstc_H_cg/cp_vstip

hip_vstip_acc

VSTIP is read-only in hip, and is the logical-OR of hvip.⁠VSTIP and, when the Sstc extension is implemented, the timer interrupt signal resulting from vstimecmp.

Sstc_H_cg/cp_vstip

hip_vstip_op, hip_vstip_vstimecmp_op, hip_vstip_clear, htimedelta_sz_acc_op, htimedeltah_sz_acc_op

hip_vstip_op: A virtual supervisor timer interrupt becomes pending, as reflected in the VSTIP bit in the hip register, whenever (time + htimedelta), truncated to 64 bits, contains a value greater than or equal to vstimecmp, treating the values as unsigned integers. hip_vstip_vstimecmp_op: The hip.⁠VSTIP bit, in response to timer interrupts generated by vstimecmp, is set by writing vstimecmp with a value that is less than or equal to the sum of time and htimedelta, truncated to 64 bits; it is cleared by writing vstimecmp with a greater value. hip_vstip_clear: If the result of this comparison changes, it is guaranteed to be reflected in VSTIP eventually, but not necessarily immediately. The interrupt remains posted until vstimecmp becomes greater than (time + htimedelta), typically as a result of writing vstimecmp. htimedelta_sz_acc_op: The htimedelta CSR is a 64-bit read/write register that contains the delta between the value of the time CSR and the value returned in VS-mode or VU-mode. That is, reading the time CSR in VS or VU mode returns the sum of the contents of htimedelta and the actual value of time. htimedeltah_sz_acc_op: When XLEN=32, htimedeltah is a 32-bit read/write register that aliases bits 63:32 of htimedelta. Register htimedeltah does not exist when XLEN=64.

Sstc_H_cg/cp_htimedelta

vstimecmp_exist, vstimecmp_sz, vstimecmp_acc

vstimecmp_exist: and the VS-level vstimecmp CSR (vstimecmp). vstimecmp_sz: The vstimecmp CSR is a 64-bit register and has 64-bit precision on all RV32 and RV64 systems. vstimecmp_acc: In RV32 only, accesses to the vstimecmp CSR access the low 32 bits, while accesses to the vstimecmph CSR access the high 32 bits of vstimecmp.

Sstc_H_cg/cp_hs_vstimecmp_{accessible, accesses}, Sstc_HSm_cg/cp_m_vstimecmp_{accessible, accesses}

henvcfg_stce

The Sstc extension adds the STCE (STimecmp Enable) bit to henvcfg CSR.

Sstc_H_cg/cp_vs_stimecmp_accessible

henvcfg_stce_rdonly0

When the Sstc extension is not implemented, STCE is read-only zero.

Not tested: needs an H implementation without Sstc

UDB Parameters: None.

TODO: beef up testing stimecmp values, behavior near wraparound

B.4. Endian

B.4.1. EndianSm Machine-Mode Endianness

Table 204. EndianSm Coverpoints
Coverpoint Goal Feature Description Notes Normative Rule

cp_mstatus_mbe_endianness

Read from memory in an endian fashion

For each endianness, sd 0x0102030405060708 to scratch, and also write all subwords with sw, sh, sb. For each endianness (independent), ld, lw, lwu, lh, lhu, lb, lbu it back. In RV32, use mstatush and don’t need the doubles.

restore endianness to normal afterward
MBE
when mstatus.MPRV=0

mstatus_mbe_op

Table 205. EndianSm Normative Rules
Normative Rule Rule Text Coverpoints

mstatus_mbe_op

MBE controls whether non-instruction-fetch memory accesses made from M-mode (assuming mstatus.⁠MPRV=0) are little-endian (MBE=0) or big-endian (MBE=1).

EndianSm_cg/{cp_mstatus_mbe_endianness_sw, cp_mstatus_mbe_endianness_lw, cp_mstatus_mbe_endianness_sh, cp_mstatus_mbe_endianness_lbu}

UDB Parameters: None.

B.4.2. EndianS Supervisor-Mode Endianness

Table 206. EndianS Coverpoints
Coverpoint Goal Feature Description Notes Normative Rule

cp_mstatus_sbe_endianness

Read from memory in an endian fashion in supervisor mode.

Run test in supervisor mode. For each endianness given by mstatus.SBE, sd 0x0102030405060708 to scratch, and also write all subwords with sw, sh, sb. For each endianness (independent), ld, lw, lwu, lh, lhu, lb, lbu it back. In RV32, use mstatush and don’t need the doubles.

restore endianness to normal afterward
SBE

mstatus_sbe_op

cp_mstatus_mprv_sbe_endianness

Read from memory in an endian fashion based on MBE and SBE for systems with supervisor mode.

Run test in machine mode. Each endianness is a cross-product of MPRV = 0/1, MPP = 01/11, MBE = 0/1, SBE = 0/1 (16 bins). For each endianness, sd 0x0102030405060708 to scratch, and also write all subwords with sw, sh, sb. For each endianness (independent), ld, lw, lwu, lh, lhu, lb, lbu it back. In RV32, use mstatush and don’t need the doubles.

restore endianness to normal afterward
MPRV, MBE, SBE

mstatus_mprv_ldst_op

cp_sstatus_ube_endianness

Read from memory in an endian fashion

Run test in user mode. For each endianness given in sstatus.UBE, sd 0x0102030405060708 to scratch, and also write all subwords with sw, sh, sb. For each endianness (independent), ld, lw, lwu, lh, lhu, lb, lbu it back. In RV32, use mstatush and don’t need the doubles.

restore endianness to normal afterward
UBE

sstatus_ube_endianness_op
sstatus_ube
sstatus_ube_implicit

Table 207. EndianS Normative Rules
Normative Rule Rule Text Coverpoints

sstatus_ube

The UBE bit is a WARL field that controls the endianness of explicit memory accesses made from U-mode, which may differ from the endianness of memory accesses in S-mode. An implementation may make UBE be a read-only field that always specifies the same endianness as for S-mode.

EndianS_cg/cp_sstatus_ube_endianness_lw

sstatus_ube_implicit

UBE has no effect on instruction fetches, which are implicit memory accesses that are always little-endian.

EndianS_cg/cp_sstatus_ube_endianness_lw

sstatus_ube_endianness_op

UBE controls whether explicit load and store memory accesses made from U-mode are little-endian (UBE=0) or big-endian (UBE=1).

EndianS_cg/{cp_sstatus_ube_endianness_sw, cp_sstatus_ube_endianness_lw, cp_sstatus_ube_endianness_sh, cp_sstatus_ube_endianness_lbu}

sstatus_ube_implicit_smode

For implicit accesses to supervisor-level memory management data structures, such as page tables, S-mode endianness always applies and UBE is ignored.

TODO: U-mode accesses through Sv translation with UBE≠SBE, checking page tables are read with S-mode endianness

endianness

The EEI will define whether the memory system is little-endian or big-endian.

ldst_endian_byte_invariant

In RISC-V, endianness is byte-address invariant.

mstatus_mprv_ldst_op

When MPRV=0, explicit memory accesses behave as normal, using the translation and protection mechanisms of the current privilege mode. When MPRV=1, load and store memory addresses are translated and protected, and endianness is applied, as though the current privilege mode were set to MPP.

EndianS_cg/cp_mstatus_mprv_sbe_endianness_sw, EndianS_cg/cp_mstatus_mprv_sbe_endianness_sb, EndianS_cg/cp_mstatus_mprv_sbe_endianness_lw, EndianS_cg/cp_mstatus_mprv_sbe_endianness_lbu

mstatus_sbe_op

If S-mode is not supported, SBE is read-only 0. Otherwise, SBE controls whether explicit load and store memory accesses made from S-mode are little-endian (SBE=0) or big-endian (SBE=1).

EndianS_cg/{cp_mstatus_sbe_endianness_sw, cp_mstatus_sbe_endianness_lw, cp_mstatus_sbe_endianness_sh, cp_mstatus_sbe_endianness_lbu}

mstatus_sbe_implicit

For implicit accesses to supervisor-level memory management data structures, such as page tables, endianness is always controlled by SBE.

mstatus_sbe_change_fence

Since changing SBE alters the implementation’s interpretation of these data structures, if any such data structures remain in use across a change to SBE, M-mode software must follow such a change to SBE by executing an SFENCE.VMA instruction with rs1=x0 and rs2=x0.

mstatus_sbe_rocopy

If S-mode is supported, an implementation may make SBE be a read-only copy of MBE.

UDB Parameters: None.

B.4.3. EndianU User-Mode Endianness

Table 208. EndianU Coverpoints
Coverpoint Goal Feature Description Notes Normative Rule

cp_mstatus_ube_endianness

Read from memory in an endian fashion

Run in user mode. For each endianness, sd 0x0102030405060708 to scratch, and also write all subwords with sw, sh, sb. For each endianness (independent), ld, lw, lwu, lh, lhu, lb, lbu it back. In RV32, don’t need the doubles.

restore endianness to normal afterward
UBE

mstatus_ube_op

cp_mstatus_mprv_ube_endianness

Read from memory in an endian fashion

Run in machine mode. Each endianness is a cross-product of MPRV = 0/1, MPP = 00/11, MBE = 0/1, UBE = 0/1 (16 bins). Run test in machine mode. For each endianness, sd 0x0102030405060708 to scratch, and also write all subwords with sw, sh, sb. For each endianness (independent), ld, lw, lwu, lh, lhu, lb, lbu it back. In RV32, don’t need the doubles.

restore endianness to normal afterward
MPRV

mstatus_mprv_ldst_op

UXL is not always modifiable, so there is no way to write coverpoints for different values

Table 209. EndianU Normative Rules
Normative Rule Rule Text Coverpoints

mstatus_mprv_ldst_op

When MPRV=0, explicit memory accesses behave as normal, using the translation and protection mechanisms of the current privilege mode. When MPRV=1, load and store memory addresses are translated and protected, and endianness is applied, as though the current privilege mode were set to MPP.

EndianU_cg/cp_mstatus_mprv_ube_endianness_sw, EndianU_cg/cp_mstatus_mprv_ube_endianness_sb, EndianU_cg/cp_mstatus_mprv_ube_endianness_lw, EndianU_cg/cp_mstatus_mprv_ube_endianness_lbu

mstatus_ube_op

If U-mode is not supported, UBE is read-only 0. Otherwise, UBE controls whether explicit load and store memory accesses made from U-mode are little-endian (UBE=0) or big-endian (UBE=1).

EndianU_cg/{cp_mstatus_ube_endianness_sw, cp_mstatus_ube_endianness_lw, cp_mstatus_ube_endianness_sh, cp_mstatus_ube_endianness_lbu}

mstatus_ube_rocopy

If U-mode is supported, an implementation may make UBE be a read-only copy of either MBE or SBE.

UDB Parameters: None.

B.4.4. EndianZaamo Endianness for AMOs

Table 210. EndianZaamo Coverpoints
Coverpoint Goal Feature Description Notes

cp_endianness_amo

Read from memory in an endian fashion

Write 0x0102030405060708 to scratch. For each endianness, amoadd.w a different value to scratch. For RV64, also amoadd.d

restore endianness to normal afterward
MBE
when mstatus.MPRV=0

B.4.5. EndianZalrsc Endianness for LR/SC

Table 211. EndianZalrsc Coverpoints
Coverpoint Goal Feature Description Notes

cp_endianness_lr
cp_endianness_sc

Read from memory in an endian fashion

Write 0x0102030405060708 to scratch. For each endianness, lr.w from scratch and sc.w a different value back to scratch. For RV64, also lr.d and sc.d

restore endianness to normal afterward
MBE
when mstatus.MPRV=0

B.4.6. EndianF Endianness for Floats

Table 212. EndianF Coverpoints
Coverpoint Goal Feature Description Notes

cp_endianness_f

Read from memory in an endian fashion

Write 0x0102030405060708 to scratch. For each endianness, flw from scratch, and fsw back to scratch. For D, also fld and fsd.

restore endianness to normal afterward
MBE
when mstatus.MPRV=0

B.4.7. EndianZca Endianness for Compressed Instructions

Table 213. EndianZca Coverpoints
Coverpoint Goal Feature Description Notes

cp_endianness_zca

Read from memory in an endian fashion

Write 0x0102030405060708 to scratch. For each endianness, c.lw from scratch, and c.sw back to scratch. For RV64, also c.ld and c.sd.

restore endianness to normal afterward
MBE
when mstatus.MPRV=0

B.5. Ssstrict

The Ssstrict extension indicates that executing unimplemented instructions or accessing unimplemented CSR in the standard or reserved encoding spaces raises an illegal instruction exception.

No non-conforming extensions are present. Attempts to execute unimplemented opcodes or access unimplemented CSRs in the standard or reserved encoding spaces raises an illegal instruction exception that results in a contained trap to the supervisor-mode trap handler.
— https://github.com/riscv/riscv-profiles/blob/main/src/rva23-profile.adoc[RVA23 profile Ssstrict definition]

The Ssstrict suite has one group per privilege mode the tests run in: Ssstrict_Sm (M-mode), Ssstrict_S (S-mode) and Ssstrict_U (U-mode), plus Ssstrict_H (VS-mode and VU-mode) when the H extension is implemented.

The Ssstrict_Sm tests require Sm, so they are not part of a certificate without Sm, such as RVA23.

Vector instructions introduce complex register constraints and are tested separately in SsstrictV.

B.5.1. Ssstrict_Sm

RISC-V does not have a ratified equivalent of Ssstrict for machine mode, but this optional test suite checks the behavior of unimplemented instructions and CSRs from machine mode. It runs the same tests as Ssstrict_S but from machine mode.

The following CSR accesses and instructions should be exercised in machine mode. All inherently require Zicsr.

Table 214. Ssstrict_Sm Coverpoints
Coverpoint Goal Feature Description Expectation Bins Normative Rule Notes

cp_csrr

CSR Accesses

Read all 4096 CSRs in M-mode (CSRR with rd≠x0). Skips: PMP regs 0x3A0-0x3EF, debug-only 0x7B0-0x7BF, and custom CSRs (0x7C0-0x7FF, 0xBC0-0xBFF, 0xFC0-0xFFF).

Legal CSRs return a value; non-existent/inaccessible CSRs raise illegal-instruction exception.

One bin per CSR address 0x000–0xFBF (excluding skips)

medelegh_omit_xlen64
medeleg_mideleg_omit_wo_s_mode
mcounteren_presence
stateen_rv32_upper_bits_csrs
menvcfgh_sz_acc_op
mseccfgh_presence
mstatush_sz_acc
rv32_high_access
menvcfg_menvcfgh_no_u_mode
Zicsr_nonexistent_rsv
Zicsr_high_half_rv64_rsv

csrr instruction, save value

cp_csrw_corners

CSR Accesses

Write all-zeros then all-ones to every CSR in M-mode. Skips PMP regs (0x3A0-0x3EF) to avoid corrupting PMP configuration and custom CSRs.

Write to legal CSRs succeeds; write to read-only or non-existent CSRs raises illegal-instruction.

Two bins per CSR: write 0x000…​0 and write 0xFFF…​F

csrw instruction

cp_csrcs

CSR Accesses

Set all bits (CSRRS with rs1=all-ones) then clear all bits (CSRRC with rs1=all-ones) for every CSR in M-mode. Skips PMP and custom CSRs.

Same as cp_csrw_corners — legal writes succeed, illegal CSRs trap.

Two bins per CSR: CSRRS all-ones, CSRRC all-ones

stateen_rv32_upper_bits_csrs
medelegh_omit_xlen64
menvcfgh_sz_acc_op
mseccfgh_presence
mstatush_sz_acc
rv32_high_access
menvcfg_menvcfgh_no_u_mode
Zicsr_nonexistent_rsv
Zicsr_high_half_rv64_rsv

csrc -1

cp_illegal_instruction

Illegal Uncompressed Instructions

Exhaustively test reserved and illegal 32-bit instruction encodings across all major opcodes and sub-fields: reserved opcodes (op7/15/21/23/26/29/31), reserved funct3 in LOAD/STORE/BRANCH/JALR, reserved funct7 in R-type/FP, reserved immediate fields (IWshift imm[5]=1, aes64ks1i rnum), reserved FP fmt/rs2 combos, reserved SYSTEM encodings, reserved FENCE fm/rs1/rd fields, and reserved vector vset encodings.

Each reserved encoding raises an illegal-instruction exception. Legal encodings of unimplemented extensions may also trap.

One bin per distinct template×exhaustive-bit combination from illegalinstrtests.py. Templates use R=random, E=exhaustive, 0/1=fixed bits.

cp_illegal_compressed_instruction

Illegal Compressed Instructions

Exhaustively test all 2^14 encodings in each 16-bit quadrant (quadrant 00 = bits[1:0]=00, quadrant 01, quadrant 10), covering reserved encodings in Zca/Zcb/Zcd/Zcf/Zcmt/Zcmp.
Encodings whose legal execution could fault, jump, or corrupt the signature pointer (x2) are excluded: quadrant 00 loads and stores; c.jal (RV32), c.addiw (RV64), c.j, c.beqz, c.bnez, and rd = x2 in quadrant 01; sp-relative loads and stores, c.jr, c.jalr, c.ebreak, and rd = x2 in quadrant 10.
The reserved code points inside those ranges are swept separately: c.jr with rs1 = x0; c.lwsp with rd = x0; c.ldsp with rd = x0; c.addi16sp with nzimm = 0; and, on RV64 only, c.addiw with rd = x0 (on RV32 these encodings are c.jal).

Each reserved compressed encoding raises illegal-instruction. Legal encodings succeed or cause addressable exceptions for memory ops.
c.ldsp with rd = x0 is reserved on RV64 and on RV32 with Zclsd. On RV32 with Zcf the same encodings are the legal c.flwsp f0, and on RV32 without Zcf or Zclsd they are unimplemented.
The separately swept reserved encodings are harmless on a hart that wrongly executes them as the neighboring legal instruction: c.lwsp and c.ldsp with rd = x0 only read x2+uimm (at most 504 bytes into the signature and trap-signature regions) and discard the result, c.addi16sp with nzimm = 0 adds 0 to x2, and c.addiw with rd = x0 writes x0.

One bin per swept encoding in each quadrant, except the excluded ranges.
Reserved code points in excluded ranges: cp_compressed10 illegal_c_jr (1 bin), illegal_c_lwsp (64 bins), illegal_c_ldsp (64 bins); cp_compressed01 illegal_c_addi16sp (1 bin), illegal_c_addiw (64 bins, RV64 only).

cp_upperreg

Instructions using x16-x31

For each register x16–x31 as rd, rs1, or rs2, execute: ADD rd,rs1,rs2 / ADDI rd,rs1,0 / ADDI rd,rs1,-1 / MUL rd,rs1,rs2 (integer). Also: FADD.S fd,fs1,fs2 / FMV.X.W rd,fs1 / FMV.W.X fd,rs1 (float). Sweeps all 16 upper register positions in each operand slot.

If RV32E/RV64E is active (misa.E=1): all x16-x31 accesses raise illegal-instruction. If standard I base: all succeed. F registers f0-f31 always succeed if F supported.

16 bins × {rd, rs1, rs2} × {add, addi×2, mul} = 192 integer bins
16 bins × {rd, rs1, rs2} × {fadd.s, fmv.x.w, fmv.w.x} = 144 float bins

diff_rv32e_rv32i

All f registers should succeed if F is supported. x16-31 should trap if E base extension is used.

cp_misa_ext_disable

Extension bits

For each MUTABLE_MISA_* parameter (A, B, C, D, F, H, I, M, Q, V, S, U): disable the misa bit, execute a representative instruction from that extension, then re-enable.
A: amoadd.w / B: sb.set+sh3add+clmul+bext / C: c.addi / D: fadd.d / F: fadd.s / H: hfence.vvma / I: addi x16,x16,0 / M: mul / Q: fadd.q / V: vadd.vv / S: enter S-mode / U: enter U-mode

Each instruction raises illegal-instruction with the misa bit cleared. Zbc is NOT controlled by B bit (clmul should still work when B=0). Entering S/U mode with S/U bit cleared should trap.

One bin per {extension × instruction-sample}
B-extension sub-bins: Zba (sh3add), Zbb (andn), Zbc (clmul — no trap), Zbs (bext)

Should throw illegal instruction. For B, run instruction from each of Zba, Zbb, Zbc, Zbs (Zbc should be unaffected). For I, run an instruction that uses x16-x31.

cp_amocas_odd

Zacas instructions with odd register IDs

For each of AMOCAS.W, AMOCAS.D, AMOCAS.Q: attempt odd rd and odd rs2 register IDs (register pairs must be even-aligned). AMOCAS.D odd regs trap on RV32; AMOCAS.Q odd regs trap on both RV32/RV64.

AMOCAS.D/Q with odd rd or rs2 raises illegal-instruction exception.

Odd rd bins × {.w, .d, .q} + Odd rs2 bins × {.w, .d, .q}

d should trap for RV32 and q for both

cp_reserved_frm

Reserved FP rounding modes

Execute a floating-point instruction (FADD.S) with each rounding mode 0–7 written explicitly to FRM. Rounding modes 5 and 6 are reserved; mode 7 (DYN) with FRM=5/6/7 should raise invalid-operation exception (NV flag set).

FRM=0-4: legal, no exception. FRM=5,6: reserved — DUT may raise illegal-instruction or invalid FP exception. FRM=7 with dynamic FRM=5/6/7: raises invalid FP exception.

8 bins: FRM ∈ {0,1,2,3,4,5,6,7} with FADD.S using rounding mode 7 (DYN)

* add vector Ssstrict instruction tests for all SEW to SsstrictV

B.5.2. Ssstrict_S

Attempt to issue all flavors of 32-bit instructions in the standard and reserved spaces and all 16-bit compressed instructions. Also attempt to access all CSRs in the standard and reserved spaces that should be inaccessible. Expect illegal instruction trap for unimplemented instructions and CSRs, matching reference model.

According to the RVA23 profile spec, the illegal instruction should be cause a trap to the supervisor trap handler. However, delegation is the business of the firmware, not the hardware. These tests only check that a trap occurs and matches the reference model.

The following CSR accesses and instructions should be exercised in supervisor mode. All inherently require Zicsr.

Table 215. Ssstrict_S Coverpoints
Coverpoint Goal Feature Description Expectation Bins Normative Rule Notes

cp_csrr

CSR Accesses

Read all 4096 CSRs from S-mode (CSRR with rd≠x0). Skips: satp (0x180, would enable virtual memory), custom S/H CSRs (0x5C0-0x5FF, 0x6C0-0x6FF, 0x9C0-0x9FF, 0xAC0-0xAFF, 0xDC0-0xDFF, 0xEC0-0xEFF).

S-mode CSRs return values; M-mode/H-mode/debug CSRs raise illegal-instruction from S-mode.

One bin per CSR 0x000–0xFFF (excluding skips), executed from S-mode

Ssstrict_unimplemented_opcodes_csr_exception
hedelegh_sz_acc_op
henvcfgh_sz_acc_op
htimedeltah_sz_acc_op
stateen_rv32_upper_bits_csrs
vstimecmp_acc
stimecmp_stimecmph_sz_acc

Switch to S-mode (ecall with a0=1) before CSR sweep.
Fast trap handler must be installed from M-mode first.
Excludes satp to avoid activating virtual memory.

cp_csrw_corners

CSR Accesses

Write all-zeros and all-ones to every CSR from S-mode. Skips satp and same custom CSRs as cp_csrr.

S-mode writable CSRs accept writes; read-only or higher-privilege CSRs trap.

Two bins per CSR: write 0 and write all-ones

Same as SsstrictSm but with mode switch to S-mode first.

cp_csrcs

CSR Accesses

Set and clear all bits of every CSR from S-mode using CSRRS/CSRRC with rs1=all-ones.

Same as cp_csrw_corners.

Two bins per CSR: CSRRS all-ones and CSRRC all-ones from S-mode

Ssstrict_unimplemented_opcodes_csr_exception
hedelegh_sz_acc_op
henvcfgh_sz_acc_op
htimedeltah_sz_acc_op
stateen_rv32_upper_bits_csrs
vstimecmp_acc
stimecmp_stimecmph_sz_acc

CSRRS/CSRRC with x=−1 from S-mode.

cp_shadow_m

Shadow CSR verification (M-mode write)

Write all-ones and all-zeros to mstatus, mie, mip from M-mode, verifying the S-mode shadow registers (sstatus, sie, sip) reflect the correct subset of bits. Also write all-ones/zeros to sstatus, sie, sip from S-mode and verify the M-mode shadows reflect the changes.

mstatus↔sstatus, mie↔sie, mip↔sip are consistent: bits shared between the views have the same value; sstatus-only bits do not appear in mstatus and vice versa.

6 bins: {mstatus, mie, mip} × {write 0, write 1s} from M-mode
6 bins: {sstatus, sie, sip} × {write 0, write 1s} from S-mode

From M-mode: csrrw x0, mstatus, x2 (x2=-1) then csrrw x0, mstatus, x0.
Implemented as inline code after S-mode CSR sweep.

cp_illegal_instruction

Illegal Uncompressed Instructions

Same encoding sweep as SsstrictSm but executed from S-mode. All reserved/illegal encodings must trap; M-mode-only instructions (MRET, debug CSR access) also trap from S-mode.

Identical to M-mode case — illegal-instruction exception per reserved encoding.

Same as SsstrictSm cp_illegal_instruction but with S-mode priv_mode context

Switch to S-mode before #include of SsstrictInstr-Tests.h.
mstatus.FS/VS must be enabled from M-mode before switching.

cp_illegal_compressed_instruction

Illegal Compressed Instructions

Same compressed quadrant sweep (00/01/10) as SsstrictSm, including the separately swept reserved code points (c.jr with rs1 = x0, c.lwsp and c.ldsp with rd = x0, c.addi16sp with nzimm = 0, and c.addiw with rd = x0 on RV64), but from S-mode.

Same as SsstrictSm — each reserved encoding traps.

Same as SsstrictSm cp_illegal_compressed_instruction but S-mode context

Switch to S-mode before #include of SsstrictInstrCompressed-Tests.h.

cp_upperreg

Instructions using x16-x31 from S-mode

Same upper-register sweep as SsstrictSm but executed in S-mode. Tests that E-extension illegal-instruction behavior is consistent across privilege modes.

If RV32E/RV64E: trap on x16-x31 access. If standard I: succeed. F regs always succeed.

Same bins as SsstrictSm cp_upperreg, S-mode context

diff_rv32e_rv32i

Switch to S-mode first. Raw .word encodings for upper register positions.

cp_misa_ext_disable

Extension bits

Same extension disable sweep as SsstrictSm but: disable misa bit from M-mode, switch to S-mode, execute instruction, switch back, re-enable. Extensions: A, B, C, D, F, H, I, M, Q, U, V (S-mode cannot disable S itself). U-mode entry with U=0 should trap.

Each instruction executed in S-mode with misa bit cleared raises illegal-instruction. Entering U-mode with misa.U=0 should fail.

One bin per extension per {M-mode-disable → S-mode-execute}

M-mode: clear misa bit / ecall to S-mode / execute instruction / ecall back to M-mode / restore misa.
U-mode entry: ecall(0) with misa.U=0 should trap.

cp_reserved_frm

Reserved FP rounding modes from S-mode

Same as SsstrictSm cp_reserved_frm but executed from S-mode. Verify reserved FRM behavior is consistent across privilege levels.

Same as SsstrictSm — FRM 5/6 reserved, mode 7 with DYN FRM=5/6/7 raises FP exception.

8 bins: FRM ∈ {0..7} with FADD.S in S-mode

Switch to S-mode, then csrwi frm,N / fadd.s f0,f1,f2 for N=0..7.

Note that satp is already tested in VM, so it is safe to exclude here

B.5.3. Ssstrict_U

Same as Ssstrict_S, but runs from user mode and includes attempts to access supervisor CSRs that should be inaccessible from user mode.

The following CSR accesses and instructions should be exercised in user mode. All inherently require Zicsr.

Table 216. Ssstrict_U Coverpoints
Coverpoint Goal Feature Description Expectation Bins Normative Rule

cp_csrr

CSR Accesses

Read all 4096 CSRs from U-mode (CSRR with rd≠x0). Skips user-custom CSRs only (0x800-0x8FF, 0xCC0-0xCFF). All non-user CSRs should raise illegal-instruction from U-mode.

User-level CSRs (cycle, time, instret, hpmcounters, fflags, frm, fcsr, vtype etc.) succeed if enabled; all others trap.

One bin per CSR 0x000–0xFFF (excluding user-custom ranges), executed from U-mode

Zicsr_nonexistent_rsv

cp_csrw_corners

CSR Accesses

Write all-zeros and all-ones to every CSR from U-mode. Skips user-custom CSRs. Writable user-level CSRs: fflags, frm, fcsr. All others trap.

Only fflags/frm/fcsr accept writes from U-mode; all other writes raise illegal-instruction.

Two bins per CSR: write 0 and write all-ones from U-mode

cp_csrcs

CSR Accesses

CSRRS/CSRRC with rs1=all-ones for every CSR from U-mode.

Same as cp_csrw_corners — only fp CSRs succeed, all others trap.

Two bins per CSR: CSRRS and CSRRC all-ones from U-mode

cp_illegal_instruction

Illegal Uncompressed Instructions

Same encoding sweep as SsstrictSm/S but from U-mode. S-mode and M-mode instructions (SRET, MRET, CSR M/S access) also trap from U-mode.

All reserved encodings and privilege-elevated instructions raise illegal-instruction from U-mode.

Same as SsstrictSm cp_illegal_instruction, U-mode priv_mode context

cp_illegal_compressed_instruction

Illegal Compressed Instructions

Same compressed quadrant sweep (00/01/10) as SsstrictSm/S, including the separately swept reserved code points (c.jr with rs1 = x0, c.lwsp and c.ldsp with rd = x0, c.addi16sp with nzimm = 0, and c.addiw with rd = x0 on RV64), but from U-mode.

All reserved encodings trap from U-mode.

Same as SsstrictSm cp_illegal_compressed_instruction, U-mode context

cp_upperreg

Instructions using x16-x31 from U-mode

Same upper-register sweep as SsstrictSm but executed in U-mode.

If RV32E/RV64E: trap on x16-x31 use. Standard I: succeed. F regs succeed if F supported.

Same bins as SsstrictSm cp_upperreg, U-mode context

cp_misa_ext_disable

Extension bits

Same extension disable sweep as SsstrictSm but: disable misa bit from M-mode, switch to U-mode, execute instruction, switch back, re-enable. Extensions: A, B, C, D, F, H, I, M, Q, V.

Each instruction executed in U-mode with misa bit cleared raises illegal-instruction.

One bin per extension per {M-mode-disable → U-mode-execute}

cp_reserved_frm

Reserved FP rounding modes from U-mode

Same as SsstrictSm cp_reserved_frm but from U-mode. Requires F extension with mstatus.FS≠Off (FP enabled by M-mode before switching).

Same FRM reserved-mode behavior as M/S modes.

8 bins: FRM ∈ {0..7} with FADD.S in U-mode

B.5.4. Ssstrict_H

Same as Ssstrict_S from VS-mode and Ssstrict_U from VU-mode. Instructions and CSR accesses that are HS-qualified but prevented when V=1 raise virtual-instruction exceptions instead of illegal-instruction exceptions.

The Ssstrict_S CSR and instruction sweeps are exercised in VS-mode and the Ssstrict_U sweeps in VU-mode. The suite boots to HS-mode, enters VS-mode or VU-mode at the start of each block of tests and returns to HS-mode at its end. Boot delegates illegal-instruction and virtual-instruction exceptions to HS-mode and leaves hedeleg = 0, so the HS-mode fast trap handler records cause, epc and tval for every trap. vsatp and hgatp stay Bare.

Table 217. Ssstrict_H Coverpoints
Coverpoint Goal Feature Description Expectation Bins Normative Rule Notes

cp_csrr

CSR Accesses

Read the Ssstrict_S CSRs from VS-mode and the Ssstrict_U CSRs from VU-mode (CSRR with rd≠x0), with the same skips.

S CSR numbers reach the VS replicas from VS-mode. Hypervisor and VS CSRs raise virtual-instruction from VS-mode. CSRs that do not exist raise illegal-instruction. From VU-mode, user CSRs behave as from U-mode.

One bin per swept CSR in Ssstrict_H_vscsr_cg (VS-mode) and Ssstrict_H_vucsr_cg (VU-mode)

Ssstrict_unimplemented_opcodes_csr_exception
H_cause_virtual_instruction
H_cause_virtual_instruction_high

satp is skipped because a write to vsatp could turn on VS-stage translation.

cp_csrw_edges

CSR Accesses

Write all-zeros and all-ones to the same CSRs as cp_csrr, from VS-mode and VU-mode, and restore each CSR.

Writable CSRs accept the writes; read-only, higher-privilege and nonexistent CSRs trap as in cp_csrr.

Two bins per CSR: write 0 and write all-ones

H_cause_virtual_instruction
H_cause_virtual_instruction_high

cp_csrcs

CSR Accesses

CSRRS and CSRRC with rs1 = all-ones for the same CSRs as cp_csrr, from VS-mode and VU-mode.

Same as cp_csrw_edges.

Two bins per CSR: CSRRS and CSRRC all-ones

H_cause_virtual_instruction
H_cause_virtual_instruction_high

cp_illegal_instruction

Illegal Uncompressed Instructions

Same encoding sweep as Ssstrict_S, including the upper-register and vector encodings, from VS-mode and from VU-mode.

Reserved encodings raise illegal-instruction. HS-qualified instructions that V=1 prevents, such as hfence.vvma and hfence.gvma, raise virtual-instruction.

Same as Ssstrict_S cp_illegal_instruction, crossed with VS-mode and VU-mode (Ssstrict_H_instr_cg)

cp_illegal_compressed_instruction

Illegal Compressed Instructions

Same compressed quadrant sweep (00/01/10) as Ssstrict_S, including the separately swept reserved code points, from VS-mode and from VU-mode.

Each reserved encoding raises illegal-instruction.

Same as Ssstrict_S cp_illegal_compressed_instruction, crossed with VS-mode and VU-mode (Ssstrict_H_comp_instr_cg)

B.5.5. Ssstrict Normative Rules

Table 218. Ssstrict Normative Rules
Normative Rule Rule Text Coverpoints

Ssstrict_no_nonconforming_extensions

If the Ssstrict extension is implemented, then no non-conforming extensions are present.

Ssstrict_S_instr_cg/{cp_illegal, cp_reserved}, Ssstrict_S_comp_instr_cg/{cp_compressed00, cp_compressed01}

Ssstrict_unimplemented_opcodes_csr_exception

Furthermore, attempts to execute unimplemented opcodes or access unimplemented CSRs in the standard or reserved encoding spaces raises an illegal instruction exception that results in a contained trap to the supervisor-mode trap handler.

Ssstrict_S_scsr_cg/cp_csrr, Ssstrict_S_scsr_cg/cp_csrw_edges, Ssstrict_S_scsr_cg/cp_csrcs, Ssstrict_S_instr_cg/cp_illegal, Ssstrict_H_vscsr_cg/cp_csrr, Ssstrict_H_vucsr_cg/cp_csrr, Ssstrict_H_instr_cg/cp_illegal

H_cause_virtual_instruction

When V=1, a virtual-instruction exception (code 22) is normally raised instead of an illegal-instruction exception if the attempted instruction is HS-qualified but is prevented from executing when V=1 either due to insufficient privilege or because the instruction is expressly disabled by a supervisor or hypervisor CSR such as scounteren or hcounteren. An instruction is HS-qualified if it would be valid to execute in HS-mode (for some values of the instruction’s register operands), assuming fields TSR and TVM of CSR mstatus are both zero.

Ssstrict_H_vscsr_cg/{cp_csrr, cp_csrw_edges, cp_csrcs}, Ssstrict_H_instr_cg/cp_privileged_000

H_cause_virtual_instruction_high

A special rule applies for CSR instructions that access 32-bit high-half CSRs such as cycleh and htimedeltah. When V=1 and XLEN=32, an invalid attempt to access a high-half CSR raises a virtual-instruction exception instead of an illegal-instruction exception if the same CSR instruction for the corresponding low-half CSR (e.g.cycle or htimedelta) is HS-qualified.

Ssstrict_H_vscsr_cg/{cp_csrr, cp_csrw_edges, cp_csrcs}

slliw_srliw_sraiw_imm5_rsv

SLLIW, SRLIW, and SRAIW encodings with imm[5]≠0 are reserved.

Ssstrict_S_instr_cg/cp_IWshift

c-addi16sp_rsv

C.ADDI16SP is valid only when nzimm≠0; the code point with nzimm=0 is reserved.

Ssstrict_S_comp_instr_cg/cp_compressed01/illegal_c_addi16sp

c-addi4spn_rsv

C.ADDI4SPN is valid only when nzuimm≠0; the code points with nzuimm=0 are reserved.

Ssstrict_S_comp_instr_cg/cp_compressed00

c-addiw_rsv

C.ADDIW is valid only when rd≠x0; the code points with rd=x0 are reserved.

Ssstrict_S_comp_instr_cg/cp_compressed01/illegal_c_addiw

c-jr_rsv

C.JR is valid only when rs1≠x0; the code point with rs1=x0 is reserved.

Ssstrict_S_comp_instr_cg/cp_compressed10/illegal_c_jr

c-ldsp_rsv

C.LDSP is valid only when rd≠x0; the code points with rd=x0 are reserved.

Ssstrict_S_comp_instr_cg/cp_compressed10/illegal_c_ldsp

c-lui_rsv

C.LUI is valid only when rd≠x2, and when the immediate is not equal to zero. The code points with imm=0 are reserved. The code points with rd=x2 and imm≠0 correspond to the C.ADDI16SP instruction.

Ssstrict_S_comp_instr_cg/cp_compressed01

c-lwsp_rsv

C.LWSP is valid only when rd≠x0; the code points with rd=x0 are reserved.

Ssstrict_S_comp_instr_cg/cp_compressed10/illegal_c_lwsp

Zilsd_c-ldsp_x0

For C.LDSP, usage of x0 as the destination is reserved.

Ssstrict_S_comp_instr_cg/cp_compressed10/illegal_c_ldsp

roundingmode_rsv

The behavior of floating-point instructions that depend on rounding mode when executed with a reserved rounding mode is reserved, including both static reserved rounding modes (101&#8205;&#8211;&#8205;110) and dynamic reserved rounding modes (101&#8205;&#8211;&#8205;111).

Ssstrict_S_instr_cg/cp_Ftype, Ssstrict_S_instr_cg/cp_reserved

roundingmode_unaffected_rm_decode

Some instructions, including widening conversions, have the rm field but are nevertheless mathematically unaffected by the rounding mode; software should set their rm field to RNE (000) but implementations must treat the rm field as usual (in particular, with regard to decoding legal vs. reserved encodings).

TODO: sweep reserved rm values (101, 110, and 111 with reserved frm) on widening conversions such as fcvt.d.s, fcvt.s.h, and fcvt.d.w

fcvtmod-w-d_enc

It is encoded like FCVT.W.D, but with the rs2 field set to 8 and the rm field set to 1 (RTZ). Other rm values are reserved.

Ssstrict_S_instr_cg/cp_cvtmodwdfrm

Zdinx_x_reg_pair

For RV32, double-precision operands in Zdinx are held in aligned x-register pairs. In other words, register numbers must be even. Use of misaligned (odd-numbered) registers for double-width floating-point operands is reserved.

TODO

bclri_shamt_rsv_rv32

For RV32, the encodings corresponding to shamt[5]=1 are reserved.

Ssstrict_S_instr_cg/cp_Itype

bexti_shamt_rsv_rv32

For RV32, the encodings corresponding to shamt[5]=1 are reserved.

Ssstrict_S_instr_cg/cp_Itype

binvi_shamt_rsv_rv32

For RV32, the encodings corresponding to shamt[5]=1 are reserved.

Ssstrict_S_instr_cg/cp_Itype

bseti_shamt_rsv_rv32

For RV32, the encodings corresponding to shamt[5]=1 are reserved.

Ssstrict_S_instr_cg/cp_Itype

Zacas_rv32_amocas-d_frst_pair_entry_reg_even

The instruction requires the first register in the pair to be even numbered; encodings with odd numbered registers specified in rs2 and rd are reserved.

Ssstrict_S_instr_cg/cp_amocas_odd

Zacas_rv64_amocas-q_frst_pair_entry_reg_even

The instruction requires the first register in the pair to be even numbered; encodings with odd numbered registers specified in rs2 and rd are reserved.

Ssstrict_S_instr_cg/cp_amocas_odd

ldaq_no_aq_reserved

The versions without the aq bit set are RESERVED.

TODO

sdrl_no_rl_reserved

The versions without the rl bit set are RESERVED.

TODO

diff_rv32e_rv32i

RV32E and RV64E use the same instruction-set encoding as RV32I and RV64I respectively, except that only registers x0‍–‍x15 are provided. All encodings specifying the other registers x16‍–‍x31 are reserved.

Ssstrict_S_instr_cg/cp_upperreg_rs1, Ssstrict_S_instr_cg/cp_upperreg_rs2, Ssstrict_S_instr_cg/cp_upperreg_rd, Ssstrict_S_instr_cg/cp_upperreg_imm_rd

hedelegh_sz_acc_op

When XLEN=32, hedelegh is a 32-bit read/write register that aliases bits 63:32 of hedeleg. Register hedelegh does not exist when XLEN=64.

Ssstrict_S_scsr_cg/{cp_csrr, cp_csrw_edges, cp_csrcs}/hedelegh

henvcfgh_sz_acc_op

When XLEN=32, henvcfgh is a 32-bit read/write register that aliases bits 63:32 of henvcfg. Register henvcfgh does not exist when XLEN=64.

Ssstrict_S_scsr_cg/{cp_csrr, cp_csrw_edges, cp_csrcs}/henvcfgh

htimedeltah_sz_acc_op

When XLEN=32, htimedeltah is a 32-bit read/write register that aliases bits 63:32 of htimedelta. Register htimedeltah does not exist when XLEN=64.

Ssstrict_S_scsr_cg/{cp_csrr, cp_csrw_edges, cp_csrcs}/htimedeltah

stateen_rv32_upper_bits_csrs

For RV32, there are CSR addresses for accessing the upper 32 bits of corresponding machine-level and hypervisor CSRs: mstateen0h, mstateen1h, mstateen2h, mstateen3h, hstateen0h, hstateen1h, hstateen2h, and hstateen3h.

Ssstrict_S_scsr_cg/{cp_csrr, cp_csrw_edges, cp_csrcs}/{hstateen0h, hstateen1h, hstateen2h, hstateen3h}, Ssstrict_Sm_mcsr_cg/{cp_csrr, cp_csrw_edges, cp_csrcs}/{mstateen0h, mstateen1h, mstateen2h, mstateen3h}

vstimecmp_acc

In RV32 only, accesses to the vstimecmp CSR access the low 32 bits, while accesses to the vstimecmph CSR access the high 32 bits of vstimecmp.

Ssstrict_S_scsr_cg/{cp_csrr, cp_csrw_edges, cp_csrcs}/vstimecmph

stimecmp_stimecmph_sz_acc

The stimecmp CSR is a 64-bit register and has 64-bit precision on all RV32 and RV64 systems. In RV32 only, accesses to the stimecmp CSR access the low 32 bits, while accesses to the stimecmph CSR access the high 32 bits of stimecmp.

Ssstrict_S_scsr_cg/{cp_csrr, cp_csrw_edges, cp_csrcs}/stimecmph

medelegh_omit_xlen64

The medelegh register does not exist when XLEN=64.

Ssstrict_Sm_mcsr_cg/{cp_csrr, cp_csrw_edges, cp_csrcs}/medelegh

menvcfgh_sz_acc_op

When XLEN=32, menvcfgh is a 32-bit read/write register that aliases bits 63:32 of menvcfg. The menvcfgh register does not exist when XLEN=64.

Ssstrict_Sm_mcsr_cg/{cp_csrr, cp_csrw_edges, cp_csrcs}/menvcfgh

mseccfgh_presence

Register mseccfgh exists when XLEN=32 and mseccfg is implemented; it does not exist when XLEN=64.

Ssstrict_Sm_mcsr_cg/{cp_csrr, cp_csrw_edges, cp_csrcs}/mseccfgh

mstatush_sz_acc

For RV32 only, mstatush is a 32-bit read/write register formatted as shown in mstatushreg.

Ssstrict_Sm_mcsr_cg/{cp_csrr, cp_csrw_edges, cp_csrcs}/mstatush

rv32_high_access

In RV32 only, accesses to the mcyclecfg and minstretcfg CSRs access the low 32 bits, while accesses to the mcyclecfgh and minstretcfgh CSRs access the high 32 bits of mcyclecfg and minstretcfg, respectively.

Ssstrict_Sm_mcsr_cg/{cp_csrr, cp_csrw_edges, cp_csrcs}/{mcyclecfgh, minstretcfgh}

menvcfg_menvcfgh_no_u_mode

If U-mode is not supported, then registers menvcfg and menvcfgh do not exist.

Ssstrict_Sm_mcsr_cg/{cp_csrr, cp_csrw_edges, cp_csrcs}/{menvcfg, menvcfgh}

UDB Parameters: None.

B.6. PMP

B.6.1. PMP_Sm Machine

General Test Environment (PMP_Sm): - Runs when Sm is implemented and NUM_PMP_ENTRIES > 0. Boots to M-mode; every access on this sheet is made from M-mode. - Test files are split by UDB parameter: base, RV64 only (MXLEN = 64), PMP_NA4_SUPPORTED, PMP_NAPOT_SUPPORTED and PMP_TOR_SUPPORTED. The NA4 and TOR coverpoints are compiled out when the mode is not supported; the NAPOT ones are not. - Background entry: the highest usable entry (15 of 16, 63 of 64) is L=1, XWR=111, NAPOT over all of memory (TOR up to all ones when NAPOT is not supported), so accesses that match no lower entry succeed. cp_none_* runs before it is set. - Grain g = 2^(G+2) bytes from PMP_GRANULARITY. A standard region is a NAPOT region of max(g, 8) bytes in .data, g-aligned past the code. A TOR region is one grain. - Fetch probe = jalr into the region, which holds a return instruction. Loads = lb, lbu, lh, lhu, lw (+ lwu, ld on RV64). Stores = sb, sh, sw (+ sd on RV64). - Legal XWR = {000, 001, 011, 100, 101, 111}. R=0 with W=1 is reserved and never written. - After every PMP CSR write the tests execute sfence.vma when S-mode is implemented. - Coverpoints compare addresses and pmpaddr values on their low bits (PMP_ADDR_LOWMASK), so bins match wherever .data lands. - Entries 0-14 are the entries below the background entry of a 16-entry PMP; with 64 entries, cp_pmp64_* covers entries 15-62.

Table 219. PMP_Sm Coverpoints
Coverpoint Goal Feature Description Expectation Bins Normative Rule

Permission bits, locked entry

cp_cfg_X

Verify that X alone controls execute permission when the entry is locked (L=1).

PMP_NAPOT_SUPPORTED only. One standard NAPOT region. Walk the six legal XWR values with L=1, each in its own entry (XWR=000 in entry 5 down to XWR=111 in entry 0), so the newest entry is the highest-priority match. jalr to the start of the region.

Instruction access fault (mcause = 1) when X=0. The fetch completes when X=1.

6 XWR × jalr = 6

pmp_rwx_check
pmp_cfg_permissions
pmp_access_fault_exception
pmp_exec_fault
pmp_mmode_locking
pmp_l_bit_m_mode_enforcement

cp_cfg_R

Verify that R controls every load width when the entry is locked.

Same walk as cp_cfg_X. Every load (lb, lbu, lh, lhu, lw (+ lwu, ld on RV64)) at the start of the region.

Load access fault (mcause = 5) when R=0.

6 XWR × 5 loads = 30 (42 on RV64)

pmp_load_fault
pmp_rwx_check
pmp_cfg_permissions
pmp_access_fault_exception
pmp_mmode_locking
pmp_l_bit_m_mode_enforcement

cp_cfg_W

Verify that W controls every store width when the entry is locked.

Same walk as cp_cfg_X. Every store (sb, sh, sw (+ sd on RV64)) at the start of the region.

Store/AMO access fault (mcause = 7) when W=0.

6 XWR × 3 stores = 18 (24 on RV64)

pmp_store_fault
pmp_rwx_check
pmp_cfg_permissions
pmp_access_fault_exception
pmp_mmode_locking
pmp_l_bit_m_mode_enforcement

Permission bits in every entry

cp_cfg_X0_all
cp_cfg_X1_all

Verify that X is enforced by each of entries 0-14.

Entries 0-14 all cover the same standard NAPOT region. Program L=1 and a rolling legal XWR into entries 14 down to 0, one entry at a time (four test files), and jalr to the region after each write. The newest entry is the lowest-numbered match.

X=0: instruction access fault. X=1: the fetch completes.

15 entries each

pmp_l_bit_m_mode_enforcement
pmp_exec_fault
pmp_cfg_permissions
pmp_rwx_check
pmp_entry_priority
pmp_access_fault_exception

cp_cfg_Rw00_all
cp_cfg_Rw10_all
cp_cfg_Rw11_all

Verify that R is enforced by each of entries 0-14.

Same walk as cp_cfg_X0_all. Every load (lb, lbu, lh, lhu, lw (+ lwu, ld on RV64)) after each write. The suffix gives R then W: Rw00 = R0 W0, Rw10 = R1 W0, Rw11 = R1 W1.

Load access fault when R=0.

3 RW values × 15 entries × 5 loads (7 on RV64)

pmp_load_fault
pmp_cfg_permissions
pmp_rwx_check
pmp_l_bit_m_mode_enforcement
pmp_entry_priority

cp_cfg_rW00_all
cp_cfg_rW10_all
cp_cfg_rW11_all

Verify that W is enforced by each of entries 0-14.

Same walk as cp_cfg_X0_all. Every store (sb, sh, sw (+ sd on RV64)) after each write. The suffix gives R then W, as for cp_cfg_Rw*_all.

Store/AMO access fault when W=0.

3 RW values × 15 entries × 3 stores (4 on RV64)

pmp_store_fault
pmp_cfg_permissions
pmp_rwx_check
pmp_l_bit_m_mode_enforcement
pmp_entry_priority

L bit

cp_cfg_L_access_exec
cp_cfg_L_access_read
cp_cfg_L_access_write

Verify that an unlocked entry (L=0) never restricts an M-mode access.

For each of entries 0-14: L=0, A=NAPOT, XWR=000 over a standard region. jalr, lw and sw in the region.

All accesses succeed.

15 entries each

pmp_l_bit_m_mode_enforcement
pmp_rwx_check

cp_cfg_L_modify

Verify that a locked entry ignores writes to its pmpcfg and pmpaddr, and that a locked TOR entry also protects the preceding pmpaddr.

Entry 1: L={0,1}, A={OFF, TOR, NAPOT}, XWR=111, pmpaddr1 = 0x100. Clear pmpaddr1, clear pmpcfg0 (zeroing pmp1cfg), set pmp0cfg.XWR=111 through pmpcfg0, and write all ones to pmpaddr0; read each back. NA4 is not used because it is not selectable when G ≥ 1.

L=1: pmp1cfg and pmpaddr1 keep their values; pmpaddr0 keeps its value only when entry 1 is TOR; pmp0cfg is always writable. L=0: every write takes effect.

2 L × 3 A × 4 CSR writes = 24 (16 without TOR)

pmp_l_bit_function
pmp_mmode_locking
pmp_l_bit_write_protection
pmp_locked_until_reset

Address-matching mode (A field)

cp_cfg_A_all_even
cp_cfg_A_all_odd

Verify that every pmpcfg byte accepts each address-matching mode.

With L=0 and XWR=000, write A = OFF, TOR, NA4 and NAPOT into every byte of every pmpcfg CSR and read each back. cp_cfg_A_all_odd covers the odd pmpcfg CSRs (RV32 only).

Readback matches the reference model. A supported mode reads back as written. NA4 when G ≥ 1, or a mode the hart does not support, reads back as a legal value of the WARL field.

4 A (fewer without TOR or NA4) × even pmpcfg CSRs (2, or 8 with 64 entries); odd: 4 A × odd pmpcfg CSRs (RV32)

pmp_na4_select_restriction
pmp_a_field_encoding
pmp_csrs_warl_access
pmp_cfg_rv32_layout
pmp_cfg_rv64_layout

cp_cfg_A_OFF_all_read
cp_cfg_A_OFF_all_write
cp_cfg_A_OFF_all_exec

Verify that A=OFF disables each of entries 0-14.

For each entry: L=1, A=OFF, XWR=000, pmpaddr = a standard region. lw, sw and jalr in the region.

All accesses succeed: the OFF entry matches nothing and the background entry grants access.

15 entries each

pmp_a_field_off
pmp_a_field_encoding

cp_cfg_A_napot_all

Verify that A=NAPOT matches exactly its region, in each of entries 0-14.

PMP_NAPOT_SUPPORTED only. For each entry: L=1, A=NAPOT, XWR=000 over a standard region. lw 4 bytes below the region, at its base, and just past its top.

Load access fault at the base only. The two accesses outside the region succeed.

15 entries × 3 addresses = 45

pmp_access_fault_exception
pmp_a_field_napot_na4
pmp_a_field_encoding
pmp_napot_encoding_low_bits
pmp_load_fault

cp_cfg_A_napot_x
cp_cfg_A_napot_r
cp_cfg_A_napot_w

Verify that XWR is enforced across a locked NAPOT region and not outside it.

PMP_NAPOT_SUPPORTED only. Same walk as cp_cfg_X. jalr, lw and sw at base-4, base, base+4, the highest word, and just past the top.

Inside the region: access fault when the permission is clear. Outside: the access succeeds.

6 XWR × 5 addresses = 30 each

pmp_exec_fault
pmp_napot_encoding_low_bits
pmp_a_field_napot_na4
pmp_addr_encoding
pmp_rwx_check
pmp_load_fault
pmp_store_fault

cp_cfg_A_NA4_all

Verify that A=NA4 matches exactly four bytes, in each of entries 0-14.

PMP_NA4_SUPPORTED only (G = 0). For each entry: L=1, A=NA4, XWR=000. lw at region-4, region and region+4.

Load access fault at the region only.

15 entries × 3 addresses = 45

pmp_a_field_napot_na4
pmp_granularity
pmp_a_field_encoding
pmp_load_fault

cp_cfg_A_na4_x
cp_cfg_A_na4_r
cp_cfg_A_na4_w

Verify that XWR is enforced on a locked NA4 region and not on its neighbors.

PMP_NA4_SUPPORTED only. One NA4 region, six legal XWR with L=1. jalr, lw and sw at region-4, region and region+4.

Access fault at the region when the permission is clear. The neighbors succeed.

6 XWR × 3 addresses = 18 each

pmp_a_field_napot_na4
pmp_rwx_check
pmp_exec_fault
pmp_load_fault
pmp_store_fault

cp_cfg_A_tor_all0
cp_cfg_A_tor_all1
cp_cfg_A_tor_all2
cp_cfg_A_tor_all3
cp_cfg_A_tor_all4
cp_cfg_A_tor_all5
cp_cfg_A_tor_all6
cp_cfg_A_tor_all7
cp_cfg_A_tor_all8
cp_cfg_A_tor_all9
cp_cfg_A_tor_all10
cp_cfg_A_tor_all11
cp_cfg_A_tor_all12
cp_cfg_A_tor_all13
cp_cfg_A_tor_all14

Verify that A=TOR works in each of entries 0-14, with each region’s bottom taken from the preceding pmpaddr.

PMP_TOR_SUPPORTED only. Program pmpaddr0-14 so that TOR region i spans i+1 grains; region 0 runs from address 0 to pmpaddr0 and holds the code. All L=1, A=TOR; XWR=111 in entry 0, 001 in odd entries and 000 in even entries. lw in the last word of region 0 and at the start of every other region.

Region 0 and the odd regions: the load succeeds. Even regions 2-14: load access fault.

15 coverpoints × 1 bin

pmp_cfg_rv32_layout
pmp_cfg_rv64_layout
pmp_a_field_tor
pmp_entry_structure
pmp_load_fault

cp_cfg_A_tor_x
cp_cfg_A_tor_r
cp_cfg_A_tor_w

Verify that XWR is enforced across a locked TOR region and not outside it.

PMP_TOR_SUPPORTED only. One TOR region of one grain [bottom, top) from a pair of entries (the odd entry is TOR, the even one below it holds the bottom). Six legal XWR with L=1. jalr, lw and sw at bottom-4, bottom, bottom+4, top-4 and top.

Inside the region: access fault when the permission is clear. bottom-4 and top: the access succeeds.

6 XWR × 5 addresses = 30 each

pmp_exec_fault
pmp_a_field_tor
pmp_a_field_encoding
pmp_addr_encoding
pmp_rwx_check
pmp_load_fault
pmp_store_fault

cp_cfg_A_tor0_r
cp_cfg_A_tor0_w
cp_cfg_A_tor0_x

Verify that TOR entry 0 uses 0 as its bottom bound.

PMP_TOR_SUPPORTED only. Entry 0: L=1, A=TOR, XWR=000, pmpaddr0 = one grain, so region 0 is [0, grain). lw, sw and jalr at 0 and pmpaddr0-4. Skipped if the image or mtvec lies in [0, grain).

All accesses raise access faults from entry 0 before reaching the bus, whatever the platform maps at 0; without entry 0 the background entry would allow them.

2 addresses each

pmp_a_field_tor

cp_cfg_A_tor_bot_L0_x
cp_cfg_A_tor_bot_L0_w
cp_cfg_A_tor_bot_L0_r
cp_cfg_A_tor_bot_L1_x
cp_cfg_A_tor_bot_L1_w
cp_cfg_A_tor_bot_L1_r

Verify that TOR entry i spans [pmpaddr(i-1), pmpaddr(i)) whatever pmpcfg(i-1) holds.

PMP_TOR_SUPPORTED only. Entry 1: L=1, A=TOR, XWR=101. Entry 0: A=OFF, XWR=000, with L=0 (L0 coverpoints) and then L=1 (L1 coverpoints). pmpaddr1 = pmpaddr0 + g. jalr, sw and lw at pmpaddr0-4, pmpaddr0, pmpaddr1-4 and pmpaddr1.

In the region: jalr and lw succeed, sw raises a store/AMO access fault. Outside: all succeed. Entry 0’s L bit does not change the result.

4 addresses each

pmp_a_field_tor
pmp_entry_structure
pmp_store_fault
pmp_rwx_check

cp_cfg_A_tor_nonoverlap1_x
cp_cfg_A_tor_nonoverlap1_w
cp_cfg_A_tor_nonoverlap1_r
cp_cfg_A_tor_nonoverlap2_x
cp_cfg_A_tor_nonoverlap2_w
cp_cfg_A_tor_nonoverlap2_r
cp_cfg_A_tor_nonoverlap3_x
cp_cfg_A_tor_nonoverlap3_w
cp_cfg_A_tor_nonoverlap3_r

Verify that a TOR entry matches nothing when pmpaddr(i-1) ≥ pmpaddr(i).

PMP_TOR_SUPPORTED only. Entry 1: L=1, A=TOR, XWR=000, pmpaddr1 = R. Entry 0: A=OFF, L=0. pmpaddr0 = R (nonoverlap1), R + g (nonoverlap2), all ones (nonoverlap3). jalr, sw and lw at R-4, R and R+4.

All accesses succeed.

3 addresses each

pmp_a_field_tor

Priority and matching

cp_priority_lw
cp_priority_sw
cp_priority_jalr

Verify that the lowest-numbered matching entry decides the access.

PMP_NAPOT_SUPPORTED only. Entries 0-6: L=1, A=NAPOT, seven nested regions with a common base; entry i covers g·2^i bytes. XWR = 000, 101, 011, 100, 001, 111, 000 for entries 0-6. lw, sw and jalr at the last word of each region, which lies in entries i..6 only.

Each access follows entry i’s XWR: access fault when its permission is clear.

7 regions each

pmp_entry_priority
pmp_napot_encoding_low_bits
pmp_rwx_check
pmp_access_fault_exception

cp_priority_off_lw
cp_priority_off_sw
cp_priority_off_jalr

Verify that OFF entries are skipped and the first matching entry decides.

PMP_NAPOT_SUPPORTED only. Entries 0-3, all L=1: entry 0 OFF XWR=000, entry 1 NAPOT XWR=101, entry 2 OFF XWR=000, entry 3 NAPOT XWR=111. pmpaddr0 and pmpaddr2 hold the probed address; entries 1 and 3 cover it. lw, sw and jalr at that address.

jalr and lw succeed; sw raises a store/AMO access fault (entry 1 decides).

1 each

pmp_a_field_off
pmp_entry_priority
pmp_store_fault

cp_none_lw
cp_none_sw
cp_none_jalr

Verify that an M-mode access that matches no entry succeeds.

Before the background entry is set: every pmpcfg.A = OFF and pmpaddr0-15 = 0. lw, sw and jalr.

All accesses succeed.

1 each

pmp_no_entry_match
pmp_a_field_off

Grain

cp_grain_OFF_to_OFF
cp_grain_OFF_to_NAPOT
cp_grain_NAPOT_to_OFF
cp_grain_NAPOT_to_NAPOT
cp_grain_OFF_to_TOR
cp_grain_NAPOT_to_TOR

Verify that the low pmpaddr bits read back according to G and the current mode, and keep their stored value when the mode changes.

G ≥ 1 only (compiled out at PMP_GRANULARITY = 2). Write zeros, ones and a checkerboard to pmpaddr0 with pmpcfg0.A = NAPOT or OFF, then change A to OFF, NAPOT or TOR and read pmpaddr0[G-1:0].

NAPOT: pmpaddr0[G-2:0] read as ones and bit G-1 returns the written value, even if it was written while the entry was OFF. OFF and TOR: pmpaddr0[G-1:0] read as zeros.

6 transitions (4 without TOR); the tests write 3 patterns per transition

pmp_tor_off_addr_read_mask
pmp_napot_addr_read_mask
pmp_addr_retention_on_mode_change
pmp_region_granularity_g

cp_grain_check_write
cp_grain_check_read

Verify the grain G seen in pmpaddr0.

pmpcfg0 = 0. Write all ones to pmpaddr0 and read it back.

Bits G-1:0 read as zero and bit G reads as one, matching PMP_GRANULARITY.

1 each

pmp_addr_registers
pmp_granularity
pmp_region_granularity_g
pmp_addr_warl
pmp_csrs_warl_access
pmp_tor_off_addr_read_mask

PMP CSR access

cp_pmpaddr_upper_zero

Verify that pmpaddr bits 63:54 are zero on RV64.

RV64 only. Write all ones to every implemented pmpaddr CSR and read it back.

Bits 63:54 read as zero.

16 or 64 pmpaddr CSRs

pmp_addr_registers
pmp_addr_warl
pmp_csrs_warl_access
pmp_addr_encoding

cp_pmpcfg_walk
cp_pmpcfg_walk_odd
cp_pmpcfg_zero

Verify the layout and WARL behavior of the pmpcfg CSRs.

Write zero, then a walking one through each bit of every implemented pmpcfg CSR (pmpcfg0-15 on RV32, the even pmpcfg CSRs on RV64), and read each back. The walk skips bit 1 (W alone is reserved) and bit 4 (A = NA4) of every byte. cp_pmpcfg_walk_odd and cp_pmpcfg_zero cover the odd CSRs on RV32.

Readback matches the reference model: bits 6:5 of each byte read as zero, and a one written to bit 7 locks that entry.

Walking-one values (24 on RV32, 48 on RV64) × even pmpcfg CSRs; on RV32 also × odd CSRs, plus zero to each odd CSR

pmp_csrs_warl_access
pmp_cfg_rv32_layout
pmp_cfg_rv64_layout
pmp_rwx_warl
pmp_entry_structure

64 PMP entries

cp_pmp64_write
cp_pmp64_read

Verify that entries 15-62 of a 64-entry PMP enforce permissions.

NUM_PMP_ENTRIES = 64 and PMP_NAPOT_SUPPORTED only. For each of entries 62 down to 15: L=1, A=NAPOT, XWR=101 over a standard region. sw and lw in the region (the test also issues jalr).

lw succeeds; sw raises a store/AMO access fault.

48 entries each

pmp_entry_count
pmp_cfg_rv64_layout
pmp_addr_registers
pmp_cfg_rv32_layout
pmp_store_fault
pmp_cfg_permissions

cp_pmpcfg_odd_rv64

Verify that the odd pmpcfg CSRs are illegal on RV64.

RV64 only. csrr and csrw each of pmpcfg1, pmpcfg3, …, pmpcfg15 from M-mode.

Illegal-instruction exception (mcause = 2) on every access.

8 CSRs × 2 operations = 16

pmp_cfg_rv64_illegal

cp_na4_boundary

Verify that an aligned doubleword that only half matches an NA4 entry fails.

RV64, PMP_NA4_SUPPORTED only. Entry i: L=1, A=NA4, XWR=111 over the lower or the upper word of an aligned doubleword. ld and sd on the doubleword.

Load or store/AMO access fault: the entry matches only some bytes of one memory operation.

2 halves × 2 accesses = 4

pmp_full_match_required
pmp_entry_priority
pmp_access_fault_exception

cp_tor_boundary

Verify that an aligned doubleword that only half matches a TOR entry fails.

RV64, G = 0, PMP_TOR_SUPPORTED only. Entry i: L=1, A=TOR, XWR=111, a 4-byte region over the lower or upper word of an aligned doubleword (entry i-1: OFF, pmpaddr(i-1) = pmpaddr(i) - 4). ld and sd on the doubleword.

Load or store/AMO access fault. (The original plan also allowed success for a split access; an aligned doubleword is one memory operation.)

2 halves × 2 accesses = 4

pmp_full_match_required
pmp_entry_priority
pmp_access_fault_exception

cp_tor_doubleregionfail

Verify that an aligned doubleword split across two TOR entries fails.

RV64, G = 0, PMP_TOR_SUPPORTED only. Entries i and i+1: XWR=111, TOR, each covering one word of an aligned doubleword (entry i-1: OFF, pmpaddr at the doubleword). ld and sd on the doubleword.

Load or store/AMO access fault: no single entry matches all bytes.

2 accesses

pmp_full_match_required
pmp_entry_priority
pmp_access_fault_exception

cp_misaligned_napot
cp_misaligned_na4
cp_misaligned_tor

Verify that a misaligned load or store that straddles a region boundary is checked byte by byte.

Standard NAPOT region, NA4 region (G = 0) or one-grain TOR region with L={0,1}, XWR=111. Misaligned lh, lhu, lw, sh, sw (+ lwu, ld, sd on RV64) at each offset straddling the start and the end of the region.

Address-misaligned exception, access fault, or success if the hart splits the access into operations that each match fully. Depends on MISALIGNED_LDST, MISALIGNED_LDST_EXCEPTION_PRIORITY and MISALIGNED_SPLIT_STRATEGY.

~(3 lw + 3 sw + 1 lh + 1 lhu + 1 sh) offsets × 2 ends × 2 L, per mode

pmp_misaligned_access_behavior
pmp_full_match_required
pmp_entry_priority
pmp_access_fault_exception

cp_misaligned_off

Verify that a misaligned access across an OFF entry’s region only sees the background entry.

Standard region with A=OFF, L={0,1}, XWR=111. The same misaligned accesses as cp_misaligned_napot.

Address-misaligned exception or success; never an access fault.

~(3 lw + 3 sw + 1 lh + 1 lhu + 1 sh) offsets × 2 ends × 2 L

pmp_a_field_off
pmp_misaligned_access_behavior

cp_misaligned_na4_wrap
cp_misaligned_tor_wrap

Verify that a doubleword that starts before and ends after a 4-byte region fails.

RV64, G = 0. A 4-byte NA4 or TOR region with L={0,1}, XWR=111. ld and sd that start 2 bytes before the region and end 2 bytes after it.

Address-misaligned exception or access fault (the entry matches only the middle bytes). Depends on MISALIGNED_LDST and MISALIGNED_LDST_EXCEPTION_PRIORITY.

2 accesses × 2 L, per mode

pmp_full_match_required
pmp_misaligned_access_behavior
pmp_entry_priority

Open item from the original plan: add mstatus.MXR to cp_cfg_R and cp_cfg_W.

Open item from the original plan: add a check of the default (background) region.

Open item from the original plan: add a check of different region types in combination.

Open item from the original plan: a misaligned instruction or data access that spans a 4 KiB page boundary and translates to two physical pages, one outside the PMP region. Belongs in PMP_Sv.

B.6.2. PMP_S Supervisor

General Test Environment (PMP_S): - Runs when S and Sm are implemented and NUM_PMP_ENTRIES > 0. The NA4, NAPOT and TOR test files also need PMP_NA4_SUPPORTED, PMP_NAPOT_SUPPORTED or PMP_TOR_SUPPORTED. - Boots to M-mode and programs the PMP there, then switches to S-mode (RVTEST_TSBI_GOTO_SMODE) for each set of probes and back to M-mode (RVTEST_TSBI_GOTO_MMODE). cp_mprv_* probes run in M-mode. - Background entry, grain, standard region, loads, stores and the fetch probe are as in PMP_Sm. - Entries under test are unlocked (L=0) unless a row says otherwise: R/W/X apply to S-mode accesses whatever L is.

Table 220. PMP_S Coverpoints
Coverpoint Goal Feature Description Expectation Bins Normative Rule

Permission bits

cp_cfg_X

Verify that X controls S-mode instruction fetch whether or not the entry is locked.

One standard NAPOT region. Walk the six legal XWR values with L=1, then again with L=0, each in its own entry as in PMP_Sm cp_cfg_X. jalr to the start of the region from S-mode.

Instruction access fault when X=0, for both L=0 and L=1.

2 L × 6 XWR = 12

pmp_l_bit_m_mode_enforcement
pmp_check_priv_modes
pmp_rwx_check
pmp_cfg_permissions
pmp_access_fault_exception
pmp_exec_fault

cp_cfg_R

Verify that R controls every S-mode load width whether or not the entry is locked.

Same walk as cp_cfg_X. Every load (lb, lbu, lh, lhu, lw (+ lwu, ld on RV64)) at the start of the region from S-mode.

Load access fault when R=0, for both L=0 and L=1.

2 L × 6 XWR × 5 loads = 60 (84 on RV64)

pmp_load_fault
pmp_check_priv_modes
pmp_rwx_check
pmp_cfg_permissions
pmp_access_fault_exception
pmp_l_bit_m_mode_enforcement

cp_cfg_W

Verify that W controls every S-mode store width whether or not the entry is locked.

Same walk as cp_cfg_X. Every store (sb, sh, sw (+ sd on RV64)) at the start of the region from S-mode.

Store/AMO access fault when W=0, for both L=0 and L=1.

2 L × 6 XWR × 3 stores = 36 (48 on RV64)

pmp_store_fault
pmp_rwx_check
pmp_cfg_permissions
pmp_access_fault_exception
pmp_check_priv_modes
pmp_l_bit_m_mode_enforcement

Address-matching modes

cp_cfg_A_off_jalr
cp_cfg_A_off_lw
cp_cfg_A_off_sw

Verify that an OFF entry does not match S-mode accesses.

Entry 0: L=0, A=OFF, XWR=000, pmpaddr0 = all ones. jalr, lw and sw in the region from S-mode.

All accesses succeed through the background entry.

1 each

pmp_a_field_off
pmp_check_priv_modes

cp_cfg_A_napot_jalr
cp_cfg_A_napot_lw
cp_cfg_A_napot_sw

Verify that XWR is enforced for S-mode across an unlocked NAPOT region and not outside it.

PMP_NAPOT_SUPPORTED only. One standard NAPOT region, six legal XWR with L=0. jalr, lw and sw at base-4, base, base+4, the highest word and just past the top, from S-mode.

Inside the region: access fault when the permission is clear. Outside: the access succeeds.

6 XWR × 5 addresses = 30 each

pmp_a_field_tor
pmp_a_field_napot_na4
pmp_napot_encoding_low_bits
pmp_check_priv_modes
pmp_rwx_check
pmp_exec_fault
pmp_load_fault
pmp_store_fault

cp_cfg_A_na4_jalr
cp_cfg_A_na4_lw
cp_cfg_A_na4_sw

Verify that XWR is enforced for S-mode on an unlocked NA4 region and not on its neighbors.

PMP_NA4_SUPPORTED only. One NA4 region, six legal XWR with L=0. jalr, lw and sw at region-4, region and region+4, from S-mode.

Access fault at the region when the permission is clear. The neighbors succeed.

6 XWR × 3 addresses = 18 each

pmp_a_field_tor
pmp_a_field_napot_na4
pmp_check_priv_modes
pmp_rwx_check
pmp_exec_fault
pmp_load_fault
pmp_store_fault

cp_cfg_A_tor_jalr
cp_cfg_A_tor_lw
cp_cfg_A_tor_sw

Verify that XWR is enforced for S-mode across an unlocked TOR region and not outside it.

PMP_TOR_SUPPORTED only. One TOR region of one grain [bottom, top) from a pair of entries, six legal XWR with L=0. jalr, lw and sw at bottom-4, bottom, top-4 and top, from S-mode.

Inside the region: access fault when the permission is clear. bottom-4 and top: the access succeeds.

6 XWR × 4 addresses = 24 each

pmp_a_field_tor
pmp_a_field_napot_na4
pmp_check_priv_modes
pmp_rwx_check
pmp_exec_fault
pmp_load_fault
pmp_store_fault

MPRV

cp_mprv_jalr
cp_mprv_lw
cp_mprv_sw

Verify that M-mode loads and stores are checked as S-mode when mstatus.MPRV=1 and MPP=S, and that fetches are not.

M-mode. Entry 0 over a standard region: L={0,1}, A=NAPOT, XWR={000, 111}. mstatus.MPP = S, MPRV = {0,1}. jalr, lw and sw in the region.

XWR=111: all succeed. XWR=000: lw and sw fault when MPRV=1 (even with L=0) or when L=1, and succeed when MPRV=0 and L=0. jalr ignores MPRV: it faults only when L=1.

2 MPRV × 2 L × 2 XWR = 8 each. MPP=M is not binned: with MPRV=1 it behaves as MPRV=0.

pmp_exec_fault
mstatus_mprv_inst_xlat_op
pmp_load_fault
pmp_l_bit_m_mode_enforcement
pmp_check_priv_modes
mstatus_mprv_ldst_op
pmp_store_fault
pmp_rwx_check

PMP CSR access

cp_pmpaddr_access_s

Verify that the pmpaddr CSRs are not accessible from S-mode.

From S-mode, write all ones to pmpaddr0-63.

Illegal-instruction exception on every write.

64 CSRs

pmp_csr_mode
pmp_addr_registers

cp_pmpcfg_access_s

Verify that the pmpcfg CSRs are not accessible from S-mode.

From S-mode, write all ones to pmpcfg0-15.

Illegal-instruction exception on every write.

16 CSRs

pmp_csr_mode

Not yet implemented in ACT4 (no coverpoint or test yet)

cp_none

Verify that a S-mode access that matches no entry fails when PMP entries are implemented.

No background entry. Program one entry that covers only the code the probes run from, then jalr, lw and sw from S-mode to an address that no entry matches. (The original plan cleared every entry, which faults on the first S-mode fetch and ends the test.)

Instruction, load or store/AMO access fault.

3 types of access

pmp_no_entry_match
pmp_check_priv_modes
pmp_access_fault_exception

B.6.3. PMP_U User

General Test Environment (PMP_U): - Runs when U and Sm are implemented and NUM_PMP_ENTRIES > 0. The NA4, NAPOT and TOR test files also need PMP_NA4_SUPPORTED, PMP_NAPOT_SUPPORTED or PMP_TOR_SUPPORTED. - Boots to M-mode and programs the PMP there, then switches to U-mode (RVTEST_TSBI_GOTO_UMODE) for each set of probes and back to M-mode (RVTEST_TSBI_GOTO_MMODE). cp_mprv_* probes run in M-mode. - Background entry, grain, standard region, loads, stores and the fetch probe are as in PMP_Sm. - Entries under test are unlocked (L=0) unless a row says otherwise: R/W/X apply to U-mode accesses whatever L is.

Table 221. PMP_U Coverpoints
Coverpoint Goal Feature Description Expectation Bins Normative Rule

Permission bits

cp_cfg_X

Verify that X controls U-mode instruction fetch whether or not the entry is locked.

One standard NAPOT region. Walk the six legal XWR values with L=1, then again with L=0, each in its own entry as in PMP_Sm cp_cfg_X. jalr to the start of the region from U-mode.

Instruction access fault when X=0, for both L=0 and L=1.

2 L × 6 XWR = 12

pmp_l_bit_m_mode_enforcement
pmp_check_priv_modes
pmp_rwx_check
pmp_cfg_permissions
pmp_access_fault_exception
pmp_exec_fault

cp_cfg_R

Verify that R controls every U-mode load width whether or not the entry is locked.

Same walk as cp_cfg_X. Every load (lb, lbu, lh, lhu, lw (+ lwu, ld on RV64)) at the start of the region from U-mode.

Load access fault when R=0, for both L=0 and L=1.

2 L × 6 XWR × 5 loads = 60 (84 on RV64)

pmp_load_fault
pmp_check_priv_modes
pmp_rwx_check
pmp_cfg_permissions
pmp_access_fault_exception
pmp_l_bit_m_mode_enforcement

cp_cfg_W

Verify that W controls every U-mode store width whether or not the entry is locked.

Same walk as cp_cfg_X. Every store (sb, sh, sw (+ sd on RV64)) at the start of the region from U-mode.

Store/AMO access fault when W=0, for both L=0 and L=1.

2 L × 6 XWR × 3 stores = 36 (48 on RV64)

pmp_store_fault
pmp_rwx_check
pmp_cfg_permissions
pmp_access_fault_exception
pmp_check_priv_modes
pmp_l_bit_m_mode_enforcement

Address-matching modes

cp_cfg_A_off_jalr
cp_cfg_A_off_lw
cp_cfg_A_off_sw

Verify that an OFF entry does not match U-mode accesses.

Entry 0: L=0, A=OFF, XWR=000, pmpaddr0 = all ones. jalr, lw and sw in the region from U-mode.

All accesses succeed through the background entry.

1 each

pmp_a_field_off
pmp_check_priv_modes

cp_cfg_A_napot_jalr
cp_cfg_A_napot_lw
cp_cfg_A_napot_sw

Verify that XWR is enforced for U-mode across an unlocked NAPOT region and not outside it.

PMP_NAPOT_SUPPORTED only. One standard NAPOT region, six legal XWR with L=0. jalr, lw and sw at base-4, base, base+4, the highest word and just past the top, from U-mode.

Inside the region: access fault when the permission is clear. Outside: the access succeeds.

6 XWR × 5 addresses = 30 each

pmp_a_field_tor
pmp_a_field_napot_na4
pmp_napot_encoding_low_bits
pmp_check_priv_modes
pmp_rwx_check
pmp_exec_fault
pmp_load_fault
pmp_store_fault

cp_cfg_A_na4_jalr
cp_cfg_A_na4_lw
cp_cfg_A_na4_sw

Verify that XWR is enforced for U-mode on an unlocked NA4 region and not on its neighbors.

PMP_NA4_SUPPORTED only. One NA4 region, six legal XWR with L=0. jalr, lw and sw at region-4, region and region+4, from U-mode.

Access fault at the region when the permission is clear. The neighbors succeed.

6 XWR × 3 addresses = 18 each

pmp_a_field_tor
pmp_a_field_napot_na4
pmp_check_priv_modes
pmp_rwx_check
pmp_exec_fault
pmp_load_fault
pmp_store_fault

cp_cfg_A_tor_jalr
cp_cfg_A_tor_lw
cp_cfg_A_tor_sw

Verify that XWR is enforced for U-mode across an unlocked TOR region and not outside it.

PMP_TOR_SUPPORTED only. One TOR region of one grain [bottom, top) from a pair of entries, six legal XWR with L=0. jalr, lw and sw at bottom-4, bottom, top-4 and top, from U-mode.

Inside the region: access fault when the permission is clear. bottom-4 and top: the access succeeds.

6 XWR × 4 addresses = 24 each

pmp_a_field_tor
pmp_a_field_napot_na4
pmp_check_priv_modes
pmp_rwx_check
pmp_exec_fault
pmp_load_fault
pmp_store_fault

MPRV

cp_mprv_jalr
cp_mprv_lw
cp_mprv_sw

Verify that M-mode loads and stores are checked as U-mode when mstatus.MPRV=1 and MPP=U, and that fetches are not.

M-mode. Entry 0 over a standard region: L={0,1}, A=NAPOT, XWR={000, 111}. mstatus.MPP = U, MPRV = {0,1}. jalr, lw and sw in the region.

XWR=111: all succeed. XWR=000: lw and sw fault when MPRV=1 (even with L=0) or when L=1, and succeed when MPRV=0 and L=0. jalr ignores MPRV: it faults only when L=1.

2 MPRV × 2 L × 2 XWR = 8 each. MPP=M is not binned: with MPRV=1 it behaves as MPRV=0.

pmp_exec_fault
mstatus_mprv_inst_xlat_op
pmp_load_fault
pmp_l_bit_m_mode_enforcement
pmp_check_priv_modes
pmp_store_fault
mstatus_mprv_ldst_op
pmp_rwx_check

PMP CSR access

cp_pmpaddr_access_u

Verify that the pmpaddr CSRs are not accessible from U-mode.

From U-mode, write all ones to pmpaddr0-63.

Illegal-instruction exception on every write.

64 CSRs

pmp_csr_mode
pmp_addr_registers

cp_pmpcfg_access_u

Verify that the pmpcfg CSRs are not accessible from U-mode.

From U-mode, write all ones to pmpcfg0-15.

Illegal-instruction exception on every write.

16 CSRs

pmp_csr_mode

Not yet implemented in ACT4 (no coverpoint or test yet)

cp_none

Verify that a U-mode access that matches no entry fails when PMP entries are implemented.

No background entry. Program one entry that covers only the code the probes run from, then jalr, lw and sw from U-mode to an address that no entry matches. (The original plan cleared every entry, which faults on the first U-mode fetch and ends the test.)

Instruction, load or store/AMO access fault.

3 types of access

pmp_no_entry_match
pmp_check_priv_modes
pmp_access_fault_exception

B.6.4. PMP_F Float

Table 222. PMP_F Coverpoints
Coverpoint Goal Feature Description Expectation Bins Normative Rule

General Test Environment (PMP_F):
- Runs when F and Sm are implemented and NUM_PMP_ENTRIES > 0. M-mode only, mstatus.FS != 0.
- Loads = flh, flw, fld. Stores = fsh, fsw, fsd. A width the hart does not implement raises an illegal-instruction exception before any PMP check; the access is still sampled.
- Standard region and L=1 XWR walk as in PMP_Sm cp_cfg_X/R/W.

cp_cfg_R

Verify that R controls floating-point loads when the entry is locked.

Six legal XWR with L=1, one entry each (as in PMP_Sm cp_cfg_R). flh, flw and fld at the start of the region.

Load access fault when R=0.

6 XWR × 3 loads = 18

pmp_load_fault
pmp_l_bit_m_mode_enforcement
pmp_cfg_permissions
pmp_rwx_check

cp_cfg_W

Verify that W controls floating-point stores when the entry is locked.

Same walk. fsh, fsw and fsd at the start of the region.

Store/AMO access fault when W=0.

6 XWR × 3 stores = 18

pmp_store_fault
pmp_l_bit_m_mode_enforcement
pmp_cfg_permissions
pmp_rwx_check

B.6.5. PMP_Zca Compressed

Table 223. PMP_Zca Coverpoints
Coverpoint Goal Feature Description Expectation Bins Normative Rule

General Test Environment (PMP_Zca):
- Runs when Zca and Sm are implemented and NUM_PMP_ENTRIES > 0. Zcb, Zcf and Zcd test files add their instructions; NA4, NAPOT and TOR rows need PMP_NA4_SUPPORTED, PMP_NAPOT_SUPPORTED or PMP_TOR_SUPPORTED. M-mode only.
- Loads = c.lw, c.lwsp (+ c.ld, c.ldsp on RV64; c.flw, c.flwsp with Zcf on RV32; c.fld, c.fldsp with Zcd; c.lbu, c.lh, c.lhu with Zcb).
- Stores = c.sw, c.swsp (+ c.sd, c.sdsp on RV64; c.fsw, c.fswsp with Zcf on RV32; c.fsd, c.fsdsp with Zcd; c.sb, c.sh with Zcb).
- Fetch rows jump with c.jalr to a target that holds a 32-bit ret (jalr x0, 0(ra)) or a 16-bit c.ret. c.jr, c.j and c.jal are not tested; their 32-bit forms are covered in PMP_Sm.
- Standard region and L=1 XWR walk as in PMP_Sm cp_cfg_X/R/W.

Compressed loads and stores

cp_cfg_R

Verify that R controls every compressed load when the entry is locked.

Six legal XWR with L=1, one entry each. Every compressed load at the start of the region.

Load access fault when R=0.

6 XWR × compressed loads. c.lwsp and c.ldsp are ignored in the cross.

pmp_load_fault
pmp_cfg_permissions
pmp_rwx_check
pmp_l_bit_m_mode_enforcement

cp_cfg_W

Verify that W controls every compressed store when the entry is locked.

Same walk. Every compressed store at the start of the region.

Store/AMO access fault when W=0.

6 XWR × compressed stores

pmp_store_fault
pmp_cfg_permissions
pmp_rwx_check
pmp_l_bit_m_mode_enforcement

32-bit fetch across a region boundary (IALIGN = 16)

cp_misaligned_napot

Verify that a 32-bit instruction straddling two NAPOT regions must be fully matched.

PMP_NAPOT_SUPPORTED only. Three consecutive standard NAPOT regions A, B, C in entries 0-2, all L=1, XWR = 111, 111, 000. A 32-bit ret inside A, inside B, straddling A|B and straddling B|C. c.jalr to each.

Inside a region: executes. A|B: instruction access fault, or executes if the hart splits the fetch into parcels that each match fully. B|C: instruction access fault (C has X=0). On a fault mepc holds the instruction address and a nonzero mtval holds the address of the faulting portion.

4 addresses

pmp_exec_fault
pmp_entry_priority
pmp_full_match_required
pmp_misaligned_access_behavior
mtval_varlen_wr
mepc_varlen_wr
Zca_align16
pmp_access_fault_exception

cp_misaligned_tor

Verify that a 32-bit instruction straddling two TOR regions must be fully matched.

PMP_TOR_SUPPORTED only. Three consecutive one-grain TOR regions in entries 1-3 (entry 0 is OFF and holds the bottom), all L=1, XWR = 111, 111, 000. Same four ret positions as cp_misaligned_napot.

As for cp_misaligned_napot.

4 addresses

pmp_exec_fault
pmp_entry_priority
pmp_full_match_required
pmp_misaligned_access_behavior
mtval_varlen_wr
mepc_varlen_wr
Zca_align16
pmp_access_fault_exception

cp_misaligned_na4

Verify that a 32-bit instruction straddling two NA4 regions must be fully matched.

PMP_NA4_SUPPORTED only (G = 0). Three consecutive NA4 regions in entries 0-2, all L=1, XWR = 111, 111, 000. A 32-bit ret straddling the first and second, and the second and third regions. c.jalr to each.

First|second: instruction access fault, or executes if split. Second|third: instruction access fault.

2 addresses

pmp_exec_fault
pmp_entry_priority
pmp_full_match_required
pmp_misaligned_access_behavior
mtval_varlen_wr
mepc_varlen_wr
pmp_access_fault_exception
Zca_align16

cp_misaligned_off

Verify that a 32-bit instruction straddling OFF entries' regions only sees the background entry.

Three consecutive regions in entries 0-2, all L=1, A=OFF, XWR=111. Same four ret positions as cp_misaligned_napot.

All execute: the background entry matches every byte.

4 addresses

pmp_a_field_off
pmp_misaligned_access_behavior

16-bit fetch at a region boundary

cp_cret_napot

Verify that 16-bit instructions at the edges of a NAPOT region execute.

PMP_NAPOT_SUPPORTED only. One standard NAPOT region in entry 0, L=1, XWR=111. c.ret 2 bytes below the region, at its base, 2 bytes below its top, and at its top. c.jalr to each.

All execute: each 16-bit fetch lies wholly inside the region or wholly in the background.

4 addresses

pmp_full_match_required
pmp_entry_priority
Zca_align16

cp_cret_tor

Verify that 16-bit instructions at the edges of a TOR region execute.

PMP_TOR_SUPPORTED only. One one-grain TOR region in entry 1 (bottom in pmpaddr0), L=1, XWR=111. c.ret at the same four positions as cp_cret_napot.

All execute.

4 addresses

pmp_full_match_required
pmp_entry_priority
Zca_align16

cp_cret_na4

Verify that 16-bit instructions at the edges of an NA4 region execute.

PMP_NA4_SUPPORTED only. One NA4 region in entry 0, L=1, XWR=111. c.ret at region-2, region, region+2 and region+4.

All execute.

4 addresses

pmp_full_match_required
pmp_entry_priority
Zca_align16

B.6.6. PMP_Zicbo CBOM/CBOZ

Table 224. PMP_Zicbo Coverpoints
Coverpoint Goal Feature Description Expectation Bins Normative Rule

General Test Environment (PMP_Zicbo):
- Runs when Sm and NUM_PMP_ENTRIES > 0, with Zicbom and Zicboz for the cbo rows and Zicbop for the prefetch rows. M-mode only.
- menvcfg.CBIE = 11, CBCFE = 1, CBZE = 1.
- The region under test is a 4 KiB-aligned NAPOT region much larger than a cache block, so every byte of the block has the same permissions. Misaligned or partially covered cache blocks are not tested: their behavior is unspecified (pmp_same).

cp_cbo_zero

Verify that cbo.zero needs W.

Entry 0 over the region: L=1, XWR = 000, 001, 011. cbo.zero at the start of the region.

Store/AMO access fault (mcause = 7, mtval = rs1) when W=0. Otherwise the block is zeroed.

3 XWR

pmp_store_fault
cbz_unperm_fault
cbz_access
fault_excep_csr

cp_cbo_clean
cp_cbo_flush
cp_cbo_inval

Verify that a cache-block management instruction needs R or W.

Same setup. cbo.clean, cbo.flush and cbo.inval at the start of the region.

XWR=000: store/AMO access fault (mtval = rs1). XWR = 001 or 011: no exception.

3 XWR each

cbm_unperm_fault
pmp_cbm_fault
cbm_access
fault_excep_csr

cp_prefetch_i
cp_prefetch_r
cp_prefetch_w

Verify that prefetches never trap on a PMP violation.

Six legal XWR with L=1, one entry each. prefetch.i, prefetch.r and prefetch.w at the start of the region.

No exception for any XWR.

6 XWR each

cbp_unperm_noexcep

B.6.7. PMP_Zaamo AMO

Table 225. PMP_Zaamo Coverpoints
Coverpoint Goal Feature Description Expectation Bins Normative Rule

General Test Environment (PMP_Zaamo):
- Runs when Zaamo and Sm are implemented and NUM_PMP_ENTRIES > 0. M-mode only.
- AMOs = amoswap, amoadd, amoxor, amoand, amoor, amomin, amomax, amominu, amomaxu (.w; also .d on RV64).
- rd is checked after every AMO, and a later AMO’s return value shows whether a faulting AMO wrote memory.
- Standard region and L=1 XWR walk as in PMP_Sm cp_cfg_X/R/W.

cp_cfg_RW

Verify that an AMO needs both R and W, and otherwise raises a store/AMO access fault without side effects.

Six legal XWR with L=1, one entry each. Every AMO with rs1 at the start of the region.

XWR = 011 or 111: the AMO completes. Otherwise: store/AMO access fault (mcause = 7); rd and memory are unchanged.

6 XWR × 9 AMOs = 54 (108 on RV64)

pmp_store_fault
pmp_l_bit_m_mode_enforcement
pmp_violation_precise_trap
mcause_exccode_st_sc_amo
pmp_cfg_permissions
pmp_rwx_check

B.6.8. PMP_Zalrsc LR/SC

Table 226. PMP_Zalrsc Coverpoints
Coverpoint Goal Feature Description Expectation Bins Normative Rule

General Test Environment (PMP_Zalrsc):
- Runs when Zalrsc and Sm are implemented and NUM_PMP_ENTRIES > 0. M-mode only.
- lr.w, sc.w (also lr.d, sc.d on RV64). Each lr is followed by an sc to the same address; when W=1 the pair retries in a constrained LR/SC loop until the sc succeeds.
- Standard region and L=1 XWR walk as in PMP_Sm cp_cfg_X/R/W.

cp_cfg_RW

Verify that LR needs R and SC needs W.

Six legal XWR with L=1, one entry each. lr then sc at the start of the region. When R=0 the lr faults, so the sc runs without a reservation.

lr: load access fault (mcause = 5) when R=0. sc: store/AMO access fault (mcause = 7) when W=0, with or without a reservation; otherwise the sc stores.

6 XWR × 2 instructions = 12 (24 on RV64)

pmp_load_fault
pmp_store_fault
sc_retire_permission
mcause_exccode_ld_ldrsv
mcause_exccode_st_sc_amo
pmp_cfg_permissions
pmp_l_bit_m_mode_enforcement

B.6.9. PMP_Sv Virtual Memory

Table 227. PMP_Sv Coverpoints
Coverpoint Goal Feature Description Expectation Bins ID Normative Rule

General Test Environment (PMP_Sv):
- Boots to M-mode (legacy mode hops) because each test programs PMP entries, which are M-mode CSRs. Unchanged by the T-SBI conversion. Run for every supported translation mode: Sv32 on RV32; Sv39, Sv48 and Sv57 on RV64, as selected by the UDB configuration.

mode

Verify each supported translation mode is exercised with PMP

Sampled while the PMP_Sv tests run under satp.MODE = Sv32, Sv39, Sv48 or Sv57.

Every supported mode is observed.

mode {sv57, sv48, sv39, sv32}
= 3 bins on RV64, 1 on RV32

pmp0_pte_noread_s

Verify PMP applies to the implicit page-table read of a load from S-mode

S-mode: PMP entry 0 (NAPOT) covers the page table used by the walk, at each level, with R=0; the background PMP region allows everything else. Load (lw) from the page through va_data.

Load access fault (mcause = 5); mtval = faulting virtual address.

PageType_d x PMP0_PTE x load_acc_fault x lw x mode {S-mode}
= 7 bins on RV64, 2 on RV32

pmp_check_pagetable_access pmp_with_paging pmp_sfence_required

pmp_check_pagetable_access
pmp_with_paging
pmp_sfence_required

pmp0_pte_noread_u

Verify PMP applies to the implicit page-table read of a load from U-mode

U-mode: PMP entry 0 (NAPOT) covers the page table used by the walk, at each level, with R=0; the background PMP region allows everything else. Load (lw) from the page through va_data.

Load access fault (mcause = 5); mtval = faulting virtual address.

PageType_d x PMP0_PTE x load_acc_fault x lw x mode {U-mode}
= 7 bins on RV64, 2 on RV32

pmp_check_pagetable_access pmp_with_paging pmp_sfence_required

pmp_check_pagetable_access
pmp_with_paging
pmp_sfence_required

pmp0_pte_nowrite_s

Verify PMP applies to the implicit page-table read of a store from S-mode

S-mode: PMP entry 0 (NAPOT) covers the page table used by the walk, at each level, with R=0; the background PMP region allows everything else. Store (sw) to the page through va_data.

Store/AMO access fault (mcause = 7); mtval = faulting virtual address.

PageType_d x PMP0_PTE x store_acc_fault x sw x mode {S-mode}
= 7 bins on RV64, 2 on RV32

pmp_check_pagetable_access pmp_with_paging pmp_sfence_required

pmp_check_pagetable_access
pmp_with_paging
pmp_sfence_required

pmp0_pte_nowrite_u

Verify PMP applies to the implicit page-table read of a store from U-mode

U-mode: PMP entry 0 (NAPOT) covers the page table used by the walk, at each level, with R=0; the background PMP region allows everything else. Store (sw) to the page through va_data.

Store/AMO access fault (mcause = 7); mtval = faulting virtual address.

PageType_d x PMP0_PTE x store_acc_fault x sw x mode {U-mode}
= 7 bins on RV64, 2 on RV32

pmp_check_pagetable_access pmp_with_paging pmp_sfence_required

pmp_check_pagetable_access
pmp_with_paging
pmp_sfence_required

pmp0_pte_noexec_s

Verify PMP applies to the implicit page-table read of an instruction fetch from S-mode

S-mode: PMP entry 0 (NAPOT) covers the page table used by the walk, at each level, with R=0; the background PMP region allows everything else. Jump (jalr) into the page through va_data.

Instruction access fault (mcause = 1); mtval = faulting virtual address.

PageType_i x PMP0_PTE x ins_acc_fault x jalr x mode {S-mode}
= 7 bins on RV64, 2 on RV32

pmp_check_pagetable_access pmp_with_paging pmp_sfence_required

pmp_check_pagetable_access
pmp_with_paging
pmp_sfence_required

pmp0_pte_noexec_u

Verify PMP applies to the implicit page-table read of an instruction fetch from U-mode

U-mode: PMP entry 0 (NAPOT) covers the page table used by the walk, at each level, with R=0; the background PMP region allows everything else. Jump (jalr) into the page through va_data.

Instruction access fault (mcause = 1); mtval = faulting virtual address.

PageType_i x PMP0_PTE x ins_acc_fault x jalr x mode {U-mode}
= 7 bins on RV64, 2 on RV32

pmp_check_pagetable_access pmp_with_paging pmp_sfence_required

pmp_check_pagetable_access
pmp_with_paging
pmp_sfence_required

pmp0_PA_noread_s

Verify PMP applies to the translated physical address of a load from S-mode

S-mode: valid leaf PTE with PTE.U=0 at every page-table level (4 KiB page and each superpage size of the Sv mode); PMP entry 0 removes R from the translated physical page. Load (lw) from the page through va_data.

Load access fault (mcause = 5); mtval = faulting virtual address.

PTE_d x PageType_d x PMP0_PA x load_acc_fault x read_acc x mode {S-mode}
= 7 bins on RV64, 2 on RV32

mtval_vaddr_not_paddr

mtval_vaddr_not_paddr

pmp0_PA_noread_u

Verify PMP applies to the translated physical address of a load from U-mode

U-mode: valid leaf PTE with PTE.U=1 at every page-table level (4 KiB page and each superpage size of the Sv mode); PMP entry 0 removes R from the translated physical page. Load (lw) from the page through va_data.

Load access fault (mcause = 5); mtval = faulting virtual address.

PTE_d x PageType_d x PMP0_PA x load_acc_fault x read_acc x mode {U-mode}
= 7 bins on RV64, 2 on RV32

mtval_vaddr_not_paddr

mtval_vaddr_not_paddr

pmp0_PA_nowrite_s

Verify PMP applies to the translated physical address of a store from S-mode

S-mode: valid leaf PTE with PTE.U=0 at every page-table level (4 KiB page and each superpage size of the Sv mode); PMP entry 0 removes W from the translated physical page. Store (sw) to the page through va_data.

Store/AMO access fault (mcause = 7); mtval = faulting virtual address.

PTE_d x PageType_d x PMP0_PA x store_acc_fault x write_acc x mode {S-mode}
= 7 bins on RV64, 2 on RV32

mtval_vaddr_not_paddr

mtval_vaddr_not_paddr

pmp0_PA_nowrite_u

Verify PMP applies to the translated physical address of a store from U-mode

U-mode: valid leaf PTE with PTE.U=1 at every page-table level (4 KiB page and each superpage size of the Sv mode); PMP entry 0 removes W from the translated physical page. Store (sw) to the page through va_data.

Store/AMO access fault (mcause = 7); mtval = faulting virtual address.

PTE_d x PageType_d x PMP0_PA x store_acc_fault x write_acc x mode {U-mode}
= 7 bins on RV64, 2 on RV32

mtval_vaddr_not_paddr

mtval_vaddr_not_paddr

pmp0_PA_noexec_s

Verify PMP applies to the translated physical address of an instruction fetch from S-mode

S-mode: valid leaf PTE with PTE.U=0 at every page-table level (4 KiB page and each superpage size of the Sv mode); PMP entry 0 removes X from the translated physical page. Jump (jalr) into the page through va_data.

Instruction access fault (mcause = 1); mtval = faulting virtual address.

PTE_i x PageType_i x PMP0_PA x ins_acc_fault x exec_acc x mode {S-mode}
= 7 bins on RV64, 2 on RV32

mtval_vaddr_not_paddr

mtval_vaddr_not_paddr

pmp0_PA_noexec_u

Verify PMP applies to the translated physical address of an instruction fetch from U-mode

U-mode: valid leaf PTE with PTE.U=1 at every page-table level (4 KiB page and each superpage size of the Sv mode); PMP entry 0 removes X from the translated physical page. Jump (jalr) into the page through va_data.

Instruction access fault (mcause = 1); mtval = faulting virtual address.

PTE_i x PageType_i x PMP0_PA x ins_acc_fault x exec_acc x mode {U-mode}
= 7 bins on RV64, 2 on RV32

mtval_vaddr_not_paddr

mtval_vaddr_not_paddr

B.6.10. PMP_SvZicbo Virtual Memory + CBOM/CBOZ

Table 228. PMP_SvZicbo Coverpoints
Coverpoint Goal Feature Description Expectation Bins ID Normative Rule

General Test Environment (PMP_SvZicbo):
- Boots to M-mode (PMP programming). Unchanged by the T-SBI conversion. Run for every supported translation mode: Sv32 on RV32; Sv39, Sv48 and Sv57 on RV64, as selected by the UDB configuration.

cp_PA_PMP_rw_unset_cbo_s

Verify PMP applies to CBOs on the translated physical address from S-mode

S-mode: valid leaf PTE with PTE.U=0 at every page-table level (4 KiB page and each superpage size of the Sv mode); PMP entry 0 removes R and W from the translated physical page. Execute Zicbom (cbo.clean/flush/inval) or Zicboz (cbo.zero) on va_data.

Store/AMO access fault (mcause = 7).

PTE_s x PageType_d x PMP_perm x cbo_ins x store_acc_fault x mode {S-mode}
= 14 bins on RV64, 4 on RV32

cbm_unperm_fault cbz_unperm_fault

cbm_unperm_fault
cbz_unperm_fault
fault_excep_csr

cp_PA_PMP_rw_unset_cbo_u

Verify PMP applies to CBOs on the translated physical address from U-mode

U-mode: valid leaf PTE with PTE.U=1 at every page-table level (4 KiB page and each superpage size of the Sv mode); PMP entry 0 removes R and W from the translated physical page. Execute Zicbom (cbo.clean/flush/inval) or Zicboz (cbo.zero) on va_data.

Store/AMO access fault (mcause = 7).

PTE_u x PageType_d x PMP_perm x cbo_ins x store_acc_fault x mode {U-mode}
= 14 bins on RV64, 4 on RV32

cbm_unperm_fault cbz_unperm_fault

cbm_unperm_fault
cbz_unperm_fault
fault_excep_csr

cp_PTE_PMP_rw_unset_cbo_s

Verify PMP applies to the page-table read made by a CBO from S-mode

S-mode: PMP entry 0 removes R from the page table used by the walk, at each level. Execute Zicbom or Zicboz on va_data.

Store/AMO access fault (mcause = 7).

PTE_s x PageType_d x PMP_perm x cbo_ins x store_acc_fault x mode {S-mode}
= 14 bins on RV64, 4 on RV32

cbp_unperm_translate pmp_check_pagetable_access

pmp_check_pagetable_access
pmp_with_paging
cbp_unperm_translate

cp_PTE_PMP_rw_unset_cbo_u

Verify PMP applies to the page-table read made by a CBO from U-mode

U-mode: PMP entry 0 removes R from the page table used by the walk, at each level. Execute Zicbom or Zicboz on va_data.

Store/AMO access fault (mcause = 7).

PTE_u x PageType_d x PMP_perm x cbo_ins x store_acc_fault x mode {U-mode}
= 14 bins on RV64, 4 on RV32

cbp_unperm_translate pmp_check_pagetable_access

pmp_check_pagetable_access
pmp_with_paging
cbp_unperm_translate

B.6.11. PMP_HSvZicbo Hypervisor Virtual Memory + CBOM/CBOZ

PMP_HSvZicbo boots to M-mode, which programs PMP, and delegates nothing, so every trap is taken in M-mode. It runs with Sv39x4 and VS-stage Sv39 on RV64, or Sv32x4 and VS-stage Sv32 on RV32, and needs at least two PMP entries, NAPOT support and a PMP granularity of at most 4 KiB. PMP entry 0 is a NAPOT region covering the 4 KiB test page; the last entry is the background region. The guest translation and other CBO cases are in the Sv suite’s Sv_HZicbo group.

Table 229. PMP_HSvZicbo Coverpoints
Coverpoint Goal Feature Description Expectation Bins Normative Rule Notes

cp_pmp

PMP checks the final supervisor physical address of a CBO from VS-mode and VU-mode

Environment: VS-stage and G-stage translation are valid and permit the access. PMP entry 0 covers the test page with XWR = 000, then with XWR = 001 (read only).
Test Case: In VS-mode and VU-mode, execute cbo.clean, cbo.flush and cbo.inval (Zicbom) or cbo.zero (Zicboz) on a guest virtual address that a VS-stage kilopage maps (through a G-stage identity mapping), and on one that a G-stage kilopage maps (through a VS-stage identity superpage).

XWR = 000: store/AMO access fault (mcause = 7) for every CBO.
XWR = 001: cbo.clean, cbo.flush and cbo.inval execute without fault, since a cache-block management instruction needs only read or write permission; cbo.zero raises a store/AMO access fault.

{VS, VU} x {cbo.clean, cbo.flush, cbo.inval, cbo.zero} x {VS-stage page, G-stage page} x pmpcfg0 XWR {000, 001}
cbo.clean/flush/inval only with Zicbom, cbo.zero only with Zicboz

pmp_store_fault
pmp_cbm_fault
H_pmp

XWR = 001 follows cmo.adoc cbm_access (a cache-block management instruction may access a block whenever a load or a store may), as Sail and Spike do; machine.adoc pmp_cbm_fault defers to it.

B.6.12. PMP_Svadu Page Table Update

Table 230. PMP_Svadu Coverpoints
Coverpoint Goal Feature Description Expectation Bins ID Normative Rule

General Test Environment (PMP_Svadu):
- Boots to M-mode (PMP programming). Unchanged by the T-SBI conversion. Run for every supported translation mode: Sv32 on RV32; Sv39, Sv48 and Sv57 on RV64, as selected by the UDB configuration.

Abit_unset_pmpW_unset_exec_s

Verify PMP applies to the hardware PTE.A update of an instruction fetch from S-mode

S-mode: menvcfg.ADUE=1; page tables in a PMP region with W=0; leaf PTE with A=0 and PTE.U=0; satp points at each top-level table in turn. Jump (jalr) into the page through va_data.

Instruction access fault (mcause = 1) from the implicit PTE write.

PTE_Abit_unset_s_i x PageType_i x Svadu_enabled x PMP_pagetable x jalr x ins_acc_fault x mode {S-mode}
= 7 bins on RV64, 2 on RV32

Svadu_hw_update_a_d_bits pmp_check_pagetable_access

pmp_check_pagetable_access
Svadu_hw_update_a_d_bits

Abit_unset_pmpW_unset_exec_u

Verify PMP applies to the hardware PTE.A update of an instruction fetch from U-mode

U-mode: menvcfg.ADUE=1; page tables in a PMP region with W=0; leaf PTE with A=0 and PTE.U=1; satp points at each top-level table in turn. Jump (jalr) into the page through va_data.

Instruction access fault (mcause = 1) from the implicit PTE write.

PTE_Abit_unset_u_i x PageType_i x Svadu_enabled x PMP_pagetable x jalr x ins_acc_fault x mode {U-mode}
= 7 bins on RV64, 2 on RV32

Svadu_hw_update_a_d_bits pmp_check_pagetable_access

Svadu_hw_update_a_d_bits
pmp_check_pagetable_access

Abit_unset_pmpW_unset_read_s

Verify PMP applies to the hardware PTE.A update of a load from S-mode

S-mode: menvcfg.ADUE=1; page tables in a PMP region with W=0; leaf PTE with A=0 and PTE.U=0; satp points at each top-level table in turn. Load (lw) from the page through va_data.

Load access fault (mcause = 5) from the implicit PTE write.

PTE_Abit_unset_s_d x PageType_d x Svadu_enabled x PMP_pagetable x lw x load_acc_fault x mode {S-mode}
= 7 bins on RV64, 2 on RV32

Svadu_hw_update_a_d_bits pmp_check_pagetable_access

pmp_check_pagetable_access
Svadu_hw_update_a_d_bits

Abit_unset_pmpW_unset_read_u

Verify PMP applies to the hardware PTE.A update of a load from U-mode

U-mode: menvcfg.ADUE=1; page tables in a PMP region with W=0; leaf PTE with A=0 and PTE.U=1; satp points at each top-level table in turn. Load (lw) from the page through va_data.

Load access fault (mcause = 5) from the implicit PTE write.

PTE_Abit_unset_u_d x PageType_d x Svadu_enabled x PMP_pagetable x lw x load_acc_fault x mode {U-mode}
= 7 bins on RV64, 2 on RV32

Svadu_hw_update_a_d_bits pmp_check_pagetable_access

Svadu_hw_update_a_d_bits
pmp_check_pagetable_access

Abit_unset_pmpW_unset_write_s

Verify PMP applies to the hardware PTE.A update of a store from S-mode

S-mode: menvcfg.ADUE=1; page tables in a PMP region with W=0; leaf PTE with A=0 and PTE.U=0; satp points at each top-level table in turn. Store (sw) to the page through va_data.

Store/AMO access fault (mcause = 7) from the implicit PTE write.

PTE_Abit_unset_s_d x PageType_d x Svadu_enabled x PMP_pagetable x sw x store_acc_fault x mode {S-mode}
= 7 bins on RV64, 2 on RV32

Svadu_hw_update_a_d_bits pmp_check_pagetable_access

Svadu_hw_update_a_d_bits
pmp_check_pagetable_access

Abit_unset_pmpW_unset_write_u

Verify PMP applies to the hardware PTE.A update of a store from U-mode

U-mode: menvcfg.ADUE=1; page tables in a PMP region with W=0; leaf PTE with A=0 and PTE.U=1; satp points at each top-level table in turn. Store (sw) to the page through va_data.

Store/AMO access fault (mcause = 7) from the implicit PTE write.

PTE_Abit_unset_u_d x PageType_d x Svadu_enabled x PMP_pagetable x sw x store_acc_fault x mode {U-mode}
= 7 bins on RV64, 2 on RV32

Svadu_hw_update_a_d_bits pmp_check_pagetable_access

pmp_check_pagetable_access
Svadu_hw_update_a_d_bits

Dbit_unset_pmpW_unset_write_s

Verify PMP applies to the hardware PTE.D update of a store from S-mode

S-mode: menvcfg.ADUE=1; page tables in a PMP region with W=0; leaf PTE with A=1, D=0 and PTE.U=0. Store (sw) through va_data.

Store/AMO access fault (mcause = 7) from the implicit PTE write.

PTE_Dbit_unset_s_d x PageType_d x Svadu_enabled x PMP_pagetable x sw x store_acc_fault x mode {S-mode}
= 7 bins on RV64, 2 on RV32

Svadu_hw_update_a_d_bits pmp_check_pagetable_access

pmp_check_pagetable_access
Svadu_hw_update_a_d_bits

Dbit_unset_pmpW_unset_write_u

Verify PMP applies to the hardware PTE.D update of a store from U-mode

U-mode: menvcfg.ADUE=1; page tables in a PMP region with W=0; leaf PTE with A=1, D=0 and PTE.U=1. Store (sw) through va_data.

Store/AMO access fault (mcause = 7) from the implicit PTE write.

PTE_Dbit_unset_u_d x PageType_d x Svadu_enabled x PMP_pagetable x sw x store_acc_fault x mode {U-mode}
= 7 bins on RV64, 2 on RV32

Svadu_hw_update_a_d_bits pmp_check_pagetable_access

Svadu_hw_update_a_d_bits
pmp_check_pagetable_access

B.6.13. PMP Normative Rules

Table 231. PMP Normative Rules
Normative Rule Rule Text Coverpoints

pmp_load_fault

Attempting to execute a load or load-reserved instruction that accesses a physical address within a PMP region without read permissions raises a load access-fault exception.

PMP_F_cg/cp_cfg_R, PMP_S_cg/{cp_cfg_R, cp_mprv_lw}, PMP_Sm_cg/cp_cfg_R, PMP_Zalrsc_cg/cp_cfg_RW, PMP_F_cg/cp_cfg_R, PMP_Zca_cg/cp_cfg_R, PMP_U_cg/{cp_cfg_R, cp_mprv_lw}, PMP_Zalrsc_cg/cp_cfg_RW, PMP_Zca_cg/cp_cfg_R

pmp_store_fault

Attempting to execute a store, store-conditional, AMO, or cache-block zero instruction that accesses a physical address within a PMP region without write permissions raises a store access-fault exception.

PMP_F_cg/cp_cfg_W, PMP_S_cg/{cp_cfg_W, cp_mprv_sw}, PMP_Sm_cg/cp_cfg_W, PMP_Zalrsc_cg/cp_cfg_RW, PMP_Zaamo_cg/cp_cfg_RW, PMP_Zicbo_cg/cp_cbo_zero, PMP_U_cg/{cp_cfg_W, cp_mprv_sw}, PMP_Zaamo_cg/cp_cfg_RW, PMP_Zalrsc_cg/cp_cfg_RW, PMP_Zca_cg/cp_cfg_W, PMP_HSvZicbo_cg/cp_pmp, PMP_Zicbo_cg/cp_cbo_zero

pmp_l_bit_m_mode_enforcement

In addition to locking the PMP entry, the L bit indicates whether the R/W/X permissions are additionally enforced on M-mode accesses. When the L bit is set, these permissions are enforced for all privilege modes. When the L bit is clear, any M-mode access matching the PMP entry will succeed; the R/W/X permissions apply only to S and U modes.

PMP_F_cg/{cp_cfg_R, cp_cfg_W}, PMP_S_cg/{cp_cfg_X, cp_mprv_lw, cp_mprv_sw}, PMP_Sm_cg/{cp_cfg_X0_all, cp_cfg_L_access_exec, cp_cfg_L_access_read, cp_cfg_L_access_write}, PMP_U_cg/{cp_cfg_X, cp_mprv_lw, cp_mprv_sw}, PMP_Zaamo_cg/cp_cfg_RW

pmp_check_priv_modes

PMP checks are applied to all accesses whose effective privilege mode is S or U, including instruction fetches and data accesses in S and U mode, and data accesses in M-mode when the MPRV bit in mstatus is set and the MPP field in mstatus contains S or U.

PMP_S_cg/{cp_cfg_X, cp_cfg_R, cp_mprv_lw, cp_mprv_sw}, PMP_U_cg/{cp_cfg_X, cp_cfg_R, cp_mprv_lw, cp_mprv_sw}

pmp_csr_mode

PMP CSRs are only accessible to M-mode.

PMP_S_cg/{cp_pmpaddr_access_s, cp_pmpcfg_access_s}, PMP_U_cg/{cp_pmpaddr_access_u, cp_pmpcfg_access_u}

pmp_addr_registers

The PMP address registers are CSRs named pmpaddr0-pmpaddr63.

PMP_S_cg/cp_pmpaddr_access_s, PMP_Sm_cg/{cp_pmpaddr_upper_zero, cp_grain_check_write}, PMP_U_cg/cp_pmpaddr_access_u

pmp_rwx_check

If a PMP entry matches all bytes of a memory operation, then the L, R, W, and X bits determine whether the operation succeeds or fails. If the L bit is clear and the privilege mode of the access is M, the operation succeeds. Otherwise, if the L bit is set or the privilege mode of the access is S or U, then the operation succeeds only if the R, W, or X bit corresponding to the access type is set.

PMP_S_cg/{cp_cfg_X, cp_cfg_R, cp_cfg_W}, PMP_Sm_cg/{cp_cfg_X, cp_cfg_R, cp_cfg_W, cp_cfg_L_access_read}, PMP_U_cg/{cp_cfg_X, cp_cfg_R, cp_cfg_W}

pmp_cfg_permissions

pmpcfg shows the layout of a PMP configuration register. The R, W, and X bits, when set, indicate that the PMP entry permits read, write, and instruction execution, respectively. When one of these bits is clear, the corresponding access type is denied.

PMP_S_cg/{cp_cfg_X, cp_cfg_R, cp_cfg_W}, PMP_Sm_cg/{cp_cfg_X, cp_cfg_R, cp_cfg_W, cp_cfg_X1_all}, PMP_U_cg/{cp_cfg_X, cp_cfg_R, cp_cfg_W}, PMP_Zca_cg/{cp_cfg_R, cp_cfg_W}

pmp_access_fault_exception

Failed memory operations generate an instruction, load, or store access-fault exception.

PMP_S_cg/{cp_cfg_X, cp_cfg_R, cp_cfg_W}, PMP_Sm_cg/{cp_cfg_X, cp_cfg_R, cp_cfg_W, cp_cfg_A_napot_all}, PMP_U_cg/{cp_cfg_X, cp_cfg_R, cp_cfg_W}

pmp_exec_fault

Attempting to fetch an instruction from a PMP region that does not have execute permissions raises an instruction access-fault exception.

PMP_S_cg/{cp_cfg_X, cp_mprv_jalr}, PMP_Sm_cg/{cp_cfg_X, cp_cfg_X0_all, cp_cfg_A_napot_x, cp_cfg_A_tor_x}, PMP_U_cg/{cp_cfg_X, cp_mprv_jalr}, PMP_Zca_cg/{cp_misaligned_napot, cp_misaligned_tor, cp_misaligned_na4}

pmp_a_field_off

When A=0, this PMP entry is disabled and matches no addresses.

PMP_S_cg/{cp_cfg_A_off_jalr, cp_cfg_A_off_lw, cp_cfg_A_off_sw}, PMP_Sm_cg/{cp_cfg_A_OFF_all_read, cp_cfg_A_OFF_all_write, cp_cfg_A_OFF_all_exec, cp_priority_off_lw}, PMP_U_cg/{cp_cfg_A_off_jalr, cp_cfg_A_off_lw, cp_cfg_A_off_sw}, PMP_Zca_cg/cp_misaligned_off

pmp_a_field_tor

If TOR is selected, the associated address register forms the top of the address range, and the preceding PMP address register forms the bottom of the address range. If PMP entry i’s A field is set to TOR, the entry matches any address y such that pmpaddri-1≤y<pmpaddri (irrespective of the value of pmpcfgi-1). If PMP entry 0’s A field is set to TOR, zero is used for the lower bound, and so it matches any address y<pmpaddr0.

PMP_S_cg/{cp_cfg_A_tor_lw, cp_cfg_A_na4_lw, cp_cfg_A_napot_lw}, PMP_Sm_cg/{cp_cfg_A_tor_r, cp_cfg_A_tor0_r, cp_cfg_A_tor_bot_L1_r, cp_cfg_A_tor_nonoverlap2_r}, PMP_U_cg/{cp_cfg_A_tor_lw, cp_cfg_A_na4_lw, cp_cfg_A_napot_lw}

pmp_a_field_napot_na4

naturally aligned power-of-2 regions (NAPOT), including the special case of naturally aligned four-byte regions (NA4);

PMP_S_cg/{cp_cfg_A_tor_lw, cp_cfg_A_na4_lw, cp_cfg_A_napot_lw}, PMP_Sm_cg/{cp_cfg_A_napot_all, cp_cfg_A_napot_r, cp_cfg_A_NA4_all, cp_cfg_A_na4_r}, PMP_U_cg/{cp_cfg_A_tor_lw, cp_cfg_A_na4_lw, cp_cfg_A_napot_lw}

pmp_l_bit_function

The L bit indicates that the PMP entry is locked, i.e., writes to the configuration register and associated address registers are ignored.

PMP_Sm_cg/cp_cfg_L_modify

pmp_mmode_locking

Optionally, PMP checks may additionally apply to M-mode accesses, in which case the PMP registers themselves are locked, so that even M-mode software cannot change them until the hart is reset.

PMP_Sm_cg/{cp_cfg_L_modify, cp_cfg_X, cp_cfg_R, cp_cfg_W}

pmp_l_bit_write_protection

If PMP entry i is locked, writes to pmpicfg and pmpaddri are ignored. Additionally, if PMP entry i is locked and pmpicfg.A is set to TOR, writes to pmpaddri-1 are ignored.

PMP_Sm_cg/cp_cfg_L_modify

pmp_locked_until_reset

Locked PMP entries remain locked until the hart is reset.

PMP_Sm_cg/cp_cfg_L_modify

pmp_na4_select_restriction

When G ≥ 1, the NA4 mode is not selectable.

PMP_Sm_cg/{cp_cfg_A_all_even, cp_cfg_A_all_odd}

pmp_a_field_encoding

The A field in a PMP entry’s configuration register encodes the address-matching mode of the associated PMP address register. The encoding of this field is shown in norm:pmpcfg_a_enc.

PMP_Sm_cg/{cp_cfg_A_all_even, cp_cfg_A_OFF_all_read, cp_cfg_A_napot_all, cp_cfg_A_tor_r}

pmp_napot_encoding_low_bits

NAPOT ranges make use of the low-order bits of the associated address register to encode the size of the range, as shown in norm:pmpaddr_napot_enc.

PMP_Sm_cg/{cp_cfg_A_napot_all, cp_cfg_A_napot_x, cp_cfg_A_napot_r, cp_cfg_A_napot_w}

pmp_entry_priority

PMP entries are statically prioritized. The lowest-numbered PMP entry that matches any byte of a memory operation determines whether that operation succeeds or fails.

PMP_Sm_cg/{cp_priority_lw, cp_priority_sw, cp_priority_off_lw}, PMP_Zca_cg/cp_misaligned_napot, PMP_Zca_cg/{cp_misaligned_napot, cp_misaligned_tor, cp_misaligned_na4}

pmp_napot_addr_read_mask

When G ≥ 2 and pmpcfgi.A[1] is set, i.e. the mode is NAPOT, then bits pmpaddri[G-2:0] read as all ones.

PMP_Sm_cg/{cp_grain_OFF_to_NAPOT, cp_grain_NAPOT_to_NAPOT}

pmp_tor_off_addr_read_mask

When G ≥ 1 and pmpcfgi.A[1] is clear, i.e. the mode is OFF or TOR, then bits pmpaddri[G-1:0] read as all zeros. Bits pmpaddri[G-1:0] do not affect the TOR address-matching logic.

PMP_Sm_cg/{cp_grain_OFF_to_OFF, cp_grain_OFF_to_TOR, cp_grain_NAPOT_to_OFF, cp_grain_NAPOT_to_TOR}

pmp_granularity

The granularity of PMP access control settings are platform-specific, but the standard PMP encoding supports regions as small as four bytes.

PMP_Sm_cg/{cp_grain_check_write, cp_grain_check_read, cp_cfg_A_NA4_all}

pmp_region_granularity_g

Although the PMP mechanism supports regions as small as four bytes, platforms may specify coarser PMP regions. In general, the PMP grain is 2G+2 bytes and must be the same across all PMP regions.

PMP_Sm_cg/{cp_grain_check_write, cp_grain_check_read}

pmp_mmode_only_regions

Certain regions’ privileges can be hardwired—for example, some regions might only ever be visible in machine mode but in no lower-privilege layers.

Descriptive spec text with no separately testable behavior

pmp_addr_warl

Not all physical address bits may be implemented, and so the pmpaddr registers are WARL.

PMP_Sm_cg/{cp_pmpaddr_upper_zero, cp_grain_check_write}

pmp_csrs_warl_access

All PMP CSR fields are WARL and may be read-only zero.

PMP_Sm_cg/{cp_pmpcfg_walk, cp_cfg_A_all_even, cp_grain_check_write, cp_pmpaddr_upper_zero}

pmp_addr_encoding

Each PMP address register encodes bits 33-2 of a 34-bit physical address for RV32, as shown in pmpaddr-rv32. For RV64, each PMP address register encodes bits 55-2 of a 56-bit physical address, as shown in pmpaddr-rv64.

PMP_Sm_cg/{cp_pmpaddr_upper_zero, cp_cfg_A_tor_r, cp_cfg_A_napot_r}

pmp_cfg_rv32_layout

For RV32, sixteen CSRs, pmpcfg0–pmpcfg15, hold the configurations pmp0cfg–pmp63cfg for the 64 PMP entries, as shown in pmpcfg-rv32.

PMP_Sm_cg/{cp_pmpcfg_walk, cp_pmpcfg_walk_odd, cp_cfg_A_tor_all3, cp_cfg_A_tor_all4}

pmp_cfg_rv64_layout

For RV64, eight even-numbered CSRs, pmpcfg0, pmpcfg2, …, pmpcfg14, hold the configurations for the 64 PMP entries, as shown in pmpcfg-rv64.

PMP_Sm_cg/{cp_pmpcfg_walk, cp_cfg_A_tor_all7, cp_cfg_A_tor_all8, cp_pmp64_read}

pmp_cfg_rv64_illegal

For RV64, the odd-numbered configuration registers, pmpcfg1, pmpcfg3, …, pmpcfg15, are illegal.

TODO: access the odd-numbered pmpcfg CSRs on RV64 and check for an illegal-instruction exception

pmp_rwx_warl

The R, W, and X fields form a collective WARL field for which the combinations with R=0 and W=1 are reserved.

PMP_Sm_cg/cp_pmpcfg_walk

pmp_full_match_required

The matching PMP entry must match all bytes of a memory operation, or the operation fails, irrespective of the L, R, W, and X bits.

PMP_Zca_cg/{cp_misaligned_napot, cp_misaligned_tor, cp_misaligned_na4}, PMP_Zca_cg/{cp_cret_tor, cp_cret_napot, cp_cret_na4, cp_misaligned_tor}

pmp_violation_precise_trap

PMP violations are always trapped precisely at the processor.

PMP_Zaamo_cg/cp_cfg_RW, PMP_Zaamo_cg/cp_cfg_RW

pmp_entry_count

Up to 64 PMP entries are supported. Implementations may implement zero, 16, or 64 PMP entries; the lowest-numbered PMP entries must be implemented first.

PMP_Sm_cg/{cp_pmp64_read, cp_pmp64_write}

pmp_misaligned_access_behavior

On some implementations, misaligned loads, stores, and instruction fetches may be decomposed into multiple memory operations, some of which may succeed before an access-fault exception occurs, as described in the RVWMO specification. PMP checking is performed on each memory operation independently.

PMP_Zca_cg/{cp_misaligned_napot, cp_misaligned_tor, cp_misaligned_na4, cp_misaligned_off}, TODO: misaligned loads and stores that straddle two PMP regions

pmp_no_entry_match

If no PMP entry matches an M-mode memory operation, the operation succeeds. If no PMP entry matches an S-mode or U-mode memory operation, the operation fails if at least one PMP entry is implemented and succeeds otherwise.

PMP_Sm_cg/{cp_none_lw, cp_none_sw, cp_none_jalr}, TODO: S-mode and U-mode accesses that match no PMP entry

pmp_addr_retention_on_mode_change

Although changing pmpcfgi.A[1] affects the value read from pmpaddri, it does not affect the underlying value stored in that register—in particular, pmpaddri[G-1] retains its original value when pmpcfgi.A is changed from NAPOT to TOR/OFF then back to NAPOT.

PMP_Sm_cg/{cp_grain_OFF_to_NAPOT, cp_grain_NAPOT_to_OFF, cp_grain_NAPOT_to_TOR}

pmp_entry_structure

PMP entries are described by an 8-bit configuration register and one MXLEN-bit address register. Some PMP settings additionally use the address register associated with the preceding PMP entry.

PMP_Sm_cg/cp_pmpcfg_walk

mcause_exccode_st_sc_amo

store, store-conditional, and AMO instructions generate store/AMO exceptions.

PMP_Zaamo_cg/cp_cfg_RW

sc_retire_permission

No SC.W instruction shall retire unless it passes memory permission checks,

PMP_Zalrsc_cg/cp_cfg_RW

mcause_exccode_ld_ldrsv

Note that load and load-reserved instructions generate load exceptions

PMP_Zalrsc_cg/cp_cfg_RW

mtval_varlen_wr

If mtval is written with a nonzero value when an instruction access-fault, page-fault, or hardware-error exception occurs on a hart with variable-length instructions, then mtval will contain the virtual address of the portion of the instruction that caused the fault

PMP_Zca_cg/{cp_misaligned_tor, cp_misaligned_napot, cp_misaligned_na4}, TODO: instruction page fault on the second half of a 32-bit instruction that straddles a page

mepc_varlen_wr

mepc will point to the beginning of the instruction.

PMP_Zca_cg/{cp_misaligned_tor, cp_misaligned_napot, cp_misaligned_na4}

Zca_align16

The Zca extension allows 16-bit instructions to be freely intermixed with 32-bit instructions, with the latter now able to start on any 16-bit boundary, i.e., IALIGN=16.

PMP_Zca_cg/{cp_misaligned_napot, cp_misaligned_tor}

cbm_unperm_fault

If access to the cache block is not permitted, a cache-block management instruction raises a store page-fault or store guest-page-fault exception if address translation does not permit any access or raises a store access-fault exception otherwise.

PMP_Zicbo_cg/{cp_cbo_inval, cp_cbo_flush, cp_cbo_clean}, PMP_SvZicbo_cg/{cp_PA_PMP_rw_unset_cbo_s,cp_PA_PMP_rw_unset_cbo_u}

pmp_cbm_fault

The permissions required for a cache-block management instruction to access a PMP region are defined in cmo; when such access is not permitted, the instruction raises a store access-fault exception.

PMP_Zicbo_cg/{cp_cbo_inval, cp_cbo_flush, cp_cbo_clean}, PMP_HSvZicbo_cg/cp_pmp

cbz_unperm_fault

If access to the cache block is not permitted, a cache-block zero instruction raises a store page-fault or store guest-page-fault exception if address translation does not permit write access or raises a store access-fault exception otherwise.

PMP_Zicbo_cg/cp_cbo_zero, PMP_SvZicbo_cg/{cp_PA_PMP_rw_unset_cbo_s,cp_PA_PMP_rw_unset_cbo_u}

cbp_unperm_noexcep

If access to the cache block is not permitted, a cache-block prefetch instruction does not raise any exceptions and shall not access any caches or memory.

PMP_Zicbo_cg/{cp_prefetch_w, cp_prefetch_r, cp_prefetch_i}

cbm_access

A cache-block management instruction is permitted to access the specified cache block whenever a load instruction or store instruction is permitted to access the corresponding physical addresses.

PMP_Zicbo_cg/{cp_cbo_clean, cp_cbo_flush, cp_cbo_inval}

cbz_access

A cache-block zero instruction is permitted to access the specified cache block whenever a store instruction is permitted to access the corresponding physical addresses and when the PMAs indicate that cache-block zero instructions are a supported access type.

PMP_Zicbo_cg/cp_cbo_zero

fault_excep_csr

When a page-fault, guest-page-fault, or access-fault exception is taken, the relevant *tval CSR is written with the faulting effective address (i.e. the value of rs1).

PMP_Zicbo_cg/{cp_cbo_zero, cp_cbo_clean}, PMP_SvZicbo_cg/{cp_PA_PMP_rw_unset_cbo_s,cp_PA_PMP_rw_unset_cbo_u}

pmp_check_pagetable_access

PMP checks are also applied to page-table accesses for virtual-address translation, for which the effective privilege mode is S.

PMP_Sv_cg/pmp0_pte_{noread,nowrite,noexec}_s, PMP_SvZicbo_cg/{cp_PTE_PMP_rw_unset_cbo_s,cp_PTE_PMP_rw_unset_cbo_u}, PMP_Svadu_cg/{Abit_unset_pmpW_unset_exec_s, Abit_unset_pmpW_unset_read_s, Abit_unset_pmpW_unset_write_u, Dbit_unset_pmpW_unset_write_s}

pmp_with_paging

When paging is enabled, instructions that access virtual memory may result in multiple physical-memory accesses, including implicit references to the page tables. The PMP checks apply to all of these accesses.

PMP_Sv_cg/pmp0_pte_{noread,nowrite,noexec}_s, PMP_SvZicbo_cg/{cp_PTE_PMP_rw_unset_cbo_s,cp_PTE_PMP_rw_unset_cbo_u}

pmp_speculative_translations

Implementations with virtual memory are permitted to perform address translations speculatively and earlier than required by an explicit memory access, and are permitted to cache them in address translation cache structures—including possibly caching the identity mappings from effective address to physical address used in Bare translation modes and M-mode. The PMP settings for the resulting physical address may be checked (and possibly cached) at any point between the address translation and the explicit memory access.

Not tested: when translations and PMP checks are cached is not observable

pmp_sfence_required

when the PMP settings are modified, M-mode software must synchronize the PMP settings with the virtual memory system and any PMP or address-translation caches. This is accomplished by executing an SFENCE.VMA instruction with rs1=x0 and rs2=x0, after the PMP CSRs are written.

Not tested: the tests always execute SFENCE.VMA after writing the PMP CSRs

mtval_vaddr_not_paddr

When page-based virtual memory is enabled, mtval is written with the faulting virtual address, even for physical-memory access-fault exceptions.

PMP_Sv_cg/pmp0_PA_{noread,nowrite,noexec}_s

Svadu_hw_update_a_d_bits

If the Svadu extension is implemented, the menvcfg.ADUE field is writable.

PMP_Svadu_cg/{Abit_unset_pmpW_unset_exec_s, Abit_unset_pmpW_unset_read_s, Abit_unset_pmpW_unset_write_u, Dbit_unset_pmpW_unset_write_s}

H_pmp

Machine-level physical memory protection applies to supervisor physical addresses and is in effect regardless of virtualization mode.

PMP_HSvZicbo_cg/cp_pmp

UDB Parameters: None.

B.7. Sv* Virtual Memory

B.7.1. Sv Virtual Memory

The Sv suite has one covergroup and test plan per group: the base Sv group, then Sm, Zicbo and the Exceptions groups. The UDB configuration file determines whether to run tests for Sv32, or for Sv39 and possibly Sv48 and Sv57.

Coverpoints that need M-mode state (mstatus.MPRV, mstatus.TVM, mstatus.SBE, or an M-mode CSR access) are in the Sm groups. The PMP_Sv, PMP_SvZicbo and PMP_Svadu groups of the PMP suite boot to M-mode because they program PMP entries.

Table 232. Sv Coverpoints
Coverpoint Goal Feature Description Expectation Bins ID Normative Rule

General Test Environment (Sv):
- T-SBI suite: boots to S-mode (BOOT_TO_SMODE) and drives the test from the boot identity map.
- The page under test is mapped at va_data.
- S-mode accesses run from the identity map.
- U-mode accesses use RVTEST_TSBI_GOTO_UMODE / RVTEST_TSBI_GOTO_SMODE; the handler moves execution to the U-accessible code alias va_rvtest_code_begin (registered with SAVE_AREA_SETUP) and back.
- menvcfg is written through T-SBI CSR calls.
- Page faults are delegated to S-mode, so causes are sampled from scause/stval.
- Run for every supported translation mode: Sv32 on RV32; Sv39, Sv48 and Sv57 on RV64, as selected by the UDB configuration.
- Coverpoints that need M-mode are in the Sv_Sm plans.

satp_asid_PPN

Verify the satp ASID and PPN fields hold zero and non-zero values

S-mode: read satp before translation is enabled (all fields 0). Then write satp with the current MODE, PPN = the identity-mapped root page table and ASID = 0, followed by writes with ASID bits set. Read satp back after each write.

satp[59:0] (satp[30:0] on RV32) reads 0 before translation is enabled and the written non-zero ASID/PPN afterwards.

satp_asid_PPN {all_zero, not_zero}
= 2 bins on RV64, 2 on RV32

satp_sz satp_acc satp_op satp_mode

satp
[norm:satp_sz] [norm:satp_acc] [norm:satp_op] [norm:satp_mode]

asid_length

Verify every implemented ASID bit is writable (determine ASIDLEN)

S-mode, with satp.MODE set and PPN = root page table: write ASID = all ones and read it back, then walk a single 1 through each ASID bit (16 bits on RV64, 9 on RV32), reading satp back each time.

Implemented ASID bits (the ASIDLEN least-significant bits) read back as written; unimplemented bits read 0.

asid_length {values}
= 1 bins on RV64, 1 on RV32

ASIDLEN

asidlen
asid_lsb_first
asidmax
[norm:ASIDLEN]

cp_access_u

Verify satp is not accessible from U-mode

With mstatus.TVM=0, switch to U-mode with RVTEST_TSBI_GOTO_UMODE and execute csrrw, csrrs and csrrc on satp, then return with RVTEST_TSBI_GOTO_SMODE.

Illegal-instruction exception (scause = 2) for each access; satp is unchanged.

Scause x tvm_mstatus x mode {U-mode}
= 1 bins on RV64, 1 on RV32

satp_sz satp_acc satp_op satp_mode

satp
[norm:satp_sz] [norm:satp_acc] [norm:satp_op] [norm:satp_mode]

cp_access_s

Verify satp is readable and writable from S-mode with csrrw, csrrs and csrrc

S-mode with mstatus.TVM=0 and scause cleared: csrrw satp with 4, csrrs with 8, csrrc with 4, reading satp back after each (satp.MODE stays Bare).

No exception; each read returns the value produced by the write.

cp_ins x Scause x tvm_mstatus x mode {S-mode}
= 3 bins on RV64, 3 on RV32

satp_sz satp_acc satp_op satp_mode

satp
[norm:satp_sz] [norm:satp_acc] [norm:satp_op] [norm:satp_mode]

cp_VA_i_mode

Verify instruction fetch at the lowest and highest virtual addresses of the translation mode

S-mode: map a 4 KiB execute-only page at VA 0 and at the highest aligned VA of the current mode (all ones); jump (jalr) to each and return.

No fault; execution runs at the extreme VA and returns.

mode_supported x VA_i
= 6 bins on RV64, 2 on RV32

satp_mode_sxlen32 satp_mode_sxlen64 satp_mode_sz satp_mode_acc satp_mode_op

satp_mode_sxlen32
satp_mode_sxlen64
Sv57_sxlen_va_sz
Sv57_vpn_sz
satp_ppn_Sv57_sz
Sv57_levels
Sv57_page_offset_sz
Sv57_ptesize
[norm:satp_mode_sxlen32] [norm:satp_mode_sxlen64] [norm:satp_mode_sz] [norm:satp_mode_acc] [norm:satp_mode_op]

cp_VA_d_mode

Verify loads and stores at the lowest and highest virtual addresses of the translation mode

S-mode: map a 4 KiB read/write page at VA 0 and at the all-ones VA of the current mode; store and load a byte at each (a word at VA 0 for Sv32 and Sv39).

No fault; each load returns the value stored.

mode_supported x VA_d
= 6 bins on RV64, 2 on RV32

satp_mode_sxlen32 satp_mode_sxlen64 satp_mode_sz satp_mode_acc satp_mode_op

satp_mode_sxlen32
satp_mode_sxlen64
Sv57_sxlen_va_sz
Sv57_vpn_sz
satp_ppn_Sv57_sz
Sv57_levels
Sv57_page_offset_sz
Sv57_ptesize
[norm:satp_mode_sxlen32] [norm:satp_mode_sxlen64] [norm:satp_mode_sz] [norm:satp_mode_acc] [norm:satp_mode_op]

cp_ins

Verify SFENCE.VMA executes in S-mode

Every Sv test executes sfence.vma x0, x0 in S-mode after each page-table update; the global-PTE test also executes sfence.vma x0, rs2 with the current ASID.

No exception.

cp_ins {sfence}
= 1 bins on RV64, 1 on RV32

satp_op_sfence_vma sfence_vma_op sfence_vma_ordering sfence_vma_invalidation sfence_vma_all_asid_va

satp_op_sfence_vma
sfence_vma_op
sfence_vma_ordering
sfence_vma_invalidation
sfence_vma_all_asid_va
sfence_vma_v0
[norm:satp_op_sfence_vma] [norm:sfence_vma_op] [norm:sfence_vma_ordering] [norm:sfence_vma_invalidation] [norm:sfence_vma_all_asid_va]

Nopagefault

Verify stval holds 0 while no page fault has been taken

Sampled on every instruction of the Sv tests before a page fault writes stval.

stval = 0.

Nopagefault {no_fault}
= 1 bins on RV64, 1 on RV32

cp_PTE_inv_exec_s_i

Verify an invalid leaf PTE (V=0) raises an instruction page fault on an instruction fetch from S-mode

S-mode: leaf PTE with V=0, R=W=X=1 and PTE.U=0, at every page-table level (4 KiB page and each superpage size of the Sv mode). Jump (jalr) into the page through va_data.

Instruction page fault (scause = 12); stval = faulting virtual address.

PTE_i_inv x PageType_i x ins_page_fault x exec_acc x mode {S-mode}
= 7 bins on RV64, 2 on RV32

Sv39_leaf_any_level Sv39_page_sizes Sv48_leaf_any_level Sv48_page_sizes Sv57_leaf_any_level Sv57_page_sizes stval_op_faulting_addr

[norm:Sv39_leaf_any_level] [norm:Sv39_page_sizes] [norm:Sv48_leaf_any_level] [norm:Sv48_page_sizes] [norm:Sv57_leaf_any_level] [norm:Sv57_page_sizes] [norm:stval_op_faulting_addr]

cp_PTE_inv_exec_u_i

Verify an invalid leaf PTE (V=0) raises an instruction page fault on an instruction fetch from U-mode

U-mode: leaf PTE with V=0, R=W=X=1 and PTE.U=1, at every page-table level (4 KiB page and each superpage size of the Sv mode). Jump (jalr) into the page through va_data.

Instruction page fault (scause = 12); stval = faulting virtual address.

PTE_i_inv x PageType_i x ins_page_fault x exec_acc x mode {U-mode}
= 7 bins on RV64, 2 on RV32

Sv39_leaf_any_level Sv39_page_sizes Sv48_leaf_any_level Sv48_page_sizes Sv57_leaf_any_level Sv57_page_sizes stval_op_faulting_addr

[norm:Sv39_leaf_any_level] [norm:Sv39_page_sizes] [norm:Sv48_leaf_any_level] [norm:Sv48_page_sizes] [norm:Sv57_leaf_any_level] [norm:Sv57_page_sizes] [norm:stval_op_faulting_addr]

cp_PTE_inv_read_s_d

Verify an invalid leaf PTE (V=0) raises a load page fault on a load from S-mode

S-mode: leaf PTE with V=0, R=W=X=1 and PTE.U=0, at every page-table level (4 KiB page and each superpage size of the Sv mode). Load (lw) from the page through va_data.

Load page fault (scause = 13); stval = faulting virtual address.

PTE_d_inv x PageType_d x load_page_fault x read_acc x mode {S-mode}
= 7 bins on RV64, 2 on RV32

sfence_vma_implicit_access Sv39_leaf_any_level Sv39_page_sizes Sv48_leaf_any_level Sv48_page_sizes Sv57_leaf_any_level Sv57_page_sizes stval_op_faulting_addr

sfence_vma_implicit_access
[norm:sfence_vma_implicit_access] [norm:Sv39_leaf_any_level] [norm:Sv39_page_sizes] [norm:Sv48_leaf_any_level] [norm:Sv48_page_sizes] [norm:Sv57_leaf_any_level] [norm:Sv57_page_sizes] [norm:stval_op_faulting_addr]

cp_PTE_inv_read_u_d

Verify an invalid leaf PTE (V=0) raises a load page fault on a load from U-mode

U-mode: leaf PTE with V=0, R=W=X=1 and PTE.U=1, at every page-table level (4 KiB page and each superpage size of the Sv mode). Load (lw) from the page through va_data.

Load page fault (scause = 13); stval = faulting virtual address.

PTE_d_inv x PageType_d x load_page_fault x read_acc x mode {U-mode}
= 7 bins on RV64, 2 on RV32

Sv39_leaf_any_level Sv39_page_sizes Sv48_leaf_any_level Sv48_page_sizes Sv57_leaf_any_level Sv57_page_sizes stval_op_faulting_addr

[norm:Sv39_leaf_any_level] [norm:Sv39_page_sizes] [norm:Sv48_leaf_any_level] [norm:Sv48_page_sizes] [norm:Sv57_leaf_any_level] [norm:Sv57_page_sizes] [norm:stval_op_faulting_addr]

cp_PTE_inv_write_s_d

Verify an invalid leaf PTE (V=0) raises a store/AMO page fault on a store from S-mode

S-mode: leaf PTE with V=0, R=W=X=1 and PTE.U=0, at every page-table level (4 KiB page and each superpage size of the Sv mode). Store (sw) to the page through va_data.

Store/AMO page fault (scause = 15); stval = faulting virtual address.

PTE_d_inv x PageType_d x store_page_fault x write_acc x mode {S-mode}
= 7 bins on RV64, 2 on RV32

Sv39_leaf_any_level Sv39_page_sizes Sv48_leaf_any_level Sv48_page_sizes Sv57_leaf_any_level Sv57_page_sizes stval_op_faulting_addr

[norm:Sv39_leaf_any_level] [norm:Sv39_page_sizes] [norm:Sv48_leaf_any_level] [norm:Sv48_page_sizes] [norm:Sv57_leaf_any_level] [norm:Sv57_page_sizes] [norm:stval_op_faulting_addr]

cp_PTE_inv_write_u_d

Verify an invalid leaf PTE (V=0) raises a store/AMO page fault on a store from U-mode

U-mode: leaf PTE with V=0, R=W=X=1 and PTE.U=1, at every page-table level (4 KiB page and each superpage size of the Sv mode). Store (sw) to the page through va_data.

Store/AMO page fault (scause = 15); stval = faulting virtual address.

PTE_d_inv x PageType_d x store_page_fault x write_acc x mode {U-mode}
= 7 bins on RV64, 2 on RV32

Sv39_leaf_any_level Sv39_page_sizes Sv48_leaf_any_level Sv48_page_sizes Sv57_leaf_any_level Sv57_page_sizes stval_op_faulting_addr

[norm:Sv39_leaf_any_level] [norm:Sv39_page_sizes] [norm:Sv48_leaf_any_level] [norm:Sv48_page_sizes] [norm:Sv57_leaf_any_level] [norm:Sv57_page_sizes] [norm:stval_op_faulting_addr]

cp_PTE_res_rwx_s_i_exec

Verify the reserved encoding W=1, R=0 raises an instruction page fault on an instruction fetch from S-mode

S-mode: leaf PTE with W=1 and R=0 (once with X=1, once with X=0) and PTE.U=0, at every page-table level (4 KiB page and each superpage size of the Sv mode). Jump (jalr) into the page through va_data.

Instruction page fault (scause = 12); stval = faulting virtual address.

PTE_i_res_rwx x PageType_i x ins_page_fault x exec_acc x mode {S-mode}
= 14 bins on RV64, 4 on RV32

Sv39_leaf_any_level Sv39_page_sizes Sv48_leaf_any_level Sv48_page_sizes Sv57_leaf_any_level Sv57_page_sizes stval_op_faulting_addr

[norm:Sv39_leaf_any_level] [norm:Sv39_page_sizes] [norm:Sv48_leaf_any_level] [norm:Sv48_page_sizes] [norm:Sv57_leaf_any_level] [norm:Sv57_page_sizes] [norm:stval_op_faulting_addr]

cp_PTE_res_rwx_u_i_exec

Verify the reserved encoding W=1, R=0 raises an instruction page fault on an instruction fetch from U-mode

U-mode: leaf PTE with W=1 and R=0 (once with X=1, once with X=0) and PTE.U=1, at every page-table level (4 KiB page and each superpage size of the Sv mode). Jump (jalr) into the page through va_data.

Instruction page fault (scause = 12); stval = faulting virtual address.

PTE_i_res_rwx x PageType_i x ins_page_fault x exec_acc x mode {U-mode}
= 14 bins on RV64, 4 on RV32

Sv39_leaf_any_level Sv39_page_sizes Sv48_leaf_any_level Sv48_page_sizes Sv57_leaf_any_level Sv57_page_sizes stval_op_faulting_addr

[norm:Sv39_leaf_any_level] [norm:Sv39_page_sizes] [norm:Sv48_leaf_any_level] [norm:Sv48_page_sizes] [norm:Sv57_leaf_any_level] [norm:Sv57_page_sizes] [norm:stval_op_faulting_addr]

cp_PTE_res_rwx_s_d_read

Verify the reserved encoding W=1, R=0 raises a load page fault on a load from S-mode

S-mode: leaf PTE with W=1 and R=0 (once with X=1, once with X=0) and PTE.U=0, at every page-table level (4 KiB page and each superpage size of the Sv mode). Load (lw) from the page through va_data.

Load page fault (scause = 13); stval = faulting virtual address.

PTE_d_res_rwx x PageType_d x load_page_fault x read_acc x mode {S-mode}
= 14 bins on RV64, 4 on RV32

Sv39_leaf_any_level Sv39_page_sizes Sv48_leaf_any_level Sv48_page_sizes Sv57_leaf_any_level Sv57_page_sizes stval_op_faulting_addr

[norm:Sv39_leaf_any_level] [norm:Sv39_page_sizes] [norm:Sv48_leaf_any_level] [norm:Sv48_page_sizes] [norm:Sv57_leaf_any_level] [norm:Sv57_page_sizes] [norm:stval_op_faulting_addr]

cp_PTE_res_rwx_u_d_read

Verify the reserved encoding W=1, R=0 raises a load page fault on a load from U-mode

U-mode: leaf PTE with W=1 and R=0 (once with X=1, once with X=0) and PTE.U=1, at every page-table level (4 KiB page and each superpage size of the Sv mode). Load (lw) from the page through va_data.

Load page fault (scause = 13); stval = faulting virtual address.

PTE_d_res_rwx x PageType_d x load_page_fault x read_acc x mode {U-mode}
= 14 bins on RV64, 4 on RV32

Sv39_leaf_any_level Sv39_page_sizes Sv48_leaf_any_level Sv48_page_sizes Sv57_leaf_any_level Sv57_page_sizes stval_op_faulting_addr

[norm:Sv39_leaf_any_level] [norm:Sv39_page_sizes] [norm:Sv48_leaf_any_level] [norm:Sv48_page_sizes] [norm:Sv57_leaf_any_level] [norm:Sv57_page_sizes] [norm:stval_op_faulting_addr]

cp_PTE_res_rwx_s_d_write

Verify the reserved encoding W=1, R=0 raises a store/AMO page fault on a store from S-mode

S-mode: leaf PTE with W=1 and R=0 (once with X=1, once with X=0) and PTE.U=0, at every page-table level (4 KiB page and each superpage size of the Sv mode). Store (sw) to the page through va_data.

Store/AMO page fault (scause = 15); stval = faulting virtual address.

PTE_d_res_rwx x PageType_d x store_page_fault x write_acc x mode {S-mode}
= 14 bins on RV64, 4 on RV32

Sv39_leaf_any_level Sv39_page_sizes Sv48_leaf_any_level Sv48_page_sizes Sv57_leaf_any_level Sv57_page_sizes stval_op_faulting_addr

[norm:Sv39_leaf_any_level] [norm:Sv39_page_sizes] [norm:Sv48_leaf_any_level] [norm:Sv48_page_sizes] [norm:Sv57_leaf_any_level] [norm:Sv57_page_sizes] [norm:stval_op_faulting_addr]

cp_PTE_res_rwx_u_d_write

Verify the reserved encoding W=1, R=0 raises a store/AMO page fault on a store from U-mode

U-mode: leaf PTE with W=1 and R=0 (once with X=1, once with X=0) and PTE.U=1, at every page-table level (4 KiB page and each superpage size of the Sv mode). Store (sw) to the page through va_data.

Store/AMO page fault (scause = 15); stval = faulting virtual address.

PTE_d_res_rwx x PageType_d x store_page_fault x write_acc x mode {U-mode}
= 14 bins on RV64, 4 on RV32

Sv39_leaf_any_level Sv39_page_sizes Sv48_leaf_any_level Sv48_page_sizes Sv57_leaf_any_level Sv57_page_sizes stval_op_faulting_addr

[norm:Sv39_leaf_any_level] [norm:Sv39_page_sizes] [norm:Sv48_leaf_any_level] [norm:Sv48_page_sizes] [norm:Sv57_leaf_any_level] [norm:Sv57_page_sizes] [norm:stval_op_faulting_addr]

cp_PTE_nonleaf_lvl0_s_i_exec

Verify a level-0 pointer PTE (V=1, R=W=X=0) raises an instruction page fault on an instruction fetch from S-mode

S-mode: level-0 PTE with V=1, R=W=X=0 and PTE.U=0, so the walk needs another level that does not exist. Jump (jalr) into the page through va_data.

Instruction page fault (scause = 12); stval = faulting virtual address.

PTE_nonleaf_lvl0_i x kilo_page_i x mode x ins_page_fault x exec_acc x mode {S-mode}
= 3 bins on RV64, 1 on RV32

stval_op_faulting_addr

[norm:stval_op_faulting_addr]

cp_PTE_nonleaf_lvl0_u_i_exec

Verify a level-0 pointer PTE (V=1, R=W=X=0) raises an instruction page fault on an instruction fetch from U-mode

U-mode: level-0 PTE with V=1, R=W=X=0 and PTE.U=1, so the walk needs another level that does not exist. Jump (jalr) into the page through va_data.

Instruction page fault (scause = 12); stval = faulting virtual address.

PTE_nonleaf_lvl0_i x kilo_page_i x mode x ins_page_fault x exec_acc x mode {U-mode}
= 3 bins on RV64, 1 on RV32

stval_op_faulting_addr

[norm:stval_op_faulting_addr]

cp_PTE_nonleaf_lvl0_s_d_read

Verify a level-0 pointer PTE (V=1, R=W=X=0) raises a load page fault on a load from S-mode

S-mode: level-0 PTE with V=1, R=W=X=0 and PTE.U=0, so the walk needs another level that does not exist. Load (lw) from the page through va_data.

Load page fault (scause = 13); stval = faulting virtual address.

PTE_nonleaf_lvl0_d x kilo_page_d x mode x load_page_fault x read_acc x mode {S-mode}
= 3 bins on RV64, 1 on RV32

sfence_vma_implicit_access stval_op_faulting_addr

sfence_vma_implicit_access
[norm:sfence_vma_implicit_access] [norm:stval_op_faulting_addr]

cp_PTE_nonleaf_lvl0_u_d_read

Verify a level-0 pointer PTE (V=1, R=W=X=0) raises a load page fault on a load from U-mode

U-mode: level-0 PTE with V=1, R=W=X=0 and PTE.U=1, so the walk needs another level that does not exist. Load (lw) from the page through va_data.

Load page fault (scause = 13); stval = faulting virtual address.

PTE_nonleaf_lvl0_d x kilo_page_d x mode x load_page_fault x read_acc x mode {U-mode}
= 3 bins on RV64, 1 on RV32

stval_op_faulting_addr

[norm:stval_op_faulting_addr]

cp_PTE_nonleaf_lvl0_s_d_write

Verify a level-0 pointer PTE (V=1, R=W=X=0) raises a store/AMO page fault on a store from S-mode

S-mode: level-0 PTE with V=1, R=W=X=0 and PTE.U=0, so the walk needs another level that does not exist. Store (sw) to the page through va_data.

Store/AMO page fault (scause = 15); stval = faulting virtual address.

PTE_nonleaf_lvl0_d x kilo_page_d x mode x store_page_fault x write_acc x mode {S-mode}
= 3 bins on RV64, 1 on RV32

stval_op_faulting_addr

[norm:stval_op_faulting_addr]

cp_PTE_nonleaf_lvl0_u_d_write

Verify a level-0 pointer PTE (V=1, R=W=X=0) raises a store/AMO page fault on a store from U-mode

U-mode: level-0 PTE with V=1, R=W=X=0 and PTE.U=1, so the walk needs another level that does not exist. Store (sw) to the page through va_data.

Store/AMO page fault (scause = 15); stval = faulting virtual address.

PTE_nonleaf_lvl0_d x kilo_page_d x mode x store_page_fault x write_acc x mode {U-mode}
= 3 bins on RV64, 1 on RV32

stval_op_faulting_addr

[norm:stval_op_faulting_addr]

cp_spage_exec_s_i

Verify an S-mode instruction fetch from a supervisor page succeeds when X=1, independent of SUM

S-mode: supervisor leaf PTE (U=0) at every page-table level (4 KiB page and each superpage size of the Sv mode), with X=1 (RWX, X-only, RX). Run with sstatus.SUM=0 and SUM=1. Jump (jalr) into the page through va_data.

No fault; SUM has no effect on supervisor pages.

PTE_x_spage_i x PageType_i x exec_acc x sum_sstatus x mode {S-mode}
= 14 bins on RV64, 4 on RV32

satp_op_active Sv39_sxlen Sv39_va_sz Sv39_vpn_sz satp_ppn_sv39_sz Sv39_levels Sv39_page_offset_sz Sv39_LEVELS Sv39_PTESIZE Sv39_leaf_any_level Sv39_page_sizes Sv39_pte_count Sv39_pte_sz Sv39_pt_sz Sv39_pt_align Sv48_sxlen Sv48_va_sz Sv48_vpn_sz satp_ppn_sv48_sz Sv48_levels Sv48_page_offset_sz Sv48_LEVELS Sv48_PTESIZE Sv48_leaf_any_level Sv48_page_sizes Sv57_sxlen Sv57_va_sz Sv57_vpn_sz satp_ppn_sv57_sz Sv57_levels Sv57_page_offset_sz Sv57_LEVELS Sv57_PTESIZE Sv57_leaf_any_level Sv57_page_sizes

satp_op_active
satp_ppn_Sv32_sz
Sv39_sxlen_va_sz
Sv39_vpn_sz
satp_ppn_Sv39_sz
Sv39_levels
Sv39_page_offset_sz
Sv39_ptesize
Sv39_leaf_any_level
Sv39_page_sizes
Sv39_pte_count_sz
Sv39_pt_sz
Sv39_pt_align
Sv48_sxlen
Sv48_va_sz
Sv48_vpn_sz
satp_ppn_Sv48_sz
Sv48_levels
Sv48_page_offset_sz
Sv48_ptesize
Sv48_leaf_any_level
Sv48_page_sizes
[norm:satp_op_active] [norm:Sv39_sxlen] [norm:Sv39_va_sz] [norm:Sv39_vpn_sz] [norm:satp_ppn_sv39_sz] [norm:Sv39_levels] [norm:Sv39_page_offset_sz] [norm:Sv39_LEVELS] [norm:Sv39_PTESIZE] [norm:Sv39_leaf_any_level] [norm:Sv39_page_sizes] [norm:Sv39_pte_count] [norm:Sv39_pte_sz] [norm:Sv39_pt_sz] [norm:Sv39_pt_align] [norm:Sv48_sxlen] [norm:Sv48_va_sz] [norm:Sv48_vpn_sz] [norm:satp_ppn_sv48_sz] [norm:Sv48_levels] [norm:Sv48_page_offset_sz] [norm:Sv48_LEVELS] [norm:Sv48_PTESIZE] [norm:Sv48_leaf_any_level] [norm:Sv48_page_sizes] [norm:Sv57_sxlen] [norm:Sv57_va_sz] [norm:Sv57_vpn_sz] [norm:satp_ppn_sv57_sz] [norm:Sv57_levels] [norm:Sv57_page_offset_sz] [norm:Sv57_LEVELS] [norm:Sv57_PTESIZE] [norm:Sv57_leaf_any_level] [norm:Sv57_page_sizes]

cp_spage_noexec_s_i

Verify an S-mode instruction fetch from a supervisor page with X=0 raises an instruction page fault

S-mode: supervisor leaf PTE (U=0) at every page-table level (4 KiB page and each superpage size of the Sv mode), with X=0 (RW, R-only). Run with sstatus.SUM=0 and SUM=1. Jump (jalr) into the page through va_data.

Instruction page fault (scause = 12); stval = faulting virtual address.

PTE_x_spage_i x PageType_i x ins_page_fault x exec_acc x sum_sstatus x mode {S-mode}
= 14 bins on RV64, 4 on RV32

fetch_page_fault_no_x Sv39_leaf_any_level Sv39_page_sizes Sv48_leaf_any_level Sv48_page_sizes Sv57_leaf_any_level Sv57_page_sizes stval_op_faulting_addr

fetch_page_fault_no_x
stval_op_faulting_addr
[norm:fetch_page_fault_no_x] [norm:Sv39_leaf_any_level] [norm:Sv39_page_sizes] [norm:Sv48_leaf_any_level] [norm:Sv48_page_sizes] [norm:Sv57_leaf_any_level] [norm:Sv57_page_sizes] [norm:stval_op_faulting_addr]

cp_spage_read_s_d

Verify an S-mode load from a supervisor page succeeds when R=1, independent of SUM

S-mode: supervisor leaf PTE (U=0) at every page-table level (4 KiB page and each superpage size of the Sv mode), with R=1 (RWX, RX, RW, R-only). Run with sstatus.SUM=0 and SUM=1. Load (lw) from the page through va_data.

No fault; SUM has no effect on supervisor pages.

PTE_rw_spage_d x PageType_d x read_acc x sum_sstatus x mode {S-mode}
= 14 bins on RV64, 4 on RV32

satp_op_active Sv39_sxlen Sv39_va_sz Sv39_vpn_sz satp_ppn_sv39_sz Sv39_levels Sv39_page_offset_sz Sv39_LEVELS Sv39_PTESIZE Sv39_leaf_any_level Sv39_page_sizes Sv39_pte_count Sv39_pte_sz Sv39_pt_sz Sv39_pt_align Sv48_sxlen Sv48_va_sz Sv48_vpn_sz satp_ppn_sv48_sz Sv48_levels Sv48_page_offset_sz Sv48_LEVELS Sv48_PTESIZE Sv48_leaf_any_level Sv48_page_sizes Sv57_sxlen Sv57_va_sz Sv57_vpn_sz satp_ppn_sv57_sz Sv57_levels Sv57_page_offset_sz Sv57_LEVELS Sv57_PTESIZE Sv57_leaf_any_level Sv57_page_sizes

satp_op_active
satp_ppn_Sv32_sz
Sv39_sxlen_va_sz
Sv39_vpn_sz
satp_ppn_Sv39_sz
Sv39_levels
Sv39_page_offset_sz
Sv39_ptesize
Sv39_leaf_any_level
Sv39_page_sizes
Sv39_pte_count_sz
Sv39_pt_sz
Sv39_pt_align
Sv48_sxlen
Sv48_va_sz
Sv48_vpn_sz
satp_ppn_Sv48_sz
Sv48_levels
Sv48_page_offset_sz
Sv48_ptesize
Sv48_leaf_any_level
Sv48_page_sizes
[norm:satp_op_active] [norm:Sv39_sxlen] [norm:Sv39_va_sz] [norm:Sv39_vpn_sz] [norm:satp_ppn_sv39_sz] [norm:Sv39_levels] [norm:Sv39_page_offset_sz] [norm:Sv39_LEVELS] [norm:Sv39_PTESIZE] [norm:Sv39_leaf_any_level] [norm:Sv39_page_sizes] [norm:Sv39_pte_count] [norm:Sv39_pte_sz] [norm:Sv39_pt_sz] [norm:Sv39_pt_align] [norm:Sv48_sxlen] [norm:Sv48_va_sz] [norm:Sv48_vpn_sz] [norm:satp_ppn_sv48_sz] [norm:Sv48_levels] [norm:Sv48_page_offset_sz] [norm:Sv48_LEVELS] [norm:Sv48_PTESIZE] [norm:Sv48_leaf_any_level] [norm:Sv48_page_sizes] [norm:Sv57_sxlen] [norm:Sv57_va_sz] [norm:Sv57_vpn_sz] [norm:satp_ppn_sv57_sz] [norm:Sv57_levels] [norm:Sv57_page_offset_sz] [norm:Sv57_LEVELS] [norm:Sv57_PTESIZE] [norm:Sv57_leaf_any_level] [norm:Sv57_page_sizes]

cp_spage_noread_s_d

Verify an S-mode load from a supervisor page with R=0 raises a load page fault

S-mode: supervisor leaf PTE (U=0) at every page-table level (4 KiB page and each superpage size of the Sv mode), with R=0 (X-only). Run with sstatus.SUM=0 and SUM=1. Load (lw) from the page through va_data.

Load page fault (scause = 13); stval = faulting virtual address.

PTE_rw_spage_d x PageType_d x load_page_fault x read_acc x sum_sstatus x mode {S-mode}
= 14 bins on RV64, 4 on RV32

load_page_fault_no_r Sv39_leaf_any_level Sv39_page_sizes Sv48_leaf_any_level Sv48_page_sizes Sv57_leaf_any_level Sv57_page_sizes stval_op_faulting_addr

load_page_fault_no_r
stval_op_faulting_addr
[norm:load_page_fault_no_r] [norm:Sv39_leaf_any_level] [norm:Sv39_page_sizes] [norm:Sv48_leaf_any_level] [norm:Sv48_page_sizes] [norm:Sv57_leaf_any_level] [norm:Sv57_page_sizes] [norm:stval_op_faulting_addr]

cp_spage_write_s_d

Verify an S-mode store from a supervisor page succeeds when W=1, independent of SUM

S-mode: supervisor leaf PTE (U=0) at every page-table level (4 KiB page and each superpage size of the Sv mode), with W=1 (RWX, RW). Run with sstatus.SUM=0 and SUM=1. Store (sw) to the page through va_data.

No fault; SUM has no effect on supervisor pages.

PTE_rw_spage_d x PageType_d x write_acc x sum_sstatus x mode {S-mode}
= 14 bins on RV64, 4 on RV32

satp_op_active Sv39_sxlen Sv39_va_sz Sv39_vpn_sz satp_ppn_sv39_sz Sv39_levels Sv39_page_offset_sz Sv39_LEVELS Sv39_PTESIZE Sv39_leaf_any_level Sv39_page_sizes Sv39_pte_count Sv39_pte_sz Sv39_pt_sz Sv39_pt_align Sv48_sxlen Sv48_va_sz Sv48_vpn_sz satp_ppn_sv48_sz Sv48_levels Sv48_page_offset_sz Sv48_LEVELS Sv48_PTESIZE Sv48_leaf_any_level Sv48_page_sizes Sv57_sxlen Sv57_va_sz Sv57_vpn_sz satp_ppn_sv57_sz Sv57_levels Sv57_page_offset_sz Sv57_LEVELS Sv57_PTESIZE Sv57_leaf_any_level Sv57_page_sizes

satp_ppn_Sv32_sz
Sv39_sxlen_va_sz
Sv39_vpn_sz
satp_ppn_Sv39_sz
Sv39_levels
Sv39_page_offset_sz
Sv39_ptesize
Sv39_leaf_any_level
Sv39_page_sizes
Sv39_pte_count_sz
Sv39_pt_sz
Sv39_pt_align
Sv48_sxlen
Sv48_va_sz
Sv48_vpn_sz
satp_ppn_Sv48_sz
Sv48_levels
Sv48_page_offset_sz
Sv48_ptesize
Sv48_leaf_any_level
Sv48_page_sizes
[norm:satp_op_active] [norm:Sv39_sxlen] [norm:Sv39_va_sz] [norm:Sv39_vpn_sz] [norm:satp_ppn_sv39_sz] [norm:Sv39_levels] [norm:Sv39_page_offset_sz] [norm:Sv39_LEVELS] [norm:Sv39_PTESIZE] [norm:Sv39_leaf_any_level] [norm:Sv39_page_sizes] [norm:Sv39_pte_count] [norm:Sv39_pte_sz] [norm:Sv39_pt_sz] [norm:Sv39_pt_align] [norm:Sv48_sxlen] [norm:Sv48_va_sz] [norm:Sv48_vpn_sz] [norm:satp_ppn_sv48_sz] [norm:Sv48_levels] [norm:Sv48_page_offset_sz] [norm:Sv48_LEVELS] [norm:Sv48_PTESIZE] [norm:Sv48_leaf_any_level] [norm:Sv48_page_sizes] [norm:Sv57_sxlen] [norm:Sv57_va_sz] [norm:Sv57_vpn_sz] [norm:satp_ppn_sv57_sz] [norm:Sv57_levels] [norm:Sv57_page_offset_sz] [norm:Sv57_LEVELS] [norm:Sv57_PTESIZE] [norm:Sv57_leaf_any_level] [norm:Sv57_page_sizes]

cp_spage_nowrite_s_d

Verify an S-mode store from a supervisor page with W=0 raises a store/AMO page fault

S-mode: supervisor leaf PTE (U=0) at every page-table level (4 KiB page and each superpage size of the Sv mode), with W=0 (X-only, RX, R-only). Run with sstatus.SUM=0 and SUM=1. Store (sw) to the page through va_data.

Store/AMO page fault (scause = 15); stval = faulting virtual address.

PTE_rw_spage_d x PageType_d x store_page_fault x write_acc x sum_sstatus x mode {S-mode}
= 14 bins on RV64, 4 on RV32

store_page_fault_no_w Sv39_leaf_any_level Sv39_page_sizes Sv48_leaf_any_level Sv48_page_sizes Sv57_leaf_any_level Sv57_page_sizes stval_op_faulting_addr

store_page_fault_no_w
stval_op_faulting_addr
[norm:store_page_fault_no_w] [norm:Sv39_leaf_any_level] [norm:Sv39_page_sizes] [norm:Sv48_leaf_any_level] [norm:Sv48_page_sizes] [norm:Sv57_leaf_any_level] [norm:Sv57_page_sizes] [norm:stval_op_faulting_addr]

cp_spage_rwx_s_i_noexec

Verify a U-mode instruction fetch from a supervisor page (U=0) raises an instruction page fault

U-mode: supervisor leaf PTE (U=0) with R=W=X=1, at every page-table level (4 KiB page and each superpage size of the Sv mode). Jump (jalr) into the page through va_data.

Instruction page fault (scause = 12); stval = faulting virtual address.

PTE_spage_i x PageType_i x ins_page_fault x exec_acc x mode {U-mode}
= 7 bins on RV64, 2 on RV32

fetch_page_fault_no_x Sv39_leaf_any_level Sv39_page_sizes Sv48_leaf_any_level Sv48_page_sizes Sv57_leaf_any_level Sv57_page_sizes stval_op_faulting_addr

fetch_page_fault_no_x
[norm:fetch_page_fault_no_x] [norm:Sv39_leaf_any_level] [norm:Sv39_page_sizes] [norm:Sv48_leaf_any_level] [norm:Sv48_page_sizes] [norm:Sv57_leaf_any_level] [norm:Sv57_page_sizes] [norm:stval_op_faulting_addr]

cp_spage_rwx_s_d_noread

Verify a U-mode load from a supervisor page (U=0) raises a load page fault

U-mode: supervisor leaf PTE (U=0) with R=W=X=1, at every page-table level (4 KiB page and each superpage size of the Sv mode). Load (lw) from the page through va_data.

Load page fault (scause = 13); stval = faulting virtual address.

PTE_spage_d x PageType_d x load_page_fault x read_acc x mode {U-mode}
= 7 bins on RV64, 2 on RV32

load_page_fault_no_r Sv39_leaf_any_level Sv39_page_sizes Sv48_leaf_any_level Sv48_page_sizes Sv57_leaf_any_level Sv57_page_sizes stval_op_faulting_addr

load_page_fault_no_r
pte_u_op
[norm:load_page_fault_no_r] [norm:Sv39_leaf_any_level] [norm:Sv39_page_sizes] [norm:Sv48_leaf_any_level] [norm:Sv48_page_sizes] [norm:Sv57_leaf_any_level] [norm:Sv57_page_sizes] [norm:stval_op_faulting_addr]

cp_spage_rwx_s_d_nowrite

Verify a U-mode store from a supervisor page (U=0) raises a store/AMO page fault

U-mode: supervisor leaf PTE (U=0) with R=W=X=1, at every page-table level (4 KiB page and each superpage size of the Sv mode). Store (sw) to the page through va_data.

Store/AMO page fault (scause = 15); stval = faulting virtual address.

PTE_spage_d x PageType_d x store_page_fault x write_acc x mode {U-mode}
= 7 bins on RV64, 2 on RV32

store_page_fault_no_w Sv39_leaf_any_level Sv39_page_sizes Sv48_leaf_any_level Sv48_page_sizes Sv57_leaf_any_level Sv57_page_sizes stval_op_faulting_addr

store_page_fault_no_w
[norm:store_page_fault_no_w] [norm:Sv39_leaf_any_level] [norm:Sv39_page_sizes] [norm:Sv48_leaf_any_level] [norm:Sv48_page_sizes] [norm:Sv57_leaf_any_level] [norm:Sv57_page_sizes] [norm:stval_op_faulting_addr]

cp_upage_smode_sumunset_noexec_s

Verify an S-mode instruction fetch from a user page (U=1) raises an instruction page fault when sstatus.SUM=0

S-mode with sstatus.SUM=0: user leaf PTE (U=1) swept through RWX, X-only, RX, RW and R-only, at every page-table level (4 KiB page and each superpage size of the Sv mode). Jump (jalr) into the page through va_data.

Instruction page fault (scause = 12); stval = faulting virtual address.

PTE_upage_i x PageType_i x ins_page_fault x exec_acc x sum_sstatus x mode {S-mode}
= 7 bins on RV64, 2 on RV32

sstatus_sum_sz sstatus_sum_acc sstatus_sum_op Sv39_leaf_any_level Sv39_page_sizes Sv48_leaf_any_level Sv48_page_sizes Sv57_leaf_any_level Sv57_page_sizes stval_op_faulting_addr

sstatus_sum
pte_u_no_s_exec
[norm:sstatus_sum_sz] [norm:sstatus_sum_acc] [norm:sstatus_sum_op] [norm:Sv39_leaf_any_level] [norm:Sv39_page_sizes] [norm:Sv48_leaf_any_level] [norm:Sv48_page_sizes] [norm:Sv57_leaf_any_level] [norm:Sv57_page_sizes] [norm:stval_op_faulting_addr]

cp_upage_smode_sumunset_noread_s

Verify an S-mode load from a user page (U=1) raises a load page fault when sstatus.SUM=0

S-mode with sstatus.SUM=0: user leaf PTE (U=1) swept through RWX, X-only, RX, RW and R-only, at every page-table level (4 KiB page and each superpage size of the Sv mode). Load (lw) from the page through va_data.

Load page fault (scause = 13); stval = faulting virtual address.

PTE_upage_d x PageType_d x load_page_fault x read_acc x sum_sstatus x mode {S-mode}
= 7 bins on RV64, 2 on RV32

sstatus_sum_sz sstatus_sum_acc sstatus_sum_op Sv39_leaf_any_level Sv39_page_sizes Sv48_leaf_any_level Sv48_page_sizes Sv57_leaf_any_level Sv57_page_sizes stval_op_faulting_addr

mstatus_sum_op
sstatus_sum
pte_u_op
[norm:sstatus_sum_sz] [norm:sstatus_sum_acc] [norm:sstatus_sum_op] [norm:Sv39_leaf_any_level] [norm:Sv39_page_sizes] [norm:Sv48_leaf_any_level] [norm:Sv48_page_sizes] [norm:Sv57_leaf_any_level] [norm:Sv57_page_sizes] [norm:stval_op_faulting_addr]

cp_upage_smode_sumunset_nowrite_s

Verify an S-mode store from a user page (U=1) raises a store/AMO page fault when sstatus.SUM=0

S-mode with sstatus.SUM=0: user leaf PTE (U=1) swept through RWX, X-only, RX, RW and R-only, at every page-table level (4 KiB page and each superpage size of the Sv mode). Store (sw) to the page through va_data.

Store/AMO page fault (scause = 15); stval = faulting virtual address.

PTE_upage_d x PageType_d x store_page_fault x write_acc x sum_sstatus x mode {S-mode}
= 7 bins on RV64, 2 on RV32

sstatus_sum_sz sstatus_sum_acc sstatus_sum_op Sv39_leaf_any_level Sv39_page_sizes Sv48_leaf_any_level Sv48_page_sizes Sv57_leaf_any_level Sv57_page_sizes stval_op_faulting_addr

mstatus_sum_op
[norm:sstatus_sum_sz] [norm:sstatus_sum_acc] [norm:sstatus_sum_op] [norm:Sv39_leaf_any_level] [norm:Sv39_page_sizes] [norm:Sv48_leaf_any_level] [norm:Sv48_page_sizes] [norm:Sv57_leaf_any_level] [norm:Sv57_page_sizes] [norm:stval_op_faulting_addr]

cp_upage_smode_sumset_noexec_s

Verify S-mode can never fetch from a user page, even with sstatus.SUM=1

S-mode with sstatus.SUM=1: user leaf PTE (U=1) with X=1 (RWX, X-only, RX), at every page-table level (4 KiB page and each superpage size of the Sv mode). Jump (jalr) into the page.

Instruction page fault (scause = 12); stval = faulting virtual address.

PTE_upage_i x PageType_i x ins_page_fault x exec_acc x sum_sstatus x mode {S-mode}
= 7 bins on RV64, 2 on RV32

sstatus_sum_sz sstatus_sum_acc sstatus_sum_op Sv39_leaf_any_level Sv39_page_sizes Sv48_leaf_any_level Sv48_page_sizes Sv57_leaf_any_level Sv57_page_sizes stval_op_faulting_addr

sstatus_sum
pte_u_no_s_exec
[norm:sstatus_sum_sz] [norm:sstatus_sum_acc] [norm:sstatus_sum_op] [norm:Sv39_leaf_any_level] [norm:Sv39_page_sizes] [norm:Sv48_leaf_any_level] [norm:Sv48_page_sizes] [norm:Sv57_leaf_any_level] [norm:Sv57_page_sizes] [norm:stval_op_faulting_addr]

cp_upage_smode_sumset_read_s

Verify an S-mode load from a user page succeeds when sstatus.SUM=1

S-mode with sstatus.SUM=1: user leaf PTE (U=1) with R=1 (RWX, RX, RW, R-only), at every page-table level (4 KiB page and each superpage size of the Sv mode). Load (lw) from the page through va_data.

No fault.

PTE_upage_d x PageType_d x read_acc x sum_sstatus x mode {S-mode}
= 7 bins on RV64, 2 on RV32

sstatus_sum_sz sstatus_sum_acc sstatus_sum_op Sv39_leaf_any_level Sv39_page_sizes Sv48_leaf_any_level Sv48_page_sizes Sv57_leaf_any_level Sv57_page_sizes

mstatus_sum_op
sstatus_sum
pte_u_op
[norm:sstatus_sum_sz] [norm:sstatus_sum_acc] [norm:sstatus_sum_op] [norm:Sv39_leaf_any_level] [norm:Sv39_page_sizes] [norm:Sv48_leaf_any_level] [norm:Sv48_page_sizes] [norm:Sv57_leaf_any_level] [norm:Sv57_page_sizes]

cp_upage_smode_sumset_write_s

Verify an S-mode store from a user page succeeds when sstatus.SUM=1

S-mode with sstatus.SUM=1: user leaf PTE (U=1) with W=1 (RWX, RW), at every page-table level (4 KiB page and each superpage size of the Sv mode). Store (sw) to the page through va_data.

No fault.

PTE_upage_d x PageType_d x write_acc x sum_sstatus x mode {S-mode}
= 7 bins on RV64, 2 on RV32

sstatus_sum_sz sstatus_sum_acc sstatus_sum_op Sv39_leaf_any_level Sv39_page_sizes Sv48_leaf_any_level Sv48_page_sizes Sv57_leaf_any_level Sv57_page_sizes

mstatus_sum_op
[norm:sstatus_sum_sz] [norm:sstatus_sum_acc] [norm:sstatus_sum_op] [norm:Sv39_leaf_any_level] [norm:Sv39_page_sizes] [norm:Sv48_leaf_any_level] [norm:Sv48_page_sizes] [norm:Sv57_leaf_any_level] [norm:Sv57_page_sizes]

cp_upage_umode_exec_u

Verify a U-mode instruction fetch from a user page succeeds when X=1

U-mode: user leaf PTE (U=1) with X=1 (RWX, X-only, RX), at every page-table level (4 KiB page and each superpage size of the Sv mode). Jump (jalr) into the page through va_data.

No fault.

PTE_x_upage_i x PageType_i x exec_acc x mode {U-mode}
= 7 bins on RV64, 2 on RV32

satp_op_active Sv39_leaf_any_level Sv39_page_sizes Sv48_leaf_any_level Sv48_page_sizes Sv57_leaf_any_level Sv57_page_sizes

[norm:satp_op_active] [norm:Sv39_leaf_any_level] [norm:Sv39_page_sizes] [norm:Sv48_leaf_any_level] [norm:Sv48_page_sizes] [norm:Sv57_leaf_any_level] [norm:Sv57_page_sizes]

cp_upage_umode_noexec_u

Verify a U-mode instruction fetch from a user page with X=0 raises an instruction page fault

U-mode: user leaf PTE (U=1) with X=0 (RW, R-only), at every page-table level (4 KiB page and each superpage size of the Sv mode). Jump (jalr) into the page through va_data.

Instruction page fault (scause = 12); stval = faulting virtual address.

PTE_x_upage_i x PageType_i x ins_page_fault x exec_acc x mode {U-mode}
= 7 bins on RV64, 2 on RV32

fetch_page_fault_no_x Sv39_leaf_any_level Sv39_page_sizes Sv48_leaf_any_level Sv48_page_sizes Sv57_leaf_any_level Sv57_page_sizes stval_op_faulting_addr

fetch_page_fault_no_x
[norm:fetch_page_fault_no_x] [norm:Sv39_leaf_any_level] [norm:Sv39_page_sizes] [norm:Sv48_leaf_any_level] [norm:Sv48_page_sizes] [norm:Sv57_leaf_any_level] [norm:Sv57_page_sizes] [norm:stval_op_faulting_addr]

cp_upage_umode_read_u

Verify a U-mode load from a user page succeeds when R=1

U-mode: user leaf PTE (U=1) with R=1 (RWX, RX, RW, R-only), at every page-table level (4 KiB page and each superpage size of the Sv mode). Load (lw) from the page through va_data.

No fault.

PTE_rw_upage_d x PageType_d x read_acc x mode {U-mode}
= 7 bins on RV64, 2 on RV32

satp_op_active Sv39_leaf_any_level Sv39_page_sizes Sv48_leaf_any_level Sv48_page_sizes Sv57_leaf_any_level Sv57_page_sizes

satp_op_active
pte_u_op
[norm:satp_op_active] [norm:Sv39_leaf_any_level] [norm:Sv39_page_sizes] [norm:Sv48_leaf_any_level] [norm:Sv48_page_sizes] [norm:Sv57_leaf_any_level] [norm:Sv57_page_sizes]

cp_upage_umode_noread_u

Verify a U-mode load from a user page with R=0 raises a load page fault

U-mode: user leaf PTE (U=1) with R=0 (X-only), at every page-table level (4 KiB page and each superpage size of the Sv mode). Load (lw) from the page through va_data.

Load page fault (scause = 13); stval = faulting virtual address.

PTE_rw_upage_d x PageType_d x load_page_fault x read_acc x mode {U-mode}
= 7 bins on RV64, 2 on RV32

load_page_fault_no_r Sv39_leaf_any_level Sv39_page_sizes Sv48_leaf_any_level Sv48_page_sizes Sv57_leaf_any_level Sv57_page_sizes stval_op_faulting_addr

load_page_fault_no_r
[norm:load_page_fault_no_r] [norm:Sv39_leaf_any_level] [norm:Sv39_page_sizes] [norm:Sv48_leaf_any_level] [norm:Sv48_page_sizes] [norm:Sv57_leaf_any_level] [norm:Sv57_page_sizes] [norm:stval_op_faulting_addr]

cp_upage_umode_write_u

Verify a U-mode store from a user page succeeds when W=1

U-mode: user leaf PTE (U=1) with W=1 (RWX, RW), at every page-table level (4 KiB page and each superpage size of the Sv mode). Store (sw) to the page through va_data.

No fault.

PTE_rw_upage_d x PageType_d x write_acc x mode {U-mode}
= 7 bins on RV64, 2 on RV32

satp_op_active Sv39_leaf_any_level Sv39_page_sizes Sv48_leaf_any_level Sv48_page_sizes Sv57_leaf_any_level Sv57_page_sizes

[norm:satp_op_active] [norm:Sv39_leaf_any_level] [norm:Sv39_page_sizes] [norm:Sv48_leaf_any_level] [norm:Sv48_page_sizes] [norm:Sv57_leaf_any_level] [norm:Sv57_page_sizes]

cp_upage_umode_nowrite_u

Verify a U-mode store from a user page with W=0 raises a store/AMO page fault

U-mode: user leaf PTE (U=1) with W=0 (X-only, RX, R-only), at every page-table level (4 KiB page and each superpage size of the Sv mode). Store (sw) to the page through va_data.

Store/AMO page fault (scause = 15); stval = faulting virtual address.

PTE_rw_upage_d x PageType_d x store_page_fault x write_acc x mode {U-mode}
= 7 bins on RV64, 2 on RV32

store_page_fault_no_w Sv39_leaf_any_level Sv39_page_sizes Sv48_leaf_any_level Sv48_page_sizes Sv57_leaf_any_level Sv57_page_sizes stval_op_faulting_addr

store_page_fault_no_w
[norm:store_page_fault_no_w] [norm:Sv39_leaf_any_level] [norm:Sv39_page_sizes] [norm:Sv48_leaf_any_level] [norm:Sv48_page_sizes] [norm:Sv57_leaf_any_level] [norm:Sv57_page_sizes] [norm:stval_op_faulting_addr]

cp_xpage_mxrunset_read_s

Verify an S-mode load from an execute-only page faults when sstatus.MXR=0

S-mode: execute-only leaf PTE (R=W=0, X=1) with PTE.U=0, at every page-table level (4 KiB page and each superpage size of the Sv mode); clear sstatus.MXR. Load (lw) through va_data (a store is also attempted).

Load page fault (scause = 13); the store raises a store/AMO page fault (scause = 15).

PTE_XnoRW_d x PageType_d x load_page_fault x read_acc x mxr_sstatus x mode {S-mode}
= 7 bins on RV64, 2 on RV32

sstatus_mxr_sz sstatus_mxr_acc sstatus_mxr_op sfence_vma_sum_mxr_effect Sv39_leaf_any_level Sv39_page_sizes Sv48_leaf_any_level Sv48_page_sizes Sv57_leaf_any_level Sv57_page_sizes stval_op_faulting_addr

mstatus_mxr_op
sstatus_mxr
sfence_vma_sum_mxr_effect
[norm:sstatus_mxr_sz] [norm:sstatus_mxr_acc] [norm:sstatus_mxr_op] [norm:sfence_vma_sum_mxr_effect] [norm:Sv39_leaf_any_level] [norm:Sv39_page_sizes] [norm:Sv48_leaf_any_level] [norm:Sv48_page_sizes] [norm:Sv57_leaf_any_level] [norm:Sv57_page_sizes] [norm:stval_op_faulting_addr]

cp_xpage_mxrunset_read_u

Verify a U-mode load from an execute-only page faults when sstatus.MXR=0

U-mode: execute-only leaf PTE (R=W=0, X=1) with PTE.U=1, at every page-table level (4 KiB page and each superpage size of the Sv mode); clear sstatus.MXR. Load (lw) through va_data (a store is also attempted).

Load page fault (scause = 13); the store raises a store/AMO page fault (scause = 15).

PTE_XnoRW_d x PageType_d x load_page_fault x read_acc x mxr_sstatus x mode {U-mode}
= 7 bins on RV64, 2 on RV32

sstatus_mxr_sz sstatus_mxr_acc sstatus_mxr_op sfence_vma_sum_mxr_effect Sv39_leaf_any_level Sv39_page_sizes Sv48_leaf_any_level Sv48_page_sizes Sv57_leaf_any_level Sv57_page_sizes stval_op_faulting_addr

mstatus_mxr_op
sstatus_mxr
sfence_vma_sum_mxr_effect
[norm:sstatus_mxr_sz] [norm:sstatus_mxr_acc] [norm:sstatus_mxr_op] [norm:sfence_vma_sum_mxr_effect] [norm:Sv39_leaf_any_level] [norm:Sv39_page_sizes] [norm:Sv48_leaf_any_level] [norm:Sv48_page_sizes] [norm:Sv57_leaf_any_level] [norm:Sv57_page_sizes] [norm:stval_op_faulting_addr]

cp_xpage_mxrset_read_s

Verify an S-mode load from an execute-only page succeeds when sstatus.MXR=1

S-mode: execute-only leaf PTE (R=W=0, X=1) with PTE.U=0, at every page-table level (4 KiB page and each superpage size of the Sv mode); set sstatus.MXR. Load (lw) through va_data (a store is also attempted).

The load succeeds; the store still raises a store/AMO page fault (scause = 15).

PTE_XnoRW_d x PageType_d x mxr_sstatus x read_acc x mode {S-mode}
= 7 bins on RV64, 2 on RV32

sstatus_mxr_sz sstatus_mxr_acc sstatus_mxr_op sfence_vma_sum_mxr_effect Sv39_leaf_any_level Sv39_page_sizes Sv48_leaf_any_level Sv48_page_sizes Sv57_leaf_any_level Sv57_page_sizes

mstatus_mxr_op
sstatus_mxr
sfence_vma_sum_mxr_effect
[norm:sstatus_mxr_sz] [norm:sstatus_mxr_acc] [norm:sstatus_mxr_op] [norm:sfence_vma_sum_mxr_effect] [norm:Sv39_leaf_any_level] [norm:Sv39_page_sizes] [norm:Sv48_leaf_any_level] [norm:Sv48_page_sizes] [norm:Sv57_leaf_any_level] [norm:Sv57_page_sizes]

cp_xpage_mxrset_read_u

Verify a U-mode load from an execute-only page succeeds when sstatus.MXR=1

U-mode: execute-only leaf PTE (R=W=0, X=1) with PTE.U=1, at every page-table level (4 KiB page and each superpage size of the Sv mode); set sstatus.MXR. Load (lw) through va_data (a store is also attempted).

The load succeeds; the store still raises a store/AMO page fault (scause = 15).

PTE_XnoRW_d x PageType_d x mxr_sstatus x read_acc x mode {U-mode}
= 7 bins on RV64, 2 on RV32

sstatus_mxr_sz sstatus_mxr_acc sstatus_mxr_op sfence_vma_sum_mxr_effect Sv39_leaf_any_level Sv39_page_sizes Sv48_leaf_any_level Sv48_page_sizes Sv57_leaf_any_level Sv57_page_sizes

mstatus_mxr_op
sstatus_mxr
sfence_vma_sum_mxr_effect
[norm:sstatus_mxr_sz] [norm:sstatus_mxr_acc] [norm:sstatus_mxr_op] [norm:sfence_vma_sum_mxr_effect] [norm:Sv39_leaf_any_level] [norm:Sv39_page_sizes] [norm:Sv48_leaf_any_level] [norm:Sv48_page_sizes] [norm:Sv57_leaf_any_level] [norm:Sv57_page_sizes]

cp_PTE_DAU_nleaf_read_s

Verify D, A or U set in a non-leaf PTE raises a load page fault on a load from S-mode

S-mode: valid level-0 leaf PTE (PTE.U=0); in each non-leaf PTE above it, set D, then A, then U (one at a time). Load (lw) from the page through va_data. Requires privileged spec 1.12 or later.

Load page fault (scause = 13); stval = faulting virtual address.

PTE_DAU_d x PageType_d x load_page_fault x mode {S-mode}
= 15 bins on RV64, 3 on RV32

Sv39_leaf_any_level Sv39_page_sizes Sv48_leaf_any_level Sv48_page_sizes Sv57_leaf_any_level Sv57_page_sizes stval_op_faulting_addr

[norm:Sv39_leaf_any_level] [norm:Sv39_page_sizes] [norm:Sv48_leaf_any_level] [norm:Sv48_page_sizes] [norm:Sv57_leaf_any_level] [norm:Sv57_page_sizes] [norm:stval_op_faulting_addr]

cp_PTE_DAU_nleaf_read_u

Verify D, A or U set in a non-leaf PTE raises a load page fault on a load from U-mode

U-mode: valid level-0 leaf PTE (PTE.U=1); in each non-leaf PTE above it, set D, then A, then U (one at a time). Load (lw) from the page through va_data. Requires privileged spec 1.12 or later.

Load page fault (scause = 13); stval = faulting virtual address.

PTE_DAU_d x PageType_d x load_page_fault x mode {U-mode}
= 15 bins on RV64, 3 on RV32

Sv39_leaf_any_level Sv39_page_sizes Sv48_leaf_any_level Sv48_page_sizes Sv57_leaf_any_level Sv57_page_sizes stval_op_faulting_addr

[norm:Sv39_leaf_any_level] [norm:Sv39_page_sizes] [norm:Sv48_leaf_any_level] [norm:Sv48_page_sizes] [norm:Sv57_leaf_any_level] [norm:Sv57_page_sizes] [norm:stval_op_faulting_addr]

cp_PTE_DAU_nleaf_write_s

Verify D, A or U set in a non-leaf PTE raises a store/AMO page fault on a store from S-mode

S-mode: valid level-0 leaf PTE (PTE.U=0); in each non-leaf PTE above it, set D, then A, then U (one at a time). Store (sw) to the page through va_data. Requires privileged spec 1.12 or later.

Store/AMO page fault (scause = 15); stval = faulting virtual address.

PTE_DAU_d x PageType_d x store_page_fault x mode {S-mode}
= 15 bins on RV64, 3 on RV32

Sv39_leaf_any_level Sv39_page_sizes Sv48_leaf_any_level Sv48_page_sizes Sv57_leaf_any_level Sv57_page_sizes stval_op_faulting_addr

[norm:Sv39_leaf_any_level] [norm:Sv39_page_sizes] [norm:Sv48_leaf_any_level] [norm:Sv48_page_sizes] [norm:Sv57_leaf_any_level] [norm:Sv57_page_sizes] [norm:stval_op_faulting_addr]

cp_PTE_DAU_nleaf_write_u

Verify D, A or U set in a non-leaf PTE raises a store/AMO page fault on a store from U-mode

U-mode: valid level-0 leaf PTE (PTE.U=1); in each non-leaf PTE above it, set D, then A, then U (one at a time). Store (sw) to the page through va_data. Requires privileged spec 1.12 or later.

Store/AMO page fault (scause = 15); stval = faulting virtual address.

PTE_DAU_d x PageType_d x store_page_fault x mode {U-mode}
= 15 bins on RV64, 3 on RV32

Sv39_leaf_any_level Sv39_page_sizes Sv48_leaf_any_level Sv48_page_sizes Sv57_leaf_any_level Sv57_page_sizes stval_op_faulting_addr

[norm:Sv39_leaf_any_level] [norm:Sv39_page_sizes] [norm:Sv48_leaf_any_level] [norm:Sv48_page_sizes] [norm:Sv57_leaf_any_level] [norm:Sv57_page_sizes] [norm:stval_op_faulting_addr]

cp_PTE_DAU_nleaf_exec_s

Verify D, A or U set in a non-leaf PTE raises an instruction page fault on an instruction fetch from S-mode

S-mode: valid level-0 leaf PTE (PTE.U=0); in each non-leaf PTE above it, set D, then A, then U (one at a time). Jump (jalr) into the page through va_data. Requires privileged spec 1.12 or later.

Instruction page fault (scause = 12); stval = faulting virtual address.

PTE_DAU_i x PageType_i x ins_page_fault x mode {S-mode}
= 15 bins on RV64, 3 on RV32

Sv39_leaf_any_level Sv39_page_sizes Sv48_leaf_any_level Sv48_page_sizes Sv57_leaf_any_level Sv57_page_sizes stval_op_faulting_addr

[norm:Sv39_leaf_any_level] [norm:Sv39_page_sizes] [norm:Sv48_leaf_any_level] [norm:Sv48_page_sizes] [norm:Sv57_leaf_any_level] [norm:Sv57_page_sizes] [norm:stval_op_faulting_addr]

cp_PTE_DAU_nleaf_exec_u

Verify D, A or U set in a non-leaf PTE raises an instruction page fault on an instruction fetch from U-mode

U-mode: valid level-0 leaf PTE (PTE.U=1); in each non-leaf PTE above it, set D, then A, then U (one at a time). Jump (jalr) into the page through va_data. Requires privileged spec 1.12 or later.

Instruction page fault (scause = 12); stval = faulting virtual address.

PTE_DAU_i x PageType_i x ins_page_fault x mode {U-mode}
= 15 bins on RV64, 3 on RV32

Sv39_leaf_any_level Sv39_page_sizes Sv48_leaf_any_level Sv48_page_sizes Sv57_leaf_any_level Sv57_page_sizes stval_op_faulting_addr

[norm:Sv39_leaf_any_level] [norm:Sv39_page_sizes] [norm:Sv48_leaf_any_level] [norm:Sv48_page_sizes] [norm:Sv57_leaf_any_level] [norm:Sv57_page_sizes] [norm:stval_op_faulting_addr]

cp_PTE_rsv_nleaf_read_s

Verify any of bits 63:54 set in a non-leaf PTE raises a load page fault on a load from S-mode

RV64, S-mode: valid level-0 leaf PTE; in each non-leaf PTE above it, set each of bits 63 (N), 62:61 (PBMT), and 60:54 in turn. These bits are reserved in non-leaf PTEs whether or not Svnapot and Svpbmt are implemented. Load (lw) from the page through va_data. Requires privileged spec 1.12 or later.

Load page fault (scause = 13); stval = faulting virtual address.

PTE_nonleaf_d x PTE_nonleaf_rsv_d x PageType_d x load_page_fault x mode {S-mode}
= 50 bins on RV64 (RV64 only)

Sv39_pte_future_rsv Svpbmt_nonleaf_pte_pbmt_must_be_zero stval_op_faulting_addr

Sv39_pte_future_rsv
[norm:Sv39_pte_future_rsv] [norm:Svpbmt_nonleaf_pte_pbmt_must_be_zero] [norm:stval_op_faulting_addr]

cp_PTE_rsv_nleaf_write_s

Verify any of bits 63:54 set in a non-leaf PTE raises a store/AMO page fault on a store from S-mode

RV64, S-mode: valid level-0 leaf PTE; in each non-leaf PTE above it, set each of bits 63 (N), 62:61 (PBMT), and 60:54 in turn. These bits are reserved in non-leaf PTEs whether or not Svnapot and Svpbmt are implemented. Store (sw) to the page through va_data. Requires privileged spec 1.12 or later.

Store/AMO page fault (scause = 15); stval = faulting virtual address.

PTE_nonleaf_d x PTE_nonleaf_rsv_d x PageType_d x store_page_fault x mode {S-mode}
= 50 bins on RV64 (RV64 only)

Sv39_pte_future_rsv Svpbmt_nonleaf_pte_pbmt_must_be_zero stval_op_faulting_addr

Sv39_pte_future_rsv
[norm:Sv39_pte_future_rsv] [norm:Svpbmt_nonleaf_pte_pbmt_must_be_zero] [norm:stval_op_faulting_addr]

cp_PTE_rsv_nleaf_exec_s

Verify any of bits 63:54 set in a non-leaf PTE raises an instruction page fault on an instruction fetch from S-mode

RV64, S-mode: valid level-0 leaf PTE; in each non-leaf PTE above it, set each of bits 63 (N), 62:61 (PBMT), and 60:54 in turn. These bits are reserved in non-leaf PTEs whether or not Svnapot and Svpbmt are implemented. Jump (jalr) into the page through va_data. Requires privileged spec 1.12 or later.

Instruction page fault (scause = 12); stval = faulting virtual address.

PTE_nonleaf_i x PTE_nonleaf_rsv_i x PageType_i x ins_page_fault x mode {S-mode}
= 50 bins on RV64 (RV64 only)

Sv39_pte_future_rsv Svpbmt_nonleaf_pte_pbmt_must_be_zero stval_op_faulting_addr

Sv39_pte_future_rsv
[norm:Sv39_pte_future_rsv] [norm:Svpbmt_nonleaf_pte_pbmt_must_be_zero] [norm:stval_op_faulting_addr]

cp_misaligned_exec_s

Verify a misaligned superpage raises an instruction page fault on an instruction fetch from S-mode

S-mode: superpage leaf PTE (level 1 and above) with PTE.U=0 whose PPN has non-zero bits below the superpage size, at each superpage level. Jump (jalr) into the page through va_data.

Instruction page fault (scause = 12); stval = faulting virtual address.

PTE_RWX_i x misaligned_PPN_i x ins_page_fault x exec_acc
= 5 bins on RV64, 1 on RV32

Sv39_superpage_align Sv39_superpage_align_fault Sv48_superpage_align Sv48_superpage_align_fault Sv57_superpage_align Sv57_superpage_align_fault stval_op_faulting_addr

Sv39_superpage_align
Sv39_superpage_align_fault
Sv48_superpage_align
Sv48_superpage_align_fault
[norm:Sv39_superpage_align] [norm:Sv39_superpage_align_fault] [norm:Sv48_superpage_align] [norm:Sv48_superpage_align_fault] [norm:Sv57_superpage_align] [norm:Sv57_superpage_align_fault] [norm:stval_op_faulting_addr]

cp_misaligned_exec_u

Verify a misaligned superpage raises an instruction page fault on an instruction fetch from U-mode

U-mode: superpage leaf PTE (level 1 and above) with PTE.U=1 whose PPN has non-zero bits below the superpage size, at each superpage level. Jump (jalr) into the page through va_data.

Instruction page fault (scause = 12); stval = faulting virtual address.

PTE_RWX_i x misaligned_PPN_i x ins_page_fault x exec_acc
= 5 bins on RV64, 1 on RV32

Sv39_superpage_align Sv39_superpage_align_fault Sv48_superpage_align Sv48_superpage_align_fault Sv57_superpage_align Sv57_superpage_align_fault stval_op_faulting_addr

[norm:Sv39_superpage_align] [norm:Sv39_superpage_align_fault] [norm:Sv48_superpage_align] [norm:Sv48_superpage_align_fault] [norm:Sv57_superpage_align] [norm:Sv57_superpage_align_fault] [norm:stval_op_faulting_addr]

cp_misaligned_read_s

Verify a misaligned superpage raises a load page fault on a load from S-mode

S-mode: superpage leaf PTE (level 1 and above) with PTE.U=0 whose PPN has non-zero bits below the superpage size, at each superpage level. Load (lw) from the page through va_data.

Load page fault (scause = 13); stval = faulting virtual address.

PTE_RWX_d x misaligned_PPN_d x load_page_fault x read_acc
= 5 bins on RV64, 1 on RV32

Sv39_superpage_align Sv39_superpage_align_fault Sv48_superpage_align Sv48_superpage_align_fault Sv57_superpage_align Sv57_superpage_align_fault stval_op_faulting_addr

Sv39_superpage_align
Sv39_superpage_align_fault
Sv48_superpage_align
Sv48_superpage_align_fault
[norm:Sv39_superpage_align] [norm:Sv39_superpage_align_fault] [norm:Sv48_superpage_align] [norm:Sv48_superpage_align_fault] [norm:Sv57_superpage_align] [norm:Sv57_superpage_align_fault] [norm:stval_op_faulting_addr]

cp_misaligned_read_u

Verify a misaligned superpage raises a load page fault on a load from U-mode

U-mode: superpage leaf PTE (level 1 and above) with PTE.U=1 whose PPN has non-zero bits below the superpage size, at each superpage level. Load (lw) from the page through va_data.

Load page fault (scause = 13); stval = faulting virtual address.

PTE_RWX_d x misaligned_PPN_d x load_page_fault x read_acc
= 5 bins on RV64, 1 on RV32

Sv39_superpage_align Sv39_superpage_align_fault Sv48_superpage_align Sv48_superpage_align_fault Sv57_superpage_align Sv57_superpage_align_fault stval_op_faulting_addr

[norm:Sv39_superpage_align] [norm:Sv39_superpage_align_fault] [norm:Sv48_superpage_align] [norm:Sv48_superpage_align_fault] [norm:Sv57_superpage_align] [norm:Sv57_superpage_align_fault] [norm:stval_op_faulting_addr]

cp_misaligned_write_s

Verify a misaligned superpage raises a store/AMO page fault on a store from S-mode

S-mode: superpage leaf PTE (level 1 and above) with PTE.U=0 whose PPN has non-zero bits below the superpage size, at each superpage level. Store (sw) to the page through va_data.

Store/AMO page fault (scause = 15); stval = faulting virtual address.

PTE_RWX_d x misaligned_PPN_d x store_page_fault x write_acc
= 5 bins on RV64, 1 on RV32

Sv39_superpage_align Sv39_superpage_align_fault Sv48_superpage_align Sv48_superpage_align_fault Sv57_superpage_align Sv57_superpage_align_fault stval_op_faulting_addr

Sv39_superpage_align
Sv39_superpage_align_fault
Sv48_superpage_align
Sv48_superpage_align_fault
[norm:Sv39_superpage_align] [norm:Sv39_superpage_align_fault] [norm:Sv48_superpage_align] [norm:Sv48_superpage_align_fault] [norm:Sv57_superpage_align] [norm:Sv57_superpage_align_fault] [norm:stval_op_faulting_addr]

cp_misaligned_write_u

Verify a misaligned superpage raises a store/AMO page fault on a store from U-mode

U-mode: superpage leaf PTE (level 1 and above) with PTE.U=1 whose PPN has non-zero bits below the superpage size, at each superpage level. Store (sw) to the page through va_data.

Store/AMO page fault (scause = 15); stval = faulting virtual address.

PTE_RWX_d x misaligned_PPN_d x store_page_fault x write_acc
= 5 bins on RV64, 1 on RV32

Sv39_superpage_align Sv39_superpage_align_fault Sv48_superpage_align Sv48_superpage_align_fault Sv57_superpage_align Sv57_superpage_align_fault stval_op_faulting_addr

[norm:Sv39_superpage_align] [norm:Sv39_superpage_align_fault] [norm:Sv48_superpage_align] [norm:Sv48_superpage_align_fault] [norm:Sv57_superpage_align] [norm:Sv57_superpage_align_fault] [norm:stval_op_faulting_addr]

cp_canonical_read_s

Verify a non-canonical virtual address raises a load page fault on a load from S-mode

RV64 (Sv39/48/57), S-mode: va_data has bit 63 set, so its upper bits are not a sign extension of the top VA bit. Valid RWX leaf PTE with PTE.U=0 for the canonical part, at every page-table level (4 KiB page and each superpage size of the Sv mode). Load (lw) from the page through va_data.

Load page fault (scause = 13); stval = faulting virtual address.

PTE_canonical_d x canonical_page_d x load_page_fault x read_acc
= 7 bins on RV64 (RV64 only)

Sv39_va_signext Sv48_va_signext Sv57_va_signext stval_op_faulting_addr

Sv39_va_signext
Sv48_va_signext
[norm:Sv39_va_signext] [norm:Sv48_va_signext] [norm:Sv57_va_signext] [norm:stval_op_faulting_addr]

cp_canonical_read_u

Verify a non-canonical virtual address raises a load page fault on a load from U-mode

RV64 (Sv39/48/57), U-mode: va_data has bit 63 set, so its upper bits are not a sign extension of the top VA bit. Valid RWX leaf PTE with PTE.U=1 for the canonical part, at every page-table level (4 KiB page and each superpage size of the Sv mode). Load (lw) from the page through va_data.

Load page fault (scause = 13); stval = faulting virtual address.

PTE_canonical_d x canonical_page_d x load_page_fault x read_acc
= 7 bins on RV64 (RV64 only)

Sv39_va_signext Sv48_va_signext Sv57_va_signext stval_op_faulting_addr

[norm:Sv39_va_signext] [norm:Sv48_va_signext] [norm:Sv57_va_signext] [norm:stval_op_faulting_addr]

cp_canonical_write_s

Verify a non-canonical virtual address raises a store/AMO page fault on a store from S-mode

RV64 (Sv39/48/57), S-mode: va_data has bit 63 set, so its upper bits are not a sign extension of the top VA bit. Valid RWX leaf PTE with PTE.U=0 for the canonical part, at every page-table level (4 KiB page and each superpage size of the Sv mode). Store (sw) to the page through va_data.

Store/AMO page fault (scause = 15); stval = faulting virtual address.

PTE_canonical_d x canonical_page_d x store_page_fault x write_acc
= 7 bins on RV64 (RV64 only)

Sv39_va_signext Sv48_va_signext Sv57_va_signext stval_op_faulting_addr

Sv39_va_signext
Sv48_va_signext
[norm:Sv39_va_signext] [norm:Sv48_va_signext] [norm:Sv57_va_signext] [norm:stval_op_faulting_addr]

cp_canonical_write_u

Verify a non-canonical virtual address raises a store/AMO page fault on a store from U-mode

RV64 (Sv39/48/57), U-mode: va_data has bit 63 set, so its upper bits are not a sign extension of the top VA bit. Valid RWX leaf PTE with PTE.U=1 for the canonical part, at every page-table level (4 KiB page and each superpage size of the Sv mode). Store (sw) to the page through va_data.

Store/AMO page fault (scause = 15); stval = faulting virtual address.

PTE_canonical_d x canonical_page_d x store_page_fault x write_acc
= 7 bins on RV64 (RV64 only)

Sv39_va_signext Sv48_va_signext Sv57_va_signext stval_op_faulting_addr

[norm:Sv39_va_signext] [norm:Sv48_va_signext] [norm:Sv57_va_signext] [norm:stval_op_faulting_addr]

cp_canonical_exec_s

Verify a non-canonical virtual address raises an instruction page fault on an instruction fetch from S-mode

RV64 (Sv39/48/57), S-mode: va_data has bit 63 set, so its upper bits are not a sign extension of the top VA bit. Valid RWX leaf PTE with PTE.U=0 for the canonical part, at every page-table level (4 KiB page and each superpage size of the Sv mode). Jump (jalr) into the page through va_data.

Instruction page fault (scause = 12); stval = faulting virtual address.

PTE_canonical_i x canonical_page_i x ins_page_fault x exec_acc
= 7 bins on RV64 (RV64 only)

Sv39_va_signext Sv48_va_signext Sv57_va_signext stval_op_faulting_addr

Sv39_va_signext
Sv48_va_signext
[norm:Sv39_va_signext] [norm:Sv48_va_signext] [norm:Sv57_va_signext] [norm:stval_op_faulting_addr]

cp_canonical_exec_u

Verify a non-canonical virtual address raises an instruction page fault on an instruction fetch from U-mode

RV64 (Sv39/48/57), U-mode: va_data has bit 63 set, so its upper bits are not a sign extension of the top VA bit. Valid RWX leaf PTE with PTE.U=1 for the canonical part, at every page-table level (4 KiB page and each superpage size of the Sv mode). Jump (jalr) into the page through va_data.

Instruction page fault (scause = 12); stval = faulting virtual address.

PTE_canonical_i x canonical_page_i x ins_page_fault x exec_acc
= 7 bins on RV64 (RV64 only)

Sv39_va_signext Sv48_va_signext Sv57_va_signext stval_op_faulting_addr

[norm:Sv39_va_signext] [norm:Sv48_va_signext] [norm:Sv57_va_signext] [norm:stval_op_faulting_addr]

cp_rsw_pte

Verify the RSW bits (PTE[9:8]) are ignored by the implementation

S-mode and U-mode: leaf PTE with RSW = 01, 10 and 11, at every page-table level (4 KiB page and each superpage size of the Sv mode). Store, load and fetch through va_data, then read the PTE back from the page table.

No fault; the PTE reads back with RSW unchanged.

RSW x mode
= 12 bins on RV64, 4 on RV32

pte_rsw_ignored

cp_global_read_s

Verify a global mapping (G=1) survives an ASID-specific SFENCE.VMA for a load from S-mode

S-mode: global leaf PTE (G=1) with PTE.U=0, at every page-table level (4 KiB page and each superpage size of the Sv mode). Load (lw) from the page through va_data, execute sfence.vma x0, rs2 with the current ASID, then repeat the access.

No fault on either access.

global_PTE_d x PageType_d x read_acc
= 7 bins on RV64, 2 on RV32

sfence_vma_asid_only

pte_g_op
[norm:sfence_vma_asid_only]

cp_global_read_u

Verify a global mapping (G=1) survives an ASID-specific SFENCE.VMA for a load from U-mode

U-mode: global leaf PTE (G=1) with PTE.U=1, at every page-table level (4 KiB page and each superpage size of the Sv mode). Load (lw) from the page through va_data, execute sfence.vma x0, rs2 with the current ASID, then repeat the access.

No fault on either access.

global_PTE_d x PageType_d x read_acc
= 7 bins on RV64, 2 on RV32

sfence_vma_asid_only

pte_g_op
[norm:sfence_vma_asid_only]

cp_global_write_s

Verify a global mapping (G=1) survives an ASID-specific SFENCE.VMA for a store from S-mode

S-mode: global leaf PTE (G=1) with PTE.U=0, at every page-table level (4 KiB page and each superpage size of the Sv mode). Store (sw) to the page through va_data, execute sfence.vma x0, rs2 with the current ASID, then repeat the access.

No fault on either access.

global_PTE_d x PageType_d x write_acc
= 7 bins on RV64, 2 on RV32

sfence_vma_asid_only

pte_g_op
[norm:sfence_vma_asid_only]

cp_global_write_u

Verify a global mapping (G=1) survives an ASID-specific SFENCE.VMA for a store from U-mode

U-mode: global leaf PTE (G=1) with PTE.U=1, at every page-table level (4 KiB page and each superpage size of the Sv mode). Store (sw) to the page through va_data, execute sfence.vma x0, rs2 with the current ASID, then repeat the access.

No fault on either access.

global_PTE_d x PageType_d x write_acc
= 7 bins on RV64, 2 on RV32

sfence_vma_asid_only

[norm:sfence_vma_asid_only]

cp_global_exec_s

Verify a global mapping (G=1) survives an ASID-specific SFENCE.VMA for an instruction fetch from S-mode

S-mode: global leaf PTE (G=1) with PTE.U=0, at every page-table level (4 KiB page and each superpage size of the Sv mode). Jump (jalr) into the page through va_data, execute sfence.vma x0, rs2 with the current ASID, then repeat the access.

No fault on either access.

global_PTE_i x PageType_i x exec_acc
= 7 bins on RV64, 2 on RV32

sfence_vma_asid_only

pte_g_op
[norm:sfence_vma_asid_only]

cp_global_exec_u

Verify a global mapping (G=1) survives an ASID-specific SFENCE.VMA for an instruction fetch from U-mode

U-mode: global leaf PTE (G=1) with PTE.U=1, at every page-table level (4 KiB page and each superpage size of the Sv mode). Jump (jalr) into the page through va_data, execute sfence.vma x0, rs2 with the current ASID, then repeat the access.

No fault on either access.

global_PTE_i x PageType_i x exec_acc
= 7 bins on RV64, 2 on RV32

sfence_vma_asid_only

[norm:sfence_vma_asid_only]

cp_svnapot_read_fault

Verify PTE.N (bit 63) is reserved when Svnapot is not implemented, for a load

RV64, S-mode: level-0 leaf PTE with N=1 and PPN[3:0]=1000. Load (lw) from the page through va_data.

Without Svnapot: load page fault (scause = 13). With Svnapot the encoding is a valid 64 KiB NAPOT mapping and the access succeeds.

svnapot_PTE_d x load_page_fault x read_acc x mode

Sv39_pte_svnapot_rsv

Sv39_pte_Svnapot_rsv
[norm:Sv39_pte_svnapot_rsv]

cp_svnapot_write_fault

Verify PTE.N (bit 63) is reserved when Svnapot is not implemented, for a store

RV64, S-mode: level-0 leaf PTE with N=1 and PPN[3:0]=1000. Store (sw) to the page through va_data.

Without Svnapot: store/AMO page fault (scause = 15). With Svnapot the encoding is a valid 64 KiB NAPOT mapping and the access succeeds.

svnapot_PTE_d x store_page_fault x write_acc x mode

Sv39_pte_svnapot_rsv

Sv39_pte_Svnapot_rsv
[norm:Sv39_pte_svnapot_rsv]

cp_svnapot_exec_fault

Verify PTE.N (bit 63) is reserved when Svnapot is not implemented, for an instruction fetch

RV64, S-mode: level-0 leaf PTE with N=1 and PPN[3:0]=1000. Jump (jalr) into the page through va_data.

Without Svnapot: instruction page fault (scause = 12). With Svnapot the encoding is a valid 64 KiB NAPOT mapping and the access succeeds.

svnapot_PTE_i x ins_page_fault x exec_acc x mode

Sv39_pte_svnapot_rsv

Sv39_pte_Svnapot_rsv
[norm:Sv39_pte_svnapot_rsv]

cp_svpbmt_read_fault

Verify PBMT (bits 62:61) is reserved when menvcfg.PBMTE=0, for a load

RV64, S-mode: clear menvcfg.PBMTE through T-SBI. Top-level leaf PTE with PBMT = 1, 2 and 3. Load (lw) from the page through va_data.

Load page fault (scause = 13); stval = faulting virtual address.

svpbmt_PTE_d x load_page_fault x read_acc x mode x PBMTE_unset
= 9 bins on RV64 (RV64 only)

Sv39_pte_svpbmt_rsv menvcfg_pbmte_op

Sv39_pte_Svpbmt_rsv
menvcfg_pbmte_op
[norm:Sv39_pte_svpbmt_rsv] [norm:menvcfg_pbmte_op]

cp_svpbmt_write_fault

Verify PBMT (bits 62:61) is reserved when menvcfg.PBMTE=0, for a store

RV64, S-mode: clear menvcfg.PBMTE through T-SBI. Top-level leaf PTE with PBMT = 1, 2 and 3. Store (sw) to the page through va_data.

Store/AMO page fault (scause = 15); stval = faulting virtual address.

svpbmt_PTE_d x store_page_fault x write_acc x mode x PBMTE_unset
= 9 bins on RV64 (RV64 only)

Sv39_pte_svpbmt_rsv menvcfg_pbmte_op

Sv39_pte_Svpbmt_rsv
menvcfg_pbmte_op
[norm:Sv39_pte_svpbmt_rsv] [norm:menvcfg_pbmte_op]

cp_svpbmt_exec_fault

Verify PBMT (bits 62:61) is reserved when menvcfg.PBMTE=0, for an instruction fetch

RV64, S-mode: clear menvcfg.PBMTE through T-SBI. Top-level leaf PTE with PBMT = 1, 2 and 3. Jump (jalr) into the page through va_data.

Instruction page fault (scause = 12); stval = faulting virtual address.

svpbmt_PTE_i x ins_page_fault x exec_acc x mode x PBMTE_unset
= 9 bins on RV64 (RV64 only)

Sv39_pte_svpbmt_rsv menvcfg_pbmte_op

Sv39_pte_Svpbmt_rsv
menvcfg_pbmte_op
[norm:Sv39_pte_svpbmt_rsv] [norm:menvcfg_pbmte_op]

cp_reserved_read_fault

Verify reserved PTE bits 60:54 raise a load page fault on a load

RV64, S-mode: top-level leaf PTE with each of bits 60..54 set in turn. Load (lw) from the page through va_data.

Load page fault (scause = 13); stval = faulting virtual address.

reserved_PTE_d x load_page_fault x read_acc x mode
= 21 bins on RV64 (RV64 only)

Sv39_pte_future_rsv

Sv39_pte_future_rsv
[norm:Sv39_pte_future_rsv]

cp_reserved_write_fault

Verify reserved PTE bits 60:54 raise a store/AMO page fault on a store

RV64, S-mode: top-level leaf PTE with each of bits 60..54 set in turn. Store (sw) to the page through va_data.

Store/AMO page fault (scause = 15); stval = faulting virtual address.

reserved_PTE_d x store_page_fault x read_acc x mode
= 21 bins on RV64 (RV64 only)

Sv39_pte_future_rsv

Sv39_pte_future_rsv
[norm:Sv39_pte_future_rsv]

cp_reserved_exec_fault

Verify reserved PTE bits 60:54 raise an instruction page fault on an instruction fetch

RV64, S-mode: top-level leaf PTE with each of bits 60..54 set in turn. Jump (jalr) into the page through va_data.

Instruction page fault (scause = 12); stval = faulting virtual address.

reserved_PTE_i x ins_page_fault x read_acc x mode
= 21 bins on RV64 (RV64 only)

Sv39_pte_future_rsv

Sv39_pte_future_rsv
[norm:Sv39_pte_future_rsv]

cp_read_nofault

Verify a PTE with bits 63:54 all zero translates normally for a load

S-mode and U-mode: loads through valid leaf PTEs whose extension and reserved bits 63:54 are zero (every Sv test).

No fault.

zeros_PTE_d x read_acc x mode
= 3 bins on RV64 (RV64 only)

Sv57_sxlen_va_sz
Sv57_vpn_sz
satp_ppn_Sv57_sz
Sv57_levels
Sv57_page_offset_sz
Sv57_ptesize

cp_write_nofault

Verify a PTE with bits 63:54 all zero translates normally for a store

S-mode and U-mode: stores through valid leaf PTEs whose extension and reserved bits 63:54 are zero (every Sv test).

No fault.

zeros_PTE_d x write_acc x mode
= 3 bins on RV64 (RV64 only)

cp_exec_nofault

Verify a PTE with bits 63:54 all zero translates normally for an instruction fetch

S-mode and U-mode: instruction fetches through valid leaf PTEs whose extension and reserved bits 63:54 are zero (every Sv test).

No fault.

zeros_PTE_i x exec_acc x mode
= 3 bins on RV64 (RV64 only)

Sv57_sxlen_va_sz
Sv57_vpn_sz
satp_ppn_Sv57_sz
Sv57_levels
Sv57_page_offset_sz
Sv57_ptesize

cp_svadu_disabled

Verify translation with hardware A/D updating disabled (menvcfg.ADUE=0)

Sampled on accesses while menvcfg.ADUE (menvcfgh.ADUE on RV32) is 0, which holds in every Sv test.

A and D bits are not updated by hardware.

ADUE_unset x mode
= 3 bins on RV64, 1 on RV32

Svadu_disabled_hw_update_falls_back_to_svade

[norm:Svadu_disabled_hw_update_falls_back_to_svade]

UDB Parameters:

  • REPORT_VA_IN_{MTVAL/STVAL}ON_{INSTRUCTION/LOAD/STORE_AMO}PAGE_FAULT affects result in {MTVAL,STVAL} during page-fault exceptions, such as coverpoints TODO

  • TODO other coverpoints at least SATP_MODE_BARE, TRAP_ON_SFENCE_VMA_WHEN_SATP_MODE_IS_READ_ONLY

Sv_Sm Virtual Memory with M-mode State

The Sm group runs only on configurations with Sm, so it is not part of a certificate without Sm, such as RVA23. It covers mstatus.MPRV accesses, mstatus.TVM trapping of satp and SFENCE.VMA, mstatus.SBE for implicit page-table accesses, and M-mode access to satp. The mstatus.SBE tests are generated but not run until a big-endian configuration is available.

Table 233. Sv_Sm Coverpoints
Coverpoint Goal Feature Description Expectation Bins ID Normative Rule

General Test Environment (Sv_Sm):
- Sm suite: boots to M-mode (BOOT_TO_MMODE) because each coverpoint needs M-mode state (mstatus.MPRV/MPP, mstatus.TVM, mstatus.SBE or an M-mode CSR access). Mode changes use RVTEST_TSBI_GOTO_*.
- These coverpoints were split out of Sv. Faults taken in M-mode are sampled from mcause.
- Run for every supported translation mode: Sv32 on RV32; Sv39, Sv48 and Sv57 on RV64, as selected by the UDB configuration.
- Split from Sv: the M-mode half of cp_access_m_s (now cp_access_m) and all of Sv_mstatus_mprv_cg.

cp_access_m

Verify satp is readable and writable from M-mode with csrrw, csrrs and csrrc

Sv32 and Sv39 configurations, M-mode: csrrw satp with 1, csrrs with 2, csrrc with 1, reading satp back after each; and the same three accesses with satp = 0 while mstatus.TVM=1, which does not restrict M-mode.

No exception; each read returns the value produced by the write.

cp_ins x Mcause x tvm_mstatus x mode {M-mode}
= 6 bins on RV64, 6 on RV32

satp_sz satp_acc satp_op satp_mode

satp
[norm:satp_sz] [norm:satp_acc] [norm:satp_op] [norm:satp_mode]

cp_tvm_exception_s

Verify mstatus.TVM=1 makes satp accesses and SFENCE.VMA illegal in S-mode

M-mode: set mstatus.TVM, read mstatus back, then csrw, csrs and csrc satp with 0. Switch to S-mode with RVTEST_TSBI_GOTO_SMODE, execute csrw, csrs and csrc on satp and sfence.vma, then return with RVTEST_TSBI_GOTO_MMODE.

Illegal-instruction exception (mcause = 2) for each instruction.

tvm_mstatus x Mcause x cp_ins x mode {S-mode}
= 4 bins on RV64, 4 on RV32

mstatus_tvm_op MSTATUS_TVM_WARL

mstatus_tvm_op
mstatus_tvm_warl
[norm:mstatus_tvm_op] [norm:MSTATUS_TVM_WARL]

cp_mprv_load

Verify MPRV=1 translates M-mode loads as if in the MPP mode

M-mode: map va_data at every page-table level (4 KiB page and each superpage size of the Sv mode) (supervisor page for MPP=S, user page for MPP=U). Set mstatus.MPRV=1 with MPP=S, then MPP=U, and load (lw) through va_data. Clear MPRV afterwards.

No fault; the load is translated through va_data.

mprv_mstatus x mpp_mstatus x read_acc x satp_mode x mode {M-mode}
= 6 bins on RV64, 2 on RV32

satp_op_active mstatus_mprv_ldst_op

mstatus_mprv_ldst_op
satp_op_active
[norm:satp_op_active] [norm:mstatus_mprv_ldst_op]

cp_mprv_store

Verify MPRV=1 translates M-mode stores as if in the MPP mode

M-mode: map va_data at every page-table level (4 KiB page and each superpage size of the Sv mode) (supervisor page for MPP=S, user page for MPP=U). Set mstatus.MPRV=1 with MPP=S, then MPP=U, and store (sw) through va_data. Clear MPRV afterwards.

No fault; the store is translated through va_data.

mprv_mstatus x mpp_mstatus x write_acc x satp_mode x mode {M-mode}
= 6 bins on RV64, 2 on RV32

satp_op_active mstatus_mprv_ldst_op

mstatus_mprv_ldst_op
[norm:satp_op_active] [norm:mstatus_mprv_ldst_op]

cp_mprv_ins

Verify MPRV=1 does not translate M-mode instruction fetches

M-mode with mstatus.MPRV=1 and MPP=S, then MPP=U: jump (jalr) to the physical address of the test page.

The fetch uses the physical address and does not fault.

mprv_mstatus x mpp_mstatus x exec_acc x satp_mode x mode {M-mode}
= 6 bins on RV64, 2 on RV32

mstatus_mprv_inst_xlat_op

mstatus_mprv_inst_xlat_op
[norm:mstatus_mprv_inst_xlat_op]

PTE_upage_i

Verify a user leaf PTE is observed on the instruction side during the MPRV tests

Sampled when an instruction fetch walks a user leaf PTE (U=1) during the MPRV/SUM tests.

A valid user leaf PTE (U=1) is seen by the fetch.

PTE_upage_i {leaflvl_u}
= 1 bins on RV64, 1 on RV32

cp_mprv_upage_smode_sumunset_noread

Verify an M-mode load with MPRV=1, MPP=S to a user page faults when mstatus.SUM=0

M-mode with MPRV=1, MPP=S and mstatus.SUM=0: user leaf PTE (U=1) at every page-table level (4 KiB page and each superpage size of the Sv mode). Load (lw) from the page through va_data.

Load page fault (mcause = 13); mtval = faulting virtual address.

mprv_mstatus x mpp_mstatus x read_acc x PTE_upage_d x PageType_d x load_page_fault x sum_sstatus x mode {M-mode}
= 7 bins on RV64, 2 on RV32

mstatus_sum_op mstatus_sum_op_mprv_mpp mtval_vaddr_wr1

mstatus_sum_op_mprv_mpp
mstatus_sum_op
[norm:mstatus_sum_op] [norm:mstatus_sum_op_mprv_mpp] [norm:mtval_vaddr_wr1]

cp_mprv_upage_smode_sumunset_nowrite

Verify an M-mode store with MPRV=1, MPP=S to a user page faults when mstatus.SUM=0

M-mode with MPRV=1, MPP=S and mstatus.SUM=0: user leaf PTE (U=1) at every page-table level (4 KiB page and each superpage size of the Sv mode). Store (sw) to the page through va_data.

Store/AMO page fault (mcause = 15); mtval = faulting virtual address.

mprv_mstatus x mpp_mstatus x write_acc x PTE_upage_d x PageType_d x store_page_fault x sum_sstatus x mode {M-mode}
= 7 bins on RV64, 2 on RV32

mstatus_sum_op mstatus_sum_op_mprv_mpp mtval_vaddr_wr1

mstatus_sum_op_mprv_mpp
mstatus_sum_op
[norm:mstatus_sum_op] [norm:mstatus_sum_op_mprv_mpp] [norm:mtval_vaddr_wr1]

cp_mprv_upage_smode_sumunset_noexec

Verify MPRV=1, MPP=S with mstatus.SUM=0 does not affect M-mode instruction fetch

M-mode with MPRV=1, MPP=S and SUM=0, user page (U=1) mapped at va_data: jump (jalr) to the physical address of the page.

No fault: instruction fetch ignores MPRV.

mprv_mstatus x mpp_mstatus x exec_acc x PageType_i x sum_sstatus x mode {M-mode}
= 7 bins on RV64, 2 on RV32

mstatus_sum_op mstatus_sum_op_mprv_mpp

[norm:mstatus_sum_op] [norm:mstatus_sum_op_mprv_mpp]

cp_mprv_upage_smode_sumset_exec

Verify MPRV=1, MPP=S with mstatus.SUM=1 does not affect M-mode instruction fetch

M-mode with MPRV=1, MPP=S and SUM=1, user page (U=1) mapped at va_data: jump (jalr) to the physical address of the page.

No fault: instruction fetch ignores MPRV.

mprv_mstatus x mpp_mstatus x exec_acc x PageType_i x sum_sstatus x mode {M-mode}
= 7 bins on RV64, 2 on RV32

mstatus_sum_op mstatus_sum_op_mprv_mpp

mstatus_mprv_inst_xlat_op
[norm:mstatus_sum_op] [norm:mstatus_sum_op_mprv_mpp]

cp_mprv_upage_smode_sumset_read

Verify an M-mode load with MPRV=1, MPP=S to a user page succeeds when mstatus.SUM=1

M-mode with MPRV=1, MPP=S and mstatus.SUM=1: user leaf PTE (U=1) at every page-table level (4 KiB page and each superpage size of the Sv mode). Load (lw) from the page through va_data.

No fault.

mprv_mstatus x mpp_mstatus x read_acc x PTE_upage_d x PageType_d x sum_sstatus x mode {M-mode}
= 7 bins on RV64, 2 on RV32

mstatus_sum_op mstatus_sum_op_mprv_mpp

mstatus_sum_op_mprv_mpp
mstatus_sum_op
[norm:mstatus_sum_op] [norm:mstatus_sum_op_mprv_mpp]

cp_mprv_upage_smode_sumset_write

Verify an M-mode store with MPRV=1, MPP=S to a user page succeeds when mstatus.SUM=1

M-mode with MPRV=1, MPP=S and mstatus.SUM=1: user leaf PTE (U=1) at every page-table level (4 KiB page and each superpage size of the Sv mode). Store (sw) to the page through va_data.

No fault.

mprv_mstatus x mpp_mstatus x write_acc x PTE_upage_d x PageType_d x sum_sstatus x mode {M-mode}
= 7 bins on RV64, 2 on RV32

mstatus_sum_op mstatus_sum_op_mprv_mpp

mstatus_sum_op_mprv_mpp
mstatus_sum_op
[norm:mstatus_sum_op] [norm:mstatus_sum_op_mprv_mpp]

cp_mstatus_sbe_read

Verify page-table walks use big-endian PTEs when mstatus.SBE=1 (load)

NORUN until a big-endian configuration exists. M-mode sets mstatus.SBE (mstatush.SBE on RV32) and writes the walk, leaf and identity-map PTEs big-endian, at every page-table level (4 KiB page and each superpage size of the Sv mode). S-mode then does the load through va_data (also with SUM=1 on a user page).

No fault; the walk interprets the big-endian PTEs.

read_acc x PTE_sbe_d x PageType_d x sbe_mstatus
= 28 bins on RV64, 8 on RV32

MSTATUS_SBE_WARL MSTATUSH_SBE_WARL mstatus_sbe_implicit

mstatus_mstatush_xbe_warl
mstatus_sbe_implicit
[norm:MSTATUS_SBE_WARL] [norm:MSTATUSH_SBE_WARL] [norm:mstatus_sbe_implicit]

cp_mstatus_sbe_write

Verify page-table walks use big-endian PTEs when mstatus.SBE=1 (store)

NORUN until a big-endian configuration exists. M-mode sets mstatus.SBE (mstatush.SBE on RV32) and writes the walk, leaf and identity-map PTEs big-endian, at every page-table level (4 KiB page and each superpage size of the Sv mode). S-mode then does the store through va_data (also with SUM=1 on a user page).

No fault; the walk interprets the big-endian PTEs.

write_acc x PTE_sbe_d x PageType_d x sbe_mstatus
= 28 bins on RV64, 8 on RV32

MSTATUS_SBE_WARL MSTATUSH_SBE_WARL mstatus_sbe_implicit

mstatus_mstatush_xbe_warl
mstatus_sbe_implicit
[norm:MSTATUS_SBE_WARL] [norm:MSTATUSH_SBE_WARL] [norm:mstatus_sbe_implicit]

Sv_Zicbo VirtMem + CBOM/CBOZ
Table 234. Sv_Zicbo Coverpoints
Coverpoint Goal Feature Description Expectation Bins ID Normative Rule Status Notes

General Test Environment (Sv_Zicbo):
- T-SBI suite: boots to S-mode (BOOT_TO_SMODE) and drives the test from the boot identity map. The page under test is mapped at va_data. S-mode accesses run from the identity map. U-mode accesses use RVTEST_TSBI_GOTO_UMODE / RVTEST_TSBI_GOTO_SMODE; the handler moves execution to the U-accessible code alias va_rvtest_code_begin (registered with SAVE_AREA_SETUP) and back. menvcfg is written through T-SBI CSR calls. Page faults are delegated to S-mode, so causes are sampled from scause/stval.
- menvcfg.CBCFE/CBIE/CBZE are set through T-SBI; U-mode tests also set senvcfg.
- Run for every supported translation mode: Sv32 on RV32; Sv39, Sv48 and Sv57 on RV64, as selected by the UDB configuration.

cp_zicbop_no_fault_s

Verify prefetch.i/r/w through a valid mapping execute without exception from S-mode

S-mode: RWX leaf PTE with PTE.U=0, at every page-table level (4 KiB page and each superpage size of the Sv mode). Execute prefetch.i, prefetch.r and prefetch.w on va_data.

No exception; prefetches never fault.

zicbop_ins x mode (each supported translation mode) x {S-mode}
= 1 bin per translation mode; a prefetch need not translate, so the PTE and page type are not crossed

cbp_unperm_translate

[norm:cbp_unperm_translate]

cp_zicbop_no_fault_u

Verify prefetch.i/r/w through a valid mapping execute without exception from U-mode

U-mode: RWX leaf PTE with PTE.U=1, at every page-table level (4 KiB page and each superpage size of the Sv mode). Execute prefetch.i, prefetch.r and prefetch.w on va_data.

No exception; prefetches never fault.

zicbop_ins x mode (each supported translation mode) x {U-mode}
= 1 bin per translation mode; a prefetch need not translate, so the PTE and page type are not crossed

cbp_unperm_translate

[norm:cbp_unperm_translate]

cp_PTE_inv_cbo_s

Verify a CBO through an invalid PTE (V=0) raises a store/AMO page fault from S-mode

S-mode: leaf PTE with V=0 and PTE.U=0, at every page-table level (4 KiB page and each superpage size of the Sv mode). Execute cbo.clean, cbo.flush and cbo.inval (Zicbom) or cbo.zero (Zicboz) on va_data.

Store/AMO page fault (scause = 15) for every CBO; stval = faulting virtual address.

PTE_d_inv x PageType_d x store_page_fault x cbo_ins x mode {S-mode}
= 14 bins on RV64, 4 on RV32

fault_excep_csr

fault_excep_csr
cbm_page_fault
[norm:fault_excep_csr]

cp_PTE_inv_cbo_u

Verify a CBO through an invalid PTE (V=0) raises a store/AMO page fault from U-mode

U-mode: leaf PTE with V=0 and PTE.U=1, at every page-table level (4 KiB page and each superpage size of the Sv mode). Execute cbo.clean, cbo.flush and cbo.inval (Zicbom) or cbo.zero (Zicboz) on va_data.

Store/AMO page fault (scause = 15) for every CBO; stval = faulting virtual address.

PTE_d_inv x PageType_d x store_page_fault x cbo_ins x mode {U-mode}
= 14 bins on RV64, 4 on RV32

fault_excep_csr

fault_excep_csr
[norm:fault_excep_csr]

cp_PTE_res_rwx_cbo_s

Verify a CBO through the reserved encoding W=1, R=0 raises a store/AMO page fault from S-mode

S-mode: leaf PTE with W=1, R=0 (with X=1 and with X=0) and PTE.U=0, at every page-table level (4 KiB page and each superpage size of the Sv mode). Execute the CBOs on va_data.

Store/AMO page fault (scause = 15).

PTE_d_res_rwx x PageType_d x store_page_fault x cbo_ins x mode {S-mode}
= 28 bins on RV64, 8 on RV32

cp_PTE_res_rwx_cbo_u

Verify a CBO through the reserved encoding W=1, R=0 raises a store/AMO page fault from U-mode

U-mode: leaf PTE with W=1, R=0 (with X=1 and with X=0) and PTE.U=1, at every page-table level (4 KiB page and each superpage size of the Sv mode). Execute the CBOs on va_data.

Store/AMO page fault (scause = 15).

PTE_d_res_rwx x PageType_d x store_page_fault x cbo_ins x mode {U-mode}
= 28 bins on RV64, 8 on RV32

cp_PTE_nonleaf_lvl0_cbo_s

Verify a CBO through a level-0 pointer PTE raises a store/AMO page fault from S-mode

S-mode: level-0 PTE with V=1, R=W=X=0 and PTE.U=0. Execute the CBOs on va_data.

Store/AMO page fault (scause = 15).

PTE_nonleaf_lvl0_d x kilo_page x mode x store_page_fault x cbo_ins x mode {S-mode}
= 6 bins on RV64, 2 on RV32

cp_PTE_nonleaf_lvl0_cbo_u

Verify a CBO through a level-0 pointer PTE raises a store/AMO page fault from U-mode

U-mode: level-0 PTE with V=1, R=W=X=0 and PTE.U=1. Execute the CBOs on va_data.

Store/AMO page fault (scause = 15).

PTE_nonleaf_lvl0_d x kilo_page x mode x store_page_fault x cbo_ins x mode {U-mode}
= 6 bins on RV64, 2 on RV32

cp_PTE_r_set_w_unset_zicbom_s

Verify Zicbom CBOs succeed with R=1 and W=0 from S-mode

S-mode: RX leaf PTE (R=1, W=0) with PTE.U=0, at every page-table level (4 KiB page and each superpage size of the Sv mode), with sstatus.SUM=0 and SUM=1. Execute cbo.clean, cbo.flush and cbo.inval on va_data.

No exception: Zicbom needs read or write permission.

PTE_r_set_w_unset_spage_d x PageType_d x cbo_ins x sum_sstatus x mode {S-mode}
= 14 bins on RV64, 4 on RV32

cbm_access

cp_PTE_r_set_w_unset_zicbom_u

Verify Zicbom CBOs succeed with R=1 and W=0 from U-mode

U-mode: RX leaf PTE (R=1, W=0) with PTE.U=1, at every page-table level (4 KiB page and each superpage size of the Sv mode). Execute cbo.clean, cbo.flush and cbo.inval on va_data.

No exception: Zicbom needs read or write permission.

PTE_r_set_w_unset_upage_d x PageType_d x cbo_ins x mode {U-mode}
= 7 bins on RV64, 2 on RV32

cbm_access

Zicbom CBOs on an execute-only page

cbm_access

Not tested

Not tested because the outcome is UNSPECIFIED. When a page permits instruction fetch but neither loads nor stores, cmo.adoc (the paragraph after cbm_access) lets the implementation either perform cbo.clean/flush/inval or raise a store page fault, so a test has no single expected result.

cp_PTE_w_unset_zicboz_s

Verify cbo.zero raises a store/AMO page fault with W=0 from S-mode

S-mode: RX leaf PTE (W=0) with PTE.U=0, at every page-table level (4 KiB page and each superpage size of the Sv mode), with sstatus.SUM=0 and SUM=1. Execute cbo.zero on va_data.

Store/AMO page fault (scause = 15).

PTE_w_unset_spage_d x PageType_d x store_page_fault x cbo_ins x sum_sstatus x mode {S-mode}
= 14 bins on RV64, 4 on RV32

cbz_unperm_fault

cbz_unperm_fault
[norm:cbz_unperm_fault]

cp_PTE_w_unset_zicboz_u

Verify cbo.zero raises a store/AMO page fault with W=0 from U-mode

U-mode: RX leaf PTE (W=0) with PTE.U=1, at every page-table level (4 KiB page and each superpage size of the Sv mode). Execute cbo.zero on va_data.

Store/AMO page fault (scause = 15).

PTE_w_unset_upage_d x PageType_d x store_page_fault x cbo_ins x mode {U-mode}
= 7 bins on RV64, 2 on RV32

cbz_unperm_fault

cbz_unperm_fault
[norm:cbz_unperm_fault]

cp_spage_rwx_cbo_u

Verify a U-mode CBO to a supervisor page (U=0) raises a store/AMO page fault

U-mode: supervisor RWX leaf PTE (U=0), at every page-table level (4 KiB page and each superpage size of the Sv mode). Execute the CBOs on va_data.

Store/AMO page fault (scause = 15).

PTE_spage_d x PageType_d x store_page_fault x cbo_ins x mode {U-mode}
= 14 bins on RV64, 4 on RV32

cbm_unperm_fault

cbm_unperm_fault
cbm_page_fault
[norm:cbm_unperm_fault]

cp_upage_sumunset_cbo_s

Verify an S-mode CBO to a user page (U=1) raises a store/AMO page fault when sstatus.SUM=0

S-mode with sstatus.SUM=0: user RWX leaf PTE (U=1), at every page-table level (4 KiB page and each superpage size of the Sv mode). Execute the CBOs on va_data.

Store/AMO page fault (scause = 15).

PTE_upage_d x PageType_d x store_page_fault x cbo_ins x sum_sstatus x mode {S-mode}
= 14 bins on RV64, 4 on RV32

cbm_unperm_fault

cbm_unperm_fault
[norm:cbm_unperm_fault]

cp_Abit_unset_cbo_s

Verify a CBO through a PTE with A=0 raises a store/AMO page fault from S-mode (no hardware A update)

S-mode: leaf PTE with A=0 and PTE.U=0, at every page-table level (4 KiB page and each superpage size of the Sv mode); menvcfg.ADUE=0. Execute the CBOs on va_data.

Store/AMO page fault (scause = 15).

PTE_Abit_unset_d x PageType_d x store_page_fault x cbo_ins x mode {S-mode}
= 14 bins on RV64, 4 on RV32

cbm_unperm_translate cbz_unperm_translate

cbm_unperm_translate
cbz_unperm_translate
[norm:cbm_unperm_translate] [norm:cbz_unperm_translate]

cp_Abit_unset_cbo_u

Verify a CBO through a PTE with A=0 raises a store/AMO page fault from U-mode (no hardware A update)

U-mode: leaf PTE with A=0 and PTE.U=1, at every page-table level (4 KiB page and each superpage size of the Sv mode); menvcfg.ADUE=0. Execute the CBOs on va_data.

Store/AMO page fault (scause = 15).

PTE_Abit_unset_d x PageType_d x store_page_fault x cbo_ins x mode {U-mode}
= 14 bins on RV64, 4 on RV32

cbm_unperm_translate

cbm_unperm_translate
cbz_unperm_translate
[norm:cbm_unperm_translate]

cp_Dbit_unset_zicbom_s

Verify Zicbom CBOs do not check PTE.D from S-mode

S-mode: leaf PTE with A=1, D=0 and PTE.U=0, at every page-table level (4 KiB page and each superpage size of the Sv mode). Execute cbo.clean, cbo.flush and cbo.inval on va_data.

No exception and D is not set.

PTE_Dbit_unset_d x PageType_d x cbo_ins x mode {S-mode}
= 7 bins on RV64, 2 on RV32

cp_Dbit_unset_zicbom_u

Verify Zicbom CBOs do not check PTE.D from U-mode

U-mode: leaf PTE with A=1, D=0 and PTE.U=1, at every page-table level (4 KiB page and each superpage size of the Sv mode). Execute cbo.clean, cbo.flush and cbo.inval on va_data.

No exception and D is not set.

PTE_Dbit_unset_d x PageType_d x cbo_ins x mode {U-mode}
= 7 bins on RV64, 2 on RV32

cp_Dbit_unset_zicboz_s

Verify cbo.zero through a PTE with D=0 raises a store/AMO page fault from S-mode (no hardware D update)

S-mode: leaf PTE with A=1, D=0 and PTE.U=0, at every page-table level (4 KiB page and each superpage size of the Sv mode); menvcfg.ADUE=0. Execute cbo.zero on va_data.

Store/AMO page fault (scause = 15).

PTE_Dbit_unset_d x PageType_d x store_page_fault x cbo_ins x mode {S-mode}
= 7 bins on RV64, 2 on RV32

cbz_unperm_translate

cbz_unperm_translate
[norm:cbz_unperm_translate]

cp_Dbit_unset_zicboz_u

Verify cbo.zero through a PTE with D=0 raises a store/AMO page fault from U-mode (no hardware D update)

U-mode: leaf PTE with A=1, D=0 and PTE.U=1, at every page-table level (4 KiB page and each superpage size of the Sv mode); menvcfg.ADUE=0. Execute cbo.zero on va_data.

Store/AMO page fault (scause = 15).

PTE_Dbit_unset_d x PageType_d x store_page_fault x cbo_ins x mode {U-mode}
= 7 bins on RV64, 2 on RV32

cbz_unperm_translate

cp_misaligned_page_cbo_s

Verify a CBO through a misaligned superpage raises a store/AMO page fault from S-mode

S-mode: superpage leaf PTE with PTE.U=0 whose PPN has non-zero bits below the superpage size, at each superpage level. Execute the CBOs on va_data.

Store/AMO page fault (scause = 15).

PTE_RWX_d x misaligned_PPN_d x store_page_fault x cbo_ins x mode {S-mode}
= 10 bins on RV64, 2 on RV32

cp_misaligned_page_cbo_u

Verify a CBO through a misaligned superpage raises a store/AMO page fault from U-mode

U-mode: superpage leaf PTE with PTE.U=1 whose PPN has non-zero bits below the superpage size, at each superpage level. Execute the CBOs on va_data.

Store/AMO page fault (scause = 15).

PTE_RWX_d x misaligned_PPN_d x store_page_fault x cbo_ins x mode {U-mode}
= 10 bins on RV64, 2 on RV32

cp_PTE_nonleaf_DAU_cbo

Verify a CBO with D, A or U set in a non-leaf PTE raises a store/AMO page fault

S-mode and U-mode: set D, A or U (one at a time) in the non-leaf PTE above a valid leaf. Execute the CBOs on va_data. Requires privileged spec 1.12 or later.

Store/AMO page fault (scause = 15).

PTE_DAU_d x PageType_d x store_page_fault x cbo_ins x mode {S/U-mode}
= 60 bins on RV64, 12 on RV32

cp_leaf_PTE_to_nonexistent_pa_cbo_s

Verify a CBO to a non-existent physical address raises a store/AMO access fault from S-mode

S-mode: valid leaf PTE with PTE.U=0 pointing at RVMODEL_ACCESS_FAULT_ADDRESS_STORE, at every page-table level (4 KiB page and each superpage size of the Sv mode). Execute the CBOs on va_data.

Store/AMO access fault (scause = 7); stval = faulting virtual address.

PTE_RWX_d x d_phys_address_nonexistent x PageType_d x store_acc_fault x cbo_ins x mode {S-mode}
= 14 bins on RV64, 4 on RV32

pma_chk_paddr

pma_chk_paddr
[norm:pma_chk_paddr]

cp_leaf_PTE_to_nonexistent_pa_cbo_u

Verify a CBO to a non-existent physical address raises a store/AMO access fault from U-mode

U-mode: valid leaf PTE with PTE.U=1 pointing at RVMODEL_ACCESS_FAULT_ADDRESS_STORE, at every page-table level (4 KiB page and each superpage size of the Sv mode). Execute the CBOs on va_data.

Store/AMO access fault (scause = 7); stval = faulting virtual address.

PTE_RWX_d x d_phys_address_nonexistent x PageType_d x store_acc_fault x cbo_ins x mode {U-mode}
= 14 bins on RV64, 4 on RV32

pma_chk_paddr

pma_chk_paddr
[norm:pma_chk_paddr]

cp_nonleaf_PTE_to_nonexistent_pa_cbo

Verify a CBO whose page-table walk reads a non-existent physical address raises a store/AMO access fault

S-mode and U-mode: non-leaf PTE pointing at RVMODEL_ACCESS_FAULT_ADDRESS_LOAD instead of the next page table. The page-table read is an implicit load, so the table uses the load access-fault region. Only when RVMODEL_ACCESS_FAULT_ADDRESS_STORE and RVMODEL_ACCESS_FAULT_ADDRESS_LOAD are defined. Execute the CBOs on va_data.

Store/AMO access fault (scause = 7).

pointer_PTE_d x d_phys_address_nonexistent x PageType_d x store_acc_fault x cbo_ins x mode {S/U-mode}
= 20 bins on RV64, 4 on RV32

Sv_Exceptions Virtual Memory Exceptions

The following coverpoints should be exercised in supervisor mode

Table 235. Sv_Exceptions Coverpoints
Coverpoint Goal Feature Description Bins Normative Rule

cp_instr_page_fault_s

Instruction Page Fault

jump to address that causes instruction page fault

cp_load_page_fault_s

Load Page Fault

load from address that causes load page fault

cp_store_page_fault_s

Store Page Fault

store to address that causes store page fault

cp_misaligned_priority_load_s
cp_misaligned_priority_store_s
cp_misaligned_priority_fetch_s

Priority of exceptions

Attempt lw and sw and fetch from memory location causing {access fault and page fault}, {page fault and misaligned}, {access fault, page fault, misaligned}

mcause_exccode_priority_misaligned
exc_priority
ia_fault_exc_on_target

cp_misaligned_load_page_fault_s

Page fault on each part of a misaligned access

Check behavior of a misaligned load spanning a page boundary, in which one of the two pages faults.
Set up two consecutive virtual kilopages, with both combinations of one page RWX=111 and the other RWX=000.
Issue misaligned lw crossing page boundary.
If misaligned accesses are supported, expect a misaligned load fault.
If misaligned access is supported, expect a load page fault.
stval could be 0, or should be the address of the load if the fault occurs in the first page,
or the address of the start of the second virtual page if the fault occurs in the second page.

2 bins

cp_misaligned_store_page_fault_s

Page fault on each part of a misaligned access

Same as cp_misaligned_load_page_fault_u but with sw and store faults.

2 bins

cp_misaligned_instr_page_fault_s

Page fault on each part of a misaligned instruction

Same setup as cp_misaligned_load_page_fault_s
Issue jalr to 4-byte instruction on odd multiple of 2 address spanning the two virtual pages.
If Zca is not supported, expect a misaligned instruction fault.
If Zca is supported, expect a instruction fetch page fault.
See cp_misaligned_load_page_fault_s about possible MTVAL outcomes.

2 bins

The following coverpoints should be exercised in user mode

cp_instr_page_fault_u

Instruction Page Fault

jump to address that causes instruction page fault

cp_load_page_fault_u

Load Page Fault

load from address that causes load page fault

cp_store_page_fault_u

Store Page Fault

store to address that causes store page fault

cp_misaligned_priority_load_u
cp_misaligned_priority_store_u
cp_misaligned_priority_fetch_u

Priority of exceptions

Attempt lw and sw and fetch from memory location causing {access fault and page fault}, {page fault and misaligned}, {access fault, page fault, misaligned}

mcause_exccode_priority_misaligned
exc_priority
ia_fault_exc_on_target

Sv_ExceptionsSm Virtual Memory Exceptions with M-mode State
Table 236. Sv_ExceptionsSm Coverpoints
Coverpoint Goal Feature Description Expectation Normative Rule

The following coverpoints should be exercised in machine mode.

cp_instr_page_fault_m

Instruction Page Fault

jump to address that would cause instruction page fault in non-M-mode because mstatus.MPRV=1 and mstatus.MPP={01, 00}, but no fault occurs because MPRV should not affect instruction fetch in M-mode.

cp_load_page_fault_m

Load Page Fault

load from address that causes load page fault because mstatus.MPRV=1 and mstatus.MPP={01, 00}

cp_store_page_fault_m

Store Page Fault

store to address that causes store page fault because mstatus.MPRV=1 and mstatus.MPP={01, 00}

cp_misaligned_priority_load_m
cp_misaligned_priority_store_m

Priority of exceptions

Attempt lw and sw and fetch from memory location causing {access fault and page fault}, {page fault and misaligned}, {access fault, page fault, misaligned}

M-mode needs MPRV to S or U mode to be able to cause access fault. No fetch fault occurs because MPRV does not affect fetch privilege.

mcause_exccode_priority_misaligned
exc_priority

cp_medeleg_m

Machine mode exception not affected by medeleg

Attempt instruction/load/store page faults crossed crossed with medeleg = [ {1011_0011_1111_1111}, {0}, and 13 different walking 1s]

medeleg should not affect machine mode exceptions. No instruction page fault occurs because MPRV does not affect fetch privilege.

The following coverpoints should be exercised in supervisor mode

cp_medeleg_s

Delegation to supervisor mode

Attempt instruction/load/store page faults crossed crossed with medeleg = [ {1011_0011_1111_1111}, {0}, and 13 different walking 1s]

Should delegate when a 1 is in the appropriate column.

The following coverpoints should be exercised in user mode

cp_medeleg_u

Delegation to supervisor mode

Attempt instruction/load/store page faults crossed crossed with medeleg = [ {1011_0011_1111_1111}, {0}, and 13 different walking 1s]

Should delegate when a 1 is in the appropriate column.

Sv_ExceptionsZalrsc Virtual Memory LR/SC Exceptions

This testplan is for systems supporting supervisor mode and virtual memory. Also requires Zalrsc The following coverpoints should be exercised in supervisor mode

Table 237. Sv_ExceptionsZalrsc Coverpoints
Coverpoint Goal Feature Description Normative Rule

cp_misaligned_priority_s

Priority of exceptions

Attempt lr.w and sc.w from memory location causing {access fault and page fault}, {page fault and misaligned}, {access fault, page fault, misaligned}

mcause_exccode_priority_misaligned
exc_priority
sc_retire_permission
lr_sc_alignment

The following coverpoints should be exercised in user mode

cp_misaligned_priority_u

Priority of exceptions

Attempt lr.w and sc.w from memory location causing {access fault and page fault}, {page fault and misaligned}, {access fault, page fault, misaligned}

mcause_exccode_priority_misaligned
exc_priority
sc_retire_permission
lr_sc_alignment

Sv_ExceptionsZalrscSm Virtual Memory LR/SC Exceptions with M-mode State

This testplan is for systems supporting supervisor mode and virtual memory. Also requires Zalrsc

Table 238. Sv_ExceptionsZalrscSm Coverpoints
Coverpoint Goal Feature Description Notes

The following coverpoints should be exercised in machine mode.

cp_misaligned_priority_m

Priority of exceptions

Attempt lr.w and sc.w from memory location causing {access fault and page fault}, {page fault and misaligned}, {access fault, page fault, misaligned}

M-mode needs MPRV to S or U mode to be able to cause access fault.

cp_medeleg_m

Machine mode exception not affected by medeleg

Attempt lr.w and sc.w causing page faults crossed crossed with medeleg = [ {1011_0011_1111_1111}, {0}, and 13 different walking 1s]

medeleg should not affect machine mode exceptions

The following coverpoints should be exercised in supervisor mode

cp_medeleg_s

Delegation to supervisor mode

Attempt lr.w and sc.w causing page faults crossed crossed with medeleg = [ {1011_0011_1111_1111}, {0}, and 13 different walking 1s]

Should delegate when a 1 is in the appropriate column.

The following coverpoints should be exercised in user mode

cp_medeleg_u

Delegation to supervisor mode

Attempt lr.w and sc.w causing page faults crossed crossed with medeleg = [ {1011_0011_1111_1111}, {0}, and 13 different walking 1s]

Should delegate when a 1 is in the appropriate column.

Sv_ExceptionsZaamo Virtual Memory AMO Exceptions

This testplan is for systems supporting supervisor mode and virtual memory. Also requires Zaamo The following coverpoints should be exercised in supervisor mode

Table 239. Sv_ExceptionsZaamo Coverpoints
Coverpoint Goal Feature Description Normative Rule

cp_misaligned_priority_s

Priority of exceptions

Attempt amoadd.w from memory location causing {access fault and page fault}, {page fault and misaligned}, {access fault, page fault, misaligned}

mcause_exccode_priority_misaligned
exc_priority
amo_alignment
misaligned_atomicity_granule_size

The following coverpoints should be exercised in user mode

cp_misaligned_priority_u

Priority of exceptions

Attempt amoadd.w from memory location causing {access fault and page fault}, {page fault and misaligned}, {access fault, page fault, misaligned}

mcause_exccode_priority_misaligned
exc_priority
amo_alignment
misaligned_atomicity_granule_size

Sv_ExceptionsZaamoSm Virtual Memory AMO Exceptions with M-mode State

This testplan is for systems supporting supervisor mode and virtual memory. Also requires Zaamo

Table 240. Sv_ExceptionsZaamoSm Coverpoints
Coverpoint Goal Feature Description Notes

The following coverpoints should be exercised in machine mode.

cp_misaligned_priority_m

Priority of exceptions

Attempt amoadd.w from memory location causing {access fault and page fault}, {page fault and misaligned}, {access fault, page fault, misaligned}

M-mode needs MPRV to S or U mode to be able to cause access fault.

cp_medeleg_m

Machine mode exception not affected by medeleg

Attempt amoadd.w causing page faults crossed crossed with medeleg = [ {1011_0011_1111_1111}, {0}, and 13 different walking 1s]

medeleg should not affect machine mode exceptions

The following coverpoints should be exercised in supervisor mode

cp_medeleg_s

Delegation to supervisor mode

Attempt amoadd.w causing page faults crossed crossed with medeleg = [ {1011_0011_1111_1111}, {0}, and 13 different walking 1s]

Should delegate when a 1 is in the appropriate column.

The following coverpoints should be exercised in user mode

cp_medeleg_u

Delegation to supervisor mode

Attempt amoadd.w causing page faults crossed crossed with medeleg = [ {1011_0011_1111_1111}, {0}, and 13 different walking 1s]

Should delegate when a 1 is in the appropriate column.

Sv_H Hypervisor 2-Stage Virtual Memory

Sv_H verifies two-stage (VS-stage and G-stage) address translation for guest accesses in VS-mode and VU-mode and for HLV, HLVX and HSV in HS-mode. The group boots to HS-mode with hedeleg = 0, so guest traps are taken in HS-mode, whose trap handler records scause, stval, htval, htinst and hstatus.GVA; only the cp_hedeleg tests delegate page faults to VS-mode. Tests that need M-mode (mstatus.MPRV with MPV = 1, and guest traps taken in M-mode) are in Sv_HSm. Guest code runs at a guest virtual address that the test maps through both stages. A guest access is a store (sw) and a load (lw) of the word at offset 8 of a 4 KiB test page, and a fetch (jalr) of the ret at its start. Loads are checked in the signature after the guest returns to HS-mode, because VU-mode cannot write the signature. VS-stage tests (Sv_H_vsstage_cg) run with hgatp = Bare, G-stage tests (Sv_H_gstage_cg) with vsatp = Bare, and two-stage tests (Sv_H_twostage_cg, Sv_H_hlv_cg) with both paged. After changing a PTE, vsatp or hgatp, the test executes hfence.vvma and hfence.gvma. Leaves are kilopages with V = R = W = X = A = D = 1 unless a row says otherwise. VS-stage leaves have U = 0 for VS-mode and U = 1 for VU-mode; G-stage leaves have U = 1, because every G-stage access is a user-level access. The crosses have a bin for each supported mode: vsatp_mode (Sv32, or Sv39, Sv48 and Sv57), hgatp_mode (Sv32x4, or Sv39x4, Sv48x4 and Sv57x4) and stage_modes (the pairs Sv32/Sv32x4, Sv39/Sv39x4, Sv48/Sv48x4 and Sv57/Sv57x4). The VS-stage, G-stage and two-stage tests run in each mode the hart supports, in separate test files for Sv48/Sv48x4 and Sv57/Sv57x4; the Bare, hedeleg, MODE-field, straddle and fence tests run with Sv32/Sv32x4 or Sv39/Sv39x4. The fetch straddle test (cp_straddle) needs Zca and the load/store straddle test (cp_ldst_straddle) needs a hart that performs misaligned accesses byte by byte; they are separate test files. The GPA-width and non-canonical tests are RV64 only. Sv_H tests Svade (menvcfg.ADUE = henvcfg.ADUE = 0). Svadu_H, Svpbmt_H and Svnapot_H test hardware A/D updates, PBMT and NAPOT in the VS-stage and G-stage. The reference model trace records instructions, registers and CSRs but not PTEs or page-table walks. The coverpoints therefore record each access with its privilege mode, the translation modes, the controls that affect it (SUM, MXR, ADUE, SPVP, hedeleg) and the trap it takes (cause, htinst, htval). The PTE that a testcase uses (permissions, U, A/D, RSW and reserved bits, leaf level, superpage alignment) is set by the test, and its effect is checked by the signature: the loaded word, the trap record, and the PTE read back after an A/D case. The coverage cannot tell apart testcases that differ only in PTE bits with the same outcome, such as RSW = 01 and 11, or reserved bits 60:59 that Svrsw60t59b makes ignored; a hart that mishandles such a bit fails the signature check instead. The vsatp and hgatp PPN, ASID and VMID fields, including hgatp.PPN[1:0] reading as zero in paged modes, are walked by H cp_atpwalk0 and cp_atpwalk1, and mstatus.TVM on hgatp is checked by HSm cp_tvm_hs. Because hgatp.PPN[1:0] are zero, the 16 KiB G-stage root table is always 16 KiB aligned and no misaligned root can be configured.

Table 241. Sv_H Coverpoints
Coverpoint Goal Feature Description Expectation Bins Normative Rule Status Notes

VS-stage translation, hgatp = Bare (Sv_H_vsstage_cg)

cp_vsatp_perm

VS-stage leaf permissions and PTE formats

In VS-mode and VU-mode with hgatp = Bare and vsstatus.SUM = MXR = 0, store, load and fetch through VS-stage leaves with U = 0 and 1 and each legal RWX (RWX, X, RX, RW, R).
In VS-mode, also store, load and fetch through a leaf with V = 0, a level-0 PTE with RWX = 000 (a pointer where a leaf is required), a leaf with RSW = 01, 10 and 11, and on RV64 a leaf with each of PTE bits 60:54 set and with all of them set.

An access succeeds when RWX permits it and U matches the mode (U = 0 in VS-mode with SUM = 0, U = 1 in VU-mode); otherwise it raises an instruction, load or store/AMO page fault (12, 13, 15) in HS-mode with stval = the guest virtual address and htval = 0. A load from an execute-only page faults.
V = 0 and the level-0 pointer raise page faults. RSW is ignored. Reserved bits 60:54 raise page faults, except that bits 60:59 are ignored with Svrsw60t59b.

{VS, VU} x {sw, lw, jalr} x vsatp_mode x hgatp Bare x {no trap, page fault}

H_vm_supported
H_vm_twostage
hgatp_mode_bare
hgatp_mode_bare_trans

cp_vsatp_sum

vsstatus.SUM in VS-mode and VU-mode

In VS-mode with hgatp = Bare and vsstatus.SUM = 1, store, load and fetch through a VS-stage leaf with U = 0 and RWX, and through leaves with U = 1 and each legal RWX. In VU-mode with SUM = 1, store, load and fetch through U = 0 and U = 1 leaves with RWX.

In VS-mode with SUM = 1, loads and stores to U = 1 pages succeed when RWX permits them, and fetches from U = 1 pages raise instruction page faults. SUM does not affect VU-mode, so U = 0 pages still fault there.

{VS, VU} x {sw, lw, jalr} x vsatp_mode x hgatp Bare x vsstatus.SUM {0, 1}

vsstatus_sz_acc_op

cp_vsstatus_mxr

vsstatus.MXR makes VS-stage execute-only pages readable

In VS-mode and VU-mode with hgatp = Bare and vsstatus.MXR = 1, store, load and fetch through an execute-only VS-stage leaf with U = 0 and 1 and vsstatus.SUM = 0 and 1. The MXR = 0 bins come from cp_vsatp_perm and cp_vsatp_sum.

With MXR = 1, the load succeeds when U and SUM permit the access; with MXR = 0 it raises a load page fault. Stores fault, and fetches follow X, U and SUM as in cp_vsatp_sum.

{VS, VU} x lw x vsatp_mode x hgatp Bare x vsstatus.SUM {0, 1} x vsstatus.MXR {0, 1}

vsstatus_mxr_vm
sstatus_mxr_vm

cp_vsatp_svade

Svade in the VS-stage

In VS-mode with hgatp = Bare and menvcfg.ADUE = henvcfg.ADUE = 0, store, load and fetch through VS-stage leaves with A = D = 0 and with D = 0. The leaf is read back after the accesses.

An access with A = 0, or a store with D = 0, raises a page fault and the PTE is unchanged.

VS x {sw, lw, jalr} x vsatp_mode x hgatp Bare x menvcfg.ADUE = henvcfg.ADUE = 0

henvcfg_adue_op

Svadu_H cp_vsatp_adue has the ADUE = 1 cases.

G-stage translation, vsatp = Bare (Sv_H_gstage_cg)

cp_hgatp_perm

G-stage leaf permissions and PTE formats

In VS-mode and VU-mode with vsatp = Bare and sstatus.MXR = vsstatus.MXR = 0, store, load and fetch through G-stage leaves with U = 0 and 1 and each legal RWX.
In VS-mode, also store, load and fetch through a G-stage leaf with V = 0, a level-0 PTE with RWX = 000, a leaf with RSW = 01, 10 and 11, a leaf with G = 1, on RV64 a leaf with each of PTE bits 60:54 set and with all of them set, and a misaligned superpage leaf (low PPN bits nonzero) at each level above 0.

G-stage accesses are user-level, so a U = 0 leaf raises a guest-page fault even from VS-mode. Otherwise an access succeeds when RWX permits it. A G-stage denial raises an instruction, load or store/AMO guest-page fault (20, 21, 23) for the original access type in HS-mode, with stval = the guest virtual address, htval = the guest physical address >> 2 (or zero) and hstatus.GVA = 1.
V = 0, the level-0 pointer, the reserved bits (bits 60:59 are ignored with Svrsw60t59b) and misaligned superpages raise guest-page faults. RSW and G are ignored.

{VS, VU} x {sw, lw, jalr} x vsatp Bare x hgatp_mode x {no trap, guest-page fault}

H_vm_supported
H_vm_twostage
hgatp_mode_bare
hgatp_mode_bare_trans
H_vm_gpatrans
H_vm_gpapriv
H_vm_gpa_g
Svrsw60t59b_H_g_stage_reserved_bits
hgatp_mode_sv39x4
hgatp_mode_sv48x4
hgatp_mode_Sv57x4
htval_trapval
mtval2_htval_virtaddr
hstatus_gva_op
H_guest_page_fault

cp_hgatp_mxr

Only the HS-level MXR makes G-stage execute-only pages readable

In VS-mode and VU-mode with vsatp = Bare, load and fetch through an execute-only G-stage leaf with sstatus.MXR = 0 and 1 and vsstatus.MXR = 0 and 1.

The load succeeds only with sstatus.MXR = 1; otherwise it raises a load guest-page fault. vsstatus.MXR affects only the VS-stage. The fetches succeed.

{VS, VU} x lw x vsatp Bare x hgatp_mode x mstatus.MXR {0, 1} x vsstatus.MXR {0, 1}

vsstatus_mxr_vm
sstatus_mxr_vm

cp_hgatp_svade

Svade in the G-stage

In VS-mode with vsatp = Bare and menvcfg.ADUE = 0, store, load and fetch through G-stage leaves with A = D = 0 and with D = 0. The leaf is read back after the accesses.

An access with A = 0, or a store with D = 0, raises a guest-page fault for the original access type and the PTE is unchanged.

VS x {sw, lw, jalr} x vsatp Bare x hgatp_mode x menvcfg.ADUE = 0

hgatp_mode_sv39x4
hgatp_mode_sv48x4
hgatp_mode_Sv57x4
menvcfg_adue_op

Svadu_H cp_hgatp_adue has the ADUE = 1 cases.

cp_hgatp_gpa_width

Guest physical address width of each G-stage mode

RV64 only. In VS-mode with vsatp = Bare, for each supported hgatp mode, load from guest physical addresses with one bit set, from bit 37 to bit 63. A superpage leaf at the highest level whose page offset is at most the set bit maps each address below the mode’s width (41 for Sv39x4, 50 for Sv48x4, 59 for Sv57x4) to the test page. Below the root, the test image is identity mapped again at the leaf’s level.

Addresses below the width translate, including the two extra root-table index bits of the x4 mode (bits 40:39 for Sv39x4), which index the 16 KiB root table. An address with a bit set at or above the width raises a load guest-page fault (GPA bits 63:41 for Sv39x4, 63:50 for Sv48x4 and 63:59 for Sv57x4 must be zero).

VS x lw x vsatp Bare x hgatp_mode x set GPA bit {37-63}

hgatp_mode_x4
hgatp_mode_sv39x4
hgatp_mode_sv48x4
hgatp_mode_Sv57x4
hgatp_root_pt_sz_align

cp_hgatp_sv32x4_gpa

Sv32x4 translates 34-bit guest physical addresses

RV32 only. In VS-mode, load through a VS-stage leaf whose guest physical address has bit 32, bit 33 or both set, with the G-stage leaf for that address valid and invalid.

With the valid G-stage leaf the load reads the test page. With the invalid leaf it raises a load guest-page fault with htval = guest physical address bits 33:2 (or zero).

VS x lw x vsatp paged x hgatp paged x htval bits 31:30 {01, 10, 11}

hgatp_mode_x4
hgatp_mode_sv32x4
htval_trapval
mtval2_htval_virtaddr
hstatus_gva_op
hgatp_root_pt_sz_align

Two-stage translation (Sv_H_twostage_cg)

cp_twostage_perm

VS-stage and G-stage permissions combined, and every pair of page sizes

In VS-mode and VU-mode, store, load and fetch through (VS-stage, G-stage) leaves with permissions (RWX, RWX), (R, RWX), (RWX, R), (X, R), (RW, X), (invalid, RWX), (RWX, invalid) and (invalid, invalid).
In VS-mode, also store, load and fetch through each VS-stage leaf level combined with each G-stage leaf level (4 KiB pages up to the mode’s largest superpage), with guest virtual, guest physical and supervisor physical addresses that differ.

The VS-stage is checked first: a VS-stage denial raises a page fault (12, 13, 15) with htval = 0, and otherwise a G-stage denial raises a guest-page fault (20, 21, 23) for the original access type with htval = the guest physical address >> 2 (or zero).
Accesses that both stages permit reach the test page: loads return its word, stores update it and fetches execute its ret, for every pair of page sizes.

{VS, VU} x {sw, lw, jalr} x stage_modes x {no trap, page fault, guest-page fault}

H_vm_supported
H_vm_twostage
hgatp_mode_bare
hgatp_mode_bare_trans
H_vm_gpatrans
H_vm_gpapriv
H_vm_gpa_g
Svrsw60t59b_H_g_stage_reserved_bits
hgatp_mode_sv39x4
hgatp_mode_sv48x4
hgatp_mode_Sv57x4
htval_trapval
mtval2_htval_virtaddr
hstatus_gva_op
H_guest_page_fault

cp_twostage_mxr

vsstatus.MXR affects only the VS-stage; the HS-level MXR affects both stages

In VS-mode and VU-mode, load and fetch through (VS-stage, G-stage) leaves (X, RWX), (RWX, X), (X, X) and (R, R), with vsstatus.MXR = 0 and 1 and sstatus.MXR = 0 and 1.

vsstatus.MXR makes a VS-stage execute-only page readable; sstatus.MXR makes execute-only pages of both stages readable. A denied load raises a load page fault (VS-stage) or load guest-page fault (G-stage). Neither MXR grants execute permission, so the fetch from the (R, R) page raises an instruction page fault.

{VS, VU} x lw x stage_modes x vsstatus.MXR {0, 1} x mstatus.MXR {0, 1}

vsstatus_mxr_vm
sstatus_mxr_vm

cp_twostage_svade

Svade in both stages

In VS-mode with menvcfg.ADUE = henvcfg.ADUE = 0, store, load and fetch through VS-stage leaves and G-stage leaves with A = D = 0 or D = 0. The VS-stage leaf is in a level-0 page table at a guest physical address with a G-stage leaf.

An access with A = 0, or a store with D = 0, raises a page fault (VS-stage) or guest-page fault (G-stage).

VS x {sw, lw, jalr} x stage_modes x menvcfg.ADUE = henvcfg.ADUE = 0

henvcfg_adue_op
menvcfg_adue_op

Svadu_H cp_twostage_adue has the ADUE = 1 cases.

cp_implicit_gpf

Guest-page faults on implicit VS-stage page-table reads

In VS-mode with menvcfg.ADUE = 0, store, load and fetch through a VS-stage level-0 page table at a guest physical address whose G-stage leaf is invalid, execute-only, has U = 0 or has A = 0.

Implicit VS-stage page-table reads are user-level G-stage loads, checked as implicit accesses rather than as the original access type. Each case raises a guest-page fault reported for the original access type (instruction, load or store/AMO), with htval = the guest physical address of the VS-stage PTE >> 2 and, if htval is nonzero, htinst = the read pseudoinstruction 0x3000 on RV64, 0x2000 on RV32.

VS x {sw, lw, jalr} x stage_modes x htinst read pseudoinstruction

H_vm_gpatrans
H_vm_gpapriv
H_vm_gpa_g
Svrsw60t59b_H_g_stage_reserved_bits
H_vm_gstagetrans
H_trap_xtinst_guestpage
H_trap_xtinst_guestpage_rw
htval_trapval
mtval2_htval_virtaddr
hstatus_gva_op
H_guest_page_fault

Svadu_H cp_implicit_gpf has the A/D update case.

cp_implicit_mxr

MXR does not apply to implicit VS-stage page-table reads

In VS-mode, load through a VS-stage level-0 page table at a guest physical address whose G-stage leaf is execute-only, with vsstatus.MXR = 0 and 1 and sstatus.MXR = 0 and 1.

MXR makes execute-only pages readable only by explicit loads. Each load raises a load guest-page fault with htinst = the read pseudoinstruction.

VS x lw x stage_modes x vsstatus.MXR {0, 1} x sstatus.MXR {0, 1} x htinst read pseudoinstruction

H_vm_gpatrans
H_vm_gpapriv
H_vm_gpa_g
Svrsw60t59b_H_g_stage_reserved_bits
vsstatus_mxr_vm
sstatus_mxr_vm

cp_twostage_access_fault_load
cp_twostage_access_fault_store
cp_twostage_access_fault_fetch

Access faults during two-stage translation report the original access type

In VS-mode, store, load and fetch where the G-stage leaf maps the page to the access-fault address of that access type, where the G-stage maps the VS-stage level-0 page table to RVMODEL_ACCESS_FAULT_ADDRESS_LOAD, and where a G-stage level-1 PTE points at a table there. The page-table read is an implicit load, so the tables use the load access-fault region.

Each access raises a store/AMO, load or instruction access fault. A fault on an implicit page-table read is reported for the original access type.

VS x {sw, lw, jalr} x stage_modes x access fault

H_vm_gpatrans
H_vm_gpapriv
H_vm_gpa_g
Svrsw60t59b_H_g_stage_reserved_bits

Each access type is generated only when the DUT defines RVMODEL_ACCESS_FAULT_ADDRESS_{LOAD/STORE/FETCH}. The page-table cases also need RVMODEL_ACCESS_FAULT_ADDRESS_LOAD.

cp_hedeleg_page_fault
cp_hedeleg_guest_page_fault

hedeleg delegates page faults, but not guest-page faults, to VS-mode

In VS-mode and VU-mode with hedeleg bits 12, 13, 15, 20, 21 and 23 written with 1, store, load and fetch through an invalid VS-stage leaf, a read-only VS-stage leaf and an invalid G-stage leaf.

hedeleg bits 20-23 are read-only zero. The page faults are taken in VS-mode (vscause = 12, 13 or 15, vstval = the guest virtual address); the guest-page faults are taken in HS-mode. The read-only leaf permits the load.

cp_hedeleg_page_fault: {VS, VU} x {sw, lw, jalr} x vsatp paged x hgatp paged x hedeleg[15:12] = 1011 x page fault in VS-mode
cp_hedeleg_guest_page_fault: {VS, VU} x {sw, lw, jalr} x vsatp paged x hgatp paged x hedeleg[15:12] = 1011 x guest-page fault in HS-mode

hedeleg_op
H_trap_deleg
H_guest_page_fault

cp_stage_both_bare

No translation when both stages are Bare

In VS-mode and VU-mode with vsatp = hgatp = Bare, store, load and fetch at the physical address of the test page.

The guest virtual address is used as the supervisor physical address and the accesses succeed.

{VS, VU} x {sw, lw, jalr} x vsatp Bare x hgatp Bare

H_vm_supported
H_vm_twostage
hgatp_mode_bare
hgatp_mode_bare_trans

cp_straddle

A fetch that straddles a page boundary faults on the second page

Needs Zca. In VS-mode, jump to a 4-byte instruction in the last halfword (offset 0xFFE) of a guest page whose next page is mapped, has an invalid G-stage leaf, or has an invalid VS-stage leaf.

When the next page is mapped, the instruction executes. Otherwise the fetch raises an instruction guest-page fault (G-stage) or instruction page fault (VS-stage) with sepc = the instruction address and stval = the page-boundary address, the faulting portion; for the guest-page fault, htval holds the guest physical address of the page boundary >> 2 (or zero).

VS x jalr x vsatp paged x hgatp paged x target offset 0xFFE x {no trap, page fault, guest-page fault}

H_straddle

cp_ldst_straddle

A misaligned load or store that straddles a page boundary faults on the second page

Only on harts with MISALIGNED_LDST and MISALIGNED_SPLIT_STRATEGY = sequential_bytes, which perform a misaligned access byte by byte. In VS-mode, store and load the word two bytes below the end (offset 0xFFE) of a guest page whose next page is mapped, has an invalid G-stage leaf, or has an invalid VS-stage leaf.

When the next page is mapped, the accesses complete across the boundary. Otherwise they raise store/AMO or load guest-page faults (G-stage) or page faults (VS-stage) with stval = the page-boundary address, the faulting portion; for the guest-page faults, htval holds the guest physical address of the page boundary >> 2 (or zero). A faulting load leaves rd unchanged.

VS x {lw, sw} x vsatp paged x hgatp paged x address offset 0xFFE x {no trap, page fault, guest-page fault}

H_straddle

cp_twostage_canonical

Non-canonical guest virtual addresses

RV64 only. For each supported pair Sv39/Sv39x4, Sv48/Sv48x4 and Sv57/Sv57x4, in VS-mode and VU-mode, store, load and fetch at the mapped guest virtual address with the bit just above the VS-stage VA width set, and with all bits from that bit to 63 set. The top VA bit is clear, so both addresses are non-canonical.

Store/AMO, load or instruction page fault (not a guest-page fault). stval, and sepc for the fetch, may hold any invalid address, because an implementation may convert an invalid address to another invalid address before writing it.

{VS, VU} x {lw, sw, jalr} x {Sv39, Sv48, Sv57 that the hart supports with the matching x4 mode} x page fault

Sv39_va_signext
Sv48_va_signext
Sv57_va_signext

cp_twostage_gpa_width

VS-stage PTE guest physical address wider than the G-stage mode

RV64 only, hgatp = Sv39x4 or Sv48x4. In VS-mode, store, load and fetch through a VS-stage leaf whose PPN sets guest physical address bit 41 (Sv39x4) or 50 (Sv48x4), or bit 55, and through a VS-stage level-1 PTE that points to the leaf table at such an address.

Store/AMO, load or instruction guest-page fault. A hart that drops the high bits reaches a valid G-stage leaf instead.

VS x {lw, sw, jalr} x vsatp paged x {Sv39x4, Sv48x4 with htval bits above the G-stage width nonzero} x guest-page fault

hgatp_mode_x4
hgatp_mode_sv39x4
hgatp_mode_sv48x4
hgatp_mode_Sv57x4

HLV, HLVX and HSV in HS-mode (Sv_H_hlv_cg)

cp_hlv_priv

hstatus.SPVP and vsstatus.SUM set the privilege of HLV, HLVX and HSV

In HS-mode, execute hlv.w, hlvx.wu and hsv.w through two-stage translation on a VS-stage leaf with U = 0 and 1, with hstatus.SPVP = 0 and 1, vsstatus.SUM = 0 and 1, and sstatus.SUM = 0 and 1.

With SPVP = 0 the accesses are VU-level, so the U = 0 page raises load or store/AMO page faults. With SPVP = 1 they are VS-level, so the U = 1 page faults unless vsstatus.SUM = 1; with SUM = 1, HLVX also reads the U = 1 page. sstatus.SUM has no effect.

HS x {hlv.w, hlvx.wu, hsv.w} x stage_modes x hstatus.SPVP {0, 1} x vsstatus.SUM {0, 1} x sstatus.SUM {0, 1}

H_vscsrs_v0
vsstatus_v0
hlsv_priv
hlsv_trans
hlsv_sstatus_mxr
hlsv_vsstatus_mxr
vsatp_v0
hstatus_spvp_virtls_op

cp_hlv_mxr

sstatus.MXR affects both stages for HLV, vsstatus.MXR only the VS-stage

In HS-mode with hstatus.SPVP = 1, execute hlv.w and hlvx.wu on a page that is execute-only in the VS-stage (G-stage RWX) and on one that is execute-only in the G-stage (VS-stage RWX), with vsstatus.MXR = 0 and 1 and sstatus.MXR = 0 and 1.

hlvx.wu reads both pages. hlv.w reads the VS-stage execute-only page when either MXR is 1, and the G-stage execute-only page only when sstatus.MXR = 1; otherwise it raises a load page fault or a load guest-page fault.

HS x {hlv.w, hlvx.wu} x stage_modes x vsstatus.MXR {0, 1} x sstatus.MXR {0, 1}

hlsv_priv
hlsv_trans
hlsv_sstatus_mxr
hlsv_vsstatus_mxr
vsatp_v0
hlsv_u_op

cp_hlvx_perm

HLVX needs execute permission in both stages

In HS-mode with hstatus.SPVP = 1, execute hlvx.wu on a VS-stage read-only page (G-stage RWX) and on a G-stage read-only page (VS-stage RWX), with each vsstatus.MXR and sstatus.MXR.

Load page fault for the VS-stage read-only page, load guest-page fault for the G-stage read-only page. MXR makes executable pages readable but does not grant execute permission, so it never avoids the fault.

stage_modes x 2 vsstatus.MXR x 2 sstatus.MXR x {load page fault, load guest-page fault}

hlsv_u_op

cp_hlv_implicit

Guest-page faults on the implicit VS-stage page-table reads of HLV, HLVX and HSV

In HS-mode with hstatus.SPVP = 1, execute hlv.w, hlvx.wu and hsv.w through a VS-stage level-0 page table at a guest physical address whose G-stage leaf is execute-only, or read-only (hlvx.wu only).

The page-table reads are implicit loads, so they need G-stage read permission, also for HLVX. The execute-only table raises a load or store guest-page fault with htinst = the read pseudoinstruction. hlvx.wu reads through the read-only table.

HS x {hlv.w, hlvx.wu, hsv.w} x stage_modes x htinst read pseudoinstruction

H_vm_gpatrans
H_vm_gpapriv
H_vm_gpa_g
Svrsw60t59b_H_g_stage_reserved_bits
H_vm_gstagetrans
H_trap_xtinst_guestpage
H_trap_xtinst_guestpage_rw
hlsv_u_op

Svadu_H cp_hlv_implicit has the A/D update case.

cp_hlv_root_gpf

A guest-page fault on the read of the VS-stage root table

In HS-mode with hstatus.SPVP = 1, set vsatp.PPN to a guest physical page whose G-stage leaf is invalid, and execute hlv.w, hlvx.wu and hsv.w.

Each raises a load or store guest-page fault with htval = the guest physical address of the root PTE >> 2 and htinst = the read pseudoinstruction.

HS x {hlv.w, hlvx.wu, hsv.w} x stage_modes x htinst read pseudoinstruction x htval in the root table

H_vm_gstagetrans
H_trap_xtinst_guestpage
H_trap_xtinst_guestpage_rw
htval_trapval
mtval2_htval_virtaddr
hstatus_gva_op
hlsv_priv
hlsv_trans
hlsv_sstatus_mxr
hlsv_vsstatus_mxr
vsatp_v0

Needs htval to report the guest physical address.

vsatp, satp and hgatp MODE (Sv_H_csr_cg)

cp_vsatp_mode_field

supported/unsupported MODE encodings

RV64 with Sv39 VS-stage translation.
Test Case: For x = {0…​15} In HS-mode: First write vsatp with {Bare, Sv39}. Then write vsatp.MODE field = {x} and read back. The other fields are zero.

A supported MODE is retained. A write with an unsupported MODE value is either ignored as it is for satp, or the fields of vsatp are treated as WARL in the normal way, so the test checks only that vsatp holds a supported MODE.

{16 x} * 2 starting modes

vsatp_mode_unsupported_v0

cp_satp_mode_field

supported/unsupported MODE encodings

RV64 with Sv39 VS-stage translation. A VS-stage identity map of the test image (gigapages for Sv39, a terapage for Sv48 and Sv57) keeps VS-mode running whatever MODE is selected.
Test Case: For x = {0…​15} In VS-mode: First write satp with {Bare, Sv39} and the root table. Then write satp.MODE field = {x} with the root table, and read back.

In VS-mode satp is vsatp. A supported MODE is retained; a write with an unsupported MODE value is ignored, so the old value is preserved.

{16 x} * 2 starting modes

vsatp_mode_unsupported_v1
vsatp_sz_acc_op

cp_hgatp_mode_field

supported/unsupported MODE encodings for hgatp

RV64 with Sv39x4.
Test Case: For x = {0…​15} In HS-mode: First write hgatp with {Bare, Sv39x4}. Then write hgatp.MODE field = {x} and read back. The other fields are zero.

Supported MODEs are retained. hgatp is WARL, and the legal value that an unsupported MODE produces is implementation-defined, so the test checks only that hgatp holds a supported MODE.

{16 x} * 2 starting modes

hgatp_mode_Sv
hgatp_mode_warl

Fences (Sv_H_fence_cg)

cp_hfence_vvma
cp_hfence_gvma
cp_sfence_vma_vs
cp_hfence_vvma_asid
cp_hfence_gvma_vmid
cp_sfence_vma_vs_asid

Fences remove stale VS-stage and G-stage translations (Sv_H_fence_cg)

Sv32/Sv32x4 and Sv39/Sv39x4. Map a guest virtual address through the VS-stage to guest physical page A and through the G-stage to physical page A, and load from it in VS-mode. HS-mode then points the VS-stage leaf at guest page B, or the G-stage leaf of page A at physical page B, and runs hfence.vvma or hfence.gvma in HS-mode, or sfence.vma in VS-mode. rs1 is x0 or the address (the guest virtual address, or the guest physical address >> 2 for hfence.gvma); rs2 is x0 or the current ASID (hfence.vvma, sfence.vma) or VMID (hfence.gvma), and the address is also used with all ASIDMAX or VMIDMAX bits set in rs2. The cases run with every implemented vsatp.ASID and hgatp.VMID bit set.
Isolation cases load under VMID or ASID 0, switch to the other ID, change the leaf and fence only the new ID: hfence.gvma with rs2 = VMID, hfence.vvma with x0 after a VMID switch and with rs2 = ASID after an ASID switch, and sfence.vma in VS-mode with x0 after a VMID switch.

The VS-mode load after the fence reads page B. Both loads are recorded. A hart that caches no translation passes.

cp_hfence_vvma: HS x hfence.vvma x vsatp paged x hgatp paged x rs1 {x0, register} x rs2 {x0, register}
cp_hfence_gvma: HS x hfence.gvma x vsatp paged x hgatp paged x rs1 {x0, register} x rs2 {x0, register}
cp_sfence_vma_vs: VS x sfence.vma x vsatp paged x hgatp paged x rs1 {x0, register} x rs2 {x0, register}
cp_hfence_vvma_asid: HS x hfence.vvma x vsatp paged x hgatp paged x rs2 {current ASID, all ASIDMAX bits set}
cp_hfence_gvma_vmid: HS x hfence.gvma x vsatp paged x hgatp paged x rs2 {current VMID, all VMIDMAX bits set}
cp_sfence_vma_vs_asid: VS x sfence.vma x vsatp paged x hgatp paged x rs2 {current ASID, all ASIDMAX bits set}

hfence-vvma_hfence-gvma_op
hfence-vvma_mode
hfence-vvma_limits
hfence-gvma_op
sfence_vma_v1
hfence-vvma_asid
hfence-gvma_vmid

A fence is required only to make new translations visible. That a fence leaves the translations of another ASID or VMID cached, or that SFENCE.VMA in VS-mode leaves HS-level and G-stage translations cached, is not observable.

Not tested

hstatus.VSBE sets the endianness of VS-mode explicit accesses and VS-stage page-table accesses

Load and store in VS-mode, and walk VS-stage page tables, with hstatus.VSBE = 0 and 1.

hstatus_vsbe_op
hstatus_vsbe_implicit

Not tested

The reference model is little-endian only, every H configuration declares VS-mode and VU-mode little-endian, and the trap handler has no big-endian support.

VS-stage A bits are not set by speculative execution unless the effective privilege is VS or VU

vs_stage_speculative_a_bit

Not tested

Not architecturally observable; a signature test cannot distinguish a speculative A-bit update from one made by an access the program performs.

Sv_HSm Hypervisor 2-Stage Virtual Memory with M-mode State

Sv_HSm covers two-stage address translation seen from M-mode through mstatus.MPRV and MPV, and guest traps taken in M-mode. The group boots to M-mode and delegates nothing (medeleg = hedeleg = 0), so the M-mode trap handler takes every trap and records mcause, mtval, mtval2, mtinst and mstatus.GVA/MPV. It runs with Sv39/Sv39x4 on RV64 and Sv32/Sv32x4 on RV32, and uses the Sv_H test page, page tables and conventions; the other two-stage cases are in Sv_H. MPRV tests set mstatus.MPRV, MPP and MPV (mstatush.MPV on RV32) just before each M-mode load or store and clear MPRV after it, because a trap from M-mode leaves MPP = M and MPV = 0. Instruction fetches in M-mode are never translated. The fetch straddle test (cp_straddle_m) needs Zca, and the load/store straddle test (cp_ldst_straddle_m) needs a hart that performs misaligned accesses byte by byte (MISALIGNED_LDST with MISALIGNED_SPLIT_STRATEGY = sequential_bytes); they are separate test files.

Table 242. Sv_HSm Coverpoints
Coverpoint Goal Feature Description Expectation Bins Normative Rule

M-mode accesses with MPRV (Sv_HSm_mprv_cg)

cp_vsatp_mprv_effects

MPRV effects on address translation

Environment: While in M-mode, set MPRV=1, mstatus.MPP={S,U}, mstatus.MPV=1, vsatp.MODE = Sv32 or Sv39, hgatp.MODE=BARE, satp.MODE=BARE, with a VS-stage leaf that is readable and writable, then execute-only. The leaf has U = 1 for MPP = U.
Test Case: Do load/store from M-mode. Instruction fetches unaffected, only data accesses translated.

Data accesses are translated through the VS-stage with the privilege of MPP: they reach the test page through the RW leaf and raise load or store/AMO page faults (13, 15) through the execute-only leaf, taken in M-mode with mtval = the guest virtual address and mstatus.GVA = 1. Instruction fetches are not translated and don’t fault.

M x {lw, sw} x MPRV = 1 x MPV/MPP {VS, VU} x vsatp paged x hgatp Bare x {no trap, page fault}

hlsv_priv
hlsv_trans
hlsv_sstatus_mxr
hlsv_vsstatus_mxr
vsatp_v0
mstatus_mprv_hypervisor

cp_hgatp_mprv_effects

MPRV behavior when G-stage present

Environment: While in M-mode, with vsatp = satp = Bare and a G-stage identity mapping that makes the test page execute-only (U = 1), set MPRV={0,1} and mstatus.MPP/MPV={M, M with MPV=1, HS, VS, U, VU} before each access.
Test Case: Execute lw, sw, hlv.w and hsv.w on the test page. MPRV affects explicit memory accesses of loads and stores; HLV/HSV ignore MPRV.

When MPRV=1 and MPV=1 (MPP = S or U), lw and sw are translated through the G-stage (vsatp is Bare) and raise load or store/AMO guest-page faults with mtval2 = the guest physical address >> 2 (or zero). When MPRV=0, or MPV=0, lw and sw access the test page untranslated; in particular M-mode with MPRV = 0 does no translation. hlv.w and hsv.w always use the G-stage, whatever MPRV is, and raise guest-page faults. MPV is ignored with MPP = M, so MPRV = 1 with MPP = M and MPV = 1 is an M-level access with no translation.

M x {lw, sw, hlv.w, hsv.w} x MPRV {0, 1} x MPP/MPV {M, M with MPV = 1, HS, VS, U, VU} x vsatp Bare x hgatp paged

hlsv_priv
hlsv_trans
hlsv_sstatus_mxr
hlsv_vsstatus_mxr
vsatp_v0
mstatus_mprv_hypervisor
mstatus_mprv_hlsv

cp_mprv_sum

With MPRV = 1 and MPV = 1, vsstatus.SUM applies instead of mstatus.SUM

In M-mode with MPRV = 1, MPV = 1 and both stages paged, store and load through a VS-stage leaf with U = 1 with MPP = S, and through a leaf with U = 0 with MPP = U, with vsstatus.SUM = 0 and 1 and mstatus.SUM = 0 and 1.

With MPP = S, the accesses to the U = 1 page succeed only with vsstatus.SUM = 1; mstatus.SUM has no effect. With MPP = U, the accesses to the U = 0 page always raise page faults.

M x {lw, sw} x MPRV = 1 x MPV/MPP {VS, VU} x vsatp paged x hgatp paged x vsstatus.SUM {0, 1} x mstatus.SUM {0, 1}

hlsv_priv
hlsv_trans
hlsv_sstatus_mxr
hlsv_vsstatus_mxr
vsatp_v0
mstatus_mprv_hypervisor

cp_mprv_mxr

With MPRV = 1 and MPV = 1, mstatus.MXR applies to both stages and vsstatus.MXR to the VS-stage

In M-mode with MPRV = 1, MPV = 1 and MPP = S and U, load through pages that are execute-only in the VS-stage, in the G-stage, or in both, with vsstatus.MXR = 0 and 1 and mstatus.MXR = 0 and 1. VS-stage leaves have U = 1 for MPP = U.

vsstatus.MXR makes the VS-stage execute-only page readable; mstatus.MXR makes execute-only pages of both stages readable. A denied load raises a load page fault (VS-stage) or load guest-page fault (G-stage) in M-mode.

M x lw x MPRV = 1 x MPV/MPP {VS, VU} x vsatp paged x hgatp paged x vsstatus.MXR {0, 1} x mstatus.MXR {0, 1}

hlsv_priv
hlsv_trans
hlsv_sstatus_mxr
hlsv_vsstatus_mxr
vsatp_v0
mstatus_mprv_hypervisor

Guest traps taken in M-mode (Sv_HSm_trap_cg)

cp_guest_page_fault_m
cp_implicit_gpf_m

Page faults and guest-page faults from VS-mode and VU-mode taken in M-mode write mtval2, mtinst and mstatus.GVA/MPV

In VS-mode and VU-mode with nothing delegated, store, load and fetch through an invalid VS-stage leaf, an invalid G-stage leaf, and a VS-stage leaf table whose G-stage leaf is invalid.

Each trap is taken in M-mode with mstatus.GVA = 1, mstatus.MPV = 1 (mstatush on RV32) and mtval = the guest virtual address.
The invalid VS-stage leaf raises a page fault (12, 13, 15) with mtval2 = 0. The invalid G-stage leaf raises a guest-page fault (20, 21, 23) with mtval2 = the guest physical address >> 2 (or zero). The leaf table raises a guest-page fault on the implicit VS-stage PTE read, with mtval2 = the guest physical address of the PTE >> 2 and, if mtval2 is nonzero, mtinst = the pseudoinstruction 0x3000 (RV64) or 0x2000 (RV32), reported for the original access type.

cp_guest_page_fault_m: {VS, VU} x {sw, lw, jalr} x vsatp paged x hgatp paged x {page fault, guest-page fault} x mstatus.GVA = MPV = 1
cp_implicit_gpf_m: {VS, VU} x {sw, lw, jalr} x vsatp paged x hgatp paged x mtinst read pseudoinstruction

H_vm_gstagetrans
H_trap_xtinst_guestpage
H_trap_xtinst_guestpage_rw
htval_trapval
mtval2_htval_virtaddr
hstatus_gva_op
H_guest_page_fault
mtval2_trapval
mtval2_trapval_vstrans
mstatus_gva_op
mstatus_mpv_op

cp_straddle_m
cp_ldst_straddle_m

mtval2 reports the faulting portion of a straddling fetch or misaligned access

cp_straddle_m needs Zca: in VS-mode and VU-mode, jump to a 4-byte instruction in the last halfword (offset 0xFFE) of a guest page whose next page has an invalid G-stage leaf.
cp_ldst_straddle_m needs a hart that performs misaligned accesses byte by byte: in VS-mode and VU-mode, store and load the word two bytes below the end of such a page.

An instruction, store/AMO or load guest-page fault taken in M-mode, with mtval = the page-boundary address (the faulting portion) and mtval2 = its guest physical address >> 2, or zero. A faulting load leaves rd unchanged.

cp_straddle_m: {VS, VU} x jalr x vsatp paged x hgatp paged x target offset 0xFFE x guest-page fault x nonzero mtval2 at the page boundary
cp_ldst_straddle_m: {VS, VU} x {lw, sw} x vsatp paged x hgatp paged x address offset 0xFFE x guest-page fault x nonzero mtval2 at the page boundary

H_straddle
mtval2_trapval_other

Sv_HZicbo Hypervisor VirtMem + CBOM/CBOZ

Sv_HZicbo boots to HS-mode with hedeleg clear, so every trap from VS-mode and VU-mode is taken in HS-mode and read from scause. PMP on the final address of a CBO is checked in the PMP suite’s PMP_HSvZicbo group (cp_pmp), which boots to M-mode. - The cp_vs_* and cp_g_* files need Sv39x4 and VS-stage Sv39 (RV64) or Sv32x4 and VS-stage Sv32 (RV32). Each case writes the PTEs, executes hfence.gvma and hfence.vvma, and runs the family’s CBOs (cbo.clean, cbo.flush and cbo.inval with Zicbom, cbo.zero with Zicboz) once in VS-mode and once in VU-mode. HS-mode checks what cbo.zero wrote. - VS-stage cases use a guest virtual address in a VS-stage mapping over the G-stage identity map. G-stage cases use a G-stage mapping reached through a VS-stage identity superpage. Every level of each stage holds the leaf in turn. - A CBO faults like a store: a store/AMO page fault, guest-page fault or access fault. A cache-block management instruction needs read or write permission and never checks D. cbo.zero needs write permission and checks D (cmo.adoc cbm_access, cbz_access). Boot leaves menvcfg.ADUE = 0, which makes henvcfg.ADUE read-only zero, so a clear A bit, or a clear D bit for cbo.zero, raises a fault (Svade behavior). - The henvcfg files run with vsatp and hgatp Bare and change menvcfg through T-SBI.

Table 243. Sv_HZicbo Coverpoints
Coverpoint Goal Feature Description Expectation Bins Normative Rule Status Notes

VS-stage PTEs

cp_vs_pte

Verify the fault that each VS-stage PTE gives a CBO from VS-mode and VU-mode.

At each VS-stage level, the leaf in turn: valid; V = 0; W without R; W and X without R; R and X without W; X only (cbo.zero only); A = 0; D = 0; a pointer (RWX = 0) at level 0; D, A or U set in the non-leaf PTE above the leaf; a misaligned superpage (levels above 0). VS-mode leaves have U = 0 and VU-mode leaves U = 1; VU-mode also uses a supervisor leaf (U = 0), and VS-mode a user leaf (U = 1) with vsstatus.SUM = 0.

No fault for a valid leaf; for R and X without W and for D = 0 with a cache-block management instruction (a load is permitted, and D is not checked).
Store/AMO page fault for every other case, and for cbo.zero on R and X without W, X only and D = 0.

{VS, VU} × CBO × {no fault, store/AMO page fault}, with vsatp and hgatp paged

cbm_unperm_fault
cbm_page_fault
cbm_unperm_translate
cbz_unperm_fault
cbz_unperm_translate
cbm_access
H_vm_supported
H_vm_twostage
hgatp_mode_bare
hgatp_mode_bare_trans
cbz_access
Svadu_disabled_hw_update_falls_back_to_Svade

cp_vs_sum

Verify that vsstatus.SUM = 1 lets VS-mode CBOs reach VS-stage user pages.

In VS-mode with vsstatus.SUM = 1, the CBOs at a VS-stage user leaf (U = 1) at each level.

No fault. (With SUM = 0 the same case is a store/AMO page fault in cp_vs_pte.)

VS × CBO × SUM = 1 × no fault

sstatus_sum
H_vm_gpatrans
H_vm_gpapriv
H_vm_gpa_g
Svrsw60t59b_H_g_stage_reserved_bits

cp_vs_gpa
cp_vs_gpa_implicit

Verify the faults that G-stage translation gives the final address and the VS-stage page-table reads of a CBO.

At each VS-stage level: a leaf whose guest physical address the G-stage does not map; and, below the top level, a non-leaf PTE that points at a table whose guest physical address the G-stage does not map, or maps to the page of RVMODEL_ACCESS_FAULT_ADDRESS_LOAD (with an index there that selects a PTE inside the access-fault region; only when RVMODEL_ACCESS_FAULT_ADDRESS_STORE and RVMODEL_ACCESS_FAULT_ADDRESS_LOAD are defined). The page-table read is an implicit load, so the table uses the load access-fault region.

Unmapped final address: store/AMO guest-page fault. Unmapped table: store/AMO guest-page fault, with htinst holding the pseudoinstruction for an implicit VS-stage read (0x2000 on RV32, 0x3000 on RV64, cp_vs_gpa_implicit). Table at a faulting supervisor physical address: store/AMO access fault.

{VS, VU} × CBO × {store/AMO guest-page fault, store/AMO access fault}; cp_vs_gpa_implicit: {VS, VU} × CBO × pseudoinstruction

fault_excep_csr
cbm_unperm_fault
cbm_page_fault
cbz_unperm_fault
cbm_access
pma_chk_paddr
H_vm_supported
H_vm_twostage
hgatp_mode_bare
hgatp_mode_bare_trans
H_vm_gstagetrans
H_trap_xtinst_guestpage
H_trap_xtinst_guestpage_rw
htval_trapval
mtval2_htval_virtaddr
hstatus_gva_op
cbz_access

G-stage PTEs

cp_g_pte

Verify the fault that each G-stage PTE gives a CBO from VS-mode and VU-mode.

At each G-stage level, the leaf in turn, as in cp_vs_pte with U = 1: valid; V = 0; W without R; W and X without R; R and X without W; X only (cbo.zero only); A = 0; D = 0; a pointer at level 0; D, A or U set in the non-leaf PTE above the leaf; a misaligned superpage. Also a leaf with U = 0.

As cp_vs_pte, with store/AMO guest-page faults in place of page faults. U = 0 is a store/AMO guest-page fault, because every G-stage access is a user access.

{VS, VU} × CBO × {no fault, store/AMO guest-page fault}, with vsatp and hgatp paged

sstatus_sum
fault_excep_csr
cbm_unperm_fault
cbm_page_fault
cbm_unperm_translate
cbz_unperm_fault
cbz_unperm_translate
cbm_access
H_vm_supported
H_vm_twostage
hgatp_mode_bare
hgatp_mode_bare_trans
H_vm_gpatrans
H_vm_gpapriv
H_vm_gpa_g
Svrsw60t59b_H_g_stage_reserved_bits
H_vm_gstagetrans
H_trap_xtinst_guestpage
H_trap_xtinst_guestpage_rw
htval_trapval
mtval2_htval_virtaddr
hstatus_gva_op
cbz_access
Svadu_disabled_hw_update_falls_back_to_Svade

cp_g_pa

Verify that a G-stage leaf or table at a faulting supervisor physical address gives a CBO a store/AMO access fault.

RVMODEL_ACCESS_FAULT_ADDRESS_STORE only. At each G-stage level, a leaf that maps RVMODEL_ACCESS_FAULT_ADDRESS_STORE; below the top level, a non-leaf G-stage PTE that points at the page of RVMODEL_ACCESS_FAULT_ADDRESS_LOAD, with an index there that selects a PTE inside the access-fault region (only when RVMODEL_ACCESS_FAULT_ADDRESS_LOAD is also defined, because the page-table read is an implicit load).

Store/AMO access fault.

{VS, VU} × CBO × store/AMO access fault

pma_chk_paddr

Prefetches

cp_vs_prefetch
cp_g_prefetch

Verify that prefetch.i, prefetch.r and prefetch.w raise no exception under two-stage translation, and do not set A or D.

Zicbop only. In VS-mode and VU-mode, prefetch at a VS-stage kilopage leaf that is valid, has V = 0, has the wrong U for the mode (U = 1 in VS-mode with vsstatus.SUM = 0, U = 0 in VU-mode), or maps an unmapped guest physical address; and at a G-stage kilopage leaf that is valid, has V = 0 or has U = 0. Then, with menvcfg.ADUE = henvcfg.ADUE = 1, prefetch at a VS-stage leaf and at a G-stage leaf with A = D = 0, and read each leaf back.

No exception (cmo.adoc cbp_unperm_noexcep). A and D stay 0 (cbp_unperm_translate).

{VS, VU} × {prefetch.i, prefetch.r, prefetch.w} × {VS-stage, G-stage} case × no exception, with vsatp and hgatp paged

cbp_unperm_noexcep
cbp_unperm_translate

henvcfg CBO enables

cp_cbie_vs

menvcfg.CBIE and henvcfg.CBIE control cbo.inval in VS-mode

Environment: vsatp and hgatp Bare. From HS-mode, write menvcfg.CBIE (through T-SBI) and henvcfg.CBIE with each of 00, 01 and 11.
Test Case: In VS-mode, store a random value to a scratch word, execute cbo.inval on it, and load it back.

menvcfg.CBIE = 00: illegal-instruction exception.
Otherwise henvcfg.CBIE = 00: virtual-instruction exception.
Otherwise, if either field is 01, cbo.inval performs a flush, so the load returns the value stored before it.
Both 11: cbo.inval executes without exception.

priv_mode VS x cbo.inval x menvcfg.CBIE {00, 01, 11} x henvcfg.CBIE {00, 01, 11} x vsatp Bare = 9 bins

henvcfg_cbie
cbo-inval_h_mode_veq1_op
cbo-inval
cbo-inval_h_mode_enabled_op
cbo-inval_h_mode_flush_enc

cp_cbie_vu

menvcfg.CBIE, henvcfg.CBIE and senvcfg.CBIE control cbo.inval in VU-mode

Environment: vsatp and hgatp Bare. From HS-mode, write menvcfg.CBIE (through T-SBI), henvcfg.CBIE and senvcfg.CBIE with each of 00, 01 and 11.
Test Case: In VU-mode, store a random value to a scratch word, execute cbo.inval on it, and load it back.

menvcfg.CBIE = 00: illegal-instruction exception.
Otherwise henvcfg.CBIE = 00 or senvcfg.CBIE = 00: virtual-instruction exception.
Otherwise, if any of the three fields is 01, cbo.inval performs a flush, so the load returns the value stored before it.
All 11: cbo.inval executes without exception.

priv_mode VU x cbo.inval x menvcfg.CBIE {00, 01, 11} x henvcfg.CBIE {00, 01, 11} x senvcfg.CBIE {00, 01, 11} x vsatp Bare = 27 bins

henvcfg_cbie
cbo-inval_h_mode_veq1_op
cbo-inval
cbo-inval_h_mode_enabled_op
cbo-inval_h_mode_flush_enc

cp_cbcfe_vs
cp_cbcfe_vu

menvcfg.CBCFE, henvcfg.CBCFE and, in VU-mode, senvcfg.CBCFE control cbo.clean and cbo.flush

Environment: vsatp and hgatp Bare. From HS-mode, write menvcfg.CBCFE (through T-SBI), henvcfg.CBCFE and, for VU-mode, senvcfg.CBCFE with each of 0 and 1.
Test Case: In VS-mode and VU-mode, execute cbo.clean and cbo.flush on a scratch word.

menvcfg.CBCFE = 0: illegal-instruction exception.
Otherwise henvcfg.CBCFE = 0, or senvcfg.CBCFE = 0 in VU-mode: virtual-instruction exception.
Otherwise the instruction executes without exception.

VS × {cbo.clean, cbo.flush} × 2 menvcfg × 2 henvcfg = 8; VU × {cbo.clean, cbo.flush} × 2 menvcfg × 2 henvcfg × 2 senvcfg = 16

henvcfg_cbcfe
cbo-clean_cbo-flush

cp_cbze_vs
cp_cbze_vu

menvcfg.CBZE, henvcfg.CBZE and, in VU-mode, senvcfg.CBZE control cbo.zero

Environment: vsatp and hgatp Bare. From HS-mode, write menvcfg.CBZE (through T-SBI), henvcfg.CBZE and, for VU-mode, senvcfg.CBZE with each of 0 and 1.
Test Case: In VS-mode and VU-mode, store a nonzero value to a scratch word, execute cbo.zero on it, and load it back.

menvcfg.CBZE = 0: illegal-instruction exception.
Otherwise henvcfg.CBZE = 0, or senvcfg.CBZE = 0 in VU-mode: virtual-instruction exception.
Otherwise cbo.zero zeroes the word.

VS × cbo.zero × 2 menvcfg × 2 henvcfg = 4; VU × cbo.zero × 2 menvcfg × 2 henvcfg × 2 senvcfg = 8

henvcfg_cbze
cbo-zero_basedon_xenvcfg_cbze

Not tested

cbo.inval with every CBIE field 11 performs an invalidate

cbo-inval_h_mode_inval_enc

Not tested

Whether an invalidate discards stored data depends on the cache hierarchy, so a test cannot tell it from a flush; cp_cbie_vs/vu check only that cbo.inval executes.

Cache-block management instructions on an X-only VS-stage or G-stage page

cbm_access

Not tested

Not tested because the outcome is UNSPECIFIED. When a page permits instruction fetch but neither loads nor stores, cmo.adoc (the paragraph after cbm_access) lets the implementation either perform cbo.clean/flush/inval or raise a store page fault, so a test has no single expected result. cbo.zero needs write permission and must fault on an execute-only page, so it is tested (cp_vs_pte and cp_g_pte).

CBOs under Sv48x4 and Sv57x4, and VS-stage Sv48 and Sv57

H_vm_twostage

Not tested

The framework allocates only the root and two lower tables per stage (rvtest_hlvl0/1, rvtest_vlvl0/1), so the cases run with Sv39x4 and VS-stage Sv39 (RV64) and Sv32x4 and VS-stage Sv32 (RV32) only.

Sv Normative Rules

The rules apply to all Sv groups.

Table 244. Sv Normative Rules
Normative Rule Rule Text Coverpoints

sstatus_mxr

The MXR (Make eXecutable Readable) bit modifies the privilege with which loads access virtual memory. When MXR=0, only loads from pages marked readable (R=1 in sv32pte) will succeed. When MXR=1, loads from pages marked either readable or executable (R=1 or X=1) will succeed. MXR has no effect when page-based virtual memory is not in effect.

Sv_vm_permissions_cg/cp_xpage_{mxrunset,mxrset}_read_{s,u}

sstatus_sum

The SUM (permit Supervisor User Memory access) bit modifies the privilege with which S-mode loads and stores access virtual memory. When SUM=0, S-mode memory accesses to pages that are accessible by U-mode (U=1 in sv32pte) will fault. When SUM=1, these accesses are permitted. SUM has no effect when page-based virtual memory is not in effect, nor when executing in U-mode. Note that S-mode can never execute instructions from user pages, regardless of the state of SUM.

Sv_vm_permissions_cg/{cp_upage_smode_sumunset_noread_s, cp_upage_smode_sumunset_noexec_s}, Sv_vm_permissions_cg/{cp_upage_smode_sumset_read_s, cp_upage_smode_sumset_noexec_s}, Sv_HZicbo_cg/{cp_vs_sum,cp_g_pte}

satp

The satp CSR is an SXLEN-bit read/write register, formatted as shown in rv32satp for SXLEN=32 and rv64satp for SXLEN=64, which controls supervisor-mode address translation and protection. This register holds the physical page number (PPN) of the root page table, i.e., its supervisor physical address divided by 4 KiB; an address space identifier (ASID), which facilitates address-translation fences on a per-address-space basis; and the MODE field, which selects the current address-translation scheme. Further details on the access to this register are described in virt-control.

Sv_satp_cg/{cp_access_s,cp_access_u,satp_asid_PPN}, Sv_Sm_satp_cg/cp_access_m

satp_mode

norm:satp_mode_enc shows the encodings of the MODE field when SXLEN=32 and SXLEN=64.

Sv_VA_cg/mode_supported, Svbare_cg/satp_bare

satp_mode_sxlen32

When SXLEN=32, the only other valid setting for MODE is Sv32, a paged virtual-memory scheme described in sv32.

Sv_VA_cg/{cp_VA_i_mode,cp_VA_d_mode}

satp_mode_sxlen64

When SXLEN=64, three paged virtual-memory schemes are defined: Sv39, Sv48, and Sv57, described in sv39, sv48, and sv57, respectively. One additional scheme, Sv64, will be defined in a later version of this specification. The remaining MODE settings are reserved for future use and may define different interpretations of the other fields in satp.

Sv_VA_cg/{cp_VA_i_mode,cp_VA_d_mode}

satp_mode_op_unsupported

Implementations are not required to support all MODE settings, and if satp is written with an unsupported MODE, the entire write has no effect; no fields in satp are modified.

TODO: write an unsupported satp.MODE and check that satp is unchanged

asidlen

The number of ASID bits is UNSPECIFIED and may be zero.

Sv_satp_cg/asid_length

asid_lsb_first

The least-significant bits of ASID are implemented first: that is, if ASIDLEN > 0, ASID[ASIDLEN-1:0] is writable.

Sv_satp_cg/asid_length

asidmax

The maximal value of ASIDLEN, termed ASIDMAX, is 9 for Sv32 or 16 for Sv39, Sv48, and Sv57.

Sv_satp_cg/asid_length

satp_mode_enc

riscv.github.io/riscv-isa-manual/snapshot/spec/index.html#norm%3Asatp_mode_enc

Sv_VA_cg/mode_supported, Svbare_cg/{satp_bare, cp_satp_bare_load, cp_satp_bare_store, cp_satp_bare_exec}, TODO: write reserved and custom MODE values (see satp_mode_op_unsupported)

satp_op_active

The satp CSR is considered active when the effective privilege mode is S-mode or U-mode. Executions of the address-translation algorithm may only begin using a given value of satp when satp is active.

Sv_vm_permissions_cg/{cp_spage_read_s_d, cp_spage_exec_s_i, cp_upage_umode_read_u}, Sv_Sm_mstatus_mprv_cg/cp_mprv_load

satp_op_sfence_vma

Note that writing satp does not imply any ordering constraints between page-table updates and subsequent address translations, nor does it imply any invalidation of address-translation caches.

Sv_sfence_cg/cp_ins

sfence_vma_op

The supervisor memory-management fence instruction SFENCE.VMA is used to synchronize updates to in-memory memory-management data structures with current execution. Instruction execution causes implicit reads and writes to these data structures; however, these implicit references are ordinarily not ordered with respect to explicit loads and stores.

Sv_sfence_cg/cp_ins

sfence_vma_ordering

Executing an SFENCE.VMA instruction guarantees that any previous stores already visible to the current RISC-V hart are ordered before certain implicit references by subsequent instructions in that hart to the memory-management data structures. The specific set of operations ordered by SFENCE.VMA is determined by rs1 and rs2, as described below.

Sv_sfence_cg/cp_ins

sfence_vma_invalidation

SFENCE.VMA is also used to invalidate entries in the address-translation cache associated with a hart (see sv32algorithm).

Sv_sfence_cg/cp_ins

sfence_vma_local_only

SFENCE.VMA orders only the local hart’s implicit references to the memory-management data structures.

Not tested: needs more than one hart

sfence_vma_all_asid_va

If rs1=x0 and rs2=x0, the fence orders all reads and writes made to any level of the page tables, for all address spaces. The fence also invalidates all address-translation cache entries, for all address spaces.

Sv_sfence_cg/cp_ins

sfence_vma_asid_only

If rs1=x0 and rs2≠x0, the fence orders all reads and writes made to any level of the page tables, but only for the address space identified by integer register rs2. Accesses to global mappings (see translation) are not ordered. The fence also invalidates all address-translation cache entries matching the address space identified by integer register rs2, except for entries containing global mappings.

sfence_vma_va_all_asid

If rs1≠x0 and rs2=x0, the fence orders only reads and writes made to leaf page table entries corresponding to the virtual address in rs1, for all address spaces. The fence also invalidates all address-translation cache entries that contain leaf page table entries corresponding to the virtual address in rs1, for all address spaces.

TODO: SFENCE.VMA with rs1!=x0 is not exercised

sfence_vma_va_asid

If rs1≠x0 and rs2≠x0, the fence orders only reads and writes made to leaf page table entries corresponding to the virtual address in rs1, for the address space identified by integer register rs2. Accesses to global mappings are not ordered. The fence also invalidates all address-translation cache entries that contain leaf page table entries corresponding to the virtual address in rs1 and that match the address space identified by integer register rs2, except for entries containing global mappings.

TODO: SFENCE.VMA with rs1!=x0 is not exercised

sfence_vma_invalid_va

If the value held in rs1 is not a valid virtual address, then the SFENCE.VMA instruction has no effect. No exception is raised in this case.

TODO: SFENCE.VMA with an invalid virtual address in rs1 is not exercised

sfence_vma_rs2_bits

When rs2≠x0, bits SXLEN-1:ASIDMAX of the value held in rs2 are reserved for future standard use. Until their use is defined by a standard extension, they should be zeroed by software and ignored by current implementations. Furthermore, if ASIDLEN<ASIDMAX, the implementation shall ignore bits ASIDMAX-1:ASIDLEN of the value held in rs2.

TODO: SFENCE.VMA with reserved rs2 bits set is not exercised

sfence_vma_ordering_semantics

An implicit read of the memory-management data structures may return any translation for an address that was valid at any time since the most recent SFENCE.VMA that subsumes that address. The ordering implied by SFENCE.VMA does not place implicit reads and writes to the memory-management data structures into the global memory order in a way that interacts cleanly with the standard RVWMO ordering rules. In particular, even though an SFENCE.VMA orders prior explicit accesses before subsequent implicit accesses, and those implicit accesses are ordered before their associated explicit accesses, SFENCE.VMA does not necessarily place prior explicit accesses before subsequent explicit accesses in the global memory order. These implicit loads also need not otherwise obey normal program order semantics with respect to prior loads or stores to the same address.

Not tested: which stale translation an implicit read returns is implementation-dependent

sfence_vma_implicit_access

Implementations must only perform implicit reads of the translation data structures pointed to by the current contents of the satp register or a subsequent valid (V=1) translation data structure entry, and must only raise exceptions for implicit accesses that are generated as a result of instruction execution, not those that are performed speculatively.

Sv_vm_permissions_cg/{cp_PTE_inv_read_s_d,cp_PTE_nonleaf_lvl0_s_d_read}

sfence_vma_sum_mxr_effect

Changes to the sstatus fields SUM and MXR take effect immediately, without the need to execute an SFENCE.VMA instruction.

Sv_vm_permissions_cg/cp_xpage_{mxrunset,mxrset}_read_{s,u}

sfence_vma_mode_effect

Changing satp.MODE from Bare to other modes and vice versa also takes effect immediately, without the need to execute an SFENCE.VMA instruction.

Not tested: every test executes SFENCE.VMA after writing satp

sfence_vma_asid_effect

Likewise, changes to satp.ASID take effect immediately.

Not tested: every test executes SFENCE.VMA after writing satp

asid_hart_private

If a hart employs an address-translation cache, that cache must appear to be private to that hart. In particular, the meaning of an ASID is local to a hart; software may choose to use the same ASID to refer to different address spaces on different harts.

Not tested: needs more than one hart

satp_ppn_Sv32_sz

22-bit physical page number (PPN)

Sv_vm_permissions_cg/{cp_spage_read_s_d,cp_spage_write_s_d,cp_spage_exec_s_i}

fetch_page_fault_no_x

Attempting to fetch an instruction from a page that does not have execute permissions raises a fetch page-fault exception.

Sv_vm_permissions_cg/{cp_spage_noexec_s_i,cp_spage_rwx_s_i_noexec,cp_upage_umode_noexec_u}

load_page_fault_no_r

Attempting to execute a load or load-reserved instruction whose effective address lies within a page without read permissions raises a load page-fault exception.

Sv_vm_permissions_cg/{cp_spage_noread_s_d,cp_spage_rwx_s_d_noread,cp_upage_umode_noread_u}

store_page_fault_no_w

Attempting to execute a store, store-conditional, AMO, or cache-block zero instruction whose effective address lies within a page without write permissions raises a store page-fault exception.

Sv_vm_permissions_cg/{cp_spage_nowrite_s_d,cp_spage_rwx_s_d_nowrite,cp_upage_umode_nowrite_u}

pte_u_op

The U bit indicates whether the page is accessible to user mode. U-mode software may only access the page when U=1. If the SUM bit in the sstatus register is set, supervisor mode software may also access pages with U=1.

Sv_vm_permissions_cg/{cp_upage_umode_read_u, cp_spage_rwx_s_d_noread, cp_upage_smode_sumset_read_s, cp_upage_smode_sumunset_noread_s}

pte_u_no_s_exec

Irrespective of SUM, the supervisor may not execute code on pages with U=1.

Sv_vm_permissions_cg/{cp_upage_smode_sumunset_noexec_s, cp_upage_smode_sumset_noexec_s}

pte_g_op

The G bit designates a global mapping. Global mappings are those that exist in all address spaces. For non-leaf PTEs, the global setting implies that all mappings in the subsequent levels of the page table are global.

Sv_res_global_pte_cg/{cp_global_read_s, cp_global_write_s, cp_global_exec_s, cp_global_read_u}

pte_rsw_ignored

The RSW field is reserved for use by supervisor software; the implementation shall ignore this field.

Sv_res_global_pte_cg/cp_rsw_pte

pte_a_def

Each leaf PTE contains an accessed (A) and dirty (D) bit. The A bit indicates the virtual page has been read, written, or fetched from since the last time the A bit was cleared.

Svadu_cg/{Abit_unset_exec_s, Abit_unset_read_u}, Svade_cg/{Abit_unset_write_s, Abit_unset_read_u}

pte_d_def

The D bit indicates the virtual page has been written since the last time the D bit was cleared.

Svadu_cg/{Dbit_unset_write_s, Dbit_unset_write_u}, Svade_cg/{Dbit_unset_write_s, Dbit_unset_write_u}

pte_ad_scheme_uniform

All harts in a system must employ the same PTE-update scheme as each other.

Not tested: needs more than one hart

lr_sc_rsrv_set_page

For implementations with both page-based virtual memory and the A standard extension, the LR/SC reservation set must lie completely within a single base physical page (i.e., a naturally aligned 4 KiB physical-memory region).

TODO: an LR to one 4 KiB page followed by an SC to a different page must fail

Sv39_sxlen_va_sz

This section describes a simple paged virtual-memory system for SXLEN=64, which supports 39-bit virtual address spaces.

Sv_vm_permissions_cg/{cp_spage_read_s_d,cp_spage_write_s_d,cp_spage_exec_s_i}

Sv39_vpn_sz

27-bit VPN

Sv_vm_permissions_cg/{cp_spage_read_s_d,cp_spage_write_s_d,cp_spage_exec_s_i}

satp_ppn_Sv39_sz

44-bit PPN

Sv_vm_permissions_cg/{cp_spage_read_s_d,cp_spage_write_s_d,cp_spage_exec_s_i}

Sv39_levels

three-level page table

Sv_vm_permissions_cg/{cp_spage_read_s_d,cp_spage_write_s_d,cp_spage_exec_s_i}

Sv39_page_offset_sz

12-bit page offset is untranslated

Sv_vm_permissions_cg/{cp_spage_read_s_d,cp_spage_write_s_d,cp_spage_exec_s_i}

Sv39_ptesize

PTESIZE equals 8

Sv_vm_permissions_cg/{cp_spage_read_s_d,cp_spage_write_s_d,cp_spage_exec_s_i}

Sv39_va_signext

must have bits 63–39 all equal to bit 38, or else a page-fault exception will occur

Sv_vm_permissions_cg/cp_canonical_{read,write,exec}_s, Sv_H_twostage_cg/cp_twostage_canonical

Sv39_leaf_any_level, Sv39_page_sizes

Sv39_leaf_any_level: Any level of PTE may be a leaf PTE Sv39_page_sizes: 2 MiB megapages and 1 GiB gigapages

Sv_vm_permissions_cg/{cp_spage_read_s_d,cp_spage_write_s_d,cp_spage_exec_s_i}

Sv39_superpage_align, Sv39_superpage_align_fault

Sv39_superpage_align: must be virtually and physically aligned to a boundary equal to its size Sv39_superpage_align_fault: A page-fault exception is raised if the physical address is insufficiently aligned

Sv_vm_permissions_cg/cp_misaligned_{exec,read,write}_s

Sv39_pte_count_sz

Sv39 page tables contain 29 page table entries (PTEs), eight bytes each.

Sv_vm_permissions_cg/{cp_spage_read_s_d,cp_spage_write_s_d,cp_spage_exec_s_i}

Sv39_pt_sz

exactly the size of a page

Sv_vm_permissions_cg/{cp_spage_read_s_d,cp_spage_write_s_d,cp_spage_exec_s_i}

Sv39_pt_align

must always be aligned to a page boundary

Sv_vm_permissions_cg/{cp_spage_read_s_d,cp_spage_write_s_d,cp_spage_exec_s_i}

Sv39_pte_Svnapot_rsv

If Svnapot is not implemented, bit 63 remains reserved and must be zeroed by software for forward compatibility, or else a page-fault exception is raised

Sv_add_feature_cg/cp_svnapot_{read,write,exec}_fault

Sv39_pte_Svpbmt_rsv

If Svpbmt is not implemented, bits 62-61 remain reserved and must be zeroed by software for forward compatibility, or else a page-fault exception is raised

Sv_add_feature_cg/cp_svpbmt_{read,write,exec}_fault

Sv39_pte_future_rsv

must be zeroed by software for forward compatibility. If any of these bits are set, a page-fault exception is raised

Sv_add_feature_cg/cp_reserved_{read,write,exec}_fault, Sv_vm_permissions_cg/cp_PTE_rsv_nleaf_{read,write,exec}_s

Sv48_sxlen

riscv.github.io/riscv-isa-manual/snapshot/spec/index.html#norm%3ASv48_sxlen

Sv_vm_permissions_cg/{cp_spage_read_s_d,cp_spage_write_s_d,cp_spage_exec_s_i}

Sv48_va_sz

48-bit virtual address spaces

Sv_vm_permissions_cg/{cp_spage_read_s_d,cp_spage_write_s_d,cp_spage_exec_s_i}

Sv48_vpn_sz

36-bit VPN

Sv_vm_permissions_cg/{cp_spage_read_s_d,cp_spage_write_s_d,cp_spage_exec_s_i}

satp_ppn_Sv48_sz

44-bit PPN

Sv_vm_permissions_cg/{cp_spage_read_s_d,cp_spage_write_s_d,cp_spage_exec_s_i}

Sv48_levels

four-level page table

Sv_vm_permissions_cg/{cp_spage_read_s_d,cp_spage_write_s_d,cp_spage_exec_s_i}

Sv48_page_offset_sz

12-bit page offset is untranslated

Sv_vm_permissions_cg/{cp_spage_read_s_d,cp_spage_write_s_d,cp_spage_exec_s_i}

Sv48_ptesize

PTESIZE equals 8

Sv_vm_permissions_cg/{cp_spage_read_s_d,cp_spage_write_s_d,cp_spage_exec_s_i}

Sv48_va_signext

must have bits 63–48 all equal to bit 47, or else a page-fault exception will occur

Sv_vm_permissions_cg/cp_canonical_{read,write,exec}_s, Sv_H_twostage_cg/cp_twostage_canonical

Sv48_leaf_any_level, Sv48_page_sizes

Sv48_leaf_any_level: Any level of PTE may be a leaf PTE Sv48_page_sizes: 2 MiB megapages, 1 GiB gigapages, and 512 GiB terapages

Sv_vm_permissions_cg/{cp_spage_read_s_d,cp_spage_write_s_d,cp_spage_exec_s_i}

Sv48_superpage_align, Sv48_superpage_align_fault

Sv48_superpage_align: must be virtually and physically aligned to a boundary equal to its size Sv48_superpage_align_fault: A page-fault exception is raised if the physical address is insufficiently aligned

Sv_vm_permissions_cg/cp_misaligned_{exec,read,write}_s

Sv48_requires_Sv39

Implementations that support Sv48 must also support Sv39

Not tested: extension dependency checked by the UDB configuration

Sv57_sxlen_va_sz

This section describes a simple paged virtual-memory system designed for RV64 systems, which supports 57-bit virtual address spaces.

Sv_VA_cg/{cp_VA_i_mode, cp_VA_d_mode}, Sv_add_feature_cg/{cp_read_nofault, cp_exec_nofault}

Sv57_vpn_sz

45-bit VPN

Sv_VA_cg/{cp_VA_i_mode, cp_VA_d_mode}, Sv_add_feature_cg/{cp_read_nofault, cp_exec_nofault}

satp_ppn_Sv57_sz

44-bit PPN

Sv_VA_cg/{cp_VA_i_mode, cp_VA_d_mode}, Sv_add_feature_cg/{cp_read_nofault, cp_exec_nofault}

Sv57_levels

five-level page table

Sv_VA_cg/{cp_VA_i_mode, cp_VA_d_mode}, Sv_add_feature_cg/{cp_read_nofault, cp_exec_nofault}

Sv57_page_offset_sz

12-bit page offset is untranslated

Sv_VA_cg/{cp_VA_i_mode, cp_VA_d_mode}, Sv_add_feature_cg/{cp_read_nofault, cp_exec_nofault}

Sv57_ptesize

PTESIZE equals 8

Sv_VA_cg/{cp_VA_i_mode, cp_VA_d_mode}, Sv_add_feature_cg/{cp_read_nofault, cp_exec_nofault}

Sv57_va_signext

must have bits 63–57 all equal to bit 56, or else a page-fault exception will occur

Sv_H_twostage_cg/cp_twostage_canonical

Sv57_leaf_any_level, Sv57_page_sizes

Sv57_leaf_any_level: Any level of PTE may be a leaf PTE Sv57_page_sizes: 2 MiB megapages, 1 GiB gigapages, 512 GiB terapages, and 256 TiB petapages

Sv57_superpage_align, Sv57_superpage_align_fault

Sv57_superpage_align: must be virtually and physically aligned to a boundary equal to its size Sv57_superpage_align_fault: A page-fault exception is raised if the physical address is insufficiently aligned

Sv57_requires_Sv48

Implementations that support Sv57 must also support Sv48

Not tested: extension dependency checked by the UDB configuration

stval_op_faulting_addr

If stval is written with a nonzero value when a breakpoint, address-misaligned, access-fault, page-fault, or hardware-error exception occurs on an instruction fetch, load, or store, then stval will contain the faulting virtual address.

Sv_vm_permissions_cg/{cp_spage_noread_s_d, cp_spage_nowrite_s_d, cp_spage_noexec_s_i}

mstatus_mxr_sum_op_acc_fault

The MXR and SUM mechanisms only affect the interpretation of permissions encoded in page-table entries. In particular, they have no impact on whether access-fault exceptions are raised due to PMAs or PMP.

TODO: combine MXR/SUM with a PMA or PMP access fault

mstatus_mprv_ldst_op

When MPRV=0, explicit memory accesses behave as normal, using the translation and protection mechanisms of the current privilege mode. When MPRV=1, load and store memory addresses are translated and protected, and endianness is applied, as though the current privilege mode were set to MPP.

Sv_Sm_mstatus_mprv_cg/cp_mprv_{load,store}

mstatus_mprv_inst_xlat_op

Instruction address-translation and protection are unaffected by the setting of MPRV.

Sv_Sm_mstatus_mprv_cg/cp_mprv_ins

mstatus_sum_op, mstatus_sum_op_mprv_mpp

mstatus_sum_op: When SUM=0, S-mode memory accesses to pages that are accessible by U-mode (U=1 in sv32pte) will fault. When SUM=1, these accesses are permitted. mstatus_sum_op_mprv_mpp: while SUM is ordinarily ignored when not executing in S-mode, it is in effect when MPRV=1 and MPP=S.

Sv_Sm_mstatus_mprv_cg/cp_mprv_upage_smode_sumunset_{noread,nowrite}, Sv_Sm_mstatus_mprv_cg/cp_mprv_upage_smode_sumset_{read,write}

mstatus_tvm_op, mstatus_tvm_warl

mstatus_tvm_op: When TVM=1, attempts to read or write the satp CSR or execute an SFENCE.VMA or SINVAL.VMA instruction while executing in S-mode will raise an illegal-instruction exception. When TVM=0, these operations are permitted in S-mode. mstatus_tvm_warl: The TVM (Trap Virtual Memory) bit is a WARL field that supports intercepting supervisor virtual-memory management operations.

Sv_Sm_mstatus_mprv_cg/cp_tvm_exception_s, Svinval_Sm_cg/cp_svinval

mstatus_mstatush_xbe_warl

The MBE, SBE, and UBE bits in mstatus and mstatush are WARL fields that control the endianness of memory accesses other than instruction fetches. Each may be read/write or read-only.

Sv_Sm_mstatus_mprv_cg/cp_mstatus_sbe_{read,write}

mstatus_sbe_implicit

For implicit accesses to supervisor-level memory management data structures, such as page tables, endianness is always controlled by SBE.

Sv_Sm_mstatus_mprv_cg/cp_mstatus_sbe_{read,write}

mtval_vaddr_wr_faulting_addr

If mtval is written with a nonzero value when a breakpoint, address-misaligned, access-fault, page-fault, or hardware-error exception occurs on an instruction fetch, load, or store, then mtval will contain the faulting virtual address.

Sv_Sm_mstatus_mprv_cg/{load_page_fault,store_page_fault}

fault_excep_csr

When a page-fault, guest-page-fault, or access-fault exception is taken, the relevant *tval CSR is written with the faulting effective address (i.e. the value of rs1).

Sv_Zicbo_cg/{cp_PTE_inv_cbo_s,cp_PTE_inv_cbo_u}, Sv_HZicbo_cg/{cp_vs_gpa,cp_vs_gpa_implicit,cp_g_pte}

cbm_unperm_fault

If access to the cache block is not permitted, a cache-block management instruction raises a store page-fault or store guest-page-fault exception if address translation does not permit any access or raises a store access-fault exception otherwise.

Sv_Zicbo_cg/{cp_spage_rwx_cbo_u,cp_upage_sumunset_cbo_s}, Sv_HZicbo_cg/{cp_vs_pte,cp_vs_gpa,cp_g_pte}

cbm_page_fault

The permissions required for a cache-block management instruction are defined in cmo; when address translation does not permit any access, the instruction raises a store page-fault exception.

Sv_Zicbo_cg/{cp_PTE_inv_cbo_s, cp_spage_rwx_cbo_u}, Sv_HZicbo_cg/{cp_vs_pte,cp_vs_gpa,cp_g_pte}

cbm_unperm_translate

During address translation, the instruction also checks the accessed bit and may either raise an exception or set the bit as required.

Sv_Zicbo_cg/{cp_Abit_unset_cbo_s,cp_Abit_unset_cbo_u}, Sv_HZicbo_cg/{cp_vs_pte,cp_g_pte}

cbz_unperm_fault

If access to the cache block is not permitted, a cache-block zero instruction raises a store page-fault or store guest-page-fault exception if address translation does not permit write access or raises a store access-fault exception otherwise.

Sv_Zicbo_cg/{cp_PTE_w_unset_zicboz_s,cp_PTE_w_unset_zicboz_u}, Sv_HZicbo_cg/{cp_vs_pte,cp_vs_gpa,cp_g_pte}

cbz_unperm_translate

During address translation, the instruction also checks the accessed and dirty bits and may either raise an exception or set the bits as required.

Sv_Zicbo_cg/{cp_Abit_unset_cbo_s, cp_Abit_unset_cbo_u, cp_Dbit_unset_zicboz_s, cp_Dbit_unset_zicboz_u}, Sv_HZicbo_cg/{cp_vs_pte,cp_g_pte}

cbp_unperm_noexcep

If access to the cache block is not permitted, a cache-block prefetch instruction does not raise any exceptions and shall not access any caches or memory.

Sv_HZicbo_cg/{cp_vs_prefetch,cp_g_prefetch}

cbp_unperm_translate

During address translation, the instruction does not check the accessed and dirty bits and neither raises an exception nor sets the bits.

Sv_HZicbo_cg/{cp_vs_prefetch,cp_g_prefetch}

cbm_access

A cache-block management instruction is permitted to access the specified cache block whenever a load instruction or store instruction is permitted to access the corresponding physical addresses.

Sv_Zicbo_cg/{cp_PTE_r_set_w_unset_zicbom_s,cp_PTE_r_set_w_unset_zicbom_u}, Sv_HZicbo_cg/{cp_vs_pte,cp_vs_gpa,cp_g_pte}

pma_chk_paddr

PMAs are checked for any access to physical memory, including accesses that have undergone virtual to physical memory translation.

Sv_Zicbo_cg/{cp_leaf_PTE_to_nonexistent_pa_cbo_s,cp_leaf_PTE_to_nonexistent_pa_cbo_u}, Sv_HZicbo_cg/{cp_vs_gpa,cp_g_pa}

mcause_exccode_priority_misaligned

Load/store/AMO address-misaligned exceptions may have either higher or lower priority than load/store/AMO page-fault and access-fault exceptions.

Sv_Exceptions_cg/cp_misaligned_priority_{load, store}_{s, u}, Sv_ExceptionsSm_cg/cp_misaligned_priority_{load, store}_m, Sv_ExceptionsZaamo_cg/{cp_misaligned_priority_s, cp_misaligned_priority_u}, Sv_ExceptionsZalrsc_cg/{cp_misaligned_priority_s, cp_misaligned_priority_u}

exc_priority

Priority|Exc.Code|Description === Highest|3|Instruction address breakpoint¶|12, 1|During instruction address translation: First encountered page fault or access fault¶|1|With physical address for instruction: Instruction access fault¶|2 0 8,9,11 3 3|Illegal instruction Instruction address misaligned Environment call Environment break Load/store/AMO address breakpoint¶|4,6|Optionally: Load/store/AMO address misaligned¶|13, 15, 5, 7|During address translation for an explicit memory access: First encountered page fault or access fault¶|5,7|With physical address for an explicit memory access: Load/store/AMO access fault¶Lowest|4,6|If not higher priority: Load/store/AMO address misaligned ===

Sv_Exceptions_cg/cp_misaligned_priority_{load, store, fetch}_{s, u}, Sv_ExceptionsSm_cg/cp_misaligned_priority_{load, store}_m, Sv_ExceptionsZaamo_cg/{cp_misaligned_priority_s, cp_misaligned_priority_u}, Sv_ExceptionsZalrsc_cg/{cp_misaligned_priority_s, cp_misaligned_priority_u}

ia_fault_exc_on_target

If an instruction access-fault or instruction page-fault exception occurs on the target of a jump or taken branch, the exception is reported on the target instruction, not on the jump or branch instruction.

Sv_Exceptions_cg/{cp_misaligned_priority_fetch_s, cp_misaligned_priority_fetch_u}

amo_alignment

For AMOs, the Zaamo extension requires that the address held in rs1 be naturally aligned to the size of the operand (i.e., eight-byte aligned for doublewords and four-byte aligned for words).

Sv_ExceptionsZaamo_cg/{cp_misaligned_priority_s, cp_misaligned_priority_u}

misaligned_atomicity_granule_size

The misaligned atomicity granule PMA, defined in sec:misaligned-atomicity-granule, optionally relaxes this alignment requirement. If present, the misaligned atomicity granule PMA specifies the size of a misaligned atomicity granule, a power-of-two number of bytes. The misaligned atomicity granule PMA applies only to AMOs defined in the Zaamo, Zabha, and Zacas extensions; loads and stores defined in the base ISAs; loads and stores of no more than XLEN bits defined in the F, D, and Q extensions; the load-acquire and store-release instructions defined in the Zalasr extension; and compressed encodings of the foregoing loads and stores. For an instruction in that set, if all accessed bytes lie within the same misaligned atomicity granule, the instruction will not raise an exception for reasons of address alignment, and the instruction will give rise to only one memory operation for the purposes of RVWMO—​i.e., it will execute atomically.

Sv_ExceptionsZaamo_cg/{cp_misaligned_priority_s, cp_misaligned_priority_u}

sc_retire_permission

No SC.W instruction shall retire unless it passes memory permission checks,

Sv_ExceptionsZalrsc_cg/{cp_misaligned_priority_s, cp_misaligned_priority_u}

lr_sc_alignment

For LR and SC, the Zalrsc extension requires that the address held in rs1 be naturally aligned to the size of the operand (i.e., eight-byte aligned for doublewords and four-byte aligned for words). If the address is not naturally aligned, an address-misaligned exception or an access-fault exception will be generated. The access-fault exception can be generated for a memory access that would otherwise be able to complete except for the misalignment, if the misaligned access should not be emulated.

Sv_ExceptionsZalrsc_cg/{cp_misaligned_priority_s, cp_misaligned_priority_u}

H_vm_supported, H_vm_twostage, hgatp_mode_bare, hgatp_mode_bare_trans

H_vm_supported: standard page-based address translation must be supported, either Sv32 for RV32, or a minimum of Sv39 for RV64 H_vm_twostage: Whenever the current virtualization mode V is 1, two-stage address translation and protection is in effect. For any virtual memory access, the original virtual address is converted in the first stage by VS-level address translation, as controlled by the vsatp register, into a guest physical address. The guest physical address is then converted in the second stage by guest physical address translation, as controlled by the hgatp register, into a supervisor physical address. The two stages are known also as VS-stage and G-stage translation. hgatp_mode_bare: norm:hgatp_mode_enc shows the encodings of the MODE field when HSXLEN=32 and HSXLEN=64. When MODE=Bare, guest physical addresses are equal to supervisor physical addresses, and there is no further memory protection for a guest virtual machine beyond the physical memory protection scheme described in pmp. In this case, software must write zero to the remaining fields in hgatp. hgatp_mode_bare_trans: When the address translation scheme selected by the MODE field of hgatp is Bare, guest physical addresses are equal to supervisor physical addresses without modification, and no memory protection applies in the trivial translation of guest physical addresses to supervisor physical addresses.

Sv_H_vsstage_cg/cp_vsatp_perm, Sv_H_gstage_cg/cp_hgatp_perm, Sv_H_twostage_cg/cp_twostage_perm, Sv_H_twostage_cg/cp_stage_both_bare, Sv_HZicbo_cg/{cp_vs_pte,cp_vs_gpa,cp_g_pte}

H_vm_gpatrans, H_vm_gpapriv, H_vm_gpa_g, Svrsw60t59b_H_g_stage_reserved_bits

H_vm_gpatrans: The conversion of an Sv32x4, Sv39x4, Sv48x4, or Sv57x4 guest physical address is accomplished with the same algorithm used for Sv32, Sv39, Sv48, or Sv57, as presented in sv32algorithm, except that: H_vm_gpapriv: For G-stage address translation, all memory accesses (including those made to access data structures for VS-stage address translation) are considered to be user-level accesses, as though executed in U-mode. Access type permissions—readable, writable, or executable—are checked during G-stage translation the same as for VS-stage translation. For a memory access made to support VS-stage address translation (such as to read/write a VS-level page table), permissions and the need to set A and/or D bits at the G-stage level are checked as though for an implicit load or store, not for the original access type. However, any exception is always reported for the original access type (instruction, load, or store/AMO). H_vm_gpa_g: The G bit in all G-stage PTEs is currently not used. Until its use is defined by a standard extension, it should be cleared by software for forward compatibility, and must be ignored by hardware. Svrsw60t59b_H_g_stage_reserved_bits: If the Hypervisor (H) extension is also implemented, then bits 60-59 of the G-stage PTEs are reserved for use by supervisor software and are ignored by the implementation.

Sv_H_gstage_cg/cp_hgatp_perm, Sv_H_twostage_cg/cp_twostage_perm, Sv_H_twostage_cg/cp_implicit_gpf, Sv_H_twostage_cg/cp_implicit_mxr, Sv_H_twostage_cg/cp_twostage_access_fault_{load, store, fetch}, Sv_H_hlv_cg/cp_hlv_implicit, Sv_HZicbo_cg/{cp_vs_sum,cp_g_pte}

hgatp_mode_x4

When hgatp.⁠MODE specifies a translation scheme of Sv32x4, Sv39x4, Sv48x4, or Sv57x4, G-stage address translation is a variation on the usual page-based virtual address translation scheme of Sv32, Sv39, Sv48, or Sv57, respectively. In each case, the size of the incoming address is widened by 2 bits (to 34, 41, 50, or 59 bits). To accommodate the two extra bits, the root page table (only) is expanded by a factor of 4 to be 16 KiB instead of the usual 4 KiB. Matching its larger size, the root page table also must be aligned to a 16 KiB boundary instead of the usual 4 KiB page boundary. Except as noted, all other aspects of Sv32, Sv39, Sv48, or Sv57 are adopted unchanged for G-stage translation. Non-root page tables and all page table entries (PTEs) have the same formats as documented in sv32, sv39, sv48, and sv57.

Sv_H_gstage_cg/cp_hgatp_gpa_width, Sv_H_twostage_cg/cp_hgatp_sv32x4_gpa, Sv_H_twostage_cg/cp_twostage_gpa_width

hgatp_mode_sv39x4, hgatp_mode_sv48x4, hgatp_mode_Sv57x4

hgatp_mode_sv39x4: For Sv39x4, an incoming guest physical address is partitioned as shown in sv39x4va. This partitioning is identical to that for an Sv39 virtual address as depicted in sv39va, except with 2 more bits at the high end in VPN[2]. Address bits 63:41 must all be zeros, or else a guest-page-fault exception occurs. hgatp_mode_sv48x4: For Sv48x4, an incoming guest physical address is partitioned as shown in sv48x4va. This partitioning is identical to that for an Sv48 virtual address as depicted in sv48va, except with 2 more bits at the high end in VPN[3]. Address bits 63:50 must all be zeros, or else a guest-page-fault exception occurs. hgatp_mode_Sv57x4: For Sv57x4, an incoming guest physical address is partitioned as shown in sv57x4va. This partitioning is identical to that for an Sv57 virtual address as depicted in sv57va, except with 2 more bits at the high end in VPN[4]. Address bits 63:59 must all be zeros, or else a guest-page-fault exception occurs.

Sv_H_gstage_cg/cp_hgatp_perm, Sv_H_gstage_cg/cp_hgatp_svade, Sv_H_twostage_cg/cp_twostage_perm, Sv_H_gstage_cg/cp_hgatp_gpa_width, Sv_H_twostage_cg/cp_twostage_gpa_width

hgatp_mode_sv32x4

For Sv32x4, an incoming guest physical address is partitioned into a virtual page number (VPN) and page offset as shown in sv32x4va. This partitioning is identical to that for an Sv32 virtual address as depicted in sv32va, except with two more bits at the high end in VPN[1]. (Note that the fields of a partitioned guest physical address also correspond one-for-one with the structure that Sv32 assigns to a physical address, depicted in sv32va.)

Sv_H_twostage_cg/cp_hgatp_sv32x4_gpa

vsatp_mode_unsupported_v0

When V=0, a write to vsatp with an unsupported MODE value is either ignored as it is for satp, or the fields of vsatp are treated as WARL in the normal way.

Sv_H_csr_cg/cp_vsatp_mode_field

vsatp_mode_unsupported_v1, vsatp_sz_acc_op

vsatp_mode_unsupported_v1: However, when V=1, a write to satp with an unsupported MODE value is ignored and no write to vsatp is effected. vsatp_sz_acc_op: The vsatp register is a VSXLEN-bit read/write register that is VS-mode’s version of supervisor register satp, formatted as shown in rv32vsatpreg for VSXLEN=32 and rv64vsatpreg for VSXLEN=64. When V=1, vsatp substitutes for the usual satp, so instructions that normally read or modify satp actually access vsatp instead. vsatp controls VS-stage address translation, the first stage of two-stage translation for guest virtual addresses (see two-stage-translation).

Sv_H_csr_cg/cp_satp_mode_field

hgatp_mode_Sv, hgatp_mode_warl

hgatp_mode_Sv: When HSXLEN=32, the only other valid setting for MODE is Sv32x4, which is a modification of the usual Sv32 paged virtual-memory scheme, extended to support 34-bit guest physical addresses. When HSXLEN=64, modes Sv39x4, Sv48x4, and Sv57x4 are defined as modifications of the Sv39, Sv48, and Sv57 paged virtual-memory schemes. All of these paged virtual-memory schemes are described in guest-addr-translation. hgatp_mode_warl: A write to hgatp with an unsupported MODE value is not ignored as it is for satp. Instead, the fields of hgatp are WARL in the normal way, when so indicated.

Sv_H_csr_cg/cp_hgatp_mode_field

H_vm_gstagetrans, H_trap_xtinst_guestpage, H_trap_xtinst_guestpage_rw

H_vm_gstagetrans: When V=1, memory accesses that would normally bypass address translation are subject to G-stage address translation alone. This includes memory accesses made in support of VS-stage address translation, such as reads and writes of VS-level page tables. H_trap_xtinst_guestpage: For guest-page faults, the trap instruction register is written with a special pseudoinstruction value if: (a) the fault is caused by an implicit memory access for VS-stage address translation, and (b) a nonzero value (the faulting guest physical address) is written to mtval2 or htval. If both conditions are met, the value written to mtinst or htinst must be taken from norm:H_trap_xtinst_pseudoinst_tbl; zero is not allowed. H_trap_xtinst_guestpage_rw: A write pseudoinstruction (0x00002020 or 0x00003020) is used for the case that the machine is attempting automatically to update bits A and/or D in VS-level page tables. All other implicit memory accesses for VS-stage address translation will be reads. If a machine never automatically updates bits A or D in VS-level page tables (leaving this to software), the write case will never arise. The fact that such a page table update must actually be atomic, not just a simple write, is ignored for the pseudoinstruction.

Sv_H_twostage_cg/cp_implicit_gpf, Svadu_H_cg/{cp_implicit_gpf,cp_hlv_implicit}, Sv_HSm_trap_cg/cp_guest_page_fault_m, Sv_HSm_trap_cg/cp_implicit_gpf_m, Sv_H_hlv_cg/{cp_hlv_implicit,cp_hlv_root_gpf}, Sv_HZicbo_cg/{cp_vs_gpa,cp_vs_gpa_implicit,cp_g_pte}

htval_trapval, mtval2_htval_virtaddr, hstatus_gva_op

htval_trapval: When a guest-page-fault trap is taken into HS-mode, htval is written with either zero or the guest physical address that faulted, shifted right by 2 bits. For other traps, htval is set to zero, but a future standard or extension may redefine `htval’s setting for other traps. mtval2_htval_virtaddr: When a guest-page fault is not due to an implicit memory access for VS-stage address translation, a nonzero guest physical address written to mtval2/htval shall correspond to the exact virtual address written to mtval/stval. hstatus_gva_op: Field GVA (Guest Virtual Address) is written by the implementation whenever a trap is taken into HS-mode. For any trap (breakpoint, address misaligned, access fault, page fault, or guest-page fault) that writes a guest virtual address to stval, GVA is set to 1. For any other trap into HS-mode, GVA is set to 0.

Sv_H_gstage_cg/cp_hgatp_perm, Sv_H_twostage_cg/cp_twostage_perm, Sv_H_twostage_cg/cp_implicit_gpf, Sv_H_twostage_cg/cp_hgatp_sv32x4_gpa, Sv_HSm_trap_cg/cp_guest_page_fault_m, Sv_HSm_trap_cg/cp_implicit_gpf_m, Sv_H_hlv_cg/cp_hlv_root_gpf, Sv_HZicbo_cg/{cp_vs_gpa,cp_vs_gpa_implicit,cp_g_pte}

H_guest_page_fault

Guest-page-fault traps may be delegated from M-mode to HS-mode under the control of CSR medeleg, but cannot be delegated to other privilege modes. On a guest-page fault, CSR mtval or stval is written with the faulting guest virtual address as usual, and mtval2 or htval is written either with zero or with the faulting guest physical address, shifted right by 2 bits. CSR mtinst or htinst may also be written with information about the faulting instruction or other reason for the access, as explained in tinst-vals.

Sv_H_twostage_cg/cp_hedeleg_guest_page_fault, Sv_H_gstage_cg/cp_hgatp_perm, Sv_H_twostage_cg/cp_twostage_perm, Sv_H_twostage_cg/cp_implicit_gpf, Sv_HSm_trap_cg/cp_guest_page_fault_m, Sv_HSm_trap_cg/cp_implicit_gpf_m

H_straddle

When an instruction fetch or a misaligned memory access straddles a page boundary, two different address translations are involved. When a guest-page fault occurs in such a circumstance, the faulting virtual address written to mtval/stval is the same as would be required for a regular page fault. Thus, the faulting virtual address may be a page-boundary address that is higher than the instruction’s original virtual address, if the byte at that page boundary is among the accessed bytes.

Sv_H_twostage_cg/cp_straddle, Sv_H_twostage_cg/cp_ldst_straddle, Sv_HSm_trap_cg/cp_straddle_m, Sv_HSm_trap_cg/cp_ldst_straddle_m

hedeleg_op, H_trap_deleg

hedeleg_op: A synchronous trap that has been delegated to HS-mode (using medeleg) is further delegated to VS-mode if V=1 before the trap and the corresponding hedeleg bit is set. H_trap_deleg: When a trap occurs in HS-mode or U-mode, it goes to M-mode, unless delegated by medeleg or mideleg, in which case it goes to HS-mode. When a trap occurs in VS-mode or VU-mode, it goes to M-mode, unless delegated by medeleg or mideleg, in which case it goes to HS-mode, unless further delegated by hedeleg or hideleg, in which case it goes to VS-mode.

Sv_H_twostage_cg/cp_hedeleg_page_fault, Sv_H_twostage_cg/cp_hedeleg_guest_page_fault

vsstatus_mxr_vm, sstatus_mxr_vm

vsstatus_mxr_vm: The vsstatus field MXR, which makes execute-only pages readable by explicit loads, only overrides VS-stage page protection. Setting MXR at VS-level does not override guest-physical page protections. sstatus_mxr_vm: Setting MXR at HS-level, however, overrides both VS-stage and G-stage execute-only permissions.

Sv_H_vsstage_cg/cp_vsstatus_mxr, Sv_H_gstage_cg/cp_hgatp_mxr, Sv_H_twostage_cg/cp_twostage_mxr, Sv_H_twostage_cg/cp_implicit_mxr

vsstatus_sz_acc_op

The vsstatus register is a VSXLEN-bit read/write register that is VS-mode’s version of supervisor register sstatus, formatted as shown in vsstatusreg-rv32 when VSXLEN=32 and vsstatusreg when VSXLEN=64. When V=1, vsstatus substitutes for the usual sstatus, so instructions that normally read or modify sstatus actually access vsstatus instead.

Sv_H_vsstage_cg/cp_vsatp_sum

hlsv_priv, hlsv_trans, hlsv_sstatus_mxr, hlsv_vsstatus_mxr, vsatp_v0

hlsv_priv: Each instruction performs an explicit memory access with an effective privilege mode of VS or VU. The effective privilege mode of the explicit memory access is VU when hstatus.SPVP=0, and VS when hstatus.SPVP=1. hlsv_trans: As usual for VS-mode and VU-mode, two-stage address translation is applied, and the HS-level sstatus.SUM is ignored. hlsv_sstatus_mxr: HS-level sstatus.MXR makes execute-only pages readable by explicit loads for both stages of address translation (VS-stage and G-stage) hlsv_vsstatus_mxr: vsstatus.MXR affects only the first translation stage (VS-stage). vsatp_v0: When V=0, vsatp does not directly affect the behavior of the machine, unless a virtual-machine load/store (HLV, HLVX, or HSV) or the MPRV feature in the mstatus register is used to execute a load or store as though V=1.

Sv_H_hlv_cg/cp_hlv_priv, Sv_H_hlv_cg/cp_hlv_mxr, Sv_H_hlv_cg/cp_hlv_root_gpf, Sv_HSm_mprv_cg/cp_vsatp_mprv_effects, Sv_HSm_mprv_cg/cp_hgatp_mprv_effects, Sv_HSm_mprv_cg/cp_mprv_sum, Sv_HSm_mprv_cg/cp_mprv_mxr

hlsv_u_op

Instructions HLVX.HU and HLVX.WU are the same as HLV.HU and HLV.WU, except that execute permission takes the place of read permission during address translation. That is, the memory being read must be executable in both stages of address translation, but read permission is not required. For the supervisor physical address that results from address translation, the supervisor physical memory attributes must grant both execute and read permissions. (The supervisor physical memory attributes are the machine’s physical memory attributes as modified by physical memory protection, pmp, for supervisor level.)

Sv_H_hlv_cg/cp_hlv_mxr, Sv_H_hlv_cg/cp_hlvx_perm, Sv_H_hlv_cg/cp_hlv_implicit

henvcfg_pbmte_op, Svpbmt_vsatp_stage_override_rule

henvcfg_pbmte_op: The PBMTE bit controls whether the Svpbmt extension is available for use in VS-stage address translation. When PBMTE=1, Svpbmt is available for VS-stage address translation. When PBMTE=0, the implementation behaves as though Svpbmt were not implemented for VS-stage address translation. If Svpbmt is not implemented, PBMTE is read-only zero. Svpbmt_vsatp_stage_override_rule: if vsatp.MODE is not equal to zero, non-zero VS-stage PTE PBMT bits override the intermediate attributes to produce the final set of attributes used by accesses to the page in question.

Svpbmt_H_cg/cp_vsatp_pbmt

menvcfg_pbmte_op, Svpbmt_hgatp_stage_override_rule

menvcfg_pbmte_op: The PBMTE bit controls whether the Svpbmt extension is available for use in S-mode and G-stage address translation (i.e., for page tables pointed to by satp or hgatp). When PBMTE=1, Svpbmt is available for S-mode and G-stage address translation. When PBMTE=0, the implementation behaves as though Svpbmt were not implemented. Svpbmt_hgatp_stage_override_rule: if hgatp.MODE is not equal to zero, non-zero G-stage PTE PBMT bits override the attributes in the PMA to produce an intermediate set of attributes.

Svpbmt_H_cg/cp_hgatp_pbmt

henvcfg_adue_op

If the Svadu extension is implemented, the ADUE bit controls whether hardware updating of PTE A/D bits is enabled for VS-stage address translation. When ADUE=1, hardware updating of PTE A/D bits is enabled during VS-stage address translation, and the implementation behaves as though the Svade extension were not implemented for VS-mode address translation. When ADUE=0, the implementation behaves as though Svade were implemented for VS-stage address translation. If Svadu is not implemented, ADUE is read-only zero.

Sv_H_vsstage_cg/cp_vsatp_svade, Sv_H_twostage_cg/cp_twostage_svade, Svadu_H_cg/{cp_vsatp_adue,cp_twostage_adue}

menvcfg_adue_op

If the Svadu extension is implemented, the ADUE bit controls whether hardware updating of PTE A/D bits is enabled for S-mode and G-stage address translations. When ADUE=1, hardware updating of PTE A/D bits is enabled during S-mode address translation, and the implementation behaves as though the Svade extension were not implemented for S-mode address translation. When the hypervisor extension is implemented, if ADUE=1, hardware updating of PTE A/D bits is enabled during G-stage address translation, and the implementation behaves as though the Svade extension were not implemented for G-stage address translation. When ADUE=0, the implementation behaves as though Svade were implemented for S-mode and G-stage address translation.

Sv_H_gstage_cg/cp_hgatp_svade, Sv_H_twostage_cg/cp_twostage_svade, Svadu_H_cg/{cp_hgatp_adue,cp_twostage_adue}

menvcfg_adue_henvcfg_adue_rdonly0, menvcfg_pbmte_henvcfg_pbmte_rdonly0, Svadu_hypervisor_adue_writable

menvcfg_adue_henvcfg_adue_rdonly0: for implementations with the hypervisor extension, henvcfg.ADUE is read-only zero if menvcfg.ADUE is zero. menvcfg_pbmte_henvcfg_pbmte_rdonly0: for implementations with the hypervisor extension, henvcfg.PBMTE is read-only zero if menvcfg.PBMTE is zero. Svadu_hypervisor_adue_writable: If the hypervisor extension is additionally implemented, the henvcfg.ADUE field is also writable.

Svadu_H_cg/{cp_henvcfg_menvcfg,cp_vsatp_adue}, Svpbmt_H_cg/cp_henvcfg_menvcfg

Svnapot_hyp_gstage

Svnapot is also supported in G-stage translation

Svnapot_H_cg/{cp_hgatp_napot,cp_twostage_napot}

vs_stage_speculative_a_bit

However, even when vsatp is active, VS-stage page-table entries’ A bits must not be set as a result of speculative execution, unless the effective privilege mode is VS or VU.

Not tested: speculative execution is not architecturally observable

hstatus_spvp_virtls_op

SPVP controls the effective privilege of explicit memory accesses made by the virtual-machine load/store instructions, HLV, HLVX, and HSV.

Sv_H_hlv_cg/cp_hlv_priv

hgatp_root_pt_sz_align

As explained in guest-addr-translation, for the paged virtual-memory schemes (Sv32x4, Sv39x4, Sv48x4, and Sv57x4), the root page table is 16 KiB and must be aligned to a 16-KiB boundary.

Sv_H_gstage_cg/cp_hgatp_gpa_width, Sv_H_twostage_cg/cp_hgatp_sv32x4_gpa

hgatp_op_hfence_gvma

Note that writing hgatp does not imply any ordering constraints between page-table updates and subsequent G-stage address translations.

Not tested: no behavior is required; tests execute hfence.gvma after writing hgatp

sfence_vma_v0

The behavior of the SFENCE.VMA instruction is affected by the current virtualization mode V. When V=0, the virtual-address argument is an HS-level virtual address, and the ASID argument is an HS-level ASID. The instruction orders stores only to HS-level address-translation structures with subsequent HS-level address translations.

Sv_sfence_cg/cp_ins (Sv tests on an H hart run with V=0)

sfence_vma_v1

When V=1, the virtual-address argument to SFENCE.VMA is a guest virtual address within the current virtual machine, and the ASID argument is a VS-level ASID within the current virtual machine. The current virtual machine is identified by the VMID field of CSR hgatp, and the effective ASID is the combination of this VMID with the VS-level ASID. The SFENCE.VMA instruction orders stores only to the VS-level address-translation structures with subsequent VS-stage address translations for the same virtual machine, i.e., only when hgatp.VMID is the same as when the SFENCE.VMA executed.

Sv_H_fence_cg/{cp_sfence_vma_vs, cp_sfence_vma_vs_asid}

mstatus_mprv_hypervisor

The hypervisor extension changes the behavior of the Modify Privilege field, MPRV, of mstatus. When MPRV=0, translation and protection behave as normal. When MPRV=1, explicit memory accesses are translated and protected, and endianness is applied, as though the current virtualization mode were set to MPV and the current nominal privilege mode were set to MPP. norm:H_mprv_tbl enumerates the cases.

Sv_HSm_mprv_cg/cp_vsatp_mprv_effects, Sv_HSm_mprv_cg/cp_hgatp_mprv_effects, Sv_HSm_mprv_cg/cp_mprv_sum, Sv_HSm_mprv_cg/cp_mprv_mxr

mstatus_mprv_hlsv

MPRV does not affect the virtual-machine load/store instructions, HLV, HLVX, and HSV. The explicit loads and stores of these instructions always act as though V=1 and the nominal privilege mode were hstatus.SPVP, overriding MPRV.

Sv_HSm_mprv_cg/cp_hgatp_mprv_effects

mtval2_trapval, mtval2_trapval_vstrans, mstatus_gva_op, mstatus_mpv_op

mtval2_trapval: When a guest-page-fault trap is taken into M-mode, mtval2 is written with either zero or the guest physical address that faulted, shifted right by 2 bits. For other traps, mtval2 is set to zero, but a future standard or extension may redefine `mtval2’s setting for other traps. mtval2_trapval_vstrans: If a guest-page fault is due to an implicit memory access during first-stage (VS-stage) address translation, a guest physical address written to mtval2 is that of the implicit memory access that faulted. Additional information is provided in CSR mtinst to disambiguate such situations. mstatus_gva_op: Field GVA (Guest Virtual Address) is written by the implementation whenever a trap is taken into M-mode. For any trap (breakpoint, address misaligned, access fault, page fault, or guest-page fault) that writes a guest virtual address to mtval, GVA is set to 1. For any other trap into M-mode, GVA is set to 0. mstatus_mpv_op: The MPV bit (Machine Previous Virtualization Mode) is written by the implementation whenever a trap is taken into M-mode. Just as the MPP field is set to the (nominal) privilege mode at the time of the trap, the MPV bit is set to the value of the virtualization mode V at the time of the trap. When an MRET instruction is executed, the virtualization mode V is set to MPV, unless MPP=3, in which case V remains 0.

Sv_HSm_trap_cg/cp_guest_page_fault_m, Sv_HSm_trap_cg/cp_implicit_gpf_m

mtval2_trapval_other

Otherwise, for misaligned loads and stores that cause guest-page faults, a nonzero guest physical address in mtval2 corresponds to the faulting portion of the access as indicated by the virtual address in mtval. For instruction guest-page faults on systems with variable-length instructions, a nonzero mtval2 corresponds to the faulting portion of the instruction as indicated by the virtual address in mtval.

Sv_HSm_trap_cg/cp_straddle_m, Sv_HSm_trap_cg/cp_ldst_straddle_m

henvcfg_cbie

The Zicbom extension adds the CBIE (Cache Block Invalidate instruction Enable) WARL field to henvcfg. The CBIE field controls execution of the cache block invalidate instruction (CBO.INVAL) in privilege modes VS and VU. The encoding 0b10 is reserved. When the Zicbom extension is not implemented, CBIE is read-only zero.

Sv_HZicbo_cg/{cp_cbie_vs,cp_cbie_vu}, H_hscsr_cg/cp_hcsrwalk_masked, HSm_mcsr_cg/cp_hcsrwalk_masked

cbo-inval_h_mode_veq1_op

When V=1, if the CBO.INVAL instruction is not HS-qualified, it raises an illegal-instruction exception. If the instruction is HS-qualified and the CBIE field is set to 0b01 or 0b11, the instruction is enabled for execution; otherwise, it raises a virtual-instruction exception.

Sv_HZicbo_cg/{cp_cbie_vs,cp_cbie_vu}

cbo-inval

A CBO.INVAL instruction executes or raises either an illegal-instruction exception or a virtual-instruction exception based on the state of the envcfg.⁠CBIE fields:

Sv_HZicbo_cg/{cp_cbie_vs,cp_cbie_vu}

henvcfg_cbcfe

The Zicbom extension adds the CBCFE (Cache Block Clean and Flush instruction Enable) field to henvcfg. When V=1, if the CBO.CLEAN and CBO.FLUSH instructions are not HS-qualified, they raise an illegal-instruction exception. If the instructions are HS-qualified and the CBCFE field is set to 1, the instructions are enabled for execution; otherwise, if the CBCFE field is set to 0, they raise a virtual-instruction exception. When the Zicbom extension is not implemented, CBCFE is read-only zero.

Sv_HZicbo_cg/{cp_cbcfe_vs,cp_cbcfe_vu}, H_hscsr_cg/cp_hcsrwalk_masked, HSm_mcsr_cg/cp_hcsrwalk_masked

cbo-clean_cbo-flush

A CBO.CLEAN or CBO.FLUSH instruction executes or raises an illegal-instruction or virtual-instruction exception based on the state of the envcfg.⁠CBCFE bits:

Sv_HZicbo_cg/{cp_cbcfe_vs,cp_cbcfe_vu}

henvcfg_cbze

The Zicboz extension adds the CBZE (Cache Block Zero instruction enable) field to henvcfg. The CBZE field applies to execution of the cache block zero instruction (CBO.ZERO) in privilege modes VS and VU, and only when the instruction is HS-qualified. If the instruction is not HS-qualified, it raises an illegal-instruction exception. If the instruction is HS-qualified and the CBZE field is set to 1, the instruction is enabled for execution; otherwise, if the CBZE field is set to 0, it raises a virtual-instruction exception. When the Zicboz extension is not implemented, CBZE is read-only zero.

Sv_HZicbo_cg/{cp_cbze_vs,cp_cbze_vu}, H_hscsr_cg/cp_hcsrwalk_masked, HSm_mcsr_cg/cp_hcsrwalk_masked

cbo-zero_basedon_xenvcfg_cbze

Finally, a CBO.ZERO instruction executes or raises an illegal-instruction or virtual-instruction exception based on the state of the envcfg.⁠CBZE bits:

Sv_HZicbo_cg/{cp_cbze_vs,cp_cbze_vu}

cbz_access

A cache-block zero instruction is permitted to access the specified cache block whenever a store instruction is permitted to access the corresponding physical addresses and when the PMAs indicate that cache-block zero instructions are a supported access type.

Sv_HZicbo_cg/{cp_vs_pte,cp_vs_gpa,cp_g_pte}

Svadu_disabled_hw_update_falls_back_to_Svade

When hardware updating of A/D bits is disabled, the Svade extension, which mandates exceptions when A/D bits need be set, instead takes effect.

Sv_HZicbo_cg/{cp_vs_pte,cp_g_pte}

cbo-inval_h_mode_enabled_op, cbo-inval_h_mode_flush_enc

cbo-inval_h_mode_enabled_op: If CBO.INVAL is enabled in HS-mode to perform a flush operation, then when the instruction is enabled in VS- or VU-mode it performs a flush operation, even if CBIE is set to 0b11. Otherwise, when the instruction is enabled for execution, its behavior depends on the CBIE encoding, as follows: cbo-inval_h_mode_flush_enc: 0b01 — The instruction is executed and performs a flush operation, even if configured by VS-mode to perform an invalidate operation.

Sv_HZicbo_cg/{cp_cbie_vs,cp_cbie_vu}

cbo-inval_h_mode_inval_enc

0b11 — The instruction is executed and performs an invalidate operation, unless configured by VS-mode to perform a flush operation.

Not tested: whether an invalidate discards stored data depends on the cache hierarchy, so a test cannot tell it from a flush

UDB Parameters: None.

B.7.2. Svbare Virtual Memory Off

The Svbare suite has two covergroups: Svbare_cg (S-mode and U-mode) and Svbare_Sm_cg (M-mode with MPRV). The Svbare_Sm tests require Sm, so they are not part of a certificate without Sm, such as RVA23.

Table 245. Svbare Coverpoints
Coverpoint Goal Feature Description Expectation Bins ID Normative Rule

General Test Environment (Svbare):
- T-SBI suite: boots to S-mode with satp.MODE=Bare; the U-mode case uses RVTEST_TSBI_GOTO_UMODE / _SMODE.
Normative rules without a coverpoint in this suite:
- SATP_MODE_ROZ_SFENCE_ILLEGAL: Not tested: needs satp.MODE read-only zero (UDB TRAP_ON_SFENCE_VMA_WHEN_SATP_MODE_IS_READ_ONLY)

cp_satp_bare_load

Verify a load with satp.MODE=Bare uses the physical address in S-mode and U-mode

S-mode: write satp = 0 and read it back. Load (lw) from the page at the physical address of rvtest_data_1 in S-mode, then in U-mode (RVTEST_TSBI_GOTO_UMODE).

No fault; the access reaches physical memory untranslated.

satp_bare x read_acc x mode {S/U-mode}
= 2 bins on RV64, 2 on RV32

satp_mode svbare_satp_mode_bare

satp_mode_enc
satp_mode
satp_mode_bare_op
svbare_satp_mode_bare

cp_satp_bare_store

Verify a store with satp.MODE=Bare uses the physical address in S-mode and U-mode

S-mode: write satp = 0 and read it back. Store (sw) to the page at the physical address of rvtest_data_1 in S-mode, then in U-mode (RVTEST_TSBI_GOTO_UMODE).

No fault; the access reaches physical memory untranslated.

satp_bare x write_acc x mode {S/U-mode}
= 2 bins on RV64, 2 on RV32

satp_mode svbare_satp_mode_bare

satp_mode_enc
satp_mode
satp_mode_bare_op
svbare_satp_mode_bare

cp_satp_bare_exec

Verify an instruction fetch with satp.MODE=Bare uses the physical address in S-mode and U-mode

S-mode: write satp = 0 and read it back. Jump (jalr) into the page at the physical address of rvtest_data_1 in S-mode, then in U-mode (RVTEST_TSBI_GOTO_UMODE).

No fault; the access reaches physical memory untranslated.

satp_bare x exec_acc x mode {S/U-mode}
= 2 bins on RV64, 2 on RV32

satp_mode svbare_satp_mode_bare

satp_mode_enc
satp_mode
satp_mode_bare_op
svbare_satp_mode_bare

Svbare_Sm Virtual Memory Off with MPRV
Table 246. Svbare_Sm Coverpoints
Coverpoint Goal Feature Description Expectation Bins ID Normative Rule

General Test Environment (SvbareSm):
- Sm suite: boots to M-mode (BOOT_TO_MMODE) because each coverpoint needs M-mode state (mstatus.MPRV/MPP, mstatus.TVM, mstatus.SBE or an M-mode CSR access). Mode changes use RVTEST_TSBI_GOTO_*. satp.MODE=Bare with mstatus.MPRV=1 and MPP=S or U.
- Split from Svbare: cp_satp_bare_mprv_{load,store,exec}.

cp_satp_bare_mprv_load

Verify an M-mode load with MPRV=1 and satp.MODE=Bare uses the physical address

M-mode with satp = 0: set mstatus.MPRV=1 with MPP=S, then MPP=U, reading mstatus back each time. Load (lw) from the page at the physical address of rvtest_data_1.

No fault; the access is untranslated for either MPP.

satp_bare x mprv_mstatus x mpp_mstatus x read_acc x mode {M-mode}
= 2 bins on RV64, 2 on RV32

mstatus_mprv_ldst_op

mstatus_mprv_ldst_op

cp_satp_bare_mprv_store

Verify an M-mode store with MPRV=1 and satp.MODE=Bare uses the physical address

M-mode with satp = 0: set mstatus.MPRV=1 with MPP=S, then MPP=U, reading mstatus back each time. Store (sw) to the page at the physical address of rvtest_data_1.

No fault; the access is untranslated for either MPP.

satp_bare x mprv_mstatus x mpp_mstatus x write_acc x mode {M-mode}
= 2 bins on RV64, 2 on RV32

mstatus_mprv_ldst_op

mstatus_mprv_ldst_op

cp_satp_bare_mprv_exec

Verify an M-mode instruction fetch with MPRV=1 and satp.MODE=Bare uses the physical address

M-mode with satp = 0: set mstatus.MPRV=1 with MPP=S, then MPP=U, reading mstatus back each time. Jump (jalr) into the page at the physical address of rvtest_data_1.

No fault; the access is untranslated for either MPP.

satp_bare x mprv_mstatus x mpp_mstatus x exec_acc x mode {M-mode}
= 2 bins on RV64, 2 on RV32

mstatus_mprv_inst_xlat_op

mstatus_mprv_inst_xlat_op

Svbare Normative Rules
Table 247. Svbare Normative Rules
Normative Rule Rule Text Coverpoints

satp_mode

norm:satp_mode_enc shows the encodings of the MODE field when SXLEN=32 and SXLEN=64.

Svbare_cg/{satp_bare,cp_satp_bare_load,cp_satp_bare_store,cp_satp_bare_exec}

satp_mode_bare_op

When MODE=Bare, supervisor virtual addresses are equal to supervisor physical addresses, and there is no additional memory protection beyond the physical memory protection scheme described in pmp.

Svbare_cg/{cp_satp_bare_load, cp_satp_bare_store, cp_satp_bare_exec}

satp_mode_bare_zero_fields

To select MODE=Bare, software must write zero to the remaining fields of satp (bits 30–0 when SXLEN=32, or bits 59–0 when SXLEN=64).

Not tested: requirement on software; the tests write satp=0 to select Bare

satp_mode_bare_nonzero_unspec

Attempting to select MODE=Bare with a nonzero pattern in the remaining fields has an UNSPECIFIED effect on the value that the remaining fields assume and an UNSPECIFIED effect on address translation and protection behavior.

Not tested: behavior is UNSPECIFIED

satp_bare_rsv_custom

When SXLEN=32, the satp encodings corresponding to MODE=Bare and ASID[8:7]=3 are designated for custom use, whereas the encodings corresponding to MODE=Bare and ASID[8:7]≠3 are reserved for future standard use. When SXLEN=64, all satp encodings corresponding to MODE=Bare are reserved for future standard use.

Not tested: reserved and custom encodings

svbare_satp_mode_bare

If an implementation supports the Svbare extension, then the satp register’s MODE field must be capable of holding the value Bare.

Svbare_cg/satp_bare

satp_mode_roz_sfence_illegal

For implementations that make satp.MODE read-only zero (always Bare), attempts to execute an SFENCE.VMA instruction might raise an illegal-instruction exception.

Not tested: needs satp.MODE read-only zero (UDB TRAP_ON_SFENCE_VMA_WHEN_SATP_MODE_IS_READ_ONLY)

mstatus_mprv_ldst_op

When MPRV=0, explicit memory accesses behave as normal, using the translation and protection mechanisms of the current privilege mode. When MPRV=1, load and store memory addresses are translated and protected, and endianness is applied, as though the current privilege mode were set to MPP.

Svbare_Sm_cg/cp_satp_bare_mprv_{load,store}

mstatus_mprv_inst_xlat_op

Instruction address-translation and protection are unaffected by the setting of MPRV.

Sv_Sm_mstatus_mprv_cg/cp_mprv_ins

UDB Parameters: None.

B.7.3. Svinval Memory Management Unit Table Invalidation

The Svinval extension defines instructions to update memory management tables for virtual memory and optionally for PMP. These tests check that the instructions run, and, with Sv39 or Sv32, that the SFENCE.W.INVAL, SINVAL.VMA, SFENCE.INVAL.IR sequence removes a changed leaf. A hart that caches no translations passes the invalidation test.

Table 248. Svinval Coverpoints
Coverpoint Goal Feature Description Expectation Bins ID Normative Rule

General Test Environment (Svinval):
- T-SBI suite: boots to S-mode; the U-mode case uses RVTEST_TSBI_GOTO_UMODE / _SMODE. mstatus.TVM=0.

cp_svinval

Verify the Svinval instructions in S-mode and U-mode with mstatus.TVM=0

S-mode: execute sfence.w.inval, sinval.vma x0, x0, sfence.inval.ir and sfence.vma x0, x0. Switch to U-mode with RVTEST_TSBI_GOTO_UMODE and execute the same four instructions.

S-mode: all four execute without exception. U-mode: illegal-instruction exception (scause = 2) for each.

cp_instr x cp_priv x cp_tvm
= 8 bins on RV64, 8 on RV32

Svinval_illegal_instruction_u_mode Svinval_sfence_w_inval_inval_u_mode Svinval_sfence_w_inval_inval_s_vs_mode

mstatus_tvm_op
mstatus_tvm_warl
Svinval_illegal_instruction_u_mode
Svinval_sfence_w_inval_inval_u_mode
Svinval_sfence_w_inval_inval_s_vs_mode
Svinval_hinval_vvma_gvma
Svinval_virtual_instruction_vu_vs
Svinval_virtual_instruction_vtvms
Svinval_sfence_w_inval_inval_vu_mode
H_virtinst_vs_sfence_sinval_satp_vtvm1
Svinval_illegal_instruction_tvm
[norm:Svinval_illegal_instruction_u_mode] [norm:Svinval_sfence_w_inval_inval_u_mode] [norm:Svinval_sfence_w_inval_inval_s_vs_mode]

cp_sinval_vma

The Svinval sequence removes a stale S-mode translation

Sv39 on RV64, Sv32 on RV32, with every implemented satp.ASID bit set. In S-mode, map a virtual address to page A and load from it. Point the leaf at page B and run sfence.w.inval, sinval.vma rs1, rs2 and sfence.inval.ir, with rs1 = x0 or the address and rs2 = x0 or the current ASID, and the address with all ASIDMAX bits set in rs2. Load again.

The load after the sequence reads page B. Both loads are recorded. A hart that caches no translation passes.

S x sinval.vma x satp paged x rs1 {x0, register} x rs2 {x0, register} = 4 bins

Svinval_sinval_vma_invalidates_same_as_sfence_vma
Svinval_sfence_w_inval_orders_before_sinval_vma
Svinval_sequence_rs1_rs2

Table 249. Svinval Normative Rules
Normative Rule Rule Text Coverpoints

Svinval_sinval_vma_invalidates_same_as_sfence_vma

However, unlike SFENCE.VMA, SINVAL.VMA instructions are only ordered with respect to SFENCE.VMA, SFENCE.W.INVAL, and SFENCE.INVAL.IR instructions as defined below.

Svinval_cg/cp_sinval_vma, Svinval_H_cg/cp_sinval_vma_vs

Svinval_sfence_w_inval_orders_before_sinval_vma

The SFENCE.INVAL.IR instruction guarantees that any previous SINVAL.VMA instructions executed by the current hart are ordered before subsequent implicit references by that hart to the memory-management data structures.

Svinval_cg/cp_sinval_vma, Svinval_H_cg/cp_sinval_vma_vs

Svinval_sequence_rs1_rs2

the values of rs1 and rs2 for the SFENCE.VMA are the same as those used in the SINVAL.VMA,

Svinval_cg/cp_sinval_vma, Svinval_H_cg/cp_sinval_vma_vs

Svinval_sequence_reads_writes_before, Svinval_sequence_reads_writes_after

Svinval_sequence_reads_writes_before: reads and writes prior to the SFENCE.W.INVAL are considered to be those prior to the SFENCE.VMA, Svinval_sequence_reads_writes_after: reads and writes following the SFENCE.INVAL.IR are considered to be those subsequent to the SFENCE.VMA.

Not tested: ordering is not observable in single-hart signature tests

Svinval_illegal_instruction_u_mode

In particular, an attempt to execute any of these instructions in U-mode always raises an illegal-instruction exception.

Svinval_cg/cp_svinval, Svinval_H_cg/cp_svinval, Svinval_SmH_cg/cp_svinval_tvm

Svinval_sfence_w_inval_inval_u_mode

raises an illegal-instruction exception.

Svinval_cg/cp_svinval, Svinval_H_cg/cp_svinval

Svinval_sfence_w_inval_inval_s_vs_mode

SFENCE.W.INVAL and SFENCE.INVAL.IR are unaffected by the mstatus.TVM and hstatus.VTVM fields and hence are always permitted in S-mode and VS-mode.

Svinval_cg/cp_svinval, Svinval_Sm_cg/cp_svinval, Svinval_H_cg/cp_svinval, Svinval_SmH_cg/cp_svinval_tvm

Svinval_hinval_vvma_gvma

These have the same semantics as SINVAL.VMA, except that they combine with SFENCE.W.INVAL and SFENCE.INVAL.IR to replace HFENCE.VVMA and HFENCE.GVMA, respectively, instead of SFENCE.VMA.

Svinval_H_cg/{cp_svinval, cp_hinval_vvma, cp_hinval_gvma}, Svinval_SmH_cg/cp_svinval_{m, tvm}

Svinval_virtual_instruction_vu_vs, Svinval_virtual_instruction_vtvms, Svinval_sfence_w_inval_inval_vu_mode

Svinval_virtual_instruction_vu_vs: An attempt to execute HINVAL.VVMA or HINVAL.GVMA in VS-mode or VU-mode, or to execute SINVAL.VMA in VU-mode, raises a virtual-instruction exception. Svinval_virtual_instruction_vtvms: When hstatus.VTVM=1, an attempt to execute SINVAL.VMA in VS-mode also raises a virtual-instruction exception. Svinval_sfence_w_inval_inval_vu_mode: Doing so in VU-mode raises a virtual-instruction exception.

Svinval_H_cg/cp_svinval, Svinval_SmH_cg/cp_svinval_{m, tvm}

H_virtinst_vs_sfence_sinval_satp_vtvm1

in VS-mode, attempts to execute an SFENCE.VMA or SINVAL.VMA instruction or to access satp, when hstatus.VTVM=1.

Svinval_H_cg/cp_svinval

Svinval_hinval_gvma_uses_vmid

HINVAL.GVMA uses VMIDs instead of ASIDs.

Svinval_H_cg/cp_hinval_gvma

Svinval_illegal_instruction_tvm

An attempt to execute SINVAL.VMA or HINVAL.GVMA in S-mode or HS-mode when mstatus.TVM=1 also raises an illegal-instruction exception.

Svinval_Sm_cg/cp_svinval, Svinval_SmH_cg/cp_svinval_tvm

mstatus_tvm_op, mstatus_tvm_warl

mstatus_tvm_op: When TVM=1, attempts to read or write the satp CSR or execute an SFENCE.VMA or SINVAL.VMA instruction while executing in S-mode will raise an illegal-instruction exception. When TVM=0, these operations are permitted in S-mode. mstatus_tvm_warl: The TVM (Trap Virtual Memory) bit is a WARL field that supports intercepting supervisor virtual-memory management operations.

Svinval_Sm_cg/cp_svinval

UDB Parameters: None.

Svinval_Sm Table Invalidation with mstatus.TVM

Runs the Svinval instructions in M, S and U mode with mstatus.TVM=0 and mstatus.TVM=1.

Table 250. Svinval_Sm Coverpoints
Coverpoint Goal Feature Description Expectation Bins ID Normative Rule

General Test Environment (SvinvalSm):
- Sm suite: boots to M-mode (BOOT_TO_MMODE) because each coverpoint needs M-mode state (mstatus.MPRV/MPP, mstatus.TVM, mstatus.SBE or an M-mode CSR access). Mode changes use RVTEST_TSBI_GOTO_*. Runs the Svinval instructions in M, S and U mode, first with mstatus.TVM=0 and then with mstatus.TVM=1.
- Split from Svinval: the M-mode and mstatus.TVM=1 bins of cr_svinival. The suite also repeats the S-mode and U-mode cases with TVM=0 so the cross closes without ignore_bins.

cp_svinval

Verify the Svinval instructions in M-mode, S-mode and U-mode with mstatus.TVM clear and set

Execute sfence.w.inval, sinval.vma x0, x0, sfence.inval.ir and sfence.vma x0, x0 in M-mode, then in S-mode (RVTEST_TSBI_GOTO_SMODE) and U-mode (RVTEST_TSBI_GOTO_UMODE); repeat the whole sequence after setting mstatus.TVM in M-mode and reading mstatus back.

M-mode: all execute for either TVM. S-mode with TVM=0: all execute; with TVM=1 sinval.vma and sfence.vma raise illegal instruction (mcause = 2) while sfence.w.inval and sfence.inval.ir execute. U-mode: illegal instruction for each, for either TVM.

cp_instr x cp_priv x cp_tvm
= 24 bins on RV64, 24 on RV32

mstatus_tvm_op MSTATUS_TVM_WARL Svinval_sfence_w_inval_inval_s_vs_mode Svinval_illegal_instruction_tvm

mstatus_tvm_op
mstatus_tvm_warl
Svinval_sfence_w_inval_inval_s_vs_mode
Svinval_illegal_instruction_tvm
[norm:mstatus_tvm_op] [norm:MSTATUS_TVM_WARL] [norm:Svinval_sfence_w_inval_inval_s_vs_mode] [norm:Svinval_illegal_instruction_tvm]

Svinval_H Hypervisor Table Invalidation

Runs the Svinval instructions in HS, VS, U and VU modes with hstatus.VTVM=0 and hstatus.VTVM=1, and checks that the Svinval sequences remove changed VS-stage and G-stage leaves.

Table 251. Svinval_H Coverpoints
Coverpoint Goal Feature Description Expectation Bins Normative Rule Notes

cp_svinval

Svinval instructions trap appropriately.

Execute each Svinval instruction {sfence.w.inval, sinval.vma x0, x0, sfence.inval.ir, hinval.vvma x0, x0, hinval.gvma x0, x0} in each privilege mode {HS/VS/U/VU} with TVM = 0 and VTVM = {0/1}. Doesn’t try to check that anything is actually invalidated.

HS: all execute.
VS: sfence.w.inval and sfence.inval.ir execute; sinval.vma executes with VTVM = 0 and raises virtual instruction with VTVM = 1; hinval.vvma and hinval.gvma raise virtual instruction.
U: all raise illegal instruction.
VU: all raise virtual instruction.

5 instructions x 4 privilege modes x TVM = 0 x 2 VTVM

Svinval_illegal_instruction_u_mode
Svinval_sfence_w_inval_inval_u_mode
Svinval_sfence_w_inval_inval_s_vs_mode
Svinval_hinval_vvma_gvma
Svinval_virtual_instruction_vu_vs
Svinval_virtual_instruction_vtvms
Svinval_sfence_w_inval_inval_vu_mode
H_virtinst_vs_sfence_sinval_satp_vtvm1

M-mode and TVM = 1 are in Svinval_SmH, because the HS-mode handler reads satp, which traps with TVM = 1

cp_hinval_vvma
cp_hinval_gvma
cp_sinval_vma_vs

Svinval sequences remove stale VS-stage and G-stage translations

Sv32/Sv32x4 and Sv39/Sv39x4. Map a guest virtual address through the VS-stage to guest physical page A and through the G-stage to physical page A, and load from it in VS-mode. HS-mode then points the VS-stage leaf at guest page B, or the G-stage leaf of page A at physical page B, and runs sfence.w.inval, hinval.vvma or hinval.gvma, and sfence.inval.ir in HS-mode, or sfence.w.inval, sinval.vma and sfence.inval.ir in VS-mode. rs1 is x0 or the address (the guest virtual address, or the guest physical address >> 2 for hinval.gvma); rs2 is x0 or the current ASID (hinval.vvma, sinval.vma) or VMID (hinval.gvma), and the address is also used with all ASIDMAX or VMIDMAX bits set in rs2. The cases run with every implemented vsatp.ASID and hgatp.VMID bit set.

The VS-mode load after the sequence reads page B. Both loads are recorded. A hart that caches no translation passes.

cp_hinval_vvma: HS x hinval.vvma x vsatp paged x hgatp paged x rs1 {x0, register} x rs2 {x0, register}
cp_hinval_gvma: HS x hinval.gvma x vsatp paged x hgatp paged x rs1 {x0, register} x rs2 {x0, register}
cp_sinval_vma_vs: VS x sinval.vma x vsatp paged x hgatp paged x rs1 {x0, register} x rs2 {x0, register}

Svinval_hinval_vvma_gvma
Svinval_hinval_gvma_uses_vmid
Svinval_sinval_vma_invalidates_same_as_sfence_vma
Svinval_sfence_w_inval_orders_before_sinval_vma
Svinval_sequence_rs1_rs2

Svinval_SmH Hypervisor Table Invalidation with mstatus.TVM

Runs the Svinval instructions in M-mode, and in HS, VS, U and VU modes with mstatus.TVM=1, whose traps are taken in M-mode.

Svinval_SmH boots to M-mode and delegates nothing, so the M-mode handler takes every trap. The lower modes with mstatus.TVM = 0 are in Svinval_H.

Table 252. Svinval_SmH Coverpoints
Coverpoint Goal Feature Description Expectation Bins Normative Rule

cp_svinval_m

Svinval instructions execute in M-mode

Execute each Svinval instruction {sfence.w.inval, sinval.vma x0, x0, sfence.inval.ir, hinval.vvma x0, x0, hinval.gvma x0, x0} in M-mode with TVM = {0/1} and VTVM = {0/1}

All execute; TVM and VTVM do not affect M-mode

5 instructions x M x 2 TVM x 2 VTVM

Svinval_hinval_vvma_gvma
Svinval_virtual_instruction_vu_vs
Svinval_virtual_instruction_vtvms
Svinval_sfence_w_inval_inval_vu_mode

cp_svinval_tvm

Svinval instructions trap appropriately with TVM = 1

Execute each Svinval instruction in each privilege mode {HS/VS/U/VU} with TVM = 1 and VTVM = {0/1}

HS: sinval.vma and hinval.gvma raise illegal instruction; sfence.w.inval, sfence.inval.ir and hinval.vvma execute.
VS: as with TVM = 0, because TVM does not affect VS-mode: sfence.w.inval and sfence.inval.ir execute; sinval.vma executes with VTVM = 0 and raises virtual instruction with VTVM = 1; hinval.vvma and hinval.gvma raise virtual instruction.
U: all raise illegal instruction.
VU: all raise virtual instruction.

5 instructions x 4 privilege modes x TVM = 1 x 2 VTVM

Svinval_illegal_instruction_u_mode
Svinval_sfence_w_inval_inval_s_vs_mode
Svinval_hinval_vvma_gvma
Svinval_virtual_instruction_vu_vs
Svinval_virtual_instruction_vtvms
Svinval_sfence_w_inval_inval_vu_mode
Svinval_illegal_instruction_tvm

B.7.4. Svade A/D Bit Page Fault Exception

Table 253. Svade Coverpoints
Coverpoint Goal Feature Description Expectation Bins ID Normative Rule

General Test Environment (Svade):
- T-SBI suite: boots to S-mode (BOOT_TO_SMODE) and drives the test from the boot identity map. The page under test is mapped at va_data. S-mode accesses run from the identity map. U-mode accesses use RVTEST_TSBI_GOTO_UMODE / RVTEST_TSBI_GOTO_SMODE; the handler moves execution to the U-accessible code alias va_rvtest_code_begin (registered with SAVE_AREA_SETUP) and back. menvcfg is written through T-SBI CSR calls. Page faults are delegated to S-mode, so causes are sampled from scause/stval.
- menvcfg.ADUE (menvcfgh.ADUE on RV32) is cleared through T-SBI so A/D bits are not updated by hardware.
- Run for every supported translation mode: Sv32 on RV32; Sv39, Sv48 and Sv57 on RV64, as selected by the UDB configuration.

Abit_unset_exec_s

Verify an instruction fetch through a PTE with A=0 raises an instruction page fault from S-mode (Svade)

S-mode: menvcfg.ADUE=0 (cleared through T-SBI). Leaf PTE with A=0 (with D=0 and D=1) and PTE.U=0, at every page-table level (4 KiB page and each superpage size of the Sv mode). Jump (jalr) into the page through va_data.

Instruction page fault (scause = 12); stval = faulting virtual address.

PTE_Abit_unset_s_i x PageType_i x Svade_enabled x ins_page_fault x exec_acc x mode {S-mode}
= 7 bins on RV64, 2 on RV32

Svade_access_ad_bit_clear Svadu_disabled_hw_update_falls_back_to_Svade menvcfg_adue_op

Svade_access_ad_bit_clear
Svadu_disabled_hw_update_falls_back_to_Svade
menvcfg_adue_op

Abit_unset_exec_u

Verify an instruction fetch through a PTE with A=0 raises an instruction page fault from U-mode (Svade)

U-mode: menvcfg.ADUE=0 (cleared through T-SBI). Leaf PTE with A=0 (with D=0 and D=1) and PTE.U=1, at every page-table level (4 KiB page and each superpage size of the Sv mode). Jump (jalr) into the page through va_data.

Instruction page fault (scause = 12); stval = faulting virtual address.

PTE_Abit_unset_u_i x PageType_i x Svade_enabled x ins_page_fault x exec_acc x mode {U-mode}
= 7 bins on RV64, 2 on RV32

Svade_access_ad_bit_clear Svadu_disabled_hw_update_falls_back_to_Svade menvcfg_adue_op

Svade_access_ad_bit_clear
Svadu_disabled_hw_update_falls_back_to_Svade
menvcfg_adue_op

Abit_unset_read_s

Verify a load through a PTE with A=0 raises a load page fault from S-mode (Svade)

S-mode: menvcfg.ADUE=0 (cleared through T-SBI). Leaf PTE with A=0 (with D=0 and D=1) and PTE.U=0, at every page-table level (4 KiB page and each superpage size of the Sv mode). Load (lw) from the page through va_data.

Load page fault (scause = 13); stval = faulting virtual address.

PTE_Abit_unset_s_d x PageType_d x Svade_enabled x load_page_fault x read_acc x mode {S-mode}
= 7 bins on RV64, 2 on RV32

Svade_access_ad_bit_clear Svadu_disabled_hw_update_falls_back_to_Svade menvcfg_adue_op

Svade_access_ad_bit_clear
Svadu_disabled_hw_update_falls_back_to_Svade
menvcfg_adue_op

Abit_unset_read_u

Verify a load through a PTE with A=0 raises a load page fault from U-mode (Svade)

U-mode: menvcfg.ADUE=0 (cleared through T-SBI). Leaf PTE with A=0 (with D=0 and D=1) and PTE.U=1, at every page-table level (4 KiB page and each superpage size of the Sv mode). Load (lw) from the page through va_data.

Load page fault (scause = 13); stval = faulting virtual address.

PTE_Abit_unset_u_d x PageType_d x Svade_enabled x load_page_fault x read_acc x mode {U-mode}
= 7 bins on RV64, 2 on RV32

Svade_access_ad_bit_clear Svadu_disabled_hw_update_falls_back_to_Svade menvcfg_adue_op

pte_a_def
Svade_access_ad_bit_clear
Svadu_disabled_hw_update_falls_back_to_Svade
menvcfg_adue_op

Abit_unset_write_s

Verify a store through a PTE with A=0 raises a store/AMO page fault from S-mode (Svade)

S-mode: menvcfg.ADUE=0 (cleared through T-SBI). Leaf PTE with A=0 (with D=0 and D=1) and PTE.U=0, at every page-table level (4 KiB page and each superpage size of the Sv mode). Store (sw) to the page through va_data.

Store/AMO page fault (scause = 15); stval = faulting virtual address.

PTE_Abit_unset_s_d x PageType_d x Svade_enabled x store_page_fault x write_acc x mode {S-mode}
= 7 bins on RV64, 2 on RV32

Svade_access_ad_bit_clear Svadu_disabled_hw_update_falls_back_to_Svade menvcfg_adue_op

pte_a_def
Svade_access_ad_bit_clear
Svadu_disabled_hw_update_falls_back_to_Svade
menvcfg_adue_op

Abit_unset_write_u

Verify a store through a PTE with A=0 raises a store/AMO page fault from U-mode (Svade)

U-mode: menvcfg.ADUE=0 (cleared through T-SBI). Leaf PTE with A=0 (with D=0 and D=1) and PTE.U=1, at every page-table level (4 KiB page and each superpage size of the Sv mode). Store (sw) to the page through va_data.

Store/AMO page fault (scause = 15); stval = faulting virtual address.

PTE_Abit_unset_u_d x PageType_d x Svade_enabled x store_page_fault x write_acc x mode {U-mode}
= 7 bins on RV64, 2 on RV32

Svade_access_ad_bit_clear Svadu_disabled_hw_update_falls_back_to_Svade menvcfg_adue_op

Svade_access_ad_bit_clear
Svadu_disabled_hw_update_falls_back_to_Svade
menvcfg_adue_op

Dbit_unset_write_s

Verify a store through a PTE with D=0 raises a store/AMO page fault from S-mode (Svade)

S-mode: menvcfg.ADUE=0. Leaf PTE with A=1, D=0 and PTE.U=0, at every page-table level (4 KiB page and each superpage size of the Sv mode). Store (sw) to the page; loads and fetches of the same page are also done.

Store/AMO page fault (scause = 15); the load and fetch succeed.

PTE_Dbit_unset_s_d x PageType_d x Svade_enabled x store_page_fault x write_acc x mode {S-mode}
= 7 bins on RV64, 2 on RV32

Svade_access_ad_bit_clear Svadu_disabled_hw_update_falls_back_to_Svade menvcfg_adue_op

pte_d_def
Svade_access_ad_bit_clear
Svadu_disabled_hw_update_falls_back_to_Svade
menvcfg_adue_op

Dbit_unset_write_u

Verify a store through a PTE with D=0 raises a store/AMO page fault from U-mode (Svade)

U-mode: menvcfg.ADUE=0. Leaf PTE with A=1, D=0 and PTE.U=1, at every page-table level (4 KiB page and each superpage size of the Sv mode). Store (sw) to the page; loads and fetches of the same page are also done.

Store/AMO page fault (scause = 15); the load and fetch succeed.

PTE_Dbit_unset_u_d x PageType_d x Svade_enabled x store_page_fault x write_acc x mode {U-mode}
= 7 bins on RV64, 2 on RV32

Svade_access_ad_bit_clear Svadu_disabled_hw_update_falls_back_to_Svade menvcfg_adue_op

pte_d_def
Svade_access_ad_bit_clear
Svadu_disabled_hw_update_falls_back_to_Svade
menvcfg_adue_op

Table 254. Svade Normative Rules
Normative Rule Rule Text Coverpoints

Svade_access_ad_bit_clear

The Svade extension: when a virtual page is accessed and the A bit is clear, or is written and the D bit is clear, a page-fault exception is raised.

Svade_cg/{Abit_unset_exec_s, Abit_unset_read_s, Abit_unset_write_s, Dbit_unset_write_s}

Svadu_disabled_hw_update_falls_back_to_Svade

When hardware updating of A/D bits is disabled, the Svade extension, which mandates exceptions when A/D bits need be set, instead takes effect.

Svade_cg/{Abit_unset_read_s, Dbit_unset_write_s}

menvcfg_adue_op

If the Svadu extension is implemented, the ADUE bit controls whether hardware updating of PTE A/D bits is enabled for S-mode and G-stage address translations. When ADUE=1, hardware updating of PTE A/D bits is enabled during S-mode address translation, and the implementation behaves as though the Svade extension were not implemented for S-mode address translation. When the hypervisor extension is implemented, if ADUE=1, hardware updating of PTE A/D bits is enabled during G-stage address translation, and the implementation behaves as though the Svade extension were not implemented for G-stage address translation. When ADUE=0, the implementation behaves as though Svade were implemented for S-mode and G-stage address translation.

Svade_cg/{Abit_unset_read_s, Dbit_unset_write_s}

UDB Parameters: None.

B.7.5. Svadu A/D Bit Hardware Update

Table 255. Svadu Coverpoints
Coverpoint Goal Feature Description Expectation Bins ID Normative Rule

General Test Environment (Svadu):
- T-SBI suite: boots to S-mode (BOOT_TO_SMODE) and drives the test from the boot identity map. The page under test is mapped at va_data. S-mode accesses run from the identity map. U-mode accesses use RVTEST_TSBI_GOTO_UMODE / RVTEST_TSBI_GOTO_SMODE; the handler moves execution to the U-accessible code alias va_rvtest_code_begin (registered with SAVE_AREA_SETUP) and back. menvcfg is written through T-SBI CSR calls. Page faults are delegated to S-mode, so causes are sampled from scause/stval.
- menvcfg.ADUE (menvcfgh.ADUE on RV32) is set through T-SBI.
- Run for every supported translation mode: Sv32 on RV32; Sv39, Sv48 and Sv57 on RV64, as selected by the UDB configuration.
Normative rules without a coverpoint in this suite:
- menvcfg_adue_rdonly0: Not tested: needs an implementation without Svadu

Abit_unset_exec_s

Verify hardware sets PTE.A on an instruction fetch from S-mode (Svadu)

S-mode: menvcfg.ADUE=1 (set through T-SBI). Leaf PTE with A=0 and PTE.U=0, at every page-table level (4 KiB page and each superpage size of the Sv mode) (separate PTEs for store, load and fetch). Jump (jalr) into the page, then read the PTE back.

No fault; the PTE reads back with A=1 (and D=1 after a store).

PTE_Abit_unset_s_i x PageType_i x Svadu_enabled x exec_acc x mode {S-mode}
= 7 bins on RV64, 2 on RV32

Svadu_hw_update_a_d_bits menvcfg_adue_op menvcfg_adue_fence

pte_a_def
[norm:Svadu_hw_update_a_d_bits] [norm:menvcfg_adue_op] [norm:menvcfg_adue_fence]

Abit_unset_exec_u

Verify hardware sets PTE.A on an instruction fetch from U-mode (Svadu)

U-mode: menvcfg.ADUE=1 (set through T-SBI). Leaf PTE with A=0 and PTE.U=1, at every page-table level (4 KiB page and each superpage size of the Sv mode) (separate PTEs for store, load and fetch). Jump (jalr) into the page, then read the PTE back.

No fault; the PTE reads back with A=1 (and D=1 after a store).

PTE_Abit_unset_u_i x PageType_i x Svadu_enabled x exec_acc x mode {U-mode}
= 7 bins on RV64, 2 on RV32

Svadu_hw_update_a_d_bits menvcfg_adue_op menvcfg_adue_fence

[norm:Svadu_hw_update_a_d_bits] [norm:menvcfg_adue_op] [norm:menvcfg_adue_fence]

Abit_unset_read_s

Verify hardware sets PTE.A on a load from S-mode (Svadu)

S-mode: menvcfg.ADUE=1 (set through T-SBI). Leaf PTE with A=0 and PTE.U=0, at every page-table level (4 KiB page and each superpage size of the Sv mode) (separate PTEs for store, load and fetch). Load (lw) from the page, then read the PTE back.

No fault; the PTE reads back with A=1 (and D=1 after a store).

PTE_Abit_unset_s_d x PageType_d x Svadu_enabled x read_acc x mode {S-mode}
= 7 bins on RV64, 2 on RV32

Svadu_hw_update_a_d_bits menvcfg_adue_op menvcfg_adue_fence

Svadu_hw_update_a_d_bits
menvcfg_adue_op
[norm:Svadu_hw_update_a_d_bits] [norm:menvcfg_adue_op] [norm:menvcfg_adue_fence]

Abit_unset_read_u

Verify hardware sets PTE.A on a load from U-mode (Svadu)

U-mode: menvcfg.ADUE=1 (set through T-SBI). Leaf PTE with A=0 and PTE.U=1, at every page-table level (4 KiB page and each superpage size of the Sv mode) (separate PTEs for store, load and fetch). Load (lw) from the page, then read the PTE back.

No fault; the PTE reads back with A=1 (and D=1 after a store).

PTE_Abit_unset_u_d x PageType_d x Svadu_enabled x read_acc x mode {U-mode}
= 7 bins on RV64, 2 on RV32

Svadu_hw_update_a_d_bits menvcfg_adue_op menvcfg_adue_fence

pte_a_def
[norm:Svadu_hw_update_a_d_bits] [norm:menvcfg_adue_op] [norm:menvcfg_adue_fence]

Abit_unset_write_s

Verify hardware sets PTE.A on a store from S-mode (Svadu)

S-mode: menvcfg.ADUE=1 (set through T-SBI). Leaf PTE with A=0 and PTE.U=0, at every page-table level (4 KiB page and each superpage size of the Sv mode) (separate PTEs for store, load and fetch). Store (sw) to the page, then read the PTE back.

No fault; the PTE reads back with A=1 (and D=1 after a store).

PTE_Abit_unset_s_d x PageType_d x Svadu_enabled x write_acc x mode {S-mode}
= 7 bins on RV64, 2 on RV32

Svadu_hw_update_a_d_bits menvcfg_adue_op menvcfg_adue_fence

[norm:Svadu_hw_update_a_d_bits] [norm:menvcfg_adue_op] [norm:menvcfg_adue_fence]

Abit_unset_write_u

Verify hardware sets PTE.A on a store from U-mode (Svadu)

U-mode: menvcfg.ADUE=1 (set through T-SBI). Leaf PTE with A=0 and PTE.U=1, at every page-table level (4 KiB page and each superpage size of the Sv mode) (separate PTEs for store, load and fetch). Store (sw) to the page, then read the PTE back.

No fault; the PTE reads back with A=1 (and D=1 after a store).

PTE_Abit_unset_u_d x PageType_d x Svadu_enabled x write_acc x mode {U-mode}
= 7 bins on RV64, 2 on RV32

Svadu_hw_update_a_d_bits menvcfg_adue_op menvcfg_adue_fence

[norm:Svadu_hw_update_a_d_bits] [norm:menvcfg_adue_op] [norm:menvcfg_adue_fence]

Dbit_unset_write_s

Verify hardware sets PTE.D on a store from S-mode (Svadu)

S-mode: menvcfg.ADUE=1. Leaf PTE with A=1, D=0 and PTE.U=0, at every page-table level (4 KiB page and each superpage size of the Sv mode). Store (sw) to the page, then read the PTE back.

No fault; the PTE reads back with D=1.

PTE_Dbit_unset_s_d x PageType_d x Svadu_enabled x write_acc x mode {S-mode}
= 7 bins on RV64, 2 on RV32

Svadu_hw_update_a_d_bits menvcfg_adue_op menvcfg_adue_fence

pte_d_def
Svadu_hw_update_a_d_bits
menvcfg_adue_op
[norm:Svadu_hw_update_a_d_bits] [norm:menvcfg_adue_op] [norm:menvcfg_adue_fence]

Dbit_unset_write_u

Verify hardware sets PTE.D on a store from U-mode (Svadu)

U-mode: menvcfg.ADUE=1. Leaf PTE with A=1, D=0 and PTE.U=1, at every page-table level (4 KiB page and each superpage size of the Sv mode). Store (sw) to the page, then read the PTE back.

No fault; the PTE reads back with D=1.

PTE_Dbit_unset_u_d x PageType_d x Svadu_enabled x write_acc x mode {U-mode}
= 7 bins on RV64, 2 on RV32

Svadu_hw_update_a_d_bits menvcfg_adue_op menvcfg_adue_fence

pte_d_def
[norm:Svadu_hw_update_a_d_bits] [norm:menvcfg_adue_op] [norm:menvcfg_adue_fence]

fault_no_update_exec_s
fault_no_update_read_s
fault_no_update_write_s

No A/D update on a faulting access

With menvcfg.ADUE = 1, in supervisor mode, access leaf PTEs with A=0 and D=0 that must page fault, then read the PTE back.
Every page-table walk check for a leaf PTE must pass before the hardware A/D update.
Test Cases (store, load, and execute each, with sfence.vma before each access):
Misaligned superpage at each superpage level.
PTE.U=1 with sstatus.SUM=0.
Reserved encoding W=1, R=0.
RV64: reserved bit 54 set; PBMT=3; N=1 with ppn[3:0]=0000; N=1 with ppn[3:0]=1000 at each superpage level.

Load/store/instruction page fault; the PTE still has A=0 and D=0.

PTE_fault_reason x Svadu_enabled x access x page fault x mode {S-mode}
= 18 bins on RV64, 9 on RV32

menvcfg_adue_op

Svadu_H Hypervisor A/D Bit Hardware Update

Checks henvcfg.ADUE and menvcfg.ADUE in the VS-stage, the G-stage and both stages, and the A/D updates of implicit VS-stage page-table accesses.

Svadu_H uses the Sv_H test environment (see Sv_H). menvcfg.ADUE selects Svade or Svadu for the G-stage, and henvcfg.ADUE for the VS-stage. The ADUE = 0 cases are also in Sv_H; they are repeated here so that each cross has every ADUE value.

Table 256. Svadu_H Coverpoints
Coverpoint Goal Feature Description Expectation Bins Normative Rule Notes

cp_vsatp_adue

henvcfg.ADUE selects Svade or Svadu for the VS-stage

In VS-mode with hgatp = Bare, store, load and fetch through VS-stage leaves with A = D = 0 and with D = 0, with (menvcfg.ADUE, henvcfg.ADUE) = (0, 1 written) and (1, 0); and with (1, 1), load and fetch through an A = D = 0 leaf and store through a D = 0 leaf. The leaf is read back after the accesses.

henvcfg.ADUE is read-only zero while menvcfg.ADUE = 0. With henvcfg.ADUE = 0 (Svade), an access with A = 0, or a store with D = 0, raises a page fault and the PTE is unchanged. With henvcfg.ADUE = 1 (Svadu), the hart sets A, and D for a store, and the access succeeds.

VS x {sw, lw, jalr} x vsatp_mode x hgatp Bare x (menvcfg.ADUE, henvcfg.ADUE) {00, 10, 11}

henvcfg_adue_op
menvcfg_adue_henvcfg_adue_rdonly0
menvcfg_pbmte_henvcfg_pbmte_rdonly0
Svadu_hypervisor_adue_writable

cp_hgatp_adue

menvcfg.ADUE selects Svade or Svadu for the G-stage

In VS-mode with vsatp = Bare, store, load and fetch through G-stage leaves with A = D = 0 and with D = 0 with menvcfg.ADUE = 0; and with menvcfg.ADUE = 1, load and fetch through an A = D = 0 leaf and store through a D = 0 leaf. The leaf is read back after the accesses.

With menvcfg.ADUE = 0 (Svade), an access with A = 0, or a store with D = 0, raises a guest-page fault for the original access type and the PTE is unchanged. With menvcfg.ADUE = 1 (Svadu), the hart sets A, and D for a store, and the access succeeds.

VS x {sw, lw, jalr} x vsatp Bare x hgatp_mode x menvcfg.ADUE {0, 1}

menvcfg_adue_op

cp_twostage_adue

A/D bits in both stages, including the G-stage leaf of a VS-stage page table

In VS-mode, store, load and fetch through VS-stage leaves with A = D = 0 or D = 0 with menvcfg.ADUE = 1 and henvcfg.ADUE = 0 and 1, and through G-stage leaves with A = D = 0 or D = 0 with menvcfg.ADUE = 0 and 1. The VS-stage leaf is in a level-0 page table at a guest physical address whose G-stage leaf has A = D = 0 or D = 0 in the hardware-update cases. Updated PTEs, including the G-stage leaf of the VS-stage leaf table, are read back.

With ADUE = 0 for a stage (Svade), an access with A = 0, or a store with D = 0, raises a page fault (VS-stage) or guest-page fault (G-stage). With ADUE = 1 (Svadu), the hart sets the bits.
The G-stage checks and updates the leaf of a VS-stage page table as for an implicit access: the PTE read sets A, and a VS-stage A/D update is an implicit store that also sets D.

VS x {sw, lw, jalr} x stage_modes x (menvcfg.ADUE, henvcfg.ADUE) {00, 10, 11}

henvcfg_adue_op
menvcfg_adue_op

cp_implicit_gpf

Guest-page faults on implicit VS-stage A/D updates

In VS-mode with menvcfg.ADUE = henvcfg.ADUE = 1, store, load and fetch through a VS-stage leaf with A = D = 0 in a level-0 page table at a guest physical address whose G-stage leaf is read-only.

The VS-stage A/D update is an implicit store, so it needs G-stage write permission. Each access raises a guest-page fault reported for the original access type (instruction, load or store/AMO), with htval = the guest physical address of the VS-stage PTE >> 2 and, if htval is nonzero, htinst = the write pseudoinstruction 0x3020 on RV64, 0x2020 on RV32.

VS x {sw, lw, jalr} x stage_modes x htinst write pseudoinstruction

H_vm_gstagetrans
H_trap_xtinst_guestpage
H_trap_xtinst_guestpage_rw

Sv_H cp_implicit_gpf has the read pseudoinstruction cases.

cp_hlv_implicit

Guest-page faults on the implicit VS-stage A/D updates of HLV, HLVX and HSV

In HS-mode with hstatus.SPVP = 1 and menvcfg.ADUE = henvcfg.ADUE = 1, execute hlv.w, hlvx.wu and hsv.w through a VS-stage leaf with A = D = 0 in a level-0 page table at a guest physical address whose G-stage leaf is read-only.

The A/D update raises a load or store guest-page fault with htinst = the write pseudoinstruction.

HS x {hlv.w, hlvx.wu, hsv.w} x stage_modes x htinst write pseudoinstruction

H_vm_gstagetrans
H_trap_xtinst_guestpage
H_trap_xtinst_guestpage_rw

Sv_H cp_hlv_implicit has the read pseudoinstruction cases.

cp_henvcfg_menvcfg

henvcfg.ADUE is read-only zero while menvcfg.ADUE = 0

In HS-mode with menvcfg.ADUE = 0, then 1, set henvcfg.ADUE (henvcfgh on RV32) and read it back.

henvcfg.ADUE reads as zero while menvcfg.ADUE = 0, and reads back as written while menvcfg.ADUE = 1.

HS x csrrs henvcfg (henvcfgh on RV32) x menvcfg.ADUE {0, 1}

menvcfg_adue_henvcfg_adue_rdonly0
menvcfg_pbmte_henvcfg_pbmte_rdonly0
Svadu_hypervisor_adue_writable

Table 257. Svadu Normative Rules
Normative Rule Rule Text Coverpoints

Svadu_hw_update_a_d_bits

If the Svadu extension is implemented, the menvcfg.ADUE field is writable.

Sm_mcsr_cg/cp_mcsrwalk_masked/menvcfg, Svadu_cg/{Abit_unset_read_s, Dbit_unset_write_s}

Svadu_hypervisor_adue_writable

If the hypervisor extension is additionally implemented, the henvcfg.ADUE field is also writable.

Svadu_H_cg/cp_henvcfg_menvcfg

Svadu_disabled_hw_update_falls_back_to_Svade

When hardware updating of A/D bits is disabled, the Svade extension, which mandates exceptions when A/D bits need be set, instead takes effect.

Svade_cg/{Abit_unset_read_s, Dbit_unset_write_s}

menvcfg_adue_op

If the Svadu extension is implemented, the ADUE bit controls whether hardware updating of PTE A/D bits is enabled for S-mode and G-stage address translations. When ADUE=1, hardware updating of PTE A/D bits is enabled during S-mode address translation, and the implementation behaves as though the Svade extension were not implemented for S-mode address translation. When the hypervisor extension is implemented, if ADUE=1, hardware updating of PTE A/D bits is enabled during G-stage address translation, and the implementation behaves as though the Svade extension were not implemented for G-stage address translation. When ADUE=0, the implementation behaves as though Svade were implemented for S-mode and G-stage address translation.

Svadu_cg/{Abit_unset_read_s, Dbit_unset_write_s}, Svadu_cg/fault_no_update_{exec,read,write}_s

menvcfg_adue_fence

After changing menvcfg.ADUE, executing an SFENCE.VMA instruction with rs1=x0 and rs2=x0 suffices to synchronize address-translation caches with respect to the altered interpretation of page-table entries' A/D bits.

Svadu_cg/Svadu_enabled

menvcfg_adue_rdonly0

If Svadu is not implemented, ADUE is read-only zero.

Sm_mcsr_cg/cp_mcsrwalk_masked/menvcfg

menvcfg_adue_henvcfg_adue_rdonly0

for implementations with the hypervisor extension, henvcfg.ADUE is read-only zero if menvcfg.ADUE is zero.

Svadu_H_cg/cp_henvcfg_menvcfg

UDB Parameters: None.

B.7.6. Svpbmt Page-Based Memory Types

Table 258. Svpbmt Coverpoints
Coverpoint Goal Feature Description Expectation Bins ID Normative Rule

General Test Environment (Svpbmt):
- T-SBI suite: boots to S-mode (BOOT_TO_SMODE) and drives the test from the boot identity map. The page under test is mapped at va_data. S-mode accesses run from the identity map. U-mode accesses use RVTEST_TSBI_GOTO_UMODE / RVTEST_TSBI_GOTO_SMODE; the handler moves execution to the U-accessible code alias va_rvtest_code_begin (registered with SAVE_AREA_SETUP) and back. menvcfg is written through T-SBI CSR calls. Page faults are delegated to S-mode, so causes are sampled from scause/stval.
- menvcfg.PBMTE is set through T-SBI. RV64 only (Sv39, Sv48, Sv57).

nonleaf_PTE_pbmt_exec_s

Verify PBMT set in a non-leaf PTE raises an instruction page fault on an instruction fetch from S-mode

S-mode: menvcfg.PBMTE=1 (set through T-SBI). Non-leaf PTE with PBMT = 1, 2 and 3 above a valid leaf with PTE.U=0. Jump (jalr) into the page through va_data.

Instruction page fault (scause = 12); stval = faulting virtual address.

nonleaf_PTE_pbmt_i x PBMTE_set x PageType_i x jalr x ins_page_fault x mode {S-mode}
= 15 bins on RV64 (RV64 only)

Svpbmt_nonleaf_pte_pbmt_must_be_zero menvcfg_pbmte_op menvcfg_pbmte_fence

Svpbmt_nonleaf_pte_pbmt_must_be_zero
menvcfg_pbmte_op
menvcfg_pbmte_fence

nonleaf_PTE_pbmt_exec_u

Verify PBMT set in a non-leaf PTE raises an instruction page fault on an instruction fetch from U-mode

U-mode: menvcfg.PBMTE=1 (set through T-SBI). Non-leaf PTE with PBMT = 1, 2 and 3 above a valid leaf with PTE.U=1. Jump (jalr) into the page through va_data.

Instruction page fault (scause = 12); stval = faulting virtual address.

nonleaf_PTE_pbmt_i x PBMTE_set x PageType_i x jalr x ins_page_fault x mode {U-mode}
= 15 bins on RV64 (RV64 only)

Svpbmt_nonleaf_pte_pbmt_must_be_zero menvcfg_pbmte_op menvcfg_pbmte_fence

Svpbmt_nonleaf_pte_pbmt_must_be_zero
menvcfg_pbmte_op
menvcfg_pbmte_fence

nonleaf_PTE_pbmt_read_s

Verify PBMT set in a non-leaf PTE raises a load page fault on a load from S-mode

S-mode: menvcfg.PBMTE=1 (set through T-SBI). Non-leaf PTE with PBMT = 1, 2 and 3 above a valid leaf with PTE.U=0. Load (lw) from the page through va_data.

Load page fault (scause = 13); stval = faulting virtual address.

nonleaf_PTE_pbmt_d x PBMTE_set x PageType_d x lw x load_page_fault x mode {S-mode}
= 15 bins on RV64 (RV64 only)

Svpbmt_nonleaf_pte_pbmt_must_be_zero menvcfg_pbmte_op menvcfg_pbmte_fence

Svpbmt_nonleaf_pte_pbmt_must_be_zero
menvcfg_pbmte_op
menvcfg_pbmte_fence

nonleaf_PTE_pbmt_read_u

Verify PBMT set in a non-leaf PTE raises a load page fault on a load from U-mode

U-mode: menvcfg.PBMTE=1 (set through T-SBI). Non-leaf PTE with PBMT = 1, 2 and 3 above a valid leaf with PTE.U=1. Load (lw) from the page through va_data.

Load page fault (scause = 13); stval = faulting virtual address.

nonleaf_PTE_pbmt_d x PBMTE_set x PageType_d x lw x load_page_fault x mode {U-mode}
= 15 bins on RV64 (RV64 only)

Svpbmt_nonleaf_pte_pbmt_must_be_zero menvcfg_pbmte_op menvcfg_pbmte_fence

Svpbmt_nonleaf_pte_pbmt_must_be_zero
menvcfg_pbmte_op
menvcfg_pbmte_fence

nonleaf_PTE_pbmt_write_s

Verify PBMT set in a non-leaf PTE raises a store/AMO page fault on a store from S-mode

S-mode: menvcfg.PBMTE=1 (set through T-SBI). Non-leaf PTE with PBMT = 1, 2 and 3 above a valid leaf with PTE.U=0. Store (sw) to the page through va_data.

Store/AMO page fault (scause = 15); stval = faulting virtual address.

nonleaf_PTE_pbmt_d x PBMTE_set x PageType_d x sw x store_page_fault x mode {S-mode}
= 15 bins on RV64 (RV64 only)

Svpbmt_nonleaf_pte_pbmt_must_be_zero menvcfg_pbmte_op menvcfg_pbmte_fence

Svpbmt_nonleaf_pte_pbmt_must_be_zero
menvcfg_pbmte_op
menvcfg_pbmte_fence

nonleaf_PTE_pbmt_write_u

Verify PBMT set in a non-leaf PTE raises a store/AMO page fault on a store from U-mode

U-mode: menvcfg.PBMTE=1 (set through T-SBI). Non-leaf PTE with PBMT = 1, 2 and 3 above a valid leaf with PTE.U=1. Store (sw) to the page through va_data.

Store/AMO page fault (scause = 15); stval = faulting virtual address.

nonleaf_PTE_pbmt_d x PBMTE_set x PageType_d x sw x store_page_fault x mode {U-mode}
= 15 bins on RV64 (RV64 only)

Svpbmt_nonleaf_pte_pbmt_must_be_zero menvcfg_pbmte_op menvcfg_pbmte_fence

Svpbmt_nonleaf_pte_pbmt_must_be_zero
menvcfg_pbmte_op
menvcfg_pbmte_fence

leaf_PTE_pbmt_exec_s

Verify an instruction fetch through a leaf PTE with PBMT = NC or IO succeeds from S-mode

S-mode: menvcfg.PBMTE=1. Leaf PTE with PBMT = 1 (NC) and 2 (IO) and PTE.U=0, at every page-table level (4 KiB page and each superpage size of the Sv mode). Jump (jalr) into the page through va_data.

No fault.

leaf_PTE_pbmt_s_i x PBMTE_set x PageType_i x jalr x mode {S-mode}
= 14 bins on RV64 (RV64 only)

Svpbmt_depends_Sv39 menvcfg_pbmte_op menvcfg_pbmte_fence

Svpbmt_pte_bits
Svpbmt_depends_Sv39
menvcfg_pbmte_op
menvcfg_pbmte_fence

leaf_PTE_pbmt_exec_u

Verify an instruction fetch through a leaf PTE with PBMT = NC or IO succeeds from U-mode

U-mode: menvcfg.PBMTE=1. Leaf PTE with PBMT = 1 (NC) and 2 (IO) and PTE.U=1, at every page-table level (4 KiB page and each superpage size of the Sv mode). Jump (jalr) into the page through va_data.

No fault.

leaf_PTE_pbmt_u_i x PBMTE_set x PageType_i x jalr x mode {U-mode}
= 14 bins on RV64 (RV64 only)

Svpbmt_depends_Sv39 menvcfg_pbmte_op menvcfg_pbmte_fence

Svpbmt_depends_Sv39
menvcfg_pbmte_op
menvcfg_pbmte_fence

leaf_PTE_pbmt_read_s

Verify a load through a leaf PTE with PBMT = NC or IO succeeds from S-mode

S-mode: menvcfg.PBMTE=1. Leaf PTE with PBMT = 1 (NC) and 2 (IO) and PTE.U=0, at every page-table level (4 KiB page and each superpage size of the Sv mode). Load (lw) from the page through va_data.

No fault.

leaf_PTE_pbmt_s_d x PBMTE_set x PageType_d x lw x mode {S-mode}
= 14 bins on RV64 (RV64 only)

Svpbmt_depends_Sv39 menvcfg_pbmte_op menvcfg_pbmte_fence

Svpbmt_pte_bits
Svpbmt_enc_tbl
Svpbmt_depends_Sv39
menvcfg_pbmte_op
menvcfg_pbmte_fence

leaf_PTE_pbmt_read_u

Verify a load through a leaf PTE with PBMT = NC or IO succeeds from U-mode

U-mode: menvcfg.PBMTE=1. Leaf PTE with PBMT = 1 (NC) and 2 (IO) and PTE.U=1, at every page-table level (4 KiB page and each superpage size of the Sv mode). Load (lw) from the page through va_data.

No fault.

leaf_PTE_pbmt_u_d x PBMTE_set x PageType_d x lw x mode {U-mode}
= 14 bins on RV64 (RV64 only)

Svpbmt_depends_Sv39 menvcfg_pbmte_op menvcfg_pbmte_fence

Svpbmt_pte_bits
Svpbmt_depends_Sv39
menvcfg_pbmte_op
menvcfg_pbmte_fence

leaf_PTE_pbmt_write_s

Verify a store through a leaf PTE with PBMT = NC or IO succeeds from S-mode

S-mode: menvcfg.PBMTE=1. Leaf PTE with PBMT = 1 (NC) and 2 (IO) and PTE.U=0, at every page-table level (4 KiB page and each superpage size of the Sv mode). Store (sw) to the page through va_data.

No fault.

leaf_PTE_pbmt_s_d x PBMTE_set x PageType_d x sw x mode {S-mode}
= 14 bins on RV64 (RV64 only)

Svpbmt_depends_Sv39 menvcfg_pbmte_op menvcfg_pbmte_fence

Svpbmt_pte_bits
Svpbmt_depends_Sv39
menvcfg_pbmte_op
menvcfg_pbmte_fence

leaf_PTE_pbmt_write_u

Verify a store through a leaf PTE with PBMT = NC or IO succeeds from U-mode

U-mode: menvcfg.PBMTE=1. Leaf PTE with PBMT = 1 (NC) and 2 (IO) and PTE.U=1, at every page-table level (4 KiB page and each superpage size of the Sv mode). Store (sw) to the page through va_data.

No fault.

leaf_PTE_pbmt_u_d x PBMTE_set x PageType_d x sw x mode {U-mode}
= 14 bins on RV64 (RV64 only)

Svpbmt_depends_Sv39 menvcfg_pbmte_op menvcfg_pbmte_fence

Svpbmt_enc_tbl
Svpbmt_depends_Sv39
menvcfg_pbmte_op
menvcfg_pbmte_fence

leaf_PTE_pbmt_reserved_enc_exec_s

Verify PBMT = 3 in a leaf PTE raises an instruction page fault on an instruction fetch from S-mode

S-mode: menvcfg.PBMTE=1. Leaf PTE with PBMT = 3 and PTE.U=0, at every page-table level (4 KiB page and each superpage size of the Sv mode). Jump (jalr) into the page through va_data.

Instruction page fault (scause = 12); stval = faulting virtual address.

leaf_PTE_pbmt_res_s_i x PBMTE_set x PageType_i x jalr x ins_page_fault x mode {S-mode}
= 7 bins on RV64 (RV64 only)

Svpbmt_leaf_pte_pbmt_reserved_3_fault menvcfg_pbmte_op menvcfg_pbmte_fence

Svpbmt_leaf_pte_pbmt_reserved_3_fault
menvcfg_pbmte_op
menvcfg_pbmte_fence

leaf_PTE_pbmt_reserved_enc_exec_u

Verify PBMT = 3 in a leaf PTE raises an instruction page fault on an instruction fetch from U-mode

U-mode: menvcfg.PBMTE=1. Leaf PTE with PBMT = 3 and PTE.U=1, at every page-table level (4 KiB page and each superpage size of the Sv mode). Jump (jalr) into the page through va_data.

Instruction page fault (scause = 12); stval = faulting virtual address.

leaf_PTE_pbmt_res_u_i x PBMTE_set x PageType_i x jalr x ins_page_fault x mode {U-mode}
= 7 bins on RV64 (RV64 only)

Svpbmt_leaf_pte_pbmt_reserved_3_fault menvcfg_pbmte_op menvcfg_pbmte_fence

Svpbmt_enc_tbl
Svpbmt_leaf_pte_pbmt_reserved_3_fault
menvcfg_pbmte_op
menvcfg_pbmte_fence

leaf_PTE_pbmt_reserved_enc_read_s

Verify PBMT = 3 in a leaf PTE raises a load page fault on a load from S-mode

S-mode: menvcfg.PBMTE=1. Leaf PTE with PBMT = 3 and PTE.U=0, at every page-table level (4 KiB page and each superpage size of the Sv mode). Load (lw) from the page through va_data.

Load page fault (scause = 13); stval = faulting virtual address.

leaf_PTE_pbmt_res_s_d x PBMTE_set x PageType_d x lw x load_page_fault x mode {S-mode}
= 7 bins on RV64 (RV64 only)

Svpbmt_leaf_pte_pbmt_reserved_3_fault menvcfg_pbmte_op menvcfg_pbmte_fence

Svpbmt_enc_tbl
Svpbmt_leaf_pte_pbmt_reserved_3_fault
menvcfg_pbmte_op
menvcfg_pbmte_fence

leaf_PTE_pbmt_reserved_enc_read_u

Verify PBMT = 3 in a leaf PTE raises a load page fault on a load from U-mode

U-mode: menvcfg.PBMTE=1. Leaf PTE with PBMT = 3 and PTE.U=1, at every page-table level (4 KiB page and each superpage size of the Sv mode). Load (lw) from the page through va_data.

Load page fault (scause = 13); stval = faulting virtual address.

leaf_PTE_pbmt_res_u_d x PBMTE_set x PageType_d x lw x load_page_fault x mode {U-mode}
= 7 bins on RV64 (RV64 only)

Svpbmt_leaf_pte_pbmt_reserved_3_fault menvcfg_pbmte_op menvcfg_pbmte_fence

Svpbmt_leaf_pte_pbmt_reserved_3_fault
menvcfg_pbmte_op
menvcfg_pbmte_fence

leaf_PTE_pbmt_reserved_enc_write_s

Verify PBMT = 3 in a leaf PTE raises a store/AMO page fault on a store from S-mode

S-mode: menvcfg.PBMTE=1. Leaf PTE with PBMT = 3 and PTE.U=0, at every page-table level (4 KiB page and each superpage size of the Sv mode). Store (sw) to the page through va_data.

Store/AMO page fault (scause = 15); stval = faulting virtual address.

leaf_PTE_pbmt_res_s_d x PBMTE_set x PageType_d x sw x store_page_fault x mode {S-mode}
= 7 bins on RV64 (RV64 only)

Svpbmt_leaf_pte_pbmt_reserved_3_fault menvcfg_pbmte_op menvcfg_pbmte_fence

Svpbmt_leaf_pte_pbmt_reserved_3_fault
menvcfg_pbmte_op
menvcfg_pbmte_fence

leaf_PTE_pbmt_reserved_enc_write_u

Verify PBMT = 3 in a leaf PTE raises a store/AMO page fault on a store from U-mode

U-mode: menvcfg.PBMTE=1. Leaf PTE with PBMT = 3 and PTE.U=1, at every page-table level (4 KiB page and each superpage size of the Sv mode). Store (sw) to the page through va_data.

Store/AMO page fault (scause = 15); stval = faulting virtual address.

leaf_PTE_pbmt_res_u_d x PBMTE_set x PageType_d x sw x store_page_fault x mode {U-mode}
= 7 bins on RV64 (RV64 only)

Svpbmt_leaf_pte_pbmt_reserved_3_fault menvcfg_pbmte_op menvcfg_pbmte_fence

Svpbmt_leaf_pte_pbmt_reserved_3_fault
menvcfg_pbmte_op
menvcfg_pbmte_fence

Svpbmt_H Hypervisor Page-Based Memory Types

Checks henvcfg.PBMTE in the VS-stage and menvcfg.PBMTE in the G-stage.

Svpbmt_H uses the Sv_H test environment (see Sv_H). Svpbmt exists only on RV64. henvcfg.PBMTE enables PBMT in the VS-stage and menvcfg.PBMTE in the G-stage. The test page is flushed (fence, and cbo.flush with Zicbom) between accesses with different attributes.

Table 259. Svpbmt_H Coverpoints
Coverpoint Goal Feature Description Expectation Bins Normative Rule

cp_vsatp_pbmt

henvcfg.PBMTE gates Svpbmt in the VS-stage

In VS-mode with hgatp = Bare and menvcfg.PBMTE = 1, store, load and fetch through a VS-stage leaf with PBMT = 1 (NC), 2 (IO) and 3 (reserved), with henvcfg.PBMTE = 0 and 1.

With henvcfg.PBMTE = 0, the PBMT bits are reserved and every access raises a page fault. With henvcfg.PBMTE = 1, the PBMT = 1 and 2 accesses complete (the attributes themselves are not observable) and PBMT = 3 raises a page fault.

VS x {sw, lw, jalr} x vsatp_mode x hgatp Bare x {henvcfg.PBMTE 0 with page fault, henvcfg.PBMTE 1 with {no trap, page fault}}

henvcfg_pbmte_op
Svpbmt_vsatp_stage_override_rule
Svpbmt_hgatp_stage_override_rule

cp_hgatp_pbmt

menvcfg.PBMTE gates Svpbmt in the G-stage

In VS-mode with vsatp = Bare, store, load and fetch through a G-stage leaf with PBMT = 1, 2 and 3, with menvcfg.PBMTE = 0 and 1.

With menvcfg.PBMTE = 0, the PBMT bits are reserved and every access raises a guest-page fault. With menvcfg.PBMTE = 1, the PBMT = 1 and 2 accesses complete and PBMT = 3 raises a guest-page fault.

VS x {sw, lw, jalr} x vsatp Bare x hgatp_mode x {menvcfg.PBMTE 0 with guest-page fault, menvcfg.PBMTE 1 with {no trap, guest-page fault}}

menvcfg_pbmte_op
Svpbmt_hgatp_stage_override_rule
Svpbmt_vsatp_stage_override_rule

cp_henvcfg_menvcfg

henvcfg.PBMTE is read-only zero while menvcfg.PBMTE = 0

In HS-mode with menvcfg.PBMTE = 0, then 1, set henvcfg.PBMTE and read it back.

henvcfg.PBMTE reads as zero while menvcfg.PBMTE = 0, and reads back as written while menvcfg.PBMTE = 1.

HS x csrrs henvcfg x menvcfg.PBMTE {0, 1}

menvcfg_adue_henvcfg_adue_rdonly0
menvcfg_pbmte_henvcfg_pbmte_rdonly0
Svadu_hypervisor_adue_writable

Table 260. Svpbmt Normative Rules
Normative Rule Rule Text Coverpoints

Svpbmt_pte_bits

In Sv39, Sv48, and Sv57, bits 62-61 of a leaf page table entry indicate the use of page-based memory types that override the PMA(s) for the associated memory pages.

Svpbmt_cg/{leaf_PTE_pbmt_exec_s, leaf_PTE_pbmt_read_s, leaf_PTE_pbmt_write_s, leaf_PTE_pbmt_read_u}

Svpbmt_depends_Sv39

The Svpbmt extension depends on the Sv39 extension

Not tested: extension dependency checked by the UDB configuration

Svpbmt_enc_tbl

Mode|Value|Requested Memory Attributes === PMA NC IO -|0 1 2 3|None Non-cacheable, idempotent, weakly-ordered (RVWMO), main memory Non-cacheable, non-idempotent, strongly-ordered (I/O ordering), I/O Reserved for future standard use ===

Svpbmt_cg/{leaf_PTE_pbmt_read_s, leaf_PTE_pbmt_write_u, leaf_PTE_pbmt_reserved_enc_read_s, leaf_PTE_pbmt_reserved_enc_exec_u}

Svpbmt_nonleaf_pte_pbmt_must_be_zero

Until their use is defined by a standard extension, they must be cleared by software for forward compatibility, or else a page-fault exception is raised.

Svpbmt_cg/{nonleaf_PTE_pbmt_exec_s, nonleaf_PTE_pbmt_read_s, nonleaf_PTE_pbmt_write_s, nonleaf_PTE_pbmt_read_u}

Svpbmt_leaf_pte_pbmt_reserved_3_fault

Until this value is defined by a standard extension, using this reserved value in a leaf PTE raises a page-fault exception.

Svpbmt_cg/{leaf_PTE_pbmt_reserved_enc_exec_s, leaf_PTE_pbmt_reserved_enc_read_s, leaf_PTE_pbmt_reserved_enc_write_s, leaf_PTE_pbmt_reserved_enc_read_u}

menvcfg_pbmte_op

The PBMTE bit controls whether the Svpbmt extension is available for use in S-mode and G-stage address translation (i.e., for page tables pointed to by satp or hgatp). When PBMTE=1, Svpbmt is available for S-mode and G-stage address translation. When PBMTE=0, the implementation behaves as though Svpbmt were not implemented.

Svpbmt_cg/PBMTE_set, Sv_add_feature_cg/cp_svpbmt_{read,write,exec}_fault

menvcfg_pbmte_fence

After changing menvcfg.PBMTE, executing an SFENCE.VMA instruction with rs1=x0 and rs2=x0 suffices to synchronize address-translation caches with respect to the altered interpretation of page-table entries' PBMT fields.

Svpbmt_cg/PBMTE_set

menvcfg_pbmte_rdonly0

If Svpbmt is not implemented, PBMTE is read-only zero.

Sm_mcsr_cg/cp_mcsrwalk_masked/menvcfg

Svpbmt_impl_may_override_pmas

Implementations may override additional PMAs not explicitly listed in norm:Svpbmt_enc_tbl.

Not tested: implementation-defined PMA overrides

Svpbmt_obeys_mem_ordering, Svpbmt_io_pma_nc_pbmt_obey_rvwmo, Svpbmt_io_pma_nc_pbmt_treated_as_io_and_memory, Svpbmt_memory_pma_io_pbmt_strong_io_ordering, Svpbmt_memory_pma_io_pbmt_treated_as_io_and_memory, Svpbmt_aliasing_attribute, Svpbmt_noncacheable_aliasing_no_coherence_loss, Svpbmt_noncacheable_aliasing_may_weaken_ordering, Svpbmt_noncacheable_aliasing_fence_prevents_ordering_loss, Svpbmt_cacheable_aliasing_may_cause_coherence_loss, Svpbmt_cacheable_aliasing_fence_flush_fence_required

Svpbmt_obeys_mem_ordering: memory accesses to such pages obey the memory ordering rules of the final effective attribute, Svpbmt_io_pma_nc_pbmt_obey_rvwmo: If the underlying physical memory attribute for a page is I/O, and the page has PBMT=NC, then accesses to that page obey RVWMO. Svpbmt_io_pma_nc_pbmt_treated_as_io_and_memory: accesses to such pages are considered to be both I/O and main memory accesses for the purposes of FENCE, .aq, and .rl. Svpbmt_memory_pma_io_pbmt_strong_io_ordering: accesses to that page obey strong channel 0 I/O ordering rules. Svpbmt_memory_pma_io_pbmt_treated_as_io_and_memory: accesses to such pages are considered to be both I/O and main memory accesses for the purposes of FENCE, .aq, and .rl. Svpbmt_aliasing_attribute: When Svpbmt is used with non-zero PBMT encodings, it is possible for multiple virtual aliases of the same physical page to exist simultaneously with different memory attributes. It is also possible for a U-mode or S-mode mapping through a PTE with Svpbmt enabled to observe different memory attributes for a given region of physical memory than a concurrent access to the same page performed by M-mode or when MODE=Bare. In such cases, the behaviors dictated by the attributes (including coherence, which is otherwise unaffected) may be violated. Svpbmt_noncacheable_aliasing_no_coherence_loss: Accessing the same location using different attributes that are both non-cacheable (e.g., NC and IO) does not cause loss of coherence, Svpbmt_noncacheable_aliasing_may_weaken_ordering: might result in weaker memory ordering than the stricter attribute ordinarily guarantees. Svpbmt_noncacheable_aliasing_fence_prevents_ordering_loss: fence iorw, iorw instruction between such accesses suffices to prevent loss of memory ordering. Svpbmt_cacheable_aliasing_may_cause_coherence_loss: may cause loss of coherence. Svpbmt_cacheable_aliasing_fence_flush_fence_required: prevents both loss of coherence and loss of memory ordering:

Not tested: memory ordering, cacheability and coherence are not observable in single-hart signature tests

Svpbmt_hgatp_stage_override_rule, Svpbmt_vsatp_stage_override_rule

Svpbmt_hgatp_stage_override_rule: if hgatp.MODE is not equal to zero, non-zero G-stage PTE PBMT bits override the attributes in the PMA to produce an intermediate set of attributes. Svpbmt_vsatp_stage_override_rule: if vsatp.MODE is not equal to zero, non-zero VS-stage PTE PBMT bits override the intermediate attributes to produce the final set of attributes used by accesses to the page in question.

Svpbmt_H_cg/{cp_vsatp_pbmt,cp_hgatp_pbmt}

menvcfg_pbmte_henvcfg_pbmte_rdonly0

for implementations with the hypervisor extension, henvcfg.PBMTE is read-only zero if menvcfg.PBMTE is zero.

Svpbmt_H_cg/cp_henvcfg_menvcfg

UDB Parameters: None.

B.7.7. Svnapot Naturally-Aligned Power-of-Two Page Sizes

Table 261. Svnapot Coverpoints
Coverpoint Goal Feature Description Expectation Bins ID Normative Rule Pass/Fail Criteria Notes

General Test Environment (Svnapot):
- T-SBI suite: boots to S-mode (BOOT_TO_SMODE) and drives the test from the boot identity map. The page under test is mapped at va_data. S-mode accesses run from the identity map. U-mode accesses use RVTEST_TSBI_GOTO_UMODE / RVTEST_TSBI_GOTO_SMODE; the handler moves execution to the U-accessible code alias va_rvtest_code_begin (registered with SAVE_AREA_SETUP) and back. menvcfg is written through T-SBI CSR calls. Page faults are delegated to S-mode, so causes are sampled from scause/stval.
- RV64 only (Sv39, Sv48, Sv57).
Normative rules without a coverpoint in this suite:
- Svnapot_cache_entries: Not tested

Svnapot_legal_enc_exec_s

Verify an instruction fetch through a 64 KiB NAPOT mapping succeeds from S-mode

S-mode: sixteen level-0 PTEs with N=1, PPN[3:0]=1000 and PTE.U=0 map a naturally aligned 64 KiB region. Jump (jalr) into the page at offsets 0, 0x2000 and 0xF000 of va_data.

No fault; each access reaches the matching 4 KiB page of the 64 KiB region.

PTE_RWX_s_i x PTE_Svnapot_i x PTE_N_i x kilopage_i x mode x exec_acc x mode {S-mode}
= 3 bins on RV64 (RV64 only)

Svnapot_depends_Sv39 Svnapot_pte_n Svnapot_range_napot Svnapot_valid_encoding_ppn_subst

Svnapot_pte_n
Svnapot_range_napot
Svnapot_enc_tbl
Svnapot_valid_encoding_ppn_subst
Svnapot_depends_Sv39

Svnapot_legal_enc_exec_u

Verify an instruction fetch through a 64 KiB NAPOT mapping succeeds from U-mode

U-mode: sixteen level-0 PTEs with N=1, PPN[3:0]=1000 and PTE.U=1 map a naturally aligned 64 KiB region. Jump (jalr) into the page at offsets 0, 0x2000 and 0xF000 of va_data.

No fault; each access reaches the matching 4 KiB page of the 64 KiB region.

PTE_RWX_u_i x PTE_Svnapot_i x PTE_N_i x kilopage_i x mode x exec_acc x mode {U-mode}
= 3 bins on RV64 (RV64 only)

Svnapot_depends_Sv39 Svnapot_pte_n Svnapot_range_napot Svnapot_valid_encoding_ppn_subst

Svnapot_pte_n
Svnapot_range_napot
Svnapot_valid_encoding_ppn_subst
Svnapot_depends_Sv39

Svnapot_legal_enc_read_s

Verify a load through a 64 KiB NAPOT mapping succeeds from S-mode

S-mode: sixteen level-0 PTEs with N=1, PPN[3:0]=1000 and PTE.U=0 map a naturally aligned 64 KiB region. Load (lw) from the page at offsets 0, 0x2000 and 0xF000 of va_data.

No fault; each access reaches the matching 4 KiB page of the 64 KiB region.

PTE_RWX_s_d x PTE_Svnapot_d x PTE_N_d x kilopage_d x mode x read_acc x mode {S-mode}
= 3 bins on RV64 (RV64 only)

Svnapot_legal_enc_read_u

Verify a load through a 64 KiB NAPOT mapping succeeds from U-mode

U-mode: sixteen level-0 PTEs with N=1, PPN[3:0]=1000 and PTE.U=1 map a naturally aligned 64 KiB region. Load (lw) from the page at offsets 0, 0x2000 and 0xF000 of va_data.

No fault; each access reaches the matching 4 KiB page of the 64 KiB region.

PTE_RWX_u_d x PTE_Svnapot_d x PTE_N_d x kilopage_d x mode x read_acc x mode {U-mode}
= 3 bins on RV64 (RV64 only)

Svnapot_enc_tbl

Svnapot_legal_enc_write_s

Verify a store through a 64 KiB NAPOT mapping succeeds from S-mode

S-mode: sixteen level-0 PTEs with N=1, PPN[3:0]=1000 and PTE.U=0 map a naturally aligned 64 KiB region. Store (sw) to the page at offsets 0, 0x2000 and 0xF000 of va_data.

No fault; each access reaches the matching 4 KiB page of the 64 KiB region.

PTE_RWX_s_d x PTE_Svnapot_d x PTE_N_d x kilopage_d x mode x write_acc x mode {S-mode}
= 3 bins on RV64 (RV64 only)

Svnapot_legal_enc_write_u

Verify a store through a 64 KiB NAPOT mapping succeeds from U-mode

U-mode: sixteen level-0 PTEs with N=1, PPN[3:0]=1000 and PTE.U=1 map a naturally aligned 64 KiB region. Store (sw) to the page at offsets 0, 0x2000 and 0xF000 of va_data.

No fault; each access reaches the matching 4 KiB page of the 64 KiB region.

PTE_RWX_u_d x PTE_Svnapot_d x PTE_N_d x kilopage_d x mode x write_acc x mode {U-mode}
= 3 bins on RV64 (RV64 only)

Svnapot_reserved_enc_exec_s

Verify a reserved NAPOT PPN encoding raises an instruction page fault on an instruction fetch from S-mode

S-mode: level-0 PTE with N=1, PTE.U=0 and PPN[3:0] = 0001, 0010, 0100 or 0000. Jump (jalr) into the page through va_data.

Instruction page fault (scause = 12); stval = faulting virtual address.

PTE_RWX_s_i x PTE_Svnapot_reserved_enc_i x PTE_N_i x kilopage_i x mode x exec_acc x ins_page_fault x mode {S-mode}
= 12 bins on RV64 (RV64 only)

Svnapot_reserved_encoding_fault

Svnapot_reserved_encoding_fault

Svnapot_reserved_enc_exec_u

Verify a reserved NAPOT PPN encoding raises an instruction page fault on an instruction fetch from U-mode

U-mode: level-0 PTE with N=1, PTE.U=1 and PPN[3:0] = 0001, 0010, 0100 or 0000. Jump (jalr) into the page through va_data.

Instruction page fault (scause = 12); stval = faulting virtual address.

PTE_RWX_u_i x PTE_Svnapot_reserved_enc_i x PTE_N_i x kilopage_i x mode x exec_acc x ins_page_fault x mode {U-mode}
= 12 bins on RV64 (RV64 only)

Svnapot_reserved_encoding_fault

Svnapot_reserved_encoding_fault

Svnapot_reserved_enc_read_s

Verify a reserved NAPOT PPN encoding raises a load page fault on a load from S-mode

S-mode: level-0 PTE with N=1, PTE.U=0 and PPN[3:0] = 0001, 0010, 0100 or 0000. Load (lw) from the page through va_data.

Load page fault (scause = 13); stval = faulting virtual address.

PTE_RWX_s_d x PTE_Svnapot_reserved_enc_d x PTE_N_d x kilopage_d x mode x read_acc x load_page_fault x mode {S-mode}
= 12 bins on RV64 (RV64 only)

Svnapot_reserved_enc_read_u

Verify a reserved NAPOT PPN encoding raises a load page fault on a load from U-mode

U-mode: level-0 PTE with N=1, PTE.U=1 and PPN[3:0] = 0001, 0010, 0100 or 0000. Load (lw) from the page through va_data.

Load page fault (scause = 13); stval = faulting virtual address.

PTE_RWX_u_d x PTE_Svnapot_reserved_enc_d x PTE_N_d x kilopage_d x mode x read_acc x load_page_fault x mode {U-mode}
= 12 bins on RV64 (RV64 only)

Svnapot_reserved_enc_write_s

Verify a reserved NAPOT PPN encoding raises a store/AMO page fault on a store from S-mode

S-mode: level-0 PTE with N=1, PTE.U=0 and PPN[3:0] = 0001, 0010, 0100 or 0000. Store (sw) to the page through va_data.

Store/AMO page fault (scause = 15); stval = faulting virtual address.

PTE_RWX_s_d x PTE_Svnapot_reserved_enc_d x PTE_N_d x kilopage_d x mode x write_acc x store_page_fault x mode {S-mode}
= 12 bins on RV64 (RV64 only)

Svnapot_enc_tbl

Svnapot_reserved_enc_write_u

Verify a reserved NAPOT PPN encoding raises a store/AMO page fault on a store from U-mode

U-mode: level-0 PTE with N=1, PTE.U=1 and PPN[3:0] = 0001, 0010, 0100 or 0000. Store (sw) to the page through va_data.

Store/AMO page fault (scause = 15); stval = faulting virtual address.

PTE_RWX_u_d x PTE_Svnapot_reserved_enc_d x PTE_N_d x kilopage_d x mode x write_acc x store_page_fault x mode {U-mode}
= 12 bins on RV64 (RV64 only)

Svnapot_reserved_ppni_exec_s

Verify PTE.N on a superpage raises an instruction page fault on an instruction fetch from S-mode

S-mode: superpage leaf PTE (level 1 and above) with N=1 and PTE.U=0. Jump (jalr) into the page through va_data.

Instruction page fault (scause = 12); stval = faulting virtual address.

PTE_RWX_s_i x PTE_N_i x PageType_i x exec_acc x ins_page_fault x mode {S-mode}
= 5 bins on RV64 (RV64 only)

Svnapot_reserved_ppni_exec_u

Verify PTE.N on a superpage raises an instruction page fault on an instruction fetch from U-mode

U-mode: superpage leaf PTE (level 1 and above) with N=1 and PTE.U=1. Jump (jalr) into the page through va_data.

Instruction page fault (scause = 12); stval = faulting virtual address.

PTE_RWX_u_i x PTE_N_i x PageType_i x exec_acc x ins_page_fault x mode {U-mode}
= 5 bins on RV64 (RV64 only)

Svnapot_reserved_ppni_read_s

Verify PTE.N on a superpage raises a load page fault on a load from S-mode

S-mode: superpage leaf PTE (level 1 and above) with N=1 and PTE.U=0. Load (lw) from the page through va_data.

Load page fault (scause = 13); stval = faulting virtual address.

PTE_RWX_s_d x PTE_N_d x PageType_d x read_acc x load_page_fault x mode {S-mode}
= 5 bins on RV64 (RV64 only)

Svnapot_enc_tbl

Svnapot_reserved_ppni_read_u

Verify PTE.N on a superpage raises a load page fault on a load from U-mode

U-mode: superpage leaf PTE (level 1 and above) with N=1 and PTE.U=1. Load (lw) from the page through va_data.

Load page fault (scause = 13); stval = faulting virtual address.

PTE_RWX_u_d x PTE_N_d x PageType_d x read_acc x load_page_fault x mode {U-mode}
= 5 bins on RV64 (RV64 only)

Svnapot_reserved_ppni_write_s

Verify PTE.N on a superpage raises a store/AMO page fault on a store from S-mode

S-mode: superpage leaf PTE (level 1 and above) with N=1 and PTE.U=0. Store (sw) to the page through va_data.

Store/AMO page fault (scause = 15); stval = faulting virtual address.

PTE_RWX_s_d x PTE_N_d x PageType_d x write_acc x store_page_fault x mode {S-mode}
= 5 bins on RV64 (RV64 only)

Svnapot_reserved_ppni_write_u

Verify PTE.N on a superpage raises a store/AMO page fault on a store from U-mode

U-mode: superpage leaf PTE (level 1 and above) with N=1 and PTE.U=1. Store (sw) to the page through va_data.

Store/AMO page fault (scause = 15); stval = faulting virtual address.

PTE_RWX_u_d x PTE_N_d x PageType_d x write_acc x store_page_fault x mode {U-mode}
= 5 bins on RV64 (RV64 only)

Svnapot_reserved_ppni_napot_enc_exec_s
Svnapot_reserved_ppni_napot_enc_exec_u
Svnapot_reserved_ppni_napot_enc_read_s
Svnapot_reserved_ppni_napot_enc_read_u
Svnapot_reserved_ppni_napot_enc_write_s
Svnapot_reserved_ppni_napot_enc_write_u

Set up a superpage leaf PTE (level i >= 1) with N=1 and the 64 KiB encoding pte.ppn[0][3:0] = 1000, at each superpage level.
The encoding is only defined for i = 0, so it is reserved here.
Store, load, and execute through the page in supervisor and user mode.

Svnapot_reserved_encoding_fault

Store/AMO, load, and instruction page faults

feature: Reserved Encoding

Svnapot_H Hypervisor NAPOT Pages

Checks 64 KiB NAPOT mappings in the VS-stage, the G-stage and both stages.

Svnapot_H uses the Sv_H test environment (see Sv_H). The tests run on RV64 with Sv39 and Sv39x4.

Table 262. Svnapot_H Coverpoints
Coverpoint Goal Feature Description Expectation Bins Normative Rule

cp_vsatp_napot

Svnapot in the VS-stage

In VS-mode and VU-mode with hgatp = Bare, store, load and fetch in pages 0, 2 and 15 of a 64 KiB NAPOT mapping (16 kilopage leaves with N = 1 and PPN[3:0] = 1000) to a 64 KiB region whose pages hold distinct words.
In VS-mode, also access through a VS-stage leaf with N = 1 on a superpage at each level above 0, and with N = 1 and PPN[3:0] = 0000, 0001, 0010 and 0100.

Each NAPOT access reaches the page of the region with the same page number. The reserved encodings raise page faults.

{VS, VU} x {sw, lw, jalr} x vsatp paged x hgatp Bare x NAPOT page {0, 2, 15}

cp_hgatp_napot

Svnapot in the G-stage

As cp_vsatp_napot, with the NAPOT leaves (and, in VS-mode, the reserved N encodings) in the G-stage and vsatp = Bare.

Each NAPOT access reaches the page of the region with the same page number. The reserved encodings raise guest-page faults.

{VS, VU} x {sw, lw, jalr} x vsatp Bare x hgatp paged x NAPOT page {0, 2, 15}

Svnapot_hyp_gstage

cp_twostage_napot

Svnapot in both stages

As cp_vsatp_napot, with a 64 KiB NAPOT mapping in the VS-stage to a guest physical NAPOT region that a G-stage NAPOT mapping maps to the physical region.

Each access reaches the page of the region with the same page number.

{VS, VU} x {sw, lw, jalr} x vsatp paged x hgatp paged x NAPOT page {0, 2, 15}

Svnapot_hyp_gstage

Table 263. Svnapot Normative Rules
Normative Rule Rule Text Coverpoints

Svnapot_depends_Sv39

The Svnapot extension depends on the Sv39 extension

Not tested: extension dependency checked by the UDB configuration

Svnapot_pte_n

In Sv39, Sv48, and Sv57, when a PTE has N=1, the PTE represents a translation that is part of a range of contiguous virtual-to-physical translations with the same values for PTE bits 5–0.

Svnapot_cg/Svnapot_legal_enc_exec_{s, u}

Svnapot_range_napot

Such ranges must be of a naturally aligned power-of-2 (NAPOT) granularity larger than the base page size

Svnapot_cg/Svnapot_legal_enc_exec_{s, u}

Svnapot_enc_tbl

i|pte.ppn[i]|Description|pte.napot_bits === 0 0 0 0 0 ≥1|x xxxx xxx1 x xxxx xx1x x xxxx x1xx x xxxx 1000 x xxxx 0xxx x xxxx xxxx|Reserved Reserved Reserved 64 KiB contiguous region Reserved Reserved|- - - 4 - - ===

Svnapot_cg/{Svnapot_legal_enc_exec_s, Svnapot_legal_enc_read_u, Svnapot_reserved_enc_write_s, Svnapot_reserved_ppni_read_s}

Svnapot_valid_encoding_ppn_subst

If the encoding in pte is valid according to norm:Svnapot_enc_tbl, then instead of returning the original value of pte, implicit reads of a NAPOT PTE return a copy of pte in which pte.ppn[i][pte.napot_bits-1:0] is replaced by vpn[i][pte.napot_bits-1:0].

Svnapot_cg/Svnapot_legal_enc_exec_{s, u}

Svnapot_reserved_encoding_fault

reserved according to norm:Svnapot_enc_tbl, then a page-fault exception must be raised

Svnapot_cg/Svnapot_reserved_enc_exec_{s, u}, Svnapot_cg/Svnapot_reserved_ppni_napot_enc_exec_{s, u}

Svnapot_cache_entries

Implicit reads of NAPOT page table entries may create address-translation cache entries mapping a + j×PTESIZE to a copy of pte in which pte.ppn[i][pte.napot_bits-1:0] is replaced by vpn[i][pte.napot_bits-1:0], for any or all j such that j >> napot_bits = vpn[i] >> napot_bits, all for the address space identified in satp as loaded by step 1

Not tested: address-translation cache contents are not observable in signature tests

Svnapot_hyp_gstage

Svnapot is also supported in G-stage translation

Svnapot_H_cg/{cp_hgatp_napot,cp_twostage_napot}

UDB Parameters: None.

B.7.8. Svvptc Obviating Memory-Management Instructions after Marking PTEs Valid

Svvptc requires a store that changes a PTE from invalid to valid to reach later implicit accesses within a bounded time, without SFENCE.VMA. The bound is implementation-defined, so each test provokes a page fault on the invalid PTE, stores the valid PTE, waits a fixed number of instructions, and checks that the retried access succeeds.

Table 264. Svvptc Coverpoints
Coverpoint Goal Feature Description Expectation Bins Normative Rule

General Test Environment (Svvptc):
- T-SBI suite: boots to S-mode (BOOT_TO_SMODE) and drives the test from the boot identity map. The page under test is mapped at va_data. S-mode accesses run from the identity map. U-mode accesses use RVTEST_TSBI_GOTO_UMODE / RVTEST_TSBI_GOTO_SMODE; the handler moves execution to the U-accessible code alias va_rvtest_code_begin (registered with SAVE_AREA_SETUP) and back. Page faults are delegated to S-mode.
- Run for every supported translation mode: Sv32 on RV32; Sv39, Sv48 and Sv57 on RV64, as selected by the UDB configuration.
- Each testcase writes the page tables in S-mode with the PTE under test invalid (V=0) and runs SFENCE.VMA. The access then takes a page fault, which lets an implementation cache the invalid PTE. S-mode stores the same PTE with V=1 using a plain store, with no SFENCE.VMA or SINVAL.VMA after it. The test waits 4096 loop iterations, about 8K instructions, and retries the access, which must succeed. The wait stands in for the bounded time that Svvptc allows. A hart that keeps the invalid PTE takes a second page fault and fails the signature check instead of hanging.
- PTE under test, for each access and privilege mode: the leaf PTE at every level (the 4 KiB page and each superpage size of the Sv mode), and the non-leaf PTE at every level above a 4 KiB leaf.
- The coverpoints sample the page fault on the V=0 PTE that starts each testcase; the signature checks the retry. The reference-model trace does not report the PTEs a walk reads, so the coverpoints distinguish the access, the translation mode and the privilege mode, but not which PTE changed.

cp_load

Verify a load reaches a page after a plain store sets V in a PTE, without SFENCE.VMA (Svvptc)

S-mode and U-mode (PTE.U=1 on the leaf for U-mode): set the leaf or non-leaf PTE under test to V=0 and run SFENCE.VMA. Load (lw) from va_data, which takes a load page fault. Store the PTE with V=1, wait, and load from va_data again.

First load: load page fault (scause = 13). Retried load: no fault; returns the word in the page.

load_page_fault x satp_mode x priv_mode_s_u
= 6 bins on RV64, 2 on RV32

Svvptc_explicit_stores_update_valid_bit

cp_store

Verify a store reaches a page after a plain store sets V in a PTE, without SFENCE.VMA (Svvptc)

S-mode and U-mode (PTE.U=1 on the leaf for U-mode): set the leaf or non-leaf PTE under test to V=0 and run SFENCE.VMA. Store (sw) to va_data, which takes a store/AMO page fault. Store the PTE with V=1, wait, store to va_data again and load the word back.

First store: store/AMO page fault (scause = 15). Retried store: no fault; the load returns the stored value.

store_page_fault x satp_mode x priv_mode_s_u
= 6 bins on RV64, 2 on RV32

Svvptc_explicit_stores_update_valid_bit

cp_fetch

Verify an instruction fetch reaches a page after a plain store sets V in a PTE, without SFENCE.VMA (Svvptc)

S-mode and U-mode (PTE.U=1 on the leaf for U-mode): set the leaf or non-leaf PTE under test to V=0 and run SFENCE.VMA. Jump (jalr) to va_data, which takes an instruction page fault; the handler returns to ra. Store the PTE with V=1, wait, and jump to va_data again. The code there writes a4 and returns.

First jump: instruction page fault (scause = 12). Retried jump: no fault; the code in the page runs and writes the result register.

fetch_page_fault x satp_mode x priv_mode_s_u
= 6 bins on RV64, 2 on RV32

Svvptc_explicit_stores_update_valid_bit

Table 265. Svvptc Normative Rules
Normative Rule Rule Text Coverpoints

Svvptc_explicit_stores_update_valid_bit

When the Svvptc extension is implemented, explicit stores by a hart that update the Valid bit of leaf and/or non-leaf PTEs from 0 to 1 and are visible to a hart will eventually become visible within a bounded timeframe to subsequent implicit accesses by that hart to such PTEs.

Svvptc_cg/cp_{load, store, fetch}

UDB Parameters: None.

B.7.9. Svukte User Kernel Translation Enable

Table 266. Svukte Coverpoints
Coverpoint Goal Feature Description Expectation Bins

General Test Environment (Svukte):
- Planned coverpoints; no Svukte generator or coverage file exists yet.
- The ISA manual normative-rule snapshot used by coverpoints/norm has no Svukte rules, so ID and Normative Rule are empty.

cp_svukte_qualified_exec_fault

Test qualified accesses from U-mode (instruction fetch)

While in U-mode, with senvcfg.UKTE=1 and any non-bare address translation mode (satp={SV39, SV48, SV57}) an access with vaddr >= (XLEN-1)^2 is Svukte-qualified.

Accesses should all cause the corresponding fault based on their access type

3 non-bare SATP modes (each)

cp_svukte_qualified_read_fault

Test qualified accesses from U-mode (load)

While in U-mode, with senvcfg.UKTE=1 and any non-bare address translation mode (satp={SV39, SV48, SV57}) an access with vaddr >= (XLEN-1)^2 is Svukte-qualified.

Accesses should all cause the corresponding fault based on their access type

3 non-bare SATP modes (each)

cp_svukte_qualified_write_fault

Test qualified accesses from U-mode (store)

While in U-mode, with senvcfg.UKTE=1 and any non-bare address translation mode (satp={SV39, SV48, SV57}) an access with vaddr >= (XLEN-1)^2 is Svukte-qualified.

Accesses should all cause the corresponding fault based on their access type

3 non-bare SATP modes (each)

cp_svukte_qualified_mprv_read_fault

Test accesses with effective U-mode from M-mode (load)

If MPRV=1 and MPP=U, accesses will have effective U-mode.
Thus, with senvcfg.UKTE=1 and any non-bare address translation mode (satp={SV39, SV48, SV57}), accesses with vaddr >= (XLEN-1)^2 will be Svukte-qualified.

3 non-bare SATP modes (each)

cp_svukte_qualified_mprv_write_fault

Test accesses with effective U-mode from M-mode (store)

If MPRV=1 and MPP=U, accesses will have effective U-mode.
Thus, with senvcfg.UKTE=1 and any non-bare address translation mode (satp={SV39, SV48, SV57}), accesses with vaddr >= (XLEN-1)^2 will be Svukte-qualified.

3 non-bare SATP modes (each)

cp_svukte_qualified_vu_exec_fault

Test accesses from VU-mode (instruction fetch)

While in VU-mode, with senvcfg.UKTE=1 and any non-bare address translation mode (satp={SV39, SV48, SV57}) an access with vaddr >= (XLEN-1)^2 is Svukte-qualified.

3 non-bare VSATP modes (each)

cp_svukte_qualified_vu_read_fault

Test accesses from VU-mode (load)

While in VU-mode, with senvcfg.UKTE=1 and any non-bare address translation mode (satp={SV39, SV48, SV57}) an access with vaddr >= (XLEN-1)^2 is Svukte-qualified.

3 non-bare VSATP modes (each)

cp_svukte_qualified_vu_write_fault

Test accesses from VU-mode (store)

While in VU-mode, with senvcfg.UKTE=1 and any non-bare address translation mode (satp={SV39, SV48, SV57}) an access with vaddr >= (XLEN-1)^2 is Svukte-qualified.

3 non-bare VSATP modes (each)

cp_svukte_qualified_hs_read_fault

Test accesses with effective VU-mode from HS-mode (load)

While in effective VU-mode, with senvcfg.UKTE=1 and any non-bare address translation mode (satp={SV39, SV48, SV57}) an access with vaddr >= (XLEN-1)^2 is Svukte-qualified.

3 non-bare VSATP modes (each)

cp_svukte_qualified_hs_write_fault

Test accesses with effective VU-mode from HS-mode (store)

While in effective VU-mode, with senvcfg.UKTE=1 and any non-bare address translation mode (satp={SV39, SV48, SV57}) an access with vaddr >= (XLEN-1)^2 is Svukte-qualified.

3 non-bare VSATP modes (each)

cp_svukte_qualified_hukte_read_fault

Test accesses virtual accesses from U-mode (load)

When an hlv, hlvx or hsv instruction is executed in U-mode (which is allowed if hstatus.HU=1), the access should be Svukte-qualified as if senvcfg.UKTE was set to the value of hstatus.HUKTE.

If hstatus.HUKTE=1, accesses should fail
If hstatus.HUKTE=0, accesses should not fail

3 non-bare VSATP modes (each) * 2 HUKTE values

cp_svukte_qualified_hukte_write_fault

Test accesses virtual accesses from U-mode (store)

When an hlv, hlvx or hsv instruction is executed in U-mode (which is allowed if hstatus.HU=1), the access should be Svukte-qualified as if senvcfg.UKTE was set to the value of hstatus.HUKTE.

If hstatus.HUKTE=1, accesses should fail
If hstatus.HUKTE=0, accesses should not fail

3 non-bare VSATP modes (each) * 2 HUKTE values

cp_svukte_unqualified_access

Test non-Svukte-qualified accesses

Accesses that do not have effective U-mode, are using Bare address translation, or the other qualifying criteria are not Svukte-qualified

Non-qualified accesses should succeed

B.8. H Hypervisor

The Hypervisor Extension adds an H coverage file containing new Hypervisor instructions, and additional coverage files related to exceptions, interrupts, endian, and virtual memory.

B.8.1. H Hypervisor CSRs and Instructions

H boots to HS-mode and tests the hypervisor CSRs and instructions in HS, VS, U and VU modes: CSR access and walks, the VS CSR replicas, the hypervisor load/store, fence and trap instructions, and the virtual-instruction exceptions. The M-mode tests, and the mstatus.TVM tests whose traps are taken in M-mode, are the Sm suite’s Sm_H group.

The H suite also contains the H_F, H_V, and H_VF tests. They repeat the S_F, S_V, and S_VF tests from VS-mode and VU-mode, and cross vsstatus.FS and vsstatus.VS with the HS-level sstatus.FS and sstatus.VS. They run when F, Zve32x, or Zve32f is also supported.

Definitions: Machine H-Extension CSRs: mtval2, mtinst HS H-Extension CSRs: hstatus, hedeleg, hideleg, hie, hcounteren, hgeie, henvcfg, htval, hip, hvip, htinst, hgatp, hgeip (+ htimedelta for Zicntr) (+ hedelegh, htimedeltah, henvcfgh for RV32) VS H-Extension CSRs: vsstatus, vsie, vstval, vsip, vstvec, vsscratch, vsepc, vscause, vsatp (+ vstimecmp for SSTC, vstimecmph with RV32) High-half H-extension CSRs (RV32 only; illegal on RV64): hedelegh, htimedeltah, henvcfgh, vstimecmph S CSRs with VS replicas: sstatus, sie, stvec, sscratch, sepc, scause, stval, sip, satp S CSRs without VS replicas: scounteren, senvcfg, scountinhibit The suite boots to HS-mode, and the HS-mode handler takes traps from U, VS and VU (hedeleg = 0). Tests that run in M-mode or need mstatus.TVM = 1 are in the Sm suite’s Sm_H group. Each trap record holds xstatus[17:0] with hstatus.GVA/SPV/SPVP (mstatus.GVA/MPV in M-mode), and, for an M-mode or HS-mode exception, mtval2/htval and mtinst/htinst.

Table 267. H Coverpoints
Coverpoint Goal Feature Description Expectation Bins Normative Rule Status Notes

Tests executed in HS-mode (H_hscsr_cg)

cp_hcsr_access
cp_hcsr_access_zero
cp_hcsr_access_masked
cp_hcsr_access_ro

All H-extension CSRs are able to read, write, set, and clear

Write all 1s and all 0s, then set all bits, then clear all bits, then read each {HS/VS} H-Extension CSR.
cp_hcsr_access_zero: htval, htinst, hgatp and vsatp need only hold zero, so their readback is checked only after writing 0 and after clearing every bit. Every bit of hedelegh (RV32, Priv 1.13) is reserved, so cp_hcsr_access and cp_hcsrwalk check that each reads zero, as for medelegh in Sm.
cp_hcsr_access_masked: hstatus and henvcfg (and henvcfgh on RV32) are written only with their checked fields, because the others are WLRL, WARL with reserved encodings, or change the endianness or XLEN.
cp_hcsr_access_ro: hgeip is read-only.
hedeleg bits 1-8, 12, 13 and 15 must be writable and 9-11, 16 and 20-23 read-only zero; bits 14 and 17 are not checked. With Priv 1.13, writing all 1s also checks that bits 18 and 19 are writable; without Zca (IALIGN = 32), that bit 0 is writable. hie.SGEIE is checked by InterruptsH, because it is writable only if GEILEN > 0.

All registers are accessible, and checked fields read back as written. Writes to hgeip raise illegal instruction.

5 * (14-17 + 9-11)

hedeleg_sz_acc
hedeleg_acc
hedeleg_bits_required
hedeleg_bit0_ialign32
hedeleg_img
hideleg_sz_acc
hideleg_acc
hideleg_img
hvip_sz_op
hvip_acc
hvip_img
hip_hie_sz_acc
hip_img
hie_img
hip_acc
hie_acc
hgeie_sz_acc_op
hgeie_img
geilen
hcounteren_sz
hcounteren_warl
htimedelta_sz_acc_op
hedelegh_sz_acc_op
htimedeltah_sz_acc_op
H_vscsrs_acc_m_hs
vsstatus_sz_acc_op
vsip_vsie_sz_acc_op
vsip_img
vsie_img
vstvec_sz_acc_op
vsscratch_sz_acc_op
vsepc_sz_acc_op
vstval_sz_acc_op
vstimecmp_sz
vstimecmp_acc
htval_sz_acc_op
htval_val
htinst_sz_acc_op
htinst_val
hgatp_sz_acc_op
vsatp_sz_acc_op
hstatus_sz_acc_op
henvcfg_sz_acc_op
henvcfgh_sz_acc_op
hgeip_sz_acc_op
vscause_sz_acc_op

cp_hcsrwalk
cp_hcsrwalk_masked

Exercise each bit of H-extension CSRs

Set and clear each bit of each {HS/VS} H-Extension CSR that holds more than zero. hstatus is walked over GVA, SPV, SPVP, HU, VTVM, VTW and VTSR, and henvcfg over FIOM, LPE, SSE, CBIE, CBCFE, CBZE, PMM, ADUE, PBMTE and STCE (cp_hcsrwalk_masked); hstatus.VGEIN is in cp_hstatus_vgein, and VSXL and UXL are out of scope. vsstatus is walked with the sstatus fields that S checks. The CSRs of cp_hcsr_access_zero are not walked, and hgatp and vsatp are walked by cp_atpwalk1/0. vsepc and vstval are not walked, because an invalid address may legally be converted; cp_vsepc_vaddr_* and cp_vstval_vaddr_* write them with valid addresses.

All registers are accessible. Some fields are WARL and will not change.

64 * 2 * (13-16 + 8-10)

hedeleg_sz_acc
hedeleg_acc
hedeleg_img
hideleg_sz_acc
hideleg_acc
hideleg_img
hvip_sz_op
hvip_acc
hvip_img
hip_hie_sz_acc
hip_img
hie_img
hip_acc
hie_acc
hgeie_sz_acc_op
hgeie_img
geilen
hcounteren_sz
hcounteren_warl
htimedelta_sz_acc_op
hedelegh_sz_acc_op
htimedeltah_sz_acc_op
vsstatus_sz_acc_op
vsip_vsie_sz_acc_op
vsip_img
vsie_img
vstvec_sz_acc_op
vsscratch_sz_acc_op
vstimecmp_sz
vstimecmp_acc
hstatus_sz_acc_op
henvcfg_sz_acc_op
henvcfgh_sz_acc_op
henvcfg_cbie
henvcfg_cbcfe
henvcfg_cbze

cp_atpwalk1
cp_atpwalk0

hgatp and vsatp hold each PPN, VMID and ASID bit

With MODE = Sv39x4/Sv39 (RV64) or Sv32x4/Sv32 (RV32), write hgatp and vsatp with a walking 1 and a walking 0 through every non-MODE bit. MODE = Bare with nonzero fields is UNSPECIFIED and unsupported MODEs are legalized in an implementation-defined way, so MODE is held at a paged mode.

Each bit reads back as written, except PPN bits at and above the physical address width, which are not checked, VMID and ASID bits above VMIDLEN and ASIDLEN, and hgatp.PPN[1:0], which may be read-only zero.

2 CSRs * (60 (RV64) or 31 (RV32)) each

hgatp_sz_acc_op
hgatp_mode_Sv
hgatp_ppn_op
hgatp_vmid
vsatp_sz_acc_op
vsatp_asidlen
hgatp_vmid_lsbs

cp_vsepc_vaddr_walk1
cp_vsepc_vaddr_walk0
cp_vsepc_vaddr_pc
cp_vsepc_vaddr_scratch
cp_vstval_vaddr_walk1
cp_vstval_vaddr_walk0
cp_vstval_vaddr_pc
cp_vstval_vaddr_scratch

vsepc and vstval hold every valid address

In HS-mode, csrrw vsepc and vstval with each canonical virtual address with a walking 1 (0s in the msbs) and a walking 0 (1s in the msbs) through bits 0 to VALEN-2 of the largest supported Sv mode, and with two physical addresses, the current pc and the scratch area. Only valid addresses are written, because an invalid address may legally be converted.

Each value reads back as written (vsepc bit 0 reads 0, and bit 1 reads 0 unless 2-byte instruction alignment is allowed).

walk1, walk0: 2 CSRs * (32 (Sv32), 38 (Sv39), 47 (Sv48) or 56 (Sv57)) each
pc, scratch: 2 CSRs * 1 each

vsepc_sz_acc_op
vsepc_warl
vstval_sz_acc_op
vstval_warl

cp_vstval_zero
cp_vstval_ilen_walk1
cp_vstval_ilen_ones

vstval holds 0 and every ILEN-bit value

In HS-mode, csrrw vstval with 0 and, when the illegal instruction encoding is reported in vstval (REPORT_ENCODING_IN_VSTVAL_ON_ILLEGAL_INSTRUCTION), with a walking 1 through bits 0 to 31 and with all 32 bits set, as cp_stval_zero, cp_stval_ilen_walk1 and cp_stval_ilen_ones in S.

Each value reads back as written

1 + 32 + 1

vstval_warl

cp_replica

In HS, writing to S/VS-mode CSRs doesn’t affect replica

In HS-mode, write different random values into S-mode CSRs and their VS-mode replicas (satp and vsatp only when vsatp supports Sv39 (RV64) or Sv32 (RV32); satp always does), read both, write new random values, and read both back.

Each CSR should have value written.

9

vsstatus_sz_acc_op
vsip_vsie_sz_acc_op
vstvec_sz_acc_op
vsscratch_sz_acc_op
vsepc_sz_acc_op
vstval_sz_acc_op
vsatp_sz_acc_op
vscause_sz_acc_op
H_vscsrs_v0
vsstatus_v0
H_vscsrs_sub
H_vscsrs_v1

cp_hstatus_vgein

VGEIN can hold values between 0 and GEILEN

Write {0, 1, GEILEN-1, GEILEN} to hstatus.VGEIN; only 0 when GEILEN = 0. Larger values are WLRL, so they are not written.

Each value reads back as written

4 (1 with GEILEN = 0)

hstatus_vgein_wlrl

Tests executed in HS-mode (H_vscause_cg)

cp_vscause_write_exception
cp_vscause_write_interrupt

vscause WLRL fields writable

Write each exception code 0-31 with interrupt = 0 and each interrupt code 0-31 with interrupt = 1, and read back.
Without Priv 1.12, only the codes that are defined in Priv 1.11. Codes 32 and up are reserved or custom, so they are WLRL values that need not be held.

Each value reads back as written

32 exceptions + 32 interrupts (13 + 6 before Priv 1.12)

vscause_sz_acc_op
vscause_wlrl

Tests executed in VS-mode (H_vscsr_cg)

cp_csr_insufficient_priv

M-mode CSRs are inaccessible from VS-mode

In VS-mode, attempt to read each CSR number in the M-mode ranges (0x300-0x3FF, 0x700-0x7FF except 0x7AA mscontext, 0xB00-0xBFF, 0xF00-0xFFF) with a nonzero rd, as S_scsr_cg/cp_csr_insufficient_priv in S-mode

Illegal instruction fault, and rd is unchanged

1023 CSRs

hedelegh_sz_acc_op
henvcfgh_sz_acc_op
htimedeltah_sz_acc_op
H_vscsrs_acc_m_hs
mtval2_sz_acc_op
mtinst_sz_acc_op
Zicsr_high_half_rv64_rsv
H_virtinst_vu_vs_nonhigh_allowedhs_tvm0
H_virtinst_vu_nonhigh_supervisor_allowedhs_tvm0
H_cause_virtual_instruction_high
Zicsr_illegal_mode

cp_csr_ro

Read-only CSRs cannot be written from VS-mode

In VS-mode, attempt to write all 1s to each CSR number from 0xC00 to 0xEFF, as S_scsr_cg/cp_csr_ro in S-mode

Illegal instruction fault, and rd is unchanged

768 CSRs

cp_hcsr_virtualinstructionfault

HS and VS registers cause virtual instruction fault from VS-mode

csrrw, csrrc, csrrs, csrr each {HS/VS} H-Extension CSR

Virtual instruction fault, or illegal instruction for an access that HS-mode could not perform (a write to hgeip)

5 * (14-17 + 9-11)

H_vscsrs_acc_m_hs
H_csrs_hs_not_vs
H_vscsrs_acc_vs
H_cause_virtual_instruction
H_virtinst_vu_vs_nonhigh_allowedhs_tvm0
H_cause_virtual_instruction_high

cp_illegalupper

In RV64, h half of CSRs are illegal.

RV64 ONLY: csrrw, csrrs, csrrc, csrr each h H-extension CSR

Illegal instruction fault

5 * 4

hedelegh_sz_acc_op
henvcfgh_sz_acc_op
htimedeltah_sz_acc_op
Zicsr_high_half_rv64_rsv

"When XLEN>32, an attempt to access a high-half CSR always raises an illegal-instruction exception."
The other high-half addresses are accessed by SsstrictSm.

cp_replica

In VS, writing to S-mode CSRs affects replica instead

In HS-mode, write different random values into S-mode CSRs and their VS-mode replicas. Switch to VS-mode and write and readback S CSRs. Switch back to HS-mode and read back both the S-mode CSRs and VS replicas. The return to HS-mode is a trap, which needs stvec and sscratch and rewrites sepc, scause and stval, so those S CSRs are left alone and only their replicas are checked. satp and vsatp stay Bare, because the test code is not mapped.

VS replica should have changed but S CSR does not change.

9

vsstatus_sz_acc_op
vsip_vsie_sz_acc_op
vstvec_sz_acc_op
vsscratch_sz_acc_op
vsepc_sz_acc_op
vstval_sz_acc_op
vsatp_sz_acc_op
vscause_sz_acc_op
H_vscsrs_v0
vsstatus_v0
H_vscsrs_sub
H_vscsrs_v1

cp_nonreplica

In VS, accessing nonreplicated S-mode CSRs behaves normally

csrrw, csrrc, csrrs, csrr each S CSR without VS replica (scounteren, senvcfg). scountinhibit is in cp_scountinhibit_vs.

Normal access

5 * 2

H_scsrs_nomatch

cp_scountinhibit_vs

In VS, scountinhibit access depends on menvcfg.CDE

If Ssccfg is supported: csrrw, csrrc, csrrs, csrr scountinhibit in VS-mode with menvcfg.CDE = {0/1}. The test currently runs only CDE = 0 (the boot value), because Sail does not implement menvcfg.CDE.

Illegal instruction fault if CDE = 0, virtual instruction fault if CDE = 1

5 * 2 CDE

Tests executed in VS-mode (H_vsstatus_cg)

cp_vsstatus_sd_write

vsstatus.SD affected by vsstatus.FS/XS/VS

In VS-mode, write sstatus (which accesses vsstatus) with the cross-product of SD, FS, XS and VS.

vsstatus.SD = 1 if FS, XS or VS is nonzero

2 * 4 * 4 * 4

vsstatus_sd_xs_op

Tests executed in VU-mode (H_vucsr_cg)

cp_csr_insufficient_priv

CSRs other than user CSRs are inaccessible from VU-mode

In VU-mode, attempt to read each CSR number that is not a user CSR (0x100-0x3FF, 0x500-0x7FF except 0x7AA mscontext, which may be accessible from S-mode, 0x900-0xBFF, 0xD00-0xFFF) with a nonzero rd, as U_ucsr_cg/cp_csr_insufficient_priv in U-mode. U-mode accesses are covered by the U suite.

Virtual instruction fault for an implemented supervisor, hypervisor or VS CSR whose access HS-mode could perform; otherwise illegal instruction fault. rd is unchanged

3071 CSRs

hedelegh_sz_acc_op
henvcfgh_sz_acc_op
htimedeltah_sz_acc_op
H_vscsrs_acc_m_hs
mtval2_sz_acc_op
mtinst_sz_acc_op
Zicsr_high_half_rv64_rsv
H_virtinst_vu_vs_nonhigh_allowedhs_tvm0
H_virtinst_vu_nonhigh_supervisor_allowedhs_tvm0
H_cause_virtual_instruction_high
H_vscsrs_acc_vs
Zicsr_illegal_mode

cp_csr_ro

User read-only CSRs cannot be written from VU-mode

In VU-mode, attempt to write all 1s to each CSR number from 0xC00 to 0xCFF, as U_ucsr_cg/cp_csr_ro in U-mode

Illegal instruction fault, and rd is unchanged

256 CSRs

Instructions (H_inst_cg)

cp_hlv

Basic load

Set up non-identity G and VS-stage page tables (Sv39x4 and Sv39, or Sv32x4 and Sv32). With hstatus.HU = 1, in {HS, U}: Write a value with the sign bit of every access size set to scratch. hlv.b, hlv.bu, hlv.h, hlv.hu, hlv.w from scratch. For rv64, also test hlv.wu, hlv.d. Random source and destination registers.

Read and sign/zero extend

2 modes * 5 instr (7 on RV64)

hlsv_mode
hlsv_op
hstatus_hu_op
hlvx-wu_valid32

cp_hlvx

Basic load

Set up non-identity G and VS-stage page tables. With hstatus.HU = 1, in {HS, U}: Write a value to scratch. hlvx.hu, hlvx.wu from scratch. Random source and destination registers.

Read and sign/zero extend

2 modes * 2 instr

hlsv_mode
hlsv_op
hstatus_hu_op
hlvx-wu_valid32

cp_hsv

Basic store

Set up non-identity G and VS-stage page tables. With hstatus.HU = 1, in {HS, U}: hsv.b, hsv.h, hsv.w to scratch, and read scratch through its physical address. For rv64, also test hsv.d. Random source and destination registers.

Stores the low bytes of the source register

2 modes * 3 instr (4 on RV64)

hlsv_mode
hlsv_op
hstatus_hu_op
hlvx-wu_valid32

cp_guest_page_fault

hlv and hsv guest-page faults record htval and htinst

In HS-mode with an empty G-stage root table, hlv.w and hsv.w with vsatp = Bare (a fault on the final translation) and with the VS-stage root table at an unmapped guest physical address (a fault on an implicit VS-stage access).

Load or store guest-page fault into HS-mode. htval holds zero or the guest physical address >> 2. htinst holds zero or the transformed instruction on the final translation, and the pseudoinstruction on the implicit access when htval is nonzero.

2 instr * 2 vsatp

htval_sz_acc_op
htinst_sz_acc_op
H_guest_page_fault
H_trap_xtinst
H_trap_xtinst_exception_lead_in
H_trap_xtinst_exception_list
H_trap_xtinst_val
H_trap_xtinst_guestpage

cp_mret_illegal

mret unavailable below M mode

Execute mret in {HS, VS, VU} modes.

Illegal instruction

3 modes

xret_in_lower_mode

cp_sret_illegal

sret unavailable in VU mode

Execute sret in VU mode.

Virtual instruction

1 mode

H_virtinst_vu_sret_sfence

cp_hfence

Hypervisor fences execute only in HS-mode (and M-mode)

With mstatus.TVM = 0 and hstatus.VTVM = 0, execute hfence.vvma and hfence.gvma (rs1 = rs2 = x0) in {HS, VS, VU, U} modes, as S_sprivinst_cg executes sfence.vma. Sm_H_tvm_cg/cp_hfence crosses them with M-mode, mstatus.TVM and hstatus.VTVM, and Sv_H_fence_cg checks that they remove stale VS-stage and G-stage translations.

Executes in HS-mode; virtual instruction in VS-mode and VU-mode; illegal instruction in U-mode

4 modes * 2 instr

hfence-vvma_hfence-gvma_op
hfence-vvma_mode
hfence-gvma_op
hfence-vvma_hfence-gvma_exceptions

cp_vtvm_sfence
cp_vtvm_satp
cp_vtvm_hfence_vvma

hstatus.VTVM traps VS-mode sfence.vma and satp accesses, but not hfence.vvma

With hstatus.VTVM = {0, 1}, execute hfence.vvma in HS-mode, and sfence.vma, csrr satp and csrw satp (writing zero, so vsatp stays Bare) in VS-mode. sinval.vma is in Svinval, and mstatus.TVM, which needs M-mode, in Sm_H.

With VTVM = 1, the VS-mode instructions raise virtual instruction; otherwise they execute. hfence.vvma executes with either VTVM.

cp_vtvm_sfence: 2 VTVM
cp_vtvm_satp: 2 accesses * 2 VTVM
cp_vtvm_hfence_vvma: 2 VTVM

hstatus_vtvm_op
H_virtinst_vs_sfence_sinval_satp_vtvm1
hfence-vvma_tvm

cp_sret_hs

sret from HS mode

Execute sret in HS-mode with cross-product of sstatus.SPP / SPIE / hstatus.SPV. After the sret, a read of mscratch traps to HS-mode, and the trap record shows the mode reached. Then check sstatus.SPP, SIE, SPIE and hstatus.SPV in HS-mode; the trap and the return to HS-mode rewrite them from the mode and SIE that the sret produced.

Goes to appropriate mode

2 SPP * 2 SPIE * 2 SPV

sret_v0
hstatus_spv_sret

cp_sret_vs

sret from VS mode

Execute sret in VS-mode with cross-product of sstatus.SPP / SPIE / hstatus.VTSR. After the sret, a read of mscratch traps and the trap record shows the mode reached. Then check sstatus.SPP, SIE, SPIE in VS-mode.

Goes to appropriate mode, or virtual-instruction exception if VTSR=1.

2 SPP * 2 SPIE * 2 VTSR

sret_v1
hstatus_vtsr_op
H_virtinst_vs_sret_vtsr1

H_F tests (H_F-NN.S): the floating-point CSRs and vsstatus.FS from VS-mode and VU-mode, run when F is also supported.

cp_fcsr_access

Writing to the CSR field
(WARL)

Write 0s and 1s to fcsr, frm, fflags cross with vsstatus.FS init/clean/dirty

Zicsr_higher_priv
mstatus_fs_vs_xs_off_op
mstatus_fs_vs_xs_dirty_op

cp_vsstatus_FS_transition

Writing to the CSR field
(WARL)

Each different type of floating-point instruction crossed with four values of FS. Includes integer-result instructions that raise a flag after fflags is cleared (feq.s with a signaling NaN, fcvt.w.s of an inexact value, fcvt.wu.s of an out-of-range value, fcvtmod.w.d of a NaN).

mstatus_fs_op
mstatus_fs_vs_xs_enc
mstatus_fs_acc1
mstatus_sd_summary_op
mstatus_sd_formula
mstatus_fs_vs_xs_off_op
mstatus_fs_vs_xs_dirty_op
mstatus_fs_no_dirty_track
mstatus_fs_vs_xs_update_indep_priv
check FS becomes dirty where appropriate
instructions that set fflags must set FS to dirty even if they write no floating-point register

cp_vsstatus_FS_transition_nondeterministic

Writing to the CSR field
(WARL)

Floating-point instructions that need not modify floating-point state (fsw, fmv.x.w, fclass.s, csrr of the FP CSRs, fmvh.x.d) crossed with vsstatus.FS = Off and Dirty

Illegal-instruction trap when FS = Off; FS stays Dirty when Dirty. Initial and Clean are omitted because these instructions may dirty FS imprecisely.

mstatus_fs_imprecise

H_V tests (H_V_vcsr-NN.S, H_V_vset-NN.S, H_V_vl_walk-NN.S): the vector CSRs, vset{i}vl{i}, vstart and vsstatus.VS from VS-mode and VU-mode, run when Zve32x is also supported.

cp_vcsrrswc

Confirm that all vector CSR properties are properly set with regards to read write, clear, and set privileges with the csr instructions

With each of the vector CSRs conduct a read, write, clear, and set operation on the CSR

Will abide by spec’s read and write permissions for each csr

3 csr instructions * 7 CSRs

Zicsr_higher_priv
vlenb_acc_op
vcsr_vxrm_op
vcsr_vxsat_op
vcsr_vxrm_vxsat_acc
Zve32x_dependent_Zicsr

test written: yes
spec: The vector extension adds 32 vector registers, and seven unprivileged CSRs (vstart, vxsat, vxrm, vcsr, vtype, vl, vlenb) to a base scalar RISC-V ISA.
read-only CSR vlenb
The XLEN-bit-wide read-only vl CSR can only be updated by the vset{i}vl{i} instructions, and the fault-only-first vector load instruction variants.
read-only XLEN-wide vector type CSR, vtype provides the default type used to interpret the contents of the vector register file, and can only be updated by vset{i}vl{i}

cp_vcsrs_walking1s

Confirm that that all writable vector CSRs have the correct bits writeable

With each of the vector CSRs that are writable, write all XLEN 1-hot values to the csr

csrs will be updated based on which bits they support to be writable

4 CSRs * XLEN 1-hot values

mstatus_vs_op
vstart_acc_sz
vxrm_val_sz_acc
vxsat_op_acc_sz

test written: yes
spec: vstart, vxrm, vxsat, vcsr are all writable

cp_vsstatus_vs_set_dirty_arithmetic

Confirm that after running an arithmetic vector instruction that vsstatus.VS is set to dirty when set to "clean" or "initial"

Run a .vv vector arithmetic instruction with vsstatus.VS = {clean, initial}

vsstatus.VS is set to dirty

2 vsstatus.VS bins

mstatus_vs_sstatus_vs_op
mstatus_fs_vs_xs_update_indep_priv
mstatus_vs_op_initial_clean

test written: yes
spec: When mstatus.VS is set to Initial or Clean, executing any instruction that changes vector state, including the vector CSRs, will change mstatus.VS to Dirty.

cp_vsstatus_vs_set_dirty_csr

Confirm that after running a vsetvli instruction that vsstatus.VS is set to dirty when set to "clean" or "initial"

Run a vsetvli instruction with vsstatus.VS = {clean, initial}

vsstatus.VS is set to dirty

2 vsstatus.VS bins

mstatus_vs_op
mstatus_vs_op_initial_clean

test written: yes
spec: When mstatus.VS is set to Initial or Clean, executing any instruction that changes vector state, including the vector CSRs, will change mstatus.VS to Dirty.

Analogous to the way in which the floating-point unit is handled, the vsstatus.VS field may exist even if misa.V is clear.

feature (coverpoint written): Untestable

cp_vsstatus_vs_off_arithmetic

Confirm that when misa.V is 1 and vsstatus.VS is off, an arithmetic vector instruction raises an illegal instruction exception

With misa.V = 1 (its reset value), set vsstatus.VS = {00} and run a .vv vector instruction

illegal instruction exception

1

mstatus_vs_sstatus_vs_op
mstatus_fs_vs_xs_off_op
mstatus_vs_op_off

test written: yes, confirm sig
spec: Attempts to execute any vector instruction, or to access the vector CSRs, raise an illegal-instruction exception when mstatus.VS is set to Off.

cp_vsstatus_vs_off_csr

Confirm that when misa.V is 1 and vsstatus.VS is off, an csr vector instruction raises an illegal instruction exception

With misa.V = 1 (its reset value), set vsstatus.VS = {00} and run a vsetvli

illegal instruction exception

1

mstatus_fs_vs_xs_off_op

test written: yes, confirm sig
spec: Attempts to execute any vector instruction, or to access the vector CSRs, raise an illegal-instruction exception when mstatus.VS is set to Off.

For implementations with a writable misa.V field, the vsstatus.VS field may exist even if misa.V is clear.

feature (coverpoint written): Untestable

Vset{i}vl{i}

cp_sew_lmul_vset_i_vli

Confirm that all combinations of lmul crossed with sew correctly set the vtype register in accordance with the vill field

Use all vset{i}vli instructions to cross eSEW={8/16/32/64} with mLMUL = {f8/f4/f2/1/2/4/8} rd and uimm can be any nonzero value

vtype.vill becomes 1 and other bits become 0 on illegal combinations, such as sew = 1xx.

2 instructions * 7 lmul bins * 4 sew bins

vtype_sz_acc_op
vtype_vsew_op
vtype_lmul_val
vtype_lmul_fval
vtype_sew_val
vset_op
vtype_vstart_op
vtype_acc

test written: yes
spec: Implementations must consider all bits of the vtype value to determine if the configuration is supported. An unsupported value in any location within the vtype value must result in vill being set. In particular, all XLEN bits of the register vtype argument to the vsetvl instruction must be checked. Implementations cannot ignore fields they do not implement. All bits must be checked to ensure that new code assuming unsupported vector features in vtype traps instead of executing incorrectly on an older implementation…​.The supported element width may vary with LMUL
The use of vtype encodings with LMUL < SEWMIN/ELEN is reserved, but implementations can set vill if they do not support these configurations.

cp_sew_lmul_vsetvl

Confirm that all combinations of lmul crossed with sew correctly set the type register in accordance with the vill field

Use vsetvl to cross rs2.sew= [3’b000:3’b011] with rs2.lmul = [000, 001, 010, 011, 101, 110, 111]. rd and uimm can be any nonzero value. Make sure rs2_val[`XLEN-1:8] = 0
rs2 must be this way to be a legal setting

vtype.vill becomes 1 and other bits become 0 on illegal combinations, such as sew = 1xx.

7 lmul bins * 4 sew bins

vtype_sz_acc_op
vtype_fields_sz
vset_op
vtype_vstart_op
vtype_acc

test written: yes
spec: Implementations must consider all bits of the vtype value to determine if the configuration is supported. An unsupported value in any location within the vtype value must result in vill being set. In particular, all XLEN bits of the register vtype argument to the vsetvl instruction must be checked. Implementations cannot ignore fields they do not implement. All bits must be checked to ensure that new code assuming unsupported vector features in vtype traps instead of executing incorrectly on an older implementation…​.The supported element width may vary with LMUL
The use of vtype encodings with LMUL < SEWMIN/ELEN is reserved, but implementations can set vill if they do not support these configurations.

cp_sew_lmul_vset_i_vli / cp_sew_lmul_vsetvl

Confirm on the supported values of lmul are recognized as legal

Use vsetivli rd, 1, sew={supported}, vlmul={supported(mf8/mf4/mf2/)m1/m2/m4/m8}, tu, mu to attempt to set all values of lmul

Expect vill is set for all values of lmul that aren’t legal, otherwise the correct lmul is set

0

feature (coverpoint written): Covered by coverpoint above
spec: Implementations must support LMUL integer values of 1, 2, 4, and 8…​.Implementations must provide fractional LMUL settings that allow the narrowest supported type to occupy a fraction of a vector register corresponding to the ratio of the narrowest supported type’s width to that of the largest supported type’s width

cp_sew_lmul_vset_i_vli / cp_sew_lmul_vsetvl

Check all values of sew to Confirm only correctly supported values are recognized as legal

Use vsetivli rd, 1, sew={e8/e16/e32/e64}, vlmul={m1}, tu, mu to attempt to set all values of lmul

Expect vill will be set when an attempted unsupported sew values are attempted to be written, otherwise vtype will contain supported sew

0

feature (coverpoint written): Covered by coverpoint above
spec: Implementations must support LMUL integer values of 1, 2, 4, and 8…​.Implementations must provide fractional LMUL settings that allow the narrowest supported type to occupy a fraction of a vector register corresponding to the ratio of the narrowest supported type’s width to that of the largest supported type’s width

cp_vill_vset_i_vli

Check that vset{i}vli instructions properly clear the vill bit when writing a valid vtype configuration

Run vsetvli and vsetivli with eSEW = {8/16/32/64} with mLMUL = {8} and vtype.vill = {1}
we set lmul to 8 to write a non-zero value to the CSR

expect vill bit is cleared and vtype written when sew is legal

2 instructions * 4 sew bins

test written: yes
spec: If the vill bit is set, then any attempt to execute a vector instruction that depends upon vtype will raise an illegal-instruction exception [except]…​.vset{i}vl{i} …​. [does] not depend upon vtype

cp_vill_vsetvl

Check that vsetvl instruction properly clears the vill bit when writing a valid vtype configuration

Run vsetvl with rs2.sew = {8/16/32/64} with rs2.lmul = {8} and vtype.vill = {1} making sure rs2_val[`XLEN-1:8] = 0
we set lmul to 8 to write a non-zero value to the CSR. rs2 must be in this manner to be a legal setting

expect vill bit is cleared and vtype written when sew is legal

4 sew bins

vtype_vill_val
vtype_vill_val_vill
vtype_vill_all_bits

test written: yes
spec: If the vill bit is set, then any attempt to execute a vector instruction that depends upon vtype will raise an illegal-instruction exception [except]…​.vset{i}vl{i} …​. [does] not depend upon vtype

cp_vill_vsetvl_rs2_vill

Check that when attempting to set a valid configuration but with the rs2.vill bit set, and the vtype.vill bit set, that the register remains all zeros besides the vill bit

Run vsetvl with rs2.sew = {8/16/32/64} with vtype.lmul = {8} and vtype.vill = {1} making sure rs2_val[`XLEN-2:8] = 0 and rs2[XLEN-1] = 1
we set lmul to 8 to attempt to write a non-zero value to the CSR. rs2 must be in this manner to be a legal setting.

vtype register remains unchanged

4 sew bins

test written: yes
spec: If the vill bit is set, then any attempt to execute a vector instruction that depends upon vtype will raise an illegal-instruction exception [except]…​.vset{i}vl{i} …​. [does] not depend upon vtype

cp_vsetvl_rs2_vill

Confirm that with vsetvl if rs2 has the vill bit set that it is treated as an unsupported configuration

run a vsetvl with rs2[XLEN-1] = 1, rs2[XLEN-2:8]=0 and rs2.sew = {supported} and rs2.lmul = 1 and vtype.vill = {0}
sew must be supported and rs2[XLEN-2:8] zero to verify the configuration is illegal due to the vill bit being set

vill bit should be set

spec: A vtype value with vill set is treated as an unsupported configuration.

cp_vset_vill

Confirm that writing 1 to vill clears other bits of vtype

Set rs1 nonzero, rs1 = 1 in XLEN-1, 11 in 7:6 (vma/vta). vsetvl rd, rs1, rs2 and vtype.vill = {0}

vtype.vill becomes 1 and other bits become 0

1

feature (coverpoint written): covered by coverpoint above
spec: When the vill bit is set, the other XLEN-1 bits in vtype shall be zero.

cp_vtype_vill_set_vl_0

Confirm that if an unsupported configuration is set, that vl is set to zero

Run vsetvl with rs1 non-zero and rs2 vill bit set and vl =! 0

vl should be set to zero

1

vtype_lmul_fval_rsv
vtype_vstart_op

test written: yes
spec: If the vtype value is not supported by the implementation, then the vill bit is set in vtype, the remaining bits in vtype are set to zero, and the vl register is also set to zero.

cp_vsetvl_i_rd_nx0_rs1_x0

Confirm that when running a vsetvl or vsetvli instruction with rd != x0 and rs1 = x0 that vl is set to vlmax

with vl != vlmax, conduct vsetvl and vsetvli with rd != x0 and rs1 = x0. Cross with sew = {8/16/32/64} and respective supported lmul {supported(f8,f4,f2,)1,2,4,8}
we want vl != vlmax since similar syntax leaves vl unmodified.

vl csr is set to vlmax

2 instructions * 4 sew bins * 7 lmul bins

vl_acc
vsetvl_op
vsetvl_op_rs1_x0_rd_nx0

test written: yes
spec: When rs1=x0 but rd≠x0, the maximum unsigned integer value (~0) is used as the AVL, and the resulting VLMAX is written to vl and also to the x register specified by rd.

cp_vsetvl_i_rd_x0_rs1_x0

Confirm that when running a vsetvl or vsetvli instruction with rd = x0 and rs1 = x0 that vl is unchanged

with vl != 0, conduct vsetvl and vsetvli with rd = x0 and rs1 = x0. sew and lmul must be such that vlmax does not change
vlmax must not change for the instruction to not be reserved.

vl is unchanged

2

vsetvl_op
vsetvl_op_rs1_x0_rd_x0

test written: yes
spec: When rs1=x0 and rd=x0, the instruction operates as if the current vector length in vl is used as the AVL, and the resulting value is written to vl, but not to a destination register. This form can only be used when VLMAX and hence vl is not actually changed by the new SEW/LMUL ratio.

AVL

cp_vsetvl_i_avl_eq_zero

Confirm that vsetvl{i} instructions follow vl requirements when avl is zero

Run vsetvli and vsetvl with rs1 = 0

vl = 0

1

vsetvl_op
vl_val_lead_in
vl_val_list

test written: yes
spec: The vset{i}vl{i} instructions first set VLMAX according to their vtype argument, then set vl obeying the following constraints:
These specific properties follow from the prior rules: vl = 0 if AVL = 0

cp_vsetvl_i_avl_eq_vlmax

Confirm that vsetvl{i} instructions follow avl requirements when equal to vlmax

Run vsetvli and vsetvl with rs1 = vlmax

vl = avl

1

vset_op
vsetvl_op
vl_val_lead_in
vl_val_list

test written: yes
spec: The vset{i}vl{i} instructions first set VLMAX according to their vtype argument, then set vl obeying the following constraints:
vl = AVL if AVL ≤ VLMAX

cp_vsetvl_i_avl_lt_2x_vlmax

Confirm that vsetvl{i} instructions follow avl requirements when greater than vlmax and less than equal to 2*vlmax (if avl is less than 2* vlmax)

Run vsetvli and vsetvl with vlmax < rs1 < 2 *vlmax

ceil(AVL / 2) ≤ vl ≤ VLMAX

1

vsetvl_op
vl_val_lead_in
vl_val_list

test written: yes, is a chance that sig don’t match
spec: The vset{i}vl{i} instructions first set VLMAX according to their vtype argument, then set vl obeying the following constraints:
ceil(AVL / 2) ≤ vl ≤ VLMAX if AVL < (2 * VLMAX)

cp_vsetvl_i_avl_eq_2x_vlmax

Confirm that vsetvl{i} instructions follow avl requirements when greater than 2 * vlmax (when avl is greater than equal to 2 * vlmax)

Run vsetvli and vsetvl with rs1 ≥ 2 *vlmax

vl = VLMAX

1

vsetvl_op

test written: yes
spec: The vset{i}vl{i} instructions first set VLMAX according to their vtype argument, then set vl obeying the following constraints:
vl = VLMAX if AVL ≥ (2 * VLMAX)

cp_vsetvl_i_avl_gt_2x_vlmax

Confirm that vsetvl{i} instructions follow avl requirements when greater than 2 * vlmax (when avl is greater than equal to 2 * vlmax)

Run vsetvli and vsetvl with rs1 ≥ 2 *vlmax

vl = VLMAX

1

vsetvl_op
vl_val_lead_in
vl_val_list

test written: yes
spec: The vset{i}vl{i} instructions first set VLMAX according to their vtype argument, then set vl obeying the following constraints:
vl = VLMAX if AVL ≥ (2 * VLMAX)

cp_vsetivli_avl_edges

Confirm that vsetivli abides by the avl corners

Run vsetivli with all values of imm = {[0:31]} with sew = {all_supported} and lmul = 1

Abides by avl rules depending on

4 sew bins * 32 imm bins

vset_op
vsetivli_op

test written: yes
spec: The vset{i}vl{i} instructions first set VLMAX according to their vtype argument, then set vl obeying the following constraints:

vstart

cp_vstart_out_of_bounds

Confirm that the vstart CSR only has enough writeable bits to hold the largest element index (2^16-1)

conduct a csr write with rs1 = 2^16 on the vstart register

Not defined in spec, either vstart takes the bottom bits or sets to vlmax-1

1

vstart_acc_sz
vstart_sz_writable

test written: yes
spec: The vstart CSR is defined to have only enough writable bits to hold the largest element index (one less than the maximum VLMAX). Try to write a number greater than what is legal

cp_sew_illegal

Cannot set SEW < 8, all set SEW must be powers of 2 (can accomplish this by looping and setting sew of 2x until vill bit is set and then confirm that vill bit is set whenever setting a non power of 2 sew in that range)

feature (coverpoint written): can’t be tested

cp_vl_walking1s_sew_lmul

Confirm that all vl CSR bit fields are correctly set for all combinations of sew and lmul (thus all VLMAX)

Running the vsetvli instruction, cross all sew = {8/16/32/64} lmul = {f8, f4,f2, 1, 2, 4, 8} with rs1 ={XLEN 1-hot values}
This is done by conducting a vsetivli every time followed by a walking one csr write to ensure the target sew and lmul were attempted to be written

vl register will be set in accordance with vlmax

4sew * 7 lmul * XLEN 1-hot values

cp_vlen_illegal

Cannot set VLEN greater than 2^16, can check vl with eew = 8

vsetvli rs1={0, 1, 2, 3, 4, 7, 8, 9, 16, 32, 64…​ 2^16}
corners: (rs1 - 1)

feature (coverpoint written): covered by csr writing tests

The vector extension must have a consistent state at reset. In particular, vtype and vl must have values that can be read and then restored with a single vsetvl instruction. (make sure reset is called)

feature (coverpoint written): untestable

H_VF tests (H_VF-NN.S): vector floating-point instructions and vsstatus.FS from VS-mode and VU-mode, run when Zve32f is also supported.

It should be understood that for most coverpoints that are based on arithmetic instructions, the coverpoints will check to make sure they’re non-trivial, meaning that vl != 0, vstart=0, vill=0, and they do not trap. It may be useful to know that when using vsetvl{i} instructions if rd != x0 and rs1 = x0, vl = vlmax

cp_vectorfp_vsstatus_fs_state_affecting_register

Confirm vector floating point instructions set vsstatus.FS to dirty when modifying floating point register state

Set vsstatus.FS = {initial/clean} and run a fd writing instruction

vsstatus.FS is set to dirty

1

mstatus_fs_dirty_V_fp

spec: Any vector floating-point instruction that modifies any floating-point extension state (i.e., floating-point CSRs or f registers) must set mstatus.FS to Dirty.

cp_vectorfp_vsstatus_fs_state_affecting_csr

Confirm vector floating point instructions set vsstatus.FS to dirty when modifying floating point csr state

Set vsstatus.FS = {initial/clean} and run an instruction that would raise a fp flag after clearing the fp flags (vfdiv.vv divide by zero, vfadd.vv inf + -inf, and vmflt.vv with a NaN operand, which writes only a mask register)

vsstatus.FS is set to dirty

1

spec: Any vector floating-point instruction that modifies any floating-point extension state (i.e., floating-point CSRs or f registers) must set mstatus.FS to Dirty.

cp_vectorfp_vsstatus_fs_state_nonaffecting

Confirm vector floating point instructions properly set vsstatus.FS when not modifying floating point state

Set vsstatus.FS = {initial/clean} and run a vector fp instruction that does not affect floating point state (chosen situation for coverpoint is a .vv ins where vs1 = vs2 = 0)

vsstatus.FS may be set to dirty or not depending on implementation

1

spec: Any vector floating-point instruction that modifies any floating-point extension state (i.e., floating-point CSRs or f registers) must set mstatus.FS to Dirty.

cp_vectorfp_vsstatus_fs_off

Confirm that vector floating point instructions (even if they dont modify fp state) raise an illegal instruction exception if vsstatus.FS is set to off

Set vsstatus.FS = {off} and run a vector fp instruction that does not affect floating point state (chosen situation for coverpoint is a .vv ins where vs1 = vs2 = 0)

illegal instruction exception

1

spec: If the floating-point unit status field mstatus.FS is Off then any attempt to execute a vector floating-point instruction will raise an illegal instruction exception.

Not tested

hstatus.VSBE sets the endianness of VS-mode accesses

hstatus_vsbe_warl
hstatus_vsbe_op
hstatus_vsbe_implicit
hstatus_vsbe_acc
vsstatus_ube

Not tested

Sail is little-endian only, every H config declares little-endian VS-mode and VU-mode, and the trap handler would need big-endian support.

henvcfg.FIOM orders main memory with device I/O for V = 1

henvcfg_fiom_op
henvcfg_fiom_order

Not tested

Ordering is not observable in single-hart signature tests. cp_hcsrwalk_masked checks that FIOM is writable.

Implementation choices that a test cannot distinguish

hgatp_ppn_acc
hstatus_vgein_acc

Not tested

hgatp.PPN[1:0] may be read-only zero or writable, and no UDB parameter records the choice. With GEILEN = 0 the only legal VGEIN value is 0, so a read-only-zero VGEIN cannot be distinguished from a writable one.

henvcfg.SSE and henvcfg.DTE control Zicfiss and Ssdbltrp in VS-mode

henvcfg_sse_op
henvcfg_dte_op
vsstatus_sdt_op
sret_dt

Not tested

These belong to ZicfissH and SsdbltrpH, which have no tests yet.

Table 268. H Normative Rules
Normative Rule Rule Text Coverpoints

hstatus_sz_acc_op

The hstatus register is an HSXLEN-bit read/write register formatted as shown in hstatusreg-rv32 when HSXLEN=32 and hstatusreg when HSXLEN=64. The hstatus register provides facilities analogous to the mstatus register for tracking and controlling the exception behavior of a VS-mode guest.

H_hscsr_cg/{cp_hcsr_access_masked, cp_hcsrwalk_masked}/hstatus

hedeleg_sz_acc

Register hedeleg is a 64-bit read/write register, formatted as shown in norm:hedeleg_img.

H_hscsr_cg/{cp_hcsr_access, cp_hcsrwalk}/hedeleg, H_hscsr_cg/{cp_hcsr_access, cp_hcsrwalk}/hedelegh

hedeleg_acc

Each bit of hedeleg shall be either writable or read-only zero.

H_hscsr_cg/{cp_hcsr_access, cp_hcsrwalk}/hedeleg

hedeleg_bits_required, hedeleg_bit0_ialign32

hedeleg_bits_required: Many bits of hedeleg are required specifically to be writable or zero, as enumerated in norm:hedeleg_bits_acc_tbl. hedeleg_bit0_ialign32: Bit 0, corresponding to instruction address-misaligned exceptions, must be writable if IALIGN=32.

H_hscsr_cg/cp_hcsr_access/hedeleg, Sm_H_mcsr_cg/cp_hcsr_access/hedeleg

hedeleg_img

H_hscsr_cg/{cp_hcsr_access, cp_hcsrwalk}/hedeleg

hideleg_sz_acc

Register hideleg is an HSXLEN-bit read/write register, formatted as shown in norm:hideleg_img.

H_hscsr_cg/{cp_hcsr_access, cp_hcsrwalk}/hideleg

hideleg_acc

Among bits 15:0 of hideleg, bits 10, 6, and 2 (corresponding to the standard VS-level interrupts) are writable, and bits 12, 9, 5, and 1 (corresponding to the standard S-level interrupts) are read-only zeros.

H_hscsr_cg/{cp_hcsr_access, cp_hcsrwalk}/hideleg

hideleg_img

H_hscsr_cg/{cp_hcsr_access, cp_hcsrwalk}/hideleg

hvip_sz_op

Register hvip is an HSXLEN-bit read/write register that a hypervisor can write to indicate virtual interrupts intended for VS-mode. Bits of hvip that are not writable are read-only zeros.

H_hscsr_cg/{cp_hcsr_access, cp_hcsrwalk}/hvip

hvip_acc

The standard portion (bits 15:0) of hvip is formatted as shown in hvipreg-standard. Bits VSEIP, VSTIP, and VSSIP of hvip are writable. Setting VSEIP=1 in hvip asserts a VS-level external interrupt; setting VSTIP asserts a VS-level timer interrupt; and setting VSSIP asserts a VS-level software interrupt.

H_hscsr_cg/{cp_hcsr_access, cp_hcsrwalk}/hvip

hvip_img

H_hscsr_cg/{cp_hcsr_access, cp_hcsrwalk}/hvip

hip_hie_sz_acc

Registers hip and hie are HSXLEN-bit read/write registers that supplement HS-level’s sip and sie respectively.

H_hscsr_cg/{cp_hcsr_access, cp_hcsrwalk}/hip, H_hscsr_cg/{cp_hcsr_access, cp_hcsrwalk}/hie

hip_img

H_hscsr_cg/{cp_hcsr_access, cp_hcsrwalk}/hip

hie_img

H_hscsr_cg/{cp_hcsr_access, cp_hcsrwalk}/hie

hip_acc

If bit i of sie is read-only zero, the same bit in register hip may be writable or may be read-only. When bit i in hip is writable, a pending interrupt i can be cleared by writing 0 to this bit. If interrupt i can become pending in hip but bit i in hip is read-only, then either the interrupt can be cleared by clearing bit i of hvip, or the implementation must provide some other mechanism for clearing the pending interrupt (which may involve a call to the execution environment).

H_hscsr_cg/{cp_hcsr_access, cp_hcsrwalk}/hip

hie_acc

A bit in hie shall be writable if the corresponding interrupt can ever become pending in hip. Bits of hie that are not writable shall be read-only zero.

H_hscsr_cg/{cp_hcsr_access, cp_hcsrwalk}/hie

hgeip_sz_acc_op

The hgeip register is an HSXLEN-bit read-only register, formatted as shown in hgeipreg, that indicates pending guest external interrupts for this hart.

H_hscsr_cg/cp_hcsr_access_ro

hgeie_sz_acc_op

The hgeie register is an HSXLEN-bit read/write register, formatted as shown in norm:hgeie_img, that contains enable bits for the guest external interrupts at this hart.

H_hscsr_cg/{cp_hcsr_access, cp_hcsrwalk}/hgeie

hgeie_img

H_hscsr_cg/{cp_hcsr_access, cp_hcsrwalk}/hgeie

geilen

The number of bits implemented in hgeip and hgeie for guest external interrupts is UNSPECIFIED and may be zero. This number is known as GEILEN. The least-significant bits are implemented first, apart from bit 0. Hence, if GEILEN is nonzero, bits GEILEN:1 shall be writable in hgeie, and all other bit positions shall be read-only zeros in both hgeip and hgeie.

H_hscsr_cg/{cp_hcsr_access, cp_hcsrwalk}/hgeie, H_hscsr_cg/cp_hcsr_access_ro

henvcfg_sz_acc_op

The henvcfg CSR is a 64-bit read/write register, formatted as shown in henvcfg, that controls certain characteristics of the execution environment when virtualization mode V=1.

H_hscsr_cg/{cp_hcsr_access_masked, cp_hcsrwalk_masked}/henvcfg, H_hscsr_cg/{cp_hcsr_access_masked, cp_hcsrwalk_masked}/henvcfgh

hcounteren_sz

The counter-enable register hcounteren is a 32-bit register that controls the availability of the hardware performance monitoring counters to the guest virtual machine.

H_hscsr_cg/{cp_hcsr_access, cp_hcsrwalk}/hcounteren

hcounteren_warl

hcounteren must be implemented. However, any of the bits may be read-only zero, indicating reads to the corresponding counter will cause an exception when V=1. Hence, they are effectively WARL fields.

H_hscsr_cg/{cp_hcsr_access, cp_hcsrwalk}/hcounteren

htimedelta_sz_acc_op

The htimedelta CSR is a 64-bit read/write register that contains the delta between the value of the time CSR and the value returned in VS-mode or VU-mode. That is, reading the time CSR in VS or VU mode returns the sum of the contents of htimedelta and the actual value of time.

H_hscsr_cg/{cp_hcsr_access, cp_hcsrwalk}/htimedelta, H_Zicntr_cg/{cp_delta_hs, cp_delta_vs, cp_delta_u, cp_delta_vu}

htval_sz_acc_op

The htval register is an HSXLEN-bit read/write register formatted as shown in htvalreg. When a trap is taken into HS-mode, htval is written with additional exception-specific information, alongside stval, to assist software in handling the trap.

H_hscsr_cg/cp_hcsr_access_zero/htval, H_inst_cg/cp_guest_page_fault

htval_val

htval is a WARL register that must be able to hold zero and may be capable of holding only an arbitrary subset of other 2-bit-shifted guest physical addresses, if any.

H_hscsr_cg/cp_hcsr_access_zero/htval

htinst_sz_acc_op

The htinst register is an HSXLEN-bit read/write register formatted as shown in htinstreg. When a trap is taken into HS-mode, htinst is written with a value that, if nonzero, provides information about the instruction that trapped, to assist software in handling the trap. The values that may be written to htinst on a trap are documented in tinst-vals.

H_hscsr_cg/cp_hcsr_access_zero/htinst, H_inst_cg/cp_guest_page_fault

htinst_val

htinst is a WARL register that need only be able to hold the values that the implementation may automatically write to it on a trap.

H_hscsr_cg/cp_hcsr_access_zero/htinst

hgatp_sz_acc_op

The hgatp register is an HSXLEN-bit read/write register, formatted as shown in rv32hgatp for HSXLEN=32 and rv64hgatp for HSXLEN=64, which controls G-stage address translation and protection, the second stage of two-stage translation for guest virtual addresses (see two-stage-translation).

H_hscsr_cg/cp_hcsr_access_zero/hgatp, H_hscsr_cg/{cp_atpwalk1, cp_atpwalk0}/hgatp

hgatp_mode_Sv

When HSXLEN=32, the only other valid setting for MODE is Sv32x4, which is a modification of the usual Sv32 paged virtual-memory scheme, extended to support 34-bit guest physical addresses. When HSXLEN=64, modes Sv39x4, Sv48x4, and Sv57x4 are defined as modifications of the Sv39, Sv48, and Sv57 paged virtual-memory schemes. All of these paged virtual-memory schemes are described in guest-addr-translation.

H_hscsr_cg/{cp_atpwalk1, cp_atpwalk0}/hgatp

hgatp_ppn_op

In these modes, the lowest two bits of the physical page number (PPN) in hgatp always read as zeros.

H_hscsr_cg/{cp_atpwalk1, cp_atpwalk0}/hgatp

hgatp_vmid

The number of VMID bits is UNSPECIFIED and may be zero.

H_hscsr_cg/{cp_atpwalk1, cp_atpwalk0}/hgatp

hedelegh_sz_acc_op

When XLEN=32, hedelegh is a 32-bit read/write register that aliases bits 63:32 of hedeleg. Register hedelegh does not exist when XLEN=64.

H_hscsr_cg/{cp_hcsr_access, cp_hcsrwalk}/hedelegh, H_vscsr_cg/cp_illegalupper/hedelegh, H_vucsr_cg/cp_csr_insufficient_priv

henvcfgh_sz_acc_op

When XLEN=32, henvcfgh is a 32-bit read/write register that aliases bits 63:32 of henvcfg. Register henvcfgh does not exist when XLEN=64.

H_hscsr_cg/{cp_hcsr_access_masked, cp_hcsrwalk_masked}/henvcfgh, H_vscsr_cg/cp_illegalupper/henvcfgh, H_vucsr_cg/cp_csr_insufficient_priv

htimedeltah_sz_acc_op

When XLEN=32, htimedeltah is a 32-bit read/write register that aliases bits 63:32 of htimedelta. Register htimedeltah does not exist when XLEN=64.

H_hscsr_cg/{cp_hcsr_access, cp_hcsrwalk}/htimedeltah, H_vscsr_cg/cp_illegalupper/htimedeltah, H_vucsr_cg/cp_csr_insufficient_priv, H_Zicntr_cg/{cp_delta_hs, cp_delta_vs, cp_delta_u, cp_delta_vu}

H_vscsrs_acc_m_hs

The VS CSRs can be accessed as themselves only from M-mode or HS-mode.

H_hscsr_cg/cp_hcsr_access, H_hscsr_cg/cp_hcsr_access_zero/vsatp, H_vscsr_cg/cp_hcsr_virtualinstructionfault, H_vucsr_cg/cp_csr_insufficient_priv, U_ucsr_cg/cp_csr_insufficient_priv

vsstatus_sz_acc_op

The vsstatus register is a VSXLEN-bit read/write register that is VS-mode’s version of supervisor register sstatus, formatted as shown in vsstatusreg-rv32 when VSXLEN=32 and vsstatusreg when VSXLEN=64. When V=1, vsstatus substitutes for the usual sstatus, so instructions that normally read or modify sstatus actually access vsstatus instead.

H_hscsr_cg/{cp_hcsr_access, cp_hcsrwalk}/vsstatus, H_vscsr_cg/cp_replica/sstatus

vsip_vsie_sz_acc_op

The vsip and vsie registers are VSXLEN-bit read/write registers that are VS-mode’s versions of supervisor CSRs sip and sie, formatted as shown in norm:vsip_img and norm:vsie_img respectively. When V=1, vsip and vsie substitute for the usual sip and sie, so instructions that normally read or modify sip/sie actually access vsip/vsie instead. However, interrupts directed to HS-level continue to be indicated in the HS-level sip register, not in vsip, when V=1.

H_hscsr_cg/{cp_hcsr_access, cp_hcsrwalk}/vsip, H_hscsr_cg/{cp_hcsr_access, cp_hcsrwalk}/vsie, H_vscsr_cg/cp_replica/sip, H_vscsr_cg/cp_replica/sie

vsip_img

H_hscsr_cg/{cp_hcsr_access, cp_hcsrwalk}/vsip

vsie_img

H_hscsr_cg/{cp_hcsr_access, cp_hcsrwalk}/vsie

vstvec_sz_acc_op

The vstvec register is a VSXLEN-bit read/write register that is VS-mode’s version of supervisor register stvec, formatted as shown in norm:vstvec_img. When V=1, vstvec substitutes for the usual stvec, so instructions that normally read or modify stvec actually access vstvec instead. When V=0, vstvec does not directly affect the behavior of the machine.

H_hscsr_cg/{cp_hcsr_access, cp_hcsrwalk}/vstvec, H_vscsr_cg/cp_replica/stvec

vsscratch_sz_acc_op

The vsscratch register is a VSXLEN-bit read/write register that is VS-mode’s version of supervisor register sscratch, formatted as shown in vsscratchreg. When V=1, vsscratch substitutes for the usual sscratch, so instructions that normally read or modify sscratch actually access vsscratch instead. The contents of vsscratch never directly affect the behavior of the machine.

H_hscsr_cg/{cp_hcsr_access, cp_hcsrwalk}/vsscratch, H_vscsr_cg/cp_replica/sscratch

vsepc_sz_acc_op

The vsepc register is a VSXLEN-bit read/write register that is VS-mode’s version of supervisor register sepc, formatted as shown in vsepcreg. When V=1, vsepc substitutes for the usual sepc, so instructions that normally read or modify sepc actually access vsepc instead. When V=0, vsepc does not directly affect the behavior of the machine.

H_hscsr_cg/cp_hcsr_access/vsepc, H_hscsr_cg/{cp_vsepc_vaddr_walk1, cp_vsepc_vaddr_walk0, cp_vsepc_vaddr_pc, cp_vsepc_vaddr_scratch}, H_vscsr_cg/cp_replica/sepc, Sm_H_mcsr_cg/{cp_vsepc_ialign32_read, cp_vsepc_ialign32_vs_read, cp_vsepc_ialign32_sret}

vsepc_warl

vsepc is a WARL register that must be able to hold the same set of values that sepc can hold, with VSXLEN substituting for SXLEN.

H_hscsr_cg/{cp_vsepc_vaddr_walk1, cp_vsepc_vaddr_walk0, cp_vsepc_vaddr_pc, cp_vsepc_vaddr_scratch}

vstval_sz_acc_op

The vstval register is a VSXLEN-bit read/write register that is VS-mode’s version of supervisor register stval, formatted as shown in vstvalreg. When V=1, vstval substitutes for the usual stval, so instructions that normally read or modify stval actually access vstval instead. When V=0, vstval does not directly affect the behavior of the machine.

H_hscsr_cg/cp_hcsr_access/vstval, H_hscsr_cg/{cp_vstval_vaddr_walk1, cp_vstval_vaddr_walk0, cp_vstval_vaddr_pc, cp_vstval_vaddr_scratch}, H_vscsr_cg/cp_replica/stval

vstval_warl

vstval is a WARL register that must be able to hold the same set of values that stval can hold, with VSXLEN substituting for SXLEN.

H_hscsr_cg/{cp_vstval_vaddr_walk1, cp_vstval_vaddr_walk0, cp_vstval_vaddr_pc, cp_vstval_vaddr_scratch}, H_hscsr_cg/{cp_vstval_zero, cp_vstval_ilen_walk1, cp_vstval_ilen_ones}

vsatp_sz_acc_op

The vsatp register is a VSXLEN-bit read/write register that is VS-mode’s version of supervisor register satp, formatted as shown in rv32vsatpreg for VSXLEN=32 and rv64vsatpreg for VSXLEN=64. When V=1, vsatp substitutes for the usual satp, so instructions that normally read or modify satp actually access vsatp instead. vsatp controls VS-stage address translation, the first stage of two-stage translation for guest virtual addresses (see two-stage-translation).

H_hscsr_cg/cp_hcsr_access_zero/vsatp, H_hscsr_cg/{cp_atpwalk1, cp_atpwalk0}/vsatp, H_vscsr_cg/cp_replica/satp

vsatp_asidlen

The ASID field in the vsatp register has the same number of implemented bits as that of the satp register, i.e., it is ASIDLEN bits wide.

H_hscsr_cg/{cp_atpwalk1, cp_atpwalk0}/vsatp

vstimecmp_sz

The vstimecmp CSR is a 64-bit register and has 64-bit precision on all RV32 and RV64 systems.

H_hscsr_cg/{cp_hcsr_access, cp_hcsrwalk}/vstimecmp, H_hscsr_cg/{cp_hcsr_access, cp_hcsrwalk}/vstimecmph

vstimecmp_acc

In RV32 only, accesses to the vstimecmp CSR access the low 32 bits, while accesses to the vstimecmph CSR access the high 32 bits of vstimecmp.

H_hscsr_cg/{cp_hcsr_access, cp_hcsrwalk}/vstimecmp, H_hscsr_cg/{cp_hcsr_access, cp_hcsrwalk}/vstimecmph

mtval2_sz_acc_op, mtinst_sz_acc_op

mtval2_sz_acc_op: The mtval2 register is an MXLEN-bit read/write register formatted as shown in mtval2reg. When a trap is taken into M-mode, mtval2 is written with additional exception-specific information, alongside mtval, to assist software in handling the trap. mtinst_sz_acc_op: The mtinst register is an MXLEN-bit read/write register formatted as shown in mtinstreg. When a trap is taken into M-mode, mtinst is written with a value that, if nonzero, provides information about the instruction that trapped, to assist software in handling the trap. The values that may be written to mtinst on a trap are documented in tinst-vals.

S_scsr_cg/cp_csr_insufficient_priv, H_vscsr_cg/cp_csr_insufficient_priv, H_vucsr_cg/cp_csr_insufficient_priv, U_ucsr_cg/cp_csr_insufficient_priv

hstatus_vgein_wlrl

VGEIN is a WLRL field that must be able to hold values between zero and the maximum guest external interrupt number (known as GEILEN), inclusive.

H_hscsr_cg/cp_hstatus_vgein

vscause_sz_acc_op

The vscause register is a VSXLEN-bit read/write register that is VS-mode’s version of supervisor register scause, formatted as shown in vscausereg. When V=1, vscause substitutes for the usual scause, so instructions that normally read or modify scause actually access vscause instead. When V=0, vscause does not directly affect the behavior of the machine.

H_vscause_cg/cp_vscause_write_exception, H_vscause_cg/cp_vscause_write_interrupt, H_vscsr_cg/cp_replica

vscause_wlrl

vscause is a WLRL register that must be able to hold the same set of values that scause can hold, with VSXLEN substituting for SXLEN.

H_vscause_cg/cp_vscause_write_exception, H_vscause_cg/cp_vscause_write_interrupt

H_vscsrs_v0, vsstatus_v0

H_vscsrs_v0: when V=0, the VS CSRs do not ordinarily affect the behavior of the machine other than being readable and writable by CSR instructions. vsstatus_v0: When V=0, vsstatus does not directly affect the behavior of the machine, unless a virtual-machine load/store (HLV, HLVX, or HSV) or the MPRV feature in the mstatus register is used to execute a load or store as though V=1.

H_hscsr_cg/cp_replica, Sv_H_hlv_cg/cp_hlv_priv

H_vscsrs_sub

When V=1, the VS CSRs substitute for the corresponding supervisor CSRs, taking over all functions of the usual supervisor CSRs except as specified otherwise. Instructions that normally read or modify a supervisor CSR shall instead access the corresponding VS CSR.

H_vscsr_cg/cp_replica

H_vscsrs_v1

While V=1, the normal HS-level supervisor CSRs that are replaced by VS CSRs retain their values but do not affect the behavior of the machine unless specifically documented to do so.

H_vscsr_cg/cp_replica

H_scsrs_nomatch

Some standard supervisor CSRs (senvcfg, scounteren, and scontext, possibly others) have no matching VS CSR. These supervisor CSRs continue to have their usual function and accessibility even when V=1, except with VS-mode and VU-mode substituting for HS-mode and U-mode.

H_vscsr_cg/cp_nonreplica

H_csrs_hs_not_vs, H_vscsrs_acc_vs, H_cause_virtual_instruction

H_csrs_hs_not_vs: Additional CSRs are provided to HS-mode, but not to VS-mode, to manage two-stage address translation and to control the behavior of a VS-mode guest: hstatus, hedeleg, hideleg, hvip, hip, hie, hgeip, hgeie, henvcfg, henvcfgh, hcounteren, htimedelta, htimedeltah, htval, htinst, and hgatp. H_vscsrs_acc_vs: When V=1, an attempt to read or write a VS CSR directly by its own separate CSR address causes a virtual-instruction exception. H_cause_virtual_instruction: When V=1, a virtual-instruction exception (code 22) is normally raised instead of an illegal-instruction exception if the attempted instruction is HS-qualified but is prevented from executing when V=1 either due to insufficient privilege or because the instruction is expressly disabled by a supervisor or hypervisor CSR such as scounteren or hcounteren. An instruction is HS-qualified if it would be valid to execute in HS-mode (for some values of the instruction’s register operands), assuming fields TSR and TVM of CSR mstatus are both zero.

H_vscsr_cg/cp_hcsr_virtualinstructionfault

Zicsr_high_half_rv64_rsv

Standard high-half CSRs are accessible only when the base RISC-V instruction set is RV32 (XLEN=32). For RV64 (when XLEN=64), the addresses of all standard high-half CSRs are reserved, so an attempt to access a high-half CSR typically raises an illegal-instruction exception.

H_vscsr_cg/cp_illegalupper, H_vucsr_cg/cp_csr_insufficient_priv

H_vscsrs_acc_u

Attempts from U-mode cause an illegal-instruction exception as usual.

U_ucsr_cg/cp_csr_insufficient_priv

H_virtinst_vu_vs_nonhigh_allowedhs_tvm0

in VS-mode or VU-mode, attempts to access an implemented non-high-half hypervisor CSR or VS CSR when the same access (read/write) would be allowed in HS-mode, assuming mstatus.TVM=0;

H_vscsr_cg/cp_hcsr_virtualinstructionfault, H_vucsr_cg/cp_csr_insufficient_priv

H_virtinst_vu_nonhigh_supervisor_allowedhs_tvm0

in VU-mode, attempts to access an implemented non-high-half supervisor CSR when the same access (read/write) would be allowed in HS-mode, assuming mstatus.TVM=0;

H_vucsr_cg/cp_csr_insufficient_priv

vsstatus_sd_xs_op

Read-only fields SD and XS summarize the extension context status as it is visible to VS-mode only. For example, the value of the HS-level sstatus.FS does not affect vsstatus.SD.

H_vsstatus_cg/cp_vsstatus_sd_write

hlsv_mode, hlsv_op, hstatus_hu_op, hlvx-wu_valid32

hlsv_mode: The hypervisor virtual-machine load and store instructions are valid only in M-mode or HS-mode, or in U-mode when hstatus.HU=1. hlsv_op: For every RV32I or RV64I load instruction, LB, LBU, LH, LHU, LW, LWU, and LD, there is a corresponding virtual-machine load instruction: HLV.B, HLV.BU, HLV.H, HLV.HU, HLV.W, HLV.WU, and HLV.D. For every RV32I or RV64I store instruction, SB, SH, SW, and SD, there is a corresponding virtual-machine store instruction: HSV.B, HSV.H, HSV.W, and HSV.D. Instructions HLV.WU, HLV.D, and HSV.D are not valid for RV32, of course. hstatus_hu_op: Field HU (Hypervisor in U-mode) controls whether the virtual-machine load/store instructions, HLV, HLVX, and HSV, can be used also in U-mode. When HU=1, these instructions can be executed in U-mode the same as in HS-mode. When HU=0, all hypervisor instructions cause an illegal-instruction exception in U-mode. hlvx-wu_valid32: HLVX.WU is valid for RV32, even though LWU and HLV.WU are not.

H_inst_cg/cp_hlv, H_inst_cg/cp_hlvx, H_inst_cg/cp_hsv, Ssnpm_H_cg/{cp_hlv_u_spvp1_pmm, cp_hlv_u_spvp0_pmm, cp_hlvx_u_pmm, cp_hlvx_hs_pmm}, Exceptions_H_cg/cp_loadstore_priv

hfence-vvma_hfence-gvma_op, hfence-vvma_mode, hfence-gvma_op, hfence-vvma_hfence-gvma_exceptions

hfence-vvma_hfence-gvma_op: The hypervisor memory-management fence instructions, HFENCE.VVMA and HFENCE.GVMA, perform a function similar to SFENCE.VMA (sfence.vma), except applying to the VS-level memory-management data structures controlled by CSR vsatp (HFENCE.VVMA) or the guest-physical memory-management data structures controlled by CSR hgatp (HFENCE.GVMA). Instruction SFENCE.VMA applies only to the memory-management data structures controlled by the current satp (either the HS-level satp when V=0 or vsatp when V=1). hfence-vvma_mode: HFENCE.VVMA is valid only in M-mode or HS-mode. Its effect is much the same as temporarily entering VS-mode and executing SFENCE.VMA. Executing an HFENCE.VVMA guarantees that any previous stores already visible to the current hart are ordered before all implicit reads by that hart done for VS-stage address translation for instructions that hfence-gvma_op: HFENCE.GVMA is valid only in HS-mode when mstatus.⁠TVM=0, or in M-mode (irrespective of mstatus.⁠TVM). Executing an HFENCE.GVMA instruction guarantees that any previous stores already visible to the current hart are ordered before all implicit reads by that hart done for G-stage address translation for instructions that follow the HFENCE.GVMA. If operand rs1≠x0, it specifies a single guest physical address, shifted right by 2 bits, and if operand rs2≠x0, it specifies a single virtual machine identifier (VMID). hfence-vvma_hfence-gvma_exceptions: Attempts to execute HFENCE.VVMA or HFENCE.GVMA when V=1 cause a virtual-instruction exception, while attempts to do the same in U-mode cause an illegal-instruction exception. Attempting to execute HFENCE.GVMA in HS-mode when mstatus.TVM=1 also causes an illegal-instruction exception.

H_inst_cg/cp_hfence

hstatus_vtvm_op, H_virtinst_vs_sfence_sinval_satp_vtvm1

hstatus_vtvm_op: When VTVM=1, an attempt in VS-mode to execute SFENCE.VMA or SINVAL.VMA or to access CSR satp raises a virtual-instruction exception. H_virtinst_vs_sfence_sinval_satp_vtvm1: in VS-mode, attempts to execute an SFENCE.VMA or SINVAL.VMA instruction or to access satp, when hstatus.VTVM=1.

H_inst_cg/{cp_vtvm_sfence, cp_vtvm_satp}

hfence-vvma_tvm

Neither mstatus.TVM nor hstatus.VTVM causes HFENCE.VVMA to trap.

H_inst_cg/cp_vtvm_hfence_vvma

xret_in_lower_mode

Attempting to execute an xRET instruction in a mode less privileged than x will raise an illegal-instruction exception.

H_inst_cg/cp_mret_illegal

H_virtinst_vu_sret_sfence

or to execute a supervisor instruction (SRET or SFENCE);

H_inst_cg/cp_sret_illegal, Exceptions_H_cg/cp_virtual_instr_vu_sfence_vma

sret_v0, hstatus_spv_sret

sret_v0: When executed in M-mode or HS-mode (i.e., V=0), SRET first determines what the new privilege mode will be according to the values in hstatus.SPV and sstatus.SPP, as encoded in norm:H_trap_hs_spv_spp_tbl. SRET then sets hstatus.SPV=0, and in sstatus sets SPP=0, SIE=SPIE, and SPIE=1. Lastly, SRET sets the privilege mode as previously determined, and sets pc=sepc. hstatus_spv_sret: When an SRET instruction is executed when V=0, V is set to SPV.

H_inst_cg/cp_sret_hs

sret_v1, hstatus_vtsr_op, H_virtinst_vs_sret_vtsr1

sret_v1: When executed in VS-mode (i.e., V=1), SRET sets the privilege mode according to norm:H_trap_vs_spp_tbl, in vsstatus sets SPP=0, SIE=SPIE, and SPIE=1, and lastly sets pc=vsepc. hstatus_vtsr_op: When VTSR=1, an attempt in VS-mode to execute SRET raises a virtual-instruction exception. H_virtinst_vs_sret_vtsr1: in VS-mode, attempts to execute SRET when hstatus.VTSR=1

H_inst_cg/cp_sret_vs

H_guest_page_fault

Guest-page-fault traps may be delegated from M-mode to HS-mode under the control of CSR medeleg, but cannot be delegated to other privilege modes. On a guest-page fault, CSR mtval or stval is written with the faulting guest virtual address as usual, and mtval2 or htval is written either with zero or with the faulting guest physical address, shifted right by 2 bits. CSR mtinst or htinst may also be written with information about the faulting instruction or other reason for the access, as explained in tinst-vals.

H_inst_cg/cp_guest_page_fault

H_trap_xtinst

On any trap into M-mode or HS-mode, one of these values is written automatically into the appropriate trap instruction CSR, mtinst or htinst:

H_inst_cg/cp_guest_page_fault

H_trap_xtinst_exception_lead_in

On a synchronous exception, if a nonzero value is written, one of the following shall be true about the value:

H_inst_cg/cp_guest_page_fault

H_trap_xtinst_exception_list

Bit 0 is 1, and replacing bit 1 with 1 makes the value into a valid encoding of a standard instruction. In this case, the instruction that trapped is the same kind as indicated by the register value, and the register value is the transformation of the trapping instruction, as defined later. For example, if bits 1:0 are binary 11 and the register value is the encoding of a standard LW (load word) instruction, then the trapping instruction is LW, and the register value is the transformation of the trapping LW instruction. Bit 0 is 1, and replacing bit 1 with 1 makes the value into an instruction encoding that is explicitly designated for a custom instruction (not an unused reserved encoding). This is a custom value. The instruction that trapped is a non-standard instruction. The interpretation of a custom value is not otherwise specified by this standard. The value is one of the special pseudoinstructions defined later, all of which have bits 1:0 equal to 00.

H_inst_cg/cp_guest_page_fault

H_trap_xtinst_val

norm:H_trap_xtinst_val_tbl shows the values that may be automatically written to the trap instruction register for each standard exception cause. For exceptions that prevent the fetching of an instruction, only zero or a pseudoinstruction value may be written. A custom value may be automatically written only if the instruction that traps is non-standard. A future standard or extension may permit other values to be written, chosen from the set of allowed values established earlier.

H_inst_cg/cp_guest_page_fault

H_trap_xtinst_guestpage

For guest-page faults, the trap instruction register is written with a special pseudoinstruction value if: (a) the fault is caused by an implicit memory access for VS-stage address translation, and (b) a nonzero value (the faulting guest physical address) is written to mtval2 or htval. If both conditions are met, the value written to mtinst or htinst must be taken from norm:H_trap_xtinst_pseudoinst_tbl; zero is not allowed.

H_inst_cg/cp_guest_page_fault

H_cause_virtual_instruction_high

A special rule applies for CSR instructions that access 32-bit high-half CSRs such as cycleh and htimedeltah. When V=1 and XLEN=32, an invalid attempt to access a high-half CSR raises a virtual-instruction exception instead of an illegal-instruction exception if the same CSR instruction for the corresponding low-half CSR (e.g.cycle or htimedelta) is HS-qualified.

H_vscsr_cg/cp_hcsr_virtualinstructionfault, H_vucsr_cg/cp_csr_insufficient_priv, H_Zicntr_cg/cp_hcounteren_access_vs, H_Zicntr_cg/cp_hcounteren_access_vu

hgatp_vmid_lsbs

The least-significant bits of VMID are implemented first: that is, if VMIDLEN > 0, VMID[VMIDLEN-1:0] is writable. The maximal value of VMIDLEN, termed VMIDMAX, is 7 for Sv32x4 or 14 for Sv39x4, Sv48x4, and Sv57x4.

H_hscsr_cg/cp_atpwalk1/hgatp, H_hscsr_cg/cp_atpwalk0/hgatp, Sm_H_mcsr_cg/cp_atpwalk1/hgatp, Sm_H_mcsr_cg/cp_atpwalk0/hgatp

hgatp_ppn_acc

An implementation that supports only the defined paged virtual-memory schemes and/or Bare may make PPN[1:0] read-only zero.

Not tested: PPN[1:0] may be read-only zero or writable, and no UDB parameter records the choice

hstatus_vgein_acc

GEILEN may be zero, in which case VGEIN may be read-only zero.

Not tested: with GEILEN = 0 the only legal VGEIN value is 0, so a read-only-zero VGEIN cannot be distinguished from a writable one

hsxlen

we use the term HSXLEN to refer to the effective XLEN when executing in HS-mode

Out of scope: tests run with VSXLEN = VUXLEN = HSXLEN = MXLEN

vsxlen

VSXLEN to refer to the effective XLEN when executing in VS-mode.

Out of scope: tests run with VSXLEN = VUXLEN = HSXLEN = MXLEN

hstatus_vsxl_op

The VSXL field controls the effective XLEN for VS-mode (known as VSXLEN), which may differ from the XLEN for HS-mode (HSXLEN).

Out of scope: tests run with VSXLEN = VUXLEN = HSXLEN = MXLEN

hstatus_vsxl_32

When HSXLEN=32, the VSXL field does not exist, and VSXLEN=32.

Out of scope: tests run with VSXLEN = VUXLEN = HSXLEN = MXLEN

hstatus_vsxl_64

When HSXLEN=64, VSXL is a WARL field that is encoded the same as the MXL field of misa, shown in norm:misa_mxl_enc.

Out of scope: tests run with VSXLEN = VUXLEN = HSXLEN = MXLEN

vsxl_ro

In particular, an implementation may make VSXL be a read-only field whose value always ensures that VSXLEN=HSXLEN.

Out of scope: tests run with VSXLEN = VUXLEN = HSXLEN = MXLEN

hstatus_vsxl_change

If HSXLEN is changed from 32 to a wider width, and if field VSXL is not restricted to a single value, it gets the value corresponding to the widest supported width not wider than the new HSXLEN.

Out of scope: tests run with VSXLEN = VUXLEN = HSXLEN = MXLEN

vsstatus_uxl_op

The UXL field controls the effective XLEN for VU-mode, which may differ from the XLEN for VS-mode (VSXLEN). When VSXLEN=32, the UXL field does not exist, and VU-mode XLEN=32. When VSXLEN=64, UXL is a WARL field that is encoded the same as the MXL field of misa, shown in norm:misa_mxl_enc. In particular, an implementation may make UXL be a read-only copy of field VSXL of hstatus, forcing VU-mode XLEN=VSXLEN.

Out of scope: tests run with VSXLEN = VUXLEN = HSXLEN = MXLEN

vsstatus_uxl_change

If VSXLEN is changed from 32 to a wider width, and if field UXL is not restricted to a single value, it gets the value corresponding to the widest supported width not wider than the new VSXLEN.

Out of scope: tests run with VSXLEN = VUXLEN = HSXLEN = MXLEN

hstatus_vsbe_warl, hstatus_vsbe_op, hstatus_vsbe_implicit, hstatus_vsbe_acc, vsstatus_ube

hstatus_vsbe_warl: The VSBE bit is a WARL field that controls the endianness of explicit memory accesses made from VS-mode. hstatus_vsbe_op: If VSBE=0, explicit load and store memory accesses made from VS-mode are little-endian, and if VSBE=1, they are big-endian. hstatus_vsbe_implicit: VSBE also controls the endianness of all implicit accesses to VS-level memory management data structures, such as page tables. hstatus_vsbe_acc: An implementation may make VSBE a read-only field that always specifies the same endianness as HS-mode. vsstatus_ube: An implementation may make field UBE be a read-only copy of hstatus.VSBE.

Not tested: big-endian VS-mode and VU-mode accesses; the reference model has no big-endian support

H_requires_i

The hypervisor extension depends on an I base integer ISA with 32 x registers (RV32I or RV64I), not RV32E or RV64E, which have only 16 x registers.

Not tested: configuration requirement; the I suite tests registers x16 through x31

Sha_dep

H Ssstateen Shcounterenw Shvstvala Shtvala Shvstvecd Shvsatpa Shgatpa

Definition, checked through UDB

henvcfg_fiom_op, henvcfg_fiom_order

henvcfg_fiom_op: If bit FIOM (Fence of I/O implies Memory) is set to one in henvcfg, FENCE instructions executed when V=1 are modified so the requirement to order accesses to device I/O implies also the requirement to order main memory accesses. norm:henvcfg_fiom_fence_presuc_op details the modified interpretation of FENCE instruction bits PI, PO, SI, and SO when FIOM=1 and V=1. henvcfg_fiom_order: Similarly, when FIOM=1 and V=1, if an atomic instruction that accesses a region ordered as device I/O has its aq and/or rl bit set, then that instruction is ordered as though it accesses both device I/O and memory.

Not tested: ordering of I/O and memory accesses is not observable in single-hart signature tests

henvcfg_sse_op

The Zicfiss extension adds the SSE field in henvcfg. If the SSE field is set to 1, the Zicfiss extension is activated in VS-mode. When the SSE field is 0, the Zicfiss extension remains inactive in VS-mode, and the following rules apply when V=1:

Not tested: shadow-stack instructions in VS-mode and VU-mode with henvcfg.SSE = 0 and 1 belong to ZicfissH, which has no tests yet

henvcfg_pmm_op

If the Ssnpm extension is implemented, the PMM field enables or disables pointer masking (see Zpm) for VS-mode, according to the values in norm:henvcfg_pmm_enc. When the Ssnpm extension is not implemented, the PMM field is read-only zero. The PMM field is read-only zero for RV32.

Ssnpm_H_cg/{cp_vs_pmm,cp_hlv_hs_spvp1_pmm,cp_hlv_u_spvp1_pmm}

henvcfg_dte_op

The Ssdbltrp extension adds the double-trap-enable (DTE) field in henvcfg. When henvcfg.DTE is zero, the implementation behaves as though Ssdbltrp is not implemented for VS-mode and the vsstatus.SDT bit is read-only zero.

Not tested: writing vsstatus.SDT and trapping into VS-mode with henvcfg.DTE = 0 and 1 belong to SsdbltrpH, which has no tests yet

vsstatus_sdt_op

The Ssdbltrp adds an S-mode-disable-trap (SDT) field extension to address double trap (See supv-double-trap) in VS-mode.

Not tested: traps into VS-mode with vsstatus.SDT = 0 and 1 belong to SsdbltrpH, which has no tests yet

sret_dt

If the Ssdbltrp extension is implemented, when SRET is executed in HS-mode, if the new privilege mode is VU, the SRET instruction sets vsstatus.SDT to 0. When executed in VS-mode, vsstatus.SDT is set to 0.

Not tested: vsstatus.SDT after sret belongs to SsdbltrpH, which has no tests yet

hcounteren_op, hcounteren_set_op, H_virtinst_vs_nonhighctr_h0_m1, H_virtinst_vs32_highctr_h0_m1

hcounteren_op: When the CY, TM, IR, or HPMn bit in the hcounteren register is clear, attempts to read the cycle, time, instret, or hpmcounter n register while V=1 will cause a virtual-instruction exception if the same bit in mcounteren is 1. hcounteren_set_op: When one of these bits is set, access to the corresponding register is permitted when V=1, unless prevented for some other reason. H_virtinst_vs_nonhighctr_h0_m1: in VS-mode, attempts to access a non-high-half counter CSR when the corresponding bit in hcounteren is 0 and the same bit in mcounteren is 1; H_virtinst_vs32_highctr_h0_m1: in VS-mode, if XLEN=32, attempts to access a high-half counter CSR when the corresponding bit in hcounteren is 0 and the same bit in mcounteren is 1;

H_Zicntr_cg/cp_hcounteren_access_vs, H_Zicntr_cg/cp_hcounteren_access_vu, H_Zicntr_cg/cp_mcounteren_access_vs_h0, H_Zicntr_cg/cp_mcounteren_access_vu_hs0

hcounteren_scounteren_vu_op, H_virtinst_vu_nonhighctr_h0_s0_m1, H_virtinst_vu32_highctr_h0_s0_m1

hcounteren_scounteren_vu_op: In VU-mode, a counter is not readable unless the applicable bits are set in both hcounteren and scounteren. H_virtinst_vu_nonhighctr_h0_s0_m1: in VU-mode, attempts to access a non-high-half counter CSR when the corresponding bit in either hcounteren or scounteren is 0 and the same bit in mcounteren is 1; H_virtinst_vu32_highctr_h0_s0_m1: in VU-mode, if XLEN=32, attempts to access a high-half counter CSR when the corresponding bit in either hcounteren or scounteren is 0 and the same bit in mcounteren is 1;

H_Zicntr_cg/cp_hcounteren_access_vu, H_Zicntr_cg/cp_scounteren_access_vu, H_Zicntr_cg/cp_mcounteren_access_vu, H_Zicntr_cg/cp_mcounteren_access_vu_hs0

mcounteren_clr_ill_inst_exc

When the CY, TM, IR, or HPMn bit in the mcounteren register is clear, attempts to read the cycle, time, instret, or hpmcountern register while executing in S-mode or U-mode will cause an illegal-instruction exception.

H_Zicntr_cg/cp_mcounteren_access_vs, H_Zicntr_cg/cp_mcounteren_access_vs_h0, H_Zicntr_cg/cp_mcounteren_access_vu, H_Zicntr_cg/cp_mcounteren_access_vu_hs0

mcounteren_set_nxt_priv

When one of these bits is set, access to the corresponding register is permitted in the next implemented privilege mode (S-mode if implemented, otherwise U-mode).

H_Zicntr_cg/cp_scounteren_access_hs

scounteren_op

When the CY, TM, IR, or HPMn bit in the scounteren register is clear, attempts to read the cycle, time, instret, or hpmcountern register while executing in U-mode will cause an illegal-instruction exception. When one of these bits is set, access to the corresponding register is permitted.

H_Zicntr_cg/cp_scounteren_access_u, H_Zicntr_cg/cp_scounteren_access_hs (HS-mode reads ignore scounteren)

time_htimedelta_req

If the time CSR is implemented, htimedelta (and htimedeltah for XLEN=32) must be implemented.

H_Zicntr_cg/cp_delta_hs, H_Zicntr_cg/cp_delta_vs, H_Zicntr_cg/cp_delta_u, H_Zicntr_cg/cp_delta_vu

UDB Parameters: None.

B.8.2. Hypervisor Exceptions

The hypervisor exception tests are the Exceptions_H and Exceptions_HSm groups of the Exceptions suite.

B.8.3. InterruptsH Hypervisor Interrupts

Record all trap information including xstatus add to CTP an assumption that all interrupts are implemented

Table 269. InterruptsH Coverpoints
Coverpoint Goal Feature Description Expectation Bins Normative Rule

Following tests are done in M-mode

cp_mideleg

hypervisor bits of mideleg are read-only 1

Write 0 to mideleg and read it back.

Bits 10, 6, 2 are 1s. If GEILEN > 0, bit 12 is also 1.

1

cp_mie

mie.VS*IE bits are alias of hie

With hie = 0x444, read mie.

0x444

1

cp_mip

mip.VS*IP bits are alias of hip

With hvip = 0x444, read mip and hip. Note that hip depends on hvip.

0x444

1

cp_nohint_m

VS*I never causes machine-mode interrupt

mstatus.MIE=1, hideleg = 0, mie = 0x444, mip = 0x444

No interrupt occurs because these are always delegated to HS or VS

1

Following tests are done in M-mode if GILEN > 0

cp_mie_gilen

mie.SGEIE is alias of hie

With hie = 0x1444, read mie.

0x1444

1

cp_mip_gilen

mip.SGEIP is alias of hip

Set hgeip nonzero and read mip

0x1000

1

Following tests are done in M-mode if GILEN = 0

cp_mie_gilen

mie.SGEIE is read-only zero if GILEN = 0

Write hie = 0x1000, read mie

0x0000

1

hie_acc

Following tests are done in HS-mode

cp_trigger_vsei

trigger HS-mode VSEI

With sstatus.SIE={0/1}, hideleg.VSEI = {0/1}, hie.VSEIE = {0/1}, write hvip.VSEIP

hip.VSEIP rises. if SIE=1 & hideleg = 0 & hie = 1, interrupt to HS-mode with cause 10

2 * 2 * 2

cp_trigger_vsti

trigger HS-mode VSTI

With sstatus.SIE={0/1}, hideleg.VSTI = {0/1}, hie.VSTIE = {0/1}, write hvip.VSTIP

hip.VSTIP rises. if SIE=1 & hideleg = 0 & hie = 1, interrupt to HS-mode with cause 6

2 * 2 * 2

cp_trigger_vssi

trigger HS-mode VSSI

With sstatus.SIE={0/1}, hideleg.VSSI = {0/1}, hie.VSSIE = {0/1}, write hvip.VSSIP

hip.VSSIP rises. if SIE=1 & hideleg = 0 & hie = 1, interrupt to HS-mode with cause 2

2 * 2 * 2

cp_hip_write

only hip.vssip is writable, and aliases to hvip

Write hip=0xFFFF and hip = 0x0000. Read back hvip and hip.

0x0004 and 0x0000 in both hip and hvip.

1

cp_priority_en_vsi

trigger highest priority enabled VSI

With sstatus.SIE=1, hideleg = 0, 2^3 combinations of hie.VS*IE, write 2^3 combinations of hvip.VS*IP

Highest priority enabled interrupt to HS-mode

8 * 8

cp_priority_deleg_vsi

trigger highest priority undelegated VSI

With sstatus.SIE = 1, hie=0x444, 2^3 combinations of hideleg, write 2^3 combinations of hvip.VS*IP

Highest priority undelegated interrupt to HS-mode

8 * 8

cp_priority_s

VS*I has lower priority than any S*I

With sstatus.SIE = 1, hvip = 0x444, hideleg = 0, hie = 0x444, sie = 1s, sip = {SEIP, STIP, SSIP, none}

Take highest priority interrupt (supervisor, if any asserted, else VSEI)

4

cp_hie

hie.VS*IE bits are alias of mie

With mie = 0x444, 2^3 combinations of hideleg, read hie and vsie

hie = 0x444; vsie = 1s in delegated bits

8

cp_hip

hip.VS*IP bits are alias of mip

With mip = 0x444, 2^3 combinations of hideleg, read hip and visp

hip = 0x444; visp = 1s in delegated bits

8

cp_hideleg

hideleg bits 10, 6, 2 are writable

Write 0xFFFF to hideleg, read back

0x444

1

cp_vsie

vsie is alias of hie when delegated

With 2^3 combinations of hideleg and 2^3 combinations of hie, read vsie

vsie bits = 1 if hideleg and hie bits = 1 (shifted)

8 * 8

cp_vsip

vsip is alias of hip when delegated

With 2^3 combinations of hideleg and 2^3 combinations of hip, read vsip

vsip bits = 1 if hideleg and hip bits = 1 (shifted)

8 * 8

cp_vsie_from_hie

hie is alias of vsie when delegated

With 2^3 combinations of hideleg, write 0xFFFF to vsie, read hie

delegated bits show up as 1 in hie (shifted)

8

Following tests are done in HS-mode if GILEN > 0

cp_hie_gilen

hie.SGEIE is alias of mie

With mie = 0x1444, read hie

0x1444

1

cp_priority_sgei

SGEI has higher priority than VS*I

With sstatus.SIE=1, hvip = 0x444, sgeip & sgeie != 0, hideleg = 0, hei = 0x1444

interrupt to HS-mode with cause 12

1

cp_priority_sgei_s

SGEI has lower priroity than any S*I

With sstatus.SIE = 1, hvip = 0x444, hideleg = 0, hie = 0x1444, sie = 1s, sip = {SEIP, STIP, SSIP, none}

Take highest priority interrupt (supervisor, if any are asserted)

4

cp_trigger_sgei

trigger HS-mode SGEI

With sstatus.SIE={0/1}, sgeip & sgeie != 0, hie.SGEIE = {0/1}

hip.SGEIP =1. if SIE=1 & hie = 1, interrupt to HS-mode with cause 12

2 * 2

cp_hgeie

hgeie enables SGEI

With sstatus.SIE = 0, for i in 1…​GILEN, with hgeip = {0, 1 in i, 1s in all writable bits}, hgeie = 1 in bit i

hip.SEGIP = 1 if hgeip & hgeie != 0

GLEN * 3

cp_trigger_vsei_hgeip

trigger HS-mode VSEI with HGEIP

With sstatus.SIE = 0, hvip = 0, hideleg = 0, hie = 0, for i in 1…​GLEN: hgeip = {0, 1 in i, 1 in all writable bits except i}, hgeie[i] = {0/1}, hstatus.VGEIN = i

hip.VSEIP = hgeip[i] independent of hgeie

GLEN * 2

cp_hgeip0

no VSEI selected when VGEIN=0

With statatus.SIE=0, hvip = 0, hideleg=0, hie = 0, hgeip = hgeie = 1s in all writable bits, hstatus.VGEIN = 0

hip.SEGIP = 0, hip.VSEIP = 0

1

Following tests are done in VS-mode

cp_hideleg_hip_vs

Set up 2^3 combinations of hideleg, 2^3 combinations of hip, hie = 0x444. Change to VS-mode with vsstatus.SIE = 1

Take highest priority interrupt to HS or VS. VS shifts to SEI/STI/SSI.

8 * 8

cp_hideleg_hie_vs

Set up 2^3 combinations of hideleg, 2^3 combinations of hie, hip = 0x444. Change to VS-mode with vsstatus.SIE = 1

Take highest priority interrupt to HS or VS. VS shifts to SEI/STI/SSI.

8 * 8

cp_hip_hie_vs

Set up 2^3 combinations of hip, 2^3 combinations of hie, hideleg = 0x444. Change to VS-mode with vsstatus.SIE = 1

Take highest priority interrupt to HS or VS. VS shifts to SEI/STI/SSI.

8 * 8

cp_sie_vs

hideleg = hip = hie = 0x444. Change to VS-mode with vsstatus.SIE = {0/1}

Take SEI if SIE=1

2

cp_mideleg_mip_vs

With mstatus.MIE=0, mideleg = {0/1s}, mip = {MEIP/MTIP/MSIP/SEI/STI/SSI}, mie = 1s, change to VS-mode with vsstatus.SIE=1

Take interrupt to M or HS

2 * 6

cp_mtinst

mtinst = 0 on interrupt

with mtinst randomized, mideleg = 0, exercise each interrupt.

mtinst = 0

10 interrupts

cp_htinst

htinst = 0 on interrupt

with htinst randomized, mideleg = 1, hideleg = 0 exercise each interrupt.

htinst = 0

10 interrupts

Following tests are done in VU-mode

cp_hideleg_hip_vu

Set up 2^3 combinations of hideleg, 2^3 combinations of hip, hie = 0x444. Change to VU-mode.

Take highest priority interrupt to HS or VS. VS shifts to SEI/STI/SSI.

8 * 8

cp_hideleg_hie_vu

Set up 2^3 combinations of hideleg, 2^3 combinations of hie, hip = 0x444. Change to VU-mode.

Take highest priority interrupt to HS or VS. VS shifts to SEI/STI/SSI.

8 * 8

cp_hip_hie_vu

Set up 2^3 combinations of hip, 2^3 combinations of hie, hideleg = 0x444. Change to VU-mode.

Take highest priority interrupt to HS or VS. VS shifts to SEI/STI/SSI.

8 * 8

cp_mideleg_mip_vu

With mstatus.MIE=0, mideleg = {0/1s}, mip = {MEIP/MTIP/MSIP/SEI/STI/SSI}, mie = 1s, change to VU-mode

Take interrupt to M or HS

2 * 6

Following tests are done in U-mode

cp_vsint_disabled_u

VS-mode interrupts are globally disabled in U-mode

hideleg = hip = hie = 0x444. Change to U-mode.

Nothing

1

Four hie/hip bits aliased to mie/mip

Generating hip.VSEIP with hvip

Generating hip.VSEIP with hgeip

Generating hip.VSTIP with hivip.vstip

Generating hip.VSTIP with vstimecmp and htimedelta (Sstc supported)

See SstcH

generating hip.VSSIP with hvip.VSSIP

generating hip.VSSIP by writing it directly

priority of interrupts

Generating hip.SGEIP with one or more of hgeip & hgeie

When hideleg is set, hip and hie bit is aliased to vsip and vsie * mideleg required too?

Delegated interrupts replace supervisor interrupts (test both)

Priority of interrupts

Interrupts not taken in higher mode?

Delegated interrupts are read-only zero in sie/sip. Undelegated read-only zero in hip/hie

delegated interrupts are masked at the delegator privilege level

interrupts to S mode take priority over interrupts to lower priv mode

However, interrupts directed to HS-level continue to be indicated in

the HS-level sip register, not in vsip, when V=1.

B.8.4. EndianH Hypervisor Endianness

Table 270. EndianH Coverpoints
Coverpoint Goal Feature Description Expectation Bins ID Notes

cp_hstatus_vbe_endianness

endianvs

VSBE

Read from memory in an endian fashion in supervisor mode.

Run test in VS mode. For each endianness given by hstatus.VSBE, sd 0x0102030405060708 to scratch, and also write all subwords with sw, sh, sb. For each endianness (independent), ld, lw, lwu, lh, lhu, lb, lbu it back. In RV32, don’t need the doubles.

restore endianness to normal afterward

Check against RM
To be Done
Uncovered

cp_mstatus_mprv_vsbe_endianness

endianvs

MPRV, MBE, VSBE

Read from memory in an endian fashion based on MBE and VSBE depending on MPRV.

Run test in machine mode. Each endianness is a cross-product of MPRV = 0/1, MPP = 01/11, MPV=0/1, MBE = 0/1, VSBE = 0/1 (32 bins). For each endianness, sd 0x0102030405060708 to scratch, and also write all subwords with sw, sh, sb. For each endianness (independent), ld, lw, lwu, lh, lhu, lb, lbu it back. In RV32, don’t need the doubles.

restore endianness to normal afterward

Check against RM
To be Done
Uncovered

cp_vsstatus_ube_endianness

endianvs

UBE

Read from memory in an endian fashion

Run test in VU mode. For each endianness given in vsstatus.UBE, sd 0x0102030405060708 to scratch, and also write all subwords with sw, sh, sb. For each endianness (independent), ld, lw, lwu, lh, lhu, lb, lbu it back. In RV32, don’t need the doubles.

restore endianness to normal afterward

Check against RM
To be Done
Uncovered

Note: some implementations may make UBE a read-only copy of hstatus.VSBE, or VSBE a read-only copy of sstatus.SBE, or SBE and MBE might not be writable.
Only run Endian tests if fields are writable.

B.8.5. H_Zicntr and Sm_Zicntr_H Hypervisor Counters

These are the Zicntr groups of the H and Sm suites, and run only when Zicntr and H are supported. Sm_Zicntr_H reads every counter from M-mode while walking mcounteren, hcounteren and scounteren together, and reads time with each htimedelta. H_Zicntr checks counter access from HS, VS, U and VU modes against mcounteren, hcounteren and scounteren, and time with htimedelta in each mode. H_Zicntr exercises hcounteren for all 32 counters, so no separate ZihpmH suite is needed.

Sm_Zicntr_H boots to M-mode and delegates nothing. The lower-mode counter accesses are in H_Zicntr. The counters are cycle, time, instret and each hpmcounter that HPM_COUNTER_EN implements. A counter has bins only when its MCOUNTENABLE_EN, HCOUNTENABLE_EN and SCOUNTENABLE_EN bits are set (writable).

Table 271. Sm_Zicntr_H Coverpoints
Coverpoint Goal Feature Description Expectation Bins Normative Rule Notes

in M mode

cp_mhscounteren_access_m

vscounters

Write walking 1s and 0s to all of mcounteren, hcounteren, scounteren (the same value in each). Read from corresponding counter and counterh in M-mode and attempt to write it

Reads always succeed, because M-mode ignores the counter-enable registers; writes raise illegal instruction, because the counters are read-only

{csrr, csrw} x counters x counter-enable bit {0, 1}

mcounteren_op
scounteren_op
hcounteren_op
Zihpm_op_sz_mode_acc_priv

cp_delta_m

htimedelta does not affect time in M mode

With htimedelta = {0, 2^30, 2^32-1, 2^60, -1, -2^30, -2^60}, read time. In RV32, this also involves htimedeltah and timeh; 2^32-1 exercises the carry into the high half and -1 the 64-bit wrap. Note: do not check time directly against reference model, which might tick differently. Only look at the range of values: compare against a baseline time read just before with htimedelta = 0.

0 ⇐ time - baseline < 2^30 in all circumstances

7 htimedelta values * time (and timeh on RV32)

htimedelta_sz_acc_op
htimedeltah_sz_acc_op

On RV32 each read of time reads timeh, time and timeh again, and repeats if timeh changed, so a carry between the reads cannot fail the check

H_Zicntr boots to HS-mode and delegates nothing (hedeleg = 0), so the HS-mode handler takes the illegal- and virtual-instruction traps from U, VS and VU. The M-mode reads are in Sm_Zicntr_H. Each counter-enable walk writes a walking 1 and then a walking 0 to one counter-enable register, with the others preset to all 1s or all 0s. After each write it reads the counter whose bit is set or clear (and its high half on RV32) and attempts to write it. The counters are cycle, time, instret and each hpmcounter that HPM_COUNTER_EN implements. A write to a counter raises illegal instruction in every mode, because the counters are read-only CSRs, so the write is not HS-qualified. xcounteren fields are WARL and may be read-only zero. The coverpoints sample the accessed counter’s own bit in each counter-enable register, and a counter has bins only when its MCOUNTENABLE_EN, HCOUNTENABLE_EN and SCOUNTENABLE_EN bits are set (writable).

Table 272. H_Zicntr Coverpoints
Coverpoint Goal Feature Description Expectation Bins Normative Rule Notes

in HS mode

cp_scounteren_access_hs

vscounters

Write walking 1s and 0s to scounteren with mcounteren = all 1s, hcounteren = all 0s. Read from corresponding counter and counterh in HS-mode and attempt to write it

Reads always succeed, because HS-mode ignores scounteren and hcounteren; writes raise illegal instruction

{csrr, csrw} x counters x scounteren bit {0, 1}

mcounteren_set_nxt_priv
scounteren_op

cp_delta_hs

htimedelta does not affect time in HS mode

With htimedelta = {0, 2^30, 2^32-1, 2^60, -1, -2^30, -2^60}, read time. In RV32, this also involves htimedeltah and timeh; 2^32-1 exercises the carry into the high half and -1 the 64-bit wrap. Note: do not check time directly against reference model, which might tick differently. Only look at the range of values: compare against a baseline time read just before with htimedelta = 0.

0 ⇐ time - baseline < 2^30 in all circumstances

7 htimedelta values * time (and timeh on RV32)

htimedelta_sz_acc_op
htimedeltah_sz_acc_op
time_htimedelta_req

On RV32 each read of time reads timeh, time and timeh again, and repeats if timeh changed, so a carry between the reads cannot fail the check. The same applies to every cp_delta row.

in VS mode

cp_mcounteren_access_vs

vscounters

Write walking 1s and 0s to mcounteren with hcounteren = all 1s and scounteren = all 0s. Read from corresponding counter and counterh in VS-mode and attempt to write it

Reads raise illegal instruction when the mcounteren bit is 0 and succeed when it is 1, because VS-mode ignores scounteren; writes raise illegal instruction

{csrr, csrw} x counters x mcounteren bit {0, 1}

mcounteren_clr_ill_inst_exc
mcounteren_op

cp_mcounteren_access_vs_h0

vscounters

Write walking 1s and 0s to mcounteren with hcounteren = all 0s and scounteren = all 0s. Read from corresponding counter and counterh in VS-mode and attempt to write it

Reads raise illegal instruction when the mcounteren bit is 0 and virtual instruction when it is 1, because the hcounteren bit is 0; writes raise illegal instruction

{csrr, csrw} x counters x mcounteren bit {0, 1}

hcounteren_op
hcounteren_set_op
H_virtinst_vs_nonhighctr_h0_m1
H_virtinst_vs32_highctr_h0_m1
mcounteren_clr_ill_inst_exc

cp_hcounteren_access_vs

vscounters

Write walking 1s and 0s to hcounteren with mcounteren = all 1s and scounteren = all 0s. Read from corresponding counter and counterh in VS-mode and attempt to write it

Reads raise virtual instruction when the hcounteren bit is 0 and succeed when it is 1; writes raise illegal instruction

{csrr, csrw} x counters x hcounteren bit {0, 1}

H_cause_virtual_instruction_high
hcounteren_op
hcounteren_set_op
H_virtinst_vs_nonhighctr_h0_m1
H_virtinst_vs32_highctr_h0_m1

cp_delta_vs

htimedelta affects time in VS mode

With htimedelta = {0, 2^30, 2^32-1, 2^60, -1, -2^30, -2^60}, read time. In RV32, this also involves htimedeltah and timeh; 2^32-1 exercises the carry into the high half and -1 the 64-bit wrap. Note: do not check time directly against reference model, which might tick differently. Only look at the range of values: compare against a baseline time read just before with htimedelta = 0.

(time - baseline - htimedelta) mod 2^64 < 2^30 for each htimedelta, so time + htimedelta wraps modulo 2^64

7 htimedelta values * time (and timeh on RV32)

htimedelta_sz_acc_op
htimedeltah_sz_acc_op
time_htimedelta_req

in U mode

cp_scounteren_access_u

vscounters

Write walking 1s and 0s to scounteren with mcounteren = all 1s, hcounteren = all 0s. Read from corresponding counter and counterh in U-mode and attempt to write it

Reads raise illegal instruction when the scounteren bit is 0 and succeed when it is 1, because U-mode ignores hcounteren; writes raise illegal instruction

{csrr, csrw} x counters x scounteren bit {0, 1}

scounteren_op

cp_delta_u

htimedelta does not affect time in U mode

With htimedelta = {0, 2^30, 2^32-1, 2^60, -1, -2^30, -2^60}, read time. In RV32, this also involves htimedeltah and timeh; 2^32-1 exercises the carry into the high half and -1 the 64-bit wrap. Note: do not check time directly against reference model, which might tick differently. Only look at the range of values: compare against a baseline time read just before with htimedelta = 0.

0 ⇐ time - baseline < 2^30 in all circumstances

7 htimedelta values * time (and timeh on RV32)

htimedelta_sz_acc_op
htimedeltah_sz_acc_op
time_htimedelta_req

in VU mode

cp_mcounteren_access_vu

vscounters

Write walking 1s and 0s to mcounteren with hcounteren = scounteren = all 1s. Read from corresponding counter and counterh in VU-mode and attempt to write it

Reads raise illegal instruction when the mcounteren bit is 0 and succeed when it is 1; writes raise illegal instruction

{csrr, csrw} x counters x mcounteren bit {0, 1}

hcounteren_scounteren_vu_op
H_virtinst_vu_nonhighctr_h0_s0_m1
H_virtinst_vu32_highctr_h0_s0_m1
mcounteren_clr_ill_inst_exc

cp_mcounteren_access_vu_hs0

vscounters

Write walking 1s and 0s to mcounteren with hcounteren = scounteren = all 0s. Read from corresponding counter and counterh in VU-mode and attempt to write it

Reads raise illegal instruction when the mcounteren bit is 0 and virtual instruction when it is 1, because the hcounteren and scounteren bits are 0; writes raise illegal instruction

{csrr, csrw} x counters x mcounteren bit {0, 1}

hcounteren_op
hcounteren_set_op
H_virtinst_vs_nonhighctr_h0_m1
H_virtinst_vs32_highctr_h0_m1
hcounteren_scounteren_vu_op
H_virtinst_vu_nonhighctr_h0_s0_m1
H_virtinst_vu32_highctr_h0_s0_m1
mcounteren_clr_ill_inst_exc

cp_hcounteren_access_vu

vscounters

Write walking 1s and 0s to hcounteren with mcounteren = scounteren = all 1s. Read from corresponding counter and counterh in VU-mode and attempt to write it

Reads raise virtual instruction when the hcounteren bit is 0 and succeed when it is 1; writes raise illegal instruction

{csrr, csrw} x counters x hcounteren bit {0, 1}

H_cause_virtual_instruction_high
hcounteren_op
hcounteren_set_op
H_virtinst_vs_nonhighctr_h0_m1
H_virtinst_vs32_highctr_h0_m1
hcounteren_scounteren_vu_op
H_virtinst_vu_nonhighctr_h0_s0_m1
H_virtinst_vu32_highctr_h0_s0_m1

cp_scounteren_access_vu

vscounters

Write walking 1s and 0s to scounteren with mcounteren = hcounteren = all 1s. Read from corresponding counter and counterh in VU-mode and attempt to write it

Reads raise virtual instruction when the scounteren bit is 0 and succeed when it is 1; writes raise illegal instruction

{csrr, csrw} x counters x scounteren bit {0, 1}

hcounteren_scounteren_vu_op
H_virtinst_vu_nonhighctr_h0_s0_m1
H_virtinst_vu32_highctr_h0_s0_m1

cp_delta_vu

htimedelta affects time in VU mode

With htimedelta = {0, 2^30, 2^32-1, 2^60, -1, -2^30, -2^60}, read time. In RV32, this also involves htimedeltah and timeh; 2^32-1 exercises the carry into the high half and -1 the 64-bit wrap. Note: do not check time directly against reference model, which might tick differently. Only look at the range of values: compare against a baseline time read just before with htimedelta = 0.

(time - baseline - htimedelta) mod 2^64 < 2^30 for each htimedelta, so time + htimedelta wraps modulo 2^64

7 htimedelta values * time (and timeh on RV32)

htimedelta_sz_acc_op
htimedeltah_sz_acc_op
time_htimedelta_req

B.8.6. PMPH Hypervisor Physical Memory Protection

Table 273. PMPH Coverpoints
Coverpoint Goal Feature Description Expectation Bins ID Normative Rule

This test plan verifies correct enforcement of PMP in systems implementing the RISC-V Hypervisor extension. It ensures that PMP permissions are applied consistently across all relevant privilege modes (M, HS, VS, and VU), including accesses performed through hypervisor-specific load and store instructions and under one-stage and two-stage address translation.
The test environment assumes a configurable number of writable PMP entries (PMP_writable_regs), typically 16, and tests are parameterized to allow execution on implementations with fewer writable regions. To reduce runtime, tests are executed with PMP_writable_regs = 16 where supported. The lowest-priority writable PMP region (region PMP_writable_regs−1, typically region 15) is always configured as a background region covering the entire physical address space, using NAPOT addressing with RWX permissions and the L bit set, and with the address register programmed to all ones. Functional coverage is written for PMP_writable_regs−1 regions, while tests are executed assuming PMP_writable_regs regions, ensuring full coverage even when the highest region is reserved as background.
Unless otherwise specified, tests execute in M-mode while configuring PMP state, and then transition into HS-mode, VS-mode, or VU-mode to observe PMP enforcement. Standard PMP regions are configured using NAPOT addressing with a size of max(g, 8) bytes, placed beyond the program code and not overlapping other standard regions. A default TOR region is aligned to the PMP grain size g and placed beyond the end of the program, with a size of exactly g. PMP grain size is derived from the platform parameter G, where g = 2^(G+2).
The pmpcfg_i field refers to the 8-bit configuration for region i, located in pmpcfg[i/4] on RV32 or pmpcfg[2*(i/8)] on RV64. Instruction fetch accesses are generated using jal and jalr. Read accesses include {lb, lbu, lh, lhu, lw, lwu, ld}, and write accesses include {sb, sh, sw, sd}. For RV32 systems, instructions lwu, ld, and sd are excluded. Legal PMP permission encodings tested are {000, 001, 011, 100, 101, 110}, with the W=1, R=0 combination treated as reserved and unpredictable.
For tests involving address translation, valid VS-stage and G-stage page tables are configured as required. Proper privilege mode transitions between HS, VS, and VU are explicitly performed to validate correct enforcement in virtualized contexts.
After modifying PMP CSRs, synchronization is performed to ensure consistent behavior. Since PMP permissions are not cached in translation structures, PMP changes are expected to take effect immediately; however, when PMP changes are combined with updates to translation structures, appropriate fencing is used. SFENCE.VMA is issued after VS-stage page table updates, and HFENCE.GVMA with rs1 = x0 and rs2 = x0 is issued after G-stage updates. On systems where satp.MODE is read-only zero, SFENCE.VMA may raise an illegal instruction exception; such traps are expected and may be ignored for test purposes. Memory barriers are used where required to ensure proper ordering of configuration changes relative to memory operations.

cp_pmp_hs_mode_access

Verify PMP applies in HS-mode

HS-mode executes {lw, sw, jalr} to PMP-protected region

Access allowed iff PMP permits on final PA

{R,W,X} × {allow/deny}

pmp_hs_access_v0

norm:pmp_check_priv_modes
norm:pmp_with_paging

cp_pmp_vs_mode_access

Verify PMP applies in VS-mode

Access allowed iff PMP permits on final PA

{R,W,X} × {allow/deny}

pmp_vs_access_v0

norm:pmp_check_priv_modes, norm:pmp_with_paging

cp_pmp_vu_mode_access

Verify PMP applies in VU-mode

VS-mode access via VS-stage or 2-stage translation

Access allowed iff PMP permits on final PA

{R,W,X} × {allow/deny}

pmp_vu_access_v0

norm:pmp_check_priv_modes
norm:pmp_with_paging

cp_pmp_hlv_read

Verify HLV obeys PMP.R

HS-mode executes HLV* into PMP.R=0 region

Load access fault

{HLVB,HLVH,HLVW,HLVD}

pmp_hlv_r_v0

norm:pmp_load_fault, norm:pmp_rwx_check

cp_pmp_hsv_write

Verify HSV obeys PMP.W

HS-mode executes HSV into PMP.W=0 region

Store access fault

{HSV}

pmp_hsv_w_v0

norm:pmp_store_fault

cp_pmp_hlvx_x_only

Ensure HLVX does not bypass X-only PMP

PMP region X=1, R=W=0; HS executes HLVX

Load access fault

{X-only}

pmp_hlvx_xonly_v0

norm:pmp_load_fault, norm:pmp_rwx_check

cp_pmp_hlvx_r_allowed

Verify HLVX works when PMP.R=1

PMP region R=1; HS executes HLVX

Load succeeds

{R=1}

pmp_hlvx_r_v0

norm:pmp_rwx_check

cp_pmp_after_gstage

Verify PMP checked after G-stage

G-stage translation succeeds, PMP denies

Access fault (not page fault)

{allow/deny}

pmp_gstage_order_v0

norm:pmp_with_paging

cp_pmp_after_vsstage

Verify PMP checked after VS-stage

VS-stage translation succeeds, PMP denies

Access fault

{deny}

pmp_vsstage_order_v0

norm:pmp_with_paging

cp_pmp_pf_priority

Verify page fault precedes PMP

VS or G-stage translation fault

Page fault raised

{VS,G}

pmp_pf_prio_v0

norm:pmp_with_paging

cp_pmp_exec_fault_h

PMP exec violation in virtualized mode

VS/HS instruction fetch denied by PMP

Instruction access fault

{HS,VS}

pmp_exec_fault_h_v0

norm:pmp_exec_fault

cp_pmp_precise_trap_h

PMP faults are precise

Faulting instruction does not retire

PC points to faulting insn

{all types}

pmp_precise_v0

norm:pmp_violation_precise_trap

cp_pmp_hfence_translation

HFENCE required only for G-stage

Change hgatp/PT + PMP

Translation changes visible only after HFENCE

{before/after}

pmp_hfence_v0

norm:pmp_with_paging

cp_pmp_block

Check PMP and PMPH enforcement

Execute {hlv*, hsv*, hlvx*} targeting addresses disallowed by PMP/PMPH config

Should raise Load/Store Access Fault

instr × priv_mode × pmp_cfg_case

pmp_twostage_interaction

Verify PMP interaction with two-stage translation

Test Setup: Configure G-stage page tables with various GPA to SPA mappings. Set up PMP regions covering different SPA ranges with varying permissions (R/W/X combinations). Execute memory operations from VS/VU modes that trigger two-stage translation.
Test Execution: 1) Perform loads/stores/fetches from VS-mode with addresses that map through G-stage to SPA addresses covered by different PMP regions. 2) Verify PMP checks occur on final SPA, not intermediate GPA. 3) Test with PMP regions using NAPOT, TOR, and NA4 addressing modes. 4) Use standard regions of max(g,8) bytes for NAPOT configurations. 5) Test with bottom region (PMP_writable_regs-1) configured as background with NAPOT, RWX, L=1, pmpaddr=All_ones. Synchronization: Issue HFENCE.GVMA after PMP configuration changes.

PMP should apply to final supervisor physical addresses regardless of virtualization mode

PMP configurations (R/W/X/A/L) × translation results (success/fail) × privilege modes (HS/VS/VU)

pmp_gstage_pagetable_access

Verify PMP protection of G-stage page tables

Test Setup: Configure PMP regions to selectively protect/allow access to G-stage page table memory locations. Map G-stage page tables at known physical addresses and configure PMP regions to cover these addresses with varying permissions.
Test Execution: 1) Configure PMP to deny read access to L0 G-stage page table memory, attempt VS-mode memory access requiring page table walk. 2) Configure PMP to deny write access to page table locations, attempt operations that would modify G-stage page tables. 3) Test all page table levels (L0/L1/L2/L3) with different PMP protection patterns. 4) Use TOR regions to precisely cover page table boundaries. 5) Test with PMP grain size g considerations for page table alignment. Verification: Confirm appropriate guest page faults or access faults occur when PMP denies page table access.

PMP should protect G-stage page table accesses and cause appropriate faults

PMP settings (deny/allow) × page table access patterns (read/write) × page table levels (L0/L1/L2/L3)

pmp_hypervisor_priority

Verify PMP vs hypervisor exception priority

Test Setup: Create scenarios where both PMP violations and guest page faults can occur simultaneously. Configure G-stage page tables with invalid entries and PMP regions that would also deny access.
Test Execution: 1) Configure invalid G-stage PTE and PMP region denying access to same SPA range, perform memory access from VS-mode. 2) Test priority with different fault combinations: PMP read fault + guest page fault, PMP write fault + guest store page fault, PMP execute fault + guest instruction page fault. 3) Test with different privilege levels (VS vs VU mode) to verify consistent priority ordering. 4) Verify mcause/scause values reflect correct exception priority. Exception Handling: Ensure proper trap delegation configuration to test fault routing.

PMP exceptions should have higher priority than virtualization exceptions

Exception combinations (PMP fault + guest page fault) × access types (read/write/execute) × privilege levels

pmp_gpa_spa_mapping

Verify PMP application to guest physical addresses

Test Setup: Configure G-stage page tables with various GPA to SPA mappings including identity, offset, and scattered mappings. Set up PMP regions covering specific SPA ranges.
Test Execution: 1) Create GPA ranges that map to SPA ranges with different PMP protections. 2) From VS-mode, access GPAs that map to PMP-protected SPAs, verify PMP checks SPA not GPA. 3) Test with overlapping GPA ranges mapping to same SPA region with PMP protection. 4) Test invalid G-stage translation scenarios where PMP should not be reached. 5) Use TOR regions for precise SPA boundary testing. Address Validation: Verify address translation completion before PMP evaluation.

PMP should check supervisor physical addresses, not guest physical addresses

GPA ranges × SPA mappings × PMP rule coverage × translation validity

pmp_atomic_operations

Verify PMP with atomic operations in virtualized environment

Test Setup: Configure atomic memory regions accessible through two-stage translation with various PMP protections. Set up alignment-sensitive test addresses.
Test Execution: 1) Test atomic memory operations (AMO.{ADD,XOR,OR,AND,MIN,MAX,MINU,MAXU}.{W,D}) through two-stage translation to PMP-protected memory.
2) Test load-reserved/store-conditional (LR.{W,D}/SC.{W,D}) sequences with PMP boundaries in HS-mode with G-stage translation enabled.
4) Verify atomic operations fail atomically when PMP denies access.

Atomic Operation will give guest page fault if PTE permissions are violated, else access fault if PMP permissions fail

Atomic operation types (AMO/LR/SC) × PMP permissions × virtualization modes × address alignment

pmp_instruction_fetch

Verify PMP execute permissions with virtualized instruction fetch

Test Setup: Place executable code at various SPA locations with different PMP execute permissions. Configure G-stage translation to map VS-mode code regions to these SPAs.
Test Execution: 1) Execute code from VS-mode where instructions are mapped to SPA with PMP X=1, verify successful execution. 2) Execute code from VS-mode where instructions map to SPA with PMP X=0, verify instruction access fault. 3) Test fetch instructions (jal, jalr) crossing PMP region boundaries. 4) Test with pmpcfg_i.L=1 and various legal XWR combinations focusing on X bit behavior. 5) Place test code in standard regions starting after main program code. Exception Handling: Verify instruction access faults properly trap and provide correct fault addresses.

Execute permissions should be enforced on final physical addresses

Instruction fetch scenarios × execute permissions (granted/denied) × translation stages × privilege transitions

pmp_interrupt_handling

Verify PMP during interrupt/exception handling in virtualized modes

Test Setup: Configure interrupt delegation (mideleg/sideleg) for VS-mode interrupt handling. Set up interrupt handlers at various SPA locations with different PMP protections.
Test Execution: 1) Configure VS-mode interrupt handlers in memory regions with PMP restrictions, test interrupt delivery and handler execution. 2) Test external, timer, and software interrupts with handlers requiring different PMP permissions (R/W/X). 3) Test interrupt handler code crossing PMP region boundaries. 4) Test nested interrupt scenarios with multiple PMP region transitions. 5) Verify interrupt handler memory accesses (stack operations, context save/restore) respect PMP boundaries. Handler Placement: Ensure interrupt handlers are in executable regions with appropriate PMP permissions.

Interrupt handlers should respect PMP boundaries after address translation

Interrupt types (external/timer/software) × handler locations × PMP rule coverage × virtualization modes

pmp_nested_virtualization

Verify PMP with nested virtualization scenarios

Test Setup: Configure nested hypervisor environment (if supported by implementation). Set up multiple levels of address translation with PMP enforcement at appropriate levels.
Test Execution: 1) Test PMP enforcement through multiple levels of address translation (Guest→Host→Physical). 2) Verify PMP applies consistently regardless of virtualization nesting depth. 3) Test privilege mode transitions across nesting levels with PMP enforcement. 4) Test address translation chains with PMP checks at final physical address. 5) Verify exception handling and delegation through nested virtualization with PMP interactions. Nesting Support: Adapt tests based on implementation-specific nested virtualization capabilities.

PMP should apply consistently across all virtualization levels

Nesting levels × PMP configurations × address translation chains × privilege mode combinations

pmp_memory_ordering

Verify memory ordering constraints with PMP in virtualized environment

Test Setup: Configure memory regions with different PMP permissions accessible via two-stage translation. Create memory operation sequences that can test ordering semantics across PMP faults.
Test Execution: 1) Create sequences of memory operations where some operations encounter PMP faults, verify memory ordering preserved for operations before fault. 2) Test acquire/release semantics (fence instructions) with PMP boundaries in virtualized environment. 3) Test memory ordering across PMP region boundaries with mixed cached/uncached regions. 4) Verify speculative execution doesn’t violate PMP permissions or affect memory ordering. 5) Test DMA and other non-CPU memory operations with PMP ordering requirements. Ordering Models: Test both TSO and weak memory ordering implementations where applicable.

Memory ordering should be preserved even when PMP violations occur

Memory operation sequences × PMP fault locations × ordering constraints × virtualization modes

pmp_fault_delegation

Verify fault delegation with PMP in virtualized environment

Test Setup: Configure trap delegation registers (medeleg/sedeleg, hideleg/hedeleg) for various fault types. Set up scenarios where PMP faults can occur in different privilege modes.
Test Execution: 1) Configure PMP faults to be delegated to S-mode, test fault handling from VS-mode PMP violations. 2) Test fault delegation priority between PMP faults and virtualization faults. 3) Test fault information accuracy (mtval/stval/htval) for PMP faults in virtualized environment. 4) Verify correct trap routing based on delegation settings and current privilege mode. 5) Test nested fault scenarios with multiple delegation levels. Fault Information: Verify fault cause codes and addresses correctly reflect PMP vs virtualization fault sources.

PMP faults should be delegated according to virtualization and delegation settings

Fault types × delegation configurations × virtualization modes × trap handling

pmp_edge_cases

Verify PMP edge cases in virtualized environment

Test Setup: Configure PMP regions at critical address boundaries (address space limits, wraparound conditions). Set up two-stage translation with edge case address mappings.
Test Execution: 1) Test PMP regions at maximum physical address boundaries with two-stage translation. 2) Test address wraparound conditions in GPA→SPA mapping with PMP enforcement. 3) Test misaligned PMP regions with grain size restrictions in virtualized environment. 4) Test maximum number of PMP regions (PMP_writable_regs) with overlapping virtualization mappings. 5) Test zero-sized and minimum-sized PMP regions with two-stage address translation. Boundary Testing: Focus on off-by-one conditions and alignment edge cases specific to combined PMP and virtualization.

System should handle edge cases gracefully without undefined behavior

Edge conditions (address boundaries/wrap-around/alignment) × PMP configurations × virtualization states

Test Configuration Notes

hypervisor loads and stores depend on PMP

hlvx does not override PMP execute-only

PMP intgeraction with fences G and VS-stage

General Setup for All Tests:

Use PMP_writable_regs = 16 for test runtime optimization

Configure bottom region (region 15 or PMP_writable_regs-1) as background: pmpcfg_n.A=NAPOT, RWX permissions, pmpcfg_n.L=1, pmpaddr_n=All_ones

Execute in M-mode unless specified otherwise

Standard regions use NAPOT of max(g,8) bytes, placed beyond code without overlapping other standard regions

Default TOR regions aligned to grain size g, starting beyond program end, size g

After PMP CSR writes, issue sfence.vma or hfence.gvma for synchronization

Handle sfence.vma illegal instruction traps on systems with satp.MODE read-only zero

Legal pmpcfg.XWR combinations: {000, 001, 011, 100, 101, 110} (W=1,R=0 is reserved)

Grain size g = 2^(G+2) where G is the PMP grain size parameter

For RV32 systems, exclude lwu, ld, sd instructions from testing

Address Translation Setup:

Configure valid G-stage page tables for two-stage translation testing

Use appropriate VMID and ASID values for TLB management tests

Set up hgatp register for G-stage translation control

Configure proper privilege mode transitions between HS, VS, and VU modes

Synchronization Requirements:

Issue HFENCE.GVMA with rs1=x0, rs2=x0 after PMP changes affecting translation structures

Use appropriate memory barriers for cache coherency testing

Ensure proper ordering of configuration changes relative to memory operations

B.8.7. Hypervisor 2-Stage Virtual Memory

The hypervisor virtual memory tests are the Sv_H, Sv_HSm and Sv_HZicbo groups of the Sv suite. PMP on their cache-block operations is in the PMP_HSvZicbo group of the PMP suite.

B.8.8. Shcounterenw Writable Counter Enables

Table 274. Shcounterenw Coverpoints
Coverpoint Goal Feature Description Expectation Bins Normative Rule

Following tests are done in HS-mode

cp_shcounterenw

which hcounteren bits are writable

Set and clear each bit of hcounteren, then write all 1s and all 0s, as Sscounterenw does for scounteren.

0 writes 32 bits of 0
-1 writes 1s to every bit with a non-read-only-zero hpmcounter (HPM_COUNTER_EN); the other bits match the reference model

2

Shcounterenw_hpmcounter_hcounteren
hcounteren_warl

Table 275. Shcounterenw Normative Rules
Normative Rule Rule Text Coverpoints

Shcounterenw_hpmcounter_hcounteren

If the Shcounterenw extension is implemented, then for any hpmcounter that is not read-only zero, the corresponding bit in hcounteren must be writable.

Shcounterenw_cg/cp_shcounterenw

hcounteren_warl

hcounteren must be implemented. However, any of the bits may be read-only zero, indicating reads to the corresponding counter will cause an exception when V=1. Hence, they are effectively WARL fields.

Shcounterenw_cg/cp_shcounterenw

UDB Parameters: None.

B.8.9. Shvsatpa Virtual Memory Modes Supported

Table 276. Shvsatpa Coverpoints
Coverpoint Goal Feature Description Expectation Bins Normative Rule

Following tests are done in HS-mode

cp_shvsatpa

Check all values writable to vsatp.mode

Write vsatp with MODE = Bare and with Sv32 (MODE 1, RV32) or each of Sv39, Sv48 and Sv57 (MODE 8, 9 and 10, RV64) whose satp mode is supported, with the other fields zero, because Bare with nonzero fields is UNSPECIFIED; read vsatp back.

Each value reads back as written

Bare + 1 per supported satp mode (2 on RV32, up to 4 on RV64)

Shvsatpa_satp_vsatp_modes

Table 277. Shvsatpa Normative Rules
Normative Rule Rule Text Coverpoints

Shvsatpa_satp_vsatp_modes

If the Shvsatpa extension is implemented, all translation modes supported in satp must be supported in vsatp.

Shvsatpa_cg/cp_shvsatpa

UDB Parameters: None.

B.8.10. Shgatpa Virtual Memory x4 Modes Supported

Table 278. Shgatpa Coverpoints
Coverpoint Goal Feature Description Expectation Bins Normative Rule

Following tests are done in HS-mode

cp_shgatpa

Check all values writable to hgatp.mode

Write hgatp with MODE = Bare and with Sv32x4 (MODE 1, RV32) or each of Sv39x4, Sv48x4 and Sv57x4 (MODE 8, 9 and 10, RV64) whose satp mode is supported, with the other fields zero, because Bare with nonzero fields is UNSPECIFIED; read hgatp back.

Each value reads back as written

Bare + 1 per supported satp mode (2 on RV32, up to 4 on RV64)

Shgatpa_satp_hgatp_mode_support
Shgatpa_hgatp_bare_mode

Table 279. Shgatpa Normative Rules
Normative Rule Rule Text Coverpoints

Shgatpa_satp_hgatp_mode_support

If the Shgatpa extension is implemented, then for each supported virtual memory scheme SvNN supported in satp, the corresponding hgatp SvNNx4 mode must be supported.

Shgatpa_cg/cp_shgatpa

Shgatpa_hgatp_bare_mode

Furthermore, the hgatp mode Bare must also be supported.

Shgatpa_cg/cp_shgatpa

UDB Parameters: None.

B.8.11. Shvstvecd VS-Mode Direct Vectors

Table 280. Shvstvecd Coverpoints
Coverpoint Goal Feature Description Expectation Bins Normative Rule

Following tests are done in HS-mode

cp_vstvec_vaddr_pc
cp_vstvec_vaddr_scratch

Check vstvec.MODE can be 0 and when it is, vstvec.base can hold valid 4-byte aligned addresses

Write vstvec = two physical addresses with MODE = Direct, the current pc and the scratch area, and read it back. They are valid even when address translation is off.

vstvec gets value written

2

Shvstvecd_vstvec_mode_direct
Shvstvecd_vstvec_base_aligned_address

cp_vstvec_vaddr_walk1
cp_vstvec_vaddr_walk0

vstvec.BASE holds every valid 4-byte-aligned virtual address when vstvec.MODE = Direct

Write a walking 1 (0s in the msbs) and a walking 0 (1s in the msbs) through bits 2 to VALEN-2 of vstvec (bit 31 on RV32) with MODE = Direct, and read it back. Canonical addresses have bits XLEN-1:VALEN-1 equal, so only bits up to VALEN-2 are walked. VALEN is set by the largest of Sv39, Sv48 and Sv57 that satp supports; the walk needs Sv32 or Sv39.

vstvec gets value written

2 x walked bits (30 on RV32, 36/45/54 for Sv39/Sv48/Sv57)

Shvstvecd_vstvec_mode_direct
Shvstvecd_vstvec_base_aligned_address
vstvec_img

Table 281. Shvstvecd Normative Rules
Normative Rule Rule Text Coverpoints

Shvstvecd_vstvec_mode_direct

If the Shvstvecd extension is implemented, then vstvec.MODE must be capable of holding the value 0 (Direct).

Shvstvecd_cg/{cp_vstvec_vaddr_pc, cp_vstvec_vaddr_scratch, cp_vstvec_vaddr_walk1, cp_vstvec_vaddr_walk0}

Shvstvecd_vstvec_base_aligned_address

Furthermore, when vstvec.MODE=Direct, vstvec.BASE must be capable of holding any valid four-byte-aligned address.

Shvstvecd_cg/cp_vstvec_vaddr_walk1, Shvstvecd_cg/cp_vstvec_vaddr_walk0, Shvstvecd_cg/cp_vstvec_vaddr_pc, Shvstvecd_cg/cp_vstvec_vaddr_scratch

vstvec_img

Shvstvecd_cg/cp_vstvec_vaddr_walk1, Shvstvecd_cg/cp_vstvec_vaddr_walk0

UDB Parameters: None.

B.8.12. Shvstvala VS-Mode Trap Address

Shvstvala boots to HS-mode, which delegates the exceptions to VS-mode with hedeleg. Each exception is raised in VS-mode and in VU-mode after vstval is set to a random value, so a hart that does not write vstval fails, and the VS-mode trap handler records vstval. The access-fault and misaligned tests reuse the Exceptions test sequences with vsatp = hgatp = Bare; the page-fault tests run under two-stage translation. Virtual-instruction exceptions are never taken in VS-mode (hedeleg[22] is read-only zero), so the Sstvala case for them does not apply. Each access-fault test needs RVMODEL_ACCESS_FAULT_ADDRESS_{FETCH/LOAD/STORE} for its access type. The misaligned load and store tests are compiled only without MISALIGNED_LDST, and the misaligned fetch test only without Zca; no current H configuration assembles them, so they were checked only with scratch Sail configurations.

Table 282. Shvstvala Coverpoints
Coverpoint Goal Feature Description Expectation Bins Normative Rule Status Notes

cp_load_page_fault

Fault writes VA to vstval

In VS-mode and VU-mode under two-stage translation, load from a VS-stage page without R

vstval written with VA

{VS, VU} x lw x load page fault x vstval = address

Shvstvala_vstval_written

cp_store_page_fault

Fault writes VA to vstval

In VS-mode and VU-mode under two-stage translation, store to a VS-stage page without W

vstval written with VA

{VS, VU} x sw x store/AMO page fault x vstval = address

cp_instr_page_fault

Fault writes VA to vstval

In VS-mode and VU-mode under two-stage translation, fetch from a VS-stage page without X

vstval written with VA

{VS, VU} x jalr x instruction page fault x vstval = target

Shvstvala_vstval_written
hedeleg_op

cp_load_access_fault

Fault writes VA to vstval

In VS-mode and VU-mode, each load (lb, lbu, lh, lhu, lw, and lwu, ld on RV64) from RVMODEL_ACCESS_FAULT_ADDRESS_LOAD

vstval written with VA

{VS, VU} x each load x load access fault x vstval = address

Shvstvala_vstval_written
hedeleg_op

cp_store_access_fault

Fault writes VA to vstval

In VS-mode and VU-mode, each store (sb, sh, sw, and sd on RV64) to RVMODEL_ACCESS_FAULT_ADDRESS_STORE

vstval written with VA

{VS, VU} x each store x store/AMO access fault x vstval = address

cp_instr_access_fault

Fault writes VA to vstval

In VS-mode and VU-mode, jalr to RVMODEL_ACCESS_FAULT_ADDRESS_FETCH

vstval written with VA

{VS, VU} x jalr x instruction access fault x vstval = target

cp_load_address_misaligned

Fault writes VA to vstval

Only without MISALIGNED_LDST. In VS-mode and VU-mode, each load wider than a byte at offsets 0-7 of a scratch doubleword

vstval written with VA for each misaligned load

{VS, VU} x each load wider than a byte x load address misaligned x vstval = address

cp_store_address_misaligned

Fault writes VA to vstval

Only without MISALIGNED_LDST. In VS-mode and VU-mode, each store wider than a byte at offsets 0-7 of a scratch doubleword

vstval written with VA for each misaligned store

{VS, VU} x each store wider than a byte x store/AMO address misaligned x vstval = address

Shvstvala_vstval_written
hedeleg_op

cp_load_misaligned_word
cp_store_misaligned_word
cp_load_misaligned_doubleword
cp_store_misaligned_doubleword

Fault writes VA to vstval for each misalignment

Only without MISALIGNED_LDST. The misaligned word and (on RV64) doubleword accesses of cp_load_address_misaligned and cp_store_address_misaligned, binned by the address offset within the access’s natural alignment. A halfword can only be misaligned by 1.

vstval written with VA for each misalignment

{VS, VU} x {lw, lwu} or sw x offsets 1-3 x address misaligned x vstval = address; {VS, VU} x ld or sd x offsets 1-7 x address misaligned x vstval = address

cp_instr_adr_misaligned_jalr

Fault writes VA to vstval

Only without Zca. In VS-mode and VU-mode, jalr with each combination of rs1[1:0] and offset[1:0]

vstval written with the target address for each target with bit 1 set

{VS, VU} x jalr x instruction address misaligned x vstval = target

cp_illegal_instruction

Fault writes instr to vstval

In VS-mode and VU-mode, execute the instructions 0x00000000 and 0xFFFFFFFF

vstval written with instr

{VS, VU} x {0x00000000, 0xFFFFFFFF} x illegal instruction x vstval = instruction

Shvstvala_vstval_written
hedeleg_op

Not tested

Breakpoint exceptions that write an address write it to vstval

Shvstvala_vstval_written

Not tested

In VS-mode and VU-mode these come only from Sdtrig triggers. The SdtrigH suite, which is not yet in act4, delegates them to VS-mode (hedeleg[3] = 1), where the trap handler records vstval.

Table 283. Shvstvala Normative Rules
Normative Rule Rule Text Coverpoints

Shvstvala_vstval_written, hedeleg_op

Shvstvala_vstval_written: If the Shvstvala extension is implemented, vstval must be written in all cases described in sstvala for stval. hedeleg_op: A synchronous trap that has been delegated to HS-mode (using medeleg) is further delegated to VS-mode if V=1 before the trap and the corresponding hedeleg bit is set.

Shvstvala_cg/cp_load_access_fault, Shvstvala_cg/cp_store_address_misaligned, Shvstvala_cg/cp_illegal_instruction, Shvstvala_cg/cp_instr_page_fault

UDB Parameters: None.

B.8.13. Shtvala HS-Mode Trap Address

Shtvala boots to HS-mode. The tests take guest-page faults from VS-mode and VU-mode, and from HLV and HSV in HS-mode and U-mode, into HS-mode, which records htval and htinst. htval is set to a random value before each trap, so a hart that does not write it fails. Each fault is taken twice: through a VS-stage superpage leaf whose guest physical address the G-stage leaves unmapped, where the final access faults and htval holds its guest physical address >> 2 (whose page offset matches the virtual address), and through a VS-stage pointer to a page table at such an address, where the implicit VS-stage PTE read faults, htval holds the PTE’s guest physical address >> 2 and htinst holds a pseudoinstruction. The coverpoints tell the two apart by htinst and by comparing the page offset of htval << 2 with that of the virtual address, so they need no fixed address.

Table 284. Shtvala Coverpoints
Coverpoint Goal Feature Description Expectation Bins Normative Rule

cp_load_guest_page_fault

Fault writes GPA >> 2 to htval

In VS-mode and VU-mode, cause load guest-page faults on the final access and on the implicit VS-stage PTE read

htval written with the faulting guest physical address >> 2

{VS, VU} x lw x load guest-page fault x {final access, implicit PTE read}

Shtvala_htval_faulting_gpa
htval_trapval
mtval2_htval_virtaddr
H_trap_xtinst_guestpage

cp_store_guest_page_fault

Fault writes GPA >> 2 to htval

In VS-mode and VU-mode, cause store guest-page faults on the final access and on the implicit VS-stage PTE read

htval written with the faulting guest physical address >> 2

{VS, VU} x sw x store/AMO guest-page fault x {final access, implicit PTE read}

Shtvala_htval_faulting_gpa
htval_trapval
mtval2_htval_virtaddr
H_trap_xtinst_guestpage

cp_instr_guest_page_fault

Fault writes GPA >> 2 to htval

In VS-mode and VU-mode, cause fetch guest-page faults on the final access and on the implicit VS-stage PTE read

htval written with the faulting guest physical address >> 2

{VS, VU} x jalr x instruction guest-page fault x {final access, implicit PTE read}

Shtvala_htval_faulting_gpa
htval_trapval
mtval2_htval_virtaddr
H_trap_xtinst_guestpage

cp_amo_guest_page_fault
cp_lr_guest_page_fault

AMO and LR guest-page faults write GPA >> 2 to htval

Only with Zaamo (amoswap.w) or Zalrsc (lr.w). In VS-mode and VU-mode, cause guest-page faults on the final access and on the implicit VS-stage PTE read.

Store/AMO guest-page fault for amoswap.w and load guest-page fault for lr.w, with htval written with the faulting guest physical address >> 2. rd is unchanged.

{VS, VU} x {amoswap.w, lr.w} x guest-page fault x {final access, implicit PTE read}

Shtvala_htval_faulting_gpa
htval_trapval
mtval2_htval_virtaddr
H_trap_xtinst_guestpage

cp_hlv_guest_page_fault
cp_hlvx_guest_page_fault
cp_hsv_guest_page_fault

HLV, HLVX and HSV guest-page faults write GPA >> 2 to htval

In HS-mode and in U-mode with hstatus.HU = 1, both with hstatus.SPVP = 0, execute hlv.w, hlvx.wu and hsv.w where the final access or the implicit VS-stage PTE read has an unmapped guest physical address. The VS-stage and G-stage leaves allow execution, so hlvx.wu passes its permission check.

Load guest-page fault for hlv.w and hlvx.wu and store/AMO guest-page fault for hsv.w, taken in HS-mode, with htval written with the faulting guest physical address >> 2. A faulting load leaves rd unchanged.

{HS, U} x {hlv.w, hlvx.wu, hsv.w} x guest-page fault x {final access, implicit PTE read}

Shtvala_htval_faulting_gpa
htval_trapval
mtval2_htval_virtaddr
H_trap_xtinst_guestpage

cp_instr_straddle_guest_page_fault

A fetch that straddles into an unmapped guest page writes the page-boundary GPA >> 2 to htval

Only with Zca. In VS-mode and VU-mode, jalr to a 32-bit instruction two bytes below the end of a mapped guest page whose successor has an unmapped guest physical address.

Instruction guest-page fault on the second half of the instruction. sepc holds the start of the instruction, stval the page-boundary address and htval its guest physical address >> 2.

{VS, VU} x jalr x instruction guest-page fault x target at page end - 2 x htval at page boundary

H_straddle
H_tinst_addr_offset
stval_op_load_store_fault

cp_load_straddle_guest_page_fault
cp_store_straddle_guest_page_fault

A misaligned access that straddles into an unmapped guest page writes the page-boundary GPA >> 2 to htval

In VS-mode and VU-mode, lw and sw two bytes below the end of a mapped guest page whose successor has an unmapped guest physical address. The coverpoints need MISALIGNED_LDST; harts that do not perform misaligned accesses run the test and raise an address-misaligned exception instead.

Load or store/AMO guest-page fault on the part of the access in the next page, however the hart splits it. stval holds the page-boundary address and htval its guest physical address >> 2.

{VS, VU} x {lw, sw} x guest-page fault x address at page end - 2 x htval at page boundary

H_straddle
H_tinst_addr_offset
stval_op_load_store_fault

cp_hlv_straddle_guest_page_fault
cp_hsv_straddle_guest_page_fault

HLV and HSV that straddle into an unmapped guest page write htval and the htinst Addr. Offset

In HS-mode with hstatus.SPVP = 0 and in U-mode with hstatus.HU = 1, hlv.w and hsv.w two bytes below the end of a mapped guest page whose successor has an unmapped guest physical address. The coverpoints need MISALIGNED_LDST, as above.

Load or store/AMO guest-page fault. htval holds the page-boundary guest physical address >> 2. A faulting hlv.w leaves rd unchanged. htinst is zero or holds an Addr. Offset of 2, the difference between the faulting virtual address in stval and the original virtual address; HS-mode checks it, and the trap record holds it for U-mode.

{HS, U} x {hlv.w, hsv.w} x guest-page fault x address at page end - 2 x htval at page boundary

H_straddle
H_tinst_addr_offset
stval_op_load_store_fault

Table 285. Shtvala Normative Rules
Normative Rule Rule Text Coverpoints

Shtvala_htval_faulting_gpa, htval_trapval, mtval2_htval_virtaddr, H_trap_xtinst_guestpage

Shtvala_htval_faulting_gpa: If the Shtvala extension is implemented, htval must be written with the faulting guest physical address in all circumstances permitted by the ISA. htval_trapval: When a guest-page-fault trap is taken into HS-mode, htval is written with either zero or the guest physical address that faulted, shifted right by 2 bits. For other traps, htval is set to zero, but a future standard or extension may redefine `htval’s setting for other traps. mtval2_htval_virtaddr: When a guest-page fault is not due to an implicit memory access for VS-stage address translation, a nonzero guest physical address written to mtval2/htval shall correspond to the exact virtual address written to mtval/stval. H_trap_xtinst_guestpage: For guest-page faults, the trap instruction register is written with a special pseudoinstruction value if: (a) the fault is caused by an implicit memory access for VS-stage address translation, and (b) a nonzero value (the faulting guest physical address) is written to mtval2 or htval. If both conditions are met, the value written to mtinst or htinst must be taken from norm:H_trap_xtinst_pseudoinst_tbl; zero is not allowed.

Shtvala_cg/cp_load_guest_page_fault, Shtvala_cg/cp_store_guest_page_fault, Shtvala_cg/cp_instr_guest_page_fault, Shtvala_cg/cp_amo_guest_page_fault, Shtvala_cg/cp_lr_guest_page_fault, Shtvala_cg/cp_hlv_guest_page_fault, Shtvala_cg/cp_hlvx_guest_page_fault, Shtvala_cg/cp_hsv_guest_page_fault

H_straddle, H_tinst_addr_offset, stval_op_load_store_fault

H_straddle: When an instruction fetch or a misaligned memory access straddles a page boundary, two different address translations are involved. When a guest-page fault occurs in such a circumstance, the faulting virtual address written to mtval/stval is the same as would be required for a regular page fault. Thus, the faulting virtual address may be a page-boundary address that is higher than the instruction’s original virtual address, if the byte at that page boundary is among the accessed bytes. H_tinst_addr_offset: In all the transformed instructions above, the Addr. Offset field that replaces the instruction’s rs1 field in bits 19:15 is the positive difference between the faulting virtual address (written to mtval or stval) and the original virtual address. This difference can be nonzero only for a misaligned memory access. stval_op_load_store_fault: If stval is written with a nonzero value when a misaligned load or store causes an access-fault, page-fault, or hardware-error exception, then stval will contain the virtual address of the portion of the access that caused the fault.

Shtvala_cg/{cp_load_straddle_guest_page_fault,cp_store_straddle_guest_page_fault}, Shtvala_cg/{cp_hlv_straddle_guest_page_fault,cp_hsv_straddle_guest_page_fault}, Shtvala_cg/cp_instr_straddle_guest_page_fault

UDB Parameters: None.

B.8.14. Shlcofideleg Hypervisor Counter Overflow Delegation

Develop this after baseline overflow delegation tests

B.8.15. Zkr Hypervisor Entropy Register

The hypervisor entropy tests are the H group of the Zkr suite: see Table 176.

B.8.16. Sstc Hypervisor Timer Compare

The hypervisor timer compare tests are the H and HSm groups of the Sstc suite: see Table 201 and Table 202.

B.8.17. SscrindH Hypervisor Indirect CSR Access

Hypervisor indirect CSR access.

Develop this after baseline indirect CSR tests

B.8.18. SscfgH Hypervisor Counter Delegation

Develop this after baseline Sscfg tests

B.8.19. SmctrH Hypervisor Control Transfer Records

Develop this after baseline control transfer record tests

B.8.20. Svinval Hypervisor Memory Management Table Invalidation

The hypervisor TLB invalidation tests are the H and SmH groups of the Svinval suite: see Table 251 and Table 252.

B.8.21. Svadu, Svpbmt and Svnapot Hypervisor Virtual Memory

The hypervisor tests of these extensions are the H groups of their suites: see Table 256, Table 259 and Table 262.

B.8.22. Hypervisor Landing Pads

The hypervisor landing pad tests are the Zicfilp_H and Zicfilp_SmH groups of the Zicfilp suite.

B.8.23. SsdbltrpH Hypervisor Double Trap

  • develop after Ssdbltrp

B.8.24. Hypervisor Pointer Masking

The hypervisor pointer masking tests are the Ssnpm_H group of the Ssnpm suite.

B.8.25. SmnpmH Hypervisor Pointer Masking

Develop this after baseline pointer masking tests

B.9. Vector Privileged Test Suites

All of the vector privileged suites are collected in this section. The machine-, supervisor-, and user-mode vector CSR tests, Sm_V, Sm_VF, S_V, S_VF, U_V, and U_VF, are part of the Sm, S, and U suites and their test plans.

B.9.1. MisalignV Vector Misalignment

MisalignV tests misaligned vector loads and stores. Unlike scalar misaligned suites, they are privileged tests that run whether or not misaligned accesses are supported, so they may trap or not depending on TODO UDBParameter.

Table 286. MisalignV Instruction Coverpoints
Instruction vl1re16.v vl1re32.v vl1re64.v vl1re8.v vl2re16.v vl2re32.v vl2re64.v vl2re8.v vl4re16.v vl4re32.v vl4re64.v vl4re8.v

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

cp_misalignv_ls_wholereg_misaligned

x

x

x

x

x

x

x

x

x

x

x

x

Instruction vl8re16.v vl8re32.v vl8re64.v vl8re8.v vle16.v vle16ff.v vle32.v vle32ff.v vle64.v vle64ff.v vle8.v vle8ff.v

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

cp_misalignv_ls_element_misaligned

x

x

x

x

x

x

x

x

cp_misalignv_ls_wholereg_misaligned

x

x

x

x

Instruction vlm.v vloxei16.v vloxei32.v vloxei64.v vloxei8.v vloxseg2ei16.v vloxseg2ei32.v vloxseg2ei64.v vloxseg2ei8.v vloxseg3ei16.v vloxseg3ei32.v vloxseg3ei64.v

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

cp_misalignv_ls_element_misaligned

x

x

x

x

x

x

x

x

x

x

x

x

Instruction vloxseg3ei8.v vloxseg4ei16.v vloxseg4ei32.v vloxseg4ei64.v vloxseg4ei8.v vloxseg5ei16.v vloxseg5ei32.v vloxseg5ei64.v vloxseg5ei8.v vloxseg6ei16.v vloxseg6ei32.v vloxseg6ei64.v

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

cp_misalignv_ls_element_misaligned

x

x

x

x

x

x

x

x

x

x

x

x

Instruction vloxseg6ei8.v vloxseg7ei16.v vloxseg7ei32.v vloxseg7ei64.v vloxseg7ei8.v vloxseg8ei16.v vloxseg8ei32.v vloxseg8ei64.v vloxseg8ei8.v vlse16.v vlse32.v vlse64.v

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

cp_misalignv_ls_element_misaligned

x

x

x

x

x

x

x

x

x

x

x

x

Instruction vlse8.v vlseg2e16.v vlseg2e16ff.v vlseg2e32.v vlseg2e32ff.v vlseg2e64.v vlseg2e64ff.v vlseg2e8.v vlseg2e8ff.v vlseg3e16.v vlseg3e16ff.v vlseg3e32.v

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

cp_misalignv_ls_element_misaligned

x

x

x

x

x

x

x

x

x

x

x

x

Instruction vlseg3e32ff.v vlseg3e64.v vlseg3e64ff.v vlseg3e8.v vlseg3e8ff.v vlseg4e16.v vlseg4e16ff.v vlseg4e32.v vlseg4e32ff.v vlseg4e64.v vlseg4e64ff.v vlseg4e8.v

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

cp_misalignv_ls_element_misaligned

x

x

x

x

x

x

x

x

x

x

x

x

Instruction vlseg4e8ff.v vlseg5e16.v vlseg5e16ff.v vlseg5e32.v vlseg5e32ff.v vlseg5e64.v vlseg5e64ff.v vlseg5e8.v vlseg5e8ff.v vlseg6e16.v vlseg6e16ff.v vlseg6e32.v

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

cp_misalignv_ls_element_misaligned

x

x

x

x

x

x

x

x

x

x

x

x

Instruction vlseg6e32ff.v vlseg6e64.v vlseg6e64ff.v vlseg6e8.v vlseg6e8ff.v vlseg7e16.v vlseg7e16ff.v vlseg7e32.v vlseg7e32ff.v vlseg7e64.v vlseg7e64ff.v vlseg7e8.v

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

cp_misalignv_ls_element_misaligned

x

x

x

x

x

x

x

x

x

x

x

x

Instruction vlseg7e8ff.v vlseg8e16.v vlseg8e16ff.v vlseg8e32.v vlseg8e32ff.v vlseg8e64.v vlseg8e64ff.v vlseg8e8.v vlseg8e8ff.v vlsseg2e16.v vlsseg2e32.v vlsseg2e64.v

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

cp_misalignv_ls_element_misaligned

x

x

x

x

x

x

x

x

x

x

x

x

Instruction vlsseg2e8.v vlsseg3e16.v vlsseg3e32.v vlsseg3e64.v vlsseg3e8.v vlsseg4e16.v vlsseg4e32.v vlsseg4e64.v vlsseg4e8.v vlsseg5e16.v vlsseg5e32.v vlsseg5e64.v

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

cp_misalignv_ls_element_misaligned

x

x

x

x

x

x

x

x

x

x

x

x

Instruction vlsseg5e8.v vlsseg6e16.v vlsseg6e32.v vlsseg6e64.v vlsseg6e8.v vlsseg7e16.v vlsseg7e32.v vlsseg7e64.v vlsseg7e8.v vlsseg8e16.v vlsseg8e32.v vlsseg8e64.v

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

cp_misalignv_ls_element_misaligned

x

x

x

x

x

x

x

x

x

x

x

x

Instruction vlsseg8e8.v vluxei16.v vluxei32.v vluxei64.v vluxei8.v vluxseg2ei16.v vluxseg2ei32.v vluxseg2ei64.v vluxseg2ei8.v vluxseg3ei16.v vluxseg3ei32.v vluxseg3ei64.v

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

cp_misalignv_ls_element_misaligned

x

x

x

x

x

x

x

x

x

x

x

x

Instruction vluxseg3ei8.v vluxseg4ei16.v vluxseg4ei32.v vluxseg4ei64.v vluxseg4ei8.v vluxseg5ei16.v vluxseg5ei32.v vluxseg5ei64.v vluxseg5ei8.v vluxseg6ei16.v vluxseg6ei32.v vluxseg6ei64.v

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

cp_misalignv_ls_element_misaligned

x

x

x

x

x

x

x

x

x

x

x

x

Instruction vluxseg6ei8.v vluxseg7ei16.v vluxseg7ei32.v vluxseg7ei64.v vluxseg7ei8.v vluxseg8ei16.v vluxseg8ei32.v vluxseg8ei64.v vluxseg8ei8.v vs1r.v vs2r.v vs4r.v

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

cp_misalignv_ls_element_misaligned

x

x

x

x

x

x

x

x

x

x

x

x

cp_misalignv_ls_wholereg_misaligned

x

x

x

Instruction vs8r.v vse16.v vse32.v vse64.v vse8.v vsm.v vsoxei16.v vsoxei32.v vsoxei64.v vsoxei8.v vsoxseg2ei16.v vsoxseg2ei32.v

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

cp_misalignv_ls_element_misaligned

x

x

x

x

x

x

x

x

x

x

x

x

cp_misalignv_ls_wholereg_misaligned

x

Instruction vsoxseg2ei64.v vsoxseg2ei8.v vsoxseg3ei16.v vsoxseg3ei32.v vsoxseg3ei64.v vsoxseg3ei8.v vsoxseg4ei16.v vsoxseg4ei32.v vsoxseg4ei64.v vsoxseg4ei8.v vsoxseg5ei16.v vsoxseg5ei32.v

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

cp_misalignv_ls_element_misaligned

x

x

x

x

x

x

x

x

x

x

x

x

Instruction vsoxseg5ei64.v vsoxseg5ei8.v vsoxseg6ei16.v vsoxseg6ei32.v vsoxseg6ei64.v vsoxseg6ei8.v vsoxseg7ei16.v vsoxseg7ei32.v vsoxseg7ei64.v vsoxseg7ei8.v vsoxseg8ei16.v vsoxseg8ei32.v

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

cp_misalignv_ls_element_misaligned

x

x

x

x

x

x

x

x

x

x

x

x

Instruction vsoxseg8ei64.v vsoxseg8ei8.v vsse16.v vsse32.v vsse64.v vsse8.v vsseg2e16.v vsseg2e32.v vsseg2e64.v vsseg2e8.v vsseg3e16.v vsseg3e32.v

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

cp_misalignv_ls_element_misaligned

x

x

x

x

x

x

x

x

x

x

x

x

Instruction vsseg3e64.v vsseg3e8.v vsseg4e16.v vsseg4e32.v vsseg4e64.v vsseg4e8.v vsseg5e16.v vsseg5e32.v vsseg5e64.v vsseg5e8.v vsseg6e16.v vsseg6e32.v

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

cp_misalignv_ls_element_misaligned

x

x

x

x

x

x

x

x

x

x

x

x

Instruction vsseg6e64.v vsseg6e8.v vsseg7e16.v vsseg7e32.v vsseg7e64.v vsseg7e8.v vsseg8e16.v vsseg8e32.v vsseg8e64.v vsseg8e8.v vssseg2e16.v vssseg2e32.v

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

cp_misalignv_ls_element_misaligned

x

x

x

x

x

x

x

x

x

x

x

x

Instruction vssseg2e64.v vssseg2e8.v vssseg3e16.v vssseg3e32.v vssseg3e64.v vssseg3e8.v vssseg4e16.v vssseg4e32.v vssseg4e64.v vssseg4e8.v vssseg5e16.v vssseg5e32.v

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

cp_misalignv_ls_element_misaligned

x

x

x

x

x

x

x

x

x

x

x

x

Instruction vssseg5e64.v vssseg5e8.v vssseg6e16.v vssseg6e32.v vssseg6e64.v vssseg6e8.v vssseg7e16.v vssseg7e32.v vssseg7e64.v vssseg7e8.v vssseg8e16.v vssseg8e32.v

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

cp_misalignv_ls_element_misaligned

x

x

x

x

x

x

x

x

x

x

x

x

Instruction vssseg8e64.v vssseg8e8.v vsuxei16.v vsuxei32.v vsuxei64.v vsuxei8.v vsuxseg2ei16.v vsuxseg2ei32.v vsuxseg2ei64.v vsuxseg2ei8.v vsuxseg3ei16.v vsuxseg3ei32.v

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

cp_misalignv_ls_element_misaligned

x

x

x

x

x

x

x

x

x

x

x

x

Instruction vsuxseg3ei64.v vsuxseg3ei8.v vsuxseg4ei16.v vsuxseg4ei32.v vsuxseg4ei64.v vsuxseg4ei8.v vsuxseg5ei16.v vsuxseg5ei32.v vsuxseg5ei64.v vsuxseg5ei8.v vsuxseg6ei16.v vsuxseg6ei32.v

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

cp_misalignv_ls_element_misaligned

x

x

x

x

x

x

x

x

x

x

x

x

Instruction vsuxseg6ei64.v vsuxseg6ei8.v vsuxseg7ei16.v vsuxseg7ei32.v vsuxseg7ei64.v vsuxseg7ei8.v vsuxseg8ei16.v vsuxseg8ei32.v vsuxseg8ei64.v vsuxseg8ei8.v

RV32

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

cp_misalignv_ls_element_misaligned

x

x

x

x

x

x

x

x

x

x

Table 287. MisalignV Normative Rules
Normative Rule Rule Text Coverpoints

vector_ls_misaligned_exception

If an element accessed by a vector memory instruction is not naturally aligned to the size of the element, either the element is transferred successfully or an address-misaligned exception is raised on that element.

{MisalignV_vle16_v_cg,MisalignV_vle32_v_cg,MisalignV_vle64_v_cg,MisalignV_vle8_v_cg}/{cp_misalignv_ls_element_misaligned}, {MisalignV_vse16_v_cg,MisalignV_vse32_v_cg,MisalignV_vse64_v_cg,MisalignV_vse8_v_cg}/{cp_misalignv_ls_element_misaligned}, {MisalignV_vlm_v_cg}/{cp_misalignv_ls_element_misaligned}, {MisalignV_vlse16_v_cg,MisalignV_vlse32_v_cg,MisalignV_vlse64_v_cg,MisalignV_vlse8_v_cg}/{cp_misalignv_ls_element_misaligned}, {MisalignV_vsm_v_cg}/{cp_misalignv_ls_element_misaligned}, {MisalignV_vsse16_v_cg,MisalignV_vsse32_v_cg,MisalignV_vsse64_v_cg,MisalignV_vsse8_v_cg}/{cp_misalignv_ls_element_misaligned}, {MisalignV_vle16ff_v_cg,MisalignV_vle32ff_v_cg,MisalignV_vle64ff_v_cg,MisalignV_vle8ff_v_cg}/{cp_misalignv_ls_element_misaligned}, {MisalignV_*_v_cg}/{cp_misalignv_ls_element_misaligned}

vector_ls_wholereg_misaligned_exception

Implementations are allowed to raise a misaligned address exception on whole register loads and stores if the base address is not naturally aligned to the larger of the size of the encoded EEW in bytes (EEW/8) or the implementation’s smallest supported SEW size in bytes (SEWMIN/8).

{MisalignV_vl1re16_v_cg,MisalignV_vl1re32_v_cg,MisalignV_vl1re64_v_cg,MisalignV_vl1re8_v_cg,MisalignV_vl2re16_v_cg,MisalignV_vl2re32_v_cg,MisalignV_vl2re64_v_cg,MisalignV_vl2re8_v_cg,MisalignV_vl4re16_v_cg,MisalignV_vl4re32_v_cg,MisalignV_vl4re64_v_cg,MisalignV_vl4re8_v_cg,MisalignV_vl8re16_v_cg,MisalignV_vl8re32_v_cg,MisalignV_vl8re64_v_cg,MisalignV_vl8re8_v_cg,MisalignV_vs1r_v_cg,MisalignV_vs2r_v_cg,MisalignV_vs4r_v_cg,MisalignV_vs8r_v_cg}/{cp_misalignv_ls_wholereg_misaligned}

vector_ls_scalar_misaligned_independence

Support for misaligned vector memory accesses is independent of an implementation’s support for misaligned scalar memory accesses.

See VECTOR_LS_MISALIGNED_EXCEPTION

vector_ls_scalar_misaligned_dependence

Vector misaligned memory accesses follow the same rules for atomicity as scalar misaligned memory accesses.

TODO

Zicclsm_misaligned_support

If the Zicclsm extension is implemented, then misaligned loads and stores to main memory regions with both the coherence and cacheability PMAs must be supported.

See VECTOR_LS_MISALIGNED_EXCEPTION

UDB Parameters: None.

B.9.2. SsstrictV Vector Strict Decoding

SsstrictV tests that reserved vector encodings trap when Ssstrict is implemented. It includes a comprehensive set of reserved overlapping register constraints. It also tests miscellaneous reserved conditions such as widening to unsupported SEWs, register groups not aligned to a multiple of LMUL, reserved mask overlaps, and constraints on vsetvl* operands.

Table 288. SsstrictV Coverpoints
Coverpoint Goal Feature Description Expectation Bins Normative Rule Pass/Fail Criteria Notes

cp_ssstrictv_widening_source_overlap

Confirm for every instruction with the .w* suffix (and widening reduction operations), that if vs1 and vs2 are the same register, the encoding is reserved

Run a widening instruction with sew = {supported}, lmul = {1/2/4}, vs2 = vs1 = v8
Crossing all lmul (except 8 as it implies an emul of 16) confirms that the overlap is recognized for all sizes of register groups and running with v8 keeps register group alignment and removes and possible conflicts with v0

trap

4 lmul bins

vreg_overlap_rsv
vreg_source_eew_rsv

spec: An encoding that would result in the same vector register being read with two or more different EEWs, including when the vector register appears at different positions within two or more vector register groups, is reserved.
EMUL_SEW_LMUL_dep; vreg_source_EEW_rsv; vtype-lmul_val; vwop_vd_eew_emul

cp_ssstrictv_all_widening_source_overlap

Confirm for a single instruction with the .w* suffix (and widening reduction operations), every combination of vs1 and vs2 across lmul = {1/2/4/8} is reserved

With a widdening instruction cross vs1 = {0-31} with vs2 = {0-31} and lmul = {1/2/4} with sew = {supported}
Crossing all lmul (except 8 as it implies an emul of 16) confirms that the overlap is recognized for all sizes of register groups. Although much trapping will occur because of incorrect register alignment, this simplifies both the writing of the coverpoint and testing

trap

32 vs1 x 32 vs2 x 4 lmul

does not depend on csr state: ? Don’t know if we need a cross across lmul
spec: An encoding that would result in the same vector register being read with two or more different EEWs, including when the vector register appears at different positions within two or more vector register groups, is reserved.
EEW; EEW_SEW_LMUL_dep; EMUL; EMUL_SEW_LMUL_dep; EMUL_rsv; vreg_overlap_rsv; vreg_source_EEW_rsv; vwop_vd_eew_emul

All vzext and vsext instructions ending in f2

cp_ssstrictv_vext2_overlapping_vd_vs2

Confirm that with zero and sign extending instructions ending in "f2," when the vs2 overlaps the bottom half of the vd register group the operation is illegal

Conduct a widening operation with lmul=2, vd group aligned and vs2 overlapping the bottom half of the vd register group (if lmul is 2 and vd = v0 then vs2 would be v0 for vzext.vf2).
If vd and vs2 registers must overlap in this manner it is illegal

trap

1

does not depend on csr state: Only if vd == vs2
spec: A destination vector register group can overlap a source vector register group only if one of the following holds:
The destination EEW is greater than the source EEW, the source EMUL is at least 1, and the overlap is in the highest-numbered part of the destination register group (e.g., when LMUL=8, vzext.vf4 v0, v6 is legal, but a source of v0, v2, or v4 is not).
EEW; EMUL; EMUL_SEW_LMUL_dep; vreg_lmulge2_op; vreg_overlap_legal; vreg_overlap_rsv; vsext_op; vsext_vd_eew_emul; vsext_vs_eew_emul; vzext_op; vzext_vd_eew_emul; vzext_vs_eew_emul

All vzext and vsext instructions ending in f4

cp_ssstrictv_vext4_overlapping_vd_vs2

Confirm that with zero and sign extending instructions ending in "f4," when the vs2 overlaps the bottom 3/4 of the vd register group the operation is illegal

Conduct a widening operation with lmul=4, vd group aligned and vs2 overlapping the bottom 3/4 of the vd register group (if lmul is 4 and vd = v0 then vs2 could be v0, v1, or v2 for vzext.vf4).
If the vd and vs2 registers overlap in this manner it is illegal

trap

1

does not depend on csr state: Only if vd == vs2
spec: A destination vector register group can overlap a source vector register group only if one of the following holds:
The destination EEW is greater than the source EEW, the source EMUL is at least 1, and the overlap is in the highest-numbered part of the destination register group (e.g., when LMUL=8, vzext.vf4 v0, v6 is legal, but a source of v0, v2, or v4 is not).
EEW; EMUL; EMUL_SEW_LMUL_dep; vreg_overlap_legal; vreg_overlap_rsv; vsext_op; vsext_vd_eew_emul; vsext_vs_eew_emul; vzext_op; vzext_vd_eew_emul; vzext_vs_eew_emul

All vzext and vsext instructions ending in f8

cp_ssstrictv_vext8_overlapping_vd_vs2

Confirm that with zero and sign extending instructions ending in "f8," when the vs2 overlaps the bottom 7/8 of the vd register group the operation is illegal

Conduct a widening operation with lmul=8, vd group aligned and vs2 overlapping the bottom 7/8 of the vd register group (if lmul is 8 and vd = v0 then vs2 could be v{0-6} for vzext.vf8).
If the vd and vs2 registers must overlap in this manner it is illegal

trap

1

does not depend on csr state: Only if vd == vs2
spec: A destination vector register group can overlap a source vector register group only if one of the following holds:
The destination EEW is greater than the source EEW, the source EMUL is at least 1, and the overlap is in the highest-numbered part of the destination register group (e.g., when LMUL=8, vzext.vf4 v0, v6 is legal, but a source of v0, v2, or v4 is not).
EEW; EMUL; EMUL_rsv; vreg_overlap_legal; vreg_overlap_rsv; vsext_op; vsext_vd_eew_emul; vsext_vs_eew_emul; vzext_op; vzext_vd_eew_emul; vzext_vs_eew_emul

All widening instructions except reduction

cp_ssstrictv_vwiden_overlapping_vd_vs1_lmul1

Confirm that with widening instructions (must end in .v*) vs1 = vd is illegal

Conduct a widening operation with lmul=1, vs1 = vd and vd group aligned. vs2 should not overlap vd
The vd and vs1 register groups overlapping in this manner is illegal

trap

1

spec: A destination vector register group can overlap a source vector register group only if one of the following holds:
The destination EEW is greater than the source EEW, the source EMUL is at least 1, and the overlap is in the highest-numbered part of the destination register group (e.g., when LMUL=8, vzext.vf4 v0, v6 is legal, but a source of v0, v2, or v4 is not).
vreg_overlap_legal; vreg_overlap_rsv; vwop_vd_eew_emul

cp_ssstrictv_vwiden_overlapping_vd_vs2_lmul1

Confirm that with widening instructions (must end in .v*) vs2 = vd is illegal

Conduct a widening operation with lmul=1, vs2 = vd and vd group aligned. vs1 should not overlap vd
The vd and vs2 register groups overlapping in this manner is illegal

trap

1

spec: A destination vector register group can overlap a source vector register group only if one of the following holds:
The destination EEW is greater than the source EEW, the source EMUL is at least 1, and the overlap is in the highest-numbered part of the destination register group (e.g., when LMUL=8, vzext.vf4 v0, v6 is legal, but a source of v0, v2, or v4 is not).
EEW; EMUL; vreg_overlap_legal; vreg_overlap_rsv; vwop_vd_eew_emul

cp_ssstrictv_vwidenw_overlapping_vd_vs1_lmul1

Confirm that with widening instructions (must end in .w*) vs1 = vd is illegal

Conduct a widening operation with lmul=1, vs1 = vd and vd group aligned. vs2 should not overlap vd
The vd and vs1 register groups overlapping in this manner is illegal

trap

1

spec: A destination vector register group can overlap a source vector register group only if one of the following holds:
The destination EEW is greater than the source EEW, the source EMUL is at least 1, and the overlap is in the highest-numbered part of the destination register group (e.g., when LMUL=8, vzext.vf4 v0, v6 is legal, but a source of v0, v2, or v4 is not).
vreg_overlap_legal; vreg_overlap_rsv; vwop_vd_eew_emul

All narrowing instructions

cp_ssstrictv_vnarrow_overlapping_vd_vs2

Confirm that with narrowing instructions, vs2 = vd is illegal

Conduct a narrowing operation with lmul=1, vs1 = vd and vs2 group aligned. vs2 should not overlap vs1
The vd and vs2 register groups overlapping in this manner is illegal

trap

1

vfncvt_vreg_constr

spec: The destination EEW is smaller than the source EEW and the overlap is in the lowest-numbered part of the source register group (e.g., when LMUL=1, vnsrl.wi v0, v0, 3 is legal, but a destination of v1 is not).
vnarrowing_EEW; vnarrowing_EMUL; vreg_overlap_legal; vreg_overlap_rsv

cp_ssstrictv_widening_vd_emul_16

Confirm that with all widening instructions (ending in .v* and .w* excluding the widening reduction instructions) that EMUL>=16 traps

Set sew = {supported} and lmul = {8} and confirm that the instruction traps
sew needs to be supported to ensure the instruction does not trap due to vill, lmul of 8 will imply an emul of 16 with widening instructions

trap

1

spec: The largest vector register group used by an instruction can not be greater than 8 vector registers (i.e., EMUL≤8), and if a vector instruction would require greater than 8 vector registers in a group, the instruction encoding is reserved. For example, a widening operation that produces a widened vector register group result when LMUL=8 is reserved as this would imply a result EMUL=16.
EMUL_SEW_LMUL_dep; EMUL_rsv; vwop_vd_eew_emul

cp_ssstrictv_narrowing_vs2_emul_16

Confirm that with all narrowing instructions that EMUL>=16 traps

Set sew = {supported} and lmul = {8} and confirm that the instruction traps
sew needs to be supported to ensure the instruction does not trap due to vill, lmul of 8 will imply an emul of 16 with narrowing instructions

trap

1

spec: The largest vector register group used by an instruction can not be greater than 8 vector registers (i.e., EMUL≤8), and if a vector instruction would require greater than 8 vector registers in a group, the instruction encoding is reserved. For example, a widening operation that produces a widened vector register group result when LMUL=8 is reserved as this would imply a result EMUL=16.
EMUL_rsv; vnarrowing_EEW; vnarrowing_EMUL

cp_ssstrictv_widening_vd_sew_eq_elen

Confirm for all widening instructions (.v*, .w* and reduction) that if SEW=ELEN the instruction traps

Set sew = {8,16,32,64} and lmul = {1}, vd = 8, vs2 = 10, vs1 = 12
Attempt to set all sew as this is simpler than figuring out SEW_MAX, the instruction should only trap for the highest SEW. Registers were chosen to ensure the instruction does not trap due to register overlap

trap

4 sew bins

spec: EEW; ELEN; EMUL_SEW_LMUL_dep; RESERVED_VILL_SET; V_supported_eew; vnarrowing_EEW; vnarrowing_EMUL; vreduction_trap; vwop_vd_eew_emul

cp_ssstrictv_narrowing_vs2_sew_eq_elen

Confirm for all narrowing instructions that if SEW=ELEN the instruction traps

Set sew = {8,16,32,64} and lmul = {1}, vd = 8, vs2 = 10, vs1 = 12
Attempt to set all sew as this is simpler than figuring out SEW_MAX, the instruction should only trap for the highest SEW. Registers were chosen to ensure the instruction does not trap due to register overlap

trap

4 sew bins

spec: ELEN; V_supported_eew; Zve_eew; vnarrowing_EEW; vnarrowing_EMUL; vnclip_op; vnclipu_op; vnop_vs2_eew_emul; vnsra_op; vnsrl_op; vtype-sew_val

cp_ssstrictv_vrgather_vd_vs1_eq

Confirm for vrgather instructions that if vs1 and vd overlap that the encoding is reserved

Set vs1 = vd = {v0-28} and lmul = 4 with vs2 not overlapping
vs2 not overlapping ensures that the encoding is reserved due to vs1 not vs2, lmul of 4 ensures vrgatherei16 won’t be reserved due to emul

trap

8 register bins

spec: For any vrgather instruction, the destination vector register group cannot overlap with the source vector register groups, otherwise the instruction encoding is reserved.
vreg_overlap_rsv; vrgather_vreg_constr; vrgatherei16_vreg_constr

cp_ssstrictv_vrgather_vd_vs2_eq

Confirm for vrgather.v* instructions that if vs2 and vd overlap that the encoding is reserved

Set vs2 = vd = {v0-28} and lmul = 4 with vs1 not overlapping
vs1 not overlapping ensures that the encoding is reserved due to vs2 not vs1, lmul of 4 ensures vrgatherei16 won’t be reserved due to emul

trap

8 register bins

spec: For any vrgather instruction, the destination vector register group cannot overlap with the source vector register groups, otherwise the instruction encoding is reserved.
vreg_overlap_rsv; vrgather_vreg_constr; vrgatherei16_vreg_constr

cp_ssstrictv_vrgatherei16_emul_16

Confirm if vrgatherei16 implies an emul of 16 the encoding is reserved

run lmul = 8 and sew = 8 and vd != vs1 and vd != vs2 (all group aligned)
lmul = 8 and sew = 8 are the only values that can produce an emul of 16. Register restrictions ensure that encoding isn’t reserved for other reasons

trap

1

spec: The vrgather.vv form uses SEW/LMUL for both the data and indices. The vrgatherei16.vv form uses SEW/LMUL for the data in vs2 but EEW=16 and EMUL = (16/SEW)*LMUL for the indices in vs1
EMUL_rsv; vrgatherei16-vv_sew_lmul

cp_ssstrictv_vrgatherei16_emul_f16

Confirm if vrgatherei16 implies an emul of 1/16 the encoding is reserved

run {lmul, sew} = {(1/8, 32), (1/4, 64)} and vd != vs1 and vd != vs2 (all group aligned)
These are the two situations that produce an emul = 1/16. Register restrictions ensure that encoding isn’t reserved for other reasons

trap

2 lmul&sew combined bins

spec: The vrgather.vv form uses SEW/LMUL for both the data and indices. The vrgatherei16.vv form uses SEW/LMUL for the data in vs2 but EEW=16 and EMUL = (16/SEW)*LMUL for the indices in vs1
EMUL_SEW_LMUL_dep; EMUL_rsv; vrgatherei16-vv_sew_lmul

cp_ssstrictv_masking_vd_eq_v0

Confirm for a "masked vector instruction" that vd = v0 is reserved

Run a masked vector instruction (mask enabled) with lmul = 1 and vd = v0, vd != vs1, vd != vs2, vs2 != vs1
run with lmul of 1 to ensure all other vector registers are on group and the instruction is not reserved for that reason (same with registers equaling each other)

trap

1

vadc_vsbc_vd_v0_rsv
vreg_vmask_rsv
vmfeq_vmfne_vmflt_vmfle_vmfgt_vmfge_vd_eq_v0
vreg_mask_overlap
vmsbf_vreg_constr
vmsif_vreg_constr
vmsof_vreg_constr
viota_vreg_constr

does not depend on csr state: (I think, github issue says its wrong, but vm is part of the instruction)
spec: The destination vector register group for a masked vector instruction cannot overlap the source mask register (v0), unless the destination vector register is being written with a mask value (e.g., compares) or the scalar result of a reduction. These instruction encodings are reserved.
V_masked; vreg_overlap_rsv; vreg_vmask; vreg_vmask_rsv

cp_ssstrict_ls_nf_eew

Confirm any NFIELDS * EEW violation is checked, run on all instructions with nf and eew

Run segment load/store instructions with NFIELDS and EEW combinations where NFIELDS * EEW exceeds the implementation limit, across all segment load/store instruction variants

trap

spec: The EMUL setting must be such that EMUL * NFIELDS ≤ 8, otherwise the instruction encoding is reserved.
EMUL_NFIELDS_rsv; NFIELDS; vector_ls_EEW; vector_ls_EMUL; vector_ls_seg_indexed_EMUL_NFIELDS_val

cp_ssstrictv_masking_vd_eq_v0_lmulgt1

Confirm for a masked vector instruction that vd = v0 with LMUL > 1 is reserved

Run a masked vector instruction (mask enabled) with lmul = {2, 4, 8} and vd = v0, vd != vs1, vd != vs2, vs2 != vs1
Complements cp_ssstrictv_masking_vd_eq_v0 (LMUL=1) by testing higher LMUL values where the vd register group still overlaps v0

trap

3 lmul bins

does not depend on csr state: ? Isn’t this masking_vd_eq_v0
spec: LMUL; V_masked; vreg_overlap_rsv; vreg_vmask; vreg_vmask_rsv; vtype-lmul_val

cp_ssstrictv_ls_seg_vd_overflow

Confirm segment load/store traps when register numbers increment past 31

Run a segment load/store with LMUL=1 and NFIELDS/vd combinations where vd + NFIELDS > 32 (e.g., NFIELDS=2 vd=31, NFIELDS=4 vd=29, NFIELDS=8 vd=25)

trap

7 nf/vd overflow bins

emul_nfields_rsv
vector_ls_seg_rsv
vector_ls_seg_indexed_emul_nfields_val

cp_ssstrictv_ls_seg_idx_vd_vs2_overlap

Confirm indexed segment load traps when destination groups overlap vs2 index register

Run an indexed segment load with LMUL=1 and vd=8, with vs2 set to each destination register in the segment range (vs2=vd through vs2=vd+NFIELDS-1) across NFIELDS=2..8

trap

8 nf/vd/vs2 overlap bins

vector_ls_seg_indexed_vreg_rsv

spec: vector_ls_seg_indexed_vreg_rsv; vreg_overlap_rsv

cp_ssstrictv_ls_wr_nf_reserved

Confirm whole register load/store traps for non-power-of-2 nf and unaligned vd

Run a whole register load/store with nf encoding non-power-of-2 register counts (NREG=3,5,6,7). Also run with valid NREG (2,4,8) but vd not aligned to NREG

trap

4 non-pow2 nf bins + 16 vd off-group (NREG=2) + 24 vd off-group (NREG=4) + 28 vd off-group (NREG=8)

spec: vector_ls_seg_wholereg_nf_rsv; vector_wholels_nf_op; vmv-nr-r_nreg_rsv; vmv-nr-r_unaligned_rsv

cp_ssstrictv_vfp_frm_reserved

Confirm vector FP instructions trap when frm contains reserved rounding mode

Run a vector floating-point instruction with frm set to each invalid rounding mode (5, 6, 7). Also run with vl=0 and with vstart >= vl to confirm the reservation applies regardless of element activity

trap

3 frm bins x 3 conditions (normal / vl=0 / vstart>=vl)

spec: V_fp_frm; V_inv_frm_rsv

cp_ssstrictv_vfp_eew_unsupported

Confirm vector FP instructions trap when operand EEW is not a supported FP type width

Run a vector FP instruction with SEW=8 (never a valid FP width). Also run with SEW=64 when FLEN=32 (no D extension). Test under normal conditions, with vl=0, and with vstart >= vl

trap

1-2 sew bins x 3 conditions (normal / vl=0 / vstart>=vl)

spec: V_fp_EEW_IEEE_nsupported_rsv; V_fp_eew_rsv; vstart_vl_dep; vtype-vill_op; vtype-vill_set

cp_ssstrictv_vzext_src_reserved

Confirm vzext instructions trap when source EEW is unsupported or source EMUL is below minimum

Run vzext.vf2/vf4/vf8 with SEW/LMUL combinations where source EEW (SEW/N) < 8 or source EMUL (LMUL/N) < 1/8. For vf2: SEW=8 or LMUL=mf8. For vf4: SEW⇐16 or LMUL⇐mf4. For vf8: SEW⇐32 or LMUL⇐mf2

trap

3 src_eew crosses (1+2+3 sew bins) + 3 src_emul crosses (1+2+3 lmul bins)

spec: RESERVED_VILL_SET; V_supported_eew; vzext_ill_eew_emul_rsv; vzext_vs_eew_emul

cp_ssstrictv_vadc_vsbc_vm1_reserved

Confirm vadc/vsbc trap when encoded with vm=1 (unmasked)

Run a vadc or vsbc instruction with vm=1 (the reserved unmasked encoding)

trap

2 funct6 bins (vadc and vsbc) x vm=1

vadc_vsbc_unmasked_rsv

spec: vadc_unmasked_rsv; vsbc_unmasked_rsv

cp_ssstrictv_vadc_vsbc_vd_v0_reserved

Confirm vadc/vsbc trap when vd is v0

Run a vadc or vsbc instruction with the destination register set to v0

trap

2 funct6 bins (vadc and vsbc) x vd=v0

does not depend on csr state: ? Isn’t this covered by the general masking case?
spec: vadc_vd_v0_rsv; vsbc_vd_v0_rsv

cp_ssstrictv_vmv_vs2_not_v0_reserved

Confirm vmv.v.v traps when vs2 is not v0

Run a vmv.v.v instruction with vs2 set to any register other than v0

trap

31 vs2 bins (v1-v31)

vmv_vs2_nv0_rsv

spec: vmv_vs2_nv0_rsv

cp_ssstrictv_vfp_widen_eew_unsupported

Confirm widening/narrowing FP instructions trap when wider operand EEW is not a supported FP type

Run a widening or narrowing vector FP instruction with SEW=32 when FLEN=32 (no D extension), so the wider operand EEW=64 is unsupported. Test under normal conditions, with vl=0, and with vstart >= vl

trap

1 sew bin x 3 conditions (normal / vl=0 / vstart>=vl)

spec: V_dependent_F_D; V_fp_EEW_IEEE_nsupported_rsv; V_fp_eew_rsv; Vf_requrires_Vx; Zve32f_dependent_F; vstart_vl_dep; vwop_vd_eew_emul

cp_ssstrictv_vfmv_vs2_not_v0_reserved

Confirm vfmv.v.f traps when vs2 is not v0

Run a vfmv.v.f instruction with vs2 set to any register other than v0

trap

31 vs2 bins (v1-v31)

vfmv_vs2_nv0_rsv

spec: epc_op_V_trap; vfmv_vs2_nv0_rsv; vstart_op_V_trap

cp_ssstrictv_mask_logical_vm0_reserved

Confirm mask logical instructions trap when vm=0

Run a vector mask logical instruction (vmand/vmnand/vmandn/vmxor/vmor/vmnor/vmorn/vmxnor) with vm=0 (masked encoding)

trap

8 funct6 bins x vm=0

vmasklogical_masked_rsv

spec: vmasklogical_masked_rsv; vmasklogical_unmasked

cp_ssstrictv_vid_vs2_not_v0_reserved

Confirm vid.v traps when vs2 is not v0

Run a vid.v instruction with vs2 set to any register other than v0

trap

31 vs2 bins (v1-v31)

vid_vs2_nv0_rsv

spec: vid_vs2_nv0_rsv

cp_ssstrictv_vmv_xs_sx_vm0_reserved

Confirm vmv.x.s and vmv.s.x trap when vm=0

Run a vmv.x.s or vmv.s.x instruction with vm=0 (masked encoding)

trap

2 funct3 bins x vm=0

vmv-s-x_vmv-x-s_masked_rsv

spec: vmv-s-x_masked_rsv; vmv-x-s_masked_rsv

cp_ssstrictv_vfmv_fs_sf_vm0_reserved

Confirm vfmv.f.s and vfmv.s.f trap when vm=0

Run a vfmv.f.s or vfmv.s.f instruction with vm=0 (masked encoding)

trap

2 funct3 bins x vm=0

vfmv-s-f_masked_rsv

spec: vfmv-s-f_masked_rsv

cp_ssstrictv_vslideup_vd_vs2_overlap

Confirm vslideup traps when destination register group overlaps source register group

Run a vslideup instruction where the vd register group overlaps the vs2 register group, at each LMUL={1,2,4,8}

trap

4 LMUL bins (1 overlap per LMUL)

vslideup_vreg_constr

does not depend on csr state: Only vd = vs1, nothing to do with lmul overlaps

cp_ssstrictv_vrgather_vd_vs2_overlap

Confirm vrgather traps when destination register group overlaps vs2 register group

Run a vrgather instruction where the vd register group overlaps the vs2 register group, at each LMUL={1,2,4,8}

trap

4 LMUL bins (1 overlap per LMUL)

vrgather_vrgatherei16_vreg_constr

does not depend on csr state: Only vd = vs1, nothing to do with lmul overlaps
spec: LMUL; vreg_overlap_rsv; vrgather_vreg_constr

cp_ssstrictv_vrgather_vd_vs1_overlap

Confirm vrgather.vv traps when destination register group overlaps vs1 register group

Run a vrgather.vv instruction where the vd register group overlaps the vs1 register group, at each LMUL={1,2,4,8}

trap

4 LMUL bins (1 overlap per LMUL)

does not depend on csr state: Only vd = vs1, nothing to do with lmul overlaps

cp_ssstrictv_vcompress_vd_vs2_overlap

Confirm vcompress traps when destination register group overlaps source register group

Run a vcompress instruction where the vd register group overlaps the vs2 register group, at each LMUL={1,2,4,8}

trap

4 LMUL bins (1 overlap per LMUL)

vcompress_vreg_constr

does not depend on csr state: Only vd = vs1, nothing to do with lmul overlaps
spec: LMUL; vcompress_vreg_constr; vreg_lmulge2_op; vreg_overlap_rsv

cp_ssstrictv_vcompress_vd_v0_overlap

Confirm vcompress traps when destination register group overlaps source mask register (v0)

Run a vcompress instruction where the vd register group overlaps v0 (the source mask register), at each LMUL={1,2,4,8}

trap

4 LMUL bins (vd=v0 at each LMUL)

does not depend on csr state: Only vd = v0, nothing to do with lmul overlaps

cp_ssstrictv_vmvnr_simm_reserved

Confirm whole register move traps when simm[4:0] is a reserved value

Run a vmv<nr>r.v instruction with simm[4:0] set to a value other than 0/1/3/7 (the reserved encodings)

trap

28 reserved simm bins (all simm values except 0/1/3/7)

vmv-nr-r_nreg_rsv
vmv-nr-r_enc

spec: epc_op_V_trap; vmv-nr-r_nreg_rsv; vstart_op_V_trap

cp_ssstrictv_vmvnr_reg_align

Confirm whole register move traps when both vd and vs2 are misaligned for the register group size

Run vmv2r.v/vmv4r.v/vmv8r.v with both vd and vs2 unaligned for the NREG group size (not divisible by NREG)

trap

3 NREG variants x all unaligned vd x all unaligned vs2

spec: vmv-nr-r_unaligned_rsv; vmv-nr-r_vreg_constr; vreg_offgroup_LMUL2_rsv; vreg_offgroup_LMUL4_rsv; vreg_offgroup_LMUL8_rsv

cp_ssstrictv_vcsr_reserved_bits

Confirm vcsr top XLEN-3 bits are reserved and read as zero

Write vcsr via CSRRx with non-zero values in bits [XLEN-1:3], confirm they read back as zero

no trap

1 bin (upper bits zero after write with non-zero source)

does not depend on csr state: ? is this Ssstrict, should we be testing WARL?
spec: vcsr-vxrm_acc; vcsr-vxsat_acc

cp_ssstrictv_masking_vd_v0_overlap

Confirm masked vector instruction traps when vd=v0 at any LMUL

Run a masked vector instruction with vd=v0 at each LMUL={1,2,4,8} where vd != vs1 and vd != vs2

trap

4 LMUL bins (vd=v0 masked at each LMUL)

does not depend on csr state: Again?

cp_ssstrictv_lmulgt1_off_group

Confirm vector instructions trap when register specifier is not aligned to LMUL group size

Run a vector instruction with LMUL={2,4,8} where vd, vs1, or vs2 is not aligned to the register group size (e.g., odd register for LMUL=2)

trap

9 crosses: 3 LMUL values x 3 register operands (vd, vs1, vs2), each with all unaligned registers

spec: EMUL_offgroup_rsv; vreg_offgroup_LMUL2_rsv; vreg_offgroup_LMUL4_rsv; vreg_offgroup_LMUL8_rsv

cp_ssstrictv_ls_eew_2x_elen

Confirm that all load/store trap when violating EEW = 2 * ELEN

Run vector load/store instructions with EEW encoded in the width field set to 2 * ELEN (e.g., if ELEN=64, attempt EEW=128 encoding)

trap

spec: Vector loads and stores have an EEW encoded directly in the instruction. If the EEW is not a supported width, the instruction encoding is reserved.
vector_ls_EEW; vector_ls_ins_rsv; vector_ls_mew_rsv

cp_ssstrictv_ls_emul_16

Confirm that all load/store trap when EMUL = 16

Run vector load/store instructions with SEW/LMUL/EEW combinations producing (EEW/SEW)*LMUL = 16 (e.g., EEW=64, SEW=8, LMUL=2)

trap

spec: If the EMUL would be out of range (EMUL>8 or EMUL<1/8), the instruction encoding is reserved
EEW_SEW_LMUL_dep; EMUL_SEW_LMUL_dep; EMUL_rsv; vector_ls_EMUL; vector_ls_EMUL_rsv

cp_ssstrictv_ls_emul_f16

Confirm that all load/store trap when EMUL = 1/16

Run vle8/vse8 with {SEW=16/LMUL=1/8, SEW=32/LMUL=1/4, SEW=64/LMUL=1/2} to produce EMUL=1/16 (out of range, must trap)

trap

3 SEW/LMUL bins

spec: If the EMUL would be out of range (EMUL>8 or EMUL<1/8), the instruction encoding is reserved
EEW_SEW_LMUL_dep; EMUL_SEW_LMUL_dep; vector_ls_EMUL; vector_ls_EMUL_rsv

cp_ssstrictv_ls_emul_nfields_16

Confirm that using 16 registers with strided instructions is reserved

Run segment load/store instructions with EMUL and NFIELDS combinations where EMUL * NFIELDS > 8 (e.g., EMUL=2, NFIELDS=5)

trap

spec: The EMUL setting must be such that EMUL * NFIELDS ≤ 8, otherwise the instruction encoding is reserved.
EMUL_NFIELDS_rsv

cp_ssstrictv_vslide1up_vd_vs2_overlap

Confirm vslide1up traps when destination register group overlaps source register group

Run vslide1up.vx with LMUL={1,2,4,8} where vd register group overlaps vs2 register group

trap

4 crosses: LMUL=1 (vd==vs2), LMUL=2 (group overlap), LMUL=4 (group overlap), LMUL=8 (group overlap)

vslide1up-vx_vreg_constr

spec: The vslide1up instruction requires that the destination vector register group does not overlap the source vector register group. Otherwise the instruction encoding is reserved.
LMUL; epc_op_V_trap; vreg_overlap_rsv; vslide1up-vx_vreg_constr; vstart_op_V_trap

cp_ssstrictv_vcompress_vstart_nonzero

Confirm that vcompress with non-zero vstart raises an illegal instruction exception

Run a vcompress instruction with vstart != 0

trap

1 cross: vstart nonzero × trap × vcompress encoding

spec: Executing a vcompress instruction with a non-zero vstart raises an illegal instruction exception.
vcompress_trap; vcompress_vstart_n0_ill

cp_ssstrictv_vcompress_vstart_report_zero

Confirm that a trap on vcompress is always reported with vstart of 0

Run a vcompress instruction that traps and verify vstart is 0 after the trap

trap

1 cross: vcompress encoding × trap × vstart=0 after

does not depend on csr state: Put this in ExcpetionsVx
spec: A trap on a vcompress instruction is always reported with a vstart of 0.
vcompress_trap; vstart_op_V_trap

cp_ssstrictv_vmvnr_off_group

Confirm that vmv<nr>r.v instructions trap with off-group base registers

Run vmv2r.v, vmv4r.v, vmv8r.v with vd or vs2 not aligned to NREG.
For vmv2r.v: vd or vs2 must be divisible by 2
For vmv4r.v: vd or vs2 must be divisible by 4
For vmv8r.v: vd or vs2 must be divisible by 8

trap

16 vd off-group + 24 vs2 off-group

spec: Whole register move: The source and destination vector register numbers must be aligned appropriately for the vector register group size, and encodings with other vector register numbers are reserved.
RESERVED_VILL_SET; vmv-nr-r_unaligned_rsv; vmv-nr-r_vreg_constr; vreg_offgroup_LMUL2_rsv; vreg_offgroup_LMUL4_rsv; vreg_offgroup_LMUL8_rsv

cp_ssstrictv_ls_seg_idx_vd_vs2_grp_overlap

Confirm that indexed segment loads with EMUL>1 trap when any destination register group overlaps the vs2 index register group

Set LMUL=2 and execute an indexed segment load where vs2 falls within one of the destination register groups (each spanning EMUL=2 registers)

trap

8 overlap scenarios across nf=2/3/4

spec: For vector indexed segment loads, the destination vector register groups cannot overlap the source vector register group (specified by vs2), else the instruction encoding is reserved.
vector_ls_seg_indexed_vreg_rsv; vreg_overlap_rsv

cp_ssstrictv_reserved_vcsrs

Confirm CSR addresses 0x00B-0x00E raise illegal instruction exceptions

Attempt to read/write CSR addresses 0x00B, 0x00C, 0x00D, 0x00E (reserved for future vector CSRs) and confirm each raises an illegal instruction trap

trap

4 CSR address bins

cp_ssstrictv_vsetvli_reserved_vsew

Confirm vsetvli/vsetivli with vsew[2:0] = 1xx sets vill

Run vsetvli or vsetivli with vsew field set to 3’b100, 3’b101, 3’b110, 3’b111 (reserved encodings) and verify vill is set to 1

vill set

4 vsew bins

does not depend on csr state: This is not part of Ssstrict
spec: vset_op; vtype-vill_set; vtype-vsew_rsv; vtype_acc

cp_ssstrictv_vsetvli_lmul_sew_ratio

Confirm vsetvli with unsupported LMUL/SEW ratio sets vill

Run vsetvli with LMUL and SEW combinations where LMUL < minSEW/ELEN (the ratio is unsupported), and verify vill is set

vill set

Cross of all LMUL x SEW combinations

does not depend on csr state: This is not part of Ssstrict
spec: vset_op; vtype-lmul_fval_rsv; vtype-sew_val; vtype-vill_set

cp_ssstrictv_ls_eew_lt_sewmin

Confirm vector load/store instructions trap when EEW < SEWMIN

Execute a vector load/store instruction with EEW (encoded in width field) smaller than the minimum supported SEW (SEWMIN). For example, vle8.v when SEWMIN > 8

trap

Should trap as reserved encoding

vector_ls_ins_rsv

does not depend on csr state: Specifically, we can test things like vle8, where the width is part of the instruction
spec: Vector loads and stores have an EEW encoded directly in the instruction. If the EEW is not a supported width, the instruction encoding is reserved.
Zve_eew; vector_ls_EEW; vector_ls_EEW_rsv; vector_ls_ins_req; vector_ls_ins_rsv

cp_ssstrictv_ls_mew_reserved

Confirm vector load/store instructions trap when mew bit is set

Run a vector load or store instruction with mew=1 (bit 28 of instruction) and confirm the encoding is reserved

trap

1 bin

vector_ls_mew_rsv

spec: vector_ls_mew_rsv

cp_ssstrictv_vzext_vf2_reserved

Confirm vzext.vf2 traps when source EEW < 8 or source EMUL < 1/8

Run vzext.vf2 with SEW=8 (source EEW=4, unsupported). Also run with LMUL=mf8 (source EMUL=1/16, below minimum)

trap

1 sew bin + 1 lmul bin

spec: RESERVED_VILL_SET; V_supported_eew; vtype-lmul_fval; vzext_ill_eew_emul_rsv; vzext_vs_eew_emul

cp_ssstrictv_vzext_vf4_reserved

Confirm vzext.vf4 traps when source EEW < 8 or source EMUL < 1/8

Run vzext.vf4 with SEW=8 (EEW=2) or SEW=16 (EEW=4). Also run with LMUL=mf8 (EMUL=1/32) or LMUL=mf4 (EMUL=1/16)

trap

2 sew bins + 2 lmul bins

spec: EMUL_rsv; RESERVED_VILL_SET; Zve_eew; vzext_ill_eew_emul_rsv; vzext_vs_eew_emul

cp_ssstrictv_vzext_vf8_reserved

Confirm vzext.vf8 traps when source EEW < 8 or source EMUL < 1/8

Run vzext.vf8 with SEW=8 (EEW=1) or SEW=16 (EEW=2) or SEW=32 (EEW=4). Also run with LMUL=mf8 (EMUL=1/64) or LMUL=mf4 (EMUL=1/32) or LMUL=mf2 (EMUL=1/16)

trap

3 sew bins + 3 lmul bins

spec: EMUL_rsv; RESERVED_VILL_SET; epc_op_V_trap; vtype-vill_op; vzext_ill_eew_emul_rsv; vzext_vs_eew_emul

cp_ssstrictv_vcompress_vm0_reserved

Confirm vcompress traps when vm=0

Run a vcompress instruction with vm=0 (masked encoding)

trap

1 funct6 x funct3 x vm=0

vcompress_masked_rsv
vcompress_enc

spec: vcompress_enc; vcompress_masked_rsv

cp_ssstrictv_vsext_src_reserved

Confirm vsext.vfN instructions trap when source EEW or source EMUL is out of range

Run vsext.vf2/vf4/vf8 with SEW values where source EEW = SEW/N < 8, or with fractional LMUL values where source EMUL = LMUL/N < 1/8

trap

6 crosses: 3 variants x 2 conditions (bad EEW, bad EMUL)

spec: The source EEW is smaller than SEW and the source EMUL is correspondingly smaller than LMUL. If the source EEW is not a supported SEW or the source EMUL would be below the minimum legal LMUL the instruction encoding is reserved.
RESERVED_VILL_SET; V_supported_eew; vsext_ill_eew_emul_rsv; vsext_vs_eew_emul

cp_ssstrictv_ext_emul_lt1_overlap

Confirm vzext/vsext instructions trap when source EMUL < 1 and vs2 overlaps vd group

Run vzext/vsext.vf2 with LMUL=1, vf4 with LMUL={1,2}, vf8 with LMUL={1,2,4} where source EMUL < 1 and vs2 overlaps the destination register group

trap

6 crosses: vf2 at LMUL=1, vf4 at LMUL={1,2}, vf8 at LMUL={1,2,4} each with overlap

spec: EMUL; EMUL_SEW_LMUL_dep; vreg_overlap_rsv; vsext_ill_eew_emul_rsv; vsext_op; vsext_vs_eew_emul; vzext_ill_eew_emul_rsv; vzext_op; vzext_vs_eew_emul

cp_ssstrictv_widen_max_sew

Confirm all widening instructions trap when SEW equals ELEN so destination EEW = 2*SEW exceeds ELEN

Run a widening instruction with SEW = {all supported} and LMUL = {1, 2, 4}; the instruction should trap only when SEW = MAX_SEW (destination EEW = 2*SEW > ELEN), including widening reductions

trap

all supported SEW x 3 LMUL bins

spec: The destination EEW must be a supported element width. For widening operations destination EEW = 2*SEW; when SEW = ELEN this exceeds the maximum supported element width and the instruction encoding is reserved.
ELEN; V_fp_EEW_IEEE_nsupported_rsv; V_supported_eew; epc_op_V_trap; vfwredosum_op; vfwredusum_op; vstart_op_V_trap; vwop_vd_eew_emul; vwredsum_op; vwredsumu_op

cp_ssstrictv_vsetvli_x0_x0_reserved

Confirm vsetvl{i} with rs1=x0 rd=x0 traps when VLMAX would change or vill was set

Run vsetvli with rs1=x0 and rd=x0 when (1) vill=1 beforehand, or (2) new SEW/LMUL would change VLMAX

trap

3 crosses: vill=1 case, new SEW differs case, new LMUL differs case

When rs1=x0 and rd=x0, the instruction operates as if the current vector length in vl is used as the AVL, and the resulting value is written to vl, but not to a destination register. This form can only be used when VLMAX and hence vl is not actually changed by the new SEW/LMUL ratio. Use of the instruction with a new SEW/LMUL ratio that would result in a change of VLMAX is reserved. Use of the instruction is also reserved if vill was 1 beforehand. Implementations may set vill in either case.
spec: VLMAX; vset_op; vsetvl_op; vtype-vill_op; vtype_vset_rsv

cp_ssstrictv_vsetvl_x0_x0_reserved

Confirm vsetvl with rs1=x0 rd=x0 traps when VLMAX would change or vill was set

Run vsetvl with rs1=x0 and rd=x0 when (1) vill=1 beforehand, or (2) new SEW/LMUL in rs2 would change VLMAX

trap

3 crosses: vill=1 case, new SEW differs case, new LMUL differs case

When rs1=x0 and rd=x0, the instruction operates as if the current vector length in vl is used as the AVL, and the resulting value is written to vl, but not to a destination register. This form can only be used when VLMAX and hence vl is not actually changed by the new SEW/LMUL ratio. Use of the instruction with a new SEW/LMUL ratio that would result in a change of VLMAX is reserved. Use of the instruction is also reserved if vill was 1 beforehand.
spec: vsetvl_op; vtype-vill_op; vtype_vset_rsv

cp_ssstrictv_ls_seg_vd_overflow_emulgt1

Confirm segment load/store traps when register groups increment past v31 with LMUL > 1

Run a segment load/store with LMUL={2,4} and NFIELDS/vd combinations where vd + NFIELDS * LMUL > 32 (e.g., LMUL=2 NFIELDS=2 vd=30, LMUL=4 NFIELDS=2 vd=28)

trap

7 (lmul, nf, vd) overflow bins

spec: If the vector register numbers accessed by the segment load or store would increment past 31, then the instruction encoding is reserved.
EMUL; LMUL; NFIELDS; vector_ls_seg_rsv; vreg_count

cp_ssstrictv_vlmul_100_reserved

Confirm vsetvli/vsetivli with reserved vlmul=100 encoding sets vill

Run vsetvli or vsetivli requesting vlmul=3’b100 (reserved encoding) and verify vill is set to 1 afterward

vlmul = {100}: The use of vtype encodings with LMUL < SEWMIN/ELEN is reserved, but implementations can set vill if they do not support these configurations.

1 cross: vlmul_100_requested × vill_set_after

does not depend on csr state: Is this Ssstrict?
spec: LMUL; RESERVED_VILL_SET; vset_op; vtype-lmul_fval_rsv; vtype-vill_set

cp_ssstrictv_ls_idx_emul_gt8

Confirm indexed load/store traps when index EMUL > 8

Run an indexed load/store with SEW/LMUL/index-EEW combinations where (index_EEW / SEW) * LMUL > 8

trap

10 (vlmul, vsew, width) reserved tuples

spec: If the EMUL would be out of range (EMUL>8 or EMUL<1/8), the instruction encoding is reserved.
EEW_SEW_LMUL_dep; EMUL_SEW_LMUL_dep; EMUL_rsv; vector_ls_EMUL; vector_ls_EMUL_rsv; vector_ls_indexed_EMUL; vector_ls_indexed_op

cp_ssstrictv_ls_idx_emul_lt_f8

Confirm indexed load/store traps when index EMUL < 1/8

Run an indexed load/store with SEW/LMUL/index-EEW combinations where (index_EEW / SEW) * LMUL < 1/8

trap

12 (vlmul, vsew, width) reserved tuples (ifdef-guarded for fractional LMUL and SEW support)

spec: If the EMUL would be out of range (EMUL>8 or EMUL<1/8), the instruction encoding is reserved.
EEW_SEW_LMUL_dep; EMUL_SEW_LMUL_dep; EMUL_rsv; vector_ls_EMUL; vector_ls_EMUL_rsv; vector_ls_indexed_EMUL; vector_ls_indexed_op

cp_vtype_walking1s

Confirm all XLEN bits of rs2 are checked when running vsetvl instruction

Set rs1 nonzero, rs2 = (one hot [all XLEN versions]) and run vsetvl rd, rs1, rs2
Running 1 hot confirms that every single bit is checked in rs2 when running vsetvl for reserved configurations

vtype.vill becomes 1 when there is a 1 in XLEN:8, otherwise it depends on which configurations are supported

XLEN 1 hot bins

feature: yes
does not depend on csr state: Is this Ssstrict?
spec: RESERVED_VILL_SET; vsetvl_op; vtype-vill_set; vtype-vill_sz; vtype-vlmul_sz; vtype-vma_sz; vtype-vsew_rsv; vtype-vsew_sz; vtype-vta_sz; vtype_acc; vtype_sz

vmsof.m, vmsif.m, vmsbf.m, viota

cp_exceptionsv_vd_vs2_overlap

Confirm that vd vs2 overlap is reserved

Run instruction with vd = {v8} = vs2
We run with v8 because this ensures its a legal register for all lmuls and does not overlap with v0 in case mask is active

reserved

1

viota_vreg_constr

spec: vmsof.m, vmsif.m, vmsbf.m: The destination register cannot overlap the source register and, if masked, cannot overlap the mask register ('v0').
Any instruction encoding that violates the overlap constraints is reserved.
vmsbf_vreg_constr; vmsif_vreg_constr; vmsof_vreg_constr; vreg_overlap_rsv

cp_exceptionsv_vd_vs1_overlap

Confirm that vd vs1 overlap is reserved

Run instruction with vd = {v8} = vs1
We run with v8 because this ensures its a legal register for all lmuls and does not overlap with v0 in case mask is active

reserved

1

spec: vmsof.m, vmsif.m, vmsbf.m: The destination register cannot overlap the source register and, if masked, cannot overlap the mask register ('v0').
Any instruction encoding that violates the overlap constraints is reserved.
vmsbf_vreg_constr; vmsif_vreg_constr; vmsof_vreg_constr; vreg_overlap_rsv

cp_exceptionsv_vd_v0_overlap_mask_active

Confirm that vd v0 overlap is reserved when the mask is active

Run instruction with vd = {v0} and mask active vm={0}

reserved

1

does not depend on csr state: Again?
spec: vmsof.m, vmsif.m, vmsbf.m: The destination register cannot overlap the source register and, if masked, cannot overlap the mask register ('v0').
Any instruction encoding that violates the overlap constraints is reserved.
vmsbf_vreg_constr; vmsif_vreg_constr; vmsof_vreg_constr; vreg_overlap_rsv; vreg_vmask_rsv

cp_ssstrictv_vstart_ge_vlmax

Confirm vstart >= VLMAX traps on any vector instruction with valid vtype

Set vtype to a valid configuration (vill=0) and set vstart >= VLMAX, then execute a vector instruction

trap

1 cross bin (vstart >= VLMAX & vill=0 & trap)

does not depend on csr state: Exceptions Suite
spec: vstart_val_rsv; vstart_vtype_dep

Table 289. SsstrictV Normative Rules
Normative Rule Rule Text Coverpoints

emul_nfields_rsv

The EMUL setting must be such that EMUL * NFIELDS ≤ 8, otherwise the instruction encoding is reserved.

SsstrictV_vlseg2e8_v_cg/cp_ssstrictv_ls_seg_vd_overflow

emul_offgroup_rsv

Using other than the lowest-numbered vector register to specify a vector register group is a reserved encoding.

Out-of-Scope: this behavior is unspecified even under Ssstrict, which does not cover CSR-state-dependent reserved conditions

emul_rsv

The largest vector register group used by an instruction can not be greater than 8 vector registers (i.e., EMUL≤8), and if a vector instruction would require greater than 8 vector registers in a group, the instruction encoding is reserved. For example, a widening operation that produces a widened vector register group result when LMUL=8 is reserved as this would imply a result EMUL=16.

Out-of-Scope: reserved behavior that is not covered by Ssstrict

V_fp_eew_ieee_nsupported_rsv

If the EEW of a vector floating-point operand does not correspond to a supported IEEE floating-point type, the instruction encoding is reserved.

ExceptionsVf16_vfmv_f_s_cg/cp_vill

V_fp_eew_rsv

Vector instructions where any floating-point vector operand’s EEW is not a supported floating-point type width (which includes when FLEN < SEW) are reserved.

ExceptionsVf16_vfadd_vv_cg/cp_vill

V_inv_frm_rsv

Use of the frm field when it contains an invalid rounding mode by any vector floating-point instruction—​even those that do not depend on the rounding mode—​is reserved, irrespective of the values of vstart and vl.

Out-of-Scope: Ssstrict does not apply to CSR values

egs_ge_vlmax_rsv

Vector instructions with EGS > VLMAX are reserved.

Out-of-Scope: no Ssstrict-equivalent suite exists for the vector-crypto (Zvk*) extensions, and this reserved condition depends on CSR state, matching Ssstrict’s own encoding-only scope boundary

egs_vl_rsv

When an operand is a vector of element groups, the vl setting must correspond to an integer multiple of the element group size, with other values of vl reserved.

Out-of-Scope: no Ssstrict-equivalent suite exists for the vector-crypto (Zvk*) extensions, and this reserved condition depends on CSR state, matching Ssstrict’s own encoding-only scope boundary

vadc_vsbc_unmasked_rsv

Encodings corresponding to the unmasked versions (vm=1) are reserved.

{SsstrictV_vadc_vvm_cg,SsstrictV_vsbc_vvm_cg}/cp_ssstrictv_vadc_vsbc_vm1_reserved

vadc_vsbc_vd_v0_rsv

For VADC and VSBC, the instruction encoding is reserved if the destination vector register is v0.

SsstrictV_vadc_vim_cg/cp_ssstrictv_masking_vd_eq_v0

vcompress_masked_rsv

The equivalent masked instruction (vm=0) is reserved.

SsstrictV_vcompress_vm_cg/cp_ssstrictv_vcompress_vm0_reserved

vector_ls_eew_rsv

If the implementation does not support the EEW of the offset elements, the instruction is reserved.

ExceptionsVls_vloxei16_v_cg/cp_exceptionsv_index_eew16

vector_ls_emul_offgroup_rsv

The vector register groups must have legal register specifiers for the selected EMUL, otherwise the instruction encoding is reserved.

SsstrictV_vl8re8_v_cg/cp_ssstrictv_ls_wr_nreg8_vd_unaligned

vector_ls_emul_rsv

If the EMUL would be out of range (EMUL>8 or EMUL<1/8), the instruction encoding is reserved.

ExceptionsVls_vloxei16_v_cg/cp_exceptionsv_index_eew16

vector_ls_ins_rsv

Vector load/store encodings for unsupported EEW widths are reserved.

SsstrictV_vle8_v_cg/cp_ssstrictv_ls_eew_lt_sewmin

vector_ls_mew_rsv

The mew bit (inst[28]) when set is expected to be used to encode expanded memory sizes of 128 bits and above, but these encodings are currently reserved.

SsstrictV_vle8_v_cg/cp_ssstrictv_ls_mew_reserved

vector_ls_seg_indexed_vreg_rsv

For vector indexed segment loads, the destination vector register groups cannot overlap the source vector register group (specified by vs2), else the instruction encoding is reserved.

SsstrictV_vloxseg2ei8_v_cg/cp_ssstrictv_ls_seg_idx_vd_vs2_overlap

vector_ls_seg_rsv

If the vector register numbers accessed by the segment load or store would increment past 31, then the instruction encoding is reserved.

SsstrictV_vlseg2e8_v_cg/cp_ssstrictv_ls_seg_vd_overflow

vector_ls_seg_wholereg_nf_rsv

Only NFIELDS values of 1, 2, 4, 8 are supported, with other values reserved.

SsstrictV_vl1re8_v_cg/cp_ssstrictv_ls_wr_nf_not_pow2, SsstrictV_vs1r_v_cg/cp_ssstrictv_ls_wr_nf_not_pow2

vfmv-s-f_masked_rsv

The encodings corresponding to the masked versions (vm=0) of VFMV.F.S and VFMV.S.F are reserved.

SsstrictV_vfmv_s_f_cg/cp_ssstrictv_vfmv_fs_sf_vm0_reserved

vfmv_vs2_nv0_rsv

The instruction must have the vs2 field set to v0, with all other values for vs2 reserved.

SsstrictV_vfmv_v_f_cg/cp_ssstrictv_vfmv_vs2_not_v0_reserved

vid_vs2_nv0_rsv

The vs2 field of the instruction must be set to v0, otherwise the encoding is reserved.

SsstrictV_vid_v_cg/cp_ssstrictv_vid_vs2_not_v0_reserved

vmasklogical_masked_rsv

so there are no inactive elements, and the encodings with vm=0 are reserved.

SsstrictV_vmand_mm_cg/cp_ssstrictv_mask_logical_vm0_reserved, SsstrictV_vmnand_mm_cg/cp_ssstrictv_mask_logical_vm0_reserved, SsstrictV_vmor_mm_cg/cp_ssstrictv_mask_logical_vm0_reserved, SsstrictV_vmxor_mm_cg/cp_ssstrictv_mask_logical_vm0_reserved

vmv-nr-r_nreg_rsv

The value of NREG must be 1, 2, 4, or 8, and values of imm[4:0] other than 0, 1, 3, and 7 are reserved.

SsstrictV_vmv1r_v_cg/cp_ssstrictv_vmvnr_simm_reserved

vmv-nr-r_unaligned_rsv

encodings with other vector register numbers are reserved.

SsstrictV_vmv4r_v_cg/cp_ssstrictv_vmv4r_both_unaligned

vmv-s-x_vmv-x-s_masked_rsv

The encodings corresponding to the masked versions (vm=0) of VMV.X.S and VMV.S.X are reserved.

SsstrictV_vmv_s_x_cg/cp_ssstrictv_vmv_xs_sx_vm0_reserved

vmv_vs2_nv0_rsv

The first operand specifier (vs2) must contain v0, and any other vector register number in vs2 is reserved.

SsstrictV_vmv_v_v_cg/cp_ssstrictv_vmv_vs2_not_v0_reserved, SsstrictV_vmv_v_x_cg/cp_ssstrictv_vmv_vs2_not_v0_reserved, SsstrictV_vmv_v_i_cg/cp_ssstrictv_vmv_vs2_not_v0_reserved

vreg_offgroup_lmul2_rsv

Instructions specifying an LMUL=2 vector register group with an odd-numbered vector register are reserved.

Out-of-Scope: reserved behavior that depends on prior CSR state is unspecified and outside Ssstrict’s encoding-only methodology

vreg_offgroup_lmul4_rsv

instructions specifying an LMUL=4 vector register group using vector register numbers that are not multiples of four are reserved.

Out-of-Scope: reserved behavior that depends on prior CSR state is unspecified and outside Ssstrict’s encoding-only methodology

vreg_offgroup_lmul8_rsv

instructions specifying an LMUL=8 vector register group using register numbers that are not multiples of eight are reserved.

Out-of-Scope: reserved behavior that depends on prior CSR state is unspecified and outside Ssstrict’s encoding-only methodology

vreg_overlap_rsv

Any instruction encoding that violates the overlap constraints is reserved.

SsstrictV_vwadd_wv_cg/cp_ssstrictv_widening_source_overlap

vreg_source_eew_rsv

A vector register cannot be used to provide source operands with more than one EEW for a single instruction. A mask register source is considered to have EEW=1 for this constraint. An encoding that would result in the same vector register being read with two or more different EEWs, including when the vector register appears at different positions within two or more vector register groups, is reserved.

SsstrictV_vwadd_wv_cg/cp_ssstrictv_widening_source_overlap

vreg_vmask_rsv

The destination vector register group for a masked vector instruction cannot overlap the source mask register (v0), unless the destination vector register is being written with a mask value (e.g., compares) or the scalar result of a reduction. These instruction encodings are reserved.

SsstrictV_vadd_vv_cg/cp_ssstrictv_masking_vd_eq_v0

vsext_vzext_ill_eew_emul_rsv

If the source EEW is not a supported width, or source EMUL would be below the minimum legal LMUL, the instruction encoding is reserved.

ExceptionsVx_vsext_vf2_cg/cp_vill

vstart_val_rsv

The use of vstart values greater than the largest element index for the current vtype setting is reserved.

ExceptionsVx_vsaddu_vv_cg/cp_vstart_gt_vl

vtype_lmul_fval_rsv

The use of vtype encodings with LMUL < SEWMIN/min(ELEN, VLEN) is reserved, but implementations can set VILL if they do not support these configurations.

Sm_V_cg/cp_vtype_vill_set_vl_0, U_V_cg/cp_vtype_vill_set_vl_0, S_V_cg/cp_vtype_vill_set_vl_0, H_V_cg/cp_vtype_vill_set_vl_0

vtype_vset_rsv

Use of the instructions with a new SEW/LMUL ratio that would result in a change of VLMAX is reserved. Use of the instructions is also reserved if VILL was 1 beforehand.

Out-of-Scope: we cannot test reserved behavior that depends on prior vill state; outside Ssstrict’s encoding-only methodology

vclmul_sewn64_rsv

SEW is any value other than 64

Out-of-Scope: reserved because of CSR state (vtype.sew); no Ssstrict-equivalent suite exists for Zvbc to exercise this reserved SEW encoding

vclmulh_sewn64_rsv

SEW is any value other than 64

Out-of-Scope: reserved because of CSR state (vtype.sew); no Ssstrict-equivalent suite exists for Zvbc to exercise this reserved SEW encoding

veccrypto_sew_rsv

Some Vector Crypto instructions are only defined for a specific SEW. In such a case all other SEW values are reserved.

Out-of-Scope: reserved because of CSR state (vtype.sew); no Ssstrict-equivalent suite exists to exercise these reserved SEW encodings; see the per-instruction _sewn32_rsv/_sewn64_rsv rules in each extension’s own file

veccrypto_vl_vstart_rsv

Instructions that violate the vl or vstart requirements are reserved.

TODO: no Ssstrict-equivalent suite exists for the vector-crypto extensions to exercise vl/vstart values that violate the EGS constraint

vghsh-vv_sewn32_rsv

SEW is any value other than 32

Out-of-Scope: reserved because of CSR state (vtype.sew); Zvkg only generates SEW=32 tests and there is no Ssstrict-equivalent suite for vector-crypto

vgmul-vv_sewn32_rsv

SEW is any value other than 32

Out-of-Scope: reserved because of CSR state (vtype.sew); Zvkg only generates SEW=32 tests and there is no Ssstrict-equivalent suite for vector-crypto

vsha2chl-vv_Zvknha_sewn32_rsv

Zvknha: SEW is any value other than 32

Out-of-Scope: reserved because of CSR state (vtype.sew); no suite drives it to a reserved value under Zvknha and there is no Ssstrict-equivalent suite for vector-crypto

vsha2chl-vv_Zvknhb_sewn32or64_rsv

Zvknhb: SEW is any value other than 32 or 64

Out-of-Scope: reserved because of CSR state (vtype.sew); no suite drives it to a reserved value under Zvknhb and there is no Ssstrict-equivalent suite for vector-crypto

vsha2chl-vv_vdoverlapvs1vs2_rsv

The vd register group overlaps with either vs1 or vs2

TODO: this is an SsstrictV-style reserved-encoding test; no cmp_vd_vs1/cmp_vd_vs2-style register-aliasing coverpoint exists for this suite and no SsstrictV-equivalent suite exists for vector crypto

vsha2ms-vv_Zvknha_sewn32_rsv

Zvknha: SEW is any value other than 32

Out-of-Scope: reserved because of CSR state (vtype.sew); no suite drives it to a reserved value under Zvknha and there is no Ssstrict-equivalent suite for vector-crypto

vsha2ms-vv_Zvknhb_sewn32or64_rsv

Zvknhb: SEW is any value other than 32 or 64

Out-of-Scope: reserved because of CSR state (vtype.sew); no suite drives it to a reserved value under Zvknhb and there is no Ssstrict-equivalent suite for vector-crypto

vsha2ms-vv_vdoverlapvs1vs2_rsv

The vd register group overlaps with either vs1 or vs2

TODO: this is an SsstrictV-style reserved-encoding test; no cmp_vd_vs1/cmp_vd_vs2-style register-aliasing coverpoint exists for this suite and no SsstrictV-equivalent suite exists for vector crypto

vsm3c-vi_sewn32_rsv

SEW is any value other than 32

Out-of-Scope: reserved because of CSR state (vtype.sew); Zvksh only generates SEW=32 tests and there is no Ssstrict-equivalent suite for vector-crypto

vsm3c-vi_vdoverlapvs2_rsv

The vd register group overlaps with the vs2 register group

TODO: this is an SsstrictV-style reserved-encoding test; Zvksh_vsm3c_vi_cg has no vd/vs2 register-aliasing coverpoint and there is no Ssstrict-equivalent suite for vector-crypto

vsm3me-vv_sewn32_rsv

SEW is any value other than 32

Out-of-Scope: reserved because of CSR state (vtype.sew); Zvksh only generates SEW=32 tests and there is no Ssstrict-equivalent suite for vector-crypto

vsm3me-vv_vdoverlapvs2_rsv

The vd register group overlaps with the vs2 register group.

TODO: this is an SsstrictV-style reserved-encoding test; Zvksh_vsm3me_vv_cg has no vd/vs2 register-aliasing coverpoint (only vd/vs1 and vs1/vs2) and there is no Ssstrict-equivalent suite for vector-crypto

vsm4k-vi_sewn32_rsv

SEW is any value other than 32

Out-of-Scope: reserved because of CSR state (vtype.sew); Zvksed only generates SEW=32 tests and there is no Ssstrict-equivalent suite for vector-crypto

vsm4r-vs_vdoverlapvs2_rsv

Only for the *.VS form: the vd register group overlaps the vs2 register

TODO: this is an SsstrictV-style reserved-encoding test; Zvksed_vsm4r_vs_cg has no vd/vs2 register-aliasing coverpoint and there is no Ssstrict-equivalent suite for vector-crypto

vsm4r_sewn32_rsv

SEW is any value other than 32

Out-of-Scope: reserved because of CSR state (vtype.sew); Zvksed only generates SEW=32 tests and there is no Ssstrict-equivalent suite for vector-crypto

veccrypto_vsins_vdvs2overlap

For implementations with VLEN ≥ 128, vs2 refers to a single register. Thus, the vd register group must not overlap the vs2 register. However, in implementations where VLEN < 128, vs2 refers to a register group comprised of the number of registers needed to hold the 128-bit scalar element group. In this case, the vd register group must not overlap this vs2 register group.

TODO

UDB Parameters: None.

B.9.3. ExceptionsVx Vector Integer Exceptions

The vector exception tests exercise everything else that might cause exceptions aside from misalignment and reserved instructions.

These additional exception tests are run on configurations with vector (V extension or subsets thereof that rely on mstatus.VS) related to vector integer instructions. Some tests always trap, such as access faults. Other tests may either succeed or trap depending on a parameter. For example, an implementation may trap on nonzero vstart values, or may execute them in hardware.

Table 290. ExceptionsVx Instruction Coverpoints
Instruction vadd.vv vadd.vx vadd.vi vwadd.vv vwadd.vx vwaddu.vv vwaddu.vx vwadd.wv vwadd.wx vwaddu.wv vwaddu.wx vsub.vv

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW8

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW16

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW32

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW64

x

x

x

x

cp_vill

x

x

x

x

x

x

x

x

x

x

x

x

cp_vstart

x

x

x

x

x

x

x

x

x

x

x

x

cp_vstart_gt_vl

x

x

x

x

x

x

x

x

x

x

x

x

Instruction vsub.vx vwsub.vv vwsub.vx vwsubu.vv vwsubu.vx vwsub.wv vwsub.wx vwsubu.wv vwsubu.wx vrsub.vx vrsub.vi vzext.vf2

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW8

x

x

x

x

x

x

x

x

x

x

x

EFFEW16

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW32

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW64

x

x

x

x

cp_vill

x

x

x

x

x

x

x

x

x

x

x

x

cp_vstart

x

x

x

x

x

x

x

x

x

x

x

x

cp_vstart_gt_vl

x

x

x

x

x

x

x

x

x

x

x

x

Instruction vzext.vf4 vzext.vf8 vsext.vf2 vsext.vf4 vsext.vf8 vadc.vvm vadc.vxm vadc.vim vsbc.vvm vsbc.vxm vmadc.vvm vmadc.vxm

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW8

x

x

x

x

x

x

x

EFFEW16

x

x

x

x

x

x

x

x

EFFEW32

x

x

x

x

x

x

x

x

x

x

EFFEW64

x

x

x

x

x

x

x

x

x

x

x

x

cp_vill

x

x

x

x

x

x

x

x

x

x

x

x

cp_vstart

x

x

x

x

x

x

x

x

x

x

x

x

cp_vstart_gt_vl

x

x

x

x

x

x

x

x

x

x

x

x

Instruction vmadc.vim vmadc.vv vmadc.vx vmadc.vi vmsbc.vvm vmsbc.vxm vmsbc.vv vmsbc.vx vand.vv vand.vx vand.vi vor.vv

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW8

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW16

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW32

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW64

x

x

x

x

x

x

x

x

x

x

x

x

cp_vill

x

x

x

x

x

x

x

x

x

x

x

x

cp_vstart

x

x

x

x

x

x

x

x

x

x

x

x

cp_vstart_gt_vl

x

x

x

x

x

x

x

x

x

x

x

x

Instruction vor.vx vor.vi vxor.vv vxor.vx vxor.vi vsll.vv vsll.vx vsll.vi vsrl.vv vsrl.vx vsrl.vi vnsrl.wv

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW8

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW16

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW32

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW64

x

x

x

x

x

x

x

x

x

x

x

cp_vill

x

x

x

x

x

x

x

x

x

x

x

x

cp_vstart

x

x

x

x

x

x

x

x

x

x

x

x

cp_vstart_gt_vl

x

x

x

x

x

x

x

x

x

x

x

x

Instruction vnsrl.wx vnsrl.wi vsra.vv vsra.vx vsra.vi vnsra.wv vnsra.wx vnsra.wi vmseq.vv vmseq.vx vmseq.vi vmsne.vv

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW8

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW16

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW32

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW64

x

x

x

x

x

x

x

cp_vill

x

x

x

x

x

x

x

x

x

x

x

x

cp_vstart

x

x

x

x

x

x

x

x

x

x

x

x

cp_vstart_gt_vl

x

x

x

x

x

x

x

x

x

x

x

x

Instruction vmsne.vx vmsne.vi vmslt.vv vmslt.vx vmsltu.vv vmsltu.vx vmsle.vv vmsle.vx vmsle.vi vmsleu.vv vmsleu.vx vmsleu.vi

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW8

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW16

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW32

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW64

x

x

x

x

x

x

x

x

x

x

x

x

cp_vill

x

x

x

x

x

x

x

x

x

x

x

x

cp_vstart

x

x

x

x

x

x

x

x

x

x

x

x

cp_vstart_gt_vl

x

x

x

x

x

x

x

x

x

x

x

x

Instruction vmsgt.vx vmsgt.vi vmsgtu.vx vmsgtu.vi vmin.vv vmin.vx vminu.vv vminu.vx vmax.vv vmax.vx vmaxu.vv vmaxu.vx

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW8

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW16

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW32

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW64

x

x

x

x

x

x

x

x

x

x

x

x

cp_vill

x

x

x

x

x

x

x

x

x

x

x

x

cp_vstart

x

x

x

x

x

x

x

x

x

x

x

x

cp_vstart_gt_vl

x

x

x

x

x

x

x

x

x

x

x

x

Instruction vmul.vv vmul.vx vmulh.vv vmulh.vx vmulhu.vv vmulhu.vx vmulhsu.vv vmulhsu.vx vwmul.vv vwmul.vx vwmulu.vv vwmulu.vx

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW8

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW16

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW32

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW64

x

x

x

x

x

x

x

x

cp_vill

x

x

x

x

x

x

x

x

x

x

x

x

cp_vstart

x

x

x

x

x

x

x

x

x

x

x

x

cp_vstart_gt_vl

x

x

x

x

x

x

x

x

x

x

x

x

Instruction vwmulsu.vv vwmulsu.vx vdiv.vv vdiv.vx vdivu.vv vdivu.vx vrem.vv vrem.vx vremu.vv vremu.vx vmacc.vv vmacc.vx

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW8

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW16

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW32

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW64

x

x

x

x

x

x

x

x

x

x

cp_vill

x

x

x

x

x

x

x

x

x

x

x

x

cp_vstart

x

x

x

x

x

x

x

x

x

x

x

x

cp_vstart_gt_vl

x

x

x

x

x

x

x

x

x

x

x

x

Instruction vnmsac.vv vnmsac.vx vmadd.vv vmadd.vx vnmsub.vv vnmsub.vx vwmacc.vv vwmacc.vx vwmaccu.vv vwmaccu.vx vwmaccsu.vv vwmaccsu.vx

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW8

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW16

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW32

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW64

x

x

x

x

x

x

cp_vill

x

x

x

x

x

x

x

x

x

x

x

x

cp_vstart

x

x

x

x

x

x

x

x

x

x

x

x

cp_vstart_gt_vl

x

x

x

x

x

x

x

x

x

x

x

x

Instruction vwmaccus.vx vmerge.vvm vmerge.vxm vmerge.vim vmv.v.v vmv.v.x vmv.v.i vsadd.vv vsadd.vx vsadd.vi vsaddu.vv vsaddu.vx

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW8

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW16

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW32

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW64

x

x

x

x

x

x

x

x

x

x

x

cp_vill

x

x

x

x

x

x

x

x

x

x

x

x

cp_vstart

x

x

x

x

x

x

x

x

x

x

x

x

cp_vstart_gt_vl

x

x

x

x

x

x

x

x

x

x

x

x

Instruction vsaddu.vi vssub.vv vssub.vx vssubu.vv vssubu.vx vaadd.vv vaadd.vx vaaddu.vv vaaddu.vx vasub.vv vasub.vx vasubu.vv

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW8

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW16

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW32

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW64

x

x

x

x

x

x

x

x

x

x

x

x

cp_vill

x

x

x

x

x

x

x

x

x

x

x

x

cp_vstart

x

x

x

x

x

x

x

x

x

x

x

x

cp_vstart_gt_vl

x

x

x

x

x

x

x

x

x

x

x

x

Instruction vasubu.vx vsmul.vv vsmul.vx vssrl.vv vssrl.vx vssrl.vi vssra.vv vssra.vx vssra.vi vnclip.wv vnclip.wx vnclip.wi

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW8

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW16

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW32

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW64

x

x

x

x

x

x

x

x

x

cp_vill

x

x

x

x

x

x

x

x

x

x

x

x

cp_vstart

x

x

x

x

x

x

x

x

x

x

x

x

cp_vstart_gt_vl

x

x

x

x

x

x

x

x

x

x

x

x

Instruction vnclipu.wv vnclipu.wx vnclipu.wi vredsum.vs vwredsum.vs vwredsumu.vs vredmax.vs vredmaxu.vs vredmin.vs vredminu.vs vredand.vs vredor.vs

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW8

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW16

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW32

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW64

x

x

x

x

x

x

x

cp_vill

x

x

x

x

x

x

x

x

x

x

x

x

cp_vstart

x

x

x

x

x

x

x

x

x

x

x

x

cp_vstart_gt_vl

x

x

x

x

x

x

x

x

x

x

x

x

Instruction vredxor.vs vmand.mm vmnand.mm vmandn.mm vmxor.mm vmor.mm vmnor.mm vmorn.mm vmxnor.mm vcpop.m vfirst.m vmsbf.m

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW8

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW16

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW32

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW64

x

x

x

x

x

x

x

x

x

x

x

x

cp_vill

x

x

x

x

x

x

x

x

x

x

x

x

cp_vstart

x

x

x

x

x

x

x

x

x

x

x

x

cp_vstart_gt_vl

x

x

x

x

x

x

x

x

x

x

x

x

Instruction vmsif.m vmsof.m viota.m vid.v vmv.x.s vmv.s.x vslideup.vx vslideup.vi vslidedown.vx vslidedown.vi vslide1up.vx vslide1down.vx

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW8

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW16

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW32

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW64

x

x

x

x

x

x

x

x

x

x

x

x

cp_vill

x

x

x

x

x

x

x

x

x

x

x

x

cp_vstart

x

x

x

x

x

x

x

x

x

x

x

x

cp_vstart_gt_vl

x

x

x

x

x

x

x

x

x

x

x

x

Instruction vrgather.vv vrgather.vx vrgather.vi vrgatherei16.vv vcompress.vm vmv1r.v vmv2r.v vmv4r.v vmv8r.v

RV32

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

EFFEW8

x

x

x

x

x

x

x

x

EFFEW16

x

x

x

x

x

x

x

x

x

EFFEW32

x

x

x

x

x

x

x

x

x

EFFEW64

x

x

x

x

x

x

x

x

x

cp_vill

x

x

x

x

x

x

x

x

x

cp_vstart

x

x

x

x

x

x

x

x

x

cp_vstart_gt_vl

x

x

x

x

x

Table 291. ExceptionsVx Normative Rules
Normative Rule Rule Text Coverpoints

vstart_unmodified

vstart is not modified by vector instructions that raise illegal-instruction exceptions.

TODO: no coverpoint checks that vstart is unmodified after an illegal-instruction exception; cp_vstart only checks that the exception is raised

vstart_val_rsv

The use of vstart values greater than the largest element index for the current vtype setting is reserved.

ExceptionsVx_vsaddu_vv_cg/cp_vstart_gt_vl

vstart_vtype_dep

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.

Untestable: implementations are permitted, not required, to raise this exception, so no behavior can be asserted

UDB Parameters: None.

B.9.4. ExceptionsVf Vector Floating-Point Exceptions

These additional exception tests are run on configurations with vector (V extension or subsets thereof that rely on mstatus.VS) related to vector floating-point instructions. They test operations that may either succeed or trap depending on a parameter.

Table 292. ExceptionsVf Instruction Coverpoints
Instruction vfadd.vv vfadd.vf vfwadd.vv vfwadd.vf vfwadd.wv vfwadd.wf vfsub.vv vfsub.vf vfwsub.vv vfwsub.vf vfwsub.wv vfwsub.wf

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW16

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW32

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW64

x

x

x

x

cp_vill

x

x

x

x

x

x

x

x

x

x

x

x

cp_vstart

x

x

x

x

x

x

x

x

x

x

x

x

cp_vstart_gt_vl

x

x

x

x

x

x

x

x

x

x

x

x

cp_mstatus_vs_off

x

x

x

x

x

x

x

x

x

x

x

x

cp_mstatus_fs_off

x

x

x

x

x

x

x

x

x

x

x

x

cp_vectorfp_mstatus_fs_state

x

x

x

x

x

x

x

x

x

x

x

x

cp_vectorfp_mstatus_fs_state_nonaffecting

x

x

x

x

x

x

x

x

x

x

x

x

cp_vectorfp_mstatus_fs_state_affecting_register

x

x

x

x

x

x

x

x

x

x

x

x

cp_vectorfp_mstatus_fs_state_affecting_csr

x

x

x

x

x

x

x

x

x

x

x

x

Instruction vfrsub.vf vfmul.vv vfmul.vf vfwmul.vv vfwmul.vf vfdiv.vv vfdiv.vf vfrdiv.vf vfmacc.vv vfmacc.vf vfnmacc.vv vfnmacc.vf

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW16

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW32

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW64

x

x

x

x

x

x

x

x

x

x

cp_vill

x

x

x

x

x

x

x

x

x

x

x

x

cp_vstart

x

x

x

x

x

x

x

x

x

x

x

x

cp_vstart_gt_vl

x

x

x

x

x

x

x

x

x

x

x

x

cp_mstatus_vs_off

x

x

x

x

x

x

x

x

x

x

x

x

cp_mstatus_fs_off

x

x

x

x

x

x

x

x

x

x

x

x

cp_vectorfp_mstatus_fs_state

x

x

x

x

x

x

x

x

x

x

x

x

cp_vectorfp_mstatus_fs_state_nonaffecting

x

x

x

x

x

x

x

x

x

x

x

x

cp_vectorfp_mstatus_fs_state_affecting_register

x

x

x

x

x

x

x

x

x

x

x

x

cp_vectorfp_mstatus_fs_state_affecting_csr

x

x

x

x

x

x

x

x

x

x

x

x

Instruction vfmsac.vv vfmsac.vf vfnmsac.vv vfnmsac.vf vfmadd.vv vfmadd.vf vfnmadd.vv vfnmadd.vf vfmsub.vv vfmsub.vf vfnmsub.vv vfnmsub.vf

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW16

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW32

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW64

x

x

x

x

x

x

x

x

x

x

x

x

cp_vill

x

x

x

x

x

x

x

x

x

x

x

x

cp_vstart

x

x

x

x

x

x

x

x

x

x

x

x

cp_vstart_gt_vl

x

x

x

x

x

x

x

x

x

x

x

x

cp_mstatus_vs_off

x

x

x

x

x

x

x

x

x

x

x

x

cp_mstatus_fs_off

x

x

x

x

x

x

x

x

x

x

x

x

cp_vectorfp_mstatus_fs_state

x

x

x

x

x

x

x

x

x

x

x

x

cp_vectorfp_mstatus_fs_state_nonaffecting

x

x

x

x

x

x

x

x

x

x

x

x

cp_vectorfp_mstatus_fs_state_affecting_register

x

x

x

x

x

x

x

x

x

x

x

x

cp_vectorfp_mstatus_fs_state_affecting_csr

x

x

x

x

x

x

x

x

x

x

x

x

Instruction vfwmacc.vv vfwmacc.vf vfwnmacc.vv vfwnmacc.vf vfwmsac.vv vfwmsac.vf vfwnmsac.vv vfwnmsac.vf vfsqrt.v vfrsqrt7.v vfrec7.v vfmin.vv

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW16

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW32

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW64

x

x

x

x

cp_vill

x

x

x

x

x

x

x

x

x

x

x

x

cp_vstart

x

x

x

x

x

x

x

x

x

x

x

x

cp_vstart_gt_vl

x

x

x

x

x

x

x

x

x

x

x

x

cp_mstatus_vs_off

x

x

x

x

x

x

x

x

x

x

x

x

cp_mstatus_fs_off

x

x

x

x

x

x

x

x

x

x

x

x

cp_vectorfp_mstatus_fs_state

x

x

x

x

x

x

x

x

x

x

x

x

cp_vectorfp_mstatus_fs_state_nonaffecting

x

x

x

x

x

x

x

x

x

x

x

x

cp_vectorfp_mstatus_fs_state_affecting_register

x

x

x

x

x

x

x

x

x

x

x

x

cp_vectorfp_mstatus_fs_state_affecting_csr

x

x

x

x

x

x

x

x

x

x

x

x

Instruction vfmin.vf vfmax.vv vfmax.vf vfsgnj.vv vfsgnj.vf vfsgnjn.vv vfsgnjn.vf vfsgnjx.vv vfsgnjx.vf vfredosum.vs vfwredosum.vs vfredusum.vs

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW16

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW32

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW64

x

x

x

x

x

x

x

x

x

x

x

cp_vill

x

x

x

x

x

x

x

x

x

x

x

x

cp_vstart

x

x

x

x

x

x

x

x

x

x

x

x

cp_vstart_gt_vl

x

x

x

x

x

x

x

x

x

x

x

x

cp_mstatus_vs_off

x

x

x

x

x

x

x

x

x

x

x

x

cp_mstatus_fs_off

x

x

x

x

x

x

x

x

x

x

x

x

cp_vectorfp_mstatus_fs_state

x

x

x

x

x

x

x

x

x

x

x

x

cp_vectorfp_mstatus_fs_state_nonaffecting

x

x

x

x

x

x

x

x

x

x

x

x

cp_vectorfp_mstatus_fs_state_affecting_register

x

x

x

x

x

x

x

x

x

x

x

x

cp_vectorfp_mstatus_fs_state_affecting_csr

x

x

x

x

x

x

x

x

x

x

x

x

Instruction vfwredusum.vs vfredmax.vs vfredmin.vs vmfeq.vv vmfeq.vf vmfne.vv vmfne.vf vmflt.vv vmflt.vf vmfle.vv vmfle.vf vmfgt.vf

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW16

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW32

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW64

x

x

x

x

x

x

x

x

x

x

x

cp_vill

x

x

x

x

x

x

x

x

x

x

x

x

cp_vstart

x

x

x

x

x

x

x

x

x

x

x

x

cp_vstart_gt_vl

x

x

x

x

x

x

x

x

x

x

x

x

cp_mstatus_vs_off

x

x

x

x

x

x

x

x

x

x

x

x

cp_mstatus_fs_off

x

x

x

x

x

x

x

x

x

x

x

x

cp_vectorfp_mstatus_fs_state

x

x

x

x

x

x

x

x

x

x

x

x

cp_vectorfp_mstatus_fs_state_nonaffecting

x

x

x

x

x

x

x

x

x

x

x

x

cp_vectorfp_mstatus_fs_state_affecting_register

x

x

x

x

x

x

x

x

x

x

x

x

cp_vectorfp_mstatus_fs_state_affecting_csr

x

x

x

x

x

x

x

x

x

x

x

x

Instruction vmfge.vf vfmerge.vfm vfmv.v.f vfmv.f.s vfmv.s.f vfslide1up.vf vfslide1down.vf vfcvt.xu.f.v vfwcvt.xu.f.v vfncvt.xu.f.w vfcvt.x.f.v vfwcvt.x.f.v

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW16

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW32

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW64

x

x

x

x

x

x

x

x

x

cp_vill

x

x

x

x

x

x

x

x

x

x

x

x

cp_vstart

x

x

x

x

x

x

x

x

x

x

x

x

cp_vstart_gt_vl

x

x

x

x

x

x

x

x

x

x

x

x

cp_mstatus_vs_off

x

x

x

x

x

x

x

x

x

x

x

x

cp_mstatus_fs_off

x

x

x

x

x

x

x

x

x

x

x

x

cp_vectorfp_mstatus_fs_state

x

x

x

x

x

x

x

x

x

x

x

x

cp_vectorfp_mstatus_fs_state_nonaffecting

x

x

x

x

x

x

x

x

x

x

x

x

cp_vectorfp_mstatus_fs_state_affecting_register

x

x

x

x

x

x

x

x

x

x

x

x

cp_vectorfp_mstatus_fs_state_affecting_csr

x

x

x

x

x

x

x

x

x

x

x

x

Instruction vfncvt.x.f.w vfcvt.rtz.xu.f.v vfwcvt.rtz.xu.f.v vfncvt.rtz.xu.f.w vfcvt.rtz.x.f.v vfwcvt.rtz.x.f.v vfncvt.rtz.x.f.w vfcvt.f.xu.v vfwcvt.f.xu.v vfncvt.f.xu.w vfcvt.f.x.v vfwcvt.f.x.v

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW16

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW32

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW64

x

x

x

x

cp_vill

x

x

x

x

x

x

x

x

x

x

x

x

cp_vstart

x

x

x

x

x

x

x

x

x

x

x

x

cp_vstart_gt_vl

x

x

x

x

x

x

x

x

x

x

x

x

cp_mstatus_vs_off

x

x

x

x

x

x

x

x

x

x

x

x

cp_mstatus_fs_off

x

x

x

x

x

x

x

x

x

x

x

x

cp_vectorfp_mstatus_fs_state

x

x

x

x

x

x

x

x

x

x

x

x

cp_vectorfp_mstatus_fs_state_nonaffecting

x

x

x

x

x

x

x

x

x

x

x

x

cp_vectorfp_mstatus_fs_state_affecting_register

x

x

x

x

x

x

x

x

x

x

x

x

cp_vectorfp_mstatus_fs_state_affecting_csr

x

x

x

x

x

x

x

x

x

x

x

x

Instruction vfncvt.f.x.w vfwcvt.f.f.v vfncvt.f.f.w vfncvt.rod.f.f.w vfclass.v

RV32

x

x

x

x

x

RV64

x

x

x

x

x

EFFEW16

x

x

x

x

EFFEW32

x

x

x

x

EFFEW64

x

cp_vill

x

x

x

x

x

cp_vstart

x

x

x

x

x

cp_vstart_gt_vl

x

x

x

x

x

cp_mstatus_vs_off

x

x

x

x

x

cp_mstatus_fs_off

x

x

x

x

x

cp_vectorfp_mstatus_fs_state

x

x

x

x

x

cp_vectorfp_mstatus_fs_state_nonaffecting

x

x

x

x

x

cp_vectorfp_mstatus_fs_state_affecting_register

x

x

x

x

x

cp_vectorfp_mstatus_fs_state_affecting_csr

x

x

x

x

x

Table 293. ExceptionsVf Normative Rules
Normative Rule Rule Text Coverpoints

V_fp_eew_ieee_nsupported_rsv

If the EEW of a vector floating-point operand does not correspond to a supported IEEE floating-point type, the instruction encoding is reserved.

ExceptionsVf16_vfmv_f_s_cg/cp_vill

UDB Parameters: None.

B.9.5. ExceptionsVls Vector Load/Store Exceptions

These additional exception tests are run on configurations with vector (V extension or subsets thereof that rely on mstatus.VS) related to vector load/store instructions. They test operations that may either succeed or trap depending on a parameter.

Table 294. ExceptionsVls Instruction Coverpoints
Instruction vle8.v vle16.v vle32.v vle64.v vlseg2e8.v vlseg2e16.v vlseg2e32.v vlseg2e64.v vlseg3e8.v vlseg3e16.v vlseg3e32.v vlseg3e64.v

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW8

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW16

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW32

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW64

x

x

x

x

x

x

x

x

x

x

x

x

cp_exceptionsv_LS

x

x

x

x

x

x

x

x

x

x

x

x

cp_exceptionsv_address_fault

x

x

x

x

x

x

x

x

x

x

x

x

cp_vill

x

x

x

x

x

x

x

x

x

x

x

x

cp_vstart

x

x

x

x

x

x

x

x

x

x

x

x

cp_vstart_gt_vl

x

x

x

x

x

x

x

x

x

x

x

x

Instruction vlseg4e8.v vlseg4e16.v vlseg4e32.v vlseg4e64.v vlseg5e8.v vlseg5e16.v vlseg5e32.v vlseg5e64.v vlseg6e8.v vlseg6e16.v vlseg6e32.v vlseg6e64.v

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW8

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW16

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW32

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW64

x

x

x

x

x

x

x

x

x

x

x

x

cp_exceptionsv_LS

x

x

x

x

x

x

x

x

x

x

x

x

cp_exceptionsv_address_fault

x

x

x

x

x

x

x

x

x

x

x

x

cp_vill

x

x

x

x

x

x

x

x

x

x

x

x

cp_vstart

x

x

x

x

x

x

x

x

x

x

x

x

cp_vstart_gt_vl

x

x

x

x

x

x

x

x

x

x

x

x

Instruction vlseg7e8.v vlseg7e16.v vlseg7e32.v vlseg7e64.v vlseg8e8.v vlseg8e16.v vlseg8e32.v vlseg8e64.v vle8ff.v vle16ff.v vle32ff.v vle64ff.v

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW8

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW16

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW32

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW64

x

x

x

x

x

x

x

x

x

x

x

x

cp_exceptionsv_LS

x

x

x

x

x

x

x

x

x

x

x

x

cp_exceptionsv_ffLS

x

x

x

x

cp_exceptionsv_address_fault

x

x

x

x

x

x

x

x

x

x

x

x

cp_vill

x

x

x

x

x

x

x

x

x

x

x

x

cp_vstart

x

x

x

x

x

x

x

x

x

x

x

x

cp_vstart_gt_vl

x

x

x

x

x

x

x

x

x

x

x

x

Instruction vlseg2e8ff.v vlseg2e16ff.v vlseg2e32ff.v vlseg2e64ff.v vlseg3e8ff.v vlseg3e16ff.v vlseg3e32ff.v vlseg3e64ff.v vlseg4e8ff.v vlseg4e16ff.v vlseg4e32ff.v vlseg4e64ff.v

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW8

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW16

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW32

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW64

x

x

x

x

x

x

x

x

x

x

x

x

cp_exceptionsv_LS

x

x

x

x

x

x

x

x

x

x

x

x

cp_exceptionsv_ffLS

x

x

x

x

x

x

x

x

x

x

x

x

cp_exceptionsv_address_fault

x

x

x

x

x

x

x

x

x

x

x

x

cp_vill

x

x

x

x

x

x

x

x

x

x

x

x

cp_vstart

x

x

x

x

x

x

x

x

x

x

x

x

cp_vstart_gt_vl

x

x

x

x

x

x

x

x

x

x

x

x

Instruction vlseg5e8ff.v vlseg5e16ff.v vlseg5e32ff.v vlseg5e64ff.v vlseg6e8ff.v vlseg6e16ff.v vlseg6e32ff.v vlseg6e64ff.v vlseg7e8ff.v vlseg7e16ff.v vlseg7e32ff.v vlseg7e64ff.v

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW8

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW16

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW32

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW64

x

x

x

x

x

x

x

x

x

x

x

x

cp_exceptionsv_LS

x

x

x

x

x

x

x

x

x

x

x

x

cp_exceptionsv_ffLS

x

x

x

x

x

x

x

x

x

x

x

x

cp_exceptionsv_address_fault

x

x

x

x

x

x

x

x

x

x

x

x

cp_vill

x

x

x

x

x

x

x

x

x

x

x

x

cp_vstart

x

x

x

x

x

x

x

x

x

x

x

x

cp_vstart_gt_vl

x

x

x

x

x

x

x

x

x

x

x

x

Instruction vlseg8e8ff.v vlseg8e16ff.v vlseg8e32ff.v vlseg8e64ff.v vlse8.v vlse16.v vlse32.v vlse64.v vlsseg2e8.v vlsseg2e16.v vlsseg2e32.v vlsseg2e64.v

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW8

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW16

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW32

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW64

x

x

x

x

x

x

x

x

x

x

x

x

cp_exceptionsv_LS

x

x

x

x

x

x

x

x

x

x

x

x

cp_exceptionsv_ffLS

x

x

x

x

cp_exceptionsv_address_fault

x

x

x

x

x

x

x

x

x

x

x

x

cp_vill

x

x

x

x

x

x

x

x

x

x

x

x

cp_vstart

x

x

x

x

x

x

x

x

x

x

x

x

cp_vstart_gt_vl

x

x

x

x

x

x

x

x

x

x

x

x

Instruction vlsseg3e8.v vlsseg3e16.v vlsseg3e32.v vlsseg3e64.v vlsseg4e8.v vlsseg4e16.v vlsseg4e32.v vlsseg4e64.v vlsseg5e8.v vlsseg5e16.v vlsseg5e32.v vlsseg5e64.v

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW8

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW16

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW32

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW64

x

x

x

x

x

x

x

x

x

x

x

x

cp_exceptionsv_LS

x

x

x

x

x

x

x

x

x

x

x

x

cp_exceptionsv_address_fault

x

x

x

x

x

x

x

x

x

x

x

x

cp_vill

x

x

x

x

x

x

x

x

x

x

x

x

cp_vstart

x

x

x

x

x

x

x

x

x

x

x

x

cp_vstart_gt_vl

x

x

x

x

x

x

x

x

x

x

x

x

Instruction vlsseg6e8.v vlsseg6e16.v vlsseg6e32.v vlsseg6e64.v vlsseg7e8.v vlsseg7e16.v vlsseg7e32.v vlsseg7e64.v vlsseg8e8.v vlsseg8e16.v vlsseg8e32.v vlsseg8e64.v

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW8

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW16

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW32

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW64

x

x

x

x

x

x

x

x

x

x

x

x

cp_exceptionsv_LS

x

x

x

x

x

x

x

x

x

x

x

x

cp_exceptionsv_address_fault

x

x

x

x

x

x

x

x

x

x

x

x

cp_vill

x

x

x

x

x

x

x

x

x

x

x

x

cp_vstart

x

x

x

x

x

x

x

x

x

x

x

x

cp_vstart_gt_vl

x

x

x

x

x

x

x

x

x

x

x

x

Instruction vluxei8.v vluxei16.v vluxei32.v vluxei64.v vluxseg2ei8.v vluxseg2ei16.v vluxseg2ei32.v vluxseg2ei64.v vluxseg3ei8.v vluxseg3ei16.v vluxseg3ei32.v vluxseg3ei64.v

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW8

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW16

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW32

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW64

x

x

x

x

x

x

x

x

x

x

x

x

cp_exceptionsv_LS

x

x

x

x

x

x

x

x

x

x

x

x

cp_exceptionsv_address_fault

x

x

x

x

x

x

x

x

x

x

x

x

cp_exceptionsv_index_eew16

x

x

x

cp_exceptionsv_index_eew32

x

x

x

cp_exceptionsv_index_eew64

x

x

x

cp_exceptionsv_indexed

x

x

x

x

x

x

x

x

x

x

x

x

cp_vill

x

x

x

x

x

x

x

x

x

x

x

x

cp_vstart

x

x

x

x

x

x

x

x

x

x

x

x

cp_vstart_gt_vl

x

x

x

x

x

x

x

x

x

x

x

x

Instruction vluxseg4ei8.v vluxseg4ei16.v vluxseg4ei32.v vluxseg4ei64.v vluxseg5ei8.v vluxseg5ei16.v vluxseg5ei32.v vluxseg5ei64.v vluxseg6ei8.v vluxseg6ei16.v vluxseg6ei32.v vluxseg6ei64.v

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW8

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW16

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW32

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW64

x

x

x

x

x

x

x

x

x

x

x

x

cp_exceptionsv_LS

x

x

x

x

x

x

x

x

x

x

x

x

cp_exceptionsv_address_fault

x

x

x

x

x

x

x

x

x

x

x

x

cp_exceptionsv_index_eew16

x

x

x

cp_exceptionsv_index_eew32

x

x

x

cp_exceptionsv_index_eew64

x

x

x

cp_exceptionsv_indexed

x

x

x

x

x

x

x

x

x

x

x

x

cp_vill

x

x

x

x

x

x

x

x

x

x

x

x

cp_vstart

x

x

x

x

x

x

x

x

x

x

x

x

cp_vstart_gt_vl

x

x

x

x

x

x

x

x

x

x

x

x

Instruction vluxseg7ei8.v vluxseg7ei16.v vluxseg7ei32.v vluxseg7ei64.v vluxseg8ei8.v vluxseg8ei16.v vluxseg8ei32.v vluxseg8ei64.v vloxei8.v vloxei16.v vloxei32.v vloxei64.v

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW8

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW16

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW32

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW64

x

x

x

x

x

x

x

x

x

x

x

x

cp_exceptionsv_LS

x

x

x

x

x

x

x

x

x

x

x

x

cp_exceptionsv_address_fault

x

x

x

x

x

x

x

x

x

x

x

x

cp_exceptionsv_index_eew16

x

x

x

cp_exceptionsv_index_eew32

x

x

x

cp_exceptionsv_index_eew64

x

x

x

cp_exceptionsv_indexed

x

x

x

x

x

x

x

x

x

x

x

x

cp_vill

x

x

x

x

x

x

x

x

x

x

x

x

cp_vstart

x

x

x

x

x

x

x

x

x

x

x

x

cp_vstart_gt_vl

x

x

x

x

x

x

x

x

x

x

x

x

Instruction vloxseg2ei8.v vloxseg2ei16.v vloxseg2ei32.v vloxseg2ei64.v vloxseg3ei8.v vloxseg3ei16.v vloxseg3ei32.v vloxseg3ei64.v vloxseg4ei8.v vloxseg4ei16.v vloxseg4ei32.v vloxseg4ei64.v

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW8

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW16

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW32

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW64

x

x

x

x

x

x

x

x

x

x

x

x

cp_exceptionsv_LS

x

x

x

x

x

x

x

x

x

x

x

x

cp_exceptionsv_address_fault

x

x

x

x

x

x

x

x

x

x

x

x

cp_exceptionsv_index_eew16

x

x

x

cp_exceptionsv_index_eew32

x

x

x

cp_exceptionsv_index_eew64

x

x

x

cp_exceptionsv_indexed

x

x

x

x

x

x

x

x

x

x

x

x

cp_vill

x

x

x

x

x

x

x

x

x

x

x

x

cp_vstart

x

x

x

x

x

x

x

x

x

x

x

x

cp_vstart_gt_vl

x

x

x

x

x

x

x

x

x

x

x

x

Instruction vloxseg5ei8.v vloxseg5ei16.v vloxseg5ei32.v vloxseg5ei64.v vloxseg6ei8.v vloxseg6ei16.v vloxseg6ei32.v vloxseg6ei64.v vloxseg7ei8.v vloxseg7ei16.v vloxseg7ei32.v vloxseg7ei64.v

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW8

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW16

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW32

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW64

x

x

x

x

x

x

x

x

x

x

x

x

cp_exceptionsv_LS

x

x

x

x

x

x

x

x

x

x

x

x

cp_exceptionsv_address_fault

x

x

x

x

x

x

x

x

x

x

x

x

cp_exceptionsv_index_eew16

x

x

x

cp_exceptionsv_index_eew32

x

x

x

cp_exceptionsv_index_eew64

x

x

x

cp_exceptionsv_indexed

x

x

x

x

x

x

x

x

x

x

x

x

cp_vill

x

x

x

x

x

x

x

x

x

x

x

x

cp_vstart

x

x

x

x

x

x

x

x

x

x

x

x

cp_vstart_gt_vl

x

x

x

x

x

x

x

x

x

x

x

x

Instruction vloxseg8ei8.v vloxseg8ei16.v vloxseg8ei32.v vloxseg8ei64.v vse8.v vse16.v vse32.v vse64.v vsseg2e8.v vsseg2e16.v vsseg2e32.v vsseg2e64.v

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW8

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW16

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW32

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW64

x

x

x

x

x

x

x

x

x

x

x

x

cp_exceptionsv_LS

x

x

x

x

x

x

x

x

x

x

x

x

cp_exceptionsv_address_fault

x

x

x

x

x

x

x

x

x

x

x

x

cp_exceptionsv_index_eew16

x

cp_exceptionsv_index_eew32

x

cp_exceptionsv_index_eew64

x

cp_exceptionsv_indexed

x

x

x

x

cp_vill

x

x

x

x

x

x

x

x

x

x

x

x

cp_vstart

x

x

x

x

x

x

x

x

x

x

x

x

cp_vstart_gt_vl

x

x

x

x

x

x

x

x

x

x

x

x

Instruction vsseg3e8.v vsseg3e16.v vsseg3e32.v vsseg3e64.v vsseg4e8.v vsseg4e16.v vsseg4e32.v vsseg4e64.v vsseg5e8.v vsseg5e16.v vsseg5e32.v vsseg5e64.v

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW8

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW16

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW32

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW64

x

x

x

x

x

x

x

x

x

x

x

x

cp_exceptionsv_LS

x

x

x

x

x

x

x

x

x

x

x

x

cp_exceptionsv_address_fault

x

x

x

x

x

x

x

x

x

x

x

x

cp_vill

x

x

x

x

x

x

x

x

x

x

x

x

cp_vstart

x

x

x

x

x

x

x

x

x

x

x

x

cp_vstart_gt_vl

x

x

x

x

x

x

x

x

x

x

x

x

Instruction vsseg6e8.v vsseg6e16.v vsseg6e32.v vsseg6e64.v vsseg7e8.v vsseg7e16.v vsseg7e32.v vsseg7e64.v vsseg8e8.v vsseg8e16.v vsseg8e32.v vsseg8e64.v

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW8

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW16

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW32

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW64

x

x

x

x

x

x

x

x

x

x

x

x

cp_exceptionsv_LS

x

x

x

x

x

x

x

x

x

x

x

x

cp_exceptionsv_address_fault

x

x

x

x

x

x

x

x

x

x

x

x

cp_vill

x

x

x

x

x

x

x

x

x

x

x

x

cp_vstart

x

x

x

x

x

x

x

x

x

x

x

x

cp_vstart_gt_vl

x

x

x

x

x

x

x

x

x

x

x

x

Instruction vsse8.v vsse16.v vsse32.v vsse64.v vssseg2e8.v vssseg2e16.v vssseg2e32.v vssseg2e64.v vssseg3e8.v vssseg3e16.v vssseg3e32.v vssseg3e64.v

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW8

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW16

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW32

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW64

x

x

x

x

x

x

x

x

x

x

x

x

cp_exceptionsv_LS

x

x

x

x

x

x

x

x

x

x

x

x

cp_exceptionsv_address_fault

x

x

x

x

x

x

x

x

x

x

x

x

cp_vill

x

x

x

x

x

x

x

x

x

x

x

x

cp_vstart

x

x

x

x

x

x

x

x

x

x

x

x

cp_vstart_gt_vl

x

x

x

x

x

x

x

x

x

x

x

x

Instruction vssseg4e8.v vssseg4e16.v vssseg4e32.v vssseg4e64.v vssseg5e8.v vssseg5e16.v vssseg5e32.v vssseg5e64.v vssseg6e8.v vssseg6e16.v vssseg6e32.v vssseg6e64.v

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW8

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW16

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW32

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW64

x

x

x

x

x

x

x

x

x

x

x

x

cp_exceptionsv_LS

x

x

x

x

x

x

x

x

x

x

x

x

cp_exceptionsv_address_fault

x

x

x

x

x

x

x

x

x

x

x

x

cp_vill

x

x

x

x

x

x

x

x

x

x

x

x

cp_vstart

x

x

x

x

x

x

x

x

x

x

x

x

cp_vstart_gt_vl

x

x

x

x

x

x

x

x

x

x

x

x

Instruction vssseg7e8.v vssseg7e16.v vssseg7e32.v vssseg7e64.v vssseg8e8.v vssseg8e16.v vssseg8e32.v vssseg8e64.v vsuxei8.v vsuxei16.v vsuxei32.v vsuxei64.v

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW8

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW16

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW32

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW64

x

x

x

x

x

x

x

x

x

x

x

x

cp_exceptionsv_LS

x

x

x

x

x

x

x

x

x

x

x

x

cp_exceptionsv_address_fault

x

x

x

x

x

x

x

x

x

x

x

x

cp_exceptionsv_index_eew16

x

cp_exceptionsv_index_eew32

x

cp_exceptionsv_index_eew64

x

cp_exceptionsv_indexed

x

x

x

x

cp_vill

x

x

x

x

x

x

x

x

x

x

x

x

cp_vstart

x

x

x

x

x

x

x

x

x

x

x

x

cp_vstart_gt_vl

x

x

x

x

x

x

x

x

x

x

x

x

Instruction vsuxseg2ei8.v vsuxseg2ei16.v vsuxseg2ei32.v vsuxseg2ei64.v vsuxseg3ei8.v vsuxseg3ei16.v vsuxseg3ei32.v vsuxseg3ei64.v vsuxseg4ei8.v vsuxseg4ei16.v vsuxseg4ei32.v vsuxseg4ei64.v

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW8

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW16

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW32

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW64

x

x

x

x

x

x

x

x

x

x

x

x

cp_exceptionsv_LS

x

x

x

x

x

x

x

x

x

x

x

x

cp_exceptionsv_address_fault

x

x

x

x

x

x

x

x

x

x

x

x

cp_exceptionsv_index_eew16

x

x

x

cp_exceptionsv_index_eew32

x

x

x

cp_exceptionsv_index_eew64

x

x

x

cp_exceptionsv_indexed

x

x

x

x

x

x

x

x

x

x

x

x

cp_vill

x

x

x

x

x

x

x

x

x

x

x

x

cp_vstart

x

x

x

x

x

x

x

x

x

x

x

x

cp_vstart_gt_vl

x

x

x

x

x

x

x

x

x

x

x

x

Instruction vsuxseg5ei8.v vsuxseg5ei16.v vsuxseg5ei32.v vsuxseg5ei64.v vsuxseg6ei8.v vsuxseg6ei16.v vsuxseg6ei32.v vsuxseg6ei64.v vsuxseg7ei8.v vsuxseg7ei16.v vsuxseg7ei32.v vsuxseg7ei64.v

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW8

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW16

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW32

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW64

x

x

x

x

x

x

x

x

x

x

x

x

cp_exceptionsv_LS

x

x

x

x

x

x

x

x

x

x

x

x

cp_exceptionsv_address_fault

x

x

x

x

x

x

x

x

x

x

x

x

cp_exceptionsv_index_eew16

x

x

x

cp_exceptionsv_index_eew32

x

x

x

cp_exceptionsv_index_eew64

x

x

x

cp_exceptionsv_indexed

x

x

x

x

x

x

x

x

x

x

x

x

cp_vill

x

x

x

x

x

x

x

x

x

x

x

x

cp_vstart

x

x

x

x

x

x

x

x

x

x

x

x

cp_vstart_gt_vl

x

x

x

x

x

x

x

x

x

x

x

x

Instruction vsuxseg8ei8.v vsuxseg8ei16.v vsuxseg8ei32.v vsuxseg8ei64.v vsoxei8.v vsoxei16.v vsoxei32.v vsoxei64.v vsoxseg2ei8.v vsoxseg2ei16.v vsoxseg2ei32.v vsoxseg2ei64.v

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW8

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW16

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW32

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW64

x

x

x

x

x

x

x

x

x

x

x

x

cp_exceptionsv_LS

x

x

x

x

x

x

x

x

x

x

x

x

cp_exceptionsv_address_fault

x

x

x

x

x

x

x

x

x

x

x

x

cp_exceptionsv_index_eew16

x

x

x

cp_exceptionsv_index_eew32

x

x

x

cp_exceptionsv_index_eew64

x

x

x

cp_exceptionsv_indexed

x

x

x

x

x

x

x

x

x

x

x

x

cp_vill

x

x

x

x

x

x

x

x

x

x

x

x

cp_vstart

x

x

x

x

x

x

x

x

x

x

x

x

cp_vstart_gt_vl

x

x

x

x

x

x

x

x

x

x

x

x

Instruction vsoxseg3ei8.v vsoxseg3ei16.v vsoxseg3ei32.v vsoxseg3ei64.v vsoxseg4ei8.v vsoxseg4ei16.v vsoxseg4ei32.v vsoxseg4ei64.v vsoxseg5ei8.v vsoxseg5ei16.v vsoxseg5ei32.v vsoxseg5ei64.v

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW8

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW16

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW32

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW64

x

x

x

x

x

x

x

x

x

x

x

x

cp_exceptionsv_LS

x

x

x

x

x

x

x

x

x

x

x

x

cp_exceptionsv_address_fault

x

x

x

x

x

x

x

x

x

x

x

x

cp_exceptionsv_index_eew16

x

x

x

cp_exceptionsv_index_eew32

x

x

x

cp_exceptionsv_index_eew64

x

x

x

cp_exceptionsv_indexed

x

x

x

x

x

x

x

x

x

x

x

x

cp_vill

x

x

x

x

x

x

x

x

x

x

x

x

cp_vstart

x

x

x

x

x

x

x

x

x

x

x

x

cp_vstart_gt_vl

x

x

x

x

x

x

x

x

x

x

x

x

Instruction vsoxseg6ei8.v vsoxseg6ei16.v vsoxseg6ei32.v vsoxseg6ei64.v vsoxseg7ei8.v vsoxseg7ei16.v vsoxseg7ei32.v vsoxseg7ei64.v vsoxseg8ei8.v vsoxseg8ei16.v vsoxseg8ei32.v vsoxseg8ei64.v

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW8

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW16

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW32

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW64

x

x

x

x

x

x

x

x

x

x

x

x

cp_exceptionsv_LS

x

x

x

x

x

x

x

x

x

x

x

x

cp_exceptionsv_address_fault

x

x

x

x

x

x

x

x

x

x

x

x

cp_exceptionsv_index_eew16

x

x

x

cp_exceptionsv_index_eew32

x

x

x

cp_exceptionsv_index_eew64

x

x

x

cp_exceptionsv_indexed

x

x

x

x

x

x

x

x

x

x

x

x

cp_vill

x

x

x

x

x

x

x

x

x

x

x

x

cp_vstart

x

x

x

x

x

x

x

x

x

x

x

x

cp_vstart_gt_vl

x

x

x

x

x

x

x

x

x

x

x

x

Instruction vl1re8.v vl2re8.v vl4re8.v vl8re8.v vl1re16.v vl2re16.v vl4re16.v vl8re16.v vl1re32.v vl2re32.v vl4re32.v vl8re32.v

RV32

x

x

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW8

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW16

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW32

x

x

x

x

x

x

x

x

x

x

x

x

EFFEW64

x

x

x

x

x

x

x

x

x

x

x

x

cp_exceptionsv_LS

x

x

x

x

x

x

x

x

x

x

x

x

cp_exceptionsv_address_fault

x

x

x

x

x

x

x

x

x

x

x

x

cp_vill

x

x

x

x

x

x

x

x

x

x

x

x

cp_vstart

x

x

x

x

x

x

x

x

x

x

x

x

cp_vstart_gt_vl

x

x

x

x

x

x

x

x

x

x

x

x

Instruction vl1re64.v vl2re64.v vl4re64.v vl8re64.v vs1r.v vs2r.v vs4r.v vs8r.v vsm.v vlm.v

RV32

x

x

x

x

x

x

x

x

x

x

RV64

x

x

x

x

x

x

x

x

x

x

EFFEW8

x

x

x

x

x

x

x

x

x

x

EFFEW16

x

x

x

x

x

x

x

x

x

x

EFFEW32

x

x

x

x

x

x

x

x

x

x

EFFEW64

x

x

x

x

x

x

x

x

x

x

cp_exceptionsv_LS

x

x

x

x

x

x

x

x

x

x

cp_exceptionsv_address_fault

x

x

x

x

x

x

x

x

x

x

cp_vill

x

x

x

x

x

x

x

x

x

x

cp_vstart

x

x

x

x

x

x

x

x

x

x

cp_vstart_gt_vl

x

x

x

x

x

x

x

x

x

x

Table 295. ExceptionsVls Normative Rules
Normative Rule Rule Text Coverpoints

vector_ls_vstart

All vector loads and stores may generate and accept a non-zero vstart value.

ExceptionsVls_vle8_v_cg/cp_vstart

vector_ls_stride_unordered_precise

For implementations with precise vector traps, exceptions on indexed-unordered stores must also be precise.

ExceptionsVls_vsoxei16_v_cg/cp_exceptionsv_address_fault

vector_ls_overwrite_past_trap

Load instructions may overwrite active destination vector register group elements past the element index at which the trap is reported.

ExceptionsVls_vle8_v_cg/cp_exceptionsv_address_fault

vector_ls_seg_vstart_dep

The vstart value is in units of whole segments.

ExceptionsVls_vlseg2e8_v_cg/cp_vstart

vector_ff_past_trap

Similarly, fault-only-first load instructions may update active destination elements past the element that causes trimming of the vector length (but not past the original vector length). The values of these spurious updates do not have to correspond to the values in memory at the addressed memory locations. Non-idempotent memory locations can only be accessed when it is known the corresponding element load operation will not be restarted due to a trap or vector-length trimming.

ExceptionsVls_vle8ff_v_cg/cp_exceptionsv_ffLS_first_elm_trap

vector_ls_seg_partial_access

If a trap occurs during access to a segment, it is implementation-defined whether a subset of the faulting segment’s accesses are performed before the trap is taken.

ExceptionsVls_vlseg2e8_v_cg/cp_exceptionsv_address_fault

vector_ls_seg_ff_unit_stride_op, vector_ff_seg_partial_access

vector_ls_seg_ff_unit_stride_op: For fault-only-first segment loads, if an exception is detected partway through accessing the zeroth segment, the trap is taken. If an exception is detected partway through accessing a subsequent segment, vl is reduced to the index of that segment. vector_ff_seg_partial_access: In both cases, it is implementation-defined whether a subset of the segment is loaded.

ExceptionsVls_vlseg2e8ff_v_cg/cp_exceptionsv_ffLS_first_elm_trap

vector_ls_seg_ff_overload

These instructions may overwrite destination vector register group elements past the point at which a trap is reported or past the point at which vector length is trimmed.

ExceptionsVls_vlseg2e8ff_v_cg/cp_exceptionsv_ffLS_first_elm_trap

vec_store_nonidempotent_no_update

Non-idempotent memory regions must not have been updated for indices equal to or greater than the element that caused a synchronous trap during a vector store instruction.

ExceptionsVls_vse8_v_cg/cp_exceptionsv_address_fault

UDB Parameters: None.

B.10. Miscellaneous RV23 Privileged Extensions

B.10.1. Sscofpmf Counter filtering

The Sscofpmf suite has one covergroup per privilege mode the tests run in: Sscofpmf_Sm_cg (M-mode), Sscofpmf_S_cg (S-mode) and Sscofpmf_U_cg (U-mode). The setup table applies to all three. The Sscofpmf_Sm tests require Sm, so they are not part of a certificate without Sm, such as RVA23.

Table 296. Sscofpmf Setup
Coverpoint Goal

To test Sscofpmf, define the following RVMODEL macros in rvmodel_macros.h. check_defines.h reports an error if Sscofpmf is supported and any of them is undefined.

RVMODEL_HPM_COUNTER

Index, 3 to 31, of the HPM counter to test. The tests derive mhpmevent<n> and mhpmcounter<n>, and on RV32 their high halves, from it; the tables below call them mhpmevent and mhpmcounter.

RVMODEL_MHPMEVENT_VAL

Event selector written to mhpmevent[55:0] so that RVMODEL_MHPMEVENT_CODE increments mhpmcounter. 0 if the DUT cannot count any event, in which case the overflow checks are vacuous.

RVMODEL_MHPMEVENT_CODE

Code that increments mhpmcounter at least once in the current privilege mode, whatever that mode is. It must not trap.

The Sail reference model runs a fence in place of RVMODEL_MHPMEVENT_CODE, so map EV_FENCE to RVMODEL_MHPMEVENT_VAL in event_selectors of the DUT’s sail.json. The tests check only whether mhpmcounter moved and whether it overflowed, never by how much, so the DUT and Sail may count different events.

Only one of the HPM counters is tested because the spec does not require multiple counters supported even when Zihpm is active.

The tests run in M-mode (Sscofpmf_Sm), S-mode (Sscofpmf_S) and U-mode (Sscofpmf_U). Each group has its own covergroup and table below.

Below M-mode, T-SBI calls access the machine-mode CSRs, and counting is inhibited in the modes above the one under test so that the T-SBI trap handler is not counted.

Sscofpmf_Sm
Table 297. Sscofpmf_Sm Coverpoints
Coverpoint Goal Feature Description Expectation Bins Normative Rule

cp_minh_inhibits_mmode

MINH inhibits counting in M-mode

In M-mode:
mhpmevent[55:0] = RVMODEL_MHPMEVENT_VAL, OF = 0
MINH = 0, then 1: mhpmcounter = 0, run RVMODEL_MHPMEVENT_CODE, read mhpmcounter
mhpmevent[62:58] (MINH, SINH, UINH, VSINH, VUINH) = each of the 32 combinations:
read mhpmevent, mhpmcounter = 0, run RVMODEL_MHPMEVENT_CODE, read mhpmcounter

mhpmcounter is nonzero iff MINH = 0
mhpmevent reads back the combination, with the bits of unimplemented modes reading 0

32 xINH combinations

mhpmevent_inh_op

cp_of_set_on_overflow

OF is set when mhpmcounter overflows

In M-mode, for mhpmevent[62:58] = {00000, 11100, 10000, 01000, 00100}:
mip = 0, mie = 0
mhpmevent[55:0] = RVMODEL_MHPMEVENT_VAL, OF = 0
mhpmcounter = all 1s (mhpmcounterh too on RV32)
Run RVMODEL_MHPMEVENT_CODE
Read mhpmevent (OF and xINH) and mhpmcounter
Wait for RVMODEL_INTERRUPT_LATENCY, read mip.LCOFIP

If MINH = 0: mhpmcounter wraps, OF becomes 1 and mip.LCOFIP becomes 1
If MINH = 1: mhpmcounter does not move, and OF and mip.LCOFIP stay 0

3 patterns with MINH = 0

mhpmevent_of_op
mhpmevent_of_bit_set
hpmcounter_overflow
count_overflow_interrupt
mip_lcofip_reflects_overflow
lcofip_op

cp_of_already_set

An overflow with OF already 1 does not request a count overflow interrupt

In M-mode:
mie = 0
mhpmevent[55:0] = RVMODEL_MHPMEVENT_VAL, xINH = 00000, OF = 1
mhpmcounter = all 1s (mhpmcounterh too on RV32)
Clear mip.LCOFIP
Run RVMODEL_MHPMEVENT_CODE, wait for RVMODEL_INTERRUPT_LATENCY
Read mhpmevent, mhpmcounter and mip.LCOFIP

mhpmcounter wraps, OF stays 1, and mip.LCOFIP stays 0

1

count_overflow_interrupt

cp_overflow_hw_only

Software writes to mhpmcounter never cause an overflow

In M-mode:
mie = 0, mhpmevent = 0, clear mip.LCOFIP
mhpmcounter = all 1s, read OF
mhpmcounter = all 0s, read OF

OF stays 0

2 mhpmcounter values

count_overflow_trigger

cp_lcofip_hw_only

Setting OF by software does not raise LCOFIP

In M-mode:
mie = 0, clear mip.LCOFIP
Set mhpmevent.OF with a CSR write, wait for RVMODEL_INTERRUPT_LATENCY, read mip.LCOFIP
Clear mhpmevent.OF with a CSR write, wait for RVMODEL_INTERRUPT_LATENCY, read mip.LCOFIP

mip.LCOFIP stays 0

2 OF values

count_overflow_trigger

cp_scountovf_shadow

scountovf shadows the OF bits of mhpmevent3..31

In M-mode:
mcounteren = all 1s
Write mhpmevent3..31.OF = all 0s, walking 1s, all 1s; read scountovf after each

scountovf[31:3] matches the OF bits, and scountovf[2:0] = 0

31 OF patterns

scountovf_op

cp_scountovf_mcounteren

In M-mode, scountovf is not masked by mcounteren

In M-mode, for mhpmevent3..31.OF = all 1s, even checkerboard, odd checkerboard:
mcounteren = all 0s, all 1s, walking 1 through bits 31:3; read scountovf after each

scountovf[31:3] matches the OF bits whatever mcounteren holds, and scountovf[2:0] = 0

3 OF patterns * 31 mcounteren values

scountovf_mmode_read_access

cp_sscofpmf_access

Access scountovf and, on RV32, mhpmevent3h..31h

In M-mode, read, write 0s, write 1s, set 1s and clear 1s:
scountovf
on RV32, mhpmevent3h..31h

Reading scountovf succeeds; writing it raises an illegal-instruction exception because scountovf is read-only
Every mhpmevent3h..31h access succeeds

5 accesses * (1 CSR, or 30 CSRs on RV32)

mcycleh_minstreth_mhpmh_op
scountovf_mmode_read_access
mhpmeventh_presence

cp_lcofi_m

LCOFI is taken in M-mode iff it is pending, enabled and not delegated

In M-mode:
mstatus.MIE = 1, mstatus.SIE = 1
For mip.LCOFIP = {0, 1} (written by software) x mie.LCOFIE = {0, 1} x mideleg.LCOFI = {0, 1}:
wait for RVMODEL_INTERRUPT_LATENCY

Trap to M-mode iff LCOFIP = 1, LCOFIE = 1 and mideleg.LCOFI = 0

2 pending * 2 enabled * 2 delegated

mip_lcofip_mie_lcofie_op
mip_lcofip_acc

cp_lcofip_priority_m

LCOFI has the lowest priority of the M-mode interrupts

In M-mode, xINH = 00000, mstatus.MIE = 1, mie = 0
For each competing interrupt in {MEIP, MTIP, MSIP, none} that the platform implements:
overflow mhpmcounter to raise LCOFIP, and raise the competing interrupt
wait with mie = all 0s, then with mie = all 1s

With mie = all 0s nothing is taken. With mie = all 1s the competing interrupt is taken first and LCOFI last.

2 mie values * 4 competing interrupts

intr_m_mode_pri

Sscofpmf_S
Table 298. Sscofpmf_S Coverpoints
Coverpoint Goal Feature Description Expectation Bins Normative Rule

cp_sinh_inhibits_smode

SINH inhibits counting in S-mode

In S-mode, with M-level CSRs accessed through T-SBI:
mhpmevent[55:0] = RVMODEL_MHPMEVENT_VAL, OF = 0, MINH = 1
SINH = 0, then 1: mhpmcounter = 0, run RVMODEL_MHPMEVENT_CODE, read mhpmcounter
mhpmevent[62:58] (MINH, SINH, UINH, VSINH, VUINH) = each of the 32 combinations: read mhpmevent

mhpmcounter is nonzero iff SINH = 0
mhpmevent reads back the combination, with the bits of unimplemented modes reading 0

32 xINH combinations

mhpmevent_inh_op

cp_of_set_on_overflow

OF is set when mhpmcounter overflows

In S-mode, for mhpmevent[62:58] = {10000, 10100, 11000, 11100}:
sip = 0, sie = 0
mhpmevent[55:0] = RVMODEL_MHPMEVENT_VAL, OF = 0
mhpmcounter = all 1s (mhpmcounterh too on RV32)
Run RVMODEL_MHPMEVENT_CODE
Read mhpmevent (OF and xINH) and mhpmcounter
Wait for RVMODEL_INTERRUPT_LATENCY, read sip.LCOFIP

If SINH = 0: mhpmcounter wraps, OF becomes 1 and sip.LCOFIP becomes 1
If SINH = 1: mhpmcounter does not move, and OF and sip.LCOFIP stay 0

2 patterns with SINH = 0

mhpmevent_of_op
mhpmevent_of_bit_set
hpmcounter_overflow
count_overflow_interrupt
lcofip_op
sip_sie_Sscofpmf

cp_of_already_set

An overflow with OF already 1 does not request a count overflow interrupt

In S-mode:
mie = 0
mhpmevent[55:0] = RVMODEL_MHPMEVENT_VAL, xINH = 10000, OF = 1
mhpmcounter = all 1s (mhpmcounterh too on RV32)
Clear sip.LCOFIP
Run RVMODEL_MHPMEVENT_CODE, wait for RVMODEL_INTERRUPT_LATENCY
Read mhpmevent, mhpmcounter and sip.LCOFIP

mhpmcounter wraps, OF stays 1, and sip.LCOFIP stays 0

1

count_overflow_interrupt

cp_overflow_hw_only

Software writes to mhpmcounter never cause an overflow

In S-mode:
mie = 0, mhpmevent = 0, clear sip.LCOFIP
mhpmcounter = all 1s, read OF
mhpmcounter = all 0s, read OF

OF stays 0

2 mhpmcounter values

count_overflow_trigger

cp_lcofip_hw_only

Setting OF by software does not raise LCOFIP

In S-mode:
mie = 0, clear sip.LCOFIP
Set mhpmevent.OF with a CSR write, wait for RVMODEL_INTERRUPT_LATENCY, read sip.LCOFIP
Clear mhpmevent.OF with a CSR write, wait for RVMODEL_INTERRUPT_LATENCY, read sip.LCOFIP

sip.LCOFIP stays 0

2 OF values

count_overflow_trigger

cp_scountovf_shadow

scountovf shadows the OF bits of mhpmevent3..31

In S-mode:
mcounteren = all 1s
Write mhpmevent3..31.OF = all 0s, walking 1s, all 1s; read scountovf after each

scountovf[31:3] matches the OF bits, and scountovf[2:0] = 0

31 OF patterns

scountovf_op

cp_scountovf_mcounteren

In S-mode, scountovf is masked by mcounteren

In S-mode, for mhpmevent3..31.OF = all 1s, even checkerboard, odd checkerboard:
mcounteren = all 0s, all 1s, walking 1 through bits 31:3; read scountovf after each

scountovf[31:3] = OF bits & mcounteren[31:3], and scountovf[2:0] = 0

3 OF patterns * 31 mcounteren values

scountovf_smode_read_access
scountovf_smode_read_access_control

cp_sscofpmf_access

Access scountovf

In S-mode, read, write 0s, write 1s, set 1s and clear 1s scountovf

Reading scountovf succeeds; writing it raises an illegal-instruction exception because scountovf is read-only

5 accesses

scountovf_smode_read_access

cp_lcofi_sip_s

LCOFI is taken in S-mode iff it is pending and enabled

In S-mode, mideleg.LCOFI = 1, sstatus.SIE = 1
For sip.LCOFIP = {0, 1} (written by software) x sie.LCOFIE = {0, 1}:
wait for RVMODEL_INTERRUPT_LATENCY

Trap to S-mode iff LCOFIP = 1 and LCOFIE = 1

2 pending * 2 enabled

sip_sie_Sscofpmf

cp_lcofip_priority_s

LCOFI has the lowest priority of the S-mode interrupts

In S-mode, xINH = 10000, sstatus.SIE = 1, sie = 0, S-level interrupts delegated to S-mode
For each competing interrupt in {SEIP, STIP, SSIP, none} that the platform implements:
overflow mhpmcounter to raise LCOFIP, and raise the competing interrupt
wait with sie = all 0s, then with sie = all 1s

With sie = all 0s nothing is taken. With sie = all 1s the competing interrupt is taken first and LCOFI last.

2 sie values * 4 competing interrupts

sip_sie_priority_bit_order

Sscofpmf_U
Table 299. Sscofpmf_U Coverpoints
Coverpoint Goal Feature Description Expectation Bins Normative Rule

The U-mode tests reach the M-level CSRs, and sip and sie, through T-SBI. Where S-mode is not implemented, mip and mie take the place of sip and sie.

cp_uinh_inhibits_umode

UINH inhibits counting in U-mode

In U-mode:
mhpmevent[55:0] = RVMODEL_MHPMEVENT_VAL, OF = 0, MINH = SINH = 1
UINH = 0, then 1: mhpmcounter = 0, run RVMODEL_MHPMEVENT_CODE, read mhpmcounter
mhpmevent[62:58] (MINH, SINH, UINH, VSINH, VUINH) = each of the 32 combinations: read mhpmevent

mhpmcounter is nonzero iff UINH = 0
mhpmevent reads back the combination, with the bits of unimplemented modes reading 0

32 xINH combinations

mhpmevent_inh_op

cp_of_set_on_overflow

OF is set when mhpmcounter overflows

In U-mode, for mhpmevent[62:58] = {11000, 11100}:
sip = 0, sie = 0
mhpmevent[55:0] = RVMODEL_MHPMEVENT_VAL, OF = 0
mhpmcounter = all 1s (mhpmcounterh too on RV32)
Run RVMODEL_MHPMEVENT_CODE
Read mhpmevent (OF and xINH) and mhpmcounter
Wait for RVMODEL_INTERRUPT_LATENCY, read sip.LCOFIP

If UINH = 0: mhpmcounter wraps, OF becomes 1 and sip.LCOFIP becomes 1
If UINH = 1: mhpmcounter does not move, and OF and sip.LCOFIP stay 0

1 pattern with UINH = 0

mhpmevent_of_op
mhpmevent_of_bit_set
hpmcounter_overflow
count_overflow_interrupt
lcofip_op

cp_of_already_set

An overflow with OF already 1 does not request a count overflow interrupt

In U-mode:
mie = 0
mhpmevent[55:0] = RVMODEL_MHPMEVENT_VAL, xINH = 11000, OF = 1
mhpmcounter = all 1s (mhpmcounterh too on RV32)
Clear sip.LCOFIP
Run RVMODEL_MHPMEVENT_CODE, wait for RVMODEL_INTERRUPT_LATENCY
Read mhpmevent, mhpmcounter and sip.LCOFIP

mhpmcounter wraps, OF stays 1, and sip.LCOFIP stays 0

1

count_overflow_interrupt

cp_overflow_hw_only

Software writes to mhpmcounter never cause an overflow

In U-mode:
mie = 0, mhpmevent = 0, clear sip.LCOFIP
mhpmcounter = all 1s, read OF
mhpmcounter = all 0s, read OF

OF stays 0

2 mhpmcounter values

count_overflow_trigger

cp_lcofip_hw_only

Setting OF by software does not raise LCOFIP

In U-mode:
mie = 0, clear sip.LCOFIP
Set mhpmevent.OF with a CSR write, wait for RVMODEL_INTERRUPT_LATENCY, read sip.LCOFIP
Clear mhpmevent.OF with a CSR write, wait for RVMODEL_INTERRUPT_LATENCY, read sip.LCOFIP

sip.LCOFIP stays 0

2 OF values

count_overflow_trigger

cp_lcofi_sip_u

LCOFI is taken from U-mode iff it is pending and enabled

In U-mode, mideleg.LCOFI = 1, sstatus.SIE = 0
For sip.LCOFIP = {0, 1} (written by software) x sie.LCOFIE = {0, 1}:
wait for RVMODEL_INTERRUPT_LATENCY

Trap to S-mode iff LCOFIP = 1 and LCOFIE = 1, because S-level interrupts are always enabled in U-mode

2 pending * 2 enabled

sip_sie_Sscofpmf

Sscofpmf Normative Rules
Table 300. Sscofpmf Normative Rules
Normative Rule Rule Text Coverpoints

mhpmevent_inh_op

Each of the five xINH bits, when set, inhibit counting of events while in privilege mode x. All-zeroes for these bits results in counting of events in all modes.

Sscofpmf_Sm_cg/cp_minh_inhibits_mmode, Sscofpmf_S_cg/cp_sinh_inhibits_smode, Sscofpmf_U_cg/cp_uinh_inhibits_umode

mhpmevent_of_op

The OF bit is set when the corresponding hpmcounter overflows, and remains set until written by software.

{Sscofpmf_Sm_cg,Sscofpmf_S_cg,Sscofpmf_U_cg}/{cp_of_set_on_overflow}

mhpmevent_of_bit_set

Generation of a count-overflow-interrupt request by an hpmcounter sets the associated OF bit.

{Sscofpmf_Sm_cg,Sscofpmf_S_cg,Sscofpmf_U_cg}/{cp_of_set_on_overflow}

hpmcounter_overflow

Since hpmcounter values are unsigned values, overflow is defined as unsigned overflow of the implemented counter bits.

{Sscofpmf_Sm_cg,Sscofpmf_S_cg,Sscofpmf_U_cg}/{cp_of_set_on_overflow}

count_overflow_interrupt

If an hpmcounter overflows while the associated OF bit is zero, then a count overflow interrupt request is generated. If the OF bit is one, then no interrupt request is generated. Consequently the OF bit also functions as a count overflow interrupt disable for the associated hpmcounter.

{Sscofpmf_Sm_cg,Sscofpmf_S_cg,Sscofpmf_U_cg}/{cp_of_set_on_overflow,cp_of_already_set}

count_overflow_trigger

Count overflow never results from writes to the mhpmcountern or mhpmeventn registers, only from hardware increments of counter registers.

{Sscofpmf_Sm_cg,Sscofpmf_S_cg,Sscofpmf_U_cg}/{cp_overflow_hw_only, cp_lcofip_hw_only}

scountovf_op

This extension adds the scountovf CSR, a 32-bit read-only register that contains shadow copies of the OF bits in the 29 mhpmevent CSRs (mhpmevent3 - mhpmevent31) - where scountovf bit X corresponds to `mhpmevent`X.

{Sscofpmf_Sm_cg,Sscofpmf_S_cg}/{cp_scountovf_shadow}

scountovf_mmode_read_access

In M-mode, scountovf bit X is always readable.

Sscofpmf_Sm_cg/cp_scountovf_mcounteren, Sscofpmf_Sm_cg/cp_sscofpmf_access

scountovf_smode_read_access

In S/HS-mode, scountovf bit X is readable when mcounteren bit X is set, and otherwise reads as zero.

Sscofpmf_S_cg/cp_scountovf_mcounteren, Sscofpmf_S_cg/cp_sscofpmf_access

scountovf_smode_read_access_control

Read access to bit X is subject to the same mcounteren (or mcounteren and hcounteren) CSRs that mediate access to the hpmcounter CSRs by S-mode (or VS-mode).

Sscofpmf_S_cg/cp_scountovf_mcounteren

mhpmeventh_presence

The mhpmeventnh CSRs are provided only if the Sscofpmf extension is implemented.

Sscofpmf_Sm_cg/cp_sscofpmf_access

mip_lcofip_mie_lcofie_op

If the Sscofpmf extension is implemented, bits mip.⁠LCOFIP and mie.⁠LCOFIE are the interrupt-pending and interrupt-enable bits for local-counter-overflow interrupts.

Sscofpmf_Sm_cg/cp_lcofi_m

mip_lcofip_reflects_overflow

reflects the occurrence of a local counter-overflow overflow interrupt request resulting from any of the mhpmeventn.OF bits being set.

Sscofpmf_Sm_cg/cp_of_set_on_overflow

lcofip_op

When an OF bit is set, it eventually, but not necessarily immediately, sets the LCOFIP bit in the mip/sip registers.

{Sscofpmf_Sm_cg,Sscofpmf_S_cg,Sscofpmf_U_cg}/{cp_of_set_on_overflow}

mip_lcofip_acc

LCOFIP is read-write in mip

Sscofpmf_Sm_cg/cp_lcofi_m

sip_sie_Sscofpmf

If the Sscofpmf extension is implemented, bits sip.LCOFIP and sie.LCOFIE are the interrupt-pending and interrupt-enable bits for local-counter-overflow interrupts. LCOFIP is read-write in sip and reflects the occurrence of a local counter-overflow overflow interrupt request resulting from any of the mhpmeventn.OF bits being set. If the Sscofpmf extension is not implemented, sip.LCOFIP and sie.LCOFIE are read-only zeros.

Sscofpmf_S_cg/cp_lcofi_sip_s, Sscofpmf_S_cg/cp_of_set_on_overflow, Sscofpmf_U_cg/cp_lcofi_sip_u

intr_m_mode_pri

Multiple simultaneous interrupts destined for M-mode are handled in the following decreasing priority order: MEI, MSI, MTI, SEI, SSI, STI, LCOFI.

Sscofpmf_Sm_cg/cp_lcofip_priority_m

sip_sie_priority_bit_order

Multiple simultaneous interrupts destined for supervisor mode are handled in the following decreasing priority order: SEI, SSI, STI, LCOFI.

Sscofpmf_S_cg/cp_lcofip_priority_s

scountovf_vsmode_read_access

Similarly, in VS mode, scountovf bit X is readable when mcounteren bit X and hcounteren bit X are both set, and otherwise reads as zero.

UDB Parameters: None.

B.10.2. Ssstateen Supervisor State Enable

Table 301. Ssstateen Coverpoints
Coverpoint Goal Feature Description Expectation Bins Normative Rule

cp_walking_ones

Bits are accessible

Write msstateen0-3[31:0] (first) and then sstateen0-3 with walking ones & walking zero, and read each back.

If msstateen = 0, read back 0. If mssstateen = 1, read back value written. Note that writing msstateen = 1s won’t actually set most of the bits to 1.

2 msstateen * 4 CSRs * 64 walking ones/zero

mstateen_rv64_csrs
stateen_rv32_upper_bits_csrs
mstateen_bit_correspondence
stateen_warl_access
stateen_unimplemented_state_roz
stateen_reserved_roz
mstateen_bit_63_roz
sstateen_rv64_csrs
sstateen_ro1_bits
sstateen0_enc_img

cp_csr_illegal_accesses

Test that each stateen CSR allows read/write access from its own and higher privilege modes and denies read/write access from lower privilege modes

In Mmode , write sstateen0-3 with all ones and read back.
In Umode , write sstateen0-3 with all ones and read back.
In S-mode, write msstateen0-3 and read back. Trap.
If RV32 also write and read msstateen0-3h from S-mode.

All accesses will be successful in Mmode.
Illegal instruction exceptions will raise in
Umode and S-mode.

2mode * 4CSRs * 1value * 2 R/W

stateen_op
stateen_illegal_state_access
sstateen_rv64_csrs
sstateen_user_access_control

cp_fcsr

hstateen0.FCSR and sstateen0.FCSR control access to fcsr when misa.F = 0

If Zfinx is supported:
with misa.F = 0, hstateen0.FCSR = {0,1} and sstateen0.FCSR = {0,1}, read and write fcsr, frm, fflags from S, U and (if H is supported) VS and VU-mode.

Success from S-mode. From U-mode, illegal instruction if sstateen0.FCSR = 0, else successful.
From VS-mode, virtual instruction if hstateen0.FCSR = 0, else successful.
From VU-mode, virtual instruction if hstateen0.FCSR = 0, else illegal instruction if sstateen0.FCSR = 0, else successful.

4 states * 4 modes * 3 CSRs * 3 accesses

stateen0_fcsr_op
stateen0_fcsr0_misa_f0_illegal_fpu_instr
sstateen_user_access_control

cp_fcsr_fp_instrs

hstateen0.FCSR and sstateen0.FCSR control floating-point instructions when misa.F = 0

If Zfinx is supported:
with misa.F = 0, hstateen0.FCSR = {0,1} and sstateen0.FCSR = {0,1}, execute fadd.s, fcvt.w.s, fcvt.s.w, and fclass.s from S, U and (if H is supported) VS and VU-mode.

Same as cp_fcsr.

4 states * 4 modes * 4 instructions

stateen0_fcsr0_misa_f0_illegal_fpu_instr

cp_jvt

hstateen0.JVT and sstateen0.JVT control access to jvt

If Zcmt is supported:
With hstateen0.JVT = {0,1} and sstateen0.JVT = {0,1}, read and write jvt from S, U and (if H is supported) VS and VU-mode.

Same as cp_fcsr.

4 states * 4 modes * 3 accesses

stateen0_jvt_op
sstateen_user_access_control

cp_hstateen_walking_ones

hstateen bits are accessible

If H is supported, write hstateen0-3 with walking ones & walking zero from HS-mode, and read each back.
For RV32, also write hstateen0-3h.

Access successful. Bits that are zero in mstateen are read-only zero.

4-8 CSRs * 128-64 walking ones/zero

hstateen_rv64_csrs
hstateen_encoding
hstateen_ro1_bits
hstateen_bit_63_writable
hstateen0_enc_img

cp_hstateen_illegal_accesses

hstateen CSRs are accessible only from HS-mode and M-mode

If H is supported, write hstateen0-3 with all ones, and read it back, from U, VS and VU-mode.
For RV32, also access hstateen0-3h.

Illegal instruction from U-mode. Virtual instruction from VS and VU-mode.

4-8 CSRs * 3 modes

hstateen_encoding
stateen_op
stateen_illegal_state_access

cp_hstateen_se_controls_sstateen

Bit 63 of hstateen0-3 controls access to sstateen0-3 from VS-mode

If H is supported, for N = 0-3 and hstateenN bit 63 = {0,1}, read and write sstateenN from S-mode and VS-mode, and check the value read.
For RV32, bit 63 is bit 31 of hstateenNh.

Virtual instruction from VS-mode if 0, success if 1. Success from S-mode.
sstateen1-3 read 0 (they have no defined bits).

4 CSRs * 2 states * 2 modes * 3 ops

sstateen_vsmode_access_roz
hstateen_bit_63_op
hstateen0_se0_op
stateen_illegal_state_access
stateen_reserved_roz

cp_hstateen_envcfg

hstateen0.ENVCFG controls access to senvcfg

If H is supported, with hstateen0.ENVCFG = {0,1}, read and write senvcfg from S, U, VS and VU-mode.

Virtual instruction if 0, else successful

2 states * 2 modes * 2 accesses

hstateen0_envcfg_op

cp_hstateen_context

hstateen0.CONTEXT controls access to scontext

If Sdtrig is supported, with hstateen0.CONTEXT = {0,1}, read and write scontext from S, U, VS and VU-mode.

Virtual instruction if 0, else successful

2 states * 2 modes * 2 accesses

hstateen0_context_op

cp_hstateen_imsic

hstateen0.IMSIC controls access to stopei and vstopei

If Ssaia is supported, with hstateen0.IMSIC = {0,1}, read and write stopei from S, U, VS and VU-mode.

Virtual instruction if 0, else successful

hstateen0_imsic_op

cp_hstateen_aia

hstateen0.AIA controls access to Ssaia state

If Ssaia is supported, with hstateen0.AIA = {0,1}, access stopi (and sieh, siph on RV32) from S, U, VS and VU-mode.

Virtual instruction if 0, else successful

hstateen0_aia_op

cp_hstateen_csrind

hstateen0.CSRIND controls access to siselect and sireg from VS and VU-mode

If Sscsrind is supported, with hstateen0.CSRIND = {0,1}, access siselect, sireg, and sireg2-6 from S, U, VS and VU-mode.

Virtual instruction if 0 in VS and VU-mode, else successful. No effect in S-mode.

hstateen0_csrind_op

cp_hstateen_ctr

hstateen0.CTR controls access to sctrdepth and sctrstatus

If Ssctr is supported, with hstateen0.CTR = {0,1}, access sctrdepth and sctrstatus from S, U, VS and VU-mode.

Virtual instruction if 0, else successful

Note: All of these tests are performed in S-mode unless otherwise noted.

Note: mstateen0.SE0 must be 1 (else sstateen0 is inaccessible).

Note: mstateen0-3 are set to all ones for all tests in this suite. The coverpoints sample the mstateen bits, so only the cases with the mstateen bit set count. Tests that vary mstateen are in Smstateen.

Note: The cp_hstateen_* tests are performed in HS-mode unless otherwise noted. Feature tests run every combination of the hstateen0 and sstateen0 bit and access from S, U, VS and VU-mode, to check that each bit only affects the modes it controls.

Table 302. Ssstateen Normative Rules
Normative Rule Rule Text Coverpoints

sstateen_rv64_csrs

If supervisor mode is implemented, another four CSRs are defined at supervisor level: sstateen0, sstateen1, sstateen2, and sstateen3.

Ssstateen_cg/cp_csr_illegal_accesses, Ssstateen_cg/cp_walking_ones

sstateen_user_access_control

Each bit of a supervisor-level sstateen CSR controls user-level access (from U-mode or VU-mode) to an extension’s state.

Ssstateen_cg/{cp_jvt, cp_fcsr}

sstateen_ro1_bits

A bit in a supervisor-level sstateen CSR cannot be read-only one unless the same bit is read-only one in the matching mstateen CSR and, if it exists, in the matching hstateen CSR.

Ssstateen_cg/cp_walking_ones

sstateen0_enc_img

Ssstateen_cg/cp_walking_ones

UDB Parameters: None.

The normative rules that apply to every level of stateen CSR are listed with Smstateen (see Table 352).

B.10.3. Ssu64xl 64-bit User Mode

RV64 only

Table 303. Ssu64xl Coverpoints
Coverpoint Goal Feature Description Expectation Bins Normative Rule

cp_ssu64xl

UXLEN = 64 supported

With sstatus.UXL = 2, in U-mode, set bit 63 of a GPR and read back

bit 63 is set

1

sstatus_uxl
Ssu64xl_uxl_sstatus

Table 304. Ssu64xl Normative Rules
Normative Rule Rule Text Coverpoints

Ssu64xl_uxl_sstatus

If the Ssu64xl extension is implemented, then sstatus.UXL must be capable of holding the value 2 (i.e., UXLEN=64 must be supported).

Ssu64xl_cg/cp_ssu64xl

UDB Parameters: None.

B.10.4. Sscounterenw Writable Counter Enables

Table 305. Sscounterenw Coverpoints
Coverpoint Goal Feature Description Expectation Bins Normative Rule

cp_scounteren_writable

Check scounteren bits are writable

In S-mode, write walking 1s and walking 0s to scounteren.

Match reference model

2*XLEN

Sscounterenw_hpmcounter_scounteren

Note that this overlaps tests in S_Zicntr

Table 306. Sscounterenw Normative Rules
Normative Rule Rule Text Coverpoints

Sscounterenw_hpmcounter_scounteren

If the Sscounterenw extension is implemented, then for any hpmcounter that is not read-only zero, the corresponding bit in scounteren must be writable.

Sscounterenw_cg/cp_scounteren_writable

UDB Parameters: None.

B.10.5. Sstvecd Direct Trap Vector

Table 307. Sstvecd Coverpoints
Coverpoint Goal Feature Description Expectation Bins Normative Rule

Following tests are done in S-mode

cp_stvec_vaddr_pc
cp_stvec_vaddr_scratch

Check stvec.MODE can be 0 and when it is, stvec.BASE can hold valid 4-byte aligned addresses

Write stvec = two physical addresses with MODE = Direct, the current pc and the scratch area, and read it back. They are valid even when address translation is off.

stvec gets value written

2

Sstvecd_stvec_mode_direct
Sstvecd_stvec_base_aligned_address

cp_stvec_vaddr_walk1
cp_stvec_vaddr_walk0

stvec.BASE holds every valid 4-byte-aligned virtual address when stvec.MODE = Direct

Write a walking 1 (0s in the msbs) and a walking 0 (1s in the msbs) through bits 2 to VALEN-2 of stvec (bit 31 on RV32) with MODE = Direct, and read it back. Canonical addresses have bits XLEN-1:VALEN-1 equal, so only bits up to VALEN-2 are walked; an invalid address may legally be converted. VALEN is set by the largest of Sv39, Sv48 and Sv57 that satp supports; the walk needs Sv32 or Sv39.

stvec gets value written

2 x walked bits (30 on RV32, 36/45/54 for Sv39/Sv48/Sv57)

Sstvecd_stvec_mode_direct
Sstvecd_stvec_base_aligned_address

Table 308. Sstvecd Normative Rules
Normative Rule Rule Text Coverpoints

Sstvecd_stvec_mode_direct

If the Sstvecd extension is implemented, then stvec.MODE must be capable of holding the value 0 (Direct).

Sstvecd_cg/{cp_stvec_vaddr_pc, cp_stvec_vaddr_scratch, cp_stvec_vaddr_walk1, cp_stvec_vaddr_walk0}, S_scsr_cg/cp_stvec_vaddr_walk1, S_scsr_cg/cp_stvec_vaddr_walk0

Sstvecd_stvec_base_aligned_address

Furthermore, when stvec.MODE=Direct, stvec.BASE must be capable of holding any valid four-byte-aligned address.

Sstvecd_cg/{cp_stvec_vaddr_pc, cp_stvec_vaddr_scratch, cp_stvec_vaddr_walk1, cp_stvec_vaddr_walk0}, S_scsr_cg/cp_stvec_vaddr_walk1, S_scsr_cg/cp_stvec_vaddr_walk0, S_scsr_cg/cp_stvec_vaddr_pc, S_scsr_cg/cp_stvec_vaddr_scratch

UDB Parameters: None.

B.10.6. Sstvala Trap Address

Sstvala boots to S-mode, and the boot code delegates the exceptions to S-mode. Each exception is raised in S-mode and in U-mode after stval is set to a random value through T-SBI, so a hart that does not write stval fails, and the S-mode trap handler records stval. The page-fault tests run in S-mode under Sv39 (RV64) or Sv32 (RV32). Shvstvala tests vstval the same way in VS-mode and VU-mode. Each access-fault test needs RVMODEL_ACCESS_FAULT_ADDRESS_{FETCH/LOAD/STORE} for its access type. The misaligned load and store tests are compiled only without MISALIGNED_LDST, and the misaligned fetch test only without Zca.

Table 309. Sstvala Coverpoints
Coverpoint Goal Feature Description Expectation Bins Normative Rule

cp_load_page_fault

Fault writes VA to stval

In S-mode under Sv39 or Sv32, lw (and ld on RV64) from a page whose leaf has W but not R

stval written with VA

S x {lw, ld} x load page fault x stval = address

Sstvala_stval_faulting_vaddr

cp_store_page_fault

Fault writes VA to stval

In S-mode under Sv39 or Sv32, sw (and sd on RV64) to a page whose leaf has R and X but not W

stval written with VA

S x {sw, sd} x store/AMO page fault x stval = address

cp_instr_page_fault

Fault writes VA to stval

In S-mode under Sv39 or Sv32, jalr to a page whose leaf has R and W but not X

stval written with VA

S x jalr x instruction page fault x stval = target

Sstvala_stval_faulting_vaddr

cp_load_access_fault

Fault writes VA to stval

In S-mode and U-mode, each load (lb, lbu, lh, lhu, lw, and lwu, ld on RV64) from RVMODEL_ACCESS_FAULT_ADDRESS_LOAD

stval written with VA

{S, U} x each load x load access fault x stval = address

Sstvala_stval_faulting_vaddr

cp_store_access_fault

Fault writes VA to stval

In S-mode and U-mode, each store (sb, sh, sw, and sd on RV64) to RVMODEL_ACCESS_FAULT_ADDRESS_STORE

stval written with VA

{S, U} x each store x store/AMO access fault x stval = address

Sstvala_stval_faulting_vaddr

cp_instr_access_fault

Fault writes VA to stval

In S-mode and U-mode, jalr to RVMODEL_ACCESS_FAULT_ADDRESS_FETCH

stval written with VA

{S, U} x jalr x instruction access fault x stval = target

Sstvala_stval_faulting_vaddr

cp_load_address_misaligned

Fault writes VA to stval

Only without MISALIGNED_LDST. In S-mode and U-mode, each load wider than a byte at offsets 0-7 of a scratch doubleword

stval written with VA for each misaligned load

{S, U} x each load wider than a byte x load address misaligned x stval = address

Sstvala_stval_faulting_vaddr

cp_store_address_misaligned

Fault writes VA to stval

Only without MISALIGNED_LDST. In S-mode and U-mode, each store wider than a byte at offsets 0-7 of a scratch doubleword

stval written with VA for each misaligned store

{S, U} x each store wider than a byte x store/AMO address misaligned x stval = address

Sstvala_stval_faulting_vaddr

cp_load_misaligned_word
cp_store_misaligned_word
cp_load_misaligned_doubleword
cp_store_misaligned_doubleword

Fault writes VA to stval for each misalignment

Only without MISALIGNED_LDST. The misaligned word and (on RV64) doubleword accesses of cp_load_address_misaligned and cp_store_address_misaligned, binned by the address offset within the access’s natural alignment. A halfword can only be misaligned by 1.

stval written with VA for each misalignment

{S, U} x {lw, lwu} or sw x offsets 1-3 x address misaligned x stval = address; {S, U} x ld or sd x offsets 1-7 x address misaligned x stval = address

cp_instr_adr_misaligned_jalr

Fault writes VA to stval

Only without Zca. In S-mode and U-mode, jalr with each combination of rs1[1:0] and offset[1:0]

stval written with the target address for each target with bit 1 set

{S, U} x jalr x instruction address misaligned x stval = target

Sstvala_stval_faulting_vaddr

cp_illegal_instruction

Fault writes instr to stval

In S-mode and U-mode, execute the instructions 0x00000000 and 0xFFFFFFFF

stval written with instr

{S, U} x {0x00000000, 0xFFFFFFFF} x illegal instruction x stval = instruction

Sstvala_stval_faulting_instruction

Note: breakpoints tested in SstvalaSdtrig because they are generated with debug triggers

Table 310. Sstvala Normative Rules
Normative Rule Rule Text Coverpoints

Sstvala_stval_faulting_vaddr

If the Sstvala extension is implemented, then stval must be written with the faulting virtual address for load, store, and instruction page-fault, access-fault, and misaligned exceptions, and for breakpoint exceptions that are defined to write an address to stval, other than those caused by execution of the EBREAK or C.EBREAK instructions.

Sstvala_cg/{cp_load_access_fault, cp_load_address_misaligned}, Sstvala_cg/{cp_load_page_fault, cp_instr_page_fault}

Sstvala_stval_faulting_instruction

For virtual-instruction and illegal-instruction exceptions, stval must be written with the faulting instruction.

Sstvala_cg/cp_illegal_instruction

UDB Parameters: None.

B.10.7. Ssccptr Page Table Reads

Table 311. Ssccptr Coverpoints
Coverpoint Goal Feature Description Expectation Bins Normative Rule

cp_ssccptr

Main memory supports HPTW read

With Sv active, access virtual memory with page table stored in main memory

Success

1

Ssccptr_memory_pte_reads

Note: this is already covered in Sv

Table 312. Ssccptr Normative Rules
Normative Rule Rule Text Coverpoints

Ssccptr_memory_pte_reads

If the Ssccptr extension is implemented, then main memory regions with both the cacheability and coherence PMAs must support hardware page-table reads.

Ssccptr_cg/cp_ssccptr

UDB Parameters: None.

B.10.8. Ss1p13 Supervisor Mode 1.13

Table 313. Ss1p13 Coverpoints
Coverpoint Goal Feature Description Expectation Bins Normative Rule Notes

cp_sxlen_ge_uxlen

sxlen > uxlen

From S-mode, attempt to set sstatus.UXL = (1, 2)

Can’t write 2 unless SXL is also 2 (64 b)

2

mstatus_uxl_legal_vals_smode

cp_scause

scause accepts sofware-check and hardware error

Write scause = 18, 19, read back

Match ref model

2

NOTE : Already covered in cp_scause_write_exception

NOTE : Tests and coverage files are under the S.py and S_coverage.svh respectvely with the guard of `ifdef SS1P13_SUPPORTED

Table 314. Ss1p13 Normative Rules
Normative Rule Rule Text Coverpoints

mstatus_uxl_legal_vals_smode

If S-mode is implemented, the set of legal values that the UXL field may assume excludes those that would cause UXLEN to be greater than SXLEN.

Not tested: with SXLEN=64 the only excluded value is the reserved UXL=3, whose WARL result is implementation-defined

UDB Parameters: None.

B.10.9. Ssnpm Pointer Masking

Ssnpm
Table 315. Ssnpm Coverpoints
Coverpoint Goal Feature Description Expectation Bins Normative Rule Notes

A supervisor-level extension that provides pointer masking for the next lower privilege
mode (U-mode) by enabling senvcfg.PMM bits. Pointer masking applies for RV64 only.

todo: ADD UDB parameters of PMLEN7_SUPPORTED and PMLEN16_SUPPORTED

For all test entries in this sheet, the following address patterns are used to exercise pointer masking behavior:
Base addresses (A bits 63:48):
0x0000 unaffected by pointer masking
0x0001 bit 48 masked if PMLEN=16 but not 7
0x0100 bit 56 masked if PMLEN = 16 but not 7
0x0200 bit 57 masked if PMLEN = 16 or 7
0x8000 bit 63 masked if PMLEN = 16 or 7
0xFFFF bits 63:48 are masked if PMLEN = 16, only partially if PMLEN=7
0xFE00 bits 63:57 are masked if PMLEN = 16 or 7
0xFF00 bits 63:56 are masked if PMLEN=16, only partially if PMLEN=7
Masked address :
For PMLEN= 16 ( PMM=11)
Bare mode (PA): {0x0000} → upper bits forced to zero
Sv39 / Sv48/Sv57 (VA): {0x0000, 0xFFFF} → upper bits follow sign bit (XLEN-PMLEN-1 = 64-16-1 = 47 bit )
For PMLEN= 7 (PMM= 10):
Bare mode (PA): {0x00 / 7’b0} → upper bits forced to zero
Sv39 / Sv48Sv57 (VA): {7’b0, 0x7F} → upper bits follow sign bit ( XLEN-PMLEN-1 = 64 - 7 -1 = 56 bit )
All virtual A_masked addresses map to physical addresses with upper bits = 0x0000.
The lower bits of the address being tested point to a scratch memory location that can safely be read and written.
Virtual addresses with leading 0s are identity mapped to the same physical address.
Virtual addresses with leading 1s are mapped to another scratch memory location containing a different data value so that it can be distinguished whether the upper bits are handled correctly.

Why do we need a different page than scratch to map the VA with leading 1s?
A' = scratch page (upper bits = 0x0000), pre-loaded with value_old, identity-mapped with VA with leading 0s(VA == PA).
VAs with leading 1s are explicitly PTE-mapped to a separate page pre-loaded with value_different. This separation is necessary because if both VAs mapped to the same PA, a read would return value_old regardless of whether masking actually occurred; the page table itself would resolve both addresses to scratch, making it impossible to tell if the hardware masked the upper bits or simply followed the mapping.
With a separate page holding a distinct value, the outcome is unambiguous: returning value_old proves the upper bits were stripped and scratch was reached via masking; returning value_different proves the upper bits were used as-is and other different page was accessed instead.
NOTE : We will take sv tests as reference to setup PTE to map VA with leading ones to a dedicated physical region.

cp_pmlen_masking

Verify that upper PMLEN bits are ignored for every memory-accessing instruction when pointer masking is enabled

If pointer masking is enabled, addresses differing only in upper PMLEN bits access the same physical location.
Test Environment:
In S-mode set senvcfg.PMM={00 (PMLEN=0), 10(PMLEN=7), 11(PMLEN=16)}. Place known value_old in scratch memory.
Let A' = scratch (upper bits = 0x0000). For VA with upper bits = 1: mapped to a separate page from scratch.
Enable SUM bit so we can access user-space pages from S-mode
Switch to U-mode and execute the following loop:
For each PMM in {00, 10, 11} under SAT.MODES = { Bare, Sv39, Sv48, Sv57 } :
For each A_upper_bits in {0x0000, 0x0001, 0x0100, 0x0200, 0x8000, 0xFFFF, 0xFE00, 0xFF00}:
Set A = A' with upper bits replaced by A_upper_bits
For each read instruction: read directly from A, sigupd(value) + record any traps.
For each write instruction: write unique known value_new to A, then read back from scratch (A'), sigupd(value) + record any traps.
Instructions covered under this loop:
(LOAD/STORE): Reads: {lb/lbu, lh/lhu, lw/lwu, ld}. Writes: {sb, sh, sw, sd}.
(ATOMIC OPS): Each AMO is both a read and write, we will treat it as write: perform AMO at A, read back from scratch. If RV64A: {AMOSWAP.W/D, AMOADD.W/D, AMOXOR.W/D, AMOAND.W/D, AMOOR.W/D, AMOMIN.W/D, AMOMAX.W/D, AMOMINU.W/D, AMOMAXU.W/D}.
If Zacas: {AMOCAS.W/D/Q}.
If Zabha: {AMOSWAP.B/H, AMOADD.B/H, AMOXOR.B/H, AMOAND.B/H, AMOOR.B/H, AMOMIN.B/H, AMOMAX.B/H, AMOMINU.B/H, AMOMAXU.B/H}.
(FLOATING POINT OPS): Reads: { FLW (F), FLD (D), FLQ (Q) } . Writes: { FSW (F), FSD (D), FSQ (Q). }
(COMPRESSED OPS): If Zca , Reads: {C.LW, C.LD, C.LWSP, C.LDSP}. Writes: {C.SW, C.SD, C.SWSP, C.SDSP}.
If Zcd , Read: C.FLDSP. Write: C.FSDSP.
(CACHE MANAGEMENT OPS): If Zicboz: perform CBO.ZERO at A (write), read back from scratch using lw/ld.
If Zicbom: perform {CBO.CLEAN, CBO.FLUSH} at A (write), read back from scratch.
If CBIE enabled: perform CBO.INVAL at A, read back from scratch.
If Zicbop: perform {PREFETCH.R, PREFETCH.W, PREFETCH.I} at A, then do a normal load/store at Scratch to observe cache effect.
(VECTOR OPS): If ZVL32b/RVV 1.0, Reads: {vleXX.v, vlseXX.v, vluxeiXX.v, vloxeiXX.v, vlsegNfXX.v, vl1r.v, vleXXff.v} from A, sigupd. Writes: {vseXX.v, vsseXX.v, vsuxeiXX.v, vsoxeiXX.v, vssegNfXX.v, vs1r.v} to A, read back from scratch sigupd(value) + record any traps.

When PMM=10/11: all 8 A patterns whose upper bits fall within PMLEN resolve to scratch , reads return known value_old, write readbacks return known value_new. When PMM=00: masking disabled : only A=0x0000 resolves to scratch; all other patterns either access a different location (returning old/unrelated value) or cause a trap.

3 PMM × 8 address variants × 1 mode (U) × satp supported modes (Bare, Sv39, Sv48, Sv57) × [Base: 4r×4w] + [RV64A if implemented: 9 AMO variants × 2 widths] + [Zacas if implemented: 3] + [Zabha if implemented: 9 AMO variants × 2 widths] + [FP if implemented: per F/D/Q] + [Zca if implemented: 4r×4w regular + 4r×4w SP-relative] + [Zcd if implemented: 1r×1w SP-relative] + [RVV if implemented: vector load/store variants] + [Zicbom if implemented: CBO.CLEAN, CBO.FLUSH, CBO.INVAL] + [Zicboz if implemented: CBO.ZERO] + [Zicbop if implemented: PREFETCH.R, PREFETCH.W, PREFETCH.I]

senvcfg_pmm_ssnpm
senvcfg_pmm_enc
pm_ignore_upper_bits
pm_ignore_va
pm_ignore_pa
pm_apply_explicit
pm_deterministic_effect
pmlen_supported_values
pm_per_mode_control
pm_auto_apply_active_mode
pm_config_next_higher
pm_mode_only_dependency
pm_explicit_accesses
pm_cpu_only
ssnpm_definition
pm_rv64_only
pmlen_mode_depend

pm_all_priv_modes ("Such tools can be applied in all privilege modes (U, S, and M).") is no longer a tagged rule in the ISA manual.
UPDATED WITH CTP : pm_rv64_only, pmlen_supported_values, pmlen_mode_depend, pm_ignore_va, pm_ignore_pa

cp_pmlen_zicfiss_amo

Verify that upper PMLEN bits are ignored for the Zicfiss shadow stack AMO instructions when pointer masking is enabled

If pointer masking is enabled, SSAMOSWAP.W/D addresses differing only in upper PMLEN bits access the same shadow stack location.
SSAMOSWAP accesses memory only with shadow stacks enabled and an address in a shadow stack page, so Bare mode is not tested: there it always raises a store/AMO access fault.
Test Environment:
If Zicfiss: In S-mode set menvcfg.SSE=1 and senvcfg.SSE=1, and senvcfg.PMM={00 (PMLEN=0), 10(PMLEN=7), 11(PMLEN=16)}.
Let A' = ss_page (upper bits = 0x0000), identity-mapped as a user shadow stack page (pte.xwr = 010).
Switch to U-mode and execute the following loop:
For each PMM in {00, 10, 11} under SAT.MODES = { Sv39, Sv48, Sv57 } :
For each A_upper_bits in {0x0000, 0x0001, 0x0100, 0x0200, 0x8000, 0xFFFF, 0xFE00, 0xFF00}:
Set A = A' with upper bits replaced by A_upper_bits
Place known value_old in ss_page with SSAMOSWAP.D at A' (an ordinary store to a shadow stack page faults).
For each of {SSAMOSWAP.W, SSAMOSWAP.D}: swap unique known value_new at A, sigupd(rd), then read back from ss_page (A'), sigupd(value) + record any traps.

When PMM=10/11: all A patterns whose upper bits fall within PMLEN resolve to ss_page , rd returns known value_old, readback returns known value_new. When PMM=00: masking disabled : only A=0x0000 resolves to ss_page; all other patterns cause a store/AMO page fault, rd is unchanged and readback returns value_old.

3 PMM × 8 address variants × 1 mode (U) × satp supported modes (Sv39, Sv48, Sv57) × [Zicfiss if implemented: SSAMOSWAP.W, SSAMOSWAP.D]

pm_ignore_upper_bits
pm_apply_explicit
pm_ignore_va

cp_pmlen_zicfiss_ssp

Verify that upper PMLEN bits are ignored for the Zicfiss shadow stack push and pop instructions when pointer masking is enabled

SSPUSH and SSPOPCHK address memory through the ssp CSR instead of rs1. If pointer masking is enabled, ssp values differing only in upper PMLEN bits access the same shadow stack location.
Pushes and pops access memory only with shadow stacks enabled and an address in a shadow stack page, so Bare mode is not tested: there they always raise a store/AMO access fault.
Test Environment:
If Zicfiss: In S-mode set menvcfg.SSE=1 and senvcfg.SSE=1, and senvcfg.PMM={00 (PMLEN=0), 10(PMLEN=7), 11(PMLEN=16)}.
Let A' = ss_page (upper bits = 0x0000), identity-mapped as a user shadow stack page (pte.xwr = 010).
Switch to U-mode and execute the following loop:
For each PMM in {00, 10, 11} under SAT.MODES = { Sv39, Sv48, Sv57 } :
For each A_upper_bits in {0x0000, 0x0001, 0x0100, 0x0200, 0x8000, 0xFFFF, 0xFE00, 0xFF00}:
Set A = A' with upper bits replaced by A_upper_bits
Place known value_old in ss_page with SSAMOSWAP.D at A'.
For each push {SSPUSH x1, SSPUSH x5, C.SSPUSH x1 (if Zcmop)}: set ssp = A + 8 and link register = value_new, push, sigupd(ssp), then read back from ss_page (A'), sigupd(value) + record any traps.
For each pop {SSPOPCHK x1, SSPOPCHK x5, C.SSPOPCHK x5 (if Zcmop)}: set ssp = A and link register = value_old, pop, sigupd(ssp) + record any traps.

When PMM=10/11: all A patterns whose upper bits fall within PMLEN resolve to ss_page , a push writes value_new and leaves ssp = A, a pop matches value_old and leaves ssp = A + 8. When PMM=00: masking disabled : only A=0x0000 resolves to ss_page; all other patterns cause a store/AMO page fault, ssp is unchanged and readback returns value_old.

3 PMM × 8 ssp variants × 1 mode (U) × satp supported modes (Sv39, Sv48, Sv57) × [Zicfiss if implemented: SSPUSH x1, SSPUSH x5, SSPOPCHK x1, SSPOPCHK x5] + [Zcmop if implemented: C.SSPUSH x1, C.SSPOPCHK x5]

pm_ignore_upper_bits
pm_apply_explicit
pm_ignore_va

cp_pmm_mxr
cp_pmm_jalr

Verify pointer masking behavior across all combinations of PMM, MXR, address pairs, and VM modes using representative explicit load/store and implicit fetch accesses.

When MXR is in effect at the effective privilege mode where explicit memory
access is performed, pointer masking does not apply.
For implicit memory accesses such as page-table walks or instruction fetches, pointer masking does not apply.
Test Environment:
In S-mode set senvcfg.PMM={ 00 (PMLEN=0 ), 10(PMLEN=7), 11(PMLEN=16)}, sstatus.MXR = { 0, 1}.
Let A' = scratch (upper bits = 0x0000). For VA with upper bits = 1: mapped to a separate page from scratch.
Switch to U-mode and execute the following loop:
For each PMM in {00, 10, 11} under all satp. modes = { Bare , Sv39, Sv48, Sv57 } :
For each A_upper_bits in {0x0000, 0x0001, 0x0100, 0x0200, 0x8000, 0xFFFF, 0xFE00, 0xFF00}:
Set A = A' with upper bits replaced by A_upper_bits
For MXR Scenario : Perform sw to A and then read back using scratch (A') , signupd + record traps under satp.MODE ∈ {Bare, Sv39, Sv48, Sv57}.
For JALR : Place valid executable instructions at A' , execute jalr to A, sigupd result, record any traps. Since pointer masking never applies to instruction fetch, A is always sent raw to PMP/MMU regardless of PMM or MXR.

1- PMM=00: masking disabled; only A_upper_bits=0x0000 resolves to scratch; all other patterns access different location or cause trap.
2-- PMM=10/11, MXR=0: masking applied; write readbacks return known value_new for all A patterns whose upper bits fall within PMLEN.
3- PMM=10/11, MXR=1, in Sv39/Sv48/Sv57: MXR suppresses masking; A used raw, causing a trap or sw to location other than A'
4- PMM=10/11, MXR=1 in Bare: MXR suppresses masking even though MXR has no permission effect in bare mode.
5- jalr: no masking applied regardless of PMM or MXR; non-zero upper bits always sent raw resulting in fault.

3 PMM × 2 MXR × 8 A patterns 3 instructions (lw, sw, jalr) × 4 VM modes (Bare, Sv39, Sv48, Sv57) × 1 mode (U)

pm_mxr_exception
pm_not_apply_implicit

cp_pmlen_misaligned_word

Verify correct pointer masking behavior for misaligned memory accesses.

Test Environment:
In S-mode set senvcfg.PMM={ 10(PMLEN=7)}. Place known value_old at scratch+1 (naturally misaligned for word access).
Let A' = scratch+1 (upper bits = 0x0000). For VA with upper bits = 1: mapped to a separate page from scratch+1.
Switch to U-mode.
For each PMM in {00, 10, 11} under all satp. modes = { Bare , Sv39, Sv48, Sv57 } :
For each A_upper_bits in {0x0000, 0x0001, 0x0100, 0x0200, 0x8000, 0xFFFF, 0xFE00, 0xFF00}::
Set A = A' with upper bits replaced by A_upper_bits
For read (lw): read directly from A, sigupd(value), record any traps.
For write (sw): write unique known value_new to A, read back from scratch+1 (A'), sigupd(value), record any traps.

No trap. Masking applied to the misaligned address before access, A and A' resolve to the same physical location. Read returns known value_old. Write readback from A' returns known value_new. Misalignment does not interfere with pointer masking.

1 PMM × 2 address variants (upper 7 bits = 0/1) × 1 misaligned write (sw) × 1 misaligned read (lw) × 1 mode (U) ×

pm_misaligned_equivalence

cp_hardware_csr_writes_fault_load

Verify pointer masking is applied to hardware-written CSR address values.
Verify that stval contains the masked effective address when a fault occurs on a pointer-masked load.

When a fault occurs on an explicit memory access under pointer masking, the hardware-written stval reflects the masked effective address, not the raw tagged address.
Test Environment:
In S-mode set senvcfg.PMM={10(PMLEN=7), 11(PMLEN=16)}.
Set medeleg[12,13,15]=1 to delegate U-mode load/store/access faults to S-mode.
If RVMODEL_ACCESS_FAULT_ADDRESS_LOAD is defined, use it as the base illegal address across all modes. Construct addresses by applying upper-16-bit patterns {0x0000, 0x0001, 0x0100, 0x0200, 0x8000, 0xFFFF, 0xFE00, 0xFF00} to this illegal base address.
Switch to U-mode.
Perform one lw to each constructed illegal address under satp.MODE={Bare, Sv39, Sv48, Sv57}.
In the S-mode trap handler, read stval and verify it contains the correctly masked effective address.

Fault is taken; stval written by hardware contains the masked effective address (upper PMLEN bits correctly zeroed in bare mode or sign-extended in VA modes), not the original unmasked address used by the program.

2 PMM × 8 address patterns × 1 lw × 1 mode (U) × satp supported modes (Bare, Sv39, Sv48, Sv57)

pm_csr_hw_apply
pm_no_trap_vector_mask

cp_hardware_csr_writes_fault_store

Verify pointer masking is applied to hardware-written CSR address values.
Verify that stval contains the masked effective address when a fault occurs on a pointer-masked store.

When a fault occurs on an explicit memory access under pointer masking, the hardware-written stval reflects the masked effective address, not the raw tagged address.
Test Environment:
In S-mode set senvcfg.PMM={10(PMLEN=7), 11(PMLEN=16)}.
Set medeleg[12,13,15]=1 to delegate U-mode load/store/access faults to S-mode.
If RVMODEL_ACCESS_FAULT_ADDRESS_STORE is defined, use it as the base illegal address across all modes. Construct addresses by applying upper-16-bit patterns {0x0000, 0x0001, 0x0100, 0x0200, 0x8000, 0xFFFF, 0xFE00, 0xFF00} to this illegal base address.
Switch to U-mode.
Perform one sw to each constructed illegal address under satp.MODE={Bare, Sv39, Sv48, Sv57}.
In the S-mode trap handler, read stval and verify it contains the correctly masked effective address.

Fault is taken; stval written by hardware contains the masked effective address (upper PMLEN bits correctly zeroed in bare mode or sign-extended in VA modes), not the original unmasked address used by the program.

2 PMM × 8 address patterns × 1 sw × 1 mode (U) × satp supported modes (Bare, Sv39, Sv48, Sv57)

pm_csr_hw_apply
pm_no_trap_vector_mask

cp_pmm_uxl_clear

Verify that setting sstatus.UXL=01 (RV32) clears senvcfg.PMM bits

When sstatus.UXL is set to 01 (indicating U-mode is RV32), the pointer masking configuration bits in senvcfg.PMM must be cleared automatically by hardware.
Test Environment:
In S-mode, write senvcfg.PMM={10(PMLEN=7), 11(PMLEN=16)} and confirm the written value is retained by reading back senvcfg.PMM. Then set sstatus.UXL=01 (RV32). Read back senvcfg.PMM and verify it has been cleared to 00 (if UXL is writable).

When sstatus.UXL is set to 01: senvcfg.PMM is cleared to 00 regardless of its previously written value.

2 PMM values (10, 11) × 1 UXL × 1 mode (U)

pm_uxl_clear
pmlen_illegal_warl

Ssnpm_Sm

Ssnpm provides pointer masking for U-mode via senvcfg.PMM. In this sheet , test plan is for the M-mode part of Ssnpm: M-mode accesses memory as U-mode via MPRV. - tests run in M-mode with mstatus.MPRV=1 and mstatus.MPP=U - The suite requires Ssnpm because senvcfg.PMM governs the access. mseccfg.PMM is swept only if Smmpm is supported, to show that it does not apply.

Table 316. Ssnpm Coverpoints (M-mode with MPRV)
Coverpoint Goal Feature Description Expectation Bins Normative Rule

cp_pm_mprv_mpp_u

Verify that senvcfg.PMM governs pointer masking when M-mode accesses memory as U-mode via MPRV.

MPRV affect pointer masking as well, causing the pointer masking settings of the effective privilege mode to be applied.
With MPP=U the effective privilege mode is U, so senvcfg.PMM applies and mseccfg.PMM does not.
Test Environment:
In M-mode set mstatus.MPRV=1 and mstatus.MPP=U
Set mstatus.SUM=1 so the setup code can access user-space pages.
Place known value_old in scratch. Let A' = scratch (upper bits = 0x0000).
Page tables configured for valid mappings under satp.MODE ∈ {Bare, Sv39}, with the data pages user-accessible.
For each mstatus.MXR in {0, 1}:
For each mseccfg.PMM in {00, 10, 11} if Smmpm supported:
For each senvcfg.PMM in {00, 10, 11}:
For each satp.MODE in {Bare, Sv39}:
For each A_upper_bits in {0x0000, 0x0001, 0x0200}:
Set A = A' with upper bits replaced by A_upper_bits
For read (lw): read directly from A in M-mode with MPRV=1, sigupd(value), record any traps.
For write (sw): write unique known value_new to A in M-mode with MPRV=1, read back from scratch (A'), sigupd(value), record any traps.

When senvcfg.PMM=10/11 and MXR=0: A patterns whose upper bits fall within PMLEN resolve to scratch, reads return known value_old, write readbacks return known value_new, regardless of mseccfg.PMM. When senvcfg.PMM=00 or MXR=1: masking disabled : only A=0x0000 resolves to scratch; all other patterns cause a trap.

2 MXR * 3 mseccfg.PMM * 3 senvcfg.PMM * 1 MPRV * 1 MPP (U) * 2 satp.MODE * 3 addresses * 2 instructions (lw, sw)

pm_mprv_spvp

Ssnpm_H

Ssnpm with the H extension provides pointer masking for VS-mode (henvcfg.PMM), VU-mode (senvcfg.PMM), and for the explicit accesses of HLV.* and HSV.* (henvcfg.PMM as VS; senvcfg.PMM from HS-mode or hstatus.HUPMM from U-mode as VU). HLVX.* and accesses with MXR in effect are never masked. Whether the ignore transformation zero-extends or sign-extends is chosen by vsatp.MODE (not satp, not hgatp): vsatp = Bare means the address is a guest physical address (GPA) and is zero-extended. When vsatp is not Bare, the address in rs1 is a guest virtual address (GVA), and the sequence is: * Mask: the top PMLEN bits are replaced with copies of bit XLEN-PMLEN-1 (bit 56 for PMLEN 7, bit 47 for PMLEN 16), the same sign extension as in Ssnpm with Sv39/48/57. * VS stage: the masked GVA is translated to a GPA using vsatp. * G stage: that GPA is translated to a host physical address using hgatp.

Groups. Ssnpm_H boots to HS-mode (BOOT_TO_SMODE) and enters VS/VU with RVTEST_TSBI_GOTO_VSMODE/VUMODE. Every coverpoint is RV64 only (pm_rv64_only). PMM = 10 bins exist only with UDB_SUPPORTED_PMLEN_SSNPM_7 and PMM = 11 bins only with UDB_SUPPORTED_PMLEN_SSNPM_16. PMM fields. The fields are henvcfg.PMM, senvcfg.PMM, hstatus.HUPMM, menvcfg.PMM (Smnpm) and mseccfg.PMM (Smmpm). menvcfg.PMM and mseccfg.PMM are set only when the extension is implemented, and only to PMLENs that Smnpm (UDB_SUPPORTED_PMLEN_SMNPM_*) and Smmpm (UDB_SUPPORTED_PMLEN_SMMPM_*) support, not Ssnpm’s. The fields not under test are set to a different value, so reading the wrong field changes the result: the largest supported value (11, else 10) when the field under test is 00, and 00 otherwise. The HLVX and MXR coverpoints enable every field; the HFENCE coverpoints leave the others at 00. PMM values are the outermost loop because menvcfg and mseccfg need a T-SBI call. Translation modes. (vsatp.MODE, hgatp.MODE) is swept over seven pairs, each bin guarded by its own support macro. With vsatp = Bare the tag bits are GPA bits, so hgatp decides what an unmasked tag does: Bare, Sv39x4, Sv48x4 and Sv57x4 are swept. With vsatp paged, an unmasked tag is stopped by the VS stage before the G stage, so hgatp cannot change the masking result and only the matching width is used: (Sv39, Sv39x4), (Sv48, Sv48x4), (Sv57, Sv57x4). Only cp_vs_pmm and cp_vu_pmm sweep all seven pairs. The other coverpoints use two pairs, each the widest the DUT supports, so they always run once: * BARE_PAIR: the first supported of (Bare, Sv57x4), (Bare, Sv48x4), (Bare, Sv39x4), (Bare, Bare). * PAGED_PAIR: the first supported of (Sv57, Sv57x4), (Sv48, Sv48x4), (Sv39, Sv39x4). Absent when the DUT has no paged vsatp mode. The support guards are mutually exclusive, so a narrower pair adds no bin when a wider one is supported. A tag bit beyond the chosen width faults instead of reaching the alias page, and the expectations already allow both. Tag patterns (A_upper_bits) (bits 63:48 replaced in the base address). Five patterns: * 0x0000 - no tag (the untagged control) * 0x0002 - bit 49: masked by PMLEN 16 only; extra GPA bit of Sv48x4, inside Sv57x4 * 0x0400 - bit 58: masked by PMLEN 7 and 16; extra GPA bit of Sv57x4 * 0xFF00 - bits 63:56: all masked by PMLEN 16, only 63:57 by PMLEN 7 * 0xFFFF - bits 63:48: all masked by PMLEN 16, only 63:57 by PMLEN 7 The partially masked patterns (0xFFFF and 0xFF00 with PMLEN 7) keep some tag bits after masking. Those bits can lie inside the Sv57 address width. The test leaves those addresses unmapped, so the access faults, or maps them to the alias page. The faulting address is invalid, and stval for an invalid address may legally be a different invalid address, so the stval/htval coverpoints (pm_csr_hw_apply) use only 0x0000 and fully masked tags. Expected traps. Counted per tagged access. A tagged access whose tag is fully masked never traps. An access whose tag is not cleared by masking traps at most once, and does not trap when it reaches pm_gpa_alias_page. The readback from A' is untagged and never traps. * cp_*pmm, cp*pmlen_masking, cp*pmlen_zicfiss*, cp_hlv_*pmm: PMM 00 traps only for the unmasked tags (all but 0x0000); PMM 10 traps for 0x0002, 0xFF00 and 0xFFFF; PMM 11 never traps. * cp*mxr_pmm, cp_hlvx*pmm, cp*pmm_jalr: no masking, so every tag except 0x0000 is unmasked. Tag 0x0000 never traps. * cp*pmlen_misaligned_word: tag 0x0000 and fully masked tags only, so no trap is expected. * cp*_hardware_csr_writes_fault_load and _store: every access traps, once per lw (_load) or sw (_store). The tags are 0x0000 and fully masked tags only. * cp_henvcfg_pmm_change_no_hfence: with PMM 00 the Ti access traps, except tag 0x0002 in case 5, which reaches alias_i; with PMM 10 or 11 it never traps. * cp_vs_gstage_no_pmm, cp_henvcfg_pmm_change_hfence, cp_henvcfg_pmm_change_hfence_sv48x4, cp_hupmm_change_hfence, cp_hupmm_change_hfence_sv48x4: no traps. Why do we need a different page than the test data page? A' = pm_lo_page, the test data page (tag bits = 0x0000), pre-loaded with value_old. A tagged address whose tag is NOT cleared by masking must never reach A'. It is either left unmapped (so the access faults), or mapped to a separate page, pm_gpa_alias_page, pre-loaded with value_diff. If both the tagged and the untagged address reached A', a read would return value_old whether or not the hardware masked the tag, so the test could not tell the difference. With a separate page holding a distinct value, the outcome is unambiguous: value_old proves the tag was stripped and A' was reached through masking; value_diff or a fault proves the tag was used as-is. This matters most when the tag bits are inside the GPA width (bits 49:48 with Sv48x4, bits 58:48 with Sv57x4). There the unmasked tagged GPA is a valid address, so the G-stage page tables decide where it goes, and they must not send it to A'. With vsatp paged, the VS stage does the same job: a tagged VA must not translate to A'. With (vsatp, hgatp) = (Bare, Bare) there is no table to leave unmapped. A tagged address is a host physical address, so an unmasked tag bit must lie outside the PA width or in a PMA hole. The access then raises an access fault and cannot alias DRAM. A tag is therefore used with (Bare, Bare) only if every bit it leaves unmasked is at or above the PA width: 0x0002 (bit 49) needs PA width ⇐ 49, and 0xFFFF with PMLEN 7 (bits 56:48) needs PA width ⇐ 48. Otherwise the tag is dropped for (Bare, Bare). 0x0400 (bit 58) and 0xFF00 with PMLEN 7 (bit 56) are used with every PA width up to 56.

Table 317. Ssnpm_H Coverpoints (pointer masking in VS-mode, VU-mode)
Coverpoint Goal Feature Description Expectation Bins Normative Rule Notes

cp_vs_pmm

henvcfg.PMM masks loads and stores in VS-mode, for guest physical (vsatp = Bare) and guest virtual (vsatp paged) addresses

Test Environment:
In HS-mode, identity map the test image in both stages. Seed pm_lo_page with value_old.
Set henvcfg.PMM and the other PMM fields as in the notes, then HFENCE.GVMA x0, x0 and HFENCE.VVMA x0, x0.
Switch to VS-mode and execute the following loop:
For each henvcfg.PMM in {00, 10, 11} (outermost loop; the other PMM fields as in the notes) under (vsatp.MODE, hgatp.MODE) in {(Bare, Bare), (Bare, Sv39x4), (Bare, Sv48x4), (Bare, Sv57x4), (Sv39, Sv39x4), (Sv48, Sv48x4), (Sv57, Sv57x4)}:
For each A_upper_bits:
Set A = A' with upper bits replaced by A_upper_bits
ld from A, sigupd(value) + record any traps.
sd unique value_new to A, then read back from A' (untagged), sigupd(value) + record any traps.

When henvcfg.PMM = 10/11 and every tag bit is within PMLEN: the access reaches A' (ld returns value_old, the readback
returns value_new), no trap.
vsatp = Bare: A is a guest physical address, so the top PMLEN bits are zero-extended.
vsatp paged: A is a guest virtual address, so the top PMLEN bits are sign-extended from bit XLEN-PMLEN-1.
Otherwise (PMM = 00, or a tag bit outside PMLEN): the access faults, or reaches a page other than A':
vsatp = Bare: load or store/AMO guest-page fault (hgatp paged), or load or store/AMO access fault (hgatp Bare).
vsatp paged: load or store/AMO page fault (non-canonical or unmapped VA).

priv_mode VS x {ld, sd} x henvcfg.PMM {00, 10, 11} x tag {5 patterns} x (vsatp, hgatp) {(Bare, Bare), (Bare, Sv39x4), (Bare, Sv48x4), (Bare, Sv57x4), (Sv39, Sv39x4), (Sv48, Sv48x4), (Sv57, Sv57x4)}
PMM 10 and 11 only when PMLEN 7 and 16 are supported; each vsatp and hgatp mode only when supported

henvcfg_pmm_op
pm_ignore_upper_bits
pm_ignore_va
pm_ignore_pa
pm_apply_explicit
pmlen_supported_values
pm_per_mode_control
pm_config_next_higher
pm_mode_only_dependency
ssnpm_definition
pmlen_mode_depend
pm_deterministic_effect
pm_csr_hw_apply

cp_vu_pmm

senvcfg.PMM masks loads and stores in VU-mode, for guest physical (vsatp = Bare) and guest virtual (vsatp paged) addresses

Same test environment and loop as cp_vs_pmm, except:
- the field under test is senvcfg.PMM;
- the VS-stage data pages have PTE.U = 1;
- the accesses run in VU-mode.
The VS-writer bins use tag 0x0400, which both PMLENs mask. Tag 0xFFFF is not used there: with PMM 10, PMLEN 7
sign-extends it from bit 56 back to 0xFFFF, so masking would change nothing.
Writer {HS-mode, VS-mode}: senvcfg has no VS copy, so a csrw senvcfg in VS-mode writes the real senvcfg.PMM.
With writer HS-mode, HS-mode sets senvcfg.PMM as in cp_vs_pmm. With writer VS-mode:
1. HS-mode sets senvcfg.PMM to a value different from the one under test (the opposite rule of the notes). When
Ssstateen is implemented, it also sets mstateen0.ENVCFG = 1 and hstateen0.ENVCFG = 1, since VS-mode can write
senvcfg only with hstateen0.ENVCFG = 1. It then switches to VS-mode.
2. VS-mode executes csrw senvcfg with the PMM under test, reads senvcfg back, and sigupd(value).
This write does not change the masking of VS-mode itself, which follows henvcfg.PMM.
3. VS-mode switches to VU-mode (RVTEST_TSBI_GOTO_VUMODE) and runs the loop.

As cp_vs_pmm, with the PMLEN of senvcfg.PMM. With writer VS-mode, the csrw does not trap, senvcfg.PMM reads back
the value written, and the VU accesses follow it, not the value HS-mode set.

priv_mode VU x writer HS-mode x {ld, sd} x senvcfg.PMM {00, 10, 11} x tag {5 patterns} x (vsatp, hgatp) {(Bare, Bare), (Bare, Sv39x4), (Bare, Sv48x4), (Bare, Sv57x4), (Sv39, Sv39x4), (Sv48, Sv48x4), (Sv57, Sv57x4)}
cp_vu_pmm_writer_vs, the writer VS-mode: priv_mode VS x csrw x senvcfg x senvcfg.PMM after the write {00, 10, 11}. The VU accesses that follow are the writer HS-mode bins of cp_vu_pmm. The test runs it with vsatp = Bare, since VS-mode cannot execute the user-accessible code alias of a paged VS stage.
PMM 10 and 11 only when PMLEN 7 and 16 are supported; each vsatp and hgatp mode only when supported

senvcfg_pmm_ssnpm
pm_ignore_va
pm_ignore_pa
pm_apply_explicit
pm_per_mode_control
pm_config_next_higher
ssnpm_definition
pmlen_mode_depend
senvcfg_pmm_enc

cp_vs_gstage_no_pmm

henvcfg.PMM masks the address of a VS-mode access, never the guest physical address that the VS stage produces

Pointer masking applies to the address an instruction computes. The GPA that the VS stage produces and the G stage
that translates it are implicit steps, so neither is masked. The test maps an untagged guest virtual address to a GPA
whose top bit b lies in the masked range. If the GPA were masked, bit b would be cleared and the access would reach
A' instead of the alias page.
Test Environment:
In HS-mode, vsatp paged. b is the top GPA bit: 49 for Sv48x4, 58 for Sv57x4.
G = GPA(A') with bit b set. The VS stage maps the untagged VA V to G.
The G stage maps GPA(A') to pm_lo_page (value_old) and G to pm_gpa_alias_page (value_diff).
Set henvcfg.PMM and the other PMM fields as in the notes, then HFENCE.GVMA x0, x0 and HFENCE.VVMA x0, x0.
Switch to VS-mode and execute the following loop:
For each (vsatp.MODE, hgatp.MODE) in {(Sv48, Sv48x4), (Sv57, Sv57x4)}:
For each henvcfg.PMM in {10, 11} (outermost loop; the other PMM fields as in the notes):
ld from V, sigupd(value) + record any traps.
sd unique value_new to V, then read back from A' and from the alias page, sigupd(value) + record any traps.

No trap. ld returns value_diff, sd writes the alias page, and A' still holds value_old. A hart that masks the GPA
would clear bit b, reach A', and return value_old.

Not sampled: the guest physical address that the VS stage produces cannot be sampled, and the VS-mode ld and sd of cp_vs_pmm already fill any bin made from the paged pair and PMM. The signature checks it.
Cases the test runs: priv_mode VS x {ld, sd} x henvcfg.PMM {11 (Sv48x4: bit 49), 10 and 11 (Sv57x4: bit 58)} x (vsatp, hgatp) {(Sv48, Sv48x4), (Sv57, Sv57x4)}
PMM 10 and 11 only when PMLEN 7 and 16 are supported; each vsatp and hgatp mode only when supported

pm_not_apply_implicit
henvcfg_pmm_op

With PMLEN 7, bit 49 is not masked, so Sv48x4 is tested with PMM = 11 only.

cp_hlv_hs_spvp1_pmm

HLV and HSV in HS-mode with hstatus.SPVP = 1 (access as VS) take henvcfg.PMM

With hstatus.SPVP = 1, for each henvcfg.PMM value, hlv.d and hsv.d in HS-mode at the test data with each tag set.
Test Environment:
In HS-mode, identity map the test image in both stages; the VS-stage data pages have PTE.U = 0.
Seed pm_lo_page with value_old.
HLV/HSV run with V = 0, but the address type (GPA or GVA) still comes from vsatp.
HFENCE.GVMA x0, x0 and HFENCE.VVMA x0, x0 after each PMM, vsatp or hgatp change.
For each henvcfg.PMM in {00, 10, 11} (outermost loop; the other PMM fields as in the notes) under (vsatp.MODE, hgatp.MODE) in {BARE_PAIR, PAGED_PAIR}:
For each A_upper_bits in the 5 tag patterns:
Set A = A' with upper bits replaced by A_upper_bits
hlv.d from A, sigupd(value) + record any traps.
hsv.d value_new to A, then hlv.d from A' (untagged), sigupd(value) + record any traps.

As cp_vs_pmm, with the PMLEN of henvcfg.PMM: when every tag bit is within PMLEN, hlv.d returns value_old
and the readback after hsv.d returns value_new; otherwise the access faults or reaches a
page other than A'. Faults are taken in HS-mode with hstatus.GVA = 1.

priv_mode HS x {hlv.d, hsv.d} x hstatus.SPVP = 1 x henvcfg.PMM {00, 10, 11} x tag {5 patterns} x (vsatp, hgatp) {BARE_PAIR, PAGED_PAIR}
PMM 10 and 11 only when PMLEN 7 and 16 are supported; each vsatp and hgatp mode only when supported

henvcfg_pmm_op
pm_ignore_va
pm_ignore_pa
pm_apply_explicit
pm_mprv_spvp

cp_hlv_hs_spvp1_mxr_pmm

vsstatus.MXR = 1 or sstatus.MXR = 1 turns henvcfg.PMM pointer masking off for HLV and HSV in HS-mode with hstatus.SPVP = 1 (access as VS)

Same test environment and loop as cp_hlv_hs_spvp1_pmm, except:
- for each PMM in {10, 11} (outermost), all PMM fields are set to that value, so a masked result can only mean MXR was ignored;
- inside it, for each (vsstatus.MXR, sstatus.MXR) in {(0,1), (1,0), (1,1)}, HS-mode sets both bits;
- A_upper_bits is in {0x0000, 0x0400} (PMM 10) or {0x0000, 0xFFFF} (PMM 11) and (vsatp.MODE, hgatp.MODE) is in {BARE_PAIR, PAGED_PAIR}.

No masking for every MXR combination. Tag 0x0000 reaches the test data (the control). Every other tag is used
unmasked: the access faults or reaches a page other than A'.

priv_mode HS x {hlv.d, hsv.d} x hstatus.SPVP = 1 x (vsstatus.MXR, sstatus.MXR) {(0,1), (1,0), (1,1)} x henvcfg.PMM {10, 11} x tag (PMM 10 {0x0000, 0x0400}, PMM 11 {0x0000, 0xFFFF}) x (vsatp, hgatp) {BARE_PAIR, PAGED_PAIR}
PMM 10 and 11 only when PMLEN 7 and 16 are supported; each vsatp and hgatp mode only when supported

pm_mprv_spvp
pm_mxr_exception

vsstatus.MXR = 0 and sstatus.MXR = 0 is cp_hlv_hs_spvp1_pmm.

cp_hlv_hs_spvp0_pmm

HLV and HSV in HS-mode with hstatus.SPVP = 0 (access as VU) take senvcfg.PMM

Same test environment and loop as cp_hlv_hs_spvp1_pmm, except:
- hstatus.SPVP = 0;
- the field under test is senvcfg.PMM;
- the VS-stage data pages have PTE.U = 1.

As cp_hlv_hs_spvp1_pmm, with the PMLEN of senvcfg.PMM.

priv_mode HS x {hlv.d, hsv.d} x hstatus.SPVP = 0 x senvcfg.PMM {00, 10, 11} x tag {5 patterns} x (vsatp, hgatp) {BARE_PAIR, PAGED_PAIR}
PMM 10 and 11 only when PMLEN 7 and 16 are supported; each vsatp and hgatp mode only when supported

senvcfg_pmm_ssnpm
pm_ignore_va
pm_ignore_pa
pm_apply_explicit
pm_mprv_spvp

cp_hlv_hs_spvp0_mxr_pmm

vsstatus.MXR = 1 or sstatus.MXR = 1 turns senvcfg.PMM pointer masking off for HLV and HSV in HS-mode with hstatus.SPVP = 0 (access as VU)

Same test environment and loop as cp_hlv_hs_spvp0_pmm, except:
- for each PMM in {10, 11} (outermost), all PMM fields are set to that value, so a masked result can only mean MXR was ignored;
- inside it, for each (vsstatus.MXR, sstatus.MXR) in {(0,1), (1,0), (1,1)}, HS-mode sets both bits;
- A_upper_bits is in {0x0000, 0x0400} (PMM 10) or {0x0000, 0xFFFF} (PMM 11) and (vsatp.MODE, hgatp.MODE) is in {BARE_PAIR, PAGED_PAIR}.

No masking for every MXR combination. Tag 0x0000 reaches the test data (the control). Every other tag is used
unmasked: the access faults or reaches a page other than A'.

priv_mode HS x {hlv.d, hsv.d} x hstatus.SPVP = 0 x (vsstatus.MXR, sstatus.MXR) {(0,1), (1,0), (1,1)} x senvcfg.PMM {10, 11} x tag (PMM 10 {0x0000, 0x0400}, PMM 11 {0x0000, 0xFFFF}) x (vsatp, hgatp) {BARE_PAIR, PAGED_PAIR}
PMM 10 and 11 only when PMLEN 7 and 16 are supported; each vsatp and hgatp mode only when supported

pm_mprv_spvp
pm_mxr_exception

vsstatus.MXR = 0 and sstatus.MXR = 0 is cp_hlv_hs_spvp0_pmm.

cp_hlv_u_spvp1_pmm

HLV and HSV in U-mode with hstatus.SPVP = 1 (access as VS) take henvcfg.PMM

Same test environment and loop as cp_hlv_hs_spvp1_pmm, except:
- hstatus.HU = 1; HS-mode sets hstatus.SPVP and henvcfg.PMM, then switches to U-mode for the accesses.

As cp_hlv_hs_spvp1_pmm, with the PMLEN of henvcfg.PMM.

priv_mode U x hstatus.HU = 1 x {hlv.d, hsv.d} x hstatus.SPVP = 1 x henvcfg.PMM {00, 10, 11} x tag {5 patterns} x (vsatp, hgatp) {BARE_PAIR, PAGED_PAIR}
PMM 10 and 11 only when PMLEN 7 and 16 are supported; each vsatp and hgatp mode only when supported

hlsv_mode
hlsv_op
hstatus_hu_op
hlvx-wu_valid32
henvcfg_pmm_op
pm_mprv_spvp

cp_hlv_u_spvp0_pmm

HLV and HSV in U-mode with hstatus.SPVP = 0 (access as VU) take hstatus.HUPMM

Same test environment and loop as cp_hlv_hs_spvp1_pmm, except:
- hstatus.HU = 1 and hstatus.SPVP = 0; HS-mode sets hstatus.HUPMM, then switches to U-mode for the accesses;
- the field under test is hstatus.HUPMM;
- the VS-stage data pages have PTE.U = 1.

As cp_hlv_hs_spvp1_pmm, with the PMLEN of hstatus.HUPMM.

priv_mode U x hstatus.HU = 1 x {hlv.d, hsv.d} x hstatus.SPVP = 0 x hstatus.HUPMM {00, 10, 11} x tag {5 patterns} x (vsatp, hgatp) {BARE_PAIR, PAGED_PAIR}
PMM 10 and 11 only when PMLEN 7 and 16 are supported; each vsatp and hgatp mode only when supported

hlsv_mode
hlsv_op
hstatus_hu_op
hlvx-wu_valid32
pm_mprv_spvp

This is the one VU access that does not use senvcfg.PMM: in U-mode senvcfg.PMM holds the host’s own U-mode
setting, so the guest’s VU setting is copied into hstatus.HUPMM. The HUPMM paragraph has no normative tag.

cp_hlvx_hs_pmm

HLVX in HS-mode is never masked

With every PMM field enabled (henvcfg.PMM = senvcfg.PMM = hstatus.HUPMM), hlvx.wu in HS-mode for
hstatus.SPVP = 0 and 1 at the test data with each tag set.
Test Environment:
Identity map the test image in both stages, with the data page executable (X = 1) in both stages so the
untagged HLVX succeeds; the VS-stage page has PTE.U = 1 when SPVP = 0 and PTE.U = 0 when SPVP = 1.
Seed pm_lo_page with value_old.
For each PMM in {10, 11} under (vsatp.MODE, hgatp.MODE) in {BARE_PAIR, PAGED_PAIR}:
For each hstatus.SPVP in {0, 1}:
For each A_upper_bits in the 5 tag patterns:
Set A = A' with upper bits replaced by A_upper_bits
hlvx.wu: read from A, sigupd(value) + record any traps.

Tag 0x0000 returns the data (the control: without it a hart where HLVX always faults would pass).
Every other tag is used unmasked: the access faults or reaches a page other than A'. When the faulting address
is valid, stval holds it untransformed; for an invalid address stval may be a different invalid address and is
not checked.

priv_mode HS x hlvx.wu x hstatus.SPVP {0, 1} x henvcfg.PMM = senvcfg.PMM = hstatus.HUPMM {10, 11} x tag {5 patterns} x (vsatp, hgatp) {BARE_PAIR, PAGED_PAIR}
PMM 10 and 11 only when PMLEN 7 and 16 are supported; each vsatp and hgatp mode only when supported

hlsv_mode
hlsv_op
hstatus_hu_op
hlvx-wu_valid32

The HLVX sentence in hypervisor.adoc ("not subject to pointer masking") has no normative tag.

cp_hlvx_u_pmm

HLVX in U-mode is never masked

Same test environment and loop as cp_hlvx_hs_pmm, except hstatus.HU = 1 and the accesses run in U-mode
(HS-mode sets hstatus.SPVP and the PMM fields, then switches to U-mode).

As cp_hlvx_hs_pmm.

priv_mode U x hstatus.HU = 1 x hlvx.wu x hstatus.SPVP {0, 1} x henvcfg.PMM = senvcfg.PMM = hstatus.HUPMM {10, 11} x tag {5 patterns} x (vsatp, hgatp) {BARE_PAIR, PAGED_PAIR}
PMM 10 and 11 only when PMLEN 7 and 16 are supported; each vsatp and hgatp mode only when supported

hlsv_mode
hlsv_op
hstatus_hu_op
hlvx-wu_valid32

cp_vs_mxr_pmm

vsstatus.MXR = 1 or sstatus.MXR = 1 turns henvcfg.PMM pointer masking off in VS-mode

With vsstatus.MXR = 1 or sstatus.MXR = 1 (or both) and henvcfg.PMM enabled, ld and sd in VS-mode at the test data
with each tag set. vsstatus.MXR applies to the VS stage only; sstatus.MXR applies to both stages. Either one is
MXR in effect for a guest access.
Test Environment:
In HS-mode, identity map the test image in both stages; the VS-stage data pages have PTE.U = 0.
Seed pm_lo_page with value_old.
For each PMM in {10, 11}, written to henvcfg.PMM, senvcfg.PMM, hstatus.HUPMM and, when implemented, menvcfg.PMM and mseccfg.PMM (outermost):
For each (vsstatus.MXR, sstatus.MXR) in {(0,1), (1,0), (1,1)}, under (vsatp.MODE, hgatp.MODE) in {BARE_PAIR, PAGED_PAIR}: set both MXR bits in HS-mode.
Switch to VS-mode and execute the following loop:
For each A_upper_bits in {0x0000, 0x0400} (PMM 10) or {0x0000, 0xFFFF} (PMM 11):
Set A = A' with upper bits replaced by A_upper_bits
ld from A, sigupd(value) + record any traps.
sd unique value_new to A, then read back from A' (untagged), sigupd(value) + record any traps.

No masking for every MXR combination. Tag 0x0000 reaches the test data (the control). Every other tag is used
unmasked: the access faults or reaches a page other than A'.

priv_mode VS x {ld, sd} x (vsstatus.MXR, sstatus.MXR) {(0,1), (1,0), (1,1)} x henvcfg.PMM {10, 11} x tag (PMM 10 {0x0000, 0x0400}, PMM 11 {0x0000, 0xFFFF}) x (vsatp, hgatp) {BARE_PAIR, PAGED_PAIR}
PMM 10 and 11 only when PMLEN 7 and 16 are supported; each vsatp and hgatp mode only when supported

pm_mxr_exception

vsstatus.MXR = 0 and sstatus.MXR = 0 is cp_vs_pmm.

cp_vu_mxr_pmm

vsstatus.MXR = 1 or sstatus.MXR = 1 turns senvcfg.PMM pointer masking off in VU-mode

Same test environment and loop as cp_vs_mxr_pmm, except:
- the VS-stage data pages have PTE.U = 1;
- the accesses run in VU-mode.

As cp_vs_mxr_pmm.

priv_mode VU x {ld, sd} x (vsstatus.MXR, sstatus.MXR) {(0,1), (1,0), (1,1)} x senvcfg.PMM {10, 11} x tag (PMM 10 {0x0000, 0x0400}, PMM 11 {0x0000, 0xFFFF}) x (vsatp, hgatp) {BARE_PAIR, PAGED_PAIR}
PMM 10 and 11 only when PMLEN 7 and 16 are supported; each vsatp and hgatp mode only when supported

pm_mxr_exception

vsstatus.MXR = 0 and sstatus.MXR = 0 is cp_vu_pmm.

cp_vs_pmlen_masking

henvcfg.PMM ignores the upper PMLEN bits of the address for every kind of memory-accessing instruction in VS-mode

If pointer masking is enabled, addresses differing only in upper PMLEN bits access the same location. This is
cp_pmlen_masking of Ssnpm run in VS-mode with henvcfg.PMM. Each instruction is tested in one variant only, the .D
form where there is one.
Test Environment:
In HS-mode, identity map the test image in both stages; the VS-stage data pages have PTE.U = 0.
Seed pm_lo_page with value_old.
Enable the state the instruction groups need: FS and VS in mstatus and vsstatus, menvcfg.CBZE, menvcfg.CBCFE, henvcfg.CBZE and henvcfg.CBCFE.
Set henvcfg.PMM and the other PMM fields as in the notes, then HFENCE.GVMA x0, x0 and HFENCE.VVMA x0, x0.
Switch to VS-mode and execute the following loop:
For each henvcfg.PMM in {00, 10, 11} (outermost loop; the other PMM fields as in the notes) under (vsatp.MODE, hgatp.MODE) in {BARE_PAIR, PAGED_PAIR}:
For each A_upper_bits in {0x0000, 0x0400, 0xFFFF}:
Set A = A' with upper bits replaced by A_upper_bits
For each read instruction: read from A, sigupd(value) + record any traps.
For each write instruction: write unique value_new to A, then read back from A' (untagged), sigupd(value) + record any traps.
Instructions covered under this loop:
(ATOMIC OPS): Each AMO is both a read and a write, so treat it as a write: perform the AMO at A, read back from A'.
If RV64A: amoadd.d. If Zacas: amocas.d. If Zabha: amoadd.h (Zabha has only byte and halfword forms).
(FLOATING POINT OPS): If D, Read: fld. Write: fsd.
(COMPRESSED OPS): If Zca, Reads: c.ld, c.ldsp. Writes: c.sd, c.sdsp. If Zcd, Read: c.fldsp. Write: c.fsdsp.
(CACHE MANAGEMENT OPS): If Zicboz: cbo.zero at A (write), read back from A'.
If Zicbom: cbo.clean at A (write), read back from A'.
prefetch.w at A, not gated on Zicbop. It is a hint with no architectural effect, so no cache effect is observed;
the bin only records that the instruction executed at the tagged address.
(VECTOR OPS): If RVV 1.0, Reads: vle64.v, vlse64.v, vluxei64.v, vloxei64.v, vlseg2e64.v, vl1re64.v, vle64ff.v from A, sigupd.
Writes: vse64.v, vsse64.v, vsuxei64.v, vsoxei64.v, vsseg2e64.v, vs1r.v to A, read back from A', sigupd(value) + record any traps.

As cp_vs_pmm, with the PMLEN of henvcfg.PMM, for every instruction in the loop.

priv_mode VS x {{amoadd.d (RV64A), amocas.d (Zacas), amoadd.h (Zabha)} + {fld, fsd (D)} + {c.ld, c.sd, c.ldsp, c.sdsp (Zca), c.fldsp, c.fsdsp (Zcd)} + {cbo.zero (Zicboz), cbo.clean (Zicbom), prefetch.w (coverage only)} + {vle64.v, vlse64.v, vluxei64.v, vloxei64.v, vlseg2e64.v, vl1re64.v, vle64ff.v, vse64.v, vsse64.v, vsuxei64.v, vsoxei64.v, vsseg2e64.v, vs1r.v (RVV)}} x henvcfg.PMM {00, 10, 11} x tag {0x0000, 0x0400, 0xFFFF} x (vsatp, hgatp) {BARE_PAIR, PAGED_PAIR}
PMM 10 and 11 only when PMLEN 7 and 16 are supported; each vsatp and hgatp mode only when supported; each instruction group only when its extension is implemented (prefetch.w always)

henvcfg_pmm_op
pm_ignore_upper_bits
pm_ignore_va
pm_ignore_pa
pm_apply_explicit
pm_deterministic_effect
pmlen_supported_values
pm_per_mode_control
pm_config_next_higher
pm_mode_only_dependency
ssnpm_definition
pm_rv64_only
pmlen_mode_depend
pm_cpu_only

cp_vu_pmlen_masking

senvcfg.PMM ignores the upper PMLEN bits of the address for every kind of memory-accessing instruction in VU-mode

Same test environment and loop as cp_vs_pmlen_masking, except:
- the field under test is senvcfg.PMM;
- the VS-stage data pages have PTE.U = 1;
- senvcfg.CBZE and senvcfg.CBCFE are also enabled;
- the accesses run in VU-mode.

As cp_vs_pmlen_masking, with the PMLEN of senvcfg.PMM.

priv_mode VU x {{amoadd.d (RV64A), amocas.d (Zacas), amoadd.h (Zabha)} + {fld, fsd (D)} + {c.ld, c.sd, c.ldsp, c.sdsp (Zca), c.fldsp, c.fsdsp (Zcd)} + {cbo.zero (Zicboz), cbo.clean (Zicbom), prefetch.w (coverage only)} + {vle64.v, vlse64.v, vluxei64.v, vloxei64.v, vlseg2e64.v, vl1re64.v, vle64ff.v, vse64.v, vsse64.v, vsuxei64.v, vsoxei64.v, vsseg2e64.v, vs1r.v (RVV)}} x senvcfg.PMM {00, 10, 11} x tag {0x0000, 0x0400, 0xFFFF} x (vsatp, hgatp) {BARE_PAIR, PAGED_PAIR}
PMM 10 and 11 only when PMLEN 7 and 16 are supported; each vsatp and hgatp mode only when supported; each instruction group only when its extension is implemented (prefetch.w always)

senvcfg_pmm_ssnpm
senvcfg_pmm_enc
pm_ignore_upper_bits
pm_ignore_va
pm_ignore_pa
pm_apply_explicit
pm_deterministic_effect
pmlen_supported_values
pm_per_mode_control
pm_config_next_higher
pm_mode_only_dependency
ssnpm_definition
pm_rv64_only
pmlen_mode_depend

cp_vs_pmlen_zicfiss_amo

henvcfg.PMM ignores the upper PMLEN bits of the SSAMOSWAP address in VS-mode

If pointer masking is enabled, SSAMOSWAP.W/D addresses differing only in upper PMLEN bits access the same shadow
stack location. This is cp_pmlen_zicfiss_amo of Ssnpm run in VS-mode with henvcfg.PMM.
SSAMOSWAP needs an address in a shadow stack page, so vsatp = Bare is not tested: there it always faults.
Test Environment:
Gated on Zicfiss. In HS-mode, identity map the test image in both stages.
Map ss_page (A', upper bits 0x0000) in the VS stage as a shadow stack page (PTE.xwr = 010, PTE.U = 0) and in the
G stage with R = W = 1.
Set menvcfg.SSE = 1 and henvcfg.SSE = 1.
Set henvcfg.PMM and the other PMM fields as in the notes, then HFENCE.GVMA x0, x0 and HFENCE.VVMA x0, x0.
Switch to VS-mode and execute the following loop:
For each henvcfg.PMM in {00, 10, 11} (outermost loop; the other PMM fields as in the notes) under (vsatp.MODE, hgatp.MODE) = PAGED_PAIR:
For each A_upper_bits in {0x0000, 0x0400, 0xFFFF}:
Set A = A' with upper bits replaced by A_upper_bits
Place known value_old in ss_page with SSAMOSWAP.D at A'.
For each of {SSAMOSWAP.W, SSAMOSWAP.D}: swap unique value_new at A, sigupd(rd), then read back from ss_page (A'), sigupd(value) + record any traps.

When henvcfg.PMM = 10/11 and every tag bit is within PMLEN: rd returns value_old, the readback returns value_new, no
trap. Otherwise (PMM = 00, or a tag bit outside PMLEN): the access takes a store/AMO page fault or reaches a page
other than ss_page, rd is unchanged and the readback returns value_old.

priv_mode VS x {ssamoswap.w, ssamoswap.d} (Zicfiss) x henvcfg.PMM {00, 10, 11} x tag {0x0000, 0x0400, 0xFFFF} x (vsatp, hgatp) {PAGED_PAIR}
PMM 10 and 11 only when PMLEN 7 and 16 are supported; only when a paged pair is supported

henvcfg_pmm_op
pm_ignore_upper_bits
pm_ignore_va
pm_apply_explicit

cp_vu_pmlen_zicfiss_amo

senvcfg.PMM ignores the upper PMLEN bits of the SSAMOSWAP address in VU-mode

Same test environment and loop as cp_vs_pmlen_zicfiss_amo, except:
- the field under test is senvcfg.PMM;
- the VS-stage shadow stack page has PTE.U = 1;
- senvcfg.SSE is also enabled;
- the accesses run in VU-mode.

As cp_vs_pmlen_zicfiss_amo, with the PMLEN of senvcfg.PMM.

priv_mode VU x {ssamoswap.w, ssamoswap.d} (Zicfiss) x senvcfg.PMM {00, 10, 11} x tag {0x0000, 0x0400, 0xFFFF} x (vsatp, hgatp) {PAGED_PAIR}
PMM 10 and 11 only when PMLEN 7 and 16 are supported; only when a paged pair is supported

pm_ignore_upper_bits
pm_ignore_va
pm_apply_explicit
senvcfg_pmm_ssnpm
senvcfg_pmm_enc

cp_vs_pmlen_zicfiss_ssp

henvcfg.PMM ignores the upper PMLEN bits of the ssp address of shadow stack pushes and pops in VS-mode

SSPUSH and SSPOPCHK address memory through the ssp CSR instead of rs1. If pointer masking is enabled, ssp values
differing only in upper PMLEN bits access the same shadow stack location. This is cp_pmlen_zicfiss_ssp of Ssnpm
run in VS-mode with henvcfg.PMM. vsatp = Bare is not tested: there pushes and pops always fault.
Same test environment as cp_vs_pmlen_zicfiss_amo. Execute the following loop in VS-mode:
For each henvcfg.PMM in {00, 10, 11} (outermost loop; the other PMM fields as in the notes) under (vsatp.MODE, hgatp.MODE) = PAGED_PAIR:
For each A_upper_bits in {0x0000, 0x0400, 0xFFFF}:
Set A = A' with upper bits replaced by A_upper_bits
Place known value_old in ss_page with SSAMOSWAP.D at A'.
For each push {sspush x1, sspush x5, c.sspush x1 (if Zcmop)}: set ssp = A + 8 and the link register = value_new, push, sigupd(ssp), then read back from ss_page (A'), sigupd(value) + record any traps.
For each pop {sspopchk x1, sspopchk x5, c.sspopchk x5 (if Zcmop)}: the pushes left value_new at A', so first reseed
value_old in ss_page with SSAMOSWAP.D at A' (untagged). Then set ssp = A and the link register = value_old, pop, sigupd(ssp) + record any traps.

When henvcfg.PMM = 10/11 and every tag bit is within PMLEN: a push writes value_new and leaves ssp = A, a pop
matches value_old and leaves ssp = A + 8, no trap. Otherwise: the access takes a store/AMO page fault or reaches
a page other than ss_page, ssp is unchanged and the readback returns value_old.

priv_mode VS x {sspush x1, sspush x5, sspopchk x1, sspopchk x5} (Zicfiss) + {c.sspush x1, c.sspopchk x5} (Zcmop) x henvcfg.PMM {00, 10, 11} x tag {0x0000, 0x0400, 0xFFFF} x (vsatp, hgatp) {PAGED_PAIR}
PMM 10 and 11 only when PMLEN 7 and 16 are supported; only when a paged pair is supported

henvcfg_pmm_op
pm_ignore_upper_bits
pm_ignore_va
pm_apply_explicit

cp_vu_pmlen_zicfiss_ssp

senvcfg.PMM ignores the upper PMLEN bits of the ssp address of shadow stack pushes and pops in VU-mode

Same test environment and loop as cp_vs_pmlen_zicfiss_ssp, except:
- the field under test is senvcfg.PMM;
- the VS-stage shadow stack page has PTE.U = 1;
- senvcfg.SSE is also enabled;
- the accesses run in VU-mode.

As cp_vs_pmlen_zicfiss_ssp, with the PMLEN of senvcfg.PMM.

priv_mode VU x {sspush x1, sspush x5, sspopchk x1, sspopchk x5} (Zicfiss) + {c.sspush x1, c.sspopchk x5} (Zcmop) x senvcfg.PMM {00, 10, 11} x tag {0x0000, 0x0400, 0xFFFF} x (vsatp, hgatp) {PAGED_PAIR}
PMM 10 and 11 only when PMLEN 7 and 16 are supported; only when a paged pair is supported

pm_ignore_upper_bits
pm_ignore_va
pm_apply_explicit
senvcfg_pmm_ssnpm
senvcfg_pmm_enc

cp_vs_pmm_jalr

Pointer masking never applies to instruction fetch, so a JALR through a tagged pointer in VS-mode is not masked

For implicit memory accesses such as instruction fetches, pointer masking does not apply.
Test Environment:
In HS-mode, identity map the test image in both stages; the VS-stage code pages have PTE.U = 0.
Place valid executable instructions at A'. Map the alias pages non-executable (X = 0) in each paged stage, so a
fetch that reaches one takes an instruction page fault or guest-page fault instead of executing.
Set henvcfg.PMM and the other PMM fields as in the notes, then HFENCE.GVMA x0, x0 and HFENCE.VVMA x0, x0.
Switch to VS-mode and execute the following loop:
For each henvcfg.PMM in {00, 10, 11} (outermost loop; the other PMM fields as in the notes) under (vsatp.MODE, hgatp.MODE) in {BARE_PAIR, PAGED_PAIR}:
For each A_upper_bits in the 5 tag patterns:
Set A = A' with upper bits replaced by A_upper_bits
jalr to A, sigupd(result) + record any traps.

No masking for any henvcfg.PMM. Tag 0x0000 reaches the code at A' (the control). Every other tag is fetched
unmasked: instruction page fault (vsatp paged), instruction guest-page fault (vsatp = Bare, hgatp paged), or
instruction access fault (hgatp Bare), including a fetch that reaches a non-executable alias page.

priv_mode VS x jalr x henvcfg.PMM {00, 10, 11} x tag {5 patterns} x (vsatp, hgatp) {BARE_PAIR, PAGED_PAIR}
PMM 10 and 11 only when PMLEN 7 and 16 are supported; each vsatp and hgatp mode only when supported

pm_not_apply_implicit

cp_vu_pmm_jalr

Pointer masking never applies to instruction fetch, so a JALR through a tagged pointer in VU-mode is not masked

Same test environment and loop as cp_vs_pmm_jalr, except:
- the field under test is senvcfg.PMM;
- the VS-stage code pages have PTE.U = 1;
- the jalr runs in VU-mode.

As cp_vs_pmm_jalr.

priv_mode VU x jalr x senvcfg.PMM {00, 10, 11} x tag {5 patterns} x (vsatp, hgatp) {BARE_PAIR, PAGED_PAIR}
PMM 10 and 11 only when PMLEN 7 and 16 are supported; each vsatp and hgatp mode only when supported

pm_not_apply_implicit

cp_vs_pmlen_misaligned_word

Pointer masking is applied to the address of a misaligned access in VS-mode

Only the enabled PMM values, tag 0x0000 and fully masked tags are used. Whether a
misaligned access reports a misaligned, page or access fault first is implementation-defined, so a faulting
misaligned access has no single expected trap on a hart without misaligned support.
Test Environment:
In HS-mode, identity map the test image in both stages; the VS-stage data pages have PTE.U = 0.
Place known value_old at pm_lo_page+1, which is misaligned for a word access. Let A' = pm_lo_page+1.
Set henvcfg.PMM and the other PMM fields as in the notes, then HFENCE.GVMA x0, x0 and HFENCE.VVMA x0, x0.
Switch to VS-mode and execute the following loop:
For each henvcfg.PMM in {10, 11} (outermost loop; the other PMM fields as in the notes) under (vsatp.MODE, hgatp.MODE) in {BARE_PAIR, PAGED_PAIR}:
For each A_upper_bits in {0x0000, 0x0400} (PMM 10) or {0x0000, 0xFFFF} (PMM 11), the untagged control and the tags fully within PMLEN:
Set A = A' with upper bits replaced by A_upper_bits
lw from A, sigupd(value) + record any traps.
sw unique value_new to A, then read back from A' (untagged), sigupd(value) + record any traps.

No trap: masking is applied to the misaligned address before the access, so A and A' resolve to the same location,
lw returns value_old and the readback returns value_new. Misalignment does not interfere with pointer masking.
A hart without misaligned support instead takes a load or store address-misaligned or access-fault trap, which is
not checked against a single expected trap.

priv_mode VS x {lw, sw} x misaligned (address + 1) x henvcfg.PMM {10, 11} x tag (PMM 10 {0x0000, 0x0400}, PMM 11 {0x0000, 0xFFFF}) x (vsatp, hgatp) {BARE_PAIR, PAGED_PAIR}
PMM 10 and 11 only when PMLEN 7 and 16 are supported; each vsatp and hgatp mode only when supported

pm_misaligned_equivalence

cp_vu_pmlen_misaligned_word

Pointer masking is applied to the address of a misaligned access in VU-mode

Same test environment and loop as cp_vs_pmlen_misaligned_word, except:
- the field under test is senvcfg.PMM;
- the VS-stage data pages have PTE.U = 1;
- the accesses run in VU-mode.

As cp_vs_pmlen_misaligned_word, with the PMLEN of senvcfg.PMM.

priv_mode VU x {lw, sw} x misaligned (address + 1) x senvcfg.PMM {10, 11} x tag (PMM 10 {0x0000, 0x0400}, PMM 11 {0x0000, 0xFFFF}) x (vsatp, hgatp) {BARE_PAIR, PAGED_PAIR}
PMM 10 and 11 only when PMLEN 7 and 16 are supported; each vsatp and hgatp mode only when supported

pm_misaligned_equivalence

cp_vs_hardware_csr_writes_fault_load

Pointer masking is applied to the addresses that hardware writes to stval and htval on a faulting access in VS-mode

When a fault occurs on an explicit memory access under pointer masking, the stval written by hardware holds the
masked effective address, not the raw tagged address. On a guest-page fault, htval holds the GPA of that address
shifted right by 2. htval is not an address on other faults (zero),
so it is read on every fault and the signature records which case it was.
Test Environment:
In HS-mode, identity map the test image in both stages; the VS-stage data pages have PTE.U = 0.
Set henvcfg.PMM and the other PMM fields as in the notes, then HFENCE.GVMA x0, x0 and HFENCE.VVMA x0, x0.
Leave hedeleg clear and delegate the load and store access faults, page faults and guest-page faults to HS-mode with medeleg, so every fault is taken in HS-mode.
Use two base addresses and construct the addresses by applying the tags below to each. Only 0x0000 and fully
masked tags are used, so the faulting address is valid and stval and htval are deterministic: on a guest-page
fault htval is zero or the GPA shifted right by 2, and on any other fault htval is zero.
- fault base: RVMODEL_ACCESS_FAULT_ADDRESS_LOAD, if defined, identity mapped in both stages; the accesses take a
load access fault.
- guest-page-fault base: an address with no G-stage mapping (hgatp paged only); the accesses take a load
guest-page fault.
Switch to VS-mode and execute the following loop:
For each henvcfg.PMM in {10, 11} (outermost loop; the other PMM fields as in the notes) under (vsatp.MODE, hgatp.MODE) in {BARE_PAIR, PAGED_PAIR}:
For each A_upper_bits in {0x0000, 0x0400} (PMM 10) or {0x0000, 0xFFFF} (PMM 11):
lw from the constructed address.
In the HS-mode trap handler, read stval and htval and sigupd both.

A fault is taken in HS-mode. stval holds the masked effective address (upper PMLEN bits zero-extended with
vsatp = Bare, sign-extended with vsatp paged), not the tagged address the program used.
Guest-page fault: htval is zero or the GPA of the masked address shifted right by 2.
Any other fault: htval is zero.

priv_mode VS x lw x base {fault, guest-page-fault (hgatp paged only)} x henvcfg.PMM {10, 11} x tag (PMM 10 {0x0000, 0x0400}, PMM 11 {0x0000, 0xFFFF}) x (vsatp, hgatp) {BARE_PAIR, PAGED_PAIR}
PMM 10 and 11 only when PMLEN 7 and 16 are supported; each vsatp and hgatp mode only when supported

pm_csr_hw_apply
pm_no_trap_vector_mask

cp_vs_hardware_csr_writes_fault_store

Pointer masking is applied to the addresses that hardware writes to stval and htval on a faulting store in VS-mode

Same test environment and loop as cp_vs_hardware_csr_writes_fault_load, except sw to the constructed address in
place of lw, and the fault base is RVMODEL_ACCESS_FAULT_ADDRESS_STORE.

As cp_vs_hardware_csr_writes_fault_load.

priv_mode VS x sw x base {fault, guest-page-fault (hgatp paged only)} x henvcfg.PMM {10, 11} x tag (PMM 10 {0x0000, 0x0400}, PMM 11 {0x0000, 0xFFFF}) x (vsatp, hgatp) {BARE_PAIR, PAGED_PAIR}
PMM 10 and 11 only when PMLEN 7 and 16 are supported; each vsatp and hgatp mode only when supported

pm_csr_hw_apply
pm_no_trap_vector_mask

cp_vu_hardware_csr_writes_fault_load

Pointer masking is applied to the addresses that hardware writes to stval and htval on a faulting load in VU-mode

Same test environment and loop as cp_vs_hardware_csr_writes_fault_load, except:
- the field under test is senvcfg.PMM;
- the VS-stage data pages have PTE.U = 1;
- the accesses run in VU-mode.

As cp_vs_hardware_csr_writes_fault_load, with the PMLEN of senvcfg.PMM.

priv_mode VU x lw x base {fault, guest-page-fault (hgatp paged only)} x senvcfg.PMM {10, 11} x tag (PMM 10 {0x0000, 0x0400}, PMM 11 {0x0000, 0xFFFF}) x (vsatp, hgatp) {BARE_PAIR, PAGED_PAIR}
PMM 10 and 11 only when PMLEN 7 and 16 are supported; each vsatp and hgatp mode only when supported

pm_csr_hw_apply
pm_no_trap_vector_mask

cp_vu_hardware_csr_writes_fault_store

Pointer masking is applied to the addresses that hardware writes to stval and htval on a faulting store in VU-mode

Same test environment and loop as cp_vu_hardware_csr_writes_fault_load, except sw to the constructed address in
place of lw, and the fault base is RVMODEL_ACCESS_FAULT_ADDRESS_STORE.

As cp_vu_hardware_csr_writes_fault_load.

priv_mode VU x sw x base {fault, guest-page-fault (hgatp paged only)} x senvcfg.PMM {10, 11} x tag (PMM 10 {0x0000, 0x0400}, PMM 11 {0x0000, 0xFFFF}) x (vsatp, hgatp) {BARE_PAIR, PAGED_PAIR}
PMM 10 and 11 only when PMLEN 7 and 16 are supported; each vsatp and hgatp mode only when supported

pm_csr_hw_apply
pm_no_trap_vector_mask

cp_henvcfg_pmm_change_hfence

After henvcfg.PMM changes to or from a PMLEN where (XLEN - PMLEN) < GPA width, HFENCE.GVMA x0 makes VS-mode accesses follow the new PMLEN

In these cases some GPA bits are also masked bits, so the hart may keep TLB entries that are wrong after the
PMM change. The hypervisor must execute HFENCE.GVMA with rs1 = x0; this test checks that no stale entry is used
after that fence.
Test Environment:
vsatp = Bare. senvcfg.PMM = hstatus.HUPMM = 00. A' = pm_lo_page, pre-loaded with value_old.
Ti = A' with bits 63:48 replaced by the tag:
Case 1: PMLEN 7 (PMM = 10), hgatp = Sv57x4 tags {0x0400} (bit 58)
Case 2: PMLEN 16 (PMM = 11), hgatp = Sv57x4 tags {0x0002, 0x0400} (bits 49, 58)
Case 3: PMLEN 16 (PMM = 11), hgatp = Sv48x4 tags {0x0002} (bit 49)
Case 4: PMLEN 7 <→ PMLEN 16 (PMM = 10 <→ 11), hgatp = Sv57x4 tags {0x0002} (bit 49)
In the G stage, identity map the test image and map each Ti to its own page alias_i (pre-loaded with
value_alias_i), so an unmasked access to Ti succeeds and is cached instead of faulting.
For each case, for each direction {00 → PMM, PMM → 00}; for case 4, {10 → 11, 11 → 10}:
1. In HS-mode set henvcfg.PMM = old, HFENCE.GVMA x0, x0. In VS-mode: ld from each Ti, sigupd(value).
2. In HS-mode set henvcfg.PMM = new, HFENCE.GVMA x0, x0.
3. In VS-mode: ld from each Ti, sigupd(value).
4. In VS-mode: sd value_new to each Ti, read back A' and alias_i untagged, sigupd(value); restore both.

No traps. PMM = 00: Ti reaches alias_i (value_alias_i). PMM = 10/11: Ti reaches A' (value_old).
Case 4: bit 49 is masked by PMLEN 16 only, so PMM = 10 reaches alias_i and PMM = 11 reaches A'.
So step 3 always differs from step 1; getting the step 1 value again means a stale entry survived the fence.

cp_henvcfg_pmm_change_hfence: priv_mode HS x HFENCE.GVMA with rs1 = x0, in the instruction right after a write to henvcfg, x hgatp.MODE = Sv57x4 x henvcfg.PMM before and after the write {00 → 10, 10 → 00, 00 → 11, 11 → 00, 10 → 11, 11 → 10}
cp_henvcfg_pmm_change_hfence_sv48x4: the same cross with hgatp.MODE = Sv48x4 x henvcfg.PMM before and after the write {00 → 11, 11 → 00}
The test writes henvcfg and executes HFENCE.GVMA x0, x0 immediately. The stale-entry check is not sampled; the signature checks it.
PMM 10 and 11 only when PMLEN 7 and 16 are supported. cp_henvcfg_pmm_change_hfence only when Sv57x4 is supported; cp_henvcfg_pmm_change_hfence_sv48x4 only when Sv48x4 and PMLEN 16 are supported

henvcfg_pmm_op

The HFENCE.GVMA paragraph (hypervisor.adoc, Interaction with Pointer Masking) has no normative tag.

cp_hupmm_change_hfence

After hstatus.HUPMM changes to or from a PMLEN where (XLEN - PMLEN) < GPA width, HFENCE.GVMA x0 makes HLV/HSV in U-mode follow the new PMLEN

Same test environment, cases, addresses and steps as cp_henvcfg_pmm_change_hfence, except:
- the field changed is hstatus.HUPMM, with henvcfg.PMM = senvcfg.PMM = 00;
- hstatus.HU = 1 and hstatus.SPVP = 0;
- the accesses run in U-mode, with hlv.d in place of ld and hsv.d in place of sd.

Same as cp_henvcfg_pmm_change_hfence, with hstatus.HUPMM in place of henvcfg.PMM.

cp_hupmm_change_hfence: priv_mode HS x HFENCE.GVMA with rs1 = x0, in the instruction right after a write to hstatus, x hgatp.MODE = Sv57x4 x hstatus.HUPMM before and after the write {00 → 10, 10 → 00, 00 → 11, 11 → 00, 10 → 11, 11 → 10}
cp_hupmm_change_hfence_sv48x4: the same cross with hgatp.MODE = Sv48x4 x hstatus.HUPMM before and after the write {00 → 11, 11 → 00}
cp_hlv_u_spvp0_sv48x4_pmm, case 3 accesses: priv_mode U x hstatus.HU = 1 x hstatus.SPVP = 0 x {hlv.d, hsv.d} x hstatus.HUPMM {00, 11} x tag {0x0002} x (vsatp, hgatp) {(Bare, Sv48x4)}. It is cp_hlv_u_spvp0_pmm at (Bare, Sv48x4); cp_hlv_u_spvp0_pmm samples only the widest bare pair, which is Sv57x4 when it is supported.
The stale-entry check is not sampled; the signature checks it.
PMM 10 and 11 only when PMLEN 7 and 16 are supported. cp_hupmm_change_hfence only when Sv57x4 is supported; cp_hupmm_change_hfence_sv48x4 and cp_hlv_u_spvp0_sv48x4_pmm only when Sv48x4 and PMLEN 16 are supported

pm_mprv_spvp

The HUPMM paragraph and the HFENCE.GVMA paragraph have no normative tags.

cp_henvcfg_pmm_change_no_hfence

After henvcfg.PMM changes in a case the HFENCE.GVMA rule does not list, VS-mode accesses follow the new PMLEN without any HFENCE

The spec requires HFENCE.GVMA only when (XLEN - PMLEN) < GPA width, where a masked bit can also be a GPA bit.
Otherwise the masked bits are never part of a translation, so the new PMLEN must take effect with no fence.
This is the twin of cp_henvcfg_pmm_change_hfence with every HFENCE after the PMM change removed.
Test Environment:
senvcfg.PMM = hstatus.HUPMM = 00. A' = pm_lo_page, pre-loaded with value_old.
Ti = A' with bits 63:48 replaced by the tag:
Case 1: vsatp = Bare, hgatp = Sv39x4, PMLEN 7 (PMM = 10) tags {0x0400} (bit 58)
Case 2: vsatp = Bare, hgatp = Sv39x4, PMLEN 16 (PMM = 11) tags {0x0002, 0x0400} (bits 49, 58)
Case 3: vsatp = Bare, hgatp = Sv48x4, PMLEN 7 (PMM = 10) tags {0x0400} (bit 58)
Case 4: vsatp = Sv57, hgatp = Sv57x4, PMLEN 7 (PMM = 10) tags {0x0400} (bit 58)
Case 5: vsatp = Sv57, hgatp = Sv57x4, PMLEN 16 (PMM = 11) tags {0x0002, 0x0400} (bits 49, 58)
Cases 1 to 3: no G-stage mapping exists for Ti, so an unmasked access to Ti faults.
Cases 4 and 5: the VS stage maps the canonical Ti (tag 0x0002) to its own page alias_i (pre-loaded with
value_alias_i), so an unmasked access succeeds and is cached. Tag 0x0400 is non-canonical in Sv57 and faults.
For each case, for each direction {00 → PMM, PMM → 00}:
1. In HS-mode set henvcfg.PMM = old, then HFENCE.GVMA x0, x0 and HFENCE.VVMA x0, x0 (setup only).
In VS-mode: ld from each Ti, sigupd(value) + record any traps.
2. In HS-mode set henvcfg.PMM = new. Execute no HFENCE.GVMA, HFENCE.VVMA or SFENCE.VMA.
3. In VS-mode: ld from each Ti, sigupd(value) + record any traps.
4. In VS-mode: sd value_new to each Ti, read back A' (and alias_i where mapped) untagged, sigupd(value) + record
any traps; restore.

PMM = 00: Ti is used unmasked (a fault, or alias_i for tag 0x0002 in case 5). PMM = 10/11 with the tag within
PMLEN: Ti reaches A' (value_old), no trap. Step 3 follows the new PMM. Getting the step 1 result again
means the hart kept a translation keyed by the old PMLEN.

priv_mode HS x the instruction right after a write to henvcfg is not HFENCE.GVMA x (vsatp, hgatp) x henvcfg.PMM before and after the write: (Bare, Sv39x4) {00 <→ 10, 00 <→ 11}, (Bare, Sv48x4) {00 <→ 10}, (Sv57, Sv57x4) {00 <→ 10, 00 <→ 11}
That no fence came later is not sampled; the signature checks it.
PMM 10 and 11 only when PMLEN 7 and 16 are supported; each case only when its vsatp and hgatp modes are supported

henvcfg_pmm_op

The HFENCE.GVMA paragraph (hypervisor.adoc, Interaction with Pointer Masking) lists only the cases of cp_henvcfg_pmm_change_hfence.

cp_pmm_vsxl_clear

Setting hstatus.VSXL = 01 (RV32 VS-mode) clears henvcfg.PMM

Test Environment:
In HS-mode, with hstatus.VSXL = 10 (RV64):
1. Write henvcfg.PMM = {10, 11}, read it back, sigupd(value).
2. Write hstatus.VSXL = 01, read henvcfg.PMM, sigupd(value).
3. Write hstatus.VSXL = 10, read henvcfg.PMM, sigupd(value).

Step 1 reads back the value written. Step 2 reads henvcfg.PMM = 00. Step 3 reads henvcfg.PMM = 00, because
returning VSXL to RV64 does not restore the previous PMM. The write to hstatus.VSXL does not trap.

priv_mode HS x csrw hstatus x henvcfg.PMM before the write {10, 11} x hstatus.VSXL after the write = 01
Sampled on the csrw that sets the field. That henvcfg.PMM reads 00 afterwards is checked by the signature.
PMM 10 and 11 only when PMLEN 7 and 16 are supported; only when hstatus.VSXL = 01 is writable

pm_uxl_clear
pmlen_illegal_warl

cp_pmm_vsuxl_clear

Setting vsstatus.UXL = 01 (RV32 VU-mode) clears senvcfg.PMM

vsstatus.UXL gives the XLEN of VU-mode, and senvcfg.PMM is the field
that masks VU-mode. Gated on vsstatus.UXL being writable.
Test Environment:
With hstatus.VSXL = 10 and vsstatus.UXL = 10 (RV64):
1. Write senvcfg.PMM = {10, 11}, read it back, sigupd(value).
2. Write vsstatus.UXL = 01, read senvcfg.PMM, sigupd(value).
3. Write vsstatus.UXL = 10, read senvcfg.PMM, sigupd(value).

Step 1 reads back the value written. Step 2 reads senvcfg.PMM = 00. Step 3 reads senvcfg.PMM = 00. The write
to vsstatus.UXL does not trap.

writer {csrw vsstatus in HS-mode, csrw sstatus in VS-mode} x senvcfg.PMM before the write {10, 11} x vsstatus.UXL after the write = 01
Sampled on the csrw that sets the field. That senvcfg.PMM reads 00 afterwards is checked by the signature.
PMM 10 and 11 only when PMLEN 7 and 16 are supported; only when vsstatus.UXL = 01 is writable

pm_uxl_clear
pmlen_illegal_warl

Table 318. Ssnpm Normative Rules
Normative Rule Rule Text Coverpoints

senvcfg_pmm_ssnpm

If the Ssnpm extension is implemented, the PMM field enables or disables pointer masking (see Zpm) for the next-lower privilege mode (U/VU), according to the values in norm:senvcfg_pmm_enc. If Ssnpm is not implemented, PMM is read-only zero. The PMM field is read-only zero for RV32.

Ssnpm_cg/cp_pmlen_masking, S_scsr_cg/cp_scsrwalk/senvcfg, Ssnpm_H_cg/{cp_vu_pmm, cp_vu_pmlen_masking, cp_hlv_hs_spvp0_pmm}

senvcfg_pmm_immediate

Changing senvcfg.PMM takes effect immediately, without the need to execute an SFENCE.VMA instruction.

TODO: change senvcfg.PMM, then access memory from U-mode with no intervening SFENCE.VMA

senvcfg_pmm_enc

Value|Description === 00|Pointer masking is disabled (PMLEN = 0)¶01|Reserved¶10|Pointer masking is enabled with PMLEN = XLEN - 57 (PMLEN = 7 on RV64)¶11|Pointer masking is enabled with PMLEN = XLEN - 48 (PMLEN = 16 on RV64) ===

Ssnpm_cg/cp_pmlen_masking, Ssnpm_H_cg/cp_vu_pmlen_masking, S_scsr_cg/cp_scsrwalk/senvcfg (the walk writes the reserved PMM=0b01)

henvcfg_pmm_op

If the Ssnpm extension is implemented, the PMM field enables or disables pointer masking (see Zpm) for VS-mode, according to the values in norm:henvcfg_pmm_enc. When the Ssnpm extension is not implemented, the PMM field is read-only zero. The PMM field is read-only zero for RV32.

Ssnpm_H_cg/{cp_vs_pmm, cp_vs_pmlen_masking, cp_hlv_hs_spvp1_pmm, cp_hlv_u_spvp1_pmm}, Ssnpm_H_cg/{cp_vs_pmlen_zicfiss_amo, cp_vs_pmlen_zicfiss_ssp}, Ssnpm_H_cg/{cp_henvcfg_pmm_change_hfence, cp_henvcfg_pmm_change_hfence_sv48x4}, Ssnpm_H_cg/cp_henvcfg_pmm_change_no_hfence, Tested by the signature: henvcfg.PMM does not mask the guest physical address from the VS stage (Ssnpm_H plan, cp_vs_gstage_no_pmm)

UDB Parameters: None.

Table 319. Zpm Normative Rules
Normative Rule Rule Text Coverpoints

pm_ignore_upper_bits

RISC-V Pointer Masking (PM) is a feature that, when enabled, causes the CPU to ignore the upper bits of the effective address

{Smmpm_cg, Smnpm_S_cg, Smnpm_U_cg, Ssnpm_cg}/cp_pmlen_masking, Ssnpm_H_cg/{cp_vs_pmlen_masking, cp_vu_pmlen_masking}, Ssnpm_H_cg/{cp_vs_pmlen_zicfiss_amo, cp_vu_pmlen_zicfiss_amo, cp_vs_pmlen_zicfiss_ssp, cp_vu_pmlen_zicfiss_ssp}, Ssnpm_H_cg/cp_vs_pmm

pm_ignore_va

The ignore transformation differs depending on whether it applies to a virtual or physical address. For virtual addresses, it replaces the upper PMLEN bits with the sign extension of the PMLEN+1st bit.

{Smmpm_cg, Smnpm_S_cg, Smnpm_U_cg, Ssnpm_cg}/cp_pmlen_masking, Ssnpm_H_cg/{cp_vs_pmlen_masking, cp_vu_pmlen_masking}, Ssnpm_H_cg/{cp_vs_pmlen_zicfiss_amo, cp_vu_pmlen_zicfiss_amo, cp_vs_pmlen_zicfiss_ssp, cp_vu_pmlen_zicfiss_ssp}, Ssnpm_H_cg/{cp_vs_pmm, cp_vu_pmm}, Ssnpm_H_cg/{cp_hlv_hs_spvp1_pmm, cp_hlv_hs_spvp0_pmm}

pm_ignore_pa

When applied to a physical address, including guest-physical addresses (i.e., all cases except when the active satp register’s MODE field != Bare), the ignore transformation replaces the upper PMLEN bits with 0. This includes both the case of running in M-mode and running in other privilege modes with Bare address translation mode.

{Smmpm_cg, Smnpm_S_cg, Smnpm_U_cg, Ssnpm_cg}/cp_pmlen_masking, Ssnpm_H_cg/{cp_vs_pmm, cp_vu_pmm}, Ssnpm_H_cg/{cp_hlv_hs_spvp1_pmm, cp_hlv_hs_spvp0_pmm}, Ssnpm_H_cg/{cp_vs_pmlen_masking, cp_vu_pmlen_masking}

pm_apply_explicit

When pointer masking is enabled, the ignore transformation will be applied to every explicit memory access (e.g., loads/stores, atomics operations, and floating point loads/stores).

{Smmpm_cg, Smnpm_S_cg, Smnpm_U_cg, Ssnpm_cg}/cp_pmlen_masking, Ssnpm_H_cg/{cp_vs_pmlen_masking, cp_vu_pmlen_masking}, Ssnpm_H_cg/{cp_vs_pmlen_zicfiss_amo, cp_vu_pmlen_zicfiss_amo, cp_vs_pmlen_zicfiss_ssp, cp_vu_pmlen_zicfiss_ssp}, Ssnpm_H_cg/{cp_vs_pmm, cp_vu_pmm, cp_hlv_hs_spvp1_pmm, cp_hlv_hs_spvp0_pmm}

pm_not_apply_implicit

The transformation does not apply to implicit accesses such as page-table walks or instruction fetches.

{Smmpm_cg, Smnpm_S_cg, Smnpm_U_cg, Ssnpm_cg}/cp_pmm_jalr, Ssnpm_H_cg/{cp_vs_pmm_jalr, cp_vu_pmm_jalr}, Tested by the signature: the guest physical address from the VS stage is not masked (Ssnpm_H plan, cp_vs_gstage_no_pmm)

pm_deterministic_effect

Pointer masking with the same value of PMLEN always has the same effect for the same type of address (virtual or physical).

{Smmpm_cg, Smnpm_S_cg, Smnpm_U_cg, Ssnpm_cg}/cp_pmlen_masking, Ssnpm_H_cg/{cp_vs_pmlen_masking, cp_vu_pmlen_masking}

pmlen_supported_values

The current standard only supports PMLEN=XLEN-48 (i.e., PMLEN=16 in RV64) and PMLEN=XLEN-57 (i.e., PMLEN=7 in RV64).

{Smmpm_cg, Smnpm_S_cg, Smnpm_U_cg, Ssnpm_cg}/cp_pmlen_masking, Ssnpm_H_cg/{cp_vs_pmlen_masking, cp_vu_pmlen_masking}, Ssnpm_H_cg/cp_vs_pmm

pmlen_future_reserved

A setting has been reserved to potentially support other values of PMLEN in future standards.

S_scsr_cg/cp_scsrwalk/senvcfg, Sm_mcsr_cg/cp_mcsrwalk_masked/{menvcfg, mseccfg}

pm_per_mode_control

Pointer masking is controlled separately for different privilege modes.

{Smmpm_cg, Smnpm_S_cg, Smnpm_U_cg, Ssnpm_cg}/cp_pmlen_masking, Ssnpm_H_cg/{cp_vs_pmlen_masking, cp_vu_pmlen_masking}, Ssnpm_H_cg/{cp_vs_pmm, cp_vu_pmm}

pm_auto_apply_active_mode

Different privilege modes may have different pointer masking settings active simultaneously and the hardware will automatically apply the pointer masking settings of the currently active privilege mode.

{Smmpm_cg, Smnpm_S_cg, Smnpm_U_cg, Ssnpm_cg}/cp_pmlen_masking

pm_config_next_higher

A privilege mode’s pointer masking setting is configured by bits in configuration registers of the next-higher privilege mode.

{Smmpm_cg, Smnpm_S_cg, Smnpm_U_cg, Ssnpm_cg}/cp_pmlen_masking, Ssnpm_H_cg/{cp_vs_pmlen_masking, cp_vu_pmlen_masking}, Ssnpm_H_cg/{cp_vs_pmm, cp_vu_pmm}

pm_mode_only_dependency

the pointer masking setting that is applied only depends on the active privilege mode, not on the address that is being masked.

{Smmpm_cg, Smnpm_S_cg, Smnpm_U_cg, Ssnpm_cg}/cp_pmlen_masking, Ssnpm_H_cg/{cp_vs_pmlen_masking, cp_vu_pmlen_masking}, Ssnpm_H_cg/cp_vs_pmm

pm_explicit_accesses

Unless otherwise specified, pointer masking applies to all explicit memory accesses.

{Smmpm_cg, Smnpm_S_cg, Smnpm_U_cg, Ssnpm_cg}/cp_pmlen_masking

pm_mprv_spvp

MPRV and SPVP affect pointer masking as well, causing the pointer masking settings of the effective privilege mode to be applied.

Smmpm_cg/cp_pm_mprv_mpp_m, Ssnpm_Sm_cg/cp_pm_mprv_mpp_u, Smnpm_SSm_cg/cp_pm_mprv_mpp_s, Smnpm_USm_cg/cp_pm_mprv_mpp_u, Ssnpm_H_cg/{cp_hlv_hs_spvp0_pmm, cp_hlv_hs_spvp1_pmm, cp_hlv_u_spvp0_pmm, cp_hlv_u_spvp1_pmm, cp_hlv_hs_spvp0_mxr_pmm, cp_hlv_hs_spvp1_mxr_pmm}, Ssnpm_H_cg/{cp_hupmm_change_hfence, cp_hupmm_change_hfence_sv48x4, cp_hlv_u_spvp0_sv48x4_pmm}

pm_mxr_exception

When MXR is in effect at the effective privilege mode where explicit memory access is performed, pointer masking does not apply.

{Smmpm_cg, Smnpm_S_cg, Ssnpm_cg}/cp_pmm_mxr, Ssnpm_H_cg/{cp_vs_mxr_pmm, cp_vu_mxr_pmm, cp_hlv_hs_spvp1_mxr_pmm, cp_hlv_hs_spvp0_mxr_pmm}

pm_cpu_only

Pointer masking only applies to accesses generated by instructions on the CPU (including CPU extensions such as an FPU). E.g., it does not apply to accesses generated by page-table walks, the IOMMU, or devices.

{Smmpm_cg, Smnpm_S_cg, Smnpm_U_cg, Ssnpm_cg}/cp_pmlen_masking

pm_misaligned_equivalence

Misaligned accesses are supported, subject to the same limitations as in the absence of pointer masking. The behavior is identical to applying the pointer masking transformation to every constituent aligned memory access.

{Smmpm_cg, Smnpm_S_cg, Smnpm_U_cg, Ssnpm_cg}/cp_pmlen_misaligned_word, Ssnpm_H_cg/{cp_vs_pmlen_misaligned_word, cp_vu_pmlen_misaligned_word}

pm_no_csr_sw

No pointer masking operations are applied when software reads/writes to CSRs, including those meant to hold addresses.

{Smmpm_cg, Smnpm_S_cg}/cp_pm_csr_software_access

pm_warl_unaffected

The implemented WARL width of CSRs is unaffected by pointer masking

{Smmpm_cg, Smnpm_S_cg}/cp_pm_csr_software_access

pm_csr_hw_apply

pointer masking, when applicable, is applied for hardware writes to a CSR (e.g., when the hardware writes the transformed address to stval when taking an exception).

{Smmpm_cg, Smnpm_S_cg, Smnpm_U_cg, Ssnpm_cg}/cp_hardware_csr_writes_fault_load, {Smmpm_cg, Smnpm_S_cg, Smnpm_U_cg, Ssnpm_cg}/cp_hardware_csr_writes_fault_store, Ssnpm_H_cg/{cp_vs_hardware_csr_writes_fault_load, cp_vs_hardware_csr_writes_fault_store, cp_vu_hardware_csr_writes_fault_load, cp_vu_hardware_csr_writes_fault_store}

pm_debug_trigger

Pointer masking is also applied, when applicable, to the memory access address when matching address triggers in debug.

pm_no_trap_vector_mask

on trap delivery (e.g., due to an exception or interrupt), pointer masking will not be applied to the address of the trap handler.

ssnpm_definition

A supervisor-level extension that provides pointer masking for the next lower privilege mode (U-mode), and for VS- and VU-modes if the H extension is present.

Ssnpm_cg/cp_pmlen_masking, Ssnpm_H_cg/{cp_vs_pmm, cp_vu_pmm, cp_vs_pmlen_masking, cp_vu_pmlen_masking}

smnpm_definition

A machine-level extension that provides pointer masking for the next lower privilege mode (S/HS if S-mode is implemented, or U-mode otherwise).

{Smnpm_S_cg, Smnpm_U_cg}/cp_pmlen_masking

smmpm_definition

A machine-level extension that provides pointer masking for M-mode.

Smmpm_cg/cp_pmlen_masking

pm_rv64_only

Pointer masking only applies to RV64.

{Smmpm_cg, Smnpm_S_cg, Smnpm_U_cg, Ssnpm_cg}/cp_pmlen_masking, Ssnpm_H_cg/{cp_vs_pmlen_masking, cp_vu_pmlen_masking}

pm_rv32_illegal

In RV32, trying to enable pointer masking will result in an illegal WARL write and not update the pointer masking configuration bits

Sm_mcsr_cg/cp_mcsrwalk_masked/{menvcfgh, mseccfgh}

pm_uxl_clear

Setting UXL/SXL to 1 will clear the corresponding pointer masking configuration bits.

Ssnpm_cg/cp_pmm_uxl_clear, Ssnpm_H_cg/{cp_pmm_vsxl_clear, cp_pmm_vsuxl_clear}

pmlen_mode_depend

the supported values of PMLEN may depend on the effective privilege mode. The current standard only defines PMLEN=XLEN-48 and PMLEN=XLEN-57,

{Smmpm_cg, Smnpm_S_cg, Smnpm_U_cg, Ssnpm_cg}/cp_pmlen_masking, Ssnpm_H_cg/{cp_vs_pmlen_masking, cp_vu_pmlen_masking}, Ssnpm_H_cg/{cp_vs_pmm, cp_vu_pmm}

pmlen_illegal_warl

Trying to enable pointer masking in an unsupported scenario represents an illegal write to the corresponding pointer masking enable bit and follows WARL semantics.

Sm_mcsr_cg/cp_mcsrwalk_masked/{menvcfg, mseccfg, menvcfgh, mseccfgh}, S_scsr_cg/cp_scsrwalk/senvcfg, Ssnpm_H_cg/{cp_pmm_vsxl_clear, cp_pmm_vsuxl_clear}

UDB Parameters: None.

B.10.10. Smnpm Pointer Masking

Smnpm_S

Smnpm is a machine level extension which enables pointer maksing for lower privilege level S mode (if implemented ) or otherwise U-mode via menvcfg. In this sheet , test plan is for S-mode implementation (SmnpmS) Similar to Ssnpm except: Run the same coverpoints as Ssnpm in S-mode except - MXR bit is sampled from mstatus csr - remove cp_pmm_uxl_clear - cp_pmlen_zicfiss_amo and cp_pmlen_zicfiss_ssp are exactly the same as Ssnpm except only menvcfg.SSE=1 is set (senvcfg.SSE controls U-mode and is not needed in S-mode), and the shadow stack page is a supervisor page.

Table 320. Smnpm Coverpoints (S mode)
Coverpoint Goal Feature Description Expectation Bins Normative Rule

- add the following cp_pm_csr_software_access_* coverpoints

cp_pm_csr_software_access

Ensure pointer masking is not applied to software CSR reads and writes

Pointer masking is not applied to software CSR reads and writes.
Test Environment:
In M-mode , set menvcfg.PMM={10(PMLEN=7),11(PMLEN=16)}
switch to S-mode;
Write XLEN test patterns with upper PMLEN bits set to RW CSRs {sepc, stvec, sscratch} using {csrrw}. Read back the same CSR using CSR read instructions then compare written and read values.

No masking applied; read-back value matches written value (subject to WARL constraints).
The implemented WARL width of CSRs is unaffected by pointer masking

2 PMM * 4 CSR ops * 1 mode (S) * 3 CSR * satp supported modes (Bare, Sv39, Sv48, Sv57)

pm_no_csr_sw
pm_warl_unaffected

Smnpm_SSm

Smnpm provides pointer masking for S-mode (if implemented) via menvcfg.PMM. In this sheet , test plan is for the M-mode part of SmnpmS: M-mode accesses memory as S-mode via MPRV. - tests run in M-mode with mstatus.MPRV=1 and mstatus.MPP=S - The suite requires Smnpm and S-mode because menvcfg.PMM governs the access. mseccfg.PMM is swept only if Smmpm is supported, to show that it does not apply.

Table 321. Smnpm Coverpoints (S mode, M-mode with MPRV)
Coverpoint Goal Feature Description Expectation Bins Normative Rule

cp_pm_mprv_mpp_s

Verify that menvcfg.PMM governs pointer masking when M-mode accesses memory as S-mode via MPRV.

MPRV affect pointer masking as well, causing the pointer masking settings of the effective privilege mode to be applied.
With MPP=S the effective privilege mode is S, so menvcfg.PMM applies and mseccfg.PMM does not.
Test Environment:
In M-mode set mstatus.MPRV=1 and mstatus.MPP=S
Set mstatus.SUM=1 so the setup code can access user-space pages.
Place known value_old in scratch. Let A' = scratch (upper bits = 0x0000).
Page tables configured for valid mappings under satp.MODE ∈ {Bare, Sv39}, with the data pages user-accessible.
For each mstatus.MXR in {0, 1}:
For each mseccfg.PMM in {00, 10, 11} if Smmpm supported:
For each menvcfg.PMM in {00, 10, 11}:
For each satp.MODE in {Bare, Sv39}:
For each A_upper_bits in {0x0000, 0x0001, 0x0200}:
Set A = A' with upper bits replaced by A_upper_bits
For read (lw): read directly from A in M-mode with MPRV=1, sigupd(value), record any traps.
For write (sw): write unique known value_new to A in M-mode with MPRV=1, read back from scratch (A'), sigupd(value), record any traps.

When menvcfg.PMM=10/11 and MXR=0: A patterns whose upper bits fall within PMLEN resolve to scratch, reads return known value_old, write readbacks return known value_new, regardless of mseccfg.PMM. When menvcfg.PMM=00 or MXR=1: masking disabled : only A=0x0000 resolves to scratch; all other patterns cause a trap.

2 MXR * 3 mseccfg.PMM * 3 menvcfg.PMM * 1 MPRV * 1 MPP (S) * 2 satp.MODE * 3 addresses * 2 instructions (lw, sw)

pm_mprv_spvp

Smnpm_U

Smnpm is a machine level extension which enables pointer maksing for lower privilege level S mode (if implemented ) or otherwise U-mode via menvcfg. In this sheet , test plan is for U-mode implementation (SmnpmU), i.e if S mode is not supported. Similar to Ssnpm except: If S-mode not supported, run the same coverpoints as Ssnpm in U-mode except the JALR cross is kept separate from MXR as it is read-only zero if S-mode is not supported , since implicit fetch must be verified as never masked regardless of whether S-mode (and hence MXR) is implemented. - all addresses are physical, Tests executed only in Bare mode . - For cp_hardware_csr_write_faults , traps are being handled in M mode and mtval will be checked. - drop cp_pmm_mxr because MXR is read-only 0 if S-mode is not supported - drop cp_pmlen_zicfiss_amo and cp_pmlen_zicfiss_ssp because Zicfiss cannot be activated if S-mode is not supported: SSAMOSWAP is illegal in U-mode, and SSPUSH and SSPOPCHK revert to their Zimop/Zcmop behavior and do not access memory.

Smnpm_USm

Smnpm provides pointer masking for U-mode via menvcfg.PMM if S-mode is not supported. In this sheet , test plan is for the M-mode part of SmnpmU: M-mode accesses memory as U-mode via MPRV. Similar to SmnpmSSm except: - tests run in M-mode with mstatus.MPRV=1 and mstatus.MPP=U - all addresses are physical, Tests executed only in Bare mode . - MXR is not swept because it is read-only 0 if S-mode is not supported

Table 322. Smnpm Coverpoints (no S mode, M-mode with MPRV)
Coverpoint Goal Feature Description Expectation Bins Normative Rule

cp_pm_mprv_mpp_u

Verify that menvcfg.PMM governs pointer masking when M-mode accesses memory as U-mode via MPRV on a hart without S-mode.

MPRV affect pointer masking as well, causing the pointer masking settings of the effective privilege mode to be applied.
With MPP=U the effective privilege mode is U, so menvcfg.PMM applies and mseccfg.PMM does not.
Test Environment:
In M-mode set mstatus.MPRV=1 and mstatus.MPP=U
Place known value_old in scratch. Let A' = scratch (upper bits = 0x0000).
For each mseccfg.PMM in {00, 10, 11} if Smmpm supported:
For each menvcfg.PMM in {00, 10, 11}:
For each A_upper_bits in {0x0000, 0x0001, 0x0200}:
Set A = A' with upper bits replaced by A_upper_bits
For read (lw): read directly from A in M-mode with MPRV=1, sigupd(value), record any traps.
For write (sw): write unique known value_new to A in M-mode with MPRV=1, read back from scratch (A'), sigupd(value), record any traps.

When menvcfg.PMM=10/11: A patterns whose upper bits fall within PMLEN resolve to scratch, reads return known value_old, write readbacks return known value_new, regardless of mseccfg.PMM. When menvcfg.PMM=00: masking disabled : only A=0x0000 resolves to scratch; all other patterns cause a trap.

3 mseccfg.PMM * 3 menvcfg.PMM * 1 MPRV * 1 MPP (U) * 3 addresses * 2 instructions (lw, sw)

pm_mprv_spvp

See Table 318 for normative rules.

B.10.11. Smmpm Pointer Masking

Smmpm is a machine-level extension that provides pointer masking for M-mode. Exactly same coverpoints as Ssnpm except delete cp_pmm_uxl_clear, add the following, and run in M-mode: - all addresses are physical, all tests run in Bare/ M-mode . - drop cp_pmlen_zicfiss_amo and cp_pmlen_zicfiss_ssp because Zicfiss cannot be activated in M-mode: SSAMOSWAP always raises a store/AMO access fault, and SSPUSH and SSPOPCHK revert to their Zimop/Zcmop behavior and do not access memory. - MPRV is tested here only with MPP=M, where mseccfg.PMM governs. MPP=U and MPP=S are governed by senvcfg.PMM and menvcfg.PMM, so they are in the SsnpmSm, SmnpmSSm and SmnpmUSm suites. the JALR cross is kept separate from MXR and not guarded by S_SUPPORTED , since implicit fetch must be verified as never masked regardless of whether S-mode (and hence MXR) is implemented.

Table 323. Smmpm Coverpoints
Coverpoint Goal Feature Description Expectation Bins Normative Rule

- For cp_hardware_csr_* , traps are being handled in M mode and mtval will be checked.

cp_pm_mprv_mpp_m

Verify that mseccfg.PMM governs pointer masking when M-mode accesses memory with MPRV=1 and MPP=M.

MPRV affect pointer masking as well, causing the pointer masking settings of the effective privilege mode to be applied.
With MPP=M the effective privilege mode stays M, so mseccfg.PMM applies. satp and MXR do not apply to M-mode accesses, so they are not swept.
Test Environment:
In M-mode set mstatus.MPRV=1 and mstatus.MPP=M
Place known value_old in scratch. Let A' = scratch (upper bits = 0x0000).
For each mseccfg.PMM in {00, 10, 11}:
For each A_upper_bits in {0x0000, 0x0001, 0x0200}:
Set A = A' with upper bits replaced by A_upper_bits
For read (lw): read directly from A in M-mode with MPRV=1, sigupd(value), record any traps.
For write (sw): write unique known value_new to A in M-mode with MPRV=1, read back from scratch (A'), sigupd(value), record any traps.

When mseccfg.PMM=10/11: A patterns whose upper bits fall within PMLEN resolve to scratch, reads return known value_old, write readbacks return known value_new. When mseccfg.PMM=00: masking disabled : only A=0x0000 resolves to scratch; all other patterns cause a trap.

3 mseccfg.PMM * 1 MPRV * 1 MPP (M) * 3 addresses * 2 instructions (lw, sw)

pm_mprv_spvp

cp_pm_csr_software_access

Ensure pointer masking is not applied to software CSR reads and writes

Pointer masking is not applied to software CSR reads and writes.
Test Environment:
In M-mode, set mseccfg.PMM={10(PMLEN=7),11(PMLEN=16)}.
Write XLEN test patterns with upper PMLEN bits set to RW CSRs {mepc, mscratch} , using {csrrw, csrrs, csrrc, csrrwi}. Read back the same CSR using CSR read instructions then compare written and read values.

No masking applied; read-back value matches written value (subject to WARL constraints).
The implemented WARL width of CSRs is unaffected by pointer masking

2 PMM * 4 (csrrw / csrrc / 4csrrs /csrrwi) * 1 mode (M ) * 3 csr

pm_no_csr_sw
pm_warl_unaffected

See Table 318 for normative rules.

B.10.12. Zicfilp Landing Pads

In Privileged section because it has both unpriv and privileged behaviors. The common coverpoints are defined once and re-executed by the Zicfilp_U, Zicfilp_Sm and Zicfilp_S groups in their privilege mode, and by the Zicfilp_H group in VS-mode and VU-mode; each group adds the coverpoints for its modes' xPELP handling. The Zicfilp_SmH group covers traps from VS-mode and VU-mode into M-mode and mret to VS-mode and VU-mode.

Table 324. Zicfilp Common Coverpoints
Coverpoint Goal Feature Description Expectation Bins ID Normative Rule Notes

In this sheet:
Indirect_CT = { JALR, C.JR, C.JALR } (if C implemented)
link_reg = { x1, x5, x7 }
non_link_reg = all other GPRs
ELP = { NO_LP_EXPECTED, LP_EXPECTED }
This sheet serves as the common reference for all Zicfilp privilege-mode
specific sheets (M-mode, S-mode, U-mode). It contains the full specification
of all shared coverpoints with complete descriptions, expectations, bins,
and normative rules.
Zicfilp provides forward-edge control-flow integrity by requiring that
indirect control transfers target an LPAD instruction when LP_EXPECTED is set.
xLPE (Landing Pad Enable) is privilege-mode dependent:
If S-mode implemented:
M-mode ⇒ mseccfg.MLPE
S/HS ⇒ menvcfg.LPE
VS ⇒ henvcfg.LPE
U/VU ⇒ senvcfg.LPE
If S-mode not implemented:
M-mode ⇒ mseccfg.MLPE
U-mode ⇒ envcfg.LPE
General Test Environment:
- Zicsr implemented.
- No higher-priority exception injected unless explicitly stated.

cp_zicfilp_indirect_elp_state_update

Verify correct update of ELP state on execution of indirect control-transfer instructions based on rs1 category, privilege mode, and xLPE enable state.

Test Case: Execute Indirect_CT instructions in each supported privilege mode under the following configurations:
1. xLPE=1
2. xLPE=0
Execute instruction with rs1 ∈ all 31registers excluding x0
- indirect jump destination={LPAD, NON-LPAD }
- for JALR the destination rd=random

software check exception if applicable
.
.

31 rs1 registers ×
2 LPEs×
3 indirect_CT types x2 destinations

Zicfilp_lpad_expected

Zicfilp_lpad_expected
Zicfilp_indirect_branch_lpad

cp_zicfilp_direct_ct_no_elp

Verify that direct jumps and taken branches do not set ELP.

Test Environment:
xLPE=1,
execute JAL (rd=x0 and rd=x1), C.J, C.JAL (RV32 with Zca) and a taken BEQ to a non-LPAD target, each skipping the instruction after it.

No software-check exception. Only JALR, C.JR and C.JALR are Indirect_CTs, so ELP stays NO_LP_EXPECTED at the target.

JAL, taken branch, plus C.J with Zca and C.JAL on RV32 with Zca

Zicfilp_lpad_expected

Zicfilp_lpad_expected
cfi_call_term

cp_zicfilp_lpad_zero_label_bypass

Verify that LPAD with LPL=0 bypasses label comparison during landing pad validation.

Test Environment:
xLPE=1,
execute an indirect control transfer (Indirect_CT) using rs1 != {x1,x5,x7} so that ELP=LP_EXPECTED.
Target an LPAD instruction whose encoded LPL=0. Execute with arbitrary values in x7.

Indirect branch shall succeed without software-check exception. LPAD label comparison shall be bypassed when LPL=0.

N Indirect_CT types × N privilege modes × target_LPL_zero

Zicfilp_lpad_imm_enc

Zicfilp_lpad_imm_enc

cp_zicfilp_lpad_valid_execution

Verify that a valid LPAD instruction satisfies landing pad validation when ELP=LP_EXPECTED.

Test Environment:
xLPE=1,
execute an indirect control transfer (Indirect_CT) using rs1 != {x1,x5,x7} so that ELP=LP_EXPECTED.
Then execute a properly aligned LPAD instruction at the target address under two conditions: (1) LPL=0, (2) LPL matches x7[31:12].

No software-check exception shall be raised. After LPAD retirement, ELP shall be set to NO_LP_EXPECTED.

2 (LPL={0,match}) × N Indirect_CT types × N privilege modes

Zicfilp_elp_lpad_expected

Zicfilp_elp_lpad_expected

cp_zicfilp_lpad_missing_instruction_exception

Verify that execution of a non-LPAD instruction when ELP=LP_EXPECTED raises a software-check exception.

Test Environment:
xLPE=1,
execute an indirect control transfer (Indirect_CT) using rs1 != {x1,x5,x7} so that ELP=LP_EXPECTED.
At the target address, execute an instruction that is not LPAD.

A software-check exception (cause=18) shall be raised. xtval shall indicate landing pad fault (code=2). ELP shall remain LP_EXPECTED.

N Indirect_CT types × N privilege modes

Zicfilp_elp_lpad_expected

Zicfilp_elp_lpad_expected

cp_zicfilp_lpad_label_mismatch

Verify software-check exception for LPAD label mismatch

xLPE=1,
execute an indirect control transfer (rs1 != {x1,x5,x7}) so that ELP=LP_EXPECTED.
Load x7 with a label using LUI, then execute LPAD with nonzero LPL that does not match x7[31:12].

Software-check exception (cause=18) shall be raised. xtval shall indicate "landing pad fault (code=2)".

Instruction type × rs1 category × ELP × N privilege modes

Zicfilp_elp_lpad_expected

cp_zicfilp_lpad_label_match_mismatch

Verify LPAD label matching and mismatching behavior

Test Environment:
- xLPE=1. Load a label (e.g. 0x12345) into x7[31:12], then execute an Indirect_CT with rs1 != {x1,x5,x7} so that ELP=LP_EXPECTED, to:
(1) an LPAD whose LPL matches x7[31:12],
(2) an LPAD whose nonzero LPL does not match x7[31:12],
(3) a non-LPAD instruction,
(4) an LPAD with nonzero LPL while x7[31:12]=0.

If expected landing pad label in x7 matches LPAD immediate label, no exception. Otherwise, software-check exception occurs.

4 scenarios x 3 Indirect_CT types (C.JR and C.JALR only with Zca) = 12

Zicfilp_lpad_label

Zicfilp_lpad_label

cp_zicfilp_lpad_label_exception_delivery

Verify software-check exception delivery and correct privilege-mode handling on LPAD label mismatch

Test Environment:
- xLPE=1. Load x7[31:12] with a nonzero label, then execute an Indirect_CT with rs1 != {x1,x5,x7} so that ELP=LP_EXPECTED, to a 4-byte aligned LPAD whose nonzero LPL does not match x7[31:12].

Software-check exception (cause=18) delivered to the mode that takes the suite’s traps: M-mode for ZicfilpSm, S-mode for ZicfilpS, and S-mode for ZicfilpU (M-mode when S-mode is not implemented). xtval = landing pad fault (code=2). xPELP = LP_EXPECTED.

3 Indirect_CT types (C.JR and C.JALR only with Zca)

Zicfilp_lpad_enabled_exception
Zicfilp_lpad_label_exception
lpad_sw_exception
cfi_sstatus_spelp_op

Zicfilp_lpad_enabled_exception
Zicfilp_lpad_label_exception
lpad_sw_exception
cfi_sstatus_spelp_op

cp_disabled_zicfilp

Verify behavior when Zicfilp is disabled

Test Environment:
but explicitly disabled at the tested privilege mode (xLPE=0),
execute LPAD instructions or indirect branches targeting LPAD.

No exception is raised; LPAD acts as a nop.

1 × N privilege modes

Zicfilp_lpad_enabled_instr_allowed

Zicfilp_lpad_enabled_instr_allowed

cp_lpad_no_sw_exception_elp_clear_zicfilp

Verify that ELP updates to NO_LP_EXPECTED after executing a valid LPAD

Test Environment:
xLPE=1.
Execute an Indirect_CT (JALR, C.JR, C.JALR) with rs1 != {x1,x5,x7} so that ELP=LP_EXPECTED,
to a 4-byte aligned LPAD whose nonzero LPL matches x7[31:12].

No software-check exception is raised. ELP is updated to NO_LP_EXPECTED after LPAD execution

3 Indirect_CT types (C.JR and C.JALR only with Zca)

Zicfilp_lpad_sw_exception

Zicfilp_lpad_no_sw_exception

cp_exception_priority_zicfilp

Verify the priority of exceptions

Test Environment:
xLPE=1.
(1) Execute an Indirect_CT with rs1 != {x1,x5,x7} targeting RVMODEL_ACCESS_FAULT_ADDRESS_FETCH: the instruction access fault is taken, not the software-check exception, and xPELP records LP_EXPECTED.
(2) Target an illegal instruction: the software-check exception is taken, not an illegal-instruction exception.

Instruction access fault (cause=1) is taken in preference to the software-check exception, and the software-check exception is taken in preference to an illegal-instruction exception (cause=2).

N privilege modes x {instruction access fault at the target, illegal instruction at the target}

Zicfilp_forward_trap_async_exception
Zicfilp_exception_priority

Zicfilp_forward_trap_async_exception
Zicfilp_exception_priority

cp_lpad_alignment_exception_zicfilp

Verify that an LPAD that is not 4-byte aligned raises a software-check exception when ELP=LP_EXPECTED

Only when Zca is implemented.
Test Environment:
xLPE=1. Execute an Indirect_CT (JALR, C.JR, C.JALR) with rs1 != {x1,x5,x7} so that ELP=LP_EXPECTED,
to an LPAD with LPL=0 at pc[1:0]=2.
Without Zca such a target raises an instruction-address-misaligned exception first, which is why this case needs Zca.

Software-check exception (cause=18) with xtval = landing pad fault (code=2), even though LPL=0.

3 Indirect_CT types (Zca only)

Zicfilp_elp_lpad_expected Zicfilp_lpad_alignment_exception

Zicfilp_elp_lpad_expected
Zicfilp_lpad_alignment_exception

cp_lpad_nop_no_lp_expected_zicfilp

Verify that LPAD is a no-op when ELP=NO_LP_EXPECTED, even with xLPE=1

Test Environment:
xLPE=1 and no Indirect_CT before the LPAD, so ELP=NO_LP_EXPECTED.
Load x7[31:12] with a nonzero label and execute sequentially:
(1) an LPAD whose nonzero LPL does not match x7[31:12],
(2) if Zca is implemented, an LPAD with LPL=0 at pc[1:0]=2.

No exception. Both LPADs execute as no-ops and ELP stays NO_LP_EXPECTED.

2 (LPL mismatch; pc[1:0]=2 only with Zca)

Zicfilp_lpad_label_exception Zicfilp_lpad_alignment_exception

Zicfilp_lpad_label_exception
Zicfilp_lpad_alignment_exception

The gray test are duplicates of other test and are excluded.

The yellow coverpoints are excluded because they apply to debug

cp_lpad_misaligned_address_exception_zicfilp

Verify exception for misaligned PC

Test Case
Execute indirect branch to set ELP=LP_EXPECTED, then execute LPAD at misaligned address (not 4-byte aligned)

Software-check exception raised (cause=18), xtval="landing pad fault (code=2)", ELP unchanged

Instruction type × rs1 category (non-link register) × ELP)xpriv mode

Zicfilp_elp_lpad_expected

Zicfilp_elp_lpad_expected

Duplicate of cp_lpad_alignment_exception_zicfilp.

cp_elp_state_preservation_debug_zicfilp

Verify Debug Mode saves and
restores previous ELP via dcsr.PELP

Test Case
Execute indirect branch to set ELP=LP_EXPECTED,
enter Debug Mode using EBREAK instruction

Debug mode entered, dcsr.pelp stores previous ELP value,
after exiting debug mode, ELP restored correctly

Origin mode U ×
Debug entry × ELP state

dcsr_pelp_op

dcsr_pelp_op

Should be added in Debug testplan when we will start writing Debug testplans

cp_pelp_debug_mode_zicfilp

Verify ELP on Debug Mode entry

Test Case
Execute indirect branch in U-mode to set ELP=LP_EXPECTED, execute EBREAK to enter Debug Mode

dcsr.pelp = LP_EXPECTED and ELP set to NO_LP_EXPECTED

Debug entry × Initial ELP state

norm:Zicfilp_pelp_debug_mode

Zicfilp_pelp_debug_mode

Should be added in Debug testplan when we will start writing Debug testplans

cp_pelp_debug_mode_r_zicfilp

Verify ELP on resuming from Debug Mode

Test Case
Resume from Debug Mode with senvcfg.LPE=1
Test Case
Resume from Debug Mode with senvcfg.LPE=0

ELP restored from dcsr.pelp for 1
ELP set to NO_LP_EXPECTED for 0

Resume privilege × LPE disabled/enabled

norm:Zicfilp_pelp_debug_mode

Zicfilp_pelp_debug_mode

Should be added in Debug testplan when we will start writing Debug testplans

Zicfilp_U User-Mode Landing Pads

In this sheet, all Zicfilp tests from the Zicfilp_Common sheet are re-executed in User Mode (U-mode). Environment: - Zicfilp extension enabled, Zicsr enabled. - Landing Pad Enabled (LPE) controlled by: senvcfg.LPE when S-mode is implemented menvcfg.LPE when S-mode is not implemented - Tests execute in U-mode. Execution Notes: - All indirect branch instructions (JALR, C.JALR, C.JR) are exercised as in the Common sheet. - LPAD behavior, label matching, immediate encoding, and software-check exceptions are tested as per normative rules defined in the spec. - ELP state is observed via sstatus.SPELP when S-mode is implemented, because U-mode software-check exceptions are delegated to S-mode (medeleg[18]=1 in the ACT4 boot code). When S-mode is not implemented the trap is taken in M-mode and ELP is observed via mstatus.MPELP (RV64) or mstatush.MPELP (RV32). - Trap entry and return coverpoints from the M-mode sheet are not repeated here as they are M-mode specific by spec. - All other assumptions, instruction types, and execution conditions are identical to the Zicfilp_Common sheet.

Table 325. Zicfilp_U Coverpoints
Coverpoint Goal Feature Description Normative Rule

cp_zicfilp_indirect_elp_state_update
cp_zicfilp_indirect_elp_state_update_c
cp_zicfilp_direct_ct_no_elp
cp_zicfilp_lpad_zero_label_bypass
cp_zicfilp_lpad_valid_execution
cp_zicfilp_lpad_missing_instruction_exception
cp_zicfilp_lpad_label_mismatch
cp_zicfilp_lpad_label_match_mismatch
cp_zicfilp_lpad_label_exception_delivery
cp_disabled_zicfilp
cp_lpad_no_sw_exception_elp_clear_zicfilp
cp_exception_priority_zicfilp
cp_lpad_nop_no_lp_expected_zicfilp
cp_lpad_alignment_exception_zicfilp

Re-run the common Zicfilp coverpoints in U-mode

The coverpoints described in the Zicfilp Common Coverpoints table, executed in U-mode.

cfi_call_term
cfi_return_term
cfi_indirect_jump_term
Zicfilp_lpad_expected
Zicfilp_indirect_branch_lpad
menvcfg_lpe_op_lead_in
menvcfg_lpe_op_list
senvcfg_lpe_Zicfilp
Zicfilp_lpad_imm_enc
Zicfilp_lpad_enc
Zicfilp_lpad_label
Zicfilp_elp_lpad_expected
Zicfilp_lpad_enabled_instr_allowed
lpad_sw_exception
stval_exception_info
Zicfilp_lpad_label_exception
Zicfilp_lpad_enabled_exception
cfi_mstatus_spelp_op
cfi_sstatus_spelp_op
Zicfilp_pelp_trap
mstatus_spelp_mpelp_op
mstatus_spelp_mpelp_enc_lead_in
mstatus_spelp_mpelp_enc_list
sstatus_spelp
Zicfilp_lpad_no_sw_exception
Zicfilp_forward_traps
Zicfilp_forward_trap_async_exception
Zicfilp_exception_priority
Zicfilp_lpad_alignment_exception

Zicfilp_Sm Machine-Mode Landing Pads

In this sheet, all Zicfilp tests from the Zicfilp_Common sheet are executed in Machine Mode (M-mode). Environment: - Zicfilp extension enabled, Zicsr enabled. - Landing Pad Enabled (LPE) controlled by mseccfg.MLPE. - Tests execute in M-mode. Execution Notes: - All indirect branch instructions (JALR, C.JALR, C.JR) are exercised as in the Common sheet. - LPAD behavior, label matching, immediate encoding, and software-check exceptions are tested as per normative rules defined in the spec. - ELP state is observed via mstatus.MPELP (RV64) or mstatush.MPELP (RV32). - This sheet additionally covers M-mode specific trap entry and return coverpoints not present in other sheets: cp_elp_state_preservation_zicfilp cp_pelp_trap_entry_zicfilp cp_pelp_trap_entry_guarded_zicfilp cp_pelp_trap_return_zicfilp cp_elp_async_interrupt_zicfilp - All other assumptions, instruction types, and execution conditions are identical to the Zicfilp_Common sheet. Excluded (Debug testplan — separate file): - cp_elp_state_preservation_debug_zicfilp - cp_pelp_debug_mode_zicfilp - cp_pelp_debug_mode_r_zicfilp Excluded (Redundant — duplicate of cp_lpad_alignment_exception_zicfilp): - cp_lpad_misaligned_address_exception_zicfilp

Table 326. Zicfilp_Sm Coverpoints
Coverpoint Goal Feature Description Expectation Bins ID Normative Rule

cp_elp_state_preservation_zicfilp

Verify M-mode trap saves and restores previous ELP using MPELP

Test Environment:
xLPE=1 in the origin mode and medeleg=0. Execute an indirect branch in S- or U-mode (rs1 != {x1,x5,x7}) to a non-LPAD instruction: the software-check exception is taken in M-mode with ELP=LP_EXPECTED.
An ECALL cannot be used for the LP_EXPECTED case, because an ECALL at the target of an ELP-setting branch raises the software-check exception first. The ECALL back to M-mode covers the ELP=NO_LP_EXPECTED case.

Trap is delivered to M-mode. Previous ELP value (LP_EXPECTED) is saved in mstatus.MPELP. After executing MRET, ELP is restored to LP_EXPECTED in the returning privilege mode

Origin mode (U/S) × Trap target (M-mode) × ELP states

cfi_mstatus_mpelp_op

lpad_sw_exception
Zicfilp_pelp_trap
mstatus_spelp_mpelp_op
cfi_mstatus_mpelp_op
mstatus_spelp_mpelp_enc_lead_in
mstatus_spelp_mpelp_enc_list

cp_pelp_trap_entry_zicfilp

Verify xPELP and ELP on trap entry to M-mode

Test Environment:
mseccfg.MLPE=1. Execute an ECALL in M-mode with ELP=NO_LP_EXPECTED (no Indirect_CT before it), followed by a non-LPAD instruction.
The ELP=LP_EXPECTED case (software-check exception at a non-LPAD target) is covered by cp_zicfilp_lpad_label_exception_delivery.

On trap entry: mstatus.MPELP (mstatush.MPELP on RV32) = NO_LP_EXPECTED and ELP = NO_LP_EXPECTED. MRET therefore leaves ELP clear, so the non-LPAD instruction after the ECALL does not trap.

1 (ECALL in M-mode with ELP=NO_LP_EXPECTED)

Zicfilp_pelp_trap

Zicfilp_pelp_trap
mstatus_spelp_mpelp_op
cfi_mstatus_mpelp_op
mstatus_spelp_mpelp_enc_lead_in
mstatus_spelp_mpelp_enc_list

cp_pelp_trap_entry_guarded_zicfilp
cp_pelp_trap_entry_guarded_zicfilp_c

Verify xPELP and ELP on trap entry from software-guarded branch

Test Environment:
mseccfg.MLPE=1. Execute an Indirect_CT through x1, x5 and x7 in M-mode to an ECALL.
No landing pad is required at the target, so the ECALL is taken instead of a software-check exception.

On trap entry: mstatus.MPELP = NO_LP_EXPECTED and ELP remains NO_LP_EXPECTED.

3 rs1 registers {x1,x5,x7} x 3 Indirect_CT types (JALR, plus C.JR and C.JALR when Zca is implemented) = 3 + 6

Zicfilp_pelp_trap

Zicfilp_indirect_branch_lpad
Zicfilp_pelp_trap

cp_pelp_trap_return_zicfilp

Verify behavior of return from trap via MRET

Test Environment:
In M-mode set mstatus.MPP to M, S or U, set mstatus.MPELP (mstatush.MPELP on RV32) to 0 or 1, set mepc to a non-LPAD instruction, and execute MRET.
Sweep every combination of mseccfg.MLPE, menvcfg.LPE and senvcfg.LPE for each target mode.
After an MRET to M-mode, read MPELP back.

On MRET, ELP is set to MPELP if the xLPE of the mode being returned to is 1, otherwise NO_LP_EXPECTED. MPELP is set to NO_LP_EXPECTED. A software-check exception occurs only when MPELP=1 and the new mode’s xLPE=1. MPELP read back after an MRET to M-mode is 0.

3 target modes (M/S/U) x 8 (mseccfg.MLPE x menvcfg.LPE x senvcfg.LPE) x 2 MPELP = 48. Without S-mode: 2 target modes (M/U) x 4 (mseccfg.MLPE x menvcfg.LPE) x 2 = 16. M-mode only: 1 x 2 x 2 = 4.

Zicfilp_pelp_trap_return

Zicfilp_pelp_trap_return
mstatus_spelp_mpelp_op
cfi_mstatus_mpelp_op

cp_elp_async_interrupt_zicfilp

Verify that an interrupt taken before the target of an MRET that set ELP saves MPELP

Test Environment:
With S-mode. menvcfg.LPE=1, mstatus.MPP=S, mstatus.MPELP=1 (mstatush.MPELP on RV32), mepc at a non-LPAD instruction.
Make an S-mode software interrupt pending and enabled (mip.SSIP=1, mie.SSIE=1) but not delegated (mideleg.SSI=0), with mstatus.MIE=0 so it is not taken in M-mode, then execute MRET.
Interrupts are evaluated right after the MRET, so the interrupt is taken in M-mode before the target instruction executes.

The interrupt saves MPELP=LP_EXPECTED. The handler clears SSIP and returns with MRET, which restores ELP=LP_EXPECTED, so the non-LPAD target then raises a software-check exception (two traps in total).

1 (MRET to S-mode with MPELP=1 and an undelegated SSI pending)

Zicfilp_forward_trap_async_interrupt

Zicfilp_forward_traps
Zicfilp_forward_trap_async_interrupt

cp_zicfilp_indirect_elp_state_update
cp_zicfilp_indirect_elp_state_update_c
cp_zicfilp_direct_ct_no_elp
cp_zicfilp_lpad_zero_label_bypass
cp_zicfilp_lpad_valid_execution
cp_zicfilp_lpad_missing_instruction_exception
cp_zicfilp_lpad_label_mismatch
cp_zicfilp_lpad_label_match_mismatch
cp_zicfilp_lpad_label_exception_delivery
cp_disabled_zicfilp
cp_lpad_no_sw_exception_elp_clear_zicfilp
cp_exception_priority_zicfilp
cp_lpad_nop_no_lp_expected_zicfilp
cp_lpad_alignment_exception_zicfilp

Re-run the common Zicfilp coverpoints in M-mode

The coverpoints described in the Zicfilp Common Coverpoints table, executed in M-mode.

cfi_call_term
cfi_return_term
cfi_indirect_jump_term
Zicfilp_lpad_expected
Zicfilp_indirect_branch_lpad
mseccfg_mlpe_presence
mseccfg_mlpe_set_op
mseccfg_mlpe_clr_op_lead_in
mseccfg_mlpe_clr_op_list
Zicfilp_lpad_imm_enc
Zicfilp_lpad_enc
Zicfilp_lpad_label
Zicfilp_elp_lpad_expected
Zicfilp_lpad_enabled_instr_allowed
lpad_sw_exception
mtval_swchk_lead_in
mtval_swchk_list
Zicfilp_lpad_label_exception
Zicfilp_lpad_enabled_exception
Zicfilp_pelp_trap
mstatus_spelp_mpelp_op
cfi_mstatus_mpelp_op
Zicfilp_lpad_no_sw_exception
Zicfilp_forward_traps
Zicfilp_forward_trap_async_exception
Zicfilp_exception_priority
Zicfilp_lpad_alignment_exception

Zicfilp_S Supervisor-Mode Landing Pads
Table 327. Zicfilp_S Coverpoints
Coverpoint Goal Feature Description Expectation Bins ID Normative Rule

In this sheet, all Zicfilp tests from the Zicfilp_common_reference sheet are re-executed in Supervisor Mode (S-mode).
Environment:
- Zicfilp extension enabled, Zicsr enabled.
- Landing Pad Enabled (LPE) set according to privilege mode.
- Tests execute in S-mode.
Execution Notes:
- All indirect branch instructions (JALR, C.JALR, C.JR) are exercised as in the M/U-mode sheet.
- LPAD behavior, label matching, immediate encoding, and software-check exceptions are tested as per normative rules defined in the spec.
- Privilege-specific CSRs (SPELP, sstatus) are used for capturing and verifying ELP state in S-mode.
- Trap entry and return tests replicate M-mode tests but with S-mode as trap target.
- All other assumptions, instruction types, and execution conditions are identical to the original Zicfilp testplan.

cp_pelp_trap_entry_zicfilp

Verify xPELP and ELP on trap entry to S-mode

Test Environment:
menvcfg.LPE=1. Execute EBREAK in S-mode with ELP=NO_LP_EXPECTED (no Indirect_CT before it), followed by a non-LPAD instruction.
The breakpoint is delegated to S-mode; an S-mode ECALL is not delegated and reaches M-mode.
The ELP=LP_EXPECTED case (software-check exception at a non-LPAD target) is covered by cp_zicfilp_lpad_label_exception_delivery.

On trap entry: sstatus.SPELP = NO_LP_EXPECTED and ELP = NO_LP_EXPECTED. SRET therefore leaves ELP clear, so the non-LPAD instruction after the EBREAK does not trap.

1 (EBREAK in S-mode with ELP=NO_LP_EXPECTED)

Zicfilp_pelp_trap

cfi_mstatus_spelp_op
cfi_sstatus_spelp_op
Zicfilp_pelp_trap
mstatus_spelp_mpelp_op
mstatus_spelp_mpelp_enc_lead_in
mstatus_spelp_mpelp_enc_list

cp_pelp_trap_entry_guarded_zicfilp
cp_pelp_trap_entry_guarded_zicfilp_c

Verify xPELP and ELP on trap entry to S-mode from a software-guarded branch

Test Environment: menvcfg.LPE=1. Execute Indirect_CT through x1, x5 and x7 to an EBREAK. No landing pad is required at the target, so the breakpoint is taken instead of a software-check exception.

On trap entry: sstatus.SPELP = NO_LP_EXPECTED and ELP remains NO_LP_EXPECTED.

3 rs1 registers {x1,x5,x7} x 3 Indirect_CT types (JALR, plus C.JR and C.JALR when Zca is implemented) = 3 + 6

Zicfilp_pelp_trap Zicfilp_indirect_branch_lpad

Zicfilp_pelp_trap
Zicfilp_indirect_branch_lpad

cp_elp_state_preservation_zicfilp

Verify S-mode trap saves and restores previous ELP using SPELP

Test Environment: senvcfg.LPE=1. Execute an indirect branch in U-mode (rs1 != {x1,x5,x7}) to a non-LPAD instruction; the software-check exception is delegated to S-mode. After SRET the next non-LPAD instruction raises a second software-check exception, which shows ELP was restored. Then ECALL from U-mode with ELP=NO_LP_EXPECTED.

Trap delivered to S-mode. Previous ELP saved in sstatus.SPELP. After SRET, ELP is restored to LP_EXPECTED in U-mode.

Origin mode (U) x trap target (S-mode) x 2 ELP states

Zicfilp_pelp_trap cfi_sstatus_spelp_op

lpad_sw_exception
cfi_mstatus_spelp_op
cfi_sstatus_spelp_op
Zicfilp_pelp_trap
mstatus_spelp_mpelp_op

cp_pelp_trap_return_zicfilp

Verify behavior of return from trap via SRET

Test Environment: In S-mode set sstatus.SPP to S or U, set sstatus.SPELP to 0 or 1, set sepc to a non-LPAD instruction, and execute SRET. Sweep all four combinations of menvcfg.LPE and senvcfg.LPE for each target mode. After an SRET to S-mode, read SPELP back.

ELP is set to SPELP if the new mode xLPE is 1, otherwise NO_LP_EXPECTED. SPELP is set to NO_LP_EXPECTED. A software-check exception occurs only when SPELP=1 and xLPE=1. SPELP read back after an SRET to S-mode is 0.

2 target modes (S/U) x 4 (menvcfg.LPE x senvcfg.LPE) x 2 SPELP = 16

Zicfilp_pelp_trap_return

cfi_mstatus_spelp_op
cfi_sstatus_spelp_op
Zicfilp_pelp_trap_return
mstatus_spelp_mpelp_op
mstatus_spelp_mpelp_enc_lead_in
mstatus_spelp_mpelp_enc_list
sstatus_spelp

cp_zicfilp_indirect_elp_state_update
cp_zicfilp_indirect_elp_state_update_c
cp_zicfilp_direct_ct_no_elp
cp_zicfilp_lpad_zero_label_bypass
cp_zicfilp_lpad_valid_execution
cp_zicfilp_lpad_missing_instruction_exception
cp_zicfilp_lpad_label_mismatch
cp_zicfilp_lpad_label_match_mismatch
cp_zicfilp_lpad_label_exception_delivery
cp_disabled_zicfilp
cp_lpad_no_sw_exception_elp_clear_zicfilp
cp_exception_priority_zicfilp
cp_lpad_nop_no_lp_expected_zicfilp
cp_lpad_alignment_exception_zicfilp

Re-run the common Zicfilp coverpoints in S-mode

The coverpoints described in the Zicfilp Common Coverpoints table, executed in S-mode.

cfi_call_term
cfi_return_term
cfi_indirect_jump_term
Zicfilp_lpad_expected
Zicfilp_indirect_branch_lpad
menvcfg_lpe_op_lead_in
menvcfg_lpe_op_list
Zicfilp_lpad_imm_enc
Zicfilp_lpad_enc
Zicfilp_lpad_label
Zicfilp_elp_lpad_expected
Zicfilp_lpad_enabled_instr_allowed
lpad_sw_exception
stval_exception_info
Zicfilp_lpad_label_exception
Zicfilp_lpad_enabled_exception
cfi_mstatus_spelp_op
cfi_sstatus_spelp_op
Zicfilp_pelp_trap
mstatus_spelp_mpelp_op
mstatus_spelp_mpelp_enc_lead_in
mstatus_spelp_mpelp_enc_list
sstatus_spelp
Zicfilp_lpad_no_sw_exception
Zicfilp_forward_traps
Zicfilp_forward_trap_async_exception
Zicfilp_exception_priority
Zicfilp_lpad_alignment_exception

Zicfilp_H Hypervisor Landing Pads

The H group boots to HS-mode and sets the landing pad enables from there: menvcfg.LPE through T-SBI, henvcfg.LPE and senvcfg.LPE directly. henvcfg.LPE enables landing pads in VS-mode and senvcfg.LPE in VU-mode. hedeleg = 0, so software-check exceptions are taken in HS-mode unless a test delegates them to VS-mode. The trap record does not hold SPELP, so the tests observe it through the instruction after the handler returns, which raises a software-check exception exactly when ELP was restored to LP_EXPECTED. The number of traps is recorded after each case. The Zicfilp_S tests also run in VS-mode and in VU-mode, where henvcfg.LPE and senvcfg.LPE are the landing pad enables. Their traps are taken in HS-mode, which saves ELP in sstatus.SPELP.

Table 328. Zicfilp_H Coverpoints
Coverpoint Goal Feature Description Expectation Bins Normative Rule

cp_zicfilp_indirect_elp_state_update
cp_zicfilp_indirect_elp_state_update_c
cp_zicfilp_direct_ct_no_elp
cp_zicfilp_lpad_zero_label_bypass
cp_zicfilp_lpad_valid_execution
cp_zicfilp_lpad_missing_instruction_exception
cp_zicfilp_lpad_label_mismatch
cp_zicfilp_lpad_label_match_mismatch
cp_zicfilp_lpad_label_exception_delivery
cp_disabled_zicfilp
cp_lpad_no_sw_exception_elp_clear_zicfilp
cp_exception_priority_zicfilp
cp_lpad_nop_no_lp_expected_zicfilp
cp_lpad_alignment_exception_zicfilp
cp_pelp_trap_entry_zicfilp
cp_pelp_trap_entry_guarded_zicfilp
cp_pelp_trap_entry_guarded_zicfilp_c

Re-run the common Zicfilp coverpoints and the S-mode trap entry coverpoints in VS-mode and VU-mode

The coverpoints described in the Zicfilp Common Coverpoints table, and the trap entry coverpoints of the Zicfilp_S sheet, executed in VS-mode and in VU-mode.
The landing pad enable is henvcfg.LPE in VS-mode and senvcfg.LPE in VU-mode. Software-check, illegal-instruction and instruction access-fault exceptions are taken in HS-mode, so sstatus.SPELP holds the previous ELP and stval the software-check code.

As in the Common table and the Zicfilp_S sheet, with the trap taken in HS-mode.

priv_mode {VS, VU} x (the bins of each re-run coverpoint)

cfi_call_term
cfi_return_term
cfi_indirect_jump_term
Zicfilp_lpad_expected
Zicfilp_indirect_branch_lpad
senvcfg_lpe_Zicfilp
henvcfg_lpe_op
Zicfilp_lpad_imm_enc
Zicfilp_lpad_enc
Zicfilp_lpad_label
Zicfilp_elp_lpad_expected
Zicfilp_lpad_enabled_instr_allowed
lpad_sw_exception
stval_exception_info
Zicfilp_lpad_label_exception
Zicfilp_lpad_enabled_exception
cfi_mstatus_spelp_op
cfi_sstatus_spelp_op
Zicfilp_pelp_trap
mstatus_spelp_mpelp_op
Zicfilp_lpad_no_sw_exception
Zicfilp_forward_traps
Zicfilp_forward_trap_async_exception
Zicfilp_exception_priority
Zicfilp_lpad_alignment_exception

cp_vs_lpe

henvcfg.LPE, not menvcfg.LPE, enables landing pads in VS-mode

For each value of henvcfg.LPE and menvcfg.LPE, in VS-mode, with x7[31:12] holding the expected label:
jalr, c.jr and c.jalr (Zca) through a register other than x1, x5 and x7 to a non-LPAD instruction, and to an LPAD whose nonzero label does not match x7[31:12].

Software-check exception (cause 18), taken in HS-mode, exactly when henvcfg.LPE = 1, whatever menvcfg.LPE holds. With henvcfg.LPE = 0, ELP stays NO_LP_EXPECTED and the LPAD executes as a no-op.

priv_mode VS x henvcfg.LPE {0, 1} x menvcfg.LPE {0, 1} x {jalr, c.jr, c.jalr} x target {not_lpad, lpad_mismatch}
= 24 bins (8 without Zca)

henvcfg_lpe_op

cp_vu_lpe

senvcfg.LPE, not henvcfg.LPE, enables landing pads in VU-mode

For each value of senvcfg.LPE and henvcfg.LPE, in VU-mode, with x7[31:12] holding the expected label:
jalr, c.jr and c.jalr (Zca) through a register other than x1, x5 and x7 to a non-LPAD instruction, and to an LPAD whose nonzero label does not match x7[31:12].

Software-check exception (cause 18), taken in HS-mode, exactly when senvcfg.LPE = 1, whatever henvcfg.LPE holds. With senvcfg.LPE = 0, ELP stays NO_LP_EXPECTED and the LPAD executes as a no-op.

priv_mode VU x senvcfg.LPE {0, 1} x henvcfg.LPE {0, 1} x {jalr, c.jr, c.jalr} x target {not_lpad, lpad_mismatch}
= 24 bins (8 without Zca)

senvcfg_lpe_Zicfilp
henvcfg_lpe_op

cp_trap_entry_spelp

A trap from VS-mode or VU-mode saves ELP in vsstatus.SPELP when taken in VS-mode and in sstatus.SPELP when taken in HS-mode

henvcfg.LPE = senvcfg.LPE = 1. Trap into VS-mode (hedeleg[3] = hedeleg[18] = 1) or into HS-mode (hedeleg = 0), from VS-mode and from VU-mode:
- ELP = LP_EXPECTED: jalr through a non-link register to a non-LPAD instruction, which raises a software-check exception.
- ELP = NO_LP_EXPECTED: an ebreak that no indirect jump precedes.

The trap saves ELP in the SPELP of the handler’s mode and the handler’s SRET restores it. After an LP_EXPECTED trap the next non-LPAD instruction traps again before the LPAD that resumes the test; after a NO_LP_EXPECTED trap the instruction after the ebreak does not trap.

priv_mode {VS, VU} x LPE of the mode enabled x ELP {lp_expected, no_lp_expected} x handler {HS, VS}
= 8 bins

Zicfilp_forward_traps
lpad_sw_exception
vsstatus_spelp_exists
Zicfilp_pelp_trap
vsstatus_spelp_op

cp_vs_sret_spelp

SRET executed in VS-mode restores ELP from vsstatus.SPELP and clears it

For each value of henvcfg.LPE, senvcfg.LPE and SPELP, and a return to VS-mode or VU-mode: HS-mode sets sstatus.SPELP to the opposite of SPELP. In VS-mode, write vsstatus.SPP and vsstatus.SPELP through sstatus, set sepc to a non-LPAD instruction and execute sret.

Software-check exception exactly when vsstatus.SPELP = 1 and the LPE of the new mode (henvcfg.LPE for VS-mode, senvcfg.LPE for VU-mode) is 1. After the SRET, vsstatus.SPELP reads 0, read as sstatus in VS-mode and through T-SBI in VU-mode.

priv_mode VS x sret x new mode {VU, VS} x henvcfg.LPE {0, 1} x senvcfg.LPE {0, 1} x vsstatus.SPELP {0, 1}
= 16 bins

vsstatus_spelp_exists
Zicfilp_pelp_trap_return
sstatus_spelp
vsstatus_spelp_op

cp_hs_sret_spelp

SRET executed in HS-mode into VS-mode or VU-mode restores ELP from sstatus.SPELP, not vsstatus.SPELP

For each value of henvcfg.LPE, senvcfg.LPE and sstatus.SPELP, and a return to VS-mode or VU-mode: in HS-mode set hstatus.SPV = 1, sstatus.SPP for the new mode, sstatus.SPELP, and vsstatus.SPELP to the opposite value, set sepc to a non-LPAD instruction and execute sret.

Software-check exception exactly when sstatus.SPELP = 1 and the LPE of the new mode (henvcfg.LPE for VS-mode, senvcfg.LPE for VU-mode) is 1. Back in HS-mode, vsstatus.SPELP is unchanged.

priv_mode HS x sret x new mode {VU, VS} x henvcfg.LPE {0, 1} x senvcfg.LPE {0, 1} x sstatus.SPELP {0, 1} x vsstatus.SPELP differs
= 16 bins

Zicfilp_pelp_trap_return
vsstatus_spelp_op

cp_vs_sstatus_spelp

sstatus.SPELP accessed in VS-mode is vsstatus.SPELP

In VS-mode, set and then clear sstatus.SPELP with csrrs and csrrc, and read sstatus back. After each write, HS-mode reads vsstatus.SPELP.

sstatus.SPELP read in VS-mode and vsstatus.SPELP read in HS-mode both hold the value VS-mode wrote.

priv_mode VS x {csrrs, csrrc} sstatus x rs1 bit 23 (SPELP) set
= 2 bins

sstatus_spelp
vsstatus_spelp_op

cp_hs_sret_to_hs_spelp

SRET from HS-mode to HS-mode restores ELP from sstatus.SPELP and clears it, leaving vsstatus.SPELP alone

For each value of menvcfg.LPE and sstatus.SPELP: in HS-mode set hstatus.SPV = 0, sstatus.SPP = 1, sstatus.SPELP, and vsstatus.SPELP to the opposite value, set sepc to a non-LPAD instruction and execute sret.

Software-check exception exactly when sstatus.SPELP = 1 and menvcfg.LPE = 1. After the SRET, sstatus.SPELP reads 0 and vsstatus.SPELP is unchanged.

priv_mode HS x sret x new mode HS x menvcfg.LPE {0, 1} x sstatus.SPELP {0, 1} x vsstatus.SPELP differs
= 4 bins

Zicfilp_pelp_trap_return
vsstatus_spelp_op

cp_elp_async_interrupt

An interrupt taken after an SRET that set ELP = LP_EXPECTED, before the target is decoded, saves SPELP = LP_EXPECTED

henvcfg.LPE = senvcfg.LPE = 1, sstatus.SIE = 0. In HS-mode raise a VS-level software interrupt (hvip.VSSIP = 1, hie.VSSIE = 1), with hideleg.VSSI = 0 so it is taken in HS-mode, or hideleg.VSSI = 1 and vsstatus.SIE = 1 so it is taken in VS-mode. SRET with sstatus.SPELP = 1 to a non-LPAD instruction in VS-mode or VU-mode.

The interrupt is taken right after the SRET and saves SPELP = LP_EXPECTED in sstatus or vsstatus. The handler’s SRET restores ELP, so the non-LPAD target then raises a software-check exception, taken in HS-mode. Two traps in all.

priv_mode HS x sret x new mode {VU, VS} x sstatus.SPELP = 1 x LPE of the new mode = 1 x interrupt taken in {HS, VS}
= 4 bins

Zicfilp_forward_traps
Zicfilp_forward_trap_async_interrupt
Zicfilp_pelp_trap
vsstatus_spelp_op

cp_vs_trap_delivery

A software-check exception delegated to VS-mode reports its cause in vscause and vstval and saves ELP in vsstatus.SPELP

hedeleg[18] = 1, with henvcfg.LPE = 1 in VS-mode or senvcfg.LPE = 1 in VU-mode, and x7[31:12] holding the expected label. From VS-mode and VU-mode, jalr, c.jr and c.jalr (Zca) through a register other than x1, x5 and x7 to a non-LPAD instruction, and to an LPAD whose nonzero label does not match x7[31:12]. Record the trap count after each case.

Software-check exception taken in VS-mode with vscause = 18, vstval = 2 when the hart reports the landing pad fault code in stval and 0 otherwise, and vsstatus.SPELP = LP_EXPECTED. The VS-mode handler’s SRET restores ELP, so the next non-LPAD instruction traps again before the LPAD.

priv_mode {VS, VU} x LPE of the mode enabled x {jalr, c.jr, c.jalr} x target {not_lpad, lpad_mismatch} x vscause software check x vstval x vsstatus.SPELP = 1
= 12 bins (4 without Zca)

lpad_sw_exception
vsstatus_spelp_exists
Zicfilp_pelp_trap
vsstatus_spelp_op
stval_exception_info

Zicfilp_SmH Machine-Mode Hypervisor Landing Pads

Zicfilp_SmH boots to M-mode with medeleg[3] = medeleg[18] = 0, so breakpoints and software-check exceptions from VS-mode and VU-mode are taken in M-mode. The number of traps is recorded after each case. Traps taken in HS-mode are in Zicfilp_H.

Table 329. Zicfilp_SmH Coverpoints
Coverpoint Goal Feature Description Expectation Bins Normative Rule

cp_trap_mpelp_virt

A trap from VS-mode or VU-mode into M-mode saves ELP in MPELP

medeleg[3] = medeleg[18] = 0. With henvcfg.LPE = 1 in VS-mode or senvcfg.LPE = 1 in VU-mode:
- ELP = LP_EXPECTED: jalr through a register other than x1, x5 and x7 to a non-LPAD instruction, which raises a software-check exception.
- ELP = NO_LP_EXPECTED: an ebreak that no indirect jump precedes.
Record the trap count afterwards.

The trap saves ELP in MPELP and sets MPV. The handler’s mret restores ELP, so after the LP_EXPECTED trap the next non-LPAD instruction traps again before the LPAD; after the ebreak the next instruction does not trap.

priv_mode {VS, VU} x LPE of the mode enabled x ELP {lp_expected, no_lp_expected}
= 4 bins

Zicfilp_pelp_trap
cfi_mstatus_mpelp_op

cp_mret_mpelp_virt

mret to VS-mode or VU-mode restores ELP from MPELP using the landing pad enable of the new mode

For each value of henvcfg.LPE, senvcfg.LPE and MPELP: execute mret with MPV = 1 and MPP = S (VS-mode) or U (VU-mode) to a non-LPAD instruction. menvcfg.LPE holds the opposite of the new mode’s enable. Record the trap count afterwards.

Software-check exception, taken in M-mode, exactly when MPELP = 1 and the new mode’s enable (henvcfg.LPE for VS-mode, senvcfg.LPE for VU-mode) is 1.

priv_mode M x mret x new mode {VU, VS} x henvcfg.LPE {0, 1} x senvcfg.LPE {0, 1} x MPELP {0, 1}
= 16 bins

Zicfilp_pelp_trap_return
cfi_mstatus_mpelp_op

cp_vs_sstatus_spelp_mstatus

A VS-mode write to sstatus.SPELP writes vsstatus.SPELP and leaves mstatus.SPELP unchanged

medeleg[10] = 0. For each value of mstatus.SPELP, set vsstatus.SPELP to the opposite of the write. In VS-mode, csrrs or csrrc sstatus with the SPELP bit, then read sstatus. In M-mode, read mstatus.SPELP and vsstatus.SPELP.

sstatus in VS-mode and vsstatus hold the written value. mstatus.SPELP is unchanged.

priv_mode VS x {csrrs, csrrc} x mstatus.SPELP {0, 1}
= 4 bins

sstatus_spelp

Table 330. Zicfilp Normative Rules
Normative Rule Rule Text Coverpoints

cfi_call_term

The term call is used to refer to a JAL, JALR or C.JAL instruction with a link register as destination, i.e., rd≠x0. Conventionally, the link register is x1 or x5. A call using JAL or C.JAL is termed a direct call. A C.JALR expands to JALR x1, 0(rs1) and thus it is a call. A call using JALR or C.JALR is termed an indirect call.

{Zicfilp_Sm_cg,Zicfilp_S_cg,Zicfilp_U_cg,Zicfilp_H_cg}/{cp_zicfilp_indirect_elp_state_update,cp_zicfilp_indirect_elp_state_update_c} (jalr with rd=x1, c.jalr), {Zicfilp_Sm_cg,Zicfilp_S_cg,Zicfilp_U_cg,Zicfilp_H_cg}/cp_zicfilp_direct_ct_no_elp (jal with rd=x1, c.jal: direct calls)

cfi_return_term

The term return is used to refer to a JALR instruction with rd=x0 and with rs1=x1 or rs1=x5. A C.JR instruction expands to JALR x0, 0(rs1) and is a return if rs1=x1 or rs1=x5.

{Zicfilp_Sm_cg,Zicfilp_S_cg,Zicfilp_U_cg,Zicfilp_H_cg}/{cp_zicfilp_indirect_elp_state_update,cp_zicfilp_indirect_elp_state_update_c} (jalr with rd=x0, c.jr)

cfi_indirect_jump_term

The term indirect jump is used to refer to a JALR instruction with rd=x0 and where the rs1 is not x1 or x5 (i.e., not a return). A C.JR instruction where rs1 is not x1 or x5 (i.e., not a return) is an indirect jump.

{Zicfilp_Sm_cg,Zicfilp_S_cg,Zicfilp_U_cg,Zicfilp_H_cg}/{cp_zicfilp_indirect_elp_state_update,cp_zicfilp_indirect_elp_state_update_c} (jalr with rd=x0, c.jr)

Zicfilp_lpad_enc

The LPAD instruction (See LP_INST) is encoded using the AUIPC major opcode with rd=x0.

{Zicfilp_Sm_cg,Zicfilp_S_cg,Zicfilp_U_cg,Zicfilp_H_cg}/cp_zicfilp_lpad_valid_execution

Zicfilp_lpad_imm_enc

The LPAD instruction is encoded with a 20-bit immediate value called the landing-pad-label (LPL) that is matched to the expected landing pad label. When LPL is encoded as zero, the LPAD instruction does not perform the label check and in programs built with this single label mode of operation the indirect call/jump sites do not need to establish an expected landing pad label value in x7.

{Zicfilp_Sm_cg,Zicfilp_S_cg,Zicfilp_U_cg,Zicfilp_H_cg}/{cp_zicfilp_lpad_zero_label_bypass,cp_zicfilp_lpad_valid_execution}

Zicfilp_lpad_expected

The Zicfilp extension, when enabled, determines if an indirect call or an indirect jump must land on a landing pad, as specified in IND_CALL_JMP. If is_lp_expected is 1, then the hart updates the ELP to LP_EXPECTED.

{Zicfilp_Sm_cg,Zicfilp_S_cg,Zicfilp_U_cg,Zicfilp_H_cg}/{cp_zicfilp_indirect_elp_state_update,cp_zicfilp_indirect_elp_state_update_c}, {Zicfilp_Sm_cg,Zicfilp_S_cg,Zicfilp_U_cg,Zicfilp_H_cg}/cp_zicfilp_direct_ct_no_elp (direct jumps and taken branches do not set ELP)

Zicfilp_indirect_branch_lpad

An indirect branch using JALR, C.JALR, or C.JR with rs1 as x7 is termed a software-guarded branch. Such branches do not need to land on a LPAD instruction and thus do not set ELP to LP_EXPECTED.

{Zicfilp_Sm_cg,Zicfilp_S_cg,Zicfilp_U_cg,Zicfilp_H_cg}/{cp_zicfilp_indirect_elp_state_update,cp_zicfilp_indirect_elp_state_update_c} (rs1 = x1, x5, x7 bins), Zicfilp_Sm_cg/{cp_pelp_trap_entry_guarded_zicfilp,cp_pelp_trap_entry_guarded_zicfilp_c}

Zicfilp_lpad_label

To support labeled landing pads, the indirect call/jump sites establish an expected landing pad label (e.g., using the LUI instruction) in the bits 31:12 of the x7 register.

{Zicfilp_Sm_cg,Zicfilp_S_cg,Zicfilp_U_cg,Zicfilp_H_cg}/{cp_zicfilp_lpad_label_match_mismatch,cp_zicfilp_lpad_valid_execution}

Zicfilp_elp_lpad_expected

When ELP is set to LP_EXPECTED, if the next instruction in the instruction stream is not 4-byte aligned, or is not LPAD, or if the landing pad label encoded in LPAD is not zero and does not match the expected landing pad label in bits 31:12 of the x7 register, then a software-check exception (cause=18) with xtval set to landing pad fault (code=2) is raised else the ELP is updated to NO_LP_EXPECTED.

{Zicfilp_Sm_cg,Zicfilp_S_cg,Zicfilp_U_cg,Zicfilp_H_cg}/{cp_zicfilp_lpad_valid_execution,cp_zicfilp_lpad_missing_instruction_exception,cp_zicfilp_lpad_label_mismatch,cp_lpad_no_sw_exception_elp_clear_zicfilp,cp_lpad_nop_no_lp_expected_zicfilp}, {Zicfilp_Sm_cg,Zicfilp_S_cg,Zicfilp_U_cg,Zicfilp_H_cg}/cp_lpad_alignment_exception_zicfilp (Zca only: without Zca a target that is not 4-byte aligned raises an instruction-address-misaligned exception first)

Zicfilp_lpad_enabled_instr_allowed

When Zicfilp is enabled, LPAD is the only instruction allowed to execute when the ELP state is LP_EXPECTED. If Zicfilp is not enabled then the instruction is a no-op.

{Zicfilp_Sm_cg,Zicfilp_S_cg,Zicfilp_U_cg,Zicfilp_H_cg}/{cp_zicfilp_lpad_missing_instruction_exception,cp_disabled_zicfilp}

Zicfilp_lpad_enabled_exception

If Zicfilp is enabled, the LPAD instruction causes a software-check exception with xtval set to landing pad fault (code=2)

{Zicfilp_Sm_cg,Zicfilp_S_cg,Zicfilp_U_cg,Zicfilp_H_cg}/cp_zicfilp_lpad_label_exception_delivery, {Zicfilp_Sm_cg,Zicfilp_S_cg,Zicfilp_U_cg,Zicfilp_H_cg}/cp_lpad_alignment_exception_zicfilp (Zca only)

Zicfilp_lpad_alignment_exception

The pc is not 4-byte aligned and ELP is LP_EXPECTED.

{Zicfilp_Sm_cg,Zicfilp_S_cg,Zicfilp_U_cg,Zicfilp_H_cg}/cp_lpad_alignment_exception_zicfilp (Zca only)

Zicfilp_lpad_label_exception

The ELP is LP_EXPECTED and the LPL is not zero and the LPL does not match the expected landing pad label in bits 31:12 of the x7 register.

{Zicfilp_Sm_cg,Zicfilp_S_cg,Zicfilp_U_cg,Zicfilp_H_cg}/{cp_zicfilp_lpad_label_mismatch,cp_zicfilp_lpad_label_exception_delivery}

Zicfilp_lpad_no_sw_exception

If a software-check exception is not caused then the ELP is updated to NO_LP_EXPECTED.

{Zicfilp_Sm_cg,Zicfilp_S_cg,Zicfilp_U_cg,Zicfilp_H_cg}/{cp_lpad_no_sw_exception_elp_clear_zicfilp,cp_lpad_nop_no_lp_expected_zicfilp}

Zicfilp_forward_traps

A trap may need to be delivered to the same or to a higher privilege mode upon completion of JALR/C.JALR/C.JR, but before the instruction at the target of indirect call/jump was decoded

{Zicfilp_Sm_cg,Zicfilp_S_cg,Zicfilp_U_cg,Zicfilp_H_cg}/cp_exception_priority_zicfilp (instruction access fault), Zicfilp_Sm_cg/cp_elp_async_interrupt_zicfilp, Zicfilp_H_cg/{cp_elp_async_interrupt,cp_trap_entry_spelp} (to HS-mode and VS-mode)

Zicfilp_forward_trap_async_interrupt

Asynchronous interrupts.

Zicfilp_Sm_cg/cp_elp_async_interrupt_zicfilp (S-mode software interrupt taken right after an MRET that set ELP), Zicfilp_H_cg/cp_elp_async_interrupt (VS-level software interrupt taken in HS-mode or VS-mode right after an SRET that set ELP)

Zicfilp_forward_trap_async_exception

Synchronous exceptions with priority higher than that of a software-check exception with xtval set to landing pad fault (code=2) (See norm:exc_priority of Privileged Specification).

{Zicfilp_Sm_cg,Zicfilp_S_cg,Zicfilp_U_cg,Zicfilp_H_cg}/cp_exception_priority_zicfilp (instruction access fault)

Zicfilp_exception_priority

The software-check exception caused by Zicfilp has higher priority than an illegal-instruction exception but lower priority than instruction access-fault.

{Zicfilp_Sm_cg,Zicfilp_S_cg,Zicfilp_U_cg,Zicfilp_H_cg}/cp_exception_priority_zicfilp (instruction access fault and illegal instruction bins)

lpad_sw_exception

The software-check exception due to the instruction not being an LPAD instruction when ELP is LP_EXPECTED or a software-check exception caused by the LPAD instruction itself leads to a trap being delivered to the same or to a higher privilege mode.

{Zicfilp_Sm_cg,Zicfilp_S_cg,Zicfilp_U_cg,Zicfilp_H_cg}/{cp_zicfilp_lpad_missing_instruction_exception,cp_zicfilp_lpad_label_exception_delivery}, Zicfilp_Sm_cg/cp_elp_state_preservation_zicfilp (from S/U-mode to M-mode), Zicfilp_S_cg/cp_elp_state_preservation_zicfilp (from U-mode to S-mode), Zicfilp_H_cg/{cp_trap_entry_spelp,cp_vs_trap_delivery} (from VS-mode and VU-mode to HS-mode and VS-mode)

cfi_mstatus_spelp_op

To store the previous ELP state on trap delivery to S/HS-mode, an SPELP bit is provided in the mstatus CSR.

Zicfilp_S_cg/{cp_pelp_trap_entry_zicfilp,cp_elp_state_preservation_zicfilp,cp_pelp_trap_return_zicfilp}, {Zicfilp_S_cg,Zicfilp_U_cg,Zicfilp_H_cg}/{cp_zicfilp_lpad_label_exception_delivery,cp_exception_priority_zicfilp}

cfi_sstatus_spelp_op

The SPELP bit in mstatus can be accessed through the sstatus CSR.

{Zicfilp_S_cg,Zicfilp_U_cg,Zicfilp_H_cg}/cp_zicfilp_lpad_label_exception_delivery, Zicfilp_S_cg/{cp_pelp_trap_entry_zicfilp,cp_elp_state_preservation_zicfilp,cp_pelp_trap_return_zicfilp}

vsstatus_spelp_exists

To store the previous ELP state on traps to VS-mode, a SPELP bit is defined in the vsstatus (VS-modes version of sstatus).

Zicfilp_H_cg/{cp_trap_entry_spelp, cp_vs_sret_spelp, cp_vs_trap_delivery}

dcsr_pelp_op

To store the previous ELP state on transition to Debug Mode, a PELP bit is defined in the dcsr register.

Debug Mode: belongs to the Sdext testplan

Zicfilp_pelp_debug_mode

Upon entry into Debug Mode, the PELP bit in dcsr is updated with the ELP at the privilege level the hart was previously in, and the ELP is set to NO_LP_EXPECTED. When a hart resumes from Debug Mode, if the new privilege mode is y, then ELP is set to the value of PELP if yLPE (see FCFIACT) is 1; otherwise, it is set to NO_LP_EXPECTED.

Debug Mode: belongs to the Sdext testplan

Zicfilp_pelp_trap

When a trap is taken into privilege mode x, the XPELP is set to ELP and ELP is set to NO_LP_EXPECTED.

Zicfilp_Sm_cg/{cp_pelp_trap_entry_zicfilp,cp_pelp_trap_entry_guarded_zicfilp,cp_pelp_trap_entry_guarded_zicfilp_c,cp_elp_state_preservation_zicfilp}, Zicfilp_S_cg/{cp_pelp_trap_entry_zicfilp,cp_pelp_trap_entry_guarded_zicfilp,cp_pelp_trap_entry_guarded_zicfilp_c,cp_elp_state_preservation_zicfilp}, {Zicfilp_Sm_cg,Zicfilp_S_cg,Zicfilp_U_cg,Zicfilp_H_cg}/{cp_zicfilp_lpad_label_exception_delivery,cp_exception_priority_zicfilp}, Zicfilp_H_cg/cp_trap_entry_spelp (traps into VS-mode and HS-mode from VS-mode and VU-mode), Zicfilp_SmH_cg/cp_trap_mpelp_virt (traps into M-mode from VS-mode and VU-mode), Zicfilp_H_cg/{cp_pelp_trap_entry_zicfilp,cp_pelp_trap_entry_guarded_zicfilp,cp_pelp_trap_entry_guarded_zicfilp_c,cp_elp_async_interrupt,cp_vs_trap_delivery}

Zicfilp_pelp_trap_return

An MRET or SRET instruction is used to return from a trap in M-mode or S-mode, respectively. When executing an XRET instruction, if the new privilege mode is y, then ELP is set to the value of XPELP if yLPE (see FCFIACT) is 1; otherwise, it is set to NO_LP_EXPECTED; XPELP is set to NO_LP_EXPECTED.

Zicfilp_Sm_cg/cp_pelp_trap_return_zicfilp (MRET), Zicfilp_S_cg/cp_pelp_trap_return_zicfilp (SRET), xPELP=NO_LP_EXPECTED after an xRET to the same mode is checked in the signature, Zicfilp_H_cg/{cp_vs_sret_spelp, cp_hs_sret_spelp} (SRET into VS-mode and VU-mode), Zicfilp_H_cg/cp_hs_sret_to_hs_spelp (SRET from HS-mode to HS-mode leaves vsstatus.SPELP alone), Zicfilp_SmH_cg/cp_mret_mpelp_virt (MRET into VS-mode and VU-mode)

mstatus_spelp_mpelp_op

The Zicfilp extension adds the SPELP and MPELP fields that hold the previous ELP, and are updated as specified in ZICFILP_FORWARD_TRAPS.

{Zicfilp_S_cg,Zicfilp_U_cg,Zicfilp_H_cg}/{cp_zicfilp_lpad_label_exception_delivery,cp_exception_priority_zicfilp}, Zicfilp_S_cg/{cp_pelp_trap_entry_zicfilp,cp_elp_state_preservation_zicfilp,cp_pelp_trap_return_zicfilp}, Zicfilp_Sm_cg/{cp_zicfilp_lpad_label_exception_delivery,cp_pelp_trap_entry_zicfilp,cp_elp_state_preservation_zicfilp,cp_pelp_trap_return_zicfilp}

cfi_mstatus_mpelp_op

To store the previous ELP state on trap delivery to M-mode, an MPELP bit is provided in the mstatus CSR.

Zicfilp_Sm_cg/{cp_zicfilp_lpad_label_exception_delivery,cp_pelp_trap_entry_zicfilp,cp_elp_state_preservation_zicfilp,cp_pelp_trap_return_zicfilp}, Zicfilp_SmH_cg/{cp_trap_mpelp_virt,cp_mret_mpelp_virt} (MPELP with MPV = 1)

mstatus_spelp_mpelp_enc_lead_in

The x`PELP` fields are encoded as follows:

Zicfilp_Sm_cg/{cp_pelp_trap_entry_zicfilp,cp_elp_state_preservation_zicfilp}, Zicfilp_S_cg/{cp_pelp_trap_entry_zicfilp,cp_pelp_trap_return_zicfilp}, {Zicfilp_S_cg,Zicfilp_U_cg}/cp_zicfilp_lpad_label_exception_delivery

mstatus_spelp_mpelp_enc_list

0 - NO_LP_EXPECTED - no landing pad instruction expected. 1 - LP_EXPECTED - a landing pad instruction is expected.

Zicfilp_Sm_cg/{cp_pelp_trap_entry_zicfilp,cp_elp_state_preservation_zicfilp}, Zicfilp_S_cg/{cp_pelp_trap_entry_zicfilp,cp_pelp_trap_return_zicfilp}, {Zicfilp_S_cg,Zicfilp_U_cg}/cp_zicfilp_lpad_label_exception_delivery

menvcfg_lpe_op_lead_in

The Zicfilp extension adds the LPE field in menvcfg. When the LPE field is set to 1 and S-mode is implemented, the Zicfilp extension is enabled in S-mode. If LPE field is set to 1 and S-mode is not implemented, the Zicfilp extension is enabled in U-mode. When the LPE field is 0, the Zicfilp extension is not enabled in S-mode, and the following rules apply to S-mode. If the LPE field is 0 and S-mode is not implemented, then the same rules apply to U-mode.

Zicfilp_S_cg/{cp_zicfilp_indirect_elp_state_update,cp_zicfilp_indirect_elp_state_update_c,cp_disabled_zicfilp}, Zicfilp_U_cg/{cp_zicfilp_indirect_elp_state_update,cp_zicfilp_indirect_elp_state_update_c,cp_disabled_zicfilp} (S-mode not implemented)

menvcfg_lpe_op_list

The hart does not update the ELP state; it remains as NO_LP_EXPECTED. The LPAD instruction operates as a no-op.

Zicfilp_S_cg/{cp_zicfilp_indirect_elp_state_update,cp_zicfilp_indirect_elp_state_update_c,cp_disabled_zicfilp}, Zicfilp_U_cg/{cp_zicfilp_indirect_elp_state_update,cp_zicfilp_indirect_elp_state_update_c,cp_disabled_zicfilp} (S-mode not implemented)

mseccfg_mlpe_presence

The Zicfilp extension adds the MLPE field in mseccfg.

Zicfilp_Sm_cg/cp_zicfilp_indirect_elp_state_update

mseccfg_mlpe_set_op

When MLPE field is 1, Zicfilp extension is enabled in M-mode.

Zicfilp_Sm_cg/{cp_zicfilp_indirect_elp_state_update,cp_zicfilp_indirect_elp_state_update_c}

mseccfg_mlpe_clr_op_lead_in

When the MLPE field is 0, the Zicfilp extension is not enabled in M-mode and the following rules apply to M-mode.

Zicfilp_Sm_cg/{cp_zicfilp_indirect_elp_state_update,cp_zicfilp_indirect_elp_state_update_c,cp_disabled_zicfilp}

mseccfg_mlpe_clr_op_list

The hart does not update the ELP state; it remains as NO_LP_EXPECTED. The LPAD instruction operates as a no-op.

Zicfilp_Sm_cg/{cp_zicfilp_indirect_elp_state_update,cp_zicfilp_indirect_elp_state_update_c,cp_disabled_zicfilp}

mseccfg_mlpe_rst

If the Zicfilp extension is implemented, the mseccfg.MLPE field is reset to 0.

Reset values are not tested

sstatus_spelp

Access to the SPELP field, added by Zicfilp, accesses the homonymous fields of mstatus when V=0, and the homonymous fields of vsstatus when V=1.

{Zicfilp_S_cg,Zicfilp_U_cg}/cp_zicfilp_lpad_label_exception_delivery (V=0), Zicfilp_S_cg/cp_pelp_trap_return_zicfilp (SPELP written through sstatus), Zicfilp_H_cg/{cp_vs_sstatus_spelp, cp_vs_sret_spelp} (V=1), Zicfilp_SmH_cg/cp_vs_sstatus_spelp_mstatus (V=1 leaves mstatus.SPELP unchanged)

senvcfg_lpe_Zicfilp

The Zicfilp extension adds the LPE field in senvcfg. When the LPE field is set to 1, the Zicfilp extension is enabled in VU/U-mode. When the LPE field is 0, the Zicfilp extension is not enabled in VU/U-mode and the following rules apply to VU/U-mode:

Zicfilp_U_cg/{cp_zicfilp_indirect_elp_state_update,cp_zicfilp_indirect_elp_state_update_c,cp_disabled_zicfilp}, Zicfilp_H_cg/cp_vu_lpe (VU-mode), Zicfilp_H_cg/{cp_zicfilp_indirect_elp_state_update,cp_zicfilp_indirect_elp_state_update_c,cp_disabled_zicfilp} (VU-mode)

henvcfg_lpe_op

The Zicfilp extension adds the LPE field in henvcfg. When the LPE field is set to 1, the Zicfilp extension is enabled in VS-mode. When the LPE field is 0, the Zicfilp extension is not enabled in VS-mode and the following rules apply to VS-mode:

Zicfilp_H_cg/{cp_vs_lpe, cp_vu_lpe}, Zicfilp_H_cg/{cp_zicfilp_indirect_elp_state_update,cp_zicfilp_indirect_elp_state_update_c,cp_disabled_zicfilp} (VS-mode)

vsstatus_spelp_op

The Zicfilp extension adds the SPELP field that holds the previous ELP, and is updated as specified in ZICFILP_FORWARD_TRAPS. The SPELP field is encoded as follows:

Zicfilp_H_cg/{cp_trap_entry_spelp, cp_vs_sret_spelp, cp_hs_sret_spelp, cp_hs_sret_to_hs_spelp, cp_vs_sstatus_spelp}, Zicfilp_H_cg/{cp_elp_async_interrupt,cp_vs_trap_delivery}

mtval_swchk_lead_in

On a trap caused by a software-check exception, the mtval register holds the cause for the exception. The following encodings are defined:

Zicfilp_Sm_cg/{cp_zicfilp_lpad_missing_instruction_exception,cp_zicfilp_lpad_label_mismatch,cp_zicfilp_lpad_label_exception_delivery}

mtval_swchk_list

0 - No information provided. 2 - Landing Pad Fault. Defined by the Zicfilp extension (priv-forward). 3 - Shadow Stack Fault. Defined by the Zicfiss extension (priv-backward).

Zicfilp_Sm_cg/{cp_zicfilp_lpad_missing_instruction_exception,cp_zicfilp_lpad_label_mismatch,cp_zicfilp_lpad_label_exception_delivery}

stval_exception_info

On a trap caused by a software-check exception, the stval register holds the cause for the exception. The following encodings are defined:

{Zicfilp_S_cg,Zicfilp_U_cg,Zicfilp_H_cg}/{cp_zicfilp_lpad_missing_instruction_exception,cp_zicfilp_lpad_label_mismatch,cp_zicfilp_lpad_label_exception_delivery}, Zicfilp_H_cg/cp_vs_trap_delivery (vstval)

mnstatus_mnpelp_op

If the Zicfilp extension is implemented, mnstatus also holds the MNPELP field, which on entry to the RNMI trap handler holds the previous ELP state.

Deferred: Smrnmi (RNMI) is not yet tested

mnstatus_mnpelp_update

When an RNMI trap is taken, MNPELP is set to ELP and ELP is set to 0.

Deferred: Smrnmi (RNMI) is not yet tested

mnret_Zicfilp

If the Zicfilp extension is implemented, then if the new privileged mode is y, MNRET sets ELP to the logical AND of yLPE (see FCFIACT) and mnstatus.MNPELP.

Deferred: Smrnmi (RNMI) is not yet tested

UDB Parameters: None.

B.10.13. Zicfiss Shadow Stack

In Privileged section because it has both unpriv and privileged behaviors. The Zicfiss suite has one group per privilege mode: Zicfiss_U, Zicfiss_S, Zicfiss_Sm and Zicfiss_H. Zicfiss_U holds the instruction-behavior coverpoints, which Zicfiss_S and Zicfiss_H re-run in their own modes; Zicfiss_S and Zicfiss_Sm add the supervisor and machine gating coverpoints. Zicfiss_H covers VS/VU-mode. Zicfiss_U also covers vector accesses to a shadow stack page when Zve32x is implemented. The Zicfiss_Sm tests require Sm, so they are not part of a certificate without Sm, such as RVA23.

No zicfiss setup have been defined yet.

Zicfiss_U User-Mode Shadow Stack

General Test Environment (applies to every coverpoint on this sheet — do not repeat per row): - Zicfiss, Zicsr, Zimop, Zaamo implemented. - Zcmop implemented unless stated (required for C.SSPUSH / C.SSPOPCHK); gate compressed variants with ZCA_SUPPORTED. - S-mode implemented (Zicfiss in U-mode requires it). - Enable chain: menvcfg.SSE=1 and senvcfg.SSE=1 unless the coverpoint states otherwise. - Virtual memory ON (satp.MODE != Bare); shadow stack lives on a page with pte.xwr=010 (R=0,W=1,X=0). - All tests on this sheet execute in U-mode (BOOT_TO_UMODE). - ssp is XLEN-aligned unless the coverpoint states otherwise. No higher-priority exception injected unless stated. - SSPUSH/SSPOPCHK are architecturally defined only for x1 and x5 (C.SSPUSH x1, C.SSPOPCHK x5). - XLEN is NOT iterated inside a coverpoint: RV32 and RV64 are separate build configs.

Table 331. Zicfiss_U Coverpoints
Coverpoint Goal Feature Description Expectation Bins Normative Rule

cp_ssp_access
cp_ssp_low_bits_ro_zero

Verify ssp CSR address, width, access type, and read-only-zero low bits

Standard CSR access idiom on ssp (0x011): read original; write all-ones; write all-zeros; set all bits; clear all bits; write walking-ones; write walking-zeros; restore original. After each write, read back and check.
Bits [1:0] must read back zero regardless of what was written.

CSR address 0x011 decodes to ssp and is URW-accessible from U-mode.
Only XLEN low-order bits are retained; no high CSR exists (ssp is always XLEN wide).
ssp[1:0] read back as 0 after any write. All other writable bits update as written.
ssp[2] is ALSO read-only zero when UXLEN and SXLEN can never be 32, so the test sweeps ssp[2:0] and compares the read-back against the reference model rather than asserting a fixed value.

csr_op {csrrw, csrrs, csrrc, csrrwi, csrrsi, csrrci} x write_pattern {all1, all0, walking1, walking0} x ssp[2:0] readback (vs reference model)

Zicfiss_ssp_csr
Zicfiss_sse_access
ssp_op
ssp_addr
ssp_sz
ssp_field_1_0

cp_sspush

Verify shadow stack push: store to (ssp - XLEN/8), then decrement, for all three push encodings

For each of SSPUSH x1 (mop.rr.7), SSPUSH x5 (mop.rr.7), C.SSPUSH x1 (c.mop.1, requires Zcmop/ZCA_SUPPORTED):
set ssp to a writable XLEN-aligned SS page address, set the link register to a known value, execute the push, then read back ssp and the memory word at (ssp_old - XLEN/8).

No exception on valid execution.
ssp decremented by XLEN/8, and only if the store completed successfully.
Memory at (ssp_old - XLEN/8) holds the pushed link-register value.
Store width is implicitly XLEN and base is implicitly ssp.

instr {SSPUSH x1, SSPUSH x5, C.SSPUSH x1} x pushed_value {all0, all1, pattern} x ssp_delta {-XLEN/8}

ss_page_enc
Zicfiss_enc
Zicfiss_sspush_enc
Zicfiss_c-sspush_enc
ss_push
sspush_c-sspush_instr
sspush_c-sspush_decrement

cp_sspopchk_match

Verify successful shadow stack pop: XLEN load from ssp, value matches link register, ssp increments

For each of SSPOPCHK x1 (mop.r.28), SSPOPCHK x5 (mop.r.28), C.SSPOPCHK x5 (c.mop.5):
preload the SS memory at ssp with a known XLEN value, load the same value into the link register, execute the pop, then check the register, ssp, and that no trap was taken.

Value is loaded from the address in ssp with implicit base=ssp and implicit width=XLEN.
Loaded value matches the link register, so no software-check exception is raised.
ssp_new = ssp_old + XLEN/8, incremented only because the load completed and no software-check was raised.

instr {SSPOPCHK x1, SSPOPCHK x5, C.SSPOPCHK x5} x popped_value {all0, all1, pattern} x ssp_delta {+XLEN/8}

ss_page_enc
Zicfiss_enc
Zicfiss_sspopchk_enc
Zicfiss_c-sspopchk_enc
ss_pop
sspopchk_shadow_return_pop
sspopchk_load_op
sspop_increment

cp_sspopchk_mismatch

Verify software-check exception when the popped value does not match the link register

For each of SSPOPCHK x1, SSPOPCHK x5, C.SSPOPCHK x5: place value A on the shadow stack (directly, or via SSPUSH then corrupt the register, or via SSAMOSWAP to corrupt the memory copy), set the link register to B != A, execute the pop.
Vary how the mismatch is created so both the 'register corrupted' and 'shadow memory corrupted' directions are hit.
Edge cases: also mismatch in exactly one bit — bit 0 and bit XLEN-1 — so a comparator that ignores either end of the word is caught.

Software-check exception raised: cause=18, xtval = shadow stack fault (code=3).
ssp is NOT incremented — it holds its pre-instruction value at the trap.
Link register and shadow stack memory are unmodified.

instr {SSPOPCHK x1, SSPOPCHK x5, C.SSPOPCHK x5} x mismatch_source {reg_corrupted, mem_corrupted_via_ssamoswap} x mismatch_width {whole_word, bit0_only, bitXLEN-1_only} x {cause==18, xtval==3, ssp unchanged}

Zicfiss_sspopchk_enc
Zicfiss_c-sspopchk_enc
ss_pop
sspopchk_shadow_return_pop
sspop_exception
sspop_increment
stval_exception_info

cp_sspopchk_fault_priority

Verify a load/store/AMO access-fault on the pop takes priority over the software-check exception

Point ssp at memory whose access will fault, and simultaneously set the link register so a value mismatch would also be detected. Execute SSPOPCHK.
An UNMAPPED page yields a store/AMO PAGE-fault (15). To get a store/AMO ACCESS-fault (7) the page must be mapped to RVMODEL_ACCESS_FAULT_ADDRESS_STORE, guarded by #ifdef.
PMP-denied regions can only be programmed from M-mode, so that variant lives on the Zicfiss_Sm sheet as cp_sspopchk_fault_priority_pmp.

The memory fault is reported, not the software-check exception.
Unmapped page: store/AMO page-fault (cause=15). RVMODEL_ACCESS_FAULT_ADDRESS_STORE: store/AMO access-fault (cause=7). Either way the fault code is remapped to the store/AMO flavour.
ssp is unchanged.

fault_source {unmapped → cause 15, RVMODEL_ACCESS_FAULT_ADDRESS_STORE → cause 7} x mismatch_also_present {yes} x reported_cause {not 18}

ss_fault_exception_code
sspopchk_load_op
sspop_exception
sspop_increment

Call/return sequence (samples cp_sspush, cp_sspopchk_match and cp_sspopchk_mismatch)

Verify the architectural non-leaf function prologue/epilogue round trip across nested call depth

Build a nested call chain of non-leaf functions. In each prologue: store the link register to the regular stack and SSPUSH it to the shadow stack. In each epilogue: load the link register from the regular stack, SSPOPCHK it against the shadow stack, then return. Exercise x1 and x5 as the link register and depth > 1 so ssp walks several slots.

Matched push/pop pairs at every depth: no exception, control returns correctly through the whole chain.
ssp returns to its original value once the outermost function returns.
A deliberately subverted return address on the regular stack is caught by the epilogue compare (software-check, cause=18, xtval=3).

link_reg {x1, x5} x return_addr {intact, subverted}. Call depth is exercised (1..3) but is not architecturally observable, so it is not a coverage axis.

cp_ssrdp

Verify SSRDP moves ssp into rd, and reads 0 when Zicfiss is inactive

TC group 1: set ssp to a known value V, execute SSRDP rd, check rd == V.
TC group 2: SSPUSH x1, then SSRDP rd; check rd == ssp after the push (i.e. V - XLEN/8). Repeat after SSPOPCHK.
TC group 3: with the extension deactivated for this mode (xSSE=0), execute SSRDP rd.

TC1/TC2: rd holds the current ssp; no exception.
TC3: rd = 0. SSRDP is encoded in mop.r.28, so when Zicfiss is inactive it reverts to Zimop behaviour and writes 0 to rd — this is the documented way software detects whether Zicfiss is active. NO exception is raised.

ssp_value {known V, after push, after pop} x xSSE {1, 0} x rd result {ssp, 0}

Zicfiss_enc
Zicfiss_ssrdp_enc
ssrdp_read

cp_ssamoswap
cp_ssamoswap_aqrl
cp_ssamoswap_reg_edges

Verify SSAMOSWAP.W / SSAMOSWAP.D atomic swap semantics including RV64 sign-extension and narrow store

RV32: SSAMOSWAP.W rd, rs2, (rs1) on a 4-byte-aligned SS address.
RV64: SSAMOSWAP.D rd, rs2, (rs1) on an 8-byte-aligned SS address (full 64-bit swap).
RV64: SSAMOSWAP.W rd, rs2, (rs1) on a 4-byte-aligned SS address, with the loaded word’s MSB = 0 and MSB = 1, and with rs2 carrying non-zero bits in [63:32].
Ordering bits: exercise all four {aq, rl} combinations — 00, 01, 10, 11 — on both widths.
Register edges: rd = x0 and rd != x0; rs2 = x0 and rs2 != x0; and rd == rs1 (the address register is also the destination).

rd receives the value previously in memory; memory receives rs2. The pair is atomic.
RV64 SSAMOSWAP.W: rd is the SIGN-EXTENDED 32-bit loaded value (MSB=1 ⇒ upper 32 bits all ones), and only rs2[31:0] is stored — rs2[63:32] is ignored.
RV32 SSAMOSWAP.W: plain 32-bit swap. No exception on a valid aligned SS address.
aq/rl do not change the architectural result of a single-hart swap, but all four encodings must decode and execute.
rd = x0 discards the loaded value, the memory write still happens. rs2 = x0 stores zero. rd == rs1 must return the loaded value in rd after the address has been consumed.

instr {SSAMOSWAP.W, SSAMOSWAP.D} x xlen_config {RV32, RV64} x loaded_msb {0, 1} x rs2_upper {zero, nonzero} x {aq,rl} {00, 01, 10, 11} x reg_edge {rd=x0, rs2=x0, rd==rs1, all distinct non-x0}

rv32_ssamoswap-w_op
rv64_ssamoswap-w_op

cp_ss_address_alignment_ssp
cp_ss_address_alignment_pop
cp_ss_address_alignment_swap

Verify alignment requirements for SSAMOSWAP (natural alignment) and for ssp (XLEN alignment)

Leg A — SSAMOSWAP: sweep the low 3 bits of the rs1 address across all 8 values for SSAMOSWAP.W (RV32/RV64) and SSAMOSWAP.D (RV64). Compare behaviour against the reference model.
Leg B — ssp: sweep the low 3 bits of ssp across all 8 values and execute SSPUSH x1, C.SSPUSH x1, SSPOPCHK x1, C.SSPOPCHK x5.

Leg A: naturally aligned (W: addr[1:0]==00; D: addr[2:0]==000) completes normally. Otherwise the same exception options as A-extension AMOs apply — reported cause must match the reference model.
Leg B: if ssp is not XLEN-aligned, SSPUSH/C.SSPUSH/SSPOPCHK/C.SSPOPCHK raise a store/AMO access-fault (cause=7). ssp and memory are unchanged.

leg {ssamoswap, ssp} x instr {SSAMOSWAP.W, SSAMOSWAP.D, SSPUSH x1, C.SSPUSH x1, SSPOPCHK x1, C.SSPOPCHK x5} x addr[2:0] {000..111}

ssp_xlen_aligned
ssamoswap_address

cp_ss_instr_target_page
cp_ss_instr_target_page_u_mxr

Verify the fault type an SS instruction takes for every class of target page / translation state

Cross every SS memory instruction against every class of target: SS page (xwr=010), read-only page (xwr=001), read-write page (xwr=011), execute page (xwr=100), unmapped page, and satp.MODE=Bare. Execute and capture the reported cause.
Sweep ALL EIGHT pte.xwr encodings (000, 001, 010, 011, 100, 101, 110, 111), not just the architecturally valid ones — 000 is a pointer rather than a leaf, and 110/111 are reserved.
Cross each with mstatus.MXR = 0 and 1, since MXR is exactly the bit that governs whether an R=0 page is readable and the SS page is R=0 by construction.
Cross each with the page’s U bit = 0 and 1.

SS page: succeeds.
Read-only page (xwr=001): store/AMO PAGE-fault, cause=15.
Any other non-SS, non-read-only page: store/AMO ACCESS-fault, cause=7.
Unmapped: store/AMO page-fault, cause=15. Non-idempotent memory: store/AMO access-fault, cause=7.
satp.MODE=Bare with effective privilege < M: store/AMO access-fault, cause=7.
In every faulting case the cause is remapped to the STORE/AMO flavour regardless of whether the instruction’s original access was a load or a store, and ssp is unchanged.
Reserved PTE encodings (e.g. xwr=110) are invalid to the page walker, so they raise a store/AMO PAGE-fault during translation rather than the access-fault that applies to valid non-SS encodings.
Reserved encodings (110, 111) and the non-leaf encoding (000) fail the walk itself, so they raise a store/AMO PAGE-fault during translation rather than the access-fault that applies to valid non-SS leaf encodings.
U=0 accessed from U-mode, and U=1 accessed from S-mode without SUM, fault on the permission check before any Zicfiss-specific rule applies.

instr {SSPUSH x1, SSPUSH x5, C.SSPUSH x1, SSPOPCHK x1, SSPOPCHK x5, C.SSPOPCHK x5, SSAMOSWAP.W, SSAMOSWAP.D} x pte.xwr {000..111} x MXR {0,1} x pte.U {0,1} x translation {Sv, satp.MODE=Bare} x cause {none, 7, 15}

ss_fault_exception_code
ssmp_ss_page_illegal_access
ssmp_ss_read_only_page

cp_ss_page_access_store
cp_ss_page_access_load
cp_ss_page_access_amo
cp_ss_page_access_cbo
cp_ss_page_access_cboz
cp_ss_page_access_lrsc
cp_ss_page_access_amocas
cp_ss_vector_load
cp_ss_vector_store
cp_ss_vector_strided
cp_ss_vector_indexed

Verify which accessor types may touch an SS page and which fault

With a page mapped as an SS page (xwr=010), attempt access from every accessor class:
(a) SS store instructions: SSPUSH x1/x5, C.SSPUSH x1, SSAMOSWAP.W/.D
(b) ordinary stores: SB, SH, SW, SD
(c) ordinary AMOs: AMOSWAP, AMOADD, …​
(d) cache-block ops: CBO.ZERO, CBO.CLEAN, CBO.FLUSH, CBO.INVAL
(e) ordinary loads: LB, LH, LW, LD
Precondition for leg (d): menvcfg/senvcfg CBIE, CBCFE and CBZE must be enabled, otherwise the cache-block op traps on its own gating instead of on the SS page.
Instruction fetch from the SS page is cp_ss_page_fetch. An implicit page-table walk through an SS page is not tested.
Additional accessor classes:
(f) LR/SC to the SS page (requires Zalrsc).
(g) AMOCAS to the SS page (requires Zacas).
(h) if V is implemented, vector loads and stores to the SS page, including strided and indexed accesses that BEGIN on a different page and run into the SS page.
Leg (e), the ordinary-load leg, is additionally crossed with mstatus.MXR = 0 and 1: the SS page is R=0, so MXR is what decides whether a plain load may read it.

(a) succeeds — these are the only instructions permitted to write an SS page.
(b),(c),(d) store/AMO access-fault (cause=7), NOT a page-fault.
(e) succeeds — the shadow stack is readable by any instruction that only loads.
(f),(g) store/AMO access-fault — LR/SC and AMOCAS are not in the set permitted to write an SS page.
(h) vector stores fault; vector loads follow the ordinary-load rule. An access that starts on an adjacent page must still fault on the element that lands in the SS page.
(e) the ordinary load succeeds for BOTH MXR values — the shadow stack is readable by any instruction that only loads, so this must not depend on MXR.

accessor {ss_store, ordinary_store, ordinary_amo, lr_sc, amocas, cbo, ordinary_load, vector_load, vector_store} x MXR {0,1} x result {ok, af}

ssmp_ss_page_access_fault
ssmp_ss_load
ssmp_ss_cache_block_access_fault

cp_ss_page_fetch

Verify an instruction fetch from an SS page raises an instruction access fault

From U-mode with Zicfiss active, jump (jalr) to the shadow stack page (xwr=010, U=1).

Implicit accesses, including instruction fetches, to an SS page are not permitted and raise the access fault for the access type [norm:ssmp_ss_implicit_access_fault]: an instruction access fault (scause=1), with stval = the target address.
Not an instruction page fault: treating the SS page as X=0 is wrong.

priv_mode {U} x jalr x target {SS page} x scause {1}

ssmp_ss_implicit_access_fault

cp_ssp_csr_gating_u

Verify ssp CSR accessibility from U-mode across the menvcfg.SSE / senvcfg.SSE enable chain

From U-mode, attempt both a read and a write of ssp for each reachable (menvcfg.SSE, senvcfg.SSE) combination: (1,1), (1,0) and (0,0). (0,1) is the same state as (0,0), because menvcfg.SSE=0 makes senvcfg.SSE read-only zero.
Also exercise the toggle direction: enable, use the shadow stack, then clear senvcfg.SSE and re-attempt the ssp access.

(menvcfg.SSE=1, senvcfg.SSE=1): access allowed, correct value read/written.
(menvcfg.SSE=0, *): illegal-instruction exception — menvcfg gating wins regardless of senvcfg.
(menvcfg.SSE=1, senvcfg.SSE=0): illegal-instruction exception.
Toggling SSE off does not corrupt shadow stack memory or the retained ssp value.
(menvcfg.SSE=0, senvcfg.SSE=1) is architecturally UNREACHABLE: menvcfg.SSE=0 forces senvcfg.SSE read-only zero. The test still attempts it and the coverpoint marks it illegal_bins, so an implementation that allows the combination is flagged.

menvcfg.SSE {0,1} x senvcfg.SSE {0,1} (m0s1 illegal/unreachable) x csr_op {read, write} x result {ok, illegal_instruction}

senvcfg_sse_Zicfiss
Zicfiss_m_menvcfg_sse
Zicfiss_ssp_csr
Zicfiss_u_senvcfg_sse

cp_ss_instr_inactive_u

Verify MOP-encoded SS instructions revert to Zimop/Zcmop no-op behaviour when Zicfiss is not active

SCOPE: the MOP-encoded instructions only — SSPUSH x1, SSPUSH x5, C.SSPUSH x1, SSPOPCHK x1, SSPOPCHK x5, C.SSPOPCHK x5, SSRDP. SSAMOSWAP is NOT in this set: it is AMO-encoded and traps instead (see cp_ssamoswap_sse_gating).
Deactivate from both directions: menvcfg.SSE=0 (32-bit revert to Zimop, 16-bit to Zcmop), and menvcfg.SSE=1 with senvcfg.SSE=0. Preload ssp and the shadow stack memory and check both after.
STRONG FORM: repeat every instruction with a HOSTILE ssp — misaligned, pointing at an unmapped page, and pointing at memory whose value would mismatch the link register. A no-op must remain a no-op in all three cases.
Sweep all four {menvcfg.SSE, senvcfg.SSE} combinations. Note (menvcfg=0, senvcfg=1) is unreachable because menvcfg.SSE=0 forces senvcfg.SSE read-only zero; it is attempted anyway.

NO exception is raised — these revert to their Zimop/Zcmop-defined behaviour, which writes 0 to rd and has no other architectural effect.
ssp unchanged. Shadow stack memory unchanged. SSRDP rd = 0.
This is the compatibility guarantee: a Zicfiss-built program still runs, just without backward-edge CFI.
The hostile-ssp variants are the real proof of the guarantee: an implementation that still performs the access and discards the result passes the benign case but fails these. No exception of any kind, no memory access, ssp unchanged, rd unchanged except SSRDP writing 0.

instr {SSPUSH x1, SSPUSH x5, C.SSPUSH x1, SSPOPCHK x1, SSPOPCHK x5, C.SSPOPCHK x5, SSRDP} x gate {menvcfg.SSE, senvcfg.SSE} = {00, 10, 11} x ssp_state {valid, misaligned, unmapped, value_mismatch} x {no trap, no memory access, ssp unchanged, rd==0 for SSRDP}

senvcfg_sse_Zicfiss
menvcfg_sse_op_lead_in
menvcfg_sse_op_list
Zicfiss_enc

cp_ss_unused_mop_rr7_rs2
cp_ss_unused_mop_rr7_rs1
cp_ss_unused_mop_rr7_rd
cp_ss_unused_mop_r28_rs1
cp_ss_unused_mop_r28_rd
cp_ss_unused_mop_c

Verify the mop.rr.7, mop.r.28 and c.mop.n encodings that Zicfiss does not use stay Zimop/Zcmop while Zicfiss is active

With Zicfiss active (menvcfg.SSE=1, and senvcfg.SSE=1 for U-mode), ssp at the top of an SS page, execute the encodings Zicfiss does not use.
Sweep each register field over x0-x31, holding the others fixed, and skip the Zicfiss instructions:
mop.rr.7: rs2 (rd=rs1=x0), rs1 (rd=x0, rs2=x1), rd (rs1=x0, rs2=x1). SSPUSH is rd=rs1=x0 with rs2=x1/x5.
mop.r.28: rs1 (rd=x0), rd (rs1=x1). SSPOPCHK is rd=x0 with rs1=x1/x5. SSRDP is rs1=x0.
c.mop.3 and c.mop.7 (with Zcmop). c.mop.1 and c.mop.5 are C.SSPUSH x1 and C.SSPOPCHK x5.
Preload rd with a nonzero value (a framework register is saved and restored). Record rd, ssp and the word below ssp afterwards.

NO exception. rd is written with 0 (unchanged when rd=x0 or for c.mop). ssp is unchanged. Nothing is pushed or checked.
An implementation that decodes SSPUSH, SSPOPCHK or SSRDP too loosely, for example ignoring rd or one rs field, fails here.

field {rd, rs1, rs2} x register {x0..x31, minus the Zicfiss instructions}; c.mop {3, 7} x {no trap, no memory access, ssp unchanged, rd==0 when rd!=x0}

cp_ss_page_access_store_misaligned

Verify an ordinary store to an SS page raises a store/AMO access-fault at every address alignment

With a page mapped as an SS page (xwr=010), execute SB, SH, SW and SD (RV64) at effective address bits [2:0] = 0..7. Most of these are misaligned.
Check memory is unchanged and record the trap.

Every store raises a store/AMO access-fault (cause=7), including the misaligned ones: the SS page rule takes priority over address-misaligned.
If the implementation gives address-misaligned exceptions higher priority (MISALIGNED_LDST_EXCEPTION_PRIORITY), the result follows the reference model.
Memory on the SS page is unchanged.

store {SB, SH, SW, SD} x addr[2:0] {0..7} x pte.xwr {010}

ssmp_ss_page_access_fault

cp_ssamoswap_sse_gating

Verify SSAMOSWAP.W/D raises an illegal-instruction exception when the SSE enable chain is off (V=0)

SSAMOSWAP is encoded in the AMO major opcode, NOT in the Zimop/Zcmop MOP space, so it does not silently no-op when Zicfiss is deactivated — it traps. Execute SSAMOSWAP.W and SSAMOSWAP.D against a valid aligned SS address for:
(a) menvcfg.SSE=0, from U-mode;
(b) menvcfg.SSE=1, senvcfg.SSE=0, from U-mode.
The S-mode case is cp_ssamoswap_sse_gating_s on Zicfiss_S.
Positive control: both set — the instruction completes (see cp_ssamoswap).

(a), (b) illegal-instruction exception.
Memory, rd and ssp unchanged.
Contrast with cp_ss_instr_inactive_u: the MOP-encoded SS instructions no-op under exactly these conditions, while SSAMOSWAP traps.

instr {SSAMOSWAP.W, SSAMOSWAP.D} x gate {menvcfg.SSE=0, (menvcfg.SSE=1 & senvcfg.SSE=0)} x mode {U} x result {illegal_instruction}

senvcfg_sse_Zicfiss
menvcfg_sse_op_list

cp_ss_page_crossing

Verify shadow stack accesses that straddle a page boundary fault on the invalid side

SSPUSH decrements ssp BEFORE storing, so a push with ssp at the very bottom of a page writes into the PRECEDING page. SSPOPCHK reads at ssp and then increments, so it reads from the page ssp is already on.
Case A: ssp = base of a valid SS page, so ssp-XLEN/8 lies on a page that is NOT a valid shadow stack page (unmapped, or mapped with a non-SS encoding). Execute SSPUSH x1 / C.SSPUSH x1.
Case B: ssp points at a page that is NOT a valid shadow stack page while ssp-XLEN/8 IS on a valid SS page. Execute SSPUSH (should succeed, it writes to the valid side) and SSPOPCHK (should fault, it reads the invalid side).
Repeat both cases with the adjacent page unmapped, mapped read-only, and mapped read/write.

The fault is determined by the page actually accessed, not by the page ssp names.
Case A: SSPUSH faults on the preceding page — store/AMO access-fault (cause=7) for a non-SS valid encoding, store/AMO page-fault (cause=15) if unmapped or read-only. ssp is NOT decremented, since the decrement is conditional on the store completing.
Case B: SSPUSH succeeds and ssp is decremented onto the valid page; the subsequent SSPOPCHK reads the invalid side and faults, leaving ssp unchanged.
In every faulting case the cause carries the store/AMO flavour.

case {A: ssp at page base, B: ssp on invalid page} x instr {SSPUSH x1, C.SSPUSH x1, SSPOPCHK x1, C.SSPOPCHK x5} x adjacent_page {unmapped, read_only, read_write} x cause {none, 7, 15} x ssp {unchanged, decremented}

ss_push
sspush_c-sspush_instr
sspush_c-sspush_decrement
ss_pop
sspopchk_load_op

cp_ss_page_ad_bits

Verify PTE Accessed/Dirty bit handling on a shadow stack page, including the write/read asymmetry

Sweep all four {A, D} combinations on the shadow stack page’s leaf PTE and execute each SS instruction against it.
The write-vs-read asymmetry is the point: SSPUSH, C.SSPUSH and SSAMOSWAP write the page and so require D=1, while SSPOPCHK and C.SSPOPCHK only read and so do not.
If Svadu is implemented, repeat with hardware A/D updating enabled (menvcfg.ADUE=1).

A=0: every SS access faults, read or write, because the page has not been marked accessed.
D=0: SSPUSH / C.SSPUSH / SSAMOSWAP fault (they write); SSPOPCHK / C.SSPOPCHK succeed (they only read).
A=1, D=1: all SS instructions succeed.
Faults carry the store/AMO flavour per the SS fault-code remapping.
With Svadu implemented and ADUE=1 the hardware sets A and D itself, so NO fault occurs in any of the above combinations and the PTE is observed updated afterwards.

instr {SSPUSH x1, C.SSPUSH x1, SSAMOSWAP.W, SSAMOSWAP.D, SSPOPCHK x1, C.SSPOPCHK x5} x {A,D} {00, 01, 10, 11} x svadu {absent, ADUE=0, ADUE=1} x cause {none, 7, 15}

cp_ss_non_idempotent

Verify SS instructions fault when the shadow stack page is non-idempotent (Svpbmt)

Requires Svpbmt. Map the shadow stack page with pte.PBMT = IO, which makes the memory non-idempotent, and execute each SS instruction that accesses memory against it.
Positive control: the same page mapped with PBMT = PMA (or NC) behaves normally.
Guard the whole coverpoint with #ifdef SVPBMT_SUPPORTED — without Svpbmt there is no portable way to identify a non-idempotent location, and the rule is then untestable rather than failing.

Every SS instruction that accesses non-idempotent memory raises a store/AMO access-fault (cause=7).
The reason is restartability: SSPOPCHK performs a load and then a comparison, and if the comparison faults and the handler restarts the instruction the load runs twice — which is unsafe on non-idempotent memory.
Positive control with PBMT=PMA: no fault.

instr {SSPUSH x1, C.SSPUSH x1, SSPOPCHK x1, C.SSPOPCHK x5, SSAMOSWAP.W, SSAMOSWAP.D} x pte.PBMT {PMA, NC, IO} x cause {none, 7}

ssmp_ss_idempotent_memory

Folded into cp_ss_instr_inactive_u (gate sweep) and cp_ssamoswap_sse_gating (the trapping half). Other privilege modes are the corresponding rows on the Zicfiss_S / Zicfiss_Sm / Zicfiss_H sheets.

Test all Zifiss instructions with each combination of {menvcfg.SSE/senvcfg.SSE} = 0, 1 in every priv mode. Check all state is unaffected if xSSE=0. Some throw illegal or virtual instructions

PROMOTED to its own coverpoint: cp_ss_page_crossing.

Test ssp pointing to the bottom of a page such that ssp-XLEN/8 is not on a valid shadow stack page, and also such that ssp is not on a valid shadow stack pages but ssp-XLEN/8 is valid.

Folded into cp_ss_instr_target_page: pte.xwr now sweeps all 8 encodings and is crossed with MXR = 0/1.

For cp_ss_instr_target_page, test all 8 XWR with MXR=0/1.

Folded into cp_ssamoswap: {aq,rl} = 00/01/10/11 added as a bin axis.

Exercise all 4 values of aq and rl in SSAMOSWP.

Folded into cp_ss_page_access as accessor leg (h), including strided/indexed accesses beginning on an adjacent page.

If V supported, try V accesses to SS page, including scattered loads and stores starting on a different page.

Folded into cp_ss_page_access as accessor legs (f) and (g). Needs Zalrsc and Zacas in the suite’s required_extensions.

LRSC and AMOCAS to SS page.

Folded into cp_ss_instr_target_page as a pte.U = 0/1 axis.

Test U bit of shadow stack page = 0/1

Folded into cp_ss_instr_inactive_u, and cp_ss_instr_inactive_m/_s on Zicfiss_Sm, as the STRONG FORM: the same instructions repeated with a misaligned, unmapped, or mismatching ssp.

When xSSE, SSPUSH/SSPOPCHK must do no memory access and raise nothing even if ssp is misaligned, unmapped, or values mismatch.

PROMOTED to its own coverpoint: cp_ss_page_ad_bits, including the Svadu/ADUE variant.

Test all combinations of A and D bits on the SS page, that fault occurs if D=0 for SSPUSH/SSAMOSWAP but not SSPOPCHK, if A=0 for all accesses. If Svadu supported, check no faults.

PROMOTED to its own coverpoint: cp_ss_non_idempotent. This also restores [norm:ssmp_ss_idempotent_memory], which had been written off as untestable.

If Svpbmt is supported, test a page mapped to I/O that makes it non-idempotent and thus fault on SS instructions.

Folded into cp_ss_page_access: the ordinary-load leg (e) is now crossed with MXR = 0/1 and must succeed for both.

Test ordinary load from SS page succeeds even though R=0, for both MXR=0/1.

Folded into cp_ssamoswap as a register-edge axis: rd=x0, rs2=x0, rd==rs1, and all-distinct.

Consider testing SSAMOSWAP with rd, rs2 = x0/non x0 and rd==rs1 edges.

Zicfiss_S Supervisor-Mode Shadow Stack

General Test Environment (S/HS-mode execution): - Same base environment as Zicfiss_U, but tests execute in S/HS-mode. menvcfg.SSE alone gates S/HS; senvcfg.SSE does NOT gate S/HS. - S-mode counterparts of the Zicfiss_U instruction-behaviour coverpoints (listed in the bookkeeping row below) run from S-mode; they are not duplicated as rows here. Only S-specific control behaviour is listed below.

Table 332. Zicfiss_S Coverpoints
Coverpoint Goal Feature Description Expectation Bins Normative Rule

cp_ssp_csr_gating_s

Verify ssp CSR accessibility from S/HS-mode depends only on menvcfg.SSE, not senvcfg.SSE

From S/HS-mode attempt ssp read and write for each combination of (menvcfg.SSE, senvcfg.SSE).
senvcfg.SSE is deliberately swept to prove it has no effect at S/HS level.

menvcfg.SSE=1: access allowed from S/HS for BOTH values of senvcfg.SSE — senvcfg.SSE gates U-mode only.
menvcfg.SSE=0: illegal-instruction exception.

menvcfg.SSE {0,1} x senvcfg.SSE {0,1} x csr_op {read, write} x result {ok, illegal_instruction}

menvcfg_sse_op_lead_in
Zicfiss_m_menvcfg_sse
Zicfiss_ssp_csr
Zicfiss_sse_access

cp_ssamoswap_sse_gating_s

Verify SSAMOSWAP from S/HS-mode is illegal only when menvcfg.SSE=0, whatever senvcfg.SSE is

From S/HS-mode, execute SSAMOSWAP.W and SSAMOSWAP.D (RV64) against the shadow stack page for each combination of (menvcfg.SSE, senvcfg.SSE).
senvcfg.SSE is swept to show that it has no effect at S/HS. The U-mode version, cp_ssamoswap_sse_gating, cannot show this, because senvcfg.SSE gates U-mode too.

menvcfg.SSE=0: illegal-instruction exception; rd and memory are unchanged.
menvcfg.SSE=1: the swap is performed for both values of senvcfg.SSE.

priv_mode {S} x instr {SSAMOSWAP.W, SSAMOSWAP.D} x (menvcfg.SSE, senvcfg.SSE) {(0,0), (1,0), (1,1)}

menvcfg_sse_op_list

cp_ss_page_enc
cp_ss_page_enc_load
cp_ss_page_enc_store

Verify the pte.xwr=010 encoding is recognised as an SS page, and is reserved when SSE is off

With menvcfg.SSE=1 build a PTE with R=0, W=1, X=0 and use it as a shadow stack from S-mode (SSPUSH, plus ordinary loads and stores).
Repeat with menvcfg.SSE=0. The U-mode accesses, including senvcfg.SSE=0, are cp_menvcfg_sse_ss_page on Zicfiss_Sm.

menvcfg.SSE=1: the page is a valid SS page. SS stores succeed, ordinary loads succeed, no exception.
menvcfg.SSE=0: the encoding is reserved, so the PTE is invalid and access raises a page-fault.

menvcfg.SSE {0,1} x mode {S} x access {ss_store, ordinary_load, ordinary_store} x result {ok, access_fault, page_fault}

ss_page_enc
ssmp_menvcfg_sse
menvcfg_sse_op_list
ssmp_ss_load
ssmp_ss_page_access_fault

cp_ss_page_perm_priority
cp_ss_page_perm_priority_load
cp_ss_page_perm_priority_store

Verify U, SUM and MXR permission checks on a shadow stack page, and that they outrank the SS access-fault rule

The shadow stack page is R=0 and may be U=0 or U=1, so the ordinary permission machinery and the Zicfiss-specific rules can both apply to the same access. This coverpoint establishes which wins.
Sweep, from S/HS-mode, the shadow stack page’s U bit = 0/1 against sstatus.SUM = 0/1 and sstatus.MXR = 0/1, for:
(a) every SS instruction that accesses memory (SSPUSH, C.SSPUSH, SSPOPCHK, C.SSPOPCHK, SSAMOSWAP.W/D);
(b) an ordinary load from the same page, which is permitted by the shadow stack rules but still subject to U/SUM/MXR;
(c) an ordinary store, which the shadow stack rules forbid regardless.
Include the case where the permission check and the SS rule would produce DIFFERENT causes, so the priority is observable rather than coincidental.

The U/SUM/MXR permission check is part of address translation and therefore resolves BEFORE any Zicfiss-specific rule. Where the two disagree, the translation fault is reported:
U=1, SUM=0, access from S-mode → page-fault from the U/SUM check, NOT the SS store/AMO access-fault, even for an instruction the SS rules would also have rejected.
U=0, access from S-mode → permitted by U/SUM; the SS rules then apply normally.
MXR governs whether the R=0 shadow stack page is readable by an ordinary load. Per [norm:ssmp_ss_load] the shadow stack is readable by any load-only instruction, so this must hold for BOTH MXR values — an implementation that requires MXR=1 to read an SS page is wrong.
SS instructions themselves are unaffected by MXR: their access is a store/AMO-flavoured access, not a load.

pte.U {0,1} x sstatus.SUM {0,1} x sstatus.MXR {0,1} x accessor {SS instr, ordinary load, ordinary store} x cause {none, page-fault from U/SUM, 7, 15} x priority {translation check wins}

cp_ss_unused_mop_rr7_rs2_s
cp_ss_unused_mop_rr7_rs1_s
cp_ss_unused_mop_rr7_rd_s
cp_ss_unused_mop_r28_rs1_s
cp_ss_unused_mop_r28_rd_s
cp_ss_unused_mop_c_s

Verify the mop.rr.7, mop.r.28 and c.mop.n encodings that Zicfiss does not use stay Zimop/Zcmop while Zicfiss is active

With Zicfiss active (menvcfg.SSE=1), ssp at the top of an SS page, execute the encodings Zicfiss does not use.
Sweep each register field over x0-x31, holding the others fixed, and skip the Zicfiss instructions:
mop.rr.7: rs2 (rd=rs1=x0), rs1 (rd=x0, rs2=x1), rd (rs1=x0, rs2=x1). SSPUSH is rd=rs1=x0 with rs2=x1/x5.
mop.r.28: rs1 (rd=x0), rd (rs1=x1). SSPOPCHK is rd=x0 with rs1=x1/x5. SSRDP is rs1=x0.
c.mop.3 and c.mop.7 (with Zcmop). c.mop.1 and c.mop.5 are C.SSPUSH x1 and C.SSPOPCHK x5.
Preload rd with a nonzero value (a framework register is saved and restored). Record rd, ssp and the word below ssp afterwards.

NO exception. rd is written with 0 (unchanged when rd=x0 or for c.mop). ssp is unchanged. Nothing is pushed or checked.
An implementation that decodes SSPUSH, SSPOPCHK or SSRDP too loosely, for example ignoring rd or one rs field, fails here.

field {rd, rs1, rs2} x register {x0..x31, minus the Zicfiss instructions}; c.mop {3, 7} x {no trap, no memory access, ssp unchanged, rd==0 when rd!=x0}

cp_ss_page_access_store_misaligned_s

Verify an ordinary store to an SS page raises a store/AMO access-fault at every address alignment

With a page mapped as an SS page (xwr=010), execute SB, SH, SW and SD (RV64) at effective address bits [2:0] = 0..7. Most of these are misaligned.
Check memory is unchanged and record the trap.

Every store raises a store/AMO access-fault (cause=7), including the misaligned ones: the SS page rule takes priority over address-misaligned.
If the implementation gives address-misaligned exceptions higher priority (MISALIGNED_LDST_EXCEPTION_PRIORITY), the result follows the reference model.
Memory on the SS page is unchanged.

store {SB, SH, SW, SD} x addr[2:0] {0..7} x pte.xwr {010}

ssmp_ss_page_access_fault

cp_senvcfg_sse_rdonly0_s

Verify senvcfg.SSE reads back 0 from S-mode whenever menvcfg.SSE is 0

Direct observation of the read-only-zero rule from the mode that owns senvcfg, rather than inferring it from an ssp access.
From M-mode set menvcfg.SSE=0. Drop to S-mode and attempt to write senvcfg.SSE=1 using csrw, csrs and csrrw, reading the CSR back after each write.
Repeat the same sequence with menvcfg.SSE=1 as the positive control.
This is the S-mode counterpart of cp_envcfg_sse_rdonly0_senvcfg on the Zicfiss_Sm sheet, which drives the same field from M-mode.

menvcfg.SSE=0: senvcfg.SSE reads back 0 after every write attempt. No exception is raised — SSE is a WARL field, so the write is discarded rather than rejected.
menvcfg.SSE=1: senvcfg.SSE is writable and reads back what was written.
This is what makes the (menvcfg.SSE=0, senvcfg.SSE=1) combination architecturally unreachable wherever it appears as a bin on this sheet or on Zicfiss_U.

menvcfg.SSE {0,1} x csr_op {csrw, csrs, csrrw} x written {0,1} x senvcfg.SSE readback {0 when menvcfg.SSE=0, written when menvcfg.SSE=1}

menvcfg_sse_rdonly0

cp_ss_non_idempotent_s

Verify S-mode SS instructions fault when the shadow stack page is non-idempotent (Svpbmt), across menvcfg.PBMTE

The S-mode counterpart of cp_ss_non_idempotent, with menvcfg.PBMTE added as an axis. Requires Svpbmt (RV64 only).
From S-mode with menvcfg.SSE=1, map the shadow stack page (xwr=010, supervisor) with pte.PBMT = PMA, NC and IO in turn, for menvcfg.PBMTE = 1 and then 0, and execute each SS instruction that accesses memory against it: SSPUSH x1/x5, C.SSPUSH x1, SSPOPCHK x1/x5, C.SSPOPCHK x5, SSAMOSWAP.W and SSAMOSWAP.D (RV64).
SSAMOSWAP is not executed on an NC page while PBMTE=1: an implementation may also override the AMO PMA of an NC page ([norm:Svpbmt_impl_may_override_pmas]), so its outcome is implementation-defined and no UDB parameter yet says which behavior a DUT has. Those two bins are a known coverage gap.

PBMTE=1, PBMT=IO: the memory is non-idempotent, so every SS instruction raises a store/AMO access-fault (cause=7) with stval = the faulting VA (ssp-XLEN/8 for a push, ssp for a pop, rs1 for SSAMOSWAP). ssp, rd and memory are unchanged.
PBMTE=1, PBMT=NC or PMA: the memory is idempotent, so the access is performed. A push stores and decrements ssp, a pop loads and compares, and SSAMOSWAP swaps.
PBMTE=0, PBMT=NC or IO: the implementation behaves as though Svpbmt were not implemented ([norm:menvcfg_pbmte_op]), so a nonzero PBMT is reserved and the walk raises a store/AMO page-fault (cause=15) before any memory-type check.
PBMTE=0, PBMT=PMA: the access is performed, as for PBMTE=1.

priv_mode {S} x instr {SSPUSH x1, SSPUSH x5, C.SSPUSH x1, SSPOPCHK x1, SSPOPCHK x5, C.SSPOPCHK x5, SSAMOSWAP.W, SSAMOSWAP.D} x pte.PBMT {PMA, NC, IO} x menvcfg.PBMTE {0, 1}

ssmp_ss_idempotent_memory

cp_sspush_s
cp_sspopchk_match_s
cp_sspopchk_mismatch_s
cp_sspopchk_fault_priority_s
cp_ssrdp_s
cp_ssamoswap_s
cp_ss_address_alignment_ssp_s
cp_ss_address_alignment_pop_s
cp_ss_address_alignment_swap_s
cp_ss_instr_target_page_s

Re-run the Zicfiss_U coverpoints with the hart booted in S-mode instead of U-mode

BOOKKEEPING ROW, not a new coverpoint. These 8 Zicfiss_U coverpoints are re-run from S-mode, sampled into Zicfiss_S_cg under the S-mode name in parentheses:
cp_sspush (cp_sspush_s)
cp_sspopchk_match (cp_sspopchk_match_s)
cp_sspopchk_mismatch (cp_sspopchk_mismatch_s)
cp_sspopchk_fault_priority (cp_sspopchk_fault_priority_s)
cp_ssrdp (cp_ssrdp_s)
cp_ssamoswap (cp_ssamoswap_s)
cp_ss_address_alignment (cp_ss_address_alignment_ssp_s, cp_ss_address_alignment_pop_s, cp_ss_address_alignment_swap_s)
cp_ss_instr_target_page (cp_ss_instr_target_page_s)
Mode-specific versions elsewhere: cp_ssp_csr_gating_u and cp_ssamoswap_sse_gating are replaced by cp_ssp_csr_gating_s and cp_ssamoswap_sse_gating_s on this sheet, because senvcfg.SSE gates U-mode only; cp_ss_non_idempotent by cp_ss_non_idempotent_s. The S-mode version of cp_ss_instr_inactive_u is cp_ss_instr_inactive_s on Zicfiss_Sm.
NOT re-run from S-mode, because their behaviour does not depend on S vs U and Zicfiss_U covers it: cp_ssp_access, the call/return sequence, cp_ss_page_access, cp_ss_page_crossing, cp_ss_page_ad_bits.
Two S-mode differences apply to every re-run: the enable chain is menvcfg.SSE alone (senvcfg.SSE does not gate S/HS), and the identity map carries no PTE_U, so the S-mode trap handler can fetch and traps may be delegated normally.

Identical architectural results to the U-mode runs — SS instruction behaviour does not depend on S vs U, only the enable chain does.
The exceptions are the coverpoints whose expectation is itself mode-dependent: the gating rows, and cp_ss_page_perm_priority on this sheet, where SUM only exists at S-mode.

priv_mode {s} x (all bins of each reused coverpoint)

Zicfiss_sspush_enc
Zicfiss_c-sspush_enc
ss_push
sspush_c-sspush_instr
sspush_c-sspush_decrement
Zicfiss_sspopchk_enc
Zicfiss_c-sspopchk_enc
ss_pop
sspopchk_shadow_return_pop
sspopchk_load_op
sspop_increment
sspop_exception
stval_exception_info
Zicfiss_ssrdp_enc
ssrdp_read
rv32_ssamoswap-w_op
rv64_ssamoswap-w_op
ssp_xlen_aligned
ssamoswap_address
ssmp_ss_page_illegal_access
ssmp_ss_read_only_page

PROMOTED to its own coverpoint: cp_ss_page_perm_priority, including the explicit priority claim that the translation-level U/SUM/MXR check resolves before any Zicfiss-specific rule.

Test U, SUM, MXR bits of shadow stack page, including that these have priority over the SS access fault rule.

PROMOTED to its own coverpoint: cp_senvcfg_sse_rdonly0_s — writes senvcfg.SSE from S-mode and reads back 0 while menvcfg.SSE=0. The M-mode counterpart is cp_envcfg_sse_rdonly0_senvcfg on Zicfiss_Sm.

Write m0s1 to xenvcfg.SSE and read back and make sure s shows up 0.

Zicfiss_Sm Machine-Mode Shadow Stack
Table 333. Zicfiss_Sm Coverpoints
Coverpoint Goal Feature Description Expectation Bins Normative Rule

General Test Environment (M-mode control plane):
- Same base environment as Zicfiss_U. These coverpoints execute in M-mode or manipulate M-mode state (menvcfg) before dropping to a lower mode.
- Use of Zicfiss in M-mode is not supported; M-mode coverpoints here test the gating and the M-mode SSAMOSWAP fault.

cp_ssamoswap_mmode_fault

Verify SSAMOSWAP.W/.D always raises a store/AMO access-fault when the effective privilege mode is M

Execute SSAMOSWAP.W and SSAMOSWAP.D from M-mode against a valid, aligned, writable SS page. Repeat with menvcfg.SSE=1 and menvcfg.SSE=0, and with satp.MODE both Bare and non-Bare, to confirm the fault is unconditional.
Repeat each with mstatus.MPRV=1 and MPP=M, where the effective privilege mode is still M.

Store/AMO access-fault raised whenever the EFFECTIVE privilege mode is M, independent of menvcfg.SSE, satp.MODE and MPRV with MPP=M.
With MPRV=1 and MPP < M the effective privilege mode is no longer M, so this rule does not apply; see cp_ssamoswap_mprv_s and cp_ssamoswap_mprv_non_idempotent.
Memory and rd are unchanged.

instr {SSAMOSWAP.W, SSAMOSWAP.D} x menvcfg.SSE {0,1} x satp.MODE {Bare, Sv} x {MPRV=0, MPRV=1 with MPP=M}

ssmp_ssamoswap

cp_ssamoswap_mprv_s

Verify SSAMOSWAP from M-mode with MPRV=1, MPP=S follows the S-mode rules, with and without translation

With menvcfg.SSE=1, set mstatus.MPRV=1 and MPP=S in M-mode and execute SSAMOSWAP.W and SSAMOSWAP.D (RV64):
(a) with satp.MODE=Bare, against the physical address of the shadow stack page;
(b) with Sv39/Sv32 on, against the S-mode shadow stack page (xwr=010, supervisor).
Does not need Svpbmt, so it also runs on RV32. MPRV is cleared straight after each swap, before any other memory access.

The effective privilege mode is S, so [norm:ssmp_ssamoswap] does not apply and SSAMOSWAP is not gated by xSSE (the hart is in M-mode).
(a) satp.MODE=Bare with an effective privilege mode below M: store/AMO access-fault (cause=7) [norm:satp_mode_bare]. rd and memory are unchanged.
(b) the swap is performed: rd receives the old value and memory the new one.

priv_mode {M} x instr {SSAMOSWAP.W, SSAMOSWAP.D} x {mstatus.MPRV=1, MPP=S} x satp.MODE {Bare, Sv}

satp_mode_bare
ssmp_ssamoswap

cp_ssamoswap_mprv_non_idempotent

Verify SSAMOSWAP from M-mode with MPRV=1, MPP=S follows the S-mode non-idempotent memory rule (Svpbmt)

SSAMOSWAP is not gated by xSSE in M-mode, and with mstatus.MPRV=1 and MPP=S its access is translated as an S-mode access, so Svpbmt applies to it although the hart runs in M-mode. Requires Svpbmt (RV64 only).
With menvcfg.SSE=1, menvcfg.PBMTE=1 and Sv39 on, map the shadow stack page (xwr=010, supervisor) with pte.PBMT = PMA and then IO. From M-mode set MPRV=1 and MPP=S and execute SSAMOSWAP.W and SSAMOSWAP.D (RV64) against it.
PBMT=NC is not tested, for the reason given in cp_ss_non_idempotent_s on the Zicfiss_S sheet.
A trap taken in M-mode sets MPP to M, so MPRV and MPP are set again before each swap.

The effective privilege mode is S, so [norm:ssmp_ssamoswap] does not apply and the S-mode shadow stack rules do.
PBMT=PMA: the swap is performed.
PBMT=IO: the memory is non-idempotent, so the swap raises a store/AMO access-fault (cause=7) taken in M-mode, with mtval = the faulting VA. rd and memory are unchanged.

priv_mode {M} x instr {SSAMOSWAP.W, SSAMOSWAP.D} x {mstatus.MPRV=1, MPP=S} x pte.xwr {010} x pte.PBMT {PMA, IO}

ssmp_ss_idempotent_memory

cp_menvcfg_sse_gating
cp_menvcfg_sse_ss_page

Verify menvcfg.SSE is the top of the enable chain for both ssp CSR access and the SS page encoding

From M-mode set menvcfg.SSE=0, then:
(a) drop to S/HS-mode and attempt ssp CSR read and write;
(b) with a PTE encoded xwr=010, attempt an ordinary load and store from S-mode and U-mode.
Repeat both with menvcfg.SSE=1 as the positive control, and repeat (b) with menvcfg.SSE=1 and senvcfg.SSE=0.
Also confirm menvcfg.SSE is writable and reads back as written.
M-mode leg (explicit): read and write ssp from M-mode with menvcfg.SSE=0 and with menvcfg.SSE=1, using csrrw/csrrs/csrrc and the immediate forms.

menvcfg.SSE=0: ssp CSR access from any mode < M raises an illegal-instruction exception, regardless of senvcfg/henvcfg.
menvcfg.SSE=0: the xwr=010 PTE encoding remains RESERVED, so access raises a page-fault rather than being treated as an SS page.
menvcfg.SSE=1: ssp accessible from S/HS, and xwr=010 is recognised as an SS page: an ordinary load reads it and an ordinary store raises a store/AMO access-fault.
menvcfg.SSE=1, senvcfg.SSE=0: xwr=010 is still an SS page, from U-mode too. Only menvcfg.SSE (and henvcfg.SSE when V=1) makes the encoding reserved ([norm:ssmp_menvcfg_sse]); senvcfg.SSE does not. An implementation that page-faults a U-mode load here is wrong.
From M-mode the ssp CSR is accessible for BOTH values of menvcfg.SSE. [norm:Zicfiss_m_menvcfg_sse] is scoped to 'privilege mode less than M', so menvcfg.SSE does not gate M-mode itself. An implementation that raises illegal-instruction on ssp access from M when menvcfg.SSE=0 is wrong.
Note this is CSR accessibility only — use of the Zicfiss shadow stack in M-mode is not supported, and the SS instructions behave as MOPs there (cp_ss_instr_inactive_m).

mode {M, S/HS} x menvcfg.SSE {0,1} x csr_op {csrrw, csrrs, csrrc, csrrwi, csrrsi, csrrci} x target {ssp read, ssp write} x result {ok at M always, ok at S iff menvcfg.SSE=1, illegal_instruction}; mode {S, U} x (menvcfg.SSE, senvcfg.SSE) {(0,0), (1,0), (1,1)} x access {ordinary load, ordinary store} on xwr=010 x result {ok, access_fault, page_fault}

menvcfg_sse_op_lead_in
Zicfiss_m_menvcfg_sse
Zicfiss_ssp_csr
ssmp_menvcfg_sse

cp_envcfg_sse_rdonly0_senvcfg
cp_envcfg_sse_rdonly0_henvcfg

Verify the SSE enable chain forces the lower-level SSE fields to read-only zero

Leg A: from M-mode set menvcfg.SSE=0, then attempt to write 1 to senvcfg.SSE (from S-mode) and to henvcfg.SSE (from HS-mode). Read both back.
Leg B: menvcfg.SSE=1, henvcfg.SSE=0, V=1. Attempt to write 1 to senvcfg.SSE and read back.
Positive control per leg: with the parent field set to 1 the child is writable and reads back 1.
The henvcfg leg (cp_envcfg_sse_rdonly0_henvcfg) is generated and compiled only with H_SUPPORTED, which ACT4 leaves undefined until Sail supports the hypervisor extension.

Leg A: with menvcfg.SSE=0, both henvcfg.SSE and senvcfg.SSE are read-only zero — the write is discarded and the field reads 0. No exception: these are WARL fields, not an illegal access.
Leg B: with henvcfg.SSE=0 and V=1, senvcfg.SSE is read-only zero.
This is what makes the (menvcfg.SSE=0, senvcfg.SSE=1) combination unreachable elsewhere.

parent {menvcfg.SSE, henvcfg.SSE} x child {senvcfg.SSE, henvcfg.SSE} x parent_val {0,1} x written {0,1} x readback {0, written}

menvcfg_sse_rdonly0

cp_ss_pmp_permissions

Verify PMP permission requirements for shadow stack instructions, and that a PMP fault outranks the software-check exception

Reprogram PMP entry 0 to cover the shadow stack page and entry 1 to grant RWX over all memory (the lowest matching entry wins), then drop to S-mode and execute each SS instruction against the page.
Leg A — permission matrix: sweep pmp0cfg R/W over {--, R-, -W, RW} and run SSPUSH, C.SSPUSH, SSPOPCHK, C.SSPOPCHK, SSAMOSWAP.W/D against each.
Leg B — priority: with PMP denying the page, set the link register so the value would ALSO mismatch, then execute SSPOPCHK. Both faults are live and only one may be reported.
Restore the boot-time allow-all PMP configuration afterwards.

Leg A: shadow stack instructions require PMP READ-WRITE permission on the accessed memory. Anything less raises a store/AMO access-fault (cause=7).
The asymmetry worth testing: SSPOPCHK and C.SSPOPCHK only READ, yet they still require PMP W. This is the opposite of the PTE dirty-bit behaviour, where SSPOPCHK does NOT require D (cp_ss_page_ad_bits on Zicfiss_U). An implementation that reuses its PTE logic for the PMP check will get exactly one of these two wrong.
Leg B: the PMP access-fault (cause=7) is reported, NOT the software-check exception (cause=18). ssp is unchanged.
SPEC NOTE: the PMP read-write requirement is stated in priv/cfi.adoc ("The PMP checks are extended to require read-write permission for memory accessed by shadow stack instructions") but carries NO norm: tag, so it cannot be referenced by ID. Raised as an upstream tagging gap.

instr {SSPUSH x1, C.SSPUSH x1, SSPOPCHK x1, C.SSPOPCHK x5, SSAMOSWAP.W, SSAMOSWAP.D} x pmp0cfg {--, R-, -W, RW} x mismatch_also_present {no, yes} x reported_cause {none, 7, not 18}

ss_fault_exception_code
sspop_exception

cp_ss_satp_bare

Verify that SS instructions below M-mode raise a store/AMO access fault when satp.MODE=Bare

From M-mode set satp=0 (Bare), menvcfg.SSE=1 and senvcfg.SSE=1, and point ssp at the SS page. Drop to S-mode, then to U-mode, and in each execute every SS memory instruction: SSPUSH x1, SSPUSH x5, C.SSPUSH x1, SSPOPCHK x1, SSPOPCHK x5, C.SSPOPCHK x5, SSAMOSWAP.W, SSAMOSWAP.D.

Store/AMO access fault (cause=7) for every instruction, including SSPOPCHK, which only reads. ssp unchanged.

2 modes (S, U) x 8 instructions (SSAMOSWAP.D only on RV64) = 16 (14 on RV32)

satp_mode_bare
ss_fault_exception_code

cp_ss_swcheck_mtval

Verify a shadow stack software-check exception taken in M-mode reports the shadow stack fault code in mtval

With menvcfg.SSE=1 and translation on, push a value from S-mode, change the link register and execute SSPOPCHK x1/x5 and C.SSPOPCHK x5. The suite boots to M-mode, so medeleg is zero and the exception is taken in M-mode.

Software-check exception (mcause=18) with mtval = 3 (shadow stack fault), or 0 if the implementation reports no information. ssp unchanged.

priv_mode {S} x instr {SSPOPCHK x1, SSPOPCHK x5, C.SSPOPCHK x5} x mcause {18} x mtval {3 or 0, by UDB parameter}

mtval_swchk_lead_in
mtval_swchk_list

cp_ss_instr_inactive_m
cp_ss_instr_inactive_s

Verify SS instructions act as MOPs, touching no memory and raising nothing, whenever Zicfiss is inactive

The M- and S-mode counterparts of cp_ss_instr_inactive_u on Zicfiss_U: setting up every inactive state requires M-mode writes to menvcfg/senvcfg, and at M-mode the behaviour is unconditional.
SCOPE: the MOP-encoded instructions — SSPUSH x1/x5, C.SSPUSH x1, SSPOPCHK x1/x5, C.SSPOPCHK x5, SSRDP. SSAMOSWAP is NOT in this set: it is AMO-encoded and traps instead (cp_ssamoswap_sse_gating on Zicfiss_U, and the M-mode case in cp_ssamoswap_mmode_fault on this sheet).
Leg A — M-mode, unconditional: use of Zicfiss in M-mode is not supported, so these instructions act as MOPs at M for BOTH values of menvcfg.SSE.
Leg B — lower modes, gated: drive the inactive states from M and execute in S/U — menvcfg.SSE=0, and menvcfg.SSE=1 with senvcfg.SSE=0.
STRONG FORM, applied to both legs: repeat every instruction with a HOSTILE ssp — misaligned, pointing at an unmapped page, and pointing at memory whose value would mismatch the link register.

No exception of ANY kind, and no memory access at all. ssp unchanged, shadow stack memory unchanged, rd unchanged except SSRDP which writes 0.
The hostile-ssp variants are what actually prove it: an implementation that still performs the access and discards the result passes the benign case and fails these. A misaligned or unmapped ssp must NOT fault, and a mismatching value must NOT raise a software check, because no access and no comparison should happen.
SSRDP reading 0 is the documented way software detects whether Zicfiss is active.

leg {M-mode unconditional, lower-mode gated} x instr {SSPUSH x1, SSPUSH x5, C.SSPUSH x1, SSPOPCHK x1, SSPOPCHK x5, C.SSPOPCHK x5, SSRDP} x gate {menvcfg.SSE, senvcfg.SSE} = {00, 10, 11} x ssp_state {valid, misaligned, unmapped, value_mismatch} x {no trap, no memory access, ssp unchanged, rd==0 for SSRDP}

menvcfg_sse_op_lead_in
menvcfg_sse_op_list

Folded into cp_menvcfg_sse_gating: the M-mode leg is now explicit — ssp is accessible from M for BOTH menvcfg.SSE values, since [norm:Zicfiss_m_menvcfg_sse] is scoped to privilege < M.

Verify access to ssp from M-mode with menvcfg.SSE=0/1

The M- and S-mode legs of the inactive-instruction row live here as cp_ss_instr_inactive_m and cp_ss_instr_inactive_s (Zicfiss_U keeps cp_ss_instr_inactive_u), with an M-mode unconditional leg added and the hostile-ssp strong form applied to both legs.

SSPUSH/SSPOPCHK/SSRDP act as MOP (SSRDP → 0) and do not touch memory or raise exceptions even if ssp is misaligned or unmapped or the values mismatch

No separate suite needed — PMP can only be programmed from M-mode, so this sheet is already the right home. The existing PMP row is widened into cp_ss_pmp_permissions, sweeping pmp0cfg R/W and covering the SSPOPCHK-needs-W asymmetry as well as the fault-priority case.

Should we add a PMPZicfiss suite exercising PMP access to a shadow stack page, including that RW permission is needed for shadow stack instructions SSPOPCHK and SSPUSH.

Zicfiss_H Hypervisor Shadow Stack
Table 334. Zicfiss_H Coverpoints
Coverpoint Goal Feature Description Expectation Bins ID Normative Rule

General Test Environment (VS/VU-mode, H-extension):
- Same base environment as Zicfiss_U plus H-extension implemented.
- menvcfg.SSE=1 and henvcfg.SSE=1 unless stated otherwise. VU additionally requires senvcfg.SSE=1.
- G-stage translation active (hgatp.MODE != Bare) unless stated otherwise.

cp_ssp_csr_gating_virt_zicfiss

Verify ssp CSR accessibility from VS-mode and VU-mode across the henvcfg.SSE / senvcfg.SSE enable chain

With menvcfg.SSE=1, attempt ssp read and write:
from VS-mode for henvcfg.SSE = {0, 1};
from VU-mode for each (henvcfg.SSE, senvcfg.SSE) combination.

Exception flavour depends on WHICH field gates, not merely on V:
menvcfg.SSE=0 → ILLEGAL-instruction exception, even when V=1.
henvcfg.SSE=0 (V=1), or senvcfg.SSE=0 in VU-mode → VIRTUAL-instruction exception.
All required bits set for the mode: access allowed.

mode {VS, VU} x henvcfg.SSE {0,1} x senvcfg.SSE {0,1} x csr_op {read, write} x result {ok, virtual_instruction}

Zicfiss_vs_henvcfg_sse Zicfiss_vu_senvcfg_sse Zicfiss_ssp_csr Zicfiss_sse_access

[norm:Zicfiss_vs_henvcfg_sse] [norm:Zicfiss_vu_senvcfg_sse] [norm:Zicfiss_ssp_csr] [norm:Zicfiss_sse_access]

cp_ss_page_enc_virt_zicfiss

Verify the pte.xwr=010 encoding is reserved at VS/VU level when henvcfg.SSE=0

With menvcfg.SSE=1 and henvcfg.SSE=0, and V=1, build a VS-stage PTE with R=0, W=1, X=0 and access it from VS-mode and VU-mode. Repeat with henvcfg.SSE=1 as the positive control.

henvcfg.SSE=0: the encoding remains reserved at VS and VU levels — access raises a page-fault.
henvcfg.SSE=1: recognised as a valid SS page.

henvcfg.SSE {0,1} x mode {VS, VU} x access {ss_store, ordinary_load} x result {ok, page_fault}

ssmp_henvcfg_sse

[norm:ssmp_henvcfg_sse]

cp_ss_g_stage_zicfiss

Verify G-stage translation requirements and the guest-page-fault code for SS instructions

With V=1 and G-stage page tables active:
(a) map the shadow stack in the G-stage PTE WITHOUT read-write permission (read-only, and no-permission) and execute each SS memory instruction from VS-mode and VU-mode;
(b) force a guest-page-fault during each SS instruction (unmapped in G-stage);
(c) set vsatp.MODE=Bare and execute each SS instruction.

(a),(b): store/AMO GUEST-page-fault, cause=23 — remapped to the store/AMO flavour regardless of the instruction’s original access type, exactly as cause 7 and 15 are for the non-virtualised cases.
(c): store/AMO access-fault, cause=7 (vsatp.MODE=Bare with effective privilege < M).
ssp unchanged in all faulting cases.

instr {SSPUSH x1, SSPUSH x5, C.SSPUSH x1, SSPOPCHK x1, SSPOPCHK x5, C.SSPOPCHK x5, SSAMOSWAP.W, SSAMOSWAP.D} x mode {VS, VU} x g_stage {no_rw, unmapped, ok} x vsatp.MODE {Bare, Sv} x cause {none, 7, 23}

active_g_stage_pte ss_fault_exception_code satp_mode_bare

[norm:active_g_stage_pte] [norm:ss_fault_exception_code] [norm:satp_mode_bare]

cp_ssamoswap_sse_gating_virt_zicfiss

Verify SSAMOSWAP.W/D raises a VIRTUAL-instruction exception when the SSE chain is off and V=1

The virtualised counterpart of cp_ssamoswap_sse_gating_zicfiss. With menvcfg.SSE=1, execute SSAMOSWAP.W and SSAMOSWAP.D against a valid aligned SS address for:
(a) henvcfg.SSE=0, from VS-mode and VU-mode;
(b) henvcfg.SSE=1, senvcfg.SSE=0, from VU-mode.
Positive control: all required bits set — the instruction completes.

(a) virtual-instruction exception when V=1 and henvcfg.SSE=0.
(b) virtual-instruction exception in VU-mode when senvcfg.SSE=0.
Note the flavour split, which is why this is separate from the U sheet: the SAME gating condition yields ILLEGAL-instruction when V=0 and VIRTUAL-instruction when V=1. Gating by menvcfg.SSE stays ILLEGAL even at V=1.
Memory, rd and ssp unchanged.

instr {SSAMOSWAP.W, SSAMOSWAP.D} x mode {VS, VU} x gate {henvcfg.SSE=0, (henvcfg.SSE=1 & senvcfg.SSE=0)} x result {virtual_instruction}

henvcfg_sse_op senvcfg_sse_Zicfiss menvcfg_sse_op_list

[norm:henvcfg_sse_op] [norm:senvcfg_sse_Zicfiss] [norm:menvcfg_sse_op_list]

cp_envcfg_sse_rdonly0_virt_zicfiss

Verify the SSE read-only-zero chain through henvcfg and, at V=1, through senvcfg

Two links of the chain, observed by direct read-back rather than inferred from an ssp access.
Link 1 (from HS-mode): set menvcfg.SSE=0, then write henvcfg.SSE=1 using csrw, csrs and csrrw, reading henvcfg back after each. Repeat with menvcfg.SSE=1 as the positive control.
Link 2 (from VS-mode): with menvcfg.SSE=1 and henvcfg.SSE=0, write senvcfg.SSE=1 and read back — the h0s1 combination must be observed as h0s0. Repeat with henvcfg.SSE=1 as the control.

Link 1: with menvcfg.SSE=0, henvcfg.SSE reads back 0 after every write attempt. No exception — SSE is WARL, so the write is discarded rather than rejected.
Link 2: with henvcfg.SSE=0 and V=1, senvcfg.SSE reads back 0. The (henvcfg=0, senvcfg=1) combination is therefore architecturally unreachable, exactly as (menvcfg=0, senvcfg=1) is at V=0.
Positive controls: with the parent field set, the child is writable and reads back what was written.
Together with cp_senvcfg_sse_rdonly0_s_zicfiss (Zicfiss_S) and cp_envcfg_sse_rdonly0_zicfiss (Zicfiss_Sm) this closes the whole menvcfg → henvcfg → senvcfg chain.

link {menvcfg→henvcfg, henvcfg→senvcfg@V=1} x parent {0,1} x csr_op {csrw, csrs, csrrw} x written {0,1} x readback {0 when parent=0, written when parent=1}

menvcfg_sse_rdonly0 henvcfg_sse_op

[norm:menvcfg_sse_rdonly0] [norm:henvcfg_sse_op]

cp_ss_enable_chain_cross_zicfiss

Cross all eight menvcfg/senvcfg/henvcfg SSE combinations against every SS instruction in every mode

The three enable bits do not all apply in every mode, and the negatives are as important as the positives:
(a) From HS-mode (V=0) with henvcfg.SSE=0: henvcfg gates V=1 only, so this must make NO difference — SS instructions behave exactly as they do with henvcfg.SSE=1.
(b) From VS-mode with senvcfg.SSE=0: senvcfg gates VU/U only, so this must make NO difference at VS.
(c) The general sweep: all 8 combinations of {menvcfg.SSE, senvcfg.SSE, henvcfg.SSE} against every SS instruction, executed from HS, VS and VU.
Unreachable combinations are still attempted and are expected to be observed as their collapsed form (see cp_envcfg_sse_rdonly0_virt_zicfiss).

Which field is consulted depends on the mode:
HS (V=0): menvcfg.SSE alone. senvcfg and henvcfg are irrelevant.
VS: menvcfg.SSE and henvcfg.SSE. senvcfg is irrelevant.
VU: menvcfg.SSE, henvcfg.SSE and senvcfg.SSE.
Where a mode’s required bits are all 1 the instruction executes normally; otherwise the MOP-encoded instructions revert to their Zimop/Zcmop no-op and SSAMOSWAP traps.
Exception flavour follows the gating field, not merely V: menvcfg.SSE=0 gives ILLEGAL-instruction even at V=1, while henvcfg/senvcfg gating at V=1 gives VIRTUAL-instruction.

{menvcfg.SSE, senvcfg.SSE, henvcfg.SSE} {000..111} x mode {HS, VS, VU} x instr {SSPUSH x1, SSPUSH x5, C.SSPUSH x1, SSPOPCHK x1, SSPOPCHK x5, C.SSPOPCHK x5, SSRDP, SSAMOSWAP.W, SSAMOSWAP.D} x result {executes, no-op, illegal_instruction, virtual_instruction}

Zicfiss_ssp_csr Zicfiss_m_menvcfg_sse Zicfiss_vs_henvcfg_sse Zicfiss_vu_senvcfg_sse Zicfiss_sse_access henvcfg_sse_op menvcfg_sse_op_list senvcfg_sse_Zicfiss

[norm:Zicfiss_ssp_csr] [norm:Zicfiss_m_menvcfg_sse] [norm:Zicfiss_vs_henvcfg_sse] [norm:Zicfiss_vu_senvcfg_sse] [norm:Zicfiss_sse_access] [norm:henvcfg_sse_op] [norm:menvcfg_sse_op_list] [norm:senvcfg_sse_Zicfiss]

cp_ss_g_stage_page_enc_zicfiss

Verify pte.xwr=010 remains a reserved encoding in G-stage page tables

The shadow stack encoding is defined for VS-stage and S-stage page tables only. G-stage has no notion of a shadow stack page, so xwr=010 there stays reserved regardless of menvcfg.SSE or henvcfg.SSE.
Map the guest physical page backing the shadow stack with a G-stage PTE of xwr=010, leaving the VS-stage PTE a correct SS page, and attempt every access type from VS and VU: SS instructions, ordinary loads, ordinary stores, and instruction fetch.
Repeat with menvcfg.SSE=1/henvcfg.SSE=1 and with them cleared, to show the encoding does not become valid at G-stage under any enable setting.

Every access type raises a store/AMO GUEST-page-fault (cause=23) — the reserved G-stage encoding makes the second-stage translation invalid, so the access never reaches the shadow stack rules.
This holds for loads and instruction fetch as well as stores, and is independent of the SSE enable bits.
Contrast with cp_ss_page_enc_virt_zicfiss, which covers the VS-stage encoding where henvcfg.SSE=0 is what makes xwr=010 reserved.

g_stage_pte.xwr {010} x access {SS instr, ordinary load, ordinary store, ifetch} x mode {VS, VU} x {menvcfg.SSE, henvcfg.SSE} {00, 11} x cause {23}

active_g_stage_pte ss_fault_exception_code H_vm_gstagetrans H_guest_page_fault

[norm:active_g_stage_pte] [norm:ss_fault_exception_code] [norm:H_vm_gstagetrans] [norm:H_guest_page_fault]

cp_ss_hlv_hsv_zicfiss

Verify hypervisor load/store access to a VS-stage shadow stack page: HLV succeeds, HSV faults

From HS-mode, with a VS-stage page correctly mapped as a shadow stack page (xwr=010), use the hypervisor virtual-machine load and store instructions to reach it:
HLV.B / HLV.H / HLV.W / HLV.D (and the unsigned forms) — these only load.
HSV.B / HSV.H / HSV.W / HSV.D — these store.
Repeat with hstatus.HU = 0 and 1, and from U-mode where HLV/HSV are only permitted when HU=1.

HLV succeeds. The shadow stack is readable by any instruction that only loads ([norm:ssmp_ss_load]), and HLV is such an instruction — being a hypervisor instruction does not change that.
HSV faults with a store/AMO access-fault: it is a store, and the set of instructions permitted to write an SS page is exactly SSPUSH, C.SSPUSH, SSAMOSWAP.W and SSAMOSWAP.D. HSV is not in it.
With hstatus.HU=0, HLV/HSV from U-mode raise a virtual-instruction exception before any shadow stack rule is consulted.

instr {HLV.B, HLV.H, HLV.W, HLV.D, HLVU variants, HSV.B, HSV.H, HSV.W, HSV.D} x hstatus.HU {0,1} x mode {HS, U} x result {ok for HLV, store/AMO access-fault for HSV, virtual_instruction when HU=0 from U}

hlsv_op hlsv_u_op ssmp_ss_load ssmp_ss_page_access_fault ss_fault_exception_code

[norm:hlsv_op] [norm:hlsv_u_op] [norm:ssmp_ss_load] [norm:ssmp_ss_page_access_fault] [norm:ss_fault_exception_code]

cp_ss_swcheck_delegation_zicfiss

Verify the shadow stack software-check exception is delegated correctly through medeleg and hedeleg

The software-check exception (cause=18) raised by a mismatching SSPOPCHK must follow the normal delegation chain. Sweep both delegation registers:
medeleg[18] = 0/1 — controls whether the exception is taken in M-mode or delegated below.
hedeleg[18] = 0/1 — with V=1, controls whether a delegated exception stops at HS or is further delegated to VS.
Trigger the mismatching SSPOPCHK from HS, VS and VU for each combination, and check where the trap lands and which tval register carries the shadow stack fault code.

medeleg[18]=0: trap taken in M-mode; mcause=18 and mtval=3.
medeleg[18]=1, V=0: trap taken in HS-mode; scause=18 and stval=3.
medeleg[18]=1, hedeleg[18]=0, V=1: trap taken in HS-mode, not VS.
medeleg[18]=1, hedeleg[18]=1, V=1: trap taken in VS-mode; vscause=18 and vstval=3.
The tval code (3, shadow stack fault) must appear in whichever tval register corresponds to the mode the trap landed in, subject to the REPORT_CAUSE_IN_xTVAL_ON_SHADOW_STACK_SOFTWARE_CHECK parameters.
hedeleg[18] must be writable if the software-check exception is delegatable at all; if the bit is read-only zero the VS case collapses into the HS case and that is what is checked.

medeleg[18] {0,1} x hedeleg[18] {0,1} x origin_mode {HS, VS, VU} x trap_lands {M, HS, VS} x {xcause==18, xtval==3}

sspop_exception mtval_swchk_lead_in mtval_swchk_list hedeleg_op medeleg_mideleg_delegate_op

[norm:sspop_exception] [norm:mtval_swchk_lead_in] [norm:mtval_swchk_list] [norm:hedeleg_op] [norm:medeleg_mideleg_delegate_op]

cp_ss_non_idempotent_virt_zicfiss

Verify VS/VU-mode SS instructions fault on non-idempotent memory under two-stage Svpbmt (VS-stage and G-stage PBMT)

The two-stage counterpart of cp_ss_non_idempotent_zicfiss. Requires Svpbmt (RV64 only).
With V=1, menvcfg.SSE=1, henvcfg.SSE=1 (and senvcfg.SSE=1 for VU), map the shadow stack page with a VS-stage PTE of xwr=010 and a G-stage PTE with R=W=1, U=1. Sweep the VS-stage PBMT and the G-stage PBMT independently over {PMA, NC, IO}, and execute each SS instruction that accesses memory from VS-mode and from VU-mode: SSPUSH x1/x5, C.SSPUSH x1, SSPOPCHK x1/x5, C.SSPOPCHK x5, SSAMOSWAP.W and SSAMOSWAP.D.
Repeat with henvcfg.PBMTE=0 (menvcfg.PBMTE=1), and with menvcfg.PBMTE=0, which makes henvcfg.PBMTE read-only zero.
Svpbmt applies the two stages in order: "if hgatp.MODE is not equal to zero, non-zero G-stage PTE PBMT bits override the attributes in the PMA to produce an intermediate set of attributes" ([norm:Svpbmt_hgatp_stage_override_rule]), then "if vsatp.MODE is not equal to zero, non-zero VS-stage PTE PBMT bits override the intermediate attributes to produce the final set of attributes used by accesses to the page in question" ([norm:Svpbmt_vsatp_stage_override_rule]).
SSAMOSWAP is not executed where the final type is NC, for the reason given in cp_ss_non_idempotent_s_zicfiss on the Zicfiss_S sheet.

menvcfg.PBMTE=1 and henvcfg.PBMTE=1: the final memory type is the VS-stage PBMT if it is nonzero, else the G-stage PBMT if it is nonzero, else the PMA.
Final type IO is non-idempotent: store/AMO access-fault (cause=7), with the faulting guest VA in the tval register of the mode the trap is taken in. This covers VS=IO over any G-stage PBMT, and VS=PMA over G=IO.
Final type NC or PMA is idempotent: the access is performed. In particular a VS-stage NC page over a G-stage IO page is idempotent, because the nonzero VS-stage PBMT overrides the G-stage one.
henvcfg.PBMTE=0: a nonzero VS-stage PBMT is reserved, so the VS-stage walk raises a store/AMO page-fault (cause=15) whatever the G-stage PBMT. The G-stage PBMT still applies under a VS-stage PMA page.
menvcfg.PBMTE=0: henvcfg.PBMTE is read-only zero, so a nonzero VS-stage PBMT raises a store/AMO page-fault (cause=15), and a nonzero G-stage PBMT is reserved, so the G-stage walk raises a store/AMO guest-page-fault (cause=23).
ssp, rd and memory are unchanged by every fault.

mode {VS, VU} x instr {SSPUSH x1, SSPUSH x5, C.SSPUSH x1, SSPOPCHK x1, SSPOPCHK x5, C.SSPOPCHK x5, SSAMOSWAP.W, SSAMOSWAP.D} x vs_pte.PBMT {PMA, NC, IO} x g_pte.PBMT {PMA, NC, IO} x {menvcfg.PBMTE, henvcfg.PBMTE} {11, 10, 00}

ssmp_ss_idempotent_memory Svpbmt_hgatp_stage_override_rule Svpbmt_vsatp_stage_override_rule

[norm:ssmp_ss_idempotent_memory] [norm:Svpbmt_hgatp_stage_override_rule] [norm:Svpbmt_vsatp_stage_override_rule]

(reused) Zicfiss_U instruction coverpoints, re-run from VS-mode and VU-mode

Re-run the Zicfiss_U coverpoints with the hart in VS/VU instead of U

BOOKKEEPING ROW, not a new coverpoint. These 13 Zicfiss_U coverpoints are re-run with V=1, sampled into the H covergroup via priv_mode_vs / priv_mode_vu:
cp_ssp_access_zicfiss
cp_sspush_zicfiss
cp_sspopchk_match_zicfiss
cp_sspopchk_mismatch_zicfiss
cp_sspopchk_fault_priority_zicfiss
cp_ss_call_return_zicfiss
cp_ssrdp_zicfiss
cp_ssamoswap_zicfiss
cp_ss_address_alignment_zicfiss
cp_ss_instr_target_page_zicfiss
cp_ss_page_access_zicfiss
cp_ss_page_crossing_zicfiss
cp_ss_page_ad_bits_zicfiss
NOT re-run: cp_ssp_csr_gating_u_zicfiss, cp_ss_instr_inactive_zicfiss, cp_ssamoswap_sse_gating_zicfiss and cp_ss_non_idempotent_zicfiss — their virtualised equivalents are cp_ssp_csr_gating_virt_zicfiss, cp_ss_enable_chain_cross_zicfiss, cp_ssamoswap_sse_gating_virt_zicfiss and cp_ss_non_idempotent_virt_zicfiss on this sheet.
Two V=1 differences apply to every re-run: translation is two-stage, so a fault may surface as a guest-page-fault (cause 23) instead of 15; and the gating flavour differs, ILLEGAL for menvcfg versus VIRTUAL for henvcfg/senvcfg.

Identical architectural results to the U-mode runs except where two-stage translation or the enable-chain flavour changes the reported cause, as described above.

priv_mode {vs, vu} x (all bins of each reused coverpoint)

(inherits the ID list of each reused coverpoint)

(inherits the normative rules of each reused coverpoint)

Folded into cp_envcfg_sse_rdonly0_virt_zicfiss.

Write henvcfg.SSE=1 when menvcfg.SSE=0, read back and ensure henvcfg = 0

Folded into cp_envcfg_sse_rdonly0_virt_zicfiss.

in vs check h0s1 reads back as h0s0

PROMOTED to its own coverpoint: cp_ss_enable_chain_cross_zicfiss, including the two irrelevance claims (henvcfg at HS, senvcfg at VS).

Test SS instructions from HS with henvcfg.SSE=0 and confirm that doesn’t matter. Also test from VS with senvcfg.SSE=0, confirm it doesn’t matter. Generally cross all 8 m/s/h enables with each instruction.

PROMOTED to its own coverpoint: cp_ss_g_stage_page_enc_zicfiss.

Test G-stage PTE of xwr=010 remains reserved, guest page fault for every access type.

PROMOTED to its own coverpoint: cp_ss_hlv_hsv_zicfiss.

Test HLV/HSV from HS-mode to VS-stage SS page. HSV faults, HLV ok.

PROMOTED to its own coverpoint: cp_ss_swcheck_delegation_zicfiss, sweeping medeleg[18] and hedeleg[18] across HS/VS/VU.

Be sure software check extension is delegated appropriately with hedeleg as well as medeleg.

Table 335. Zicfiss Normative Rules
Normative Rule Rule Text Coverpoints

senvcfg_sse_Zicfiss

The Zicfiss extension adds the SSE field in senvcfg. When the SSE field is set to 1, the Zicfiss extension is activated in VU/U-mode. When the SSE field is 0, the Zicfiss extension remains inactive in VU/U-mode, and the following rules apply:

{Zicfiss_U_cg}/{cp_ssp_csr_gating_u,cp_ssamoswap_sse_gating,cp_ss_instr_inactive_u}

menvcfg_sse_op_lead_in

The Zicfiss extension adds the SSE field to menvcfg. When the SSE field is set to 1 the Zicfiss extension is activated in S-mode. When SSE field is 0, the following rules apply to privilege modes that are less than M:

{Zicfiss_Sm_cg}/{cp_menvcfg_sse_gating,cp_ss_instr_inactive_s}, {Zicfiss_S_cg}/{cp_ssp_csr_gating_s}, {Zicfiss_U_cg}/{cp_ss_instr_inactive_u}

menvcfg_sse_op_list

32-bit Zicfiss instructions will revert to their behavior as defined by Zimop. 16-bit Zicfiss instructions will revert to their behavior as defined by Zcmop. The pte.xwr=0b010 encoding in VS/S-stage page tables becomes reserved. SSAMOSWAP.W/D raises an illegal-instruction exception.

{Zicfiss_Sm_cg}/{cp_ss_instr_inactive_s}, {Zicfiss_S_cg}/{cp_ss_page_enc_load,cp_ssamoswap_sse_gating_s}, {Zicfiss_U_cg}/{cp_ss_instr_inactive_u,cp_ssamoswap_sse_gating}

menvcfg_sse_rdonly0

When menvcfg.SSE is 0, the henvcfg.SSE and senvcfg.SSE fields are read-only zero.

{Zicfiss_Sm_cg}/{cp_envcfg_sse_rdonly0_senvcfg,cp_envcfg_sse_rdonly0_henvcfg}, {Zicfiss_S_cg}/{cp_senvcfg_sse_rdonly0_s}

henvcfg_sse_op

The Zicfiss extension adds the SSE field in henvcfg. If the SSE field is set to 1, the Zicfiss extension is activated in VS-mode. When the SSE field is 0, the Zicfiss extension remains inactive in VS-mode, and the following rules apply when V=1:

{Zicfiss_H_cg}/{cp_ssp_csr_gating_vs,cp_ssamoswap_sse_gating_vs,cp_ss_instr_inactive_virt,cp_envcfg_sse_rdonly0_virt}

Zicfiss_m_menvcfg_sse

If the privilege mode is less than M and menvcfg.⁠SSE is 0, an illegal-instruction exception is raised.

{Zicfiss_Sm_cg}/{cp_menvcfg_sse_gating}, {Zicfiss_S_cg}/{cp_ssp_csr_gating_s}, {Zicfiss_U_cg}/{cp_ssp_csr_gating_u}

Zicfiss_ssp_csr

Attempts to access the ssp CSR may result in either an illegal-instruction exception or a virtual-instruction exception, contingent upon the state of the envcfg.⁠SSE fields. The conditions are specified as follows:

{Zicfiss_Sm_cg}/{cp_menvcfg_sse_gating}, {Zicfiss_S_cg}/{cp_ssp_csr_gating_s}, {Zicfiss_U_cg}/{cp_ssp_csr_gating_u,cp_ssp_access}

Zicfiss_u_senvcfg_sse

Otherwise, if in U-mode and senvcfg.⁠SSE is 0, an illegal-instruction exception is raised.

{Zicfiss_U_cg}/{cp_ssp_csr_gating_u}

Zicfiss_vs_henvcfg_sse

Otherwise, if in VS-mode and henvcfg.⁠SSE is 0, a virtual-instruction exception is raised.

{Zicfiss_H_cg}/{cp_ssp_csr_gating_vs}

Zicfiss_vu_senvcfg_sse

Otherwise, if in VU-mode and senvcfg.⁠SSE is 0, a virtual-instruction exception is raised.

{Zicfiss_H_cg}/{cp_ssp_csr_gating_vu}

Zicfiss_sse_access

Otherwise, the access is allowed.

{Zicfiss_S_cg}/{cp_ssp_csr_gating_s}, {Zicfiss_U_cg}/{cp_ssp_access}

Zicfiss_smode_xsse

When S-mode is not implemented, then xSSE is 0.

ss_page_enc

The encoding R=0, W=1, and X=0, is defined to represent an SS page.

{Zicfiss_S_cg}/{cp_ss_page_enc}, {Zicfiss_U_cg}/{cp_sspush,cp_sspopchk_match}

ssmp_menvcfg_sse

When menvcfg.⁠SSE=0, this encoding remains reserved.

{Zicfiss_S_cg}/{cp_ss_page_enc,cp_ss_page_enc_load,cp_ss_page_enc_store}, {Zicfiss_Sm_cg}/{cp_menvcfg_sse_ss_page}

ssmp_henvcfg_sse

Similarly, when V=1 and henvcfg.⁠SSE=0, this encoding remains reserved at VS and VU levels.

{Zicfiss_H_cg}/{cp_ss_page_enc_virt}

satp_mode_bare

If satp.⁠MODE (or vsatp.⁠MODE when V=1) is set to Bare and the effective privilege mode is less than M, shadow stack instructions raise a store/AMO access-fault exception.

{Zicfiss_Sm_cg}/{cp_ss_satp_bare,cp_ssamoswap_mprv_s}

ssmp_ssamoswap

When the effective privilege mode is M, memory access by an SSAMOSWAP.W or SSAMOSWAP.D instruction results in a store/AMO access-fault exception.

{Zicfiss_Sm_cg}/{cp_ssamoswap_mmode_fault,cp_ssamoswap_mprv_s}

ssmp_ss_page_access_fault

Memory mapped as an SS page cannot be written to by instructions other than SSAMOSWAP.W, SSAMOSWAP.D, SSPUSH, and C.SSPUSH. Attempts will raise a store/AMO access-fault exception.

{Zicfiss_U_cg}/{cp_ss_page_access_store,cp_ss_page_access_store_misaligned,cp_ss_page_access_amo,cp_ss_vector_store}, {Zicfiss_S_cg}/{cp_ss_page_enc_store,cp_ss_page_access_store_misaligned_s}

ssmp_ss_cache_block_access_fault

Access to a SS page using cache-block operation (CBO.*) instructions is not permitted. Such accesses will raise a store/AMO access-fault exception.

{Zicfiss_U_cg}/{cp_ss_page_access_cbo,cp_ss_page_access_cboz}

ssmp_ss_implicit_access_fault

Implicit accesses, including instruction fetches to an SS page, are not permitted. Such accesses will raise an access-fault exception appropriate to the access type.

{Zicfiss_U_cg}/{cp_ss_page_fetch}

ssmp_ss_load

However, the shadow stack is readable by all instructions that only load from memory.

{Zicfiss_U_cg}/{cp_ss_page_access_load,cp_ss_page_access_lrsc,cp_ss_vector_load}, {Zicfiss_S_cg}/{cp_ss_page_enc_load}

ss_fault_exception_code

If a shadow stack (SS) instruction raises an access-fault, page-fault, or guest-page-fault exception that is supposed to indicate the original instruction type (load or store/AMO), then the reported exception cause is respectively a store/AMO access fault (code 7), a store/AMO page fault (code 15), or a store/AMO guest-page fault (code 23).

{Zicfiss_U_cg}/{cp_ss_instr_target_page,cp_sspopchk_fault_priority}, {Zicfiss_Sm_cg}/{cp_ss_pmp_permissions,cp_ss_satp_bare}

ssmp_ss_page_illegal_access

Should a shadow stack instruction access a page that is not designated as a shadow stack page and is not marked as read-only (pte.xwr=0b001), a store/AMO access-fault exception will be invoked.

{Zicfiss_U_cg}/{cp_ss_instr_target_page}, {Zicfiss_S_cg}/{cp_ss_instr_target_page_s}

ssmp_ss_read_only_page

Conversely, if the page being accessed by a shadow stack instruction is a read-only page, a store/AMO page-fault exception will be triggered.

{Zicfiss_U_cg}/{cp_ss_instr_target_page}, {Zicfiss_S_cg}/{cp_ss_instr_target_page_s}

ssp_xlen_aligned

If the virtual address in ssp is not XLEN aligned, then the SSPUSH, C.SSPUSH, SSPOPCHK and C.SSPOPCHK instructions cause a store/AMO access-fault exception.

{Zicfiss_U_cg}/{cp_ss_address_alignment_ssp,cp_ss_address_alignment_pop}, {Zicfiss_S_cg}/{cp_ss_address_alignment_ssp_s,cp_ss_address_alignment_pop_s}

ssmp_ss_idempotent_memory

If the memory referenced by SSPUSH, C.SSPUSH, SSPOPCHK, C.SSPOPCHK, SSAMOSWAP.W and SSAMOSWAP.D instructions is not idempotent, then the instructions cause a store/AMO access-fault exception.

{Zicfiss_Sm_cg}/{cp_ssamoswap_mprv_non_idempotent}, {Zicfiss_S_cg}/{cp_ss_non_idempotent_s}, {Zicfiss_U_cg}/{cp_ss_non_idempotent}

active_g_stage_pte

When G-stage page tables are active, the shadow stack instructions that access memory require the G-stage page table to have read-write permission for the accessed memory; else a store/AMO guest-page-fault exception is raised.

{Zicfiss_H_cg}/{cp_ss_g_stage}

Zicfiss_enc

The Zicfiss instructions, except SSAMOSWAP.W and SSAMOSWAP.D, are encoded using a subset of May-Be-Operation instructions defined by the Zimop and Zcmop extensions.

{Zicfiss_U_cg}/{cp_sspush,cp_sspopchk_match,cp_ssrdp,cp_ss_instr_inactive_u}

Zicfiss_sspush_enc

SSPUSH x1 and SSPUSH x5 - encoded using MOP.RR.7

{Zicfiss_U_cg}/{cp_sspush}, {Zicfiss_S_cg}/{cp_sspush_s}

Zicfiss_c-sspush_enc

C.SSPUSH x1 - encoded using C.MOP.1

{Zicfiss_U_cg}/{cp_sspush}, {Zicfiss_S_cg}/{cp_sspush_s}

Zicfiss_sspopchk_enc

SSPOPCHK x1 and SSPOPCHK x5 - encoded using MOP.R.28

{Zicfiss_U_cg}/{cp_sspopchk_match,cp_sspopchk_mismatch}, {Zicfiss_S_cg}/{cp_sspopchk_match_s,cp_sspopchk_mismatch_s}

Zicfiss_c-sspopchk_enc

C.SSPOPCHK x5 - encoded using C.MOP.5

{Zicfiss_U_cg}/{cp_sspopchk_match,cp_sspopchk_mismatch}, {Zicfiss_S_cg}/{cp_sspopchk_match_s,cp_sspopchk_mismatch_s}

Zicfiss_ssrdp_enc

SSRDP - encoded using MOP.R.28

{Zicfiss_U_cg}/{cp_ssrdp}, {Zicfiss_S_cg}/{cp_ssrdp_s}

ssp_op

The ssp CSR is an unprivileged read-write (URW) CSR that reads and writes XLEN low order bits of the shadow stack pointer.

{Zicfiss_U_cg}/{cp_ssp_access,cp_ssp_low_bits_ro_zero}

ssp_addr

The CSR address is 0x011.

{Zicfiss_U_cg}/{cp_ssp_access,cp_ssp_low_bits_ro_zero}

ssp_sz

There is no high CSR defined as the ssp is always as wide as the XLEN of the current privilege mode.

{Zicfiss_U_cg}/{cp_ssp_access,cp_ssp_low_bits_ro_zero}

ssp_field_1_0

The bits 1:0 of ssp are read-only zero. If the UXLEN or SXLEN may never be 32, then the bit 2 is also read-only zero.

{Zicfiss_U_cg}/{cp_ssp_access,cp_ssp_low_bits_ro_zero}

ss_push

A shadow stack push operation is defined as decrement of the ssp by XLEN/8 followed by a store of the value in the link register to memory at the new top of the shadow stack.

{Zicfiss_U_cg}/{cp_sspush,cp_ss_page_crossing}, {Zicfiss_S_cg}/{cp_sspush_s}

sspush_c-sspush_instr

The SSPUSH instruction and its compressed form C.SSPUSH can be used to push a link register on the shadow stack. The SSPUSH and C.SSPUSH instructions perform a store identically to the existing store instructions, with the difference that the base is implicitly ssp and the width is implicitly XLEN.

{Zicfiss_U_cg}/{cp_sspush,cp_ss_page_crossing}, {Zicfiss_S_cg}/{cp_sspush_s}

sspush_c-sspush_decrement

The ssp is decremented by SSPUSH and C.SSPUSH only if the store to the shadow stack completes successfully.

{Zicfiss_U_cg}/{cp_sspush,cp_ss_page_crossing}, {Zicfiss_S_cg}/{cp_sspush_s}

ss_pop

A shadow stack pop operation is defined as an XLEN wide read from the current top of the shadow stack followed by an increment of the ssp by XLEN/8.

{Zicfiss_U_cg}/{cp_sspopchk_match,cp_sspopchk_mismatch,cp_ss_page_crossing}, {Zicfiss_S_cg}/{cp_sspopchk_match_s}

sspopchk_shadow_return_pop

The SSPOPCHK instruction, and its compressed form C.SSPOPCHK, can be used to pop the shadow return address value from the shadow stack and check that the value matches the contents of the link register, and if not cause a software-check exception with xtval set to shadow stack fault (code=3).

{Zicfiss_U_cg}/{cp_sspopchk_match,cp_sspopchk_mismatch}, {Zicfiss_S_cg}/{cp_sspopchk_match_s,cp_sspopchk_mismatch_s}

sspopchk_load_op

The SSPOPCHK and C.SSPOPCHK instructions perform a load identically to the existing load instructions, with the difference that the base is implicitly ssp and the width is implicitly XLEN.

{Zicfiss_U_cg}/{cp_sspopchk_match,cp_sspopchk_fault_priority,cp_ss_page_crossing}, {Zicfiss_S_cg}/{cp_sspopchk_match_s}

sspop_exception

If the value loaded from the address in ssp does not match the value in rs1, a software-check exception (cause=18) is raised with xtval set to shadow stack fault (code=3). The software-check exception caused by SSPOPCHK or C.SSPOPCHK is lower in priority than a load/store/AMO access-fault exception.

{Zicfiss_U_cg}/{cp_sspopchk_mismatch,cp_sspopchk_fault_priority}, {Zicfiss_S_cg}/{cp_sspopchk_mismatch_s}, {Zicfiss_Sm_cg}/{cp_ss_pmp_permissions}

sspop_increment

The ssp is incremented by SSPOPCHK and C.SSPOPCHK only if the load from the shadow stack completes successfully and no software-check exception is raised.

{Zicfiss_U_cg}/{cp_sspopchk_match,cp_sspopchk_mismatch,cp_sspopchk_fault_priority}, {Zicfiss_S_cg}/{cp_sspopchk_match_s}

ssrdp_read

The SSRDP instruction is provided to move the contents of ssp to a destination register.

{Zicfiss_U_cg}/{cp_ssrdp}, {Zicfiss_S_cg}/{cp_ssrdp_s}

rv32_ssamoswap-w_op

For RV32, SSAMOSWAP.W atomically loads a 32-bit data value from address of a shadow stack location in rs1, puts the loaded value into register rd, and stores the 32-bit value held in rs2 to the original address in rs1. SSAMOSWAP.D (RV64 only) is similar to SSAMOSWAP.W but operates on 64-bit data values.

{Zicfiss_U_cg}/{cp_ssamoswap,cp_ssamoswap_aqrl,cp_ssamoswap_reg_edges}, {Zicfiss_S_cg}/{cp_ssamoswap_s}

ssamoswap_address

Just as for AMOs in the A extension, SSAMOSWAP.W or SSAMOSWAP.D requires that the address held in rs1 be naturally aligned to the size of the operand (i.e., 8-byte aligned for doublewords, and 4-byte aligned for words). The same exception options apply if the address is not naturally aligned.

{Zicfiss_U_cg}/{cp_ss_address_alignment_swap}, {Zicfiss_S_cg}/{cp_ss_address_alignment_swap_s}

rv64_ssamoswap-w_op

For RV64, SSAMOSWAP.W atomically loads a 32-bit data value from address of a shadow stack location in rs1, sign-extends the loaded value and puts it in rd, and stores the lower 32 bits of the value held in rs2 to the original address in rs1.

{Zicfiss_U_cg}/{cp_ssamoswap,cp_ssamoswap_aqrl,cp_ssamoswap_reg_edges}, {Zicfiss_S_cg}/{cp_ssamoswap_s}

stval_exception_info

On a trap caused by a software-check exception, the stval register holds the cause for the exception. The following encodings are defined:

{Zicfiss_U_cg}/{cp_sspopchk_mismatch}, {Zicfiss_S_cg}/{cp_sspopchk_mismatch_s}

mtval_swchk_lead_in

On a trap caused by a software-check exception, the mtval register holds the cause for the exception. The following encodings are defined:

{Zicfiss_Sm_cg}/{cp_ss_swcheck_mtval}

mtval_swchk_list

0 - No information provided. 2 - Landing Pad Fault. Defined by the Zicfilp extension (priv-forward). 3 - Shadow Stack Fault. Defined by the Zicfiss extension (priv-backward).

{Zicfiss_Sm_cg}/{cp_ss_swcheck_mtval}

Table 336. Zicfiss UDB Parameters
Parameter Description Coverpoint Effect

REPORT_CAUSE_IN_MTVAL_ON_SHADOW_STACK_SOFTWARE_CHECK

When true, mtval is written with the shadow stack cause (code=3) when a SoftwareCheck exception is raised into M-mode due to a shadow stack pop check instruction.

When false, mtval is written with 0.

cp_ss_swcheck_mtval

When true, a shadow stack software-check exception taken to M-mode reports the shadow stack fault code (3) in mtval; when false, mtval is 0. The coverpoint’s mtval bin follows the parameter.

REPORT_CAUSE_IN_STVAL_ON_SHADOW_STACK_SOFTWARE_CHECK

When true, stval is written with the shadow stack cause (code=3) when a SoftwareCheck exception is raised into S-mode due to a shadow stack pop check instruction.

When false, stval is written with 0.

cp_sspopchk_mismatch, cp_sspopchk_mismatch_s

Same as the mtval parameter, for a software-check exception delegated to S-mode.

REPORT_CAUSE_IN_VSTVAL_ON_SHADOW_STACK_SOFTWARE_CHECK

When true, vstval is written with the shadow stack cause (code=3) when a SoftwareCheck exception is raised into VS-mode due to a shadow stack pop check instruction.

When false, vstval is written with 0.

Untested

Same as the mtval parameter, for a software-check exception taken in VS-mode. No current coverpoint drives this: the VS/VU coverpoints exercise ssp CSR gating, which raises virtual-instruction, not software-check. Listed for when the Zicfiss_H generator lands.

MISALIGNED_AMO

Whether or not the implementation supports misaligned atomics in main memory

cp_ss_address_alignment_swap, cp_ss_address_alignment_swap_s

SSAMOSWAP takes the same exception options as A-extension AMOs for a non-naturally-aligned address, so the expected result of the addr[2:0] sweep is implementation-defined and must be compared against the reference model rather than asserted outright.

MISALIGNED_LDST_EXCEPTION_PRIORITY

The relative priority of a load/store/AMO exception vs. load/store/AMO page-fault or access-fault exceptions.

May be one of:

[separator="!"] !=== ! low ! Misaligned load/store/AMO exceptions are always lower priority than load/store/AMO page-fault and access-fault exceptions. ! high ! Misaligned load/store/AMO exceptions are always higher priority than load/store/AMO page-fault and access-fault exceptions. !===

MISALIGNED_LDST_EXCEPTION_PRIORITY cannot be "high" when MISALIGNED_MAX_ATOMICITY_GRANULE_SIZE is non-zero, since the atomicity of an access cannot be determined in that case until after address translation.

cp_ss_page_access_store_misaligned, cp_ss_page_access_store_misaligned_s

When low, a misaligned ordinary store to an SS page raises a store/AMO access-fault. When high, the address-misaligned exception can take priority. The misaligned bins therefore compare the result against the reference model.

NUM_USABLE_PMP_ENTRIES

Number of implemented PMP entries that are actually usable.

An implementation may implement PMP entries (NUM_PMP_ENTRIES) but hardwire some of them to zero (read-only zero). Such entries exist — their pmpaddrN/pmpNcfg registers are accessible and will not cause an exception from M-mode — but they cannot be configured to guard a region.

NUM_USABLE_PMP_ENTRIES gives the number of low-numbered entries that are writable/usable. Entries 0 through NUM_USABLE_PMP_ENTRIES-1 are usable; entries NUM_USABLE_PMP_ENTRIES through NUM_PMP_ENTRIES-1 are read-only zero.

Must be between 0 and NUM_PMP_ENTRIES, inclusive.

cp_ss_pmp_permissions

The PMP test uses entry 0 for the shadow stack page and entry 1 for the rest of memory. With fewer than two usable entries the test and the coverpoint are left out.

PMP_NAPOT_SUPPORTED

Whether or not the Naturally Aligned Power-Of-Two (NAPOT) PMP address matching mode is supported.

cp_ss_pmp_permissions

The PMP test maps the shadow stack page with a NAPOT region. Without NAPOT the test and the coverpoint are left out.

PMP_GRANULARITY

log2 of the smallest supported PMP region.

Generally, for systems with an MMU, should not be smaller than 12, as that would preclude caching PMP results in the TLB along with virtual memory translations

Note that PMP_GRANULARITY is equal to G+2 (not G) as described in the privileged architecture.

cp_ss_pmp_permissions

The PMP region is the 4 KiB shadow stack page. With a granularity above 4 KiB the test and the coverpoint are left out.

B.10.14. Zawrs Wait on Reservation Set

The Zawrs suite has one covergroup per privilege mode the tests run in: Zawrs_Sm_cg (M-mode), Zawrs_S_cg (S-mode) and Zawrs_U_cg (U-mode). Waits until timer interrupt or timeout on a single hart that cannot modify the reservation set. Tests behave differently in different privilege modes, so a group is defined for each. The Zawrs_Sm tests require Sm, so they are not part of a certificate without Sm, such as RVA23.

No zawrs setup have been defined yet.

Zawrs_Sm

covergroup Zawrs_Sm

Table 337. Zawrs_Sm Coverpoints
Coverpoint Goal Feature Description Expectation Bins Normative Rule Notes

tests for single core

cp_wrs_sto_timeout

WRS.STO waits till timeout

cross lr instruction to set up reservation.
mstatus.TW = {0/1}
mstatus.MIE = 0
mie=all 0s to disable interrupts
Execute WRS.STO in M mode

no exception, next instruction executes normally after WRS.STO finish execution

2 bins

Zawrs_wrs-sto_stall_duration

cp_wrs_no_res

WRS behaves as nop when no reservation is established

mstatus.TW ={0/1}
mstatus.MIE = 0
mie=all 0s to disable interrupts
Clear all reservation with sc.w, then execute {WRS.STO, WRS.NTO} with no reservation created in M mode

WRS behaves as nop

2 x 2 bins

Zawrs_all_priv_modes

cp_wrs_resume

WRS follows the rules of WFI for resuming on interrupts

cross lr instruction to set up reservation.
mstatus.TW = {0/1}
mstatus.MIE = {0/1}
cross with mie.MTIE=1
Set up timer to interrupt soon
execute {WRS.NTO/WRS.STO} in M mode

WRS resumes when interrupt is pending, MIE should not affect result

2 x 2 x 2 bins

mtime_mtimecmp_rv64_wr
Zawrs_wrs-nto_stall_exec
Zawrs_stall_terminate
Zawrs_exec_resume_rules

LA(t0, zawrs_resume_trap_handler)
csrrw t0, mtvec, t0 # save old trap vector
1: wrs.nto # keep doing nto until timeout
if MIE=0 and mip.MTIP, exit with success
j 1b
zawrs_resume_trap_handler:
csrr t1, mcause
SIGUPD t1
csrw stvec, t0 # restore trap handler
done:
Not generated without a machine timer interrupt (MTI_INTR_IMPL).

cp_wrs_no_mie

WRS does not stop when mie = 0 for pending interrupt

cross lr instruction to set up reservation
mstatus.MIE = 1
mie = all 0s
mstatus.TW = 0
mip.mtip = {MSIP + MEIP + MTIP}
execute WRS.STO in M mode

WRS does not stop when interrupt pending

1 bin

Can not be tested with single core: Zawrs_wrs-nto_stall_exec

Zawrs_S

covergroup Zawrs_S

Table 338. Zawrs_S Coverpoints
Coverpoint Goal Feature Description Expectation Bins Normative Rule Status Notes

tests for single core

cp_wrs_sto_timeout

WRS.STO waits till timeout

cross lr instruction to set up reservation.
mstatus.TW = {0/1}
mstatus.MIE = 0
mstatus.SIE = 0
mie=all zeros 0 to disable interrupts
Execute WRS.STO in S mode

no exception, next instruction executes normally after WRS.STO finish execution

2 bins

Zawrs_wrs-sto_stall_duration

cp_wrs_no_res

WRS behaves as nop when no reservation is established

mstatus.TW =0
mstatus.MIE = 0
mstatus.SIE = 0
mie=all 0s to disable interrupts
Clear all reservation with sc.w, then execute {WRS.STO, WRS.NTO} with no reservation created in S mode

WRS behaves as nop

2 bins

Zawrs_all_priv_modes

TW = 1 can not be tested because the DUT may trigger illegal instruction immediately, where SAIL allows the instruction to retire successfully

cp_wrs_resume

WRS follows the rules of WFI for resuming on interrupts

cross lr instruction to set up reservation.
mstatus.TW = 0
with Sstc: sie.STIE = 1, menvcfg.STCE = 1, woken by the supervisor timer
without Sstc: mie.MTIE = 1, woken by the machine timer through T-SBI (not RVA23, which mandates Sstc)
mstatus.MIE = {0/1}
mstatus.SIE = {0/1}
Set up timer to interrupt soon
execute {WRS.NTO/WRS.STO} in S mode

WRS resumes when interrupt is pending, MIE should not affect result, trap in all cases other than in S mode with SIE = 0 (still resumes)

2 x 2 x 2 bins

Zawrs_wrs-nto_stall_exec
Zawrs_stall_terminate
Zawrs_exec_resume_rules
LA(t0, zawrs_resume_trap_handler)
csrrw t0, stvec, t0 # save old trap vector
1: wrs.nto # keep doing nto until timeout
if in S mode version of test with SIE=0 and sip.STIP, exit with success
j 1b
zawrs_resume_trap_handler:
csrr t1, scause
SIGUPD t1
csrw stvec, t0 # restore trap handler
done:
* need to use mtvec and mcause if S not supported

Not generated without a timer interrupt (needs Sstc or MTI_INTR_IMPL).

cp_wrs_nto_timeout

WRS.NTO timeout when TW = 1

cross lr instruction to set up reservation.
mstatus.TW = 1
mstatus.MIE = 0
mstatus.SIE = 0
mie=all 0s to disable interrupts
execute WRS.NTO in S mode

WRS causes illegal instruction exception when timed out if TW = 1

1

Zawrs_stall_terminate
Zawrs_priv_illegal_instr_excp
will retire or timeout with illegal instruction
* need to use mtvec and mcause if S not supported
* make sure of delegation if S is supported (part of boot code)
#ifdef UDB_ZAWRS_NTO_IS_NOP
wrs.nto
#else
LA(t0, zawrs_trap_handler)
csrrw t0, stvec, t0 # save old trap vector
1: wrs.nto # keep doing nto until timeout
j 1b
zawrs_trap_handler:
csrr t1, scause
SIGUPD t1
csrw stvec, t0 # restore trap handler
done:
#endif
Sail: Zawrs.nto.is_nop, Zawrs.sto.is_nop

cp_wrs_nto_timeout_h

WRS.NTO timeout causing virtual instruction exception in H mode

#ifdef H_SUPPORTED
cross lr instruction to set up reservation
mstatus.MIE = 0
mstatus.SIE = 0
mie=all 0s to disable interrupts
mstatus.TW = {0/1},
hstatus.VTW = 1
execute WRS.NTO in VS/VU mode
hedeleg = 0s - do not delegate exception to VS mode

WRS causes virtual instruction exception when timed out if mstatus.tw = 0

2 x 2 bins

Zawrs_virtual_instr_excp
same as above, expect illegal instruction if TW=1 and virtual instruction if TW=0 and not NOP.

cp_wrs_no_mie

cross lr instruction to set up reservation
mstatus.MIE = 1
mstatus.SIE = 1
mie = all 0s
mstatus.TW = 1
mip = {SSIP + SEIP + STIP + MSIP + MEIP + MTIP (without Sstc)}
execute WRS.NTO and WRS.STO in S mode

WRS does not stop when interrupt pending, WRS.NTO causes illegal instruction

2 bins

same as above

Can not be tested with single core:

Untested things:

norm

Since the timeout limit can be different across platforms, cannot test WRS.STO with a timer interrupt soon

Zawrs_wrs-nto_stall_exec

Zawrs_U

covergroup Zawrs_U

Table 339. Zawrs_U Coverpoints
Coverpoint Goal Feature Description Expectation Bins Normative Rule Notes

tests for single core

cp_wrs_sto_timeout

WRS.STO waits till timeout

cross lr instruction to set up reservation.
mstatus.TW = {0/1}
mstatus.MIE = 0
mstatus.SIE = 0
mie=all zeros 0 to disable interrupts
Execute WRS.STO in U mode

no exception, next instruction executes normally after WRS.STO finish execution

2 bins

Zawrs_wrs-sto_stall_duration

cp_wrs_no_res

WRS behaves as nop when no reservation is established

mstatus.TW =0
mstatus.MIE = 0
mstatus.SIE = 0
mie=all 0s to disable interrupts
Clear all reservation with sc.w, then execute {WRS.STO, WRS.NTO} with no reservation created in U mode

WRS behaves as nop

2 bins

Zawrs_all_priv_modes

TW = 1 can not be tested because the DUT may trigger illegal instruction immediately, where SAIL allows the instruction to retire successfully

cp_wrs_resume

WRS follows the rules of WFI for resuming on interrupts

cross lr instruction to set up reservation.
mstatus.TW = 0
with Sstc: sie.STIE = 1, menvcfg.STCE = 1, woken by the supervisor timer
without Sstc: mie.MTIE = 1, woken by the machine timer through T-SBI (not RVA23, which mandates Sstc)
mstatus.MIE = {0/1}
(if S supported:mstatus.SIE = {0/1})
Set up timer to interrupt soon
execute {WRS.NTO/WRS.STO} in U mode

WRS resumes when interrupt is pending, MIE should not affect result, trap in all cases other than in S mode with SIE = 0 (still resumes)

2 x 2 x 2 bins

Zawrs_wrs-nto_stall_exec
Zawrs_stall_terminate
Zawrs_exec_resume_rules

Not generated without a timer interrupt (needs Sstc or MTI_INTR_IMPL).

cp_wrs_nto_timeout

WRS.NTO timeout when TW = 1

cross lr instruction to set up reservation.
mstatus.TW = 1
mstatus.MIE = 0
mstatus.SIE = 0
mie=all 0s to disable interrupts
execute WRS.NTO in U mode

WRS causes illegal instruction exception when timed out if TW = 1

1

Zawrs_stall_terminate
Zawrs_priv_illegal_instr_excp

cp_wrs_no_mie

cross lr instruction to set up reservation
mstatus.MIE = 1
mstatus.SIE = 1
mie = all 0s
mstatus.TW = 1
mip = {SSIP + SEIP + STIP + MSIP + MEIP + MTIP (without Sstc)}
execute WRS.NTO and WRS.STO in U mode

WRS does not stop when interrupt pending, WRS.NTO causes illegal instruction

2 bins

Zawrs Normative Rules
Table 340. Zawrs Normative Rules
Normative Rule Rule Text Coverpoints

Zawrs_wrs-nto_stall_exec

The WRS.NTO and WRS.STO instructions cause the hart to temporarily stall execution in a low-power state as long as the reservation set is valid and no locally enabled interrupts at any privilege level are pending, regardless of the global interrupt enable at each privilege level.

{Zawrs_Sm_cg,Zawrs_S_cg,Zawrs_U_cg}/cp_wrs_resume, Not tested: a store from another hart needs a multi-hart configuration

Zawrs_wrs-sto_stall_duration

For WRS.STO the stall duration is bounded by an implementation defined short timeout.

{Zawrs_Sm_cg,Zawrs_S_cg,Zawrs_U_cg}/cp_wrs_sto_timeout

Zawrs_all_priv_modes

These instructions are available in all privilege modes.

{Zawrs_Sm_cg,Zawrs_S_cg,Zawrs_U_cg}/cp_wrs_no_res

Zawrs_stall_terminate

While stalled, an implementation is permitted to occasionally terminate the stall and complete execution for any reason.

Zawrs_Sm_cg/cp_wrs_resume, {Zawrs_S_cg,Zawrs_U_cg}/cp_wrs_{resume, nto_timeout}

Zawrs_exec_resume_rules

WRS.NTO and WRS.STO instructions follow the rules of the WFI instruction for resuming execution on a locally enabled pending interrupt.

{Zawrs_Sm_cg,Zawrs_S_cg,Zawrs_U_cg}/cp_wrs_resume

Zawrs_priv_illegal_instr_excp

When the TW (timeout wait) bit in mstatus is set and WRS.NTO is executed in any privilege mode other than M-mode, and it does not complete within an implementation-specific bounded time limit, the WRS.NTO instruction will cause an illegal-instruction exception.

{Zawrs_S_cg,Zawrs_U_cg}/cp_wrs_nto_timeout

Zawrs_virtual_instr_excp

When executing in VS- or VU-mode, if the VTW bit is set in hstatus, the TW bit in mstatus is clear, and the WRS.NTO does not complete within an implementation-specific bounded time limit, the WRS.NTO instruction will cause a virtual-instruction exception.

Zawrs_S_cg/cp_wrs_nto_timeout_h

UDB Parameters: None.

These tests require support for MTI and/or STI interrupts. Note that these tests can have race conditions of timeouts, timer interrupts, and spontaneous resumption, and thus may be fussy on different implementations.

B.10.15. Zama16b Misaligned Atomics

Misaligned atomics are supported by the Misaligned Atomicity Granularity. They are also exercised via Exceptions_Zaamo.

Table 341. Zama16b Coverpoints
Coverpoint Goal Feature Description Expectation Bins Normative Rule

cp_zama16b_load

Misaligned accesses are atomic

For each op in {lw, lh, lhu, lb, lbu} + {ld, lwu for RV64} + {flw for F, fld for D on RV64, flh for Zfh}:
Pick base address as multiple of 16
Issue instruction with offsets of [0, 16-size]

No misaligned load fault

Up to 11 ops * 16 offsets

Misaligned loads, stores, and AMOs to main memory regions that do not cross a naturally aligned 16-byte boundary are atomic.

cp_zama16b_store

Misaligned accesses are atomic

For each op in {sw, sh, sb} + {sd for RV64} + {fsw for F, fsd for D on RV64, fsh for Zfh}:
Pick base address as multiple of 16
Issue instruction with offsets of [0, 16-size]

No misaligned store fault

Up to 9 ops * 16 offsets

Misaligned loads, stores, and AMOs to main memory regions that do not cross a naturally aligned 16-byte boundary are atomic.

cp_zama16b_amo

Misaligned accesses are atomic

For each op in {amoswap.w, amoadd.w, amoand.w, amoor.w, amoxor.w, amomax.w, amomaxu.w, amomin.w amominu.w} + {.d flavors for RV64} + {b and h flavors for Zabha} + {amocas.w, d, q if supported}:
Pick address as multiple of 16 + offset of [0, 16-size]
Issue instruction

No misaligned store/AMO fault

Up to 39 ops * 12 offsets

Misaligned loads, stores, and AMOs to main memory regions that do not cross a naturally aligned 16-byte boundary are atomic.

Note:

This test only checks for no misaligned fault. Multimaster testing will be required to verify atomicity.

The misaligned atomicity granule applies only to F/D/Q loads and stores of at most XLEN bits, so flq/fsq (and fld/fsd on RV32) are not tested.

Table 342. Zama16b Normative Rules
Normative Rule Rule Text Coverpoints

misaligned_atomicity_granule_size

The misaligned atomicity granule PMA, defined in sec:misaligned-atomicity-granule, optionally relaxes this alignment requirement. If present, the misaligned atomicity granule PMA specifies the size of a misaligned atomicity granule, a power-of-two number of bytes. The misaligned atomicity granule PMA applies only to AMOs defined in the Zaamo, Zabha, and Zacas extensions; loads and stores defined in the base ISAs; loads and stores of no more than XLEN bits defined in the F, D, and Q extensions; the load-acquire and store-release instructions defined in the Zalasr extension; and compressed encodings of the foregoing loads and stores. For an instruction in that set, if all accessed bytes lie within the same misaligned atomicity granule, the instruction will not raise an exception for reasons of address alignment, and the instruction will give rise to only one memory operation for the purposes of RVWMO—​i.e., it will execute atomically.

Zama16b_cg/{cp_zama16b_2byte, cp_zama16b_4byte, cp_zama16b_8byte}, atomicity OUT-OF-SCOPE for single hart

Zama16b_pma_mag_req

The Zama16b extension requires MAG16 support to main memory regions.

Zama16b_cg/{cp_zama16b_2byte, cp_zama16b_4byte, cp_zama16b_8byte}, atomicity OUT-OF-SCOPE for single hart

Zama16b_mag

If the Zama16b extension is implemented, then the misaligned atomicity granule in main memory regions with both the coherence and cacheability PMAs is 16 bytes.

Zama16b_cg/{cp_zama16b_2byte, cp_zama16b_4byte, cp_zama16b_8byte}, atomicity OUT-OF-SCOPE for single hart

pma_mag_def

The misaligned atomicity granule PMA provides constrained support for misaligned AMOs. This PMA, if present, specifies the size of a misaligned atomicity granule, a naturally aligned power-of-two number of bytes. Specific supported values for this PMA are represented by MAGNN, e.g., MAG16 indicates the misaligned atomicity granule is at least 16 bytes.

Descriptive spec text with no separately testable behavior

pma_mag_insts

The misaligned atomicity granule PMA applies only to AMOs defined in the Zaamo, Zabha, and Zacas extensions; loads and stores defined in the base ISAs; loads and stores of no more than XLEN bits defined in the F, D, and Q extensions; the load-acquire and store-release instructions defined in the Zalasr extension; and compressed encodings of the foregoing loads and stores.

Zama16b_cg/{cp_zama16b_1byte, cp_zama16b_2byte, cp_zama16b_4byte, cp_zama16b_8byte}, TODO: compressed loads and stores within a 16-byte granule

pma_mag_op_within

if all accessed bytes lie within the same misaligned atomicity granule, the instruction will not raise an exception for reasons of address alignment, and the instruction will give rise to only one memory operation for the purposes of RVWMO—​i.e., it will execute atomically.

Zama16b_cg/{cp_zama16b_2byte, cp_zama16b_4byte, cp_zama16b_8byte}, atomicity OUT-OF-SCOPE for single hart

pma_mag_op_ldst

For regular loads and stores that access such a region or for which not all accessed bytes lie within the same atomicity granule, then either an exception is raised, or the access proceeds but is not guaranteed to be atomic.

Zama16b_atomic_ops

Misaligned loads, stores and AMOs to those regions that do not cross a naturally aligned 16-byte boundary are atomic.

Zama16b_cg/{cp_zama16b_2byte, cp_zama16b_4byte, cp_zama16b_8byte}, atomicity OUT-OF-SCOPE for single hart

UDB Parameters: None.

B.10.16. Sdtrig Debug Triggers

Located here because it is part of RVA23 and can function without the rest of the Debug Specification. See Section C.1 for non-RVA23 debug extensions. The suite is divided into SdtrigSm, SdtrigS, and SdtrigU suites that are essentially identical, but are run on different privilege levels and thus produce different results for coverpoints such as reading debug registers or triggering in certain modes. SdtrigSm is listed in full; the SdtrigS and SdtrigU plans below list only how they differ, and they cover the same normative rules.

Assumptions: tests run in M-mode unless otherwise specified, udb configuration file describes supported triggers and features Only support ratified version 1.0 of the spec Implies tinfo must be implemented, Mscontext not tested Triggers are not assumed to be precise, so priority and timing not tested Hit is optional and not tested Only test action=0 of breakpoint exception because external debug and trace are not required Do not test trigger types 1 (SiFive legacy), 2 (Deprecated mcontrol), 7 (tmexttrig), 8-11 (reserved), 12-14 (custom) Reset Values not tested Unless otherwise specified, test mcontrol6 with tdata1.select=match=size=chain=0 tdata1.m/s/u/vs/vu = 1/0/0/0/0 tdata1.XSL = 1/1/1 tdata3 = 0 tcontrol.mte = 1 (if TCONTROL supported) mideleg = 0 medeleg = 0 mstatus.MIE = 1 if Smstateen/Ssstateen_SUPPORTED: mstateen0.context = 1, hstateen0.context = 1 optional context registers hold 0 if they exist

Table 343. SdtrigSm Coverpoints
Coverpoint Goal Feature Description Expectation Bins Normative Rule Status Notes

Access

cp_csr_access_common

Access all Sdtrig CSRs common to all triggers
Accesses to trigger CSRs used by any of the implemented triggers must succeed
At least one trigger must be supported

For each of UDB_SDTRIG_NUM_TRIGGERS in tselect:
For i each type in {3, 4, 5, 6, 15} the trigger supports (UDB_SDTRIG_<TYPE>_SUPPORTED_TRIGGERS[tselect])
tdata1.type = i
For x register in {tdata1,tinfo}, and in {tdata2,tdata3,tcontrol,hcontext,mcontext,scontext} if UDB_x_IMPLEMENTED:
csr read, write all 1s, write all 0s, set all 1s, clear all 1s, write back initial value of each register:

WARL
illegal instruction exception on CSR access if it is not implemented by any trigger

UDB_SDTRIG_NUM_TRIGGERS * supported types (up to 5) * implemented regs (2-8) * 5 accesses

Sdtrig_num_trigs_ge1
Sdtrig_csr_mode
Sdtrig_tdata_warl
Sdtrig_disable_trig
Sdtrig_tdata1
Sdtrig_tdata1_dmode_0
Sdtrig_tdata2
Sdtrig_tdata3
Sdtrig_tinfo
Sdtrig_trigger_modes_1
Sdtrig_scontext_data
Sdtrig_mcontext_hcontext_data
Sdtrig_mcontrol6
Sdtrig_icount
Sdtrig_itrigger
Sdtrig_itrigger_access
Sdtrig_etrigger
Sdtrig_etrigger_access
Sdtrig_textra32
Sdtrig_textra64

comments on test results: No exceptions. Tcontrol and mscontext not implemented on spike

Note: Use CSRW/CSRR to access registers in all modes

Native Triggers: breakpoint delegation from S/U-mode is tested in SdtrigS and SdtrigU (cp_breakpoint_delegate_s/u)

A Extension

Repeat for each of UDB_SDTRIG_NUM_TRIGGERS if UDB_SDTRIG_MCONTROL6_SUPPORTED_TRIGGERS[i]:
tselect = i

cp_lrsc_addr

lr instructions are loads
sc instructions are stores

if ZALRSC_SUPPORTED
tdata2 = {scratch/0}
tdata1.select = 0 (adr)
tdata1.XSL = {100/010/001}
if RV32:
Perform LR.W, SC.W 0x12345678 to scratch
if RV64:
Perform LR.D, SC.D 0x123456789ABCDEF0 to scratch

Breakpoint exception when mem access address matches tdata2 and
- sc is performed while Store = 1 or
- lr is performed while Load = 1

if RV32:
2 address * 3 XSL * 2 ops
if RV64:
2 address * 3 XSL * 4 ops

Sdtrig_Aext_lr_op
Sdtrig_Aext_sc_op

cp_lrsc_data

lr instructions are loads
sc instructions are stores

if ZALRSC_SUPPORTED
tdata1.select = 1 (data)
tdata1.XSL = {100/010/001}
if RV32:
tdata2 = {0x12345678/0}
Perform LR.W, SC.W 0x12345678 to scratch
if RV64:
tdata2 = {0x123456789ABCDEF0/0}
Perform LR.D, SC.D 0x123456789ABCDEF0 to scratch

Breakpoint exception when mem access data matches tdata2 and
- sc is performed while Store = 1 or
- lr is performed while Load = 1

2 tdata2 * 3 XSL * 2 ops (lr/sc of XLEN width; size=0 data matches are defined only for XLEN-wide accesses)

Sdtrig_Aext_lr_op
Sdtrig_Aext_sc_op

cp_amo

Amo is a load for the read portion and a store for the write portion

if ZAAMO_SUPPORTED
tdata2 = {scratch/0}
tdata1.select = 0 (adr)
tdata1.XSL = {100/010/001}
Perform each AMO (amoswap/add/and/or/xor/max/maxu/min/minu .w, and .d if RV64) to scratch with rd != x0

Breakpoint exception if load or store are set and the access address matches tdata2

2 address * 3 XSL * 9 (RV64 18) AMOs

Sdtrig_AMO_read
Sdtrig_AMO_read_addr
Sdtrig_AMO_store
Sdtrig_AMO_store_addr

Notes:
UNSPECIFIED whether failing SC instructions are stores; do not test.
UNSPECIFIED whether amo’s match on data: do not test

Combined Accesses

Repeat for each of UDB_SDTRIG_NUM_TRIGGERS if UDB_SDTRIG_MCONTROL6_SUPPORTED_TRIGGERS[i]:
tselect = i

UDB_VECTOR_SEW

cp_vector_load_store

Accesses match as if it performed a load/store of size SEW

if ZVL32B_SUPPORTED
tdata2 = {scratch/0}
tdata1.size = {0/1/2/3/4/5/6} (each size in UDB_SDTRIG_MCONTROL6_SIZE_LEGAL_VALUES of at most XLEN bits, which Sail 0.16 supports)
tdata1.select = 0 (adr)
tdata1.XSL = {010/001}
Vsetivli x0, 1, e{8/16/32/64}, m4, ta, ma (e64 only if ZVE64X_SUPPORTED)
Perform v{l/s}e{8/16/32/64}.v to scratch

Breakpoint exception if the tdata2 matches a address in the vector store and tdata1.size = SEW or 0

2 address * legal sizes (up to 7) * 4 SEW * 2 ops

Sdtrig_mult_mem_access

cp_vector_accesses

Accesses match as if happened individually

if ZVL32B_SUPPORTED
tdata2 = {scratch/scratch+8/0}
tdata1.select = 0 (adr)
tdata1.XSL = {010/001}
Vsetivli x0, {1/9}, e{8/16/32/64}, m4, ta, ma (e64 only if ZVE64X_SUPPORTED)
Perform v{l/s}e{8/16/32/64}.v to scratch

Breakpoint exception if the tdata2 = scratch
Breakpoint exception when tdata2 = scratch+8 and vl reaches it (AVL 9; vl = VLMAX < 9 for e64 at VLEN 128)

3 address * 2 Vector Lengths * 4 SEW * 2 ops

Sdtrig_mult_mem_access

cp_vector_mask

Masked vector operations do not match

if ZVL32B_SUPPORTED
tdata2 = {scratch+8}
tdata1.select = 0 (adr)
tdata1.XSL = {010/001}
Vsetivli x0, 9, e{8/16/32/64}, m4, ta, mu (e64 only if ZVE64X_SUPPORTED)
v0 = mask with the element at scratch+8 {active/inactive}
Perform v{l/s}e{8/16/32/64}.v to scratch, v0.t

Breakpoint exception when the element at tdata2 is active
No breakpoint exception when the element at tdata2 is masked off

2 mask states * 4 SEW * 2 ops

Sdtrig_mult_mem_access

cp_cm_pop_push (not generated)

Accesses match as if happened individually

if ZCMP_SUPPORTED
if RV32:
tdata2 = {scratch/scratch + 8/scratch + 12/scratch + 16}
if RV64:
tdata2 = {scratch/scratch + 8/scratch + 16}
tdata1.select = 0 (adr)
tdata1.XSL = {100/010/001}
tdata1.size = {0,1,2,3,4,5,6}
sp = scratch+16
cm.push {ra, s0}, -16
cm.pop{ra, s0}, 16

Breakpoint exception if the tdata2 matches mem address, store/load = 1, tdata1.size = XLEN or 0

3 address * 3 XSL * 7 sizes * 2 ops

Sdtrig_mult_mem_access

Not generated until the Sail reference model supports Zcmp: Sail 0.16 has no Zcmp extension (model/core/extensions.sail has no Ext_Zcmp; riscv/sail-riscv#730 adds it and is open), and no CI configuration claims both Zcmp and Sdtrig. With #730, cm.push and cm.pop make one vmem_write or vmem_read per register, which Sail’s per-access trigger matching (model/sys/vmem_utils.sail) checks individually

Cache Operations

Repeat for each of UDB_SDTRIG_NUM_TRIGGERS if UDB_SDTRIG_MCONTROL6_SUPPORTED_TRIGGERS[i]:
tselect = i

Sdtrig_caches_stores_1
Sdtrig_caches_stores_2
Sdtrig_caches_stores_3

cp_cache_zicbom

cbo.clean, cbo.flush, and cbo.inval match as if they are stores

if ZICBOM_SUPPORTED
tdata2 = {scratch/scratch-1/scratch+block/0}
tdata1.select ={0/1} (1 if UDB_SDTRIG_MCONTROL6_SELECT_WRITABLE)
tdata1.size = {0/1/2/3/4/5/6} (legal sizes of at most XLEN bits)
tdata1.XSL = {100/010/001}
Perform CBO.{CLEAN/FLUSH/INVAL} to {scratch}

Breakpoint exception when tdata2 = scratch and store = 1 and size = 0 and select = 0

4 addrs * 2 selects * legal sizes (up to 7) * 3 XSL * 3 ops

Sdtrig_caches_stores_1
Sdtrig_caches_stores_2
Sdtrig_caches_stores_3
Sdtrig_cache_compare
Sdtrig_cache_compare_opts
Sdtrig_cache_clears

cp_cache_zicboz

cbo.zero matches as if it is a store

if ZICBOZ_SUPPORTED
tdata2 = {scratch/scratch-1/scratch+block/0}
tdata1.select ={0/1} (1 if UDB_SDTRIG_MCONTROL6_SELECT_WRITABLE)
tdata1.size = {0/1/2/3/4/5/6} (legal sizes of at most XLEN bits)
tdata1.XSL = {100/010/001}
Perform CBO.ZERO to scratch

Breakpoint exception when tdata2 = scratch and store = 1 and size = 0 and select = 0

4 addrs * 2 selects * legal sizes (up to 7) * 3 XSL

Sdtrig_caches_stores_1
Sdtrig_caches_stores_2
Sdtrig_caches_stores_3
Sdtrig_cache_compare
Sdtrig_cache_compare_opts
Sdtrig_cbo_zero

cp_cache_zicbop

The prefetch instructions don’t match at all.

if ZICBOP_SUPPORTED
tdata2 = {scratch/0}
tdata1.select ={0/1} (adr)
tdata1.size = 0
tdata1.XSL = 011
Perform PREFETCH.{i/r/w} to scratch

No exceptions

2 values * 2 selects * 3 ops

Sdtrig_cache_hints
Sdtrig_prefetch

Address Matches

cp_tdata2_translate

tdata2 can hold valid addresses in all supported translation modes

For each of UDB_SDTRIG_NUM_TRIGGERS in tselect if UDB_SDTRIG_MCONTROL6_SUPPORTED_TRIGGERS[i]:
tdata1 = mcontrol6, select = 0, match = 0, execute = 1, m/s/u/vs/vu = 0 (never fires)
satp.MODE = Bare: CSRW tdata2 = largest PA (2^min(PHYS_ADDR_WIDTH, XLEN) - 1)
for each mode in {Sv39, Sv48, Sv57 on RV64, Sv32 on RV32} if supported:
satp.MODE = mode (root table), CSRW tdata2 = {largest VA with the sign bit clear, smallest VA with it set},
e.g. Sv39 0x0000003FFFFFFFFF, 0xFFFFFFC000000000
CSRR tdata2 after each write

Read value matches written
VAs are sign-extended and PAs zero-extended

NTRIG * (1 + 2 * supported VA modes)

Sdtrig_tdata2_addr_sz1
Sdtrig_pmem
Sdtrig_vmem
Sdtrig_csr_tdata2_sz2

cp_tdata2_translate_exec

An execute trigger matches the virtual address of a translated fetch, not its physical address

if S_SUPPORTED, for each mode in {Sv39, Sv48, Sv57 on RV64, Sv32 on RV32} if supported:
map the superpage holding a target (nop; jr ra) a second time at the last root slot (a negative VA),
satp.MODE = mode, medeleg[3] = 0
For each of UDB_SDTRIG_NUM_TRIGGERS in tselect if UDB_SDTRIG_MCONTROL6_SUPPORTED_TRIGGERS[i]:
tdata1 = mcontrol6, select = 0, execute = 1, s = 1
tdata2 = {target VA in the alias, target PA (also its identity-mapped VA)}
in S-mode, call the target at its alias VA
After each case, rvtest_trap_count is written to the signature.

Breakpoint into M with mepc = the alias VA iff tdata2 = VA

NTRIG * supported VA modes * 2

Sdtrig_vmem
Sdtrig_csr_tdata2_sz2

Trigger Module Registers

cp_tdata_write

Writes to one tdata register must not modify the contents of other tdata registers. Note: type 15 allow any supported value to be written to tdata2/3

For each of UDB_SDTRIG_NUM_TRIGGERS in tselect
tdata1.type = 15
For reg_x in {tdata1, tdata2, tdata3}:
Write all register = 0 (mask tdata1.type)
Read all registers
Write reg_x all 1’s
Read other 2 registers
Then, with trigger 0 disabled (tdata1.type = 15, tdata2 = scratch if it supports mcontrol6):
For reg_x in {tdata1, tdata2, tdata3} of trigger 1:
Read tdata1/2/3 of trigger 0
Select trigger 1, tdata1.type = 15, write reg_x all 0s, then all 1’s
Select trigger 0, read tdata1/2/3 again (each before ^ after is recorded)

No exceptions
Writing one tdata register does not change another
Writing the tdata registers of trigger 1 does not change those of trigger 0

3

Sdtrig_tdata_write
Sdtrig_disable_trig
Sdtrig_tdata1_write0
Sdtrig_tdata1_type_disabled
Sdtrig_tdata2_disabled
Sdtrig_tdata3_disabled

coverpoint drafted: 9/10
coverpoint reviewed: 9/10

cp_csr_access_global

The Trigger Module registers, except scontext, and hcontext, are only accessible in machine and Debug Mode

For x register in {tselect, and tcontrol, mcontext, scontext, hcontext if UDB_x_IMPLEMENTED}:
csr write all 0s, write all 1s

No exceptions
All registers can be accessed from M-mode

1 + implemented global registers, * 2 values

Sdtrig_trigger_modes
Sdtrig_trigger_modes_1
Sdtrig_scontext_access
Sdtrig_mcontext_access
Zicsr_debug_range

coverpoint drafted: 9/10
coverpoint reviewed: 9/10

cp_csr_access_local

The Trigger Module registers are only accessible in machine and Debug Mode

each of UDB_SDTRIG_NUM_TRIGGERS in tselect:
For x register in {tdata1, tdata2, tdata3, tinfo}:
tdata1 = 0 (disabled), csr write all 0s, write all 1s
if the trigger supports mcontrol6: with tdata1 = 0, CSRW tdata2 = scratch, CSRR tdata2

No exceptions
All registers can be accessed from M-mode
A disabled trigger reads tdata2 = tdata3 = 0 after writing 0, and keeps tdata2 = scratch, an address mcontrol6 supports

NUM_TRIGGERS * 4 regs * 2 values

Sdtrig_tdata_warl
Sdtrig_disable_trig
Sdtrig_trigger_modes
Sdtrig_tdata2_disabled
Zicsr_debug_range

cp_tselect_trigs

The set of triggers must start at 0 and be contiguous

For tselect = 0 to UDB_SDTRIG_NUM_TRIGGERS -1
CSRR tselect, CSRR tinfo
check tinfo.info != 1 and tinfo bits 3-6 against UDB_SDTRIG_<TYPE>_SUPPORTED_TRIGGERS[tselect]
if the trigger supports mcontrol6: check tinfo.version >= 1

No exceptions
tselect reads back the index
tinfo.info != 1 for all trigger < NUM_TRIGGERS
tinfo.info bits 3-6 are set exactly for the types the trigger supports
tinfo.version >= 1 on every trigger that supports mcontrol6

NUM_TRIGGERS

Sdtrig_num_trigs_ge1
Sdtrig_tselect
Sdtrig_tselect_access
Sdtrig_tinfo_version
Sdtrig_tinfo_support
Sdtrig_mcontrol6_dependence

coverpoint drafted: 9/10
coverpoint reviewed: 9/10

cp_tselect_nonexistent

A nonexistent trigger reads tinfo.info = 1 and tdata1 = 0

CSRW tselect = UDB_SDTRIG_NUM_TRIGGERS (the first unimplemented index), CSRR tselect
if tselect kept the index: CSRW tdata1 with dmode = 1, CSRR tinfo, CSRR tdata1

tselect is WARL and may hold another index (Sail 0.16 reads UDB_SDTRIG_NUM_TRIGGERS - 1, Spike, Whisper,
Imperas and QEMU keep the old index); only when it keeps the nonexistent index:
tinfo.info = 1, and tdata1 = 0 (type 0, with dmode and data hard-wired to 0)

1

Sdtrig_tdata1_dmode_type_0
Sdtrig_tdata1_data
Sdtrig_tinfo_no_trigger

cp_tdata1_mode_hardwired

Non supported mode bits are hardwired zero

For each of UDB_SDTRIG_NUM_TRIGGERS in tselect:
enable all priv bits (tdata1.m/s/u/vs/vu = 11111) with tdata1.type = 6
CSRR tdata1 and check type and tdata1.m/s/u/vs/vu: each bit that UDB_SDTRIG_<MODE>_WRITABLE makes writable, and
each bit of a mode the hart lacks (a non-writable bit of an implemented mode is not checked: Sail cannot model it)

Writable mode bits read back 1 and the bits of modes the hart lacks read back 0 after writing all-ones

NTRIGGERS

Sdtrig_mcontrol6_vs
Sdtrig_mcontrol6_vu
Sdtrig_mcontrol6_s
Sdtrig_mcontrol6_u

coverpoint drafted: 9/10
coverpoint reviewed: 9/10

cp_tdata1_dmode

dmode is writable only from Debug Mode

For each of UDB_SDTRIG_NUM_TRIGGERS in tselect, for each supported type in {icount, mcontrol6}:
CSRW tdata1 with dmode = 1 and that type (icount: count = 1, m = 0; mcontrol6: m = 1, XSL = 000, so neither fires)
CSRR tdata1 and check dmode

dmode reads back 0 after an M-mode write of 1

NTRIGGERS * 2 types

Sdtrig_tdata1_dmode_writable

cp_tinfo_read_only

Writing tinfo has no effect

For each of UDB_SDTRIG_NUM_TRIGGERS in tselect:
CSRR tinfo,
CSRW 0’s and 1’s to tinfo,
CSRR tinfo

Writing tinfo has no effect
Supported trigger types have bits enabled in tinfo.info

NTRIGGERS

Sdtrig_tinfo_support

coverpoint drafted: 9/10
coverpoint reviewed: 9/10

cp_csr_unimplemented

Accessing a trigger CSR that the hart does not implement raises an illegal instruction exception

For x in {tdata2, tdata3, tcontrol, mcontext, scontext, hcontext} if not UDB_x_IMPLEMENTED:
csrr x, csrw x from M-mode

Illegal instruction exception on every access

unimplemented optional CSRs * 2 accesses (none on a hart with all of them)

Sdtrig_unimp_csr_illegal
Sdtrig_unimplemented_register
Sdtrig_hcontext_implemented

Trigger Control

cp_tcontrol_enable

tcontrol.mte enables debug triggers in M-mode

if UDB_TCONTROL_IMPLEMENTED and SDTRIG_BREAKPOINT_REENTRANCY = Use_tcontrol
For each of UDB_SDTRIG_NUM_TRIGGERS in tselect if UDB_SDTRIG_MCONTROL6_SUPPORTED_TRIGGERS[i]:
tdata1 = mcontrol6, execute = 1, m = 1, tdata2 = PC of add x0, x1, x2
tcontrol.mte = {0/1}
perform add x0, x1, x2
After each case, rvtest_trap_count is written to the signature.

Breakpoint exception when mte = 1; none when mte = 0

NTRIG * 2 mte

Sdtrig_tcontrol_mte_disabled
Sdtrig_tcontrol_mte_enabled

cp_tcontrol_mtrap

tcontrol.mte/mpte on trap into M-mode

if UDB_TCONTROL_IMPLEMENTED
tcontrol.mpte = {0/1}
tcontrol.mte = {0/1}
trap to M-mode (perform the illegal instruction csrrw x0, mvendorid, x0)
CSRR tcontrol after the trap handler returns with mret

When M-mode trap taken, mpte is set to mte, mte is set = 0
The handler’s mret then sets mte = mpte, so tcontrol holds the old mte in both fields
(only mpte = old mte is observable here; cp_icount_trap_fire observes mte = 0 in the handler with Use_tcontrol)

2 mpte * 2 mte

Sdtrig_tcontrol_mpte
Sdtrig_tcontrol_mte

cp_tcontrol_mret

tcontrol.mte on mret

if UDB_TCONTROL_IMPLEMENTED
tcontrol.mpte = {0/1}
tcontrol.mte = {0/1}
perform mret with mstatus.MPP = M
CSRR tcontrol

When mret is executed, mte is set to the value of mpte; mpte is unchanged.

2 mpte * 2 mte

Sdtrig_tcontrol_mte_mret

Mcontrol (type 2): deprecated and not tested

Mcontrol6 tests: test fire and don’t fire for each scenario

Repeat for each of UDB_SDTRIG_NUM_TRIGGERS if UDB_SDTRIG_MCONTROL6_SUPPORTED_TRIGGERS[i]:
tselect = i
tdata1 = 0
write tdata2 and tdata3 as necessary
tdata3 = 0 unless otherwise specified (textra = 0, controls context matching)
tdata1.type = 6 (mcontrol6)
tdata1.dmode = 0 (M-mode accessible)
tdata1.action = 0 (breakpoint)
tdata1.uncertainen = 0 (exact match)
unless otherwise specified:
tdata1.m/s/u/vs/vu = (1 for current mode, e.g. 1 in m)
tdata1.select = 0 (adr)
tdata1.size = 0 (any)
tdata1.chain = 0 (disabled)
tdata1.match = 0 (equal)
Perform an instruction that causes trigger to fire/not fire

cp_mcontrol6_priv_mode

tdata2 = {scratch}
tdata1.select = 0 (adr)
tdata1.XSL= 010
tdata1.m/s/u = {000/100/011} (none, m only, s and u only)
Perform SW to scratch

Breakpoint exception on instruction if tdata1.m = 1; none when only s/u are set

2 m (the s/u-only case falls in the m = 0 bin)

Sdtrig_action0
Sdtrig_mcontrol6_access
Sdtrig_mcontrol6_m

comments on test results: Exceptions when m.1

cp_mcontrol6_execute_adr

tdata2 = {PC address of add x0, x1, x2/0}
tdata1.select = 0 (adr)
tdata1.XSL = 8 combinations
perform add x0, x1, x2

Breakpoint exception on PC of add x0, x1, x2 if tdata2 points to it and tdata1.execute = 1

2 values * 8 XSL

Sdtrig_mcontrol6_breakpoint
Sdtrig_mcontrol6_faulting_address
Sdtrig_mcontrol6_select_address
Sdtrig_mcontrol6_execute
Sdtrig_mcontrol6_store
Sdtrig_mcontrol6_load

comments on test results: Exceptions on triggers when execute = 1

cp_mcontrol6_load_store_adr

tdata2 = {scratch/scratch+8/0}
tdata1.select = 0 (adr)
tdata1.XSL = 8 combinations
perform {SW/ LW 0x12345678} to scratch + {0/8}

Breakpoint exception on LW if access address matches tdata2 and tdata1.load = 1
Breakpoint exception on SW if access address matches tdata2 and tdata1.store = 1

3 addresses * 8 XSL * 2 ops * 2 offsets

Sdtrig_mcontrol6_breakpoint
Sdtrig_mcontrol6_faulting_address
Sdtrig_mcontrol6_select_address
Sdtrig_mcontrol6_execute
Sdtrig_mcontrol6_store
Sdtrig_mcontrol6_load

comments on test results: Exceptions when XSL = 2 or 1 when tdata2 = scratch

cp_mcontrol6_execute_data

tdata2 = {addi x0, x1, 0 opcode (0x00008013)/0x2}
tdata1.select = 1 (data)
tdata1.XSL = 8 combinations
perform addi x0, x1, 0
(not nop, whose opcode also appears in the test environment’s own code; no instruction in the test encodes as 0x2)
on RV64, size = 0 with a 32-bit instruction relies on the zero-extension in Sdtrig_mcontrol6_select_data

Breakpoint exception on fetched instruction if tdata2 matches opcode and tdata1.execute = 1

2 values * 8 XSL

Sdtrig_mcontrol6_select_data
Sdtrig_mcontrol6_execute
Sdtrig_mcontrol6_store
Sdtrig_mcontrol6_load

comments on test results: Exceptions when tdata2 = 0x00008013, and execute = 1

cp_mcontrol6_load_store_data

tdata2 = {random XLEN-wide value / the same value with bit 0 (RV32) or bit 32 (RV64) flipped}
tdata1.select = 1 (data)
tdata1.XSL = 8 combinations
perform {SW/LW (RV32), SD/LD (RV64)} of the value to scratch
(XLEN-wide accesses: with size = 0 a data match is only well-defined when the access size is XLEN)

Breakpoint exception on the load if access data matches tdata2 and tdata1.load = 1
Breakpoint exception on the store if access data matches tdata2 and tdata1.store = 1

8 XSL * 2 ops (tdata2 values not binned because the data a load reads is not visible to coverage)

Sdtrig_mcontrol6_select_data
Sdtrig_mcontrol6_execute
Sdtrig_mcontrol6_store
Sdtrig_mcontrol6_load

comments on test results: Exceptions when td2 = the stored value, and XSL = 1/2/3

cp_mcontrol6_execute_size

tdata2 = {addi x0, x1, 0 opcode/c.nop opcode}
tdata1.select = 1 (data)
tdata1.XSL = 111
tdata1.size = {0/1/2/3/4/5/6} (legal sizes of at most XLEN bits)
perform addi x0, x1, 0
if ZCA_SUPPORTED
perform c.nop
size = 0 with c.nop, or with addi on RV64, relies on the zero-extension in Sdtrig_mcontrol6_select_data

Breakpoint exception if the size of the instruction matches the trigger size in mcontrol6 and tdata1.execute = 1

2 values * legal sizes (up to 7) * 2 ops

Sdtrig_mcontrol6_size_any
Sdtrig_mcontrol6_size_8bit
Sdtrig_mcontrol6_size_16bit
Sdtrig_mcontrol6_size_32bit
Sdtrig_mcontrol6_size_48bit
Sdtrig_mcontrol6_size_64bit

comments on test results: Exceptions when td2 = op, size = 0. Note: warls size to zero

cp_mcontrol6_execute_adr_size

A select = 0 execute trigger with size = N matches only the execution of an N-bit instruction

tdata2 = {PC of addi x0, x1, 0 / PC of c.nop}
tdata1.select = 0 (adr)
tdata1.XSL = 100
tdata1.size = {1/2/3/4/5} (legal sizes of at most XLEN bits)
perform addi x0, x1, 0 (sizes 1, 3, 4, 5)
if ZCA_SUPPORTED
perform c.nop (sizes 1, 2, 4, 5)
Not generated: size 2 on addi and size 3 on c.nop, which Sail 0.16 fires (sail-riscv#2033)

Breakpoint exception for size 2 on c.nop and size 3 on addi; none for sizes 1, 4 and 5

NTRIG * legal (size, instruction) pairs (up to 8)

Sdtrig_mcontrol6_size_8bit
Sdtrig_mcontrol6_size_16bit
Sdtrig_mcontrol6_size_32bit
Sdtrig_mcontrol6_size_48bit
Sdtrig_mcontrol6_size_64bit

cp_mcontrol6_load_store_size

tdata2 = {scratch/0}
tdata1.select = 0 (adr)
tdata1.XSL = 011
tdata1.size = {0/1/2/3/5} (legal sizes of at most XLEN bits)
perform {lb/lbu/lh/lhu/lw/sb/sh/sw} to scratch with a random value
if RV64 supported, also perform {lwu/ld/sd}
if F_SUPPORTED, also perform {flw/fsw}
if D_SUPPORTED, also perform {fld/fsd}
if ZFH_SUPPORTED, also perform {flh/fsh}
if Q_SUPPORTED, also perform {flq/fsq}
if ZCA_SUPPORTED, also perform c.{lw/sw/lwsp/swsp}
if ZCA_SUPPORTED and RV64, also perform c.{ld/sd/ldsp/sdsp}
if ZCB_SUPPORTED, also perform c.{lbu/lh/lhu/sb/sh}
if ZCF_SUPPORTED and RV32, also perform c.{flw/flwsp/fsw/fswsp}
if ZCD_SUPPORTED, also perform c.{fld/fldsp/fsd/fsdsp}

Breakpoint exception if the size of the memory access matches the trigger size in mcontrol6

2 values * legal sizes (up to 5) * up to 36 instructions

Sdtrig_mcontrol6_size_any
Sdtrig_mcontrol6_size_8bit
Sdtrig_mcontrol6_size_16bit
Sdtrig_mcontrol6_size_32bit
Sdtrig_mcontrol6_size_64bit
Sdtrig_mcontrol6_size_support

Sizes 4 (48-bit) and 6 (128-bit) are not tested; size 6 is never written (Sail 0.16 disables sizes above XLEN)

cp_mcontrol6_match

Test boundaries for match conditions

tdata1.select = 1 (data)
tdata1.XSL= 010
tdata1.match = {0/2/3/8} (each value in UDB_SDTRIG_MCONTROL6_MATCH_LEGAL_VALUES)
if RV32:
tdata2 = {0x12345678}
perform SW{0x0},{0x12345678-1} {0x12345678},{0x12345678+1},{0xFFFFFFFF} to scratch
if RV64:
tdata2 = {0x123456789ABCDEF0}
perform SD{0x0},{0x123456789ABCDEF0-1} {0x123456789ABCDEF0},{0x123456789ABCDEF0+1},{0xFFFFFFFFFFFFFFFF} to scratch

Breakpoint exception if the store data meets the condition set by tdata1.match

legal matches (up to 4) * 5 ops

Sdtrig_mcontrol6_match_equal
Sdtrig_mcontrol6_match_ge
Sdtrig_mcontrol6_match_lt
Sdtrig_mcontrol6_match_not_equal

cp_mcontrol6_match_napot

tdata1.select = 1 (data)
tdata1.XSL= 010
tdata1.match = {1/9} (each value in UDB_SDTRIG_MCONTROL6_MATCH_LEGAL_VALUES)
if RV32:
tdata2 = 0xFFFFFFFF
for x in 0:min(UDB_SDTRIG_MCONTROL6_MASKMAX6, XLEN-1)-1 tdata2[x] = 0 (legal NAPOT sizes only)
perform SW{0x0}, {0x12345678}, {0xFFFFFFFF} to scratch
if RV64:
tdata2 = 0xFFFFFFFFFFFFFFFF
for x in 0:min(UDB_SDTRIG_MCONTROL6_MASKMAX6, XLEN-1)-1 tdata2[x] = 0 (legal NAPOT sizes only)
perform SD{0x0}, {0x123456789ABCDEF0},{0xFFFFFFFFFFFFFFFF} to scratch

Breakpoint exception if the store data meets the condition set by tdata1.match
(zero bit x is a NAPOT range of 2^(x+1) bytes, so every range from 2^1 to 2^min(maskmax6, XLEN-1) is tested)

legal matches (up to 2) * min(UDB_SDTRIG_MCONTROL6_MASKMAX6, XLEN-1) values * 3 ops

Sdtrig_mcontrol6_napot_range
Sdtrig_mcontrol6_match_napot
Sdtrig_mcontrol6_match_napot_legal
Sdtrig_mcontrol6_match_not_napot

cp_mcontrol6_napot_allones

An all-ones write to bits maskmax6-1:0 of tdata2 clears bit maskmax6-1

if UDB_TDATA2_IMPLEMENTED and UDB_SDTRIG_MCONTROL6_MASKMAX6 < XLEN
For each of UDB_SDTRIG_NUM_TRIGGERS if UDB_SDTRIG_MCONTROL6_SUPPORTED_TRIGGERS[i]:
for match = {1/9} (each value in UDB_SDTRIG_MCONTROL6_MATCH_LEGAL_VALUES):
CSRW tdata1 = 0, CSRW tdata2 = 0, CSRW tdata1 = mcontrol6 with that match, XSL = 000 (never fires)
CSRW tdata2 = all ones, CSRR tdata2
Runs in SdtrigSm only (the legalization does not depend on the mode the CSRs are written from)

Bit maskmax6-1 of tdata2 reads 0; only that bit is signed (bits maskmax6-2:0 are UNSPECIFIED)

NTRIG * legal matches (up to 2)

Sdtrig_mcontrol6_match_napot_mask

cp_mcontrol6_match_mask

tdata1.select = 1 (data)
tdata1.XSL= 010
tdata1.match = {4/5/12/13} (each value in UDB_SDTRIG_MCONTROL6_MATCH_LEGAL_VALUES)
tdata2[XLEN-1:XLEN/2] is the mask and tdata2[XLEN/2-1:0] the value
if RV32:
tdata2 = {0xF0F0_A0B0}
perform SW{0x0}, {0xF0F0_A0B0}, {0xFFFFFFFF},
low half {0x0000_A0B0}, {0x0000_A1B2}, {0x0000_F0F0}, {0x0001_A0B0},
high half {0xA0B0_0000}, {0xA1B2_0000}, {0xF0F0_0000}, {0xA0B0_0001} to scratch
if RV64:
tdata2 = {0xF0F0F0F0_A0B0C0D0}
perform SD{0x0}, {0xF0F0F0F0_A0B0C0D0}, {0xFFFFFFFFFFFFFFFF},
low half {0x00000000_A0B0C0D0}, {0x00000000_A1B2C3D4}, {0x00000000_F0F0F0F0}, {0x00000001_A0B0C0D0},
high half {0xA0B0C0D0_00000000}, {0xA1B2C3D4_00000000}, {0xF0F0F0F0_00000000}, {0xA0B0C0D0_00000001} to scratch
in each half: the value, differs only outside the mask, differs inside the mask, the value with the other half nonzero

Breakpoint exception if the store data meets the condition set by tdata1.match

legal matches (up to 4) * 11 values

Sdtrig_mcontrol6_match_mask_low
Sdtrig_mcontrol6_match_mask_high
Sdtrig_mcontrol6_match_not_mask_low
Sdtrig_mcontrol6_match_not_mask_high

MControl6 Chain

Repeat for each of UDB_SDTRIG_NUM_TRIGGERS if UDB_SDTRIG_MCONTROL6_SUPPORTED_TRIGGERS[i] and UDB_SDTRIG_MCONTROL6_SUPPORTED_TRIGGERS[i+1]:
tselect = i
write tdata2 and tdata3 as necessary
tdata3 = 0 unless otherwise specified (textra = 0, controls context matching)
tdata1.type = 6 (mcontrol6)
tdata1.dmode = 0 (M-mode accessible)
tdata1.action = 0 (breakpoint)
tdata1.uncertainen = 0 (exact match)
unless otherwise specified:
tdata1.m/s/u/vs/vu = (1 for current mode, e.g. 1 in m)
tdata1.select = 0 (adr)
tdata1.size = 0 (any)
tdata1.chain = 0 (disabled)
tdata1.match = 0 (equal)
Perform an instruction that causes trigger to fire/not fire

cp_mcontrol6_chain_adr

Trigger i (Tselect = i):
tdata1.select = 0 (address)
tdata1.chain = 1
tdata2 = {scratch}
Trigger i+1 (Tselect = i + 1):
tdata1.select = 1 (data)
tdata1.chain = 0
tdata2 = {random XLEN-wide value}
tdata1.XSL = 010
perform SW (RV32) / SD (RV64) {the value/0} to {scratch/scratch+8} (XLEN-wide, as size = 0 needs)
only if UDB_SDTRIG_MAX_CHAIN_LENGTH >= 2

Breakpoint exception from final trigger in chain if all triggers match simultaneously

2 store values * 2 addresses

Sdtrig_mcontrol6_chain
Sdtrig_mcontrol6_chained_faulting
Sdtrig_mcontrol6_chain_disabled
Sdtrig_mcontrol6_chain_enabled
Sdtrig_mcontrol6_chain_start

comments on test results: Be careful of order when setting up chain, enable chain last

cp_mcontrol6_chain_long

A chain longer than 2 fires only when every trigger in it matches

For each length L in 3 to UDB_SDTRIG_MAX_CHAIN_LENGTH if triggers 0 to L-1 support mcontrol6:
Triggers 0 to L-1, configured in order: tdata1.select = 0 (address), tdata1.XSL = 010,
tdata1.chain = 1 on triggers 0 to L-2 and 0 on trigger L-1
tdata2 = scratch on every trigger, or scratch+8 on one of them (L+1 cases)
perform SW (RV32) / SD (RV64) to scratch
After each case, rvtest_trap_count is written to the signature.

Breakpoint exception only when every trigger in the chain matches

chain lengths * {fired, not fired}

Sdtrig_mcontrol6_chain
Sdtrig_mcontrol6_chain_enabled
Sdtrig_mcontrol6_chain_start

cp_mcontrol6_size_data

With select = 1 and size = N, a store trigger compares only the N bits the store writes

For each of UDB_SDTRIG_NUM_TRIGGERS if UDB_SDTRIG_MCONTROL6_SUPPORTED_TRIGGERS[i] and SELECT_WRITABLE:
tdata1.select = 1 (data), tdata1.XSL = 010
tdata1.size = {1/2/3/5} (legal sizes; 5 on RV64 only), tdata2 = an N-bit value (zero-extended)
perform {sb/sh/sw/sd} of a register whose low N bits are {the value / the value with bit 0 flipped} and
whose other bits are set, a store of another width of the value, and the next wider store (sh/sw/sd; RV64 for
sd) of the value with no other bits set, which writes tdata2 zero-extended
for size = {2/3/5}: tdata2 = a value that fits in the next narrower store, and a store of size N and the narrower
store (sb/sh/sw) of that value with no other bits set
After each case, rvtest_trap_count is written to the signature.

Breakpoint exception only for the store of size N whose low N bits equal tdata2 (not for the wider or narrower
store, whose data equals tdata2 zero-extended but whose size differs)
tdata2 bits above N are not tested: Sail 0.16 compares the zero-extended access data with all of tdata2

NTRIG * legal sizes (up to 4) * 3 cases (the wider and narrower stores fall in the other-width bin)

Sdtrig_mcontrol6_select_data
Sdtrig_mcontrol6_size_8bit
Sdtrig_mcontrol6_size_16bit
Sdtrig_mcontrol6_size_32bit
Sdtrig_mcontrol6_size_64bit
Sdtrig_mcontrol6_comparisons

cp_mcontrol6_match_size_store

Every legal match crossed with every legal size on a select = 1 store trigger

For each of UDB_SDTRIG_NUM_TRIGGERS if UDB_SDTRIG_MCONTROL6_SUPPORTED_TRIGGERS[i], SELECT_WRITABLE and STORE_WRITABLE:
tdata1.select = 1 (data), tdata1.XSL = 010
For each match in UDB_SDTRIG_MCONTROL6_MATCH_LEGAL_VALUES and each size N in
UDB_SDTRIG_MCONTROL6_SIZE_LEGAL_VALUES (1/2/3/5, 5 on RV64 only):
tdata2 = a value whose low N bits have bit N-1 set, with bits above N clear (sail-riscv#2038)
perform {sb/sh/sw/sd} of size N of a register with other bits set above N whose low N bits:
equal / not equal: the value; the value with bit 0 or bit N-1 flipped
ge / lt: the value; the value minus 1; 1 (ordered the other way by a signed compare)
NAPOT / not NAPOT over bits 3:0: both ends of the range; bit 4 or bit N-1 flipped
mask low / high and their inverses (XLEN halves of tdata2: mask high, value low): the value; an unmasked bit
flipped; a masked bit flipped; for mask high with N ⇐ XLEN/2, tdata2 value 0 and tdata2 value = the data
perform a store of each other width W (N/2, 2N up to XLEN) whose low W bits match a tdata2 built the same way
for W, and an XLEN-wide store equal to tdata2 above N
The trigger is disarmed after each store and rvtest_trap_count is written to the signature.

Breakpoint exception exactly for the stores of size N whose low N bits satisfy the match against the low N
bits of tdata2 (equal, not equal, ge, lt, NAPOT), or the XLEN halves of tdata2 and of the zero-extended data
(mask matches). The near misses, and every store of another width, do not fire.
Each miss would fire on a hart that compared the register above N, compared signed, ignored size,
or matched the store’s own width.
The mask and NAPOT expectations follow the reading Sail 0.16, Whisper and ImperasDV implement; they wait on
riscv-isa-manual#3461. tdata2 bits above N are not tested: Sail 0.16 compares all of tdata2 (sail-riscv#2038).

NTRIG * legal matches * legal sizes * {fired, not fired, other width}

Sdtrig_mcontrol6_select_data
Sdtrig_mcontrol6_size_8bit
Sdtrig_mcontrol6_size_16bit
Sdtrig_mcontrol6_size_32bit
Sdtrig_mcontrol6_size_64bit
Sdtrig_mcontrol6_match_equal
Sdtrig_mcontrol6_match_napot
Sdtrig_mcontrol6_match_ge
Sdtrig_mcontrol6_match_lt
Sdtrig_mcontrol6_match_mask_low
Sdtrig_mcontrol6_match_mask_high
Sdtrig_mcontrol6_match_not_equal
Sdtrig_mcontrol6_match_not_napot
Sdtrig_mcontrol6_match_not_mask_low
Sdtrig_mcontrol6_match_not_mask_high
Sdtrig_mcontrol6_comparisons

cp_mcontrol6_match_size_load

Every legal match crossed with every legal size on a select = 1 load trigger

As cp_mcontrol6_match_size_store, with tdata1.XSL = 001 (LOAD_WRITABLE) and sign-extending {lb/lh/lw/ld}:
the word at scratch holds the value in its low N bits and other bits set above them, written before the
trigger is armed. Because bit N-1 is set, the loaded register differs from the compare value above N.

As cp_mcontrol6_match_size_store; a hart that compared the sign-extended register would miss the cases that
fire.

NTRIG * legal matches * legal sizes * {fired, not fired, other width}

Sdtrig_mcontrol6_select_data
Sdtrig_mcontrol6_size_8bit
Sdtrig_mcontrol6_size_16bit
Sdtrig_mcontrol6_size_32bit
Sdtrig_mcontrol6_size_64bit
Sdtrig_mcontrol6_match_equal
Sdtrig_mcontrol6_match_napot
Sdtrig_mcontrol6_match_ge
Sdtrig_mcontrol6_match_lt
Sdtrig_mcontrol6_match_mask_low
Sdtrig_mcontrol6_match_mask_high
Sdtrig_mcontrol6_match_not_equal
Sdtrig_mcontrol6_match_not_napot
Sdtrig_mcontrol6_match_not_mask_low
Sdtrig_mcontrol6_match_not_mask_high
Sdtrig_mcontrol6_comparisons

cp_mcontrol6_match_size_execute

Every legal match crossed with sizes 2 and 3 on a select = 1 execute trigger

M-mode only. For each of UDB_SDTRIG_NUM_TRIGGERS if UDB_SDTRIG_MCONTROL6_SUPPORTED_TRIGGERS[i], SELECT_WRITABLE
and EXECUTE_WRITABLE: tdata1.select = 1 (data), tdata1.XSL = 100
For each match in UDB_SDTRIG_MCONTROL6_MATCH_LEGAL_VALUES and size 2 (16-bit, ZCA only) or 3 (32-bit), as
cp_mcontrol6_match_size_store with instruction encodings in place of data, and step
the lowest free field bit:
16-bit targets: c.nop hints (nzimm varies)
32-bit targets: addi/slti x0 hints (rs1 and imm vary) and, for not equal / not NAPOT / not mask low, csrrw
and csrrwi writes of 0 to tdata1, so that the csrw tdata1, x0 that disarms the trigger never matches
execute the target right after arming, then csrw tdata1, x0
also execute instructions of the other width with tdata2 built for that width: 32-bit ones on size 2, and
16-bit ones on size 3 where the disarming csrw would not match

Breakpoint exception exactly for the targets of size N that satisfy the match; the near misses and the other
width do not fire.
On RV64 the high half of an instruction is 0, so mask high and not mask high on 32-bit instructions are tested
only with groups that never fire (the others would fire on the disarming csrw) and are not in the cross.
Waits on riscv-isa-manual#3461 as cp_mcontrol6_match_size_store.

NTRIG * legal matches * sizes 2/3 * {fired, not fired}

Sdtrig_mcontrol6_select_data
Sdtrig_mcontrol6_size_16bit
Sdtrig_mcontrol6_size_32bit
Sdtrig_mcontrol6_match_equal
Sdtrig_mcontrol6_match_napot
Sdtrig_mcontrol6_match_ge
Sdtrig_mcontrol6_match_lt
Sdtrig_mcontrol6_match_mask_low
Sdtrig_mcontrol6_match_mask_high
Sdtrig_mcontrol6_match_not_equal
Sdtrig_mcontrol6_match_not_napot
Sdtrig_mcontrol6_match_not_mask_low
Sdtrig_mcontrol6_match_not_mask_high
Sdtrig_mcontrol6_comparisons

cp_mcontrol6_match_size_execute_other

A size = 2 execute trigger never fires on a 32-bit instruction it would otherwise match

The cases of cp_mcontrol6_match_size_execute that execute a 32-bit target on a size = 2 trigger whose tdata2
the target satisfies for each legal match (ZCA and size 2 legal)

No breakpoint exception.
On RV64 no 32-bit instruction satisfies mask high or not mask high (its high half is 0, see
cp_mcontrol6_match_size_execute), so those matches are not in the cross.

NTRIG * legal matches (RV64 without 5 and 13)

Sdtrig_mcontrol6_select_data
Sdtrig_mcontrol6_size_16bit

Notes:

uncertain and uncertainen not tested because optional and unpredictable

vs, vu deferred to SdtrigH

hit not tested because optional and implementation-dependent

action other than 0 not tested until those features are supported (e.g. SdtrigSdext/SdtrigTrace)

Icount tests: test fire and don’t fire for each scenario

Repeat for each of UDB_SDTRIG_NUM_TRIGGERS if UDB_SDTRIG_ICOUNT_SUPPORTED_TRIGGERS[i]:
tselect = i
tdata1 = 0
tdata3 = 0 unless otherwise specified (textra = 0, controls context matching)
tdata1.type = 3 (icount)
tdata1.dmode = 0 (M-mode accessible)
tdata1.action = 0 (breakpoint)
unless otherwise specified:
tdata1.m/s/u/vs/vu = (1 for current mode, e.g. 1 in m)
Perform an instruction that causes trigger to fire/not fire
After each case, the tdata1 readback (without hit, which is optional and not checked) and rvtest_trap_count
are written to the signature, so a fire or missing fire is reported at that case.

cp_icount_hardwired

if UDB_SDTRIG_ICOUNT_COUNT_HARDWIRED_1 (imperas-rv64-max; cp_icount_instr, cp_icount_eq0 and cp_icount_self_write
need a writable count and run otherwise):
tdata1.m/s/u/vs/vu = 11111
perform nop in machine mode
CSRR tdata1.m,s,u,vs,vu
CSRR tdata1.count,pending

breakpoint exception occurs,
m,s,u,vs,vu are cleared, pending is cleared

1

Sdtrig_icount_match_eq1
Sdtrig_icount_pending

cp_icount_instr

tdata.pending = 0
tdata1.count = 9
tdata1.m = {0/1}
perform 9x nop in machine mode
CSRR tdata1
CSRR tval

Count decreases when the instruction retires after having been fetched in M-mode and tdata1.m = 1. Tval=0 after firing, pending=0 after firing.

2 priv bits (tdata1 readback: m clear and count unchanged, m set and counted to 0)

Sdtrig_icount_access
Sdtrig_icount_match1
Sdtrig_icount_match_gt1
Sdtrig_icount_pending
Sdtrig_icount_action0
Sdtrig_icount_m

cp_icount_instr_fire

icount fires after count instructions

cp_icount_instr with tdata1.m = 1: the breakpoint taken while the icount trigger armed with count = 9 is selected

Breakpoint exception into M with tval = 0, before the instruction after the 9th

1

Sdtrig_icount_match1
Sdtrig_icount_match_gt1
Sdtrig_icount_action0

cp_icount_trap

tdata1.count = 1
perform illegal instruction trap in mmode, CSRR tdata1.count

Count decreases when a trap is taken from a privilege mode where the trigger is enabled

2 priv bits (tdata1 readback: m clear and count unchanged, m set and counted to 0)

Sdtrig_icount_match2
Sdtrig_icount_match_non_reexecuted
Sdtrig_icount_all_traps_match
Sdtrig_icount_match_eq1
Sdtrig_icount_pending_set

cp_icount_trap_fire

A trap taken in a mode where the trigger is enabled is counted, and pending fires after the handler returns

cp_icount_trap with tdata1.m = 1: the breakpoint taken on the mret that returns from the illegal-instruction trap

Breakpoint exception into M on return from the trap handler
(with Use_tcontrol, this also needs the trap to clear tcontrol.mte, so the breakpoint waits for the mret)

1

Sdtrig_tcontrol_mte
Sdtrig_icount_match2
Sdtrig_icount_match_non_reexecuted
Sdtrig_icount_all_traps_match
Sdtrig_icount_match_eq1
Sdtrig_icount_pending
Sdtrig_icount_action0
Sdtrig_icount_pending_set

cp_icount_eq0

tdata1.pending = {0/1}
CSRW tdata1.count = 0
perform 9x nop in machine mode
CSRR tdata1.count

Count stays at 0 until explicitly written
Breakpoint exception occurs when tdata1.pending = 1

2 pending (tdata1 readback: count stays 0, pending cleared)

Sdtrig_icount_count_zero
Sdtrig_icount_pending

cp_icount_eq0_fire

A pending icount trigger fires before the next instruction

cp_icount_eq0 with tdata1.pending = 1: the breakpoint taken right after the CSRW that writes count = 0, pending = 1

Breakpoint exception into M before the next instruction; pending is cleared

1

Sdtrig_icount_pending
Sdtrig_icount_action0

cp_icount_self_write

An icount trigger with count = 1 that matches a write to its own tdata1 may or may not become pending

if not UDB_SDTRIG_ICOUNT_COUNT_HARDWIRED_1
tdata1.count = 1, tdata1.m = 1
the next instruction is CSRW tdata1 = icount with count = 100, m = 1
CSRR tdata1 after the next instruction; whether count is above 1 is written to the signature, then the trigger is
disabled and rvtest_trap_count is written to the signature.

count holds the newly written value afterwards (less the instructions since), so the trigger does not fire later
pending becomes set, and a breakpoint exception is taken right after the CSRW, only if
UDB_SDTRIG_ICOUNT_SELF_WRITE_SETS_PENDING

NTRIG

Sdtrig_tdata1_write0
Sdtrig_icount_exception

Itrigger tests: test fire and don’t fire for each scenario

Repeat for each of UDB_SDTRIG_NUM_TRIGGERS if UDB_SDTRIG_ITRIGGER_SUPPORTED_TRIGGERS[i]:
tselect = i
tdata1 = 0
tdata3 = 0 unless otherwise specified (textra = 0, controls context matching)
tdata1.type = 4 (itrigger)
tdata1.dmode = 0 (M-mode accessible)
tdata1.action = 0 (breakpoint)
unless otherwise specified:
tdata1.m/s/u/vs/vu = (1 for current mode, e.g. 1 in m)
Perform an interrupt that causes trigger to fire/not fire

cp_itrigger_m

An itrigger never fires on an interrupt handled in M

tdata2[x] = 1 for x in {1,3,5,7,9,11,13} if INTERRUPTx_SUPPORTED (1,5,9,13 need S)
tdata1.m = {0/1}, mideleg[x] = 0
take interrupt x while executing in M-mode

No breakpoint (both reentrancy options prevent it in M)

NTRIG * 7 interrupts * 2 m bits

Sdtrig_itrigger_m

cp_itrigger_m_other

An itrigger does not fire on an interrupt tdata2 does not select

as cp_itrigger_m, taking the machine timer interrupt instead of x

No breakpoint

NTRIG * 2 m bits

Sdtrig_itrigger_m

cp_itrigger_s

An itrigger fires on a selected interrupt taken from S and handled in S

tdata2[x] = 1 for x in {1,5,9,13} if INTERRUPTx_SUPPORTED
tdata1.s = {0/1}, mideleg[x] = 1, medeleg[3] = 0
take interrupt x while executing in S-mode

Breakpoint into M just before the first instruction of the S-mode handler, tval = 0, iff tdata1.s = 1

NTRIG * 4 interrupts * {s clear and no breakpoint, s set and breakpoint}

Sdtrig_itrigger_fire
Sdtrig_itrigger_enable_num
Sdtrig_itrigger_timing
Sdtrig_itrigger_action0
Sdtrig_itrigger_s

cp_itrigger_s_other

An itrigger does not fire on an interrupt tdata2 does not select

as cp_itrigger_s, taking another delegated S-level interrupt (5, or 1 when x = 5) instead of x

No breakpoint

NTRIG * 2 s bits

Sdtrig_itrigger_enable_num
Sdtrig_itrigger_s

cp_itrigger_u

An itrigger fires on a selected interrupt taken from U and handled in S

as cp_itrigger_s, with tdata1.u = {0/1}, taking interrupt x while executing in U-mode

Breakpoint into M just before the first instruction of the S-mode handler, tval = 0, iff tdata1.u = 1

NTRIG * 4 interrupts * {u clear and no breakpoint, u set and breakpoint}

Sdtrig_itrigger_fire
Sdtrig_itrigger_enable_num
Sdtrig_itrigger_timing
Sdtrig_itrigger_action0
Sdtrig_itrigger_u

cp_itrigger_u_other

An itrigger does not fire on an interrupt tdata2 does not select

as cp_itrigger_u, taking another delegated S-level interrupt instead of x

No breakpoint

NTRIG * 2 u bits

Sdtrig_itrigger_enable_num
Sdtrig_itrigger_u

Etrigger tests: test fire and don’t fire for each scenario

Repeat for each of UDB_SDTRIG_NUM_TRIGGERS if UDB_SDTRIG_ETRIGGER_SUPPORTED_TRIGGERS[i]:
tselect = i
tdata1 = 0
tdata3 = 0 unless otherwise specified (textra, controls context matching)
tdata1.type = 5 (etrigger)
tdata1.dmode = 0 (M-mode accessible)
tdata1.action = 0 (breakpoint)
unless otherwise specified:
tdata1.m/s/u/vs/vu = (1 for current mode, e.g. 1 in m)

cp_etrigger_m

An etrigger never fires on an exception raised and handled in M

tdata2[x] = 1 for x in {1,2,5,7,11, and 13,15 with Sv (MPRV=1, MPP=U)}
tdata1.m = {0/1}
raise exception x while executing in M-mode

No breakpoint (both reentrancy options prevent it in M)

NTRIG * 7 exceptions * 2 m bits

Sdtrig_etrigger_m

cp_etrigger_m_other

An etrigger does not fire on an exception tdata2 does not select

tdata2[x] = 1 for each x above and x in {0,3,4,6,8,9}, tdata1.m = {0/1}
raise an illegal instruction while executing in M-mode

No breakpoint

NTRIG * 2 m bits

Sdtrig_etrigger_m

cp_etrigger_s

An etrigger never fires on an exception raised in S and handled in M

tdata2[x] = 1 for x in {1,2,5,7,9, and 12,13,15 with Sv}
tdata1.s = {0/1}, medeleg[x] = 0
raise exception x while executing in S-mode

No breakpoint

NTRIG * 8 exceptions * 2 s bits

Sdtrig_etrigger_s

cp_etrigger_s_deleg

An etrigger fires on a selected exception raised in S and handled in S

tdata2[x] = 1 for x in {1,5,7, and 12,13,15 with Sv}
tdata1.s = {0/1}, medeleg[x] = 1, medeleg[3] = 0
raise exception x while executing in S-mode
Not generated: ecall from S (the T-SBI return to M is itself an ecall) and illegal instruction with tdata1.s = 1
(a DUT that emulates the time CSR forwards it in software)

Breakpoint into M just before the first instruction of the S-mode handler, tval = 0, iff tdata1.s = 1

NTRIG * 6 exceptions * {s clear and no breakpoint, s set and breakpoint}

Sdtrig_etrigger_config
Sdtrig_etrigger_timing
Sdtrig_etrigger_action0
Sdtrig_etrigger_s

cp_etrigger_s_other

An etrigger does not fire on an exception tdata2 does not select

tdata2[x] = 1 for each x tested from S, tdata1.s = {0/1}, medeleg[2] = 0
raise an illegal instruction while executing in S-mode

No breakpoint

NTRIG * 2 s bits

Sdtrig_etrigger_config
Sdtrig_etrigger_s

cp_etrigger_u

An etrigger never fires on an exception raised in U and handled in M

tdata2[x] = 1 for x in {1,2,5,7,8, and 12,13,15 with Sv}
tdata1.u = {0/1}, medeleg[x] = 0
raise exception x while executing in U-mode

No breakpoint

NTRIG * 8 exceptions * 2 u bits

Sdtrig_etrigger_u

cp_etrigger_u_deleg

An etrigger fires on a selected exception raised in U and handled in S

tdata2[x] = 1 for x in {1,5,7,8, and 12,13,15 with Sv}
tdata1.u = {0/1}, medeleg[x] = 1, medeleg[3] = 0
raise exception x while executing in U-mode
Not generated: illegal instruction with tdata1.u = 1 (as in cp_etrigger_s_deleg)

Breakpoint into M just before the first instruction of the S-mode handler, tval = 0, iff tdata1.u = 1

NTRIG * 7 exceptions * {u clear and no breakpoint, u set and breakpoint}

Sdtrig_etrigger_config
Sdtrig_etrigger_timing
Sdtrig_etrigger_action0
Sdtrig_etrigger_u

cp_etrigger_u_other

An etrigger does not fire on an exception tdata2 does not select

tdata2[x] = 1 for each x tested from U, tdata1.u = {0/1}, medeleg[2] = 0
raise an illegal instruction while executing in U-mode

No breakpoint

NTRIG * 2 u bits

Sdtrig_etrigger_config
Sdtrig_etrigger_u

Textra tests: test fire and don’t fire for each scenario

Repeat for each of UDB_SDTRIG_NUM_TRIGGERS if UDB_TDATA3_IMPLEMENTED:
tselect = i
tdata1 = 0
tdata1.dmode = 0 (M-mode accessible)
tdata1.action = 0 (breakpoint)
unless otherwise specified:
tdata3.mhselect = 0
tdata3.sselect = 0
tdata1.m/s/u/vs/vu = (1 for current mode, e.g. 1 in m)
other fields depending on trigger type should use the defaults defined in the sections above
Perform an instruction that causes trigger to fire/not fire

cp_textra_mcontext

only run tests if SDTRIG_TEXTRA_MHSELECT_MCONTEXT_MATCH and SDTRIG_TEXTRA_MHVALUE_LEN > 0:
repeat for each trigger type supported:
tdata3.mhselect = 4
mcontext and mhvalue values below are limited to the SDTRIG_TEXTRA_MHVALUE_LEN implemented bits
if RV32:
mcontext[5:0] = 010101
tdata3.mhvalue = {010101/000000/010100}
if RV64:
mcontext[12:0] = 0x1555
tdata3.mhvalue = 0x{1555/0000/1554}
if ICOUNT_SUPPORTED:
tdata1.type = 3 (icount)
tdata1.count = 1
tdata2 = 0
perform nop in machine mode
if MCONTROL6_SUPPORTED
tdata1.type = 6 (mcontrol6)
tdata1.select = 1 (data)
tdata2 = {0x12345678 (RV32) / 0xEDCBA98712345678 (RV64)}
perform SW (RV32) / SD (RV64) of the same value (an XLEN-wide access, as size = 0 needs)
itrigger/etrigger are not used here (their traps are taken with xIE=0); see cp_textra_itrigger/etrigger.
After each case, rvtest_trap_count is written to the signature.

Breakpoint exception if mhvalue equals mcontext

3 mhvalues * 2 trigger types (icount, mcontrol6)

Sdtrig_mcontext_hcontext_data
Sdtrig_mcontrol6_textra
Sdtrig_icount_textra
Sdtrig_textra32_access
Sdtrig_textra32_filter_modes
Sdtrig_textra32_mhselect_mcontext
Sdtrig_textra64_access

cp_textra_scontext

only run tests if SDTRIG_TEXTRA_SSELECT_SCONTEXT_MATCH and SDTRIG_TEXTRA_SVALUE_LEN > 0:
repeat for each trigger type supported:
tdata3.sselect = 1
scontext and svalue values below are limited to the SDTRIG_TEXTRA_SVALUE_LEN implemented bits
if RV32:
scontext = {00001234}
tdata3.svalue = 0x{0000/0034/1200/1234}
tdata3.sbytemask = 4 combinations
if RV64:
scontext = {0x12345678}
tdata3.svalue = 0x{00000000/12345600/12340078/12005678/00345678/12345678}
tdata3.sbytemask = {0000/0001/0010/0100/1000/1111}
if ICOUNT_SUPPORTED:
tdata1.type = 3 (icount)
tdata1.count = 1
tdata2 = 0
perform nop in machine mode
if MCONTROL6_SUPPORTED
tdata1.type = 6 (mcontrol6)
tdata1.select = 1 (data)
tdata2 = {0x12345678 (RV32) / 0xEDCBA98712345678 (RV64)}
perform SW (RV32) / SD (RV64) of the same value (an XLEN-wide access, as size = 0 needs)
itrigger/etrigger are not used here (their traps are taken with xIE=0); see cp_textra_itrigger/etrigger.
After each case, rvtest_trap_count is written to the signature.

Breakpoint exception when svalue equals scontext and mask ignores A’s

if RV32:
4 svalues * 4 masks * 2 trigger types
if RV64:
6 svalues * 6 masks * 2 trigger types

Sdtrig_scontext_data
Sdtrig_mcontrol6_textra
Sdtrig_icount_textra
Sdtrig_textra32_access
Sdtrig_textra32_byte_granular
Sdtrig_textra32_byte_mask_applies
Sdtrig_textra32_filter_modes
Sdtrig_textra32_sbytemask
Sdtrig_textra32_sselect_scontext
Sdtrig_textra64_access
Sdtrig_textra64_byte_granular
Sdtrig_textra64_byte_mask_applies
Sdtrig_textra64_sbytemask

cp_textra_scontext_all

With every scontext byte masked, the scontext compare always matches

only run tests if SDTRIG_TEXTRA_SSELECT_SCONTEXT_MATCH and SDTRIG_TEXTRA_SVALUE_LEN > 0:
as cp_textra_scontext, with tdata3.sselect = 1 and tdata3.sbytemask = all ones (RV32 11, RV64 1111)

Breakpoint exception for every svalue

2 trigger types

Sdtrig_textra32_sbytemask
Sdtrig_textra64_sbytemask

cp_textra_double_context

only run tests if the conditions of both cp_textra_mcontext and cp_textra_scontext hold:
repeat for each trigger type supported:
tdata3.mhselect = {0/4}
tdata3.sselect = {0/1}
tdata3.sbytemask = 0
if RV32:
mcontext[5:0] = 111111
tdata3.mhvalue = {000000/111111}
if RV64:
mcontext[12:0] = 0x1FFF
tdata3.mhvalue = 0x{0000/1FFF}
if RV32:
scontext = 0x0000FFFF
tdata3.svalue = 0x{0000/FFFF}
if RV64:
scontext = 0xFFFFFFFF
tdata3.svalue = 0x{00000000/FFFFFFFF}
if ICOUNT_SUPPORTED:
tdata1.type = 3 (icount)
tdata1.count = 1
tdata2 = 0
perform nop in machine mode
if MCONTROL6_SUPPORTED
tdata1.type = 6 (mcontrol6)
tdata1.select = 1 (data)
tdata2 = {0x12345678 (RV32) / 0xEDCBA98712345678 (RV64)}
perform SW (RV32) / SD (RV64) of the same value (an XLEN-wide access, as size = 0 needs)
itrigger/etrigger are not used here (their traps are taken with xIE=0); see cp_textra_itrigger/etrigger.
After each case, rvtest_trap_count is written to the signature.

Breakpoint exception when all enabled context numbers match

2 mhselect * 2 sselect * 2 mhvalue * 2 svalue

Sdtrig_mcontrol6_textra
Sdtrig_icount_textra
Sdtrig_textra32_access
Sdtrig_textra32_mhselect_ignore
Sdtrig_textra32_mhselect_mcontext
Sdtrig_textra32_sselect_ignore
Sdtrig_textra32_sselect_scontext

cp_textra_asid

only run tests if S is supported, SDTRIG_TEXTRA_SSELECT_ASID_MATCH, ASID_WIDTH >= 2,
SDTRIG_TEXTRA_SVALUE_LEN >= ASID_WIDTH, and Sv39 (RV64) or Sv32 (RV32) is supported.
M-mode is not translated, so satp can select Sv39/Sv32 with ASID X and the root page table without a
mapping (satp.MODE=Bare with a nonzero ASID is UNSPECIFIED). SdtrigS repeats it in S-mode.
X = 2^UDB_ASID_WIDTH-2; ASIDMAX = 9 (RV32) or 16 (RV64)
CSRW satp = {MODE=Sv39/Sv32, ASID=X, PPN=root page table}
repeat for each trigger type supported:
tdata3.sselect = 2
tdata3.svalue = {X / 0 / X^1 / X | 1 << ASIDMAX}
if ICOUNT_SUPPORTED:
tdata1.type = 3 (icount)
tdata1.count = 1
tdata2 = 0
perform nop in machine mode
if MCONTROL6_SUPPORTED
tdata1.type = 6 (mcontrol6)
tdata1.select = 1 (data)
tdata2 = {0x12345678 (RV32) / 0xEDCBA98712345678 (RV64)}
perform SW (RV32) / SD (RV64) of the same value (an XLEN-wide access, as size = 0 needs)

Breakpoint exception if ASID in satp equals the lower ASIDMAX bits of svalue.

2 types * 2 asid_match

Sdtrig_mcontrol6_textra
Sdtrig_icount_textra
Sdtrig_textra32_sselect_asid1
Sdtrig_textra32_sselect_asid3

cp_textra_asid_sbytemask

sbytemask applies only with sselect = 1

as cp_textra_asid, with tdata3.sbytemask = all ones (RV32 11, RV64 1111) and tdata3.svalue = {X / X^1}

Breakpoint exception if ASID in satp equals the lower ASIDMAX bits of svalue.
sbytemask is ignored with sselect = 2, so it does not hide the mismatch in svalue = X^1

2 types * 2 asid_match

Sdtrig_textra32_byte_mask_applies
Sdtrig_textra64_byte_mask_applies

cp_textra_mhselect_no_h

Without H, mhselect holds only 0 or 4

only run tests if H is not supported and TDATA3_IMPLEMENTED; the tdata3 accesses run in M-mode (through T-SBI in SdtrigS).
repeat for each trigger type supported:
arm the trigger so it never fires (icount: count = 1, m = 0; mcontrol6: select = 1, XSL = 000)
CSRW tdata3.mhselect = {1/2/3/5/6/7}
CSRR tdata3 and check mhselect

mhselect reads back 0 or 4 (which of the two is implementation-defined, so only that is recorded)

2 types * 6 mhselect values

Sdtrig_textra32_mhselect_no_h

cp_textra_itrigger_mcontext
cp_textra_itrigger_scontext

An itrigger only fires when its textra condition is satisfied

only run tests if S is supported, as cp_itrigger_s with x = 1 (supervisor software interrupt):
tdata2[1] = 1, tdata1.s = 1, mideleg[1] = 1, medeleg[3] = 0, take the interrupt while executing in S-mode
under the condition of cp_textra_mcontext: mcontext as there, tdata3.mhselect = 4, tdata3.mhvalue = {mcontext / other}
under the condition of cp_textra_scontext: scontext as there, tdata3.sselect = 1, tdata3.svalue = {scontext / 0}
After each case, rvtest_trap_count is written to the signature.

Breakpoint into M just before the first instruction of the S-mode handler iff the context matches

NTRIG * 2 per available context

Sdtrig_itrigger_textra

cp_textra_etrigger_mcontext
cp_textra_etrigger_scontext

An etrigger only fires when its textra condition is satisfied

only run tests if S is supported, as cp_etrigger_s_deleg with x = 5 (load access fault):
tdata2[5] = 1, tdata1.s = 1, medeleg[5] = 1, medeleg[3] = 0, raise the exception while executing in S-mode
under the condition of cp_textra_mcontext: mcontext as there, tdata3.mhselect = 4, tdata3.mhvalue = {mcontext / other}
under the condition of cp_textra_scontext: scontext as there, tdata3.sselect = 1, tdata3.svalue = {scontext / 0}
After each case, rvtest_trap_count is written to the signature.

Breakpoint into M just before the first instruction of the S-mode handler iff the context matches

NTRIG * 2 per available context

Sdtrig_etrigger_textra

cp_smode_fields_hardwired (not generated)

NOT GENERATED: svalue/sselect "should" (not must) be tied to 0 without S-mode, so a hart that implements them is legal.
For each of UDB_SDTRIG_NUM_TRIGGERS in tselect:
If TDATA3_EXISTS:
If S_SUPPORTED = false:
CSRW textra.svalue = 1
CSRW textra.sselect = 1
CSRR tdata3

svalue tied 0 if S-mode not supported
sselect tied 0 if S-mode not supported

1

Sdtrig_textra32_svalue_no_s
Sdtrig_textra32_sselect_no_s

Not generated: the textra tests do not check svalue/sselect on harts without S

Actions: only action 0 (breakpoint) is tested here (sufficient for RVA23). Eventually add SdtrigSdext with action 1, SdtrigEtrace for Trace 2-4, SdtrigExternal for 8-9

Table 344. SdtrigSm Normative Rules
Normative Rule Rule Text Coverpoints

Sdtrig_num_trigs_ge1

SdtrigSm_access_cg/cp_csr_access_common, SdtrigSm_trig_module_reg_cg/cp_tselect_trigs

Sdtrig_unimp_csr_illegal

SdtrigSm_trig_module_reg_cg/cp_csr_unimplemented

Sdtrig_csr_mode

SdtrigSm_access_cg/cp_csr_access_common

Sdtrig_no_debug_fires

Requires Sdext external debug support; not implemented

Sdtrig_actions

Only action 0 (breakpoint) supported in this suite

Sdtrig_action0

SdtrigSm_mcontrol6_cg/cp_mcontrol6_priv_mode, xepc is not checked: with SDTRIG_IMPRECISE_XEPC the trap handler does not record xEPC for breakpoints, because DUTs that do not follow the suggested trigger timing take them at another instruction; only the breakpoint exception is checked

Sdtrig_action1

Requires Sdext external debug support; not implemented

Sdtrig_action2

Trace action defined by the separate trace specification

Sdtrig_action3

Trace action defined by the separate trace specification

Sdtrig_action4

Trace action defined by the separate trace specification

Sdtrig_action5_rsv

Trace action defined by the separate trace specification

Sdtrig_action8_9

Actions 8 and 9 drive TM external trigger outputs, which a test cannot observe

Sdtrig_action_rsv

Reserved encoding for future use; nothing to test

Sdtrig_priority

Trigger priority not tested; triggers assumed imprecise

Sdtrig_non_precise_priority

Trigger priority not tested; triggers assumed imprecise

Sdtrig_chain_priority

Trigger priority not tested; triggers assumed imprecise

Sdtrig_multiple_fires

Trigger priority not tested; triggers assumed imprecise

Sdtrig_tval

Which of several firing action=0 triggers sets tval is UNSPECIFIED; not tested

Sdtrig_debug_breakpoint

Needs action=1 (enter Debug Mode), which requires Sdext; not tested

Sdtrig_simul_debug_breakpoint_fallback

Needs action=1 (enter Debug Mode), which requires Sdext; not tested

Sdtrig_hit_set_on_action0

Needs action=1 (enter Debug Mode), which requires Sdext; not tested

Sdtrig_independent_trigs

Concerns triggers with action 2 or more (trace or external outputs), which a test cannot observe

Sdtrig_breakpoint_delegated

SdtrigS_cg/cp_breakpoint_delegate_s, SdtrigU_cg/cp_breakpoint_delegate_u

Sdtrig_Aext_lr_op

SdtrigSm_a_cg/cp_lrsc_addr, SdtrigSm_a_cg/cp_lrsc_data

Sdtrig_Aext_sc_op

SdtrigSm_a_cg/cp_lrsc_addr, SdtrigSm_a_cg/cp_lrsc_data

Sdtrig_Aext_sc_fail

Behavior is UNSPECIFIED by the specification; not tested

Sdtrig_AMO_read

SdtrigSm_a_cg/cp_amo

Sdtrig_AMO_read_addr

SdtrigSm_a_cg/cp_amo

Sdtrig_AMO_store

SdtrigSm_a_cg/cp_amo

Sdtrig_AMO_store_addr

SdtrigSm_a_cg/cp_amo

Sdtrig_AMO_store_match

Behavior is UNSPECIFIED by the specification; not tested

Sdtrig_load_zero_rd

Behavior is UNSPECIFIED by the specification; not tested

Sdtrig_mult_mem_access

SdtrigSm_combined_accesses_cg/cp_vector_load_store, SdtrigSm_combined_accesses_cg/cp_vector_accesses, SdtrigSm_combined_accesses_cg/cp_vector_mask, cm.push/cm.pop not tested until Sail supports Zcmp (riscv/sail-riscv#730)

Sdtrig_caches_stores_1

SdtrigSm_cache_operations_cg/cp_cache_zicbom, SdtrigSm_cache_operations_cg/cp_cache_zicboz

Sdtrig_caches_stores_2

SdtrigSm_cache_operations_cg/cp_cache_zicbom, SdtrigSm_cache_operations_cg/cp_cache_zicboz

Sdtrig_caches_stores_3

SdtrigSm_cache_operations_cg/cp_cache_zicbom, SdtrigSm_cache_operations_cg/cp_cache_zicboz

Sdtrig_cache_compare

SdtrigSm_cache_operations_cg/cp_cache_zicbom, SdtrigSm_cache_operations_cg/cp_cache_zicboz

Sdtrig_cache_compare_opts

SdtrigSm_cache_operations_cg/cp_cache_zicbom, SdtrigSm_cache_operations_cg/cp_cache_zicboz

Sdtrig_cache_hints

SdtrigSm_cache_operations_cg/cp_cache_zicbop

Sdtrig_cache_clears

SdtrigSm_cache_operations_cg/cp_cache_zicbom

Sdtrig_cbo_zero

SdtrigSm_cache_operations_cg/cp_cache_zicboz

Sdtrig_prefetch

SdtrigSm_cache_operations_cg/cp_cache_zicbop

Sdtrig_tdata2_addr_sz1

SdtrigSm_address_matches_cg/cp_tdata2_translate, SdtrigS_address_matches_cg/cp_tdata2_translate

Sdtrig_pmem

SdtrigSm_address_matches_cg/cp_tdata2_translate

Sdtrig_vmem

SdtrigSm_address_matches_cg/cp_tdata2_translate, SdtrigSm_address_matches_cg/cp_tdata2_translate_exec, SdtrigS_address_matches_cg/cp_tdata2_translate, SdtrigS_address_matches_cg/cp_tdata2_translate_exec

Sdtrig_csr_tdata2_sz2

SdtrigSm_address_matches_cg/cp_tdata2_translate, SdtrigSm_address_matches_cg/cp_tdata2_translate_exec, SdtrigS_address_matches_cg/cp_tdata2_translate, SdtrigS_address_matches_cg/cp_tdata2_translate_exec

Sdtrig_csr_tdata2_invalid

Recommendation (should), not a requirement; not tested

Sdtrig_multistate_change

Descriptive spec text with no separately testable behavior

Sdtrig_tdata_warl

SdtrigSm_access_cg/cp_csr_access_common, SdtrigSm_trig_module_reg_cg/cp_csr_access_local

Sdtrig_tdata_write

SdtrigSm_trig_module_reg_cg/cp_tdata_write

Sdtrig_disable_trig

SdtrigSm_trig_module_reg_cg/cp_tdata_write, SdtrigSm_trig_module_reg_cg/cp_csr_access_local, SdtrigSm_access_cg/cp_csr_access_common

Sdtrig_unimplemented_register

SdtrigSm_trig_module_reg_cg/cp_csr_unimplemented

Sdtrig_trigger_modes

SdtrigSm_trig_module_reg_cg/cp_csr_access_global, SdtrigSm_trig_module_reg_cg/cp_csr_access_local, SdtrigS_access_cg/cp_csr_access_trap_s, SdtrigU_access_cg/cp_csr_access_trap_u, From S and U, cp_csr_insufficient_priv of the S and U suites also reads every M-mode CSR (0x7A0-0x7A9 included) and expects an illegal instruction

Sdtrig_xlen_handling

XLEN-dependent behavior not tested; single XLEN assumed

Sdtrig_fields

XLEN-dependent behavior not tested; single XLEN assumed

Sdtrig_fields_high

XLEN-dependent behavior not tested; single XLEN assumed

Sdtrig_xlen_modification

XLEN-dependent behavior not tested; single XLEN assumed

Sdtrig_tselect

SdtrigSm_trig_module_reg_cg/cp_tselect_trigs

Sdtrig_tselect_access

SdtrigSm_trig_module_reg_cg/cp_tselect_trigs

Sdtrig_tselect_warl

WARL write-any-read-legal behavior not separately tested

Sdtrig_tdata1

SdtrigSm_access_cg/cp_csr_access_common

Sdtrig_tdata1_reset

Reset values not tested in this suite

Sdtrig_tdata1_write0

SdtrigSm_trig_module_reg_cg/cp_tdata_write, SdtrigSm_icount_cg/cp_icount_self_write

Sdtrig_tdata1_multiple_types

Recommendation (should), not a requirement; not tested

Sdtrig_tdata1_type_disabled

SdtrigSm_trig_module_reg_cg/cp_tdata_write

Sdtrig_tdata1_type_rsv

Reserved encoding for future use; nothing to test

Sdtrig_tdata1_dmode_type_0

SdtrigSm_trig_module_reg_cg/cp_tselect_nonexistent, tselect is WARL and no DUT here keeps a nonexistent index (Sail 0.16 legalizes it to the last trigger), so the rule is checked only on a hart that keeps it

Sdtrig_tdata1_dmode_0

SdtrigSm_access_cg/cp_csr_access_common

Sdtrig_tdata1_dmode_1

Requires Sdext external debug support; not implemented

Sdtrig_tdata1_dmode_writable

SdtrigSm_trig_module_reg_cg/cp_tdata1_dmode

Sdtrig_tdata1_data

SdtrigSm_trig_module_reg_cg/cp_tselect_nonexistent, tselect is WARL and no DUT here keeps a nonexistent index (Sail 0.16 legalizes it to the last trigger), so the rule is checked only on a hart that keeps it

Sdtrig_tdata2

SdtrigSm_access_cg/cp_csr_access_common

Sdtrig_tdata2_reset

Descriptive spec text with no separately testable behavior

Sdtrig_tdata2_disabled

SdtrigSm_trig_module_reg_cg/cp_tdata_write, SdtrigSm_trig_module_reg_cg/cp_csr_access_local

Sdtrig_tdata2_sign_extend

XLEN-dependent behavior not tested; single XLEN assumed

Sdtrig_tdata3

SdtrigSm_access_cg/cp_csr_access_common

Sdtrig_tdata3_reset

Descriptive spec text with no separately testable behavior

Sdtrig_tdata3_disabled

SdtrigSm_trig_module_reg_cg/cp_tdata_write

Sdtrig_tdata3_sign_extend

XLEN-dependent behavior not tested; single XLEN assumed

Sdtrig_tinfo

SdtrigSm_access_cg/cp_csr_access_common

Sdtrig_tinfo_reset

Reset values not tested in this suite

Sdtrig_tinfo_optional

Only ratified version 1.0 supported; version assumed

Sdtrig_tinfo_version

SdtrigSm_trig_module_reg_cg/cp_tselect_trigs

Sdtrig_tinfo_version_0

Only ratified version 1.0 supported; version assumed

Sdtrig_tinfo_version_1

Only ratified version 1.0 supported; version assumed

Sdtrig_tinfo_support

SdtrigSm_trig_module_reg_cg/cp_tselect_trigs, SdtrigSm_trig_module_reg_cg/cp_tinfo_read_only

Sdtrig_tinfo_no_trigger

SdtrigSm_trig_module_reg_cg/cp_tselect_nonexistent, tselect is WARL and no DUT here keeps a nonexistent index (Sail 0.16 legalizes it to the last trigger), so the rule is checked only on a hart that keeps it

Sdtrig_trigger_modes_1

SdtrigSm_access_cg/cp_csr_access_common, SdtrigSm_trig_module_reg_cg/cp_csr_access_global, SdtrigS_access_cg/cp_csr_access_trap_s, SdtrigU_access_cg/cp_csr_access_trap_u, The tcontrol accesses and bins need TCONTROL_IMPLEMENTED; from S and U, cp_csr_insufficient_priv of the S and U suites also reads tcontrol (0x7A5) and expects an illegal instruction

Sdtrig_tcontrol_mpte

SdtrigSm_tcontrol_cg/cp_tcontrol_mtrap

Sdtrig_tcontrol_mte_disabled

SdtrigSm_tcontrol_cg/cp_tcontrol_enable

Sdtrig_tcontrol_mte_enabled

SdtrigSm_tcontrol_cg/cp_tcontrol_enable

Sdtrig_tcontrol_mte

SdtrigSm_tcontrol_cg/cp_tcontrol_mtrap, SdtrigSm_icount_cg/cp_icount_trap_fire, mte = 0 while the M-mode handler runs is observed only on harts with Use_tcontrol, where the pending breakpoint of cp_icount_trap_fire must wait for the handler’s mret; cp_tcontrol_mtrap signs tcontrol after that mret, so it checks only that the trap copies mte to mpte

Sdtrig_tcontrol_mte_mret

SdtrigSm_tcontrol_cg/cp_tcontrol_mret

Sdtrig_hcontext_implemented

SdtrigSm_trig_module_reg_cg/cp_csr_unimplemented, Without H, hcontext is not implemented and raises an illegal instruction; behavior with H is deferred to the SdtrigH suite on the hypervisor branch

Sdtrig_hcontext_access

Needs H; deferred to the SdtrigH suite on the hypervisor branch

Sdtrig_hcontext_smstateen

Needs H; deferred to the SdtrigH suite on the hypervisor branch

Sdtrig_hcontext

Needs H; deferred to the SdtrigH suite on the hypervisor branch

Sdtrig_scontext_access

SdtrigSm_trig_module_reg_cg/cp_csr_access_global, Smstateen_cg/cp_context, From U, cp_csr_insufficient_priv of the U suite reads scontext (0x5A8) and expects an illegal instruction; VS-mode access is deferred to the SdtrigH suite on the hypervisor branch

Sdtrig_scontext_accessibility

Smstateen_cg/cp_context, hstateen0 (VS-mode access) is deferred to the SdtrigH suite on the hypervisor branch

Sdtrig_scontext_data

SdtrigSm_access_cg/cp_csr_access_common, SdtrigSm_textra_cg/cp_textra_scontext

Sdtrig_mcontext_implementation

Needs H; deferred to the SdtrigH suite on the hypervisor branch

Sdtrig_mcontext_access

SdtrigSm_trig_module_reg_cg/cp_csr_access_global, SdtrigS_access_cg/cp_csr_access_trap_s, SdtrigU_access_cg/cp_csr_access_trap_u, From S and U, cp_csr_insufficient_priv of the S and U suites also reads mcontext (0x7A8) and expects an illegal instruction

Sdtrig_mcontext_hcontext_data

SdtrigSm_access_cg/cp_csr_access_common, SdtrigSm_textra_cg/cp_textra_mcontext

Sdtrig_mscontext

Optional register, not required by Sdtrig 1.0; not tested

Sdtrig_mscontext_access

Optional register, not required by Sdtrig 1.0; not tested

Sdtrig_mcontrol

Deprecated mcontrol type 2 trigger; not implemented

Sdtrig_mcontrol_reset

Deprecated mcontrol type 2 trigger; not implemented

Sdtrig_mcontrol_access

Deprecated mcontrol type 2 trigger; not implemented

Sdtrig_mcontrol_maskmax

Deprecated mcontrol type 2 trigger; not implemented

Sdtrig_mcontrol_sizehi

Deprecated mcontrol type 2 trigger; not implemented

Sdtrig_mcontrol_hit

Deprecated mcontrol type 2 trigger; not implemented

Sdtrig_mcontrol_select_address

Deprecated mcontrol type 2 trigger; not implemented

Sdtrig_mcontrol_select_data

Deprecated mcontrol type 2 trigger; not implemented

Sdtrig_mcontrol_timing_before

Deprecated mcontrol type 2 trigger; not implemented

Sdtrig_mcontrol_timing_multi

Deprecated mcontrol type 2 trigger; not implemented

Sdtrig_mcontrol_timing_after

Deprecated mcontrol type 2 trigger; not implemented

Sdtrig_mcontrol_timing_overlap

Deprecated mcontrol type 2 trigger; not implemented

Sdtrig_mcontrol_size_any

Deprecated mcontrol type 2 trigger; not implemented

Sdtrig_mcontrol_size_8bit

Deprecated mcontrol type 2 trigger; not implemented

Sdtrig_mcontrol_size_16bit

Deprecated mcontrol type 2 trigger; not implemented

Sdtrig_mcontrol_size_32bit

Deprecated mcontrol type 2 trigger; not implemented

Sdtrig_mcontrol_size_48bit

Deprecated mcontrol type 2 trigger; not implemented

Sdtrig_mcontrol_size_64bit

Deprecated mcontrol type 2 trigger; not implemented

Sdtrig_mcontrol_size_80bit

Deprecated mcontrol type 2 trigger; not implemented

Sdtrig_mcontrol_size_96bit

Deprecated mcontrol type 2 trigger; not implemented

Sdtrig_mcontrol_size_112bit

Deprecated mcontrol type 2 trigger; not implemented

Sdtrig_mcontrol_size_128bit

Deprecated mcontrol type 2 trigger; not implemented

Sdtrig_mcontrol_size_support

Deprecated mcontrol type 2 trigger; not implemented

Sdtrig_mcontrol_chain_disabled

Deprecated mcontrol type 2 trigger; not implemented

Sdtrig_mcontrol_chain_enabled

Deprecated mcontrol type 2 trigger; not implemented

Sdtrig_mcontrol_chain_start

Deprecated mcontrol type 2 trigger; not implemented

Sdtrig_mcontrol_chain_next

Deprecated mcontrol type 2 trigger; not implemented

Sdtrig_mcontrol_chain_ignore

Deprecated mcontrol type 2 trigger; not implemented

Sdtrig_mcontrol_match_equal

Deprecated mcontrol type 2 trigger; not implemented

Sdtrig_mcontrol_match_napot

Deprecated mcontrol type 2 trigger; not implemented

Sdtrig_mcontrol_match_ge

Deprecated mcontrol type 2 trigger; not implemented

Sdtrig_mcontrol_match_lt

Deprecated mcontrol type 2 trigger; not implemented

Sdtrig_mcontrol_match_mask_low

Deprecated mcontrol type 2 trigger; not implemented

Sdtrig_mcontrol_match_mask_high

Deprecated mcontrol type 2 trigger; not implemented

Sdtrig_mcontrol_match_not_equal

Deprecated mcontrol type 2 trigger; not implemented

Sdtrig_mcontrol_match_not_napot

Deprecated mcontrol type 2 trigger; not implemented

Sdtrig_mcontrol_match_not_mask_low

Deprecated mcontrol type 2 trigger; not implemented

Sdtrig_mcontrol_match_not_mask_high

Deprecated mcontrol type 2 trigger; not implemented

Sdtrig_mcontrol_match_rsv

Deprecated mcontrol type 2 trigger; not implemented

Sdtrig_mcontrol_comparisons

Deprecated mcontrol type 2 trigger; not implemented

Sdtrig_mcontrol_m

Deprecated mcontrol type 2 trigger; not implemented

Sdtrig_mcontrol_s

Deprecated mcontrol type 2 trigger; not implemented

Sdtrig_mcontrol_u

Deprecated mcontrol type 2 trigger; not implemented

Sdtrig_mcontrol_execute

Deprecated mcontrol type 2 trigger; not implemented

Sdtrig_mcontrol_store

Deprecated mcontrol type 2 trigger; not implemented

Sdtrig_mcontrol_load

Deprecated mcontrol type 2 trigger; not implemented

Sdtrig_mcontrol6

SdtrigSm_access_cg/cp_csr_access_common

Sdtrig_mcontrol6_reset

Descriptive spec text with no separately testable behavior

Sdtrig_mcontrol6_access

SdtrigSm_mcontrol6_cg/cp_mcontrol6_priv_mode

Sdtrig_mcontrol6_dependence

SdtrigSm_trig_module_reg_cg/cp_tselect_trigs

Sdtrig_mcontrol6_chain

SdtrigSm_mcontrol6_cg/cp_mcontrol6_chain_adr, SdtrigSm_mcontrol6_cg/cp_mcontrol6_chain_long

Sdtrig_mcontrol6_breakpoint

SdtrigSm_mcontrol6_cg/cp_mcontrol6_load_store_adr, SdtrigSm_mcontrol6_cg/cp_mcontrol6_execute_adr, The trap handler signs xtval on every breakpoint and checks it against the reference model, which is configured per DUT (xtval_nonzero.hardware_breakpoint)

Sdtrig_mcontrol6_faulting_address

SdtrigSm_mcontrol6_cg/cp_mcontrol6_load_store_adr, SdtrigSm_mcontrol6_cg/cp_mcontrol6_execute_adr, The trap handler signs xtval on every breakpoint and checks it against the reference model

Sdtrig_mcontrol6_chained_faulting

SdtrigSm_mcontrol6_cg/cp_mcontrol6_chain_adr, The trap handler signs xtval on every breakpoint and checks it against the reference model

Sdtrig_mcontrol6_napot_range

SdtrigSm_mcontrol6_cg/cp_mcontrol6_match_napot

Sdtrig_mcontrol6_textra

SdtrigSm_textra_cg/cp_textra_mcontext, SdtrigSm_textra_cg/cp_textra_scontext, SdtrigSm_textra_cg/cp_textra_double_context, SdtrigSm_textra_cg/cp_textra_asid

Sdtrig_mcontrol6_uncertain

Optional WARL field (hit/uncertain bits); not tested

Sdtrig_mcontrol6_uncertain_0

Optional WARL field (hit/uncertain bits); not tested

Sdtrig_mcontrol6_uncertain_1

Optional WARL field (hit/uncertain bits); not tested

Sdtrig_mcontrol6_vs

SdtrigSm_trig_module_reg_cg/cp_tdata1_mode_hardwired, Firing in VS-mode is deferred to the SdtrigH suite on the hypervisor branch

Sdtrig_mcontrol6_vu

SdtrigSm_trig_module_reg_cg/cp_tdata1_mode_hardwired, Firing in VU-mode is deferred to the SdtrigH suite on the hypervisor branch

Sdtrig_mcontrol6_hit0

Optional WARL field (hit/uncertain bits); not tested

Sdtrig_mcontrol6_hit0_unimplemented

Optional WARL field (hit/uncertain bits); not tested

Sdtrig_mcontrol6_hit0_1

xEPC timing rule: the tests do not check xEPC on trigger breakpoints (SDTRIG_IMPRECISE_XEPC); not tested

Sdtrig_mcontrol6_hit0_2

xEPC timing rule: the tests do not check xEPC on trigger breakpoints (SDTRIG_IMPRECISE_XEPC); not tested

Sdtrig_mcontrol6_hit0_3

xEPC timing rule: the tests do not check xEPC on trigger breakpoints (SDTRIG_IMPRECISE_XEPC); not tested

Sdtrig_mcontrol6_hit0_multiple_accesses

Trigger timing (the instruction’s accesses complete before the trap) is not observable from a test; not tested

Sdtrig_mcontrol6_select_address

SdtrigSm_mcontrol6_cg/cp_mcontrol6_execute_adr, SdtrigSm_mcontrol6_cg/cp_mcontrol6_load_store_adr

Sdtrig_mcontrol6_select_data

SdtrigSm_mcontrol6_cg/cp_mcontrol6_execute_data, SdtrigSm_mcontrol6_cg/cp_mcontrol6_load_store_data, SdtrigSm_mcontrol6_cg/cp_mcontrol6_size_data, SdtrigSm_mcontrol6_cg/cp_mcontrol6_match_size_store, SdtrigSm_mcontrol6_cg/cp_mcontrol6_match_size_load, SdtrigSm_mcontrol6_cg/cp_mcontrol6_match_size_execute, SdtrigSm_mcontrol6_cg/cp_mcontrol6_match_size_execute_other

Sdtrig_mcontrol6_size_any

SdtrigSm_mcontrol6_cg/cp_mcontrol6_execute_size, SdtrigSm_mcontrol6_cg/cp_mcontrol6_load_store_size

Sdtrig_mcontrol6_size_8bit

SdtrigSm_mcontrol6_cg/cp_mcontrol6_load_store_size, SdtrigSm_mcontrol6_cg/cp_mcontrol6_execute_size, SdtrigSm_mcontrol6_cg/cp_mcontrol6_execute_adr_size, SdtrigSm_mcontrol6_cg/cp_mcontrol6_size_data, SdtrigSm_mcontrol6_cg/cp_mcontrol6_match_size_store, SdtrigSm_mcontrol6_cg/cp_mcontrol6_match_size_load

Sdtrig_mcontrol6_size_16bit

SdtrigSm_mcontrol6_cg/cp_mcontrol6_execute_size, SdtrigSm_mcontrol6_cg/cp_mcontrol6_load_store_size, SdtrigSm_mcontrol6_cg/cp_mcontrol6_execute_adr_size, SdtrigSm_mcontrol6_cg/cp_mcontrol6_size_data, SdtrigSm_mcontrol6_cg/cp_mcontrol6_match_size_store, SdtrigSm_mcontrol6_cg/cp_mcontrol6_match_size_load, SdtrigSm_mcontrol6_cg/cp_mcontrol6_match_size_execute, SdtrigSm_mcontrol6_cg/cp_mcontrol6_match_size_execute_other, A select = 0 execute trigger with size = 2 on a 32-bit instruction is not tested: Sail 0.16 fires it (sail-riscv#2033, ACT #2921)

Sdtrig_mcontrol6_size_32bit

SdtrigSm_mcontrol6_cg/cp_mcontrol6_execute_size, SdtrigSm_mcontrol6_cg/cp_mcontrol6_load_store_size, SdtrigSm_mcontrol6_cg/cp_mcontrol6_execute_adr_size, SdtrigSm_mcontrol6_cg/cp_mcontrol6_size_data, SdtrigSm_mcontrol6_cg/cp_mcontrol6_match_size_store, SdtrigSm_mcontrol6_cg/cp_mcontrol6_match_size_load, SdtrigSm_mcontrol6_cg/cp_mcontrol6_match_size_execute, A select = 0 execute trigger with size = 3 on a 16-bit instruction is not tested: Sail 0.16 fires it (sail-riscv#2033, ACT #2921)

Sdtrig_mcontrol6_size_48bit

SdtrigSm_mcontrol6_cg/cp_mcontrol6_execute_size, SdtrigSm_mcontrol6_cg/cp_mcontrol6_execute_adr_size, Only that no 16- or 32-bit instruction matches is tested, on RV64: the tests have no 48-bit instruction, and on RV32 size = 4 is never written because Sail 0.16 disables a trigger whose size exceeds XLEN

Sdtrig_mcontrol6_size_64bit

SdtrigSm_mcontrol6_cg/cp_mcontrol6_execute_size, SdtrigSm_mcontrol6_cg/cp_mcontrol6_load_store_size, SdtrigSm_mcontrol6_cg/cp_mcontrol6_execute_adr_size, SdtrigSm_mcontrol6_cg/cp_mcontrol6_size_data, SdtrigSm_mcontrol6_cg/cp_mcontrol6_match_size_store, SdtrigSm_mcontrol6_cg/cp_mcontrol6_match_size_load, On RV32 size = 5 is never written, so 64-bit fld/fsd and vector accesses are not tested there: Sail 0.16 disables a trigger whose size exceeds XLEN (sail-riscv#2034, ACT #2921)

Sdtrig_mcontrol6_size_128bit

Not tested: size = 6 is never written, so flq/fsq and 128-bit vector accesses are not tested with it, because Sail 0.16 disables a trigger whose size exceeds XLEN (as in sail-riscv#2034)

Sdtrig_mcontrol6_size_support

SdtrigSm_mcontrol6_cg/cp_mcontrol6_load_store_size

Sdtrig_mcontrol6_chain_disabled

SdtrigSm_mcontrol6_cg/cp_mcontrol6_chain_adr

Sdtrig_mcontrol6_chain_enabled

SdtrigSm_mcontrol6_cg/cp_mcontrol6_chain_adr, SdtrigSm_mcontrol6_cg/cp_mcontrol6_chain_long

Sdtrig_mcontrol6_chain_start

SdtrigSm_mcontrol6_cg/cp_mcontrol6_chain_adr, SdtrigSm_mcontrol6_cg/cp_mcontrol6_chain_long

Sdtrig_mcontrol6_chain_next

Requires Debug Mode writes; needs Sdext support

Sdtrig_mcontrol6_chain_ignore

Requires Debug Mode writes; needs Sdext support

Sdtrig_mcontrol6_match_equal

SdtrigSm_mcontrol6_cg/cp_mcontrol6_match, SdtrigSm_mcontrol6_cg/cp_mcontrol6_match_size_store, SdtrigSm_mcontrol6_cg/cp_mcontrol6_match_size_load, SdtrigSm_mcontrol6_cg/cp_mcontrol6_match_size_execute

Sdtrig_mcontrol6_match_napot

SdtrigSm_mcontrol6_cg/cp_mcontrol6_match_napot, SdtrigSm_mcontrol6_cg/cp_mcontrol6_match_size_store, SdtrigSm_mcontrol6_cg/cp_mcontrol6_match_size_load, SdtrigSm_mcontrol6_cg/cp_mcontrol6_match_size_execute

Sdtrig_mcontrol6_match_napot_mask

SdtrigSm_mcontrol6_cg/cp_mcontrol6_napot_allones

Sdtrig_mcontrol6_match_napot_legal

SdtrigSm_mcontrol6_cg/cp_mcontrol6_match_napot

Sdtrig_mcontrol6_match_ge

SdtrigSm_mcontrol6_cg/cp_mcontrol6_match, SdtrigSm_mcontrol6_cg/cp_mcontrol6_match_size_store, SdtrigSm_mcontrol6_cg/cp_mcontrol6_match_size_load, SdtrigSm_mcontrol6_cg/cp_mcontrol6_match_size_execute

Sdtrig_mcontrol6_match_lt

SdtrigSm_mcontrol6_cg/cp_mcontrol6_match, SdtrigSm_mcontrol6_cg/cp_mcontrol6_match_size_store, SdtrigSm_mcontrol6_cg/cp_mcontrol6_match_size_load, SdtrigSm_mcontrol6_cg/cp_mcontrol6_match_size_execute

Sdtrig_mcontrol6_match_mask_low

SdtrigSm_mcontrol6_cg/cp_mcontrol6_match_mask, SdtrigSm_mcontrol6_cg/cp_mcontrol6_match_size_store, SdtrigSm_mcontrol6_cg/cp_mcontrol6_match_size_load, SdtrigSm_mcontrol6_cg/cp_mcontrol6_match_size_execute

Sdtrig_mcontrol6_match_mask_high

SdtrigSm_mcontrol6_cg/cp_mcontrol6_match_mask, SdtrigSm_mcontrol6_cg/cp_mcontrol6_match_size_store, SdtrigSm_mcontrol6_cg/cp_mcontrol6_match_size_load, SdtrigSm_mcontrol6_cg/cp_mcontrol6_match_size_execute

Sdtrig_mcontrol6_match_not_equal

SdtrigSm_mcontrol6_cg/cp_mcontrol6_match, SdtrigSm_mcontrol6_cg/cp_mcontrol6_match_size_store, SdtrigSm_mcontrol6_cg/cp_mcontrol6_match_size_load, SdtrigSm_mcontrol6_cg/cp_mcontrol6_match_size_execute

Sdtrig_mcontrol6_match_not_napot

SdtrigSm_mcontrol6_cg/cp_mcontrol6_match_napot, SdtrigSm_mcontrol6_cg/cp_mcontrol6_match_size_store, SdtrigSm_mcontrol6_cg/cp_mcontrol6_match_size_load, SdtrigSm_mcontrol6_cg/cp_mcontrol6_match_size_execute

Sdtrig_mcontrol6_match_not_mask_low

SdtrigSm_mcontrol6_cg/cp_mcontrol6_match_mask, SdtrigSm_mcontrol6_cg/cp_mcontrol6_match_size_store, SdtrigSm_mcontrol6_cg/cp_mcontrol6_match_size_load, SdtrigSm_mcontrol6_cg/cp_mcontrol6_match_size_execute

Sdtrig_mcontrol6_match_not_mask_high

SdtrigSm_mcontrol6_cg/cp_mcontrol6_match_mask, SdtrigSm_mcontrol6_cg/cp_mcontrol6_match_size_store, SdtrigSm_mcontrol6_cg/cp_mcontrol6_match_size_load, SdtrigSm_mcontrol6_cg/cp_mcontrol6_match_size_execute

Sdtrig_mcontrol6_match_rsv

Reserved encoding for future use; nothing to test

Sdtrig_mcontrol6_comparisons

SdtrigSm_mcontrol6_cg/cp_mcontrol6_size_data, SdtrigSm_mcontrol6_cg/cp_mcontrol6_match_size_store, SdtrigSm_mcontrol6_cg/cp_mcontrol6_match_size_load, SdtrigSm_mcontrol6_cg/cp_mcontrol6_match_size_execute, Compares at a narrower current-mode XLEN need a writable UXL/SXL; not tested

Sdtrig_mcontrol6_m

SdtrigSm_mcontrol6_cg/cp_mcontrol6_priv_mode

Sdtrig_mcontrol6_uncertainen_disabled

Optional WARL field (hit/uncertain bits); not tested

Sdtrig_mcontrol6_uncertainen_enabled

Optional WARL field (hit/uncertain bits); not tested

Sdtrig_mcontrol6_s

SdtrigS_mcontrol6_cg/cp_mcontrol6_priv_bits_s, SdtrigS_cg/cp_breakpoint_s, SdtrigSm_trig_module_reg_cg/cp_tdata1_mode_hardwired, SdtrigS_mcontrol6_cg/cp_mcontrol6_execute_adr, SdtrigS_mcontrol6_cg/cp_mcontrol6_load_store_adr

Sdtrig_mcontrol6_u

SdtrigU_mcontrol6_cg/cp_mcontrol6_priv_bits_u, SdtrigU_cg/cp_breakpoint_u, SdtrigSm_trig_module_reg_cg/cp_tdata1_mode_hardwired, SdtrigU_mcontrol6_cg/cp_mcontrol6_execute_adr, SdtrigU_mcontrol6_cg/cp_mcontrol6_load_store_adr

Sdtrig_mcontrol6_execute

SdtrigSm_mcontrol6_cg/cp_mcontrol6_execute_adr, SdtrigSm_mcontrol6_cg/cp_mcontrol6_execute_data, SdtrigSm_mcontrol6_cg/cp_mcontrol6_load_store_adr, SdtrigSm_mcontrol6_cg/cp_mcontrol6_load_store_data

Sdtrig_mcontrol6_store

SdtrigSm_mcontrol6_cg/cp_mcontrol6_load_store_adr, SdtrigSm_mcontrol6_cg/cp_mcontrol6_load_store_data, SdtrigSm_mcontrol6_cg/cp_mcontrol6_execute_adr, SdtrigSm_mcontrol6_cg/cp_mcontrol6_execute_data

Sdtrig_mcontrol6_load

SdtrigSm_mcontrol6_cg/cp_mcontrol6_load_store_adr, SdtrigSm_mcontrol6_cg/cp_mcontrol6_load_store_data, SdtrigSm_mcontrol6_cg/cp_mcontrol6_execute_adr, SdtrigSm_mcontrol6_cg/cp_mcontrol6_execute_data

Sdtrig_icount

SdtrigSm_access_cg/cp_csr_access_common

Sdtrig_icount_reset

Descriptive spec text with no separately testable behavior

Sdtrig_icount_access

SdtrigSm_icount_cg/cp_icount_instr

Sdtrig_icount_match1

SdtrigSm_icount_cg/cp_icount_instr, SdtrigSm_icount_cg/cp_icount_instr_fire

Sdtrig_icount_match2

SdtrigSm_icount_cg/cp_icount_trap, SdtrigSm_icount_cg/cp_icount_trap_fire

Sdtrig_icount_multiple_match

Not tested: the trap cases use count = 1, where a second match in the same instruction is not visible, and with count > 1 whether the M-mode handler’s instructions are counted depends on the reentrancy option

Sdtrig_icount_match_non_reexecuted

SdtrigSm_icount_cg/cp_icount_trap, SdtrigSm_icount_cg/cp_icount_trap_fire

Sdtrig_icount_all_traps_match

SdtrigSm_icount_cg/cp_icount_trap, SdtrigSm_icount_cg/cp_icount_trap_fire

Sdtrig_icount_match_gt1

SdtrigSm_icount_cg/cp_icount_instr, SdtrigSm_icount_cg/cp_icount_instr_fire

Sdtrig_icount_match_eq1

SdtrigSm_icount_cg/cp_icount_trap, SdtrigSm_icount_cg/cp_icount_trap_fire, SdtrigSm_icount_cg/cp_icount_hardwired

Sdtrig_icount_exception

SdtrigSm_icount_cg/cp_icount_self_write

Sdtrig_icount_count_zero

SdtrigSm_icount_cg/cp_icount_eq0

Sdtrig_icount_pending

SdtrigSm_icount_cg/cp_icount_instr, SdtrigSm_icount_cg/cp_icount_eq0, SdtrigSm_icount_cg/cp_icount_eq0_fire, SdtrigSm_icount_cg/cp_icount_trap_fire, SdtrigSm_icount_cg/cp_icount_hardwired

Sdtrig_icount_action0

SdtrigSm_icount_cg/cp_icount_instr, SdtrigSm_icount_cg/cp_icount_instr_fire, SdtrigSm_icount_cg/cp_icount_trap_fire, SdtrigSm_icount_cg/cp_icount_eq0_fire

Sdtrig_icount_case

Descriptive spec text with no separately testable behavior

Sdtrig_icount_textra

SdtrigSm_textra_cg/cp_textra_mcontext, SdtrigSm_textra_cg/cp_textra_scontext, SdtrigSm_textra_cg/cp_textra_double_context, SdtrigSm_textra_cg/cp_textra_asid

Sdtrig_icount_vs

Needs H; deferred to the SdtrigH suite on the hypervisor branch

Sdtrig_icount_vu

Needs H; deferred to the SdtrigH suite on the hypervisor branch

Sdtrig_icount_hit

hit is optional and not checked (masked out of the tdata1 readback); fire/no-fire is checked through rvtest_trap_count

Sdtrig_icount_m

SdtrigSm_icount_cg/cp_icount_instr

Sdtrig_icount_pending_set

SdtrigSm_icount_cg/cp_icount_trap, SdtrigSm_icount_cg/cp_icount_trap_fire

Sdtrig_icount_s

SdtrigS_cg/cp_breakpoint_s, SdtrigS_icount_cg/cp_icount_instr, SdtrigS_icount_cg/cp_icount_instr_fire, No case with only the other modes' bits set yet

Sdtrig_icount_u

SdtrigU_cg/cp_breakpoint_u, SdtrigU_icount_cg/cp_icount_instr, SdtrigU_icount_cg/cp_icount_instr_fire, No case with only the other modes' bits set yet

Sdtrig_itrigger

SdtrigSm_access_cg/cp_csr_access_common

Sdtrig_itrigger_reset

Descriptive spec text with no separately testable behavior

Sdtrig_itrigger_access

SdtrigSm_access_cg/cp_csr_access_common

Sdtrig_itrigger_fire

SdtrigSm_itrigger_cg/cp_itrigger_s, SdtrigSm_itrigger_cg/cp_itrigger_u

Sdtrig_itrigger_enable_num

SdtrigSm_itrigger_cg/cp_itrigger_s, SdtrigSm_itrigger_cg/cp_itrigger_s_other, SdtrigSm_itrigger_cg/cp_itrigger_u, SdtrigSm_itrigger_cg/cp_itrigger_u_other

Sdtrig_itrigger_enable_nmi

A test cannot raise a non-maskable interrupt (NMIs come from outside the hart); not tested

Sdtrig_itrigger_xlen32

XLEN-dependent behavior not tested; single XLEN assumed

Sdtrig_itrigger_timing

SdtrigSm_itrigger_cg/cp_itrigger_s, SdtrigSm_itrigger_cg/cp_itrigger_u

Sdtrig_itrigger_action0

SdtrigSm_itrigger_cg/cp_itrigger_s, SdtrigSm_itrigger_cg/cp_itrigger_u

Sdtrig_itrigger_textra

SdtrigSm_textra_cg/cp_textra_itrigger_mcontext, SdtrigSm_textra_cg/cp_textra_itrigger_scontext

Sdtrig_itrigger_hit

Optional WARL field (hit/uncertain bits); not tested

Sdtrig_itrigger_vs

Needs H; deferred to the SdtrigH suite on the hypervisor branch

Sdtrig_itrigger_vu

Needs H; deferred to the SdtrigH suite on the hypervisor branch

Sdtrig_itrigger_nmi

A test cannot raise a non-maskable interrupt (NMIs come from outside the hart); not tested

Sdtrig_itrigger_m

SdtrigSm_itrigger_cg/cp_itrigger_m, SdtrigSm_itrigger_cg/cp_itrigger_m_other, Only that the trigger does not fire is checked: with action = 0 a trap handled in M never fires it (mstatus.MIE or tcontrol.mte is 0 in the handler under both reentrancy options)

Sdtrig_itrigger_s

SdtrigSm_itrigger_cg/cp_itrigger_s, SdtrigSm_itrigger_cg/cp_itrigger_s_other, SdtrigS_itrigger_cg/cp_itrigger_s, SdtrigS_itrigger_cg/cp_itrigger_s_other

Sdtrig_itrigger_u

SdtrigSm_itrigger_cg/cp_itrigger_u, SdtrigSm_itrigger_cg/cp_itrigger_u_other, SdtrigU_itrigger_cg/cp_itrigger_u, SdtrigU_itrigger_cg/cp_itrigger_u_other

Sdtrig_etrigger

SdtrigSm_access_cg/cp_csr_access_common

Sdtrig_etrigger_reset

Descriptive spec text with no separately testable behavior

Sdtrig_etrigger_access

SdtrigSm_access_cg/cp_csr_access_common

Sdtrig_etrigger_fire

Descriptive spec text with no separately testable behavior

Sdtrig_etrigger_config

SdtrigSm_etrigger_cg/cp_etrigger_s_deleg, SdtrigSm_etrigger_cg/cp_etrigger_s_other, SdtrigSm_etrigger_cg/cp_etrigger_u_deleg, SdtrigSm_etrigger_cg/cp_etrigger_u_other

Sdtrig_etrigger_xlen32

XLEN-dependent behavior not tested; single XLEN assumed

Sdtrig_etrigger_timing

SdtrigSm_etrigger_cg/cp_etrigger_s_deleg, SdtrigSm_etrigger_cg/cp_etrigger_u_deleg

Sdtrig_etrigger_action0

SdtrigSm_etrigger_cg/cp_etrigger_s_deleg, SdtrigSm_etrigger_cg/cp_etrigger_u_deleg

Sdtrig_etrigger_textra

SdtrigSm_textra_cg/cp_textra_etrigger_mcontext, SdtrigSm_textra_cg/cp_textra_etrigger_scontext

Sdtrig_etrigger_hit

Optional WARL field (hit/uncertain bits); not tested

Sdtrig_etrigger_vs

Needs H; deferred to the SdtrigH suite on the hypervisor branch

Sdtrig_etrigger_vu

Needs H; deferred to the SdtrigH suite on the hypervisor branch

Sdtrig_etrigger_m

SdtrigSm_etrigger_cg/cp_etrigger_m, SdtrigSm_etrigger_cg/cp_etrigger_m_other, Only that the trigger does not fire is checked: with action = 0 a trap handled in M never fires it (mstatus.MIE or tcontrol.mte is 0 in the handler under both reentrancy options)

Sdtrig_etrigger_s

SdtrigSm_etrigger_cg/cp_etrigger_s, SdtrigSm_etrigger_cg/cp_etrigger_s_deleg, SdtrigSm_etrigger_cg/cp_etrigger_s_other, SdtrigS_etrigger_cg/cp_etrigger_s, SdtrigS_etrigger_cg/cp_etrigger_s_other

Sdtrig_etrigger_u

SdtrigSm_etrigger_cg/cp_etrigger_u, SdtrigSm_etrigger_cg/cp_etrigger_u_deleg, SdtrigSm_etrigger_cg/cp_etrigger_u_other, SdtrigU_etrigger_cg/cp_etrigger_u, SdtrigU_etrigger_cg/cp_etrigger_u_other

Sdtrig_tmexttrigger

External trigger inputs are implementation-specific and unspecified

Sdtrig_tmexttrigger_reset

External trigger inputs are implementation-specific and unspecified

Sdtrig_tmexttrigger_access

External trigger inputs are implementation-specific and unspecified

Sdtrig_tmexttrigger_fire

External trigger inputs are implementation-specific and unspecified

Sdtrig_tmexttrigger_inputs

External trigger inputs are implementation-specific and unspecified

Sdtrig_tmexttrigger_subset

External trigger inputs are implementation-specific and unspecified

Sdtrig_tmexttrigger_unsupported

External trigger inputs are implementation-specific and unspecified

Sdtrig_tmexttrigger_action0

External trigger inputs are implementation-specific and unspecified

Sdtrig_tmexttrigger_async

External trigger inputs are implementation-specific and unspecified

Sdtrig_tmexttrigger_prevented

External trigger inputs are implementation-specific and unspecified

Sdtrig_tmexttrigger_pending

External trigger inputs are implementation-specific and unspecified

Sdtrig_tmexttrigger_hit

External trigger inputs are implementation-specific and unspecified

Sdtrig_tmexttrigger_intctl

External trigger inputs are implementation-specific and unspecified

Sdtrig_tmexttrigger_select

External trigger inputs are implementation-specific and unspecified

Sdtrig_textra32

SdtrigSm_access_cg/cp_csr_access_common

Sdtrig_textra32_reset

Descriptive spec text with no separately testable behavior

Sdtrig_textra32_access

SdtrigSm_textra_cg/cp_textra_mcontext, SdtrigSm_textra_cg/cp_textra_scontext, SdtrigSm_textra_cg/cp_textra_double_context

Sdtrig_textra32_dxlen64

Needs a narrower XLEN view of textra64 (mixed XLEN), which the tests do not switch to; not tested

Sdtrig_textra32_byte_granular

SdtrigSm_textra_cg/cp_textra_scontext

Sdtrig_textra32_byte_mask_applies

SdtrigSm_textra_cg/cp_textra_scontext, SdtrigSm_textra_cg/cp_textra_asid_sbytemask, SdtrigS_textra_cg/cp_textra_asid_sbytemask

Sdtrig_textra32_filter_modes

SdtrigSm_textra_cg/cp_textra_mcontext, SdtrigSm_textra_cg/cp_textra_scontext, SdtrigS_textra_cg/cp_textra_mcontext, SdtrigS_textra_cg/cp_textra_scontext, SdtrigU_textra_cg/cp_textra_mcontext, SdtrigU_textra_cg/cp_textra_scontext

Sdtrig_textra32_mhselect_ignore

SdtrigSm_textra_cg/cp_textra_double_context

Sdtrig_textra32_mhselect_mcontext

SdtrigSm_textra_cg/cp_textra_mcontext, SdtrigSm_textra_cg/cp_textra_double_context

Sdtrig_textra32_mhselect_mctx_sel

Needs H; deferred to the SdtrigH suite on the hypervisor branch

Sdtrig_textra32_mhselect_vmid_sel

Needs H; deferred to the SdtrigH suite on the hypervisor branch

Sdtrig_textra32_mhselect_rsv

Reserved encoding for future use; nothing to test

Sdtrig_textra32_mhselect_no_h

SdtrigSm_textra_cg/cp_textra_mhselect_no_h

Sdtrig_textra32_sbytemask

SdtrigSm_textra_cg/cp_textra_scontext, SdtrigSm_textra_cg/cp_textra_scontext_all

Sdtrig_textra32_svalue_no_s

Recommendation (should), not a requirement; not tested

Sdtrig_textra32_sselect_ignore

SdtrigSm_textra_cg/cp_textra_double_context

Sdtrig_textra32_sselect_scontext

SdtrigSm_textra_cg/cp_textra_scontext, SdtrigSm_textra_cg/cp_textra_double_context

Sdtrig_textra32_sselect_asid1

SdtrigSm_textra_cg/cp_textra_asid, SdtrigS_textra_cg/cp_textra_asid

Sdtrig_textra32_sselect_asid2

vsatp ASID matching in VS/VU-mode needs H; deferred to the SdtrigH suite on the hypervisor branch

Sdtrig_textra32_sselect_asid3

SdtrigSm_textra_cg/cp_textra_asid, SdtrigS_textra_cg/cp_textra_asid

Sdtrig_textra32_sselect_no_s

Recommendation (should), not a requirement; not tested

Sdtrig_textra64

SdtrigSm_access_cg/cp_csr_access_common

Sdtrig_textra64_reset

Descriptive spec text with no separately testable behavior

Sdtrig_textra64_access

SdtrigSm_textra_cg/cp_textra_mcontext, SdtrigSm_textra_cg/cp_textra_scontext

Sdtrig_textra64_retain

XLEN-dependent behavior not tested; single XLEN assumed

Sdtrig_textra64_xlen32

XLEN-dependent behavior not tested; single XLEN assumed

Sdtrig_textra64_byte_granular

SdtrigSm_textra_cg/cp_textra_scontext

Sdtrig_textra64_byte_mask_applies

SdtrigSm_textra_cg/cp_textra_scontext, SdtrigSm_textra_cg/cp_textra_asid_sbytemask, SdtrigS_textra_cg/cp_textra_asid_sbytemask

Sdtrig_textra64_sbytemask

SdtrigSm_textra_cg/cp_textra_scontext, SdtrigSm_textra_cg/cp_textra_scontext_all

UDB Parameters: None.

As of 10/22/26, the SdtrigSm, SdtrigS and SdtrigU tests and coverpoints exercise the mcontrol6, icount, itrigger and etrigger trigger types, textra, access to the trigger registers, and address matching on scalar, compressed, atomic, vector, cache-block and translated accesses.

Most Sdtrig features are optional, so the tests take every DUT-specific fact from the Sdtrig parameters of the DUT’s UDB configuration. SDTRIG_NUM_TRIGGERS gives the number of triggers; the tests exercise up to 16 of them. For each trigger, SDTRIG_<TYPE>_SUPPORTED_TRIGGERS says whether it supports each type (mcontrol6, icount, itrigger, etrigger). Other parameters give the writable tdata1 fields (SDTRIG_MCONTROL6_{SELECT,EXECUTE,LOAD,STORE}_WRITABLE, SDTRIG_{M,S,U,VS,VU}_WRITABLE), the legal mcontrol6 match and size values, maskmax6 and the maximum chain length, the interrupts and exceptions itrigger and etrigger can select, the icount options, the textra context matches and value widths, and which optional CSRs (tcontrol, tdata2, tdata3, mcontext, scontext, hcontext) exist. A test is generated only for values the DUT supports, so a hart with fewer features is still tested, and every absent optional CSR is checked to raise an illegal-instruction exception. Sail 0.16, the reference model, accepts mcontrol6 sizes only up to XLEN bits, so larger sizes are not tested. TODO: change this when Sail supports larger sizes in the next release.

uncertainen and uncertain are vague and implementation-specific and are thus not tested. hit varies based on timing and is optional and difficult to check so is presently not tested. Only action=0 is tested because the others depend on Sdext or trace or implementation-specific external triggers. dmode is not tested in Sdtrig because it depends on Sdext. hcontext depends on the Hypervisor extension, so the Access tests touch it only on configurations that implement it. Non-maskable interrupts are not tested because they are not part of RVA23.

mcontrol has been replaced by mcontrol6, so it is deprecated and not tested. mscontext is only for backward compatibility with Sdtrig 0.13 and is not tested.

Trigger Re-entrancy and What Can Be Tested

A trigger with action=0 raises a breakpoint exception. If that exception is taken while the hart is already in a trap handler, it overwrites xepc and xcause, and the hart cannot return from the original trap. Sdtrig gives harts two ways to prevent this:

  1. Interrupt enables. No trigger with action=0 matches or fires in M-mode while mstatus.MIE=0. If medeleg[3]=1, none matches or fires in S-mode while sstatus.SIE=0, and the same rule applies in VS-mode with hedeleg[3] and vsstatus.SIE.

  2. tcontrol. No trigger with action=0 matches or fires in M-mode while tcontrol.MTE=0. A trap into M-mode copies MTE to MPTE and clears MTE, and mret copies MPTE back to MTE. medeleg[3] is read-only zero.

Taking a trap clears MIE, SIE or MTE, depending on the method and the mode the trap enters. This decides what the tests can observe, and it affects the two kinds of trigger differently:

  • mcontrol6 and icount fire synchronously in the mode that is executing. The test controls the enable bits there, so it can make the trigger fire or not.

  • etrigger and itrigger fire just before the first instruction of the trap handler. By then the trap has already cleared the enable bit of the mode it entered.

The table below shows when an action=0 trigger can fire. For mcontrol6 and icount, the column is the mode the trigger matches in. For etrigger and itrigger, it is the mode the trap is taken from, which the trigger’s m/s/u bits select. VS-mode and VU-mode behave like S-mode and U-mode, with hedeleg[3] and vsstatus.SIE in place of medeleg[3] and sstatus.SIE.

Trigger M-mode
(either method)
S/U-mode, medeleg[3]=0
(either method; breakpoint taken to M)
S/U-mode, medeleg[3]=1
(interrupt enables only; breakpoint taken to S)

mcontrol6, icount

Fires when MIE=1 (interrupt enables) or MTE=1 (tcontrol); suppressed otherwise

Always fires

S: fires when SIE=1, suppressed when SIE=0. U: always fires.

etrigger, itrigger

Never fires, because the trap is handled in M and has cleared MIE or MTE

Fires if the exception or interrupt is delegated to S; never fires if it is handled in M

Never fires, because the trap into S has cleared SIE

Every cell is a constraint of the specification, not of the test suite. The specification states the "never fires" cells directly: "Both options prevent etrigger and itrigger from having any effect on exceptions and interrupts that are handled in M-mode." The consequences for the tests are:

  • mcontrol6 and icount can be tested firing and suppressed in every mode under both methods. The tests set MIE=1 to arm the trigger in M-mode, and also MTE=1 when the DUT’s UDB configuration sets SDTRIG_BREAKPOINT_REENTRANCY to Use_tcontrol, with mie=0 so that no interrupt is taken. They set SIE=1 to arm it in S-mode when medeleg[3]=1. They exercise medeleg[3]=1 to check breakpoints taken to S.

  • etrigger and itrigger can be shown to fire only for an exception or interrupt that is raised in S or U and delegated to S, while medeleg[3]=0.

    • In every other case, the tests can only check that the trigger stays silent. This includes tdata1.m=1, a cause that is not delegated, an M-level interrupt, and an etrigger on the breakpoint exception itself.

    • A hart without S-mode handles every trap in M. On such a hart, etrigger and itrigger with action=0 never fire, under either method.

  • Some expected outcomes depend on the method the hart implements. An example is an exception delegated to S while medeleg[3] has its boot value of 1: under interrupt enables the trigger is suppressed, but under tcontrol medeleg[3] reads 0 and the trigger fires into M. The tests therefore name bins by stimulus rather than by expected outcome. The reference model is configured with the DUT’s method. In this repository, the Spike and Whisper configurations without S-mode use tcontrol. The other Spike, Whisper and Sail configurations use interrupt enables, and so does Imperas, whose configurations set tcontrol_undefined=T.

  • The specification says harts should implement one of the two methods, so a hart may implement neither. On such a hart, a trigger that fires in an M-mode trap handler overwrites mepc and mcause, and the test cannot recover. The tests assume one of the two methods.

The three suites start in different modes. SdtrigSm boots to M-mode and can change medeleg. SdtrigS and SdtrigU boot to S-mode and U-mode, and keep the boot value of medeleg[3]: 1 on a hart that uses interrupt enables, and read-only 0 on a hart that uses tcontrol. The exception is their breakpoint-delegation test, which switches to M-mode to clear and then set medeleg[3] and fires mcontrol6 and icount triggers each way. SdtrigSm arms its M-mode triggers with MIE=1, and with MTE=1 when SDTRIG_BREAKPOINT_REENTRANCY is Use_tcontrol. SdtrigS arms its triggers with SIE=1. SdtrigSm reaches S-mode and U-mode only in the etrigger and itrigger tests, which clear medeleg[3] first. The tables below show what each suite then exercises.

Table 345. Exercised on a hart that uses interrupt enables
Trigger SdtrigSm SdtrigS SdtrigU

mcontrol6, icount

Fires in M-mode; breakpoint taken from M to M

Fires in S-mode; breakpoint taken from S to M (medeleg[3]=0) and from S to S (medeleg[3]=1)

Fires in U-mode; breakpoint taken to M (medeleg[3]=0) and to S (medeleg[3]=1); to M if there is no S-mode

etrigger, itrigger

Raised in M-mode: suppressed. Raised in S-mode or U-mode with medeleg[3]=0: fires into M if delegated to S, suppressed if handled in M.

Suppressed: handled in S with SIE=0 and medeleg[3]=1, or handled in M

Suppressed, as for SdtrigS

Table 346. Exercised on a hart that uses tcontrol
Trigger SdtrigSm SdtrigS SdtrigU

mcontrol6, icount

Fires in M-mode, where the tests set MTE; breakpoint taken from M to M

Fires in S-mode; breakpoint taken from S to M

Fires in U-mode; breakpoint taken from U to M

etrigger, itrigger

As on a hart that uses interrupt enables

Fires into M if delegated to S; suppressed if handled in M

As for SdtrigS; suppressed on a hart without S-mode

So the outcome differs between the two kinds of hart in four of the six cells. Each kind of hart leaves some cases unexercised, but none of these gaps comes from the specification:

  • SdtrigS and SdtrigU (cp_breakpoint_delegate_s/u) fire mcontrol6 and icount triggers in S-mode and U-mode with medeleg[3]=0 and with medeleg[3]=1, so on a hart that uses interrupt enables a breakpoint is also taken from S or U to M.

  • The tests read the reentrancy method from SDTRIG_BREAKPOINT_REENTRANCY and whether tcontrol exists from TCONTROL_IMPLEMENTED. The tcontrol tests check that a trap into M-mode copies MTE to MPTE and clears MTE and that mret copies MPTE to MTE on every hart with tcontrol, and that MTE gates M-mode triggers on a hart that uses tcontrol for reentrancy.

  • On a hart that uses interrupt enables, etrigger and itrigger never fire in SdtrigS or SdtrigU, because those suites keep medeleg[3]=1 for these tests. They fire only in SdtrigSm, which clears medeleg[3] first. SdtrigS and SdtrigU could clear medeleg[3] from M-mode, as their breakpoint-delegation test does.

SdtrigS

Tests run in S-mode with tdata1.s = 1, and the rows mirrored from SdtrigSm read S-mode for M-mode. The trigger CSRs are accessed through T-SBI, so those accesses run in M-mode; cp_csr_access_trap_s instead accesses them directly from S-mode, which traps The trigger-module register rows, cp_tdata2_translate, cp_textra_mhselect_no_h and the icount readbacks are sampled on those M-mode accesses, as in SdtrigSm. cp_csr_access_common runs only in SdtrigSm: through T-SBI it would make the same M-mode accesses medeleg[3] = 1 (breakpoints from triggers are taken in S-mode) unless the hart has no S-mode or hard-wires it to 0 (tcontrol); then they are taken in M-mode. Other assumptions are inherited from SdtrigSm Only SdtrigSm runs cp_csr_unimplemented (an M-mode access to an absent CSR), the itrigger/etrigger cases taken from M and the cross-privilege cases that need medeleg[3] = 0 while the source trap is delegated (cp_itrigger_u, cp_etrigger_s_deleg/u/u_deleg, cp_textra_itrigger_*, cp_textra_etrigger_*). Here an itrigger or etrigger fires on a trap handled in S only on harts using tcontrol, so cp_itrigger_s and cp_etrigger_s record the trap and the tdata1.s setting, and the signature checks the outcome

Table 347. SdtrigS Coverpoints
Coverpoint Goal Feature Description Expectation Bins Normative Rule Notes

Access

cp_csr_access_trap_s

The M-level trigger CSRs are not accessible from S-mode

For x in {tselect, tdata1, tdata2, tdata3, tinfo}, and tcontrol if UDB_TCONTROL_IMPLEMENTED and mcontext if UDB_MCONTEXT_IMPLEMENTED:
csrr x, then csrw x, directly from S-mode (not through T-SBI)

Illegal instruction exception on every access (into S-mode when medeleg[2] = 1, else into M-mode)

2 accesses * implemented M-level trigger CSRs (5-7)

Sdtrig_trigger_modes
Sdtrig_trigger_modes_1
Sdtrig_mcontext_access

Native Triggers

cp_breakpoint_s

Triggers enabled for S-mode fire in S-mode

For each of UDB_SDTRIG_NUM_TRIGGERS in tselect, for each supported trigger type in {icount, mcontrol6}:
arm the trigger with tdata1.s = 1 (T-SBI)
run the S-mode instruction that matches it

Breakpoint exception taken from S-mode (into S-mode when medeleg[3] = 1, else into M-mode)

NUM_TRIGGERS * 2 types

Sdtrig_mcontrol6_s
Sdtrig_icount_s

cp_breakpoint_delegate_s

Breakpoints caused by triggers can be delegated

if S_SUPPORTED
medeleg[3] = {0/1} (written in M-mode: T-SBI does not write medeleg)
For each of UDB_SDTRIG_NUM_TRIGGERS in tselect, for each supported trigger type in {icount, mcontrol6}:
arm the trigger with tdata1.s = 1 (T-SBI)
run the S-mode instruction that fires it; sstatus.SIE = 1
After each case, rvtest_trap_count is written to the signature

Breakpoint exception taken into M when medeleg[3] = 0 and into S when medeleg[3] = 1

NUM_TRIGGERS * 2 types * 2 medeleg

Sdtrig_breakpoint_delegated

A Extension

Repeat for each of UDB_SDTRIG_NUM_TRIGGERS if UDB_SDTRIG_MCONTROL6_SUPPORTED_TRIGGERS[i]:
tselect = i

cp_lrsc_addr

lr instructions are loads
sc instructions are stores

if ZALRSC_SUPPORTED
tdata2 = {scratch/0}
tdata1.select = 0 (adr)
tdata1.XSL = {100/010/001}
if RV32:
Perform LR.W, SC.W 0x12345678 to scratch
if RV64:
Perform LR.D, SC.D 0x123456789ABCDEF0 to scratch

Breakpoint exception when mem access address matches tdata2 and
- sc is performed while Store = 1 or
- lr is performed while Load = 1

if RV32:
2 address * 3 XSL * 2 ops
if RV64:
2 address * 3 XSL * 4 ops

Sdtrig_Aext_lr_op
Sdtrig_Aext_sc_op

cp_lrsc_data

lr instructions are loads
sc instructions are stores

if ZALRSC_SUPPORTED
tdata1.select = 1 (data)
tdata1.XSL = {100/010/001}
if RV32:
tdata2 = {0x12345678/0}
Perform LR.W, SC.W 0x12345678 to scratch
if RV64:
tdata2 = {0x123456789ABCDEF0/0}
Perform LR.D, SC.D 0x123456789ABCDEF0 to scratch

Breakpoint exception when mem access data matches tdata2 and
- sc is performed while Store = 1 or
- lr is performed while Load = 1

2 tdata2 * 3 XSL * 2 ops (lr/sc of XLEN width; size=0 data matches are defined only for XLEN-wide accesses)

Sdtrig_Aext_lr_op
Sdtrig_Aext_sc_op

cp_amo

Amo is a load for the read portion and a store for the write portion

if ZAAMO_SUPPORTED
tdata2 = {scratch/0}
tdata1.select = 0 (adr)
tdata1.XSL = {100/010/001}
Perform each AMO (amoswap/add/and/or/xor/max/maxu/min/minu .w, and .d if RV64) to scratch with rd != x0

Breakpoint exception if load or store are set and the access address matches tdata2

2 address * 3 XSL * 9 (RV64 18) AMOs

Sdtrig_AMO_read
Sdtrig_AMO_read_addr
Sdtrig_AMO_store
Sdtrig_AMO_store_addr

Notes:
UNSPECIFIED whether failing SC instructions are stores; do not test.
UNSPECIFIED whether amo’s match on data: do not test

Combined Accesses

Repeat for each of UDB_SDTRIG_NUM_TRIGGERS if UDB_SDTRIG_MCONTROL6_SUPPORTED_TRIGGERS[i]:
tselect = i

UDB_VECTOR_SEW

cp_vector_load_store

Accesses match as if it performed a load/store of size SEW

if ZVL32B_SUPPORTED
tdata2 = {scratch/0}
tdata1.size = {0/1/2/3/4/5/6} (legal sizes of at most XLEN bits)
tdata1.select = 0 (adr)
tdata1.XSL = {010/001}
Vsetivli x0, 1, e{8/16/32/64}, m4, ta, ma (e64 only if ZVE64X_SUPPORTED)
Perform v{l/s}e{8/16/32/64}.v to scratch

Breakpoint exception if the tdata2 matches a address in the vector store and tdata1.size = SEW or 0

2 address * legal sizes (up to 7) * 4 SEW * 2 ops

Sdtrig_mult_mem_access

cp_vector_accesses

Accesses match as if happened individually

if ZVL32B_SUPPORTED
tdata2 = {scratch/scratch+8/0}
tdata1.select = 0 (adr)
tdata1.XSL = {010/001}
Vsetivli x0, {1/9}, e{8/16/32/64}, m4, ta, ma (e64 only if ZVE64X_SUPPORTED)
Perform v{l/s}e{8/16/32/64}.v to scratch

Breakpoint exception if the tdata2 = scratch
Breakpoint exception when tdata2 = scratch+8 and vl reaches it (AVL 9; vl = VLMAX < 9 for e64 at VLEN 128)

3 address * 2 Vector Lengths * 4 SEW * 2 ops

Sdtrig_mult_mem_access

cp_vector_mask

Masked vector operations do not match

if ZVL32B_SUPPORTED
tdata2 = {scratch+8}
tdata1.select = 0 (adr)
tdata1.XSL = {010/001}
Vsetivli x0, 9, e{8/16/32/64}, m4, ta, mu (e64 only if ZVE64X_SUPPORTED)
v0 = mask with the element at scratch+8 {active/inactive}
Perform v{l/s}e{8/16/32/64}.v to scratch, v0.t

Breakpoint exception when the element at tdata2 is active
No breakpoint exception when the element at tdata2 is masked off

2 mask states * 4 SEW * 2 ops

Sdtrig_mult_mem_access

Cache Operations

Repeat for each of UDB_SDTRIG_NUM_TRIGGERS if UDB_SDTRIG_MCONTROL6_SUPPORTED_TRIGGERS[i]:
tselect = i

Sdtrig_caches_stores_1
Sdtrig_caches_stores_2
Sdtrig_caches_stores_3

cp_cache_zicbom

cbo.clean, cbo.flush, and cbo.inval match as if they are stores

if ZICBOM_SUPPORTED
tdata2 = {scratch/scratch-1/scratch+block/0}
tdata1.select ={0/1}
tdata1.size = {0/1/2/3/4/5/6} (legal sizes of at most XLEN bits)
tdata1.XSL = {100/010/001}
Perform CBO.{CLEAN/FLUSH/INVAL} to {scratch}

Breakpoint exception when tdata2 = scratch and store = 1 and size = 0 and select = 0

4 addrs * 2 selects * legal sizes (up to 7) * 3 XSL * 3 ops

Sdtrig_cache_clears

cp_cache_zicboz

cbo.zero matches as if it is a store

if ZICBOZ_SUPPORTED
tdata2 = {scratch/scratch-1/scratch+block/0}
tdata1.select ={0/1}
tdata1.size = {0/1/2/3/4/5/6} (legal sizes of at most XLEN bits)
tdata1.XSL = {100/010/001}
Perform CBO.ZERO to scratch

Breakpoint exception when tdata2 = scratch and store = 1 and size = 0 and select = 0

4 addrs * 2 selects * legal sizes (up to 7) * 3 XSL

Sdtrig_cbo_zero

cp_cache_zicbop

The prefetch instructions don’t match at all.

if ZICBOP_SUPPORTED
tdata2 = {scratch/0}
tdata1.select ={0/1} (adr)
tdata1.size = 0
tdata1.XSL = 011
Perform PREFETCH.{i/r/w} to scratch

No exceptions

2 values * 2 selects * 3 ops

Sdtrig_prefetch

Address Matches

cp_tdata2_translate

tdata2 can hold valid addresses in all supported translation modes

For each of UDB_SDTRIG_NUM_TRIGGERS in tselect if UDB_SDTRIG_MCONTROL6_SUPPORTED_TRIGGERS[i]:
tdata1 = mcontrol6, select = 0, match = 0, execute = 1, m/s/u/vs/vu = 0 (never fires)
satp.MODE = Bare: CSRW tdata2 = largest PA (2^min(PHYS_ADDR_WIDTH, XLEN) - 1)
for each mode in {Sv39, Sv48, Sv57 on RV64, Sv32 on RV32} if supported:
satp.MODE = mode (root table), CSRW tdata2 = {largest VA with the sign bit clear, smallest VA with it set},
e.g. Sv39 0x0000003FFFFFFFFF, 0xFFFFFFC000000000
CSRR tdata2 after each write

Read value matches written
VAs are sign-extended and PAs zero-extended

NTRIG * (1 + 2 * supported VA modes)

Sdtrig_tdata2_addr_sz1
Sdtrig_vmem
Sdtrig_csr_tdata2_sz2
Sdtrig_pmem

cp_tdata2_translate_exec

An execute trigger matches the virtual address of a translated fetch, not its physical address

for each mode in {Sv39, Sv48, Sv57 on RV64, Sv32 on RV32} if supported:
map the superpage holding a target (nop; jr ra) a second time at the last root slot (a negative VA),
satp.MODE = mode
For each of UDB_SDTRIG_NUM_TRIGGERS in tselect if UDB_SDTRIG_MCONTROL6_SUPPORTED_TRIGGERS[i]:
tdata1 = mcontrol6, select = 0, execute = 1, s = 1
tdata2 = {target VA in the alias, target PA (also its identity-mapped VA)}
call the target at its alias VA
After each case, rvtest_trap_count is written to the signature.

Breakpoint with xepc = the alias VA iff tdata2 = VA

NTRIG * supported VA modes * 2

Sdtrig_vmem
Sdtrig_csr_tdata2_sz2

Trigger Module Registers

cp_tdata_write

Writes to one tdata register must not modify the contents of other tdata registers. Note: type 15 allow any supported value to be written to tdata2/3

For each of UDB_SDTRIG_NUM_TRIGGERS in tselect
tdata1.type = 15
For reg_x in {tdata1, tdata2, tdata3}:
Write all register = 0 (mask tdata1.type)
Read all registers
Write reg_x all 1’s
Read other 2 registers
Then, with trigger 0 disabled (tdata1.type = 15, tdata2 = scratch if it supports mcontrol6):
For reg_x in {tdata1, tdata2, tdata3} of trigger 1:
Read tdata1/2/3 of trigger 0
Select trigger 1, tdata1.type = 15, write reg_x all 0s, then all 1’s
Select trigger 0, read tdata1/2/3 again (each before ^ after is recorded)

No exceptions
Writing one tdata register does not change another
Writing the tdata registers of trigger 1 does not change those of trigger 0

3

Sdtrig_tdata_write

coverpoint drafted: 9/10
coverpoint reviewed: 9/10

cp_csr_access_global

The Trigger Module registers, except scontext, and hcontext, are only accessible in machine and Debug Mode

For x register in {tselect, and tcontrol, mcontext, scontext, hcontext if UDB_x_IMPLEMENTED}:
tdata1 = 0 (disabled), csr write all 0s, write all 1s
if the trigger supports mcontrol6: with tdata1 = 0, CSRW tdata2 = scratch, CSRR tdata2

No exceptions
All registers can be accessed from M-mode

1 + implemented global registers, * 2 values

Sdtrig_trigger_modes

coverpoint drafted: 9/10
coverpoint reviewed: 9/10

cp_csr_access_local

The Trigger Module registers are only accessible in machine and Debug Mode

each of UDB_SDTRIG_NUM_TRIGGERS in tselect:
For x register in {tdata1, tdata2, tdata3, tinfo}:
tdata1 = 0 (disabled), csr write all 0s, write all 1s
if the trigger supports mcontrol6: with tdata1 = 0, CSRW tdata2 = scratch, CSRR tdata2

No exceptions
All registers can be accessed from M-mode

NUM_TRIGGERS * 4 regs * 2 values

Sdtrig_trigger_modes

cp_tselect_trigs

The set of triggers must start at 0 and be contiguous

For tselect = 0 to UDB_SDTRIG_NUM_TRIGGERS -1
CSRR tselect, CSRR tinfo
check tinfo.info != 1 and tinfo bits 3-6 against UDB_SDTRIG_<TYPE>_SUPPORTED_TRIGGERS[tselect]
if the trigger supports mcontrol6: check tinfo.version >= 1

No exceptions
tinfo.info != 1 for all trigger < NUM_TRIGGERS
tinfo.version >= 1 on every trigger that supports mcontrol6

NUM_TRIGGERS

Sdtrig_num_trigs_ge1
Sdtrig_tselect_access
Sdtrig_mcontrol6_dependence

coverpoint drafted: 9/10
coverpoint reviewed: 9/10

cp_tdata1_mode_hardwired

Non supported mode bits are hardwired zero

For each of UDB_SDTRIG_NUM_TRIGGERS in tselect:
enable all priv bits (tdata1.m/s/u/vs/vu = 11111) with tdata1.type = 6
CSRR tdata1 and check type and tdata1.m/s/u/vs/vu: each bit that UDB_SDTRIG_<MODE>_WRITABLE makes writable, and
each bit of a mode the hart lacks (a non-writable bit of an implemented mode is not checked: Sail cannot model it)

Writable mode bits read back 1 and the bits of modes the hart lacks read back 0 after writing all-ones

NTRIGGERS

Sdtrig_mcontrol6_s
Sdtrig_mcontrol6_u
Sdtrig_mcontrol6_vs
Sdtrig_mcontrol6_vu

coverpoint drafted: 9/10
coverpoint reviewed: 9/10

cp_tdata1_dmode

dmode is writable only from Debug Mode

For each of UDB_SDTRIG_NUM_TRIGGERS in tselect, for each supported type in {icount, mcontrol6}:
CSRW tdata1 with dmode = 1 and that type (icount: count = 1, m = 0; mcontrol6: m = 1, XSL = 000, so neither fires)
CSRR tdata1 and check dmode

dmode reads back 0 after an M-mode write of 1

NTRIGGERS * 2 types

Sdtrig_tdata1_dmode_writable

cp_tinfo_read_only

Writing tinfo has no effect

For each of UDB_SDTRIG_NUM_TRIGGERS in tselect:
CSRR tinfo,
CSRW 0’s and 1’s to tinfo,
CSRR tinfo

Writing tinfo has no effect
Supported trigger types have bits enabled in tinfo.info

NTRIGGERS

Sdtrig_tinfo_support

coverpoint drafted: 9/10
coverpoint reviewed: 9/10

Mcontrol6 tests: test fire and don’t fire for each scenario

Repeat for each of UDB_SDTRIG_NUM_TRIGGERS if UDB_SDTRIG_MCONTROL6_SUPPORTED_TRIGGERS[i]:
tselect = i
tdata1 = 0
write tdata2 and tdata3 as necessary
tdata3 = 0 unless otherwise specified (textra = 0, controls context matching)
tdata1.type = 6 (mcontrol6)
tdata1.dmode = 0 (M-mode accessible)
tdata1.action = 0 (breakpoint)
tdata1.uncertainen = 0 (exact match)
unless otherwise specified:
tdata1.m/s/u/vs/vu = (1 for current mode, e.g. 1 in m)
tdata1.select = 0 (adr)
tdata1.size = 0 (any)
tdata1.chain = 0 (disabled)
tdata1.match = 0 (equal)
Perform an instruction that causes trigger to fire/not fire

cp_mcontrol6_priv_bits_s

An mcontrol6 trigger fires in S-mode only when its s bit is set

For each of UDB_SDTRIG_NUM_TRIGGERS in tselect:
mcontrol6 store address trigger on scratch (select = 0, XSL = 010)
tdata1.m/s/u = {s only, m and u only}
sw to scratch in S-mode

Breakpoint exception when tdata1.s = 1
No breakpoint when only the other modes' bits are set

NUM_TRIGGERS * 2 (own bit and fired, other bits only and not fired)

Sdtrig_mcontrol6_s

cp_mcontrol6_execute_adr

tdata2 = {PC address of add x0, x1, x2/0}
tdata1.select = 0 (adr)
tdata1.XSL = 8 combinations
perform add x0, x1, x2

Breakpoint exception on PC of add x0, x1, x2 if tdata2 points to it and tdata1.execute = 1

2 values * 8 XSL

Sdtrig_mcontrol6_s
Sdtrig_mcontrol6_select_address
Sdtrig_mcontrol6_execute
Sdtrig_mcontrol6_store
Sdtrig_mcontrol6_load

comments on test results: Exceptions on triggers when execute = 1

cp_mcontrol6_load_store_adr

tdata2 = {scratch/scratch+8/0}
tdata1.select = 0 (adr)
tdata1.XSL = 8 combinations
perform {SW/ LW 0x12345678} to scratch + {0/8}

Breakpoint exception on LW if access address matches tdata2 and tdata1.load = 1
Breakpoint exception on SW if access address matches tdata2 and tdata1.store = 1

3 addresses * 8 XSL * 2 ops * 2 offsets

Sdtrig_mcontrol6_s
Sdtrig_mcontrol6_select_address
Sdtrig_mcontrol6_execute
Sdtrig_mcontrol6_store
Sdtrig_mcontrol6_load

comments on test results: Exceptions when XSL = 2 or 1 when tdata2 = scratch

cp_mcontrol6_execute_data

tdata2 = {addi x0, x1, 0 opcode (0x00008013)/0x2}
tdata1.select = 1 (data)
tdata1.XSL = 8 combinations
perform addi x0, x1, 0
(not nop, whose opcode also appears in the test environment’s own code; no instruction in the test encodes as 0x2)
on RV64, size = 0 with a 32-bit instruction relies on the zero-extension in Sdtrig_mcontrol6_select_data

Breakpoint exception on fetched instruction if tdata2 matches opcode and tdata1.execute = 1

2 values * 8 XSL

Sdtrig_mcontrol6_select_data
Sdtrig_mcontrol6_execute
Sdtrig_mcontrol6_store
Sdtrig_mcontrol6_load

comments on test results: Exceptions when tdata2 = 0x00008013, and execute = 1

cp_mcontrol6_load_store_data

tdata2 = {random XLEN-wide value / the same value with bit 0 (RV32) or bit 32 (RV64) flipped}
tdata1.select = 1 (data)
tdata1.XSL = 8 combinations
perform {SW/LW (RV32), SD/LD (RV64)} of the value to scratch
(XLEN-wide accesses: with size = 0 a data match is only well-defined when the access size is XLEN)

Breakpoint exception on the load if access data matches tdata2 and tdata1.load = 1
Breakpoint exception on the store if access data matches tdata2 and tdata1.store = 1

8 XSL * 2 ops (tdata2 values not binned because the data a load reads is not visible to coverage)

Sdtrig_mcontrol6_select_data
Sdtrig_mcontrol6_execute
Sdtrig_mcontrol6_store
Sdtrig_mcontrol6_load

comments on test results: Exceptions when td2 = the stored value, and XSL = 1/2/3

cp_mcontrol6_execute_size

tdata2 = {addi x0, x1, 0 opcode/c.nop opcode}
tdata1.select = 1 (data)
tdata1.XSL = 111
tdata1.size = {0/1/2/3/4/5/6} (legal sizes of at most XLEN bits)
perform addi x0, x1, 0
if ZCA_SUPPORTED
perform c.nop
size = 0 with c.nop, or with addi on RV64, relies on the zero-extension in Sdtrig_mcontrol6_select_data

Breakpoint exception if the size of the instruction matches the trigger size in mcontrol6 and tdata1.execute = 1

2 values * legal sizes (up to 7) * 2 ops

Sdtrig_mcontrol6_size_8bit
Sdtrig_mcontrol6_size_16bit
Sdtrig_mcontrol6_size_32bit
Sdtrig_mcontrol6_size_48bit
Sdtrig_mcontrol6_size_64bit

comments on test results: Exceptions when td2 = op, size = 0. Note: warls size to zero

cp_mcontrol6_load_store_size

tdata2 = {scratch/0}
tdata1.select = 0 (adr)
tdata1.XSL = 011
tdata1.size = {0/1/2/3/5} (legal sizes of at most XLEN bits)
perform {lb/lbu/lh/lhu/lw/sb/sh/sw} to scratch with a random value
if RV64 supported, also perform {lwu/ld/sd}
if F_SUPPORTED, also perform {flw/fsw}
if D_SUPPORTED, also perform {fld/fsd}
if ZFH_SUPPORTED, also perform {flh/fsh}
if Q_SUPPORTED, also perform {flq/fsq}
if ZCA_SUPPORTED, also perform c.{lw/sw/lwsp/swsp}
if ZCA_SUPPORTED and RV64, also perform c.{ld/sd/ldsp/sdsp}
if ZCB_SUPPORTED, also perform c.{lbu/lh/lhu/sb/sh}
if ZCF_SUPPORTED and RV32, also perform c.{flw/flwsp/fsw/fswsp}
if ZCD_SUPPORTED, also perform c.{fld/fldsp/fsd/fsdsp}

Breakpoint exception if the size of the memory access matches the trigger size in mcontrol6

2 values * legal sizes (up to 5) * up to 36 instructions

Sdtrig_mcontrol6_size_8bit
Sdtrig_mcontrol6_size_16bit
Sdtrig_mcontrol6_size_32bit
Sdtrig_mcontrol6_size_64bit

Sizes 4 (48-bit) and 6 (128-bit) are not tested; size 6 is never written (Sail 0.16 disables sizes above XLEN)

cp_mcontrol6_match

Test boundaries for match conditions

tdata1.select = 1 (data)
tdata1.XSL= 010
tdata1.match = {0/2/3/8}
if RV32:
tdata2 = {0x12345678}
perform SW{0x0},{0x12345678-1} {0x12345678},{0x12345678+1},{0xFFFFFFFF} to scratch
if RV64:
tdata2 = {0x123456789ABCDEF0}
perform SD{0x0},{0x123456789ABCDEF0-1} {0x123456789ABCDEF0},{0x123456789ABCDEF0+1},{0xFFFFFFFFFFFFFFFF} to scratch

Breakpoint exception if the store data meets the condition set by tdata1.match

legal matches (up to 4) * 5 ops

Sdtrig_mcontrol6_match_equal
Sdtrig_mcontrol6_match_ge
Sdtrig_mcontrol6_match_lt
Sdtrig_mcontrol6_match_not_equal

cp_mcontrol6_match_napot

tdata1.select = 1 (data)
tdata1.XSL= 010
tdata1.match = {1/9}
if RV32:
tdata2 = 0xFFFFFFFF
for x in 0:min(UDB_SDTRIG_MCONTROL6_MASKMAX6, XLEN-1)-1 tdata2[x] = 0 (legal NAPOT sizes only)
perform SW{0x0}, {0x12345678}, {0xFFFFFFFF} to scratch
if RV64:
tdata2 = 0xFFFFFFFFFFFFFFFF
for x in 0:min(UDB_SDTRIG_MCONTROL6_MASKMAX6, XLEN-1)-1 tdata2[x] = 0 (legal NAPOT sizes only)
perform SD{0x0}, {0x123456789ABCDEF0},{0xFFFFFFFFFFFFFFFF} to scratch

Breakpoint exception if the store data meets the condition set by tdata1.match
(zero bit x is a NAPOT range of 2^(x+1) bytes, so every range from 2^1 to 2^min(maskmax6, XLEN-1) is tested)

legal matches (up to 2) * min(UDB_SDTRIG_MCONTROL6_MASKMAX6, XLEN-1) values * 3 ops

Sdtrig_mcontrol6_match_napot
Sdtrig_mcontrol6_match_not_napot
Sdtrig_mcontrol6_match_napot_legal
Sdtrig_mcontrol6_match_napot_mask

cp_mcontrol6_match_mask

tdata1.select = 1 (data)
tdata1.XSL= 010
tdata1.match = {4/5/12/13} (each value in UDB_SDTRIG_MCONTROL6_MATCH_LEGAL_VALUES)
tdata2[XLEN-1:XLEN/2] is the mask and tdata2[XLEN/2-1:0] the value
if RV32:
tdata2 = {0xF0F0_A0B0}
perform SW{0x0}, {0xF0F0_A0B0}, {0xFFFFFFFF},
low half {0x0000_A0B0}, {0x0000_A1B2}, {0x0000_F0F0}, {0x0001_A0B0},
high half {0xA0B0_0000}, {0xA1B2_0000}, {0xF0F0_0000}, {0xA0B0_0001} to scratch
if RV64:
tdata2 = {0xF0F0F0F0_A0B0C0D0}
perform SD{0x0}, {0xF0F0F0F0_A0B0C0D0}, {0xFFFFFFFFFFFFFFFF},
low half {0x00000000_A0B0C0D0}, {0x00000000_A1B2C3D4}, {0x00000000_F0F0F0F0}, {0x00000001_A0B0C0D0},
high half {0xA0B0C0D0_00000000}, {0xA1B2C3D4_00000000}, {0xF0F0F0F0_00000000}, {0xA0B0C0D0_00000001} to scratch
in each half: the value, differs only outside the mask, differs inside the mask, the value with the other half nonzero

Breakpoint exception if the store data meets the condition set by tdata1.match

legal matches (up to 4) * 11 values

Sdtrig_mcontrol6_match_mask_low
Sdtrig_mcontrol6_match_mask_high
Sdtrig_mcontrol6_match_not_mask_low
Sdtrig_mcontrol6_match_not_mask_high

cp_mcontrol6_match_size_store

Every legal match crossed with every legal size on a select = 1 store trigger in S-mode

As SdtrigSm cp_mcontrol6_match_size_store, with tdata1.s = 1 and the stores executed in S-mode.
tdata1 is written through T-SBI.

As SdtrigSm cp_mcontrol6_match_size_store

NTRIG * legal matches * legal sizes * {fired, not fired, other width}

Sdtrig_mcontrol6_comparisons
Sdtrig_mcontrol6_select_data

cp_mcontrol6_match_size_load

Every legal match crossed with every legal size on a select = 1 load trigger in S-mode

As SdtrigSm cp_mcontrol6_match_size_load, with tdata1.s = 1 and the loads executed in S-mode.
tdata1 is written through T-SBI.

As SdtrigSm cp_mcontrol6_match_size_load

NTRIG * legal matches * legal sizes * {fired, not fired, other width}

Sdtrig_mcontrol6_comparisons
Sdtrig_mcontrol6_select_data

MControl6 Chain

Repeat for each of UDB_SDTRIG_NUM_TRIGGERS if UDB_SDTRIG_MCONTROL6_SUPPORTED_TRIGGERS[i] and UDB_SDTRIG_MCONTROL6_SUPPORTED_TRIGGERS[i+1]:
tselect = i
write tdata2 and tdata3 as necessary
tdata3 = 0 unless otherwise specified (textra = 0, controls context matching)
tdata1.type = 6 (mcontrol6)
tdata1.dmode = 0 (M-mode accessible)
tdata1.action = 0 (breakpoint)
tdata1.uncertainen = 0 (exact match)
unless otherwise specified:
tdata1.m/s/u/vs/vu = (1 for current mode, e.g. 1 in m)
tdata1.select = 0 (adr)
tdata1.size = 0 (any)
tdata1.chain = 0 (disabled)
tdata1.match = 0 (equal)
Perform an instruction that causes trigger to fire/not fire

cp_mcontrol6_chain_adr

Trigger i (Tselect = i):
tdata1.select = 0 (address)
tdata1.chain = 1
tdata2 = {scratch}
Trigger i+1 (Tselect = i + 1):
tdata1.select = 1 (data)
tdata1.chain = 0
tdata2 = {random XLEN-wide value}
tdata1.XSL = 010
perform SW (RV32) / SD (RV64) {the value/0} to {scratch/scratch+8} (XLEN-wide, as size = 0 needs)

Breakpoint exception from final trigger in chain if all triggers match simultaneously

2 store values * 2 addresses

Sdtrig_mcontrol6_chain_start

comments on test results: Be careful of order when setting up chain, enable chain last

Notes:

uncertain and uncertainen not tested because optional and unpredictable

vs, vu deferred to SdtrigH

hit not tested because optional and implementation-dependent

action other than 0 not tested until those features are supported (e.g. SdtrigSdext/SdtrigTrace)

Icount tests: test fire and don’t fire for each scenario

Repeat for each of UDB_SDTRIG_NUM_TRIGGERS if UDB_SDTRIG_ICOUNT_SUPPORTED_TRIGGERS[i]:
tselect = i
tdata1 = 0
tdata3 = 0 unless otherwise specified (textra = 0, controls context matching)
tdata1.type = 3 (icount)
tdata1.dmode = 0 (M-mode accessible)
tdata1.action = 0 (breakpoint)
unless otherwise specified:
tdata1.m/s/u/vs/vu = (1 for current mode, e.g. 1 in m)
Perform an instruction that causes trigger to fire/not fire
After each case, the tdata1 readback (without hit, which is optional and not checked) and rvtest_trap_count
are written to the signature, so a fire or missing fire is reported at that case.

cp_icount_hardwired

if UDB_SDTRIG_ICOUNT_COUNT_HARDWIRED_1 (imperas-rv64-max; cp_icount_instr, cp_icount_eq0 and cp_icount_self_write
need a writable count and run otherwise):
tdata1.m/s/u/vs/vu = 11111
perform nop in S-mode
CSRR tdata1.m,s,u,vs,vu
CSRR tdata1.count,pending

breakpoint exception occurs,
m,s,u,vs,vu are cleared, pending is cleared

1

Sdtrig_icount_match_eq1

cp_icount_instr

tdata.pending = 0
tdata1.count = 9
tdata1.s = {0/1}
perform 9x nop in S-mode
CSRR tdata1
CSRR tval

Count decreases when the instruction retires after having been fetched in S-mode and tdata1.s = 1. Tval=0 after firing, pending=0 after firing.

2 priv bits (tdata1 readback: s clear and count unchanged, s set and counted to 0)

Sdtrig_icount_s
Sdtrig_icount_access
Sdtrig_icount_match1
Sdtrig_icount_match_gt1
Sdtrig_icount_pending
Sdtrig_icount_action0

cp_icount_instr_fire

icount fires after count instructions

cp_icount_instr with tdata1.s = 1: the breakpoint taken while the icount trigger armed with count = 9 is selected

Breakpoint exception with tval = 0, before the instruction after the 9th

1

Sdtrig_icount_s
Sdtrig_icount_match1
Sdtrig_icount_match_gt1
Sdtrig_icount_action0

cp_icount_trap

tdata1.count = 1
perform illegal instruction trap in S-mode, CSRR tdata1.count

Count decreases when a trap is taken from a privilege mode where the trigger is enabled

2 priv bits (tdata1 readback: s clear and count unchanged, s set and counted to 0)

Sdtrig_icount_match2
Sdtrig_icount_match_non_reexecuted
Sdtrig_icount_all_traps_match

cp_icount_trap_fire

A trap taken in a mode where the trigger is enabled is counted, and pending fires after the handler returns

cp_icount_trap with tdata1.s = 1: the breakpoint taken on the xRET that returns from the illegal-instruction trap

Breakpoint exception on return from the trap handler

1

Sdtrig_icount_match2
Sdtrig_icount_pending_set

cp_icount_eq0

tdata1.pending = {0/1}
CSRW tdata1.count = 0
perform 9x nop in S-mode
CSRR tdata1.count

Count stays at 0 until explicitly written
Breakpoint exception occurs when tdata1.pending = 1

2 pending (tdata1 readback: count stays 0, pending cleared)

Sdtrig_icount_count_zero

cp_icount_eq0_fire

A pending icount trigger fires before the next instruction

cp_icount_eq0 with tdata1.pending = 1: the breakpoint taken on return to S-mode after the CSRW that writes count = 0, pending = 1

Breakpoint exception before the next S-mode instruction (after the T-SBI return); pending is cleared

1

Sdtrig_icount_pending

Itrigger tests: test fire and don’t fire for each scenario

Repeat for each of UDB_SDTRIG_NUM_TRIGGERS if UDB_SDTRIG_ITRIGGER_SUPPORTED_TRIGGERS[i]:
tselect = i
tdata1 = 0
tdata3 = 0 unless otherwise specified (textra = 0, controls context matching)
tdata1.type = 4 (itrigger)
tdata1.dmode = 0 (M-mode accessible)
tdata1.action = 0 (breakpoint)
unless otherwise specified:
tdata1.m/s/u/vs/vu = (1 for current mode, e.g. 1 in m)
Perform an interrupt that causes trigger to fire/not fire

cp_itrigger_s

An itrigger is evaluated on a selected interrupt taken from S-mode and handled in S

tdata2[x] = 1 for x in {1,5,9,13} if INTERRUPTx_SUPPORTED
tdata1.s = {0/1}, mideleg[x] = 1
take interrupt x while executing in S-mode
After each case, rvtest_trap_count is written to the signature.

No breakpoint when tdata1.s = 0. With tdata1.s = 1 the trigger matches as the trap is taken; the breakpoint
(medeleg[3] = 1) is then taken in the S-mode handler, where harts using sstatus.SIE re-entrancy suppress it
and harts using tcontrol take it into M. cp_itrigger_s/u in SdtrigSm check firing with medeleg[3] = 0

NTRIG * 4 interrupts * 2 s bits

Sdtrig_itrigger_s

cp_itrigger_s_other

An itrigger does not fire on an interrupt tdata2 does not select

as cp_itrigger_s, taking another delegated S-level interrupt (5, or 1 when x = 5) instead of x

No breakpoint

NTRIG * 2 s bits

Sdtrig_itrigger_s

Etrigger tests: test fire and don’t fire for each scenario

Repeat for each of UDB_SDTRIG_NUM_TRIGGERS if UDB_SDTRIG_ETRIGGER_SUPPORTED_TRIGGERS[i]:
tselect = i
tdata1 = 0
tdata3 = 0 unless otherwise specified (textra, controls context matching)
tdata1.type = 5 (etrigger)
tdata1.dmode = 0 (M-mode accessible)
tdata1.action = 0 (breakpoint)
unless otherwise specified:
tdata1.m/s/u/vs/vu = (1 for current mode, e.g. 1 in m)

cp_etrigger_s

An etrigger is evaluated on a selected exception raised in S-mode

tdata2[x] = 1 for x in {1,2,5,7,9, and 12,13,15 with Sv}
tdata1.s = {0/1}, medeleg as the suite boots
raise exception x while executing in S-mode
After each case, rvtest_trap_count is written to the signature.

No breakpoint when tdata1.s = 0, or when the exception is handled in M (ecall from S).
The other exceptions are delegated and handled in S: with tdata1.s = 1 the breakpoint (medeleg[3] = 1) is
then taken in the S-mode handler, where harts using sstatus.SIE re-entrancy suppress it and harts using
tcontrol take it into M. cp_etrigger_s/u_deleg in SdtrigSm check firing with medeleg[3] = 0

NTRIG * 8 exceptions * 2 s bits

Sdtrig_etrigger_s

cp_etrigger_s_other

An etrigger does not fire on an exception tdata2 does not select

tdata2[x] = 1 for each x above and x in {0,3,4,6} and the other modes' ecalls, tdata1.s = {0/1}
raise an illegal instruction while executing in S-mode

No breakpoint

NTRIG * 2 s bits

Sdtrig_etrigger_s

Textra tests: test fire and don’t fire for each scenario

Repeat for each of UDB_SDTRIG_NUM_TRIGGERS if UDB_TDATA3_IMPLEMENTED:
tselect = i
tdata1 = 0
tdata1.dmode = 0 (M-mode accessible)
tdata1.action = 0 (breakpoint)
unless otherwise specified:
tdata3.mhselect = 0
tdata3.sselect = 0
tdata1.m/s/u/vs/vu = (1 for current mode, e.g. 1 in m)
other fields depending on trigger type should use the defaults defined in the sections above
Perform an instruction that causes trigger to fire/not fire

cp_textra_mcontext

only run tests if MCONTEXT_IMPLEMENTED:
repeat for each trigger type supported:
tdata3.mhselect = 4
if RV32:
mcontext[5:0] = 010101
tdata3.mhvalue = {010101/000000/010100}
if RV64:
mcontext[12:0] = 0x1555
tdata3.mhvalue = 0x{1555/0000/1554}
if ICOUNT_SUPPORTED:
tdata1.type = 3 (icount)
tdata1.count = 1
tdata2 = 0
perform nop in S-mode
if MCONTROL6_SUPPORTED
tdata1.type = 6 (mcontrol6)
tdata1.select = 1 (data)
tdata2 = {0x12345678 (RV32) / 0xEDCBA98712345678 (RV64)}
perform SW (RV32) / SD (RV64) of the same value (an XLEN-wide access, as size = 0 needs)
After each case, rvtest_trap_count is written to the signature.

Breakpoint exception if mhvalue equals mcontext

3 mhvalues * 2 trigger types (icount, mcontrol6)

Sdtrig_textra32_filter_modes
Sdtrig_icount_textra
Sdtrig_mcontrol6_textra
Sdtrig_textra32_mhselect_mcontext

cp_textra_scontext

only run tests if SCONTEXT_IMPLEMENTED:
repeat for each trigger type supported:
tdata3.sselect = 1
if RV32:
scontext = {00001234}
tdata3.svalue = 0x{0000/0034/1200/1234}
tdata3.sbytemask = 4 combinations
if RV64:
scontext = {0x12345678}
tdata3.svalue = 0x{00000000/12345600/12340078/12005678/00345678/12345678}
tdata3.sbytemask = {0000/0001/0010/0100/1000/1111}
if ICOUNT_SUPPORTED:
tdata1.type = 3 (icount)
tdata1.count = 1
tdata2 = 0
perform nop in S-mode
if MCONTROL6_SUPPORTED
tdata1.type = 6 (mcontrol6)
tdata1.select = 1 (data)
tdata2 = {0x12345678 (RV32) / 0xEDCBA98712345678 (RV64)}
perform SW (RV32) / SD (RV64) of the same value (an XLEN-wide access, as size = 0 needs)
After each case, rvtest_trap_count is written to the signature.

Breakpoint exception when svalue equals scontext and mask ignores A’s

if RV32:
4 svalues * 4 masks * 2 trigger types
if RV64:
6 svalues * 6 masks * 2 trigger types

Sdtrig_textra32_filter_modes
Sdtrig_icount_textra
Sdtrig_mcontrol6_textra
Sdtrig_textra32_sselect_scontext
Sdtrig_textra32_sbytemask
Sdtrig_textra64_sbytemask
Sdtrig_textra32_byte_granular
Sdtrig_textra64_byte_granular

cp_textra_scontext_all

With every scontext byte masked, the scontext compare always matches

only run tests if SCONTEXT_IMPLEMENTED:
as cp_textra_scontext, with tdata3.sselect = 1 and tdata3.sbytemask = all ones (RV32 11, RV64 1111)

Breakpoint exception for every svalue

2 trigger types

cp_textra_double_context

only run tests if MCONTEXT_IMPLEMENTED and SCONTEXT_IMPLEMENTED:
repeat for each trigger type supported:
tdata3.mhselect = {0/4}
tdata3.sselect = {0/1}
tdata3.sbytemask = 0
if RV32:
mcontext[5:0] = 111111
tdata3.mhvalue = {000000/111111}
if RV64:
mcontext[12:0] = 0x1FFF
tdata3.mhvalue = 0x{0000/1FFF}
if RV32:
scontext = 0x0000FFFF
tdata3.svalue = 0x{0000/FFFF}
if RV64:
scontext = 0xFFFFFFFF
tdata3.svalue = 0x{00000000/FFFFFFFF}
if ICOUNT_SUPPORTED:
tdata1.type = 3 (icount)
tdata1.count = 1
tdata2 = 0
perform nop in S-mode
if MCONTROL6_SUPPORTED
tdata1.type = 6 (mcontrol6)
tdata1.select = 1 (data)
tdata2 = {0x12345678 (RV32) / 0xEDCBA98712345678 (RV64)}
perform SW (RV32) / SD (RV64) of the same value (an XLEN-wide access, as size = 0 needs)
After each case, rvtest_trap_count is written to the signature.

Breakpoint exception when all enabled context numbers match

2 mhselect * 2 sselect * 2 mhvalue * 2 svalue

Sdtrig_textra32_mhselect_mcontext
Sdtrig_textra32_sselect_scontext
Sdtrig_textra32_mhselect_ignore
Sdtrig_textra32_sselect_ignore

cp_textra_asid

only run tests if SDTRIG_TEXTRA_SSELECT_ASID_MATCH, ASID_WIDTH >= 2, SDTRIG_TEXTRA_SVALUE_LEN >= ASID_WIDTH, and Sv39 (RV64) or Sv32 (RV32) is supported.
satp selects Sv39/Sv32 with ASID X and the root page table, whose boot identity map runs the test and its
S-mode trap handler (satp.MODE=Bare with a nonzero ASID is UNSPECIFIED).
X = 2^UDB_ASID_WIDTH-2; ASIDMAX = 9 (RV32) or 16 (RV64)
CSRW satp = {MODE=Sv39/Sv32, ASID=X, PPN=root page table}
repeat for each trigger type supported:
tdata3.sselect = 2
tdata3.svalue = {X / 0 / X^1 / X | 1 << ASIDMAX}
if ICOUNT_SUPPORTED:
tdata1.type = 3 (icount)
tdata1.count = 1
tdata2 = 0
perform nop in S-mode
if MCONTROL6_SUPPORTED
tdata1.type = 6 (mcontrol6)
tdata1.select = 1 (data)
tdata2 = {0x12345678 (RV32) / 0xEDCBA98712345678 (RV64)}
perform SW (RV32) / SD (RV64) of the same value (an XLEN-wide access, as size = 0 needs)

Breakpoint exception if ASID in satp equals the lower ASIDMAX bits of svalue.

2 types * 2 asid_match

Sdtrig_textra32_sselect_asid1
Sdtrig_textra32_sselect_asid3

cp_textra_asid_sbytemask

sbytemask applies only with sselect = 1

as cp_textra_asid, with tdata3.sbytemask = all ones (RV32 11, RV64 1111) and tdata3.svalue = {X / X^1}

Breakpoint exception if ASID in satp equals the lower ASIDMAX bits of svalue.
sbytemask is ignored with sselect = 2, so it does not hide the mismatch in svalue = X^1

2 types * 2 asid_match

Sdtrig_textra32_byte_mask_applies
Sdtrig_textra64_byte_mask_applies

cp_textra_mhselect_no_h

Without H, mhselect holds only 0 or 4

only run tests if H is not supported; the tdata3 accesses run in M-mode (through T-SBI in SdtrigS).
repeat for each trigger type supported:
arm the trigger so it never fires (icount: count = 1, m = 0; mcontrol6: select = 1, XSL = 000)
CSRW tdata3.mhselect = {1/2/3/5/6/7}
CSRR tdata3 and check mhselect

mhselect reads back 0 or 4 (which of the two is implementation-defined, so only that is recorded)

2 types * 6 mhselect values

Sdtrig_textra32_mhselect_no_h

Actions: only action 0 (breakpoint) is tested here (sufficient for RVA23). Eventually add SdtrigSdext with action 1, SdtrigEtrace for Trace 2-4, SdtrigExternal for 8-9

SdtrigU

Tests run in U-mode with tdata1.u = 1, and the rows mirrored from SdtrigSm read U-mode for M-mode. The trigger CSRs are accessed through T-SBI, so those accesses run in M-mode; cp_csr_access_trap_u instead accesses them directly from U-mode, which traps. The icount readbacks are sampled on those M-mode accesses, as in SdtrigSm medeleg[3] = 1 (breakpoints from triggers are taken in S-mode) unless the hart has no S-mode or hard-wires it to 0 (tcontrol); then they are taken in M-mode. Other assumptions are inherited from SdtrigSm cp_csr_access_common runs only in SdtrigSm. The trigger-module register tests, cp_tdata2_translate/exec, cp_textra_asid/_asid_sbytemask and cp_textra_mhselect_no_h run in SdtrigSm and SdtrigS: their accesses run in M-mode or need S-mode paging. Only SdtrigSm runs cp_csr_unimplemented and the itrigger/etrigger cases that need traps handled in M or medeleg[3] = 0 (cp_itrigger_m/s, cp_etrigger_m/s/_deleg, cp_textra_itrigger*, cp_textra_etrigger_*). Here an itrigger or etrigger fires on a trap handled in S only on harts using tcontrol, so cp_itrigger_u and cp_etrigger_u record the trap and the tdata1.u setting, and the signature checks the outcome

Table 348. SdtrigU Coverpoints
Coverpoint Goal Feature Description Expectation Bins Normative Rule Notes

Access

cp_csr_access_trap_u

The M-level trigger CSRs are not accessible from U-mode

For x in {tselect, tdata1, tdata2, tdata3, tinfo}, and tcontrol if UDB_TCONTROL_IMPLEMENTED and mcontext if UDB_MCONTEXT_IMPLEMENTED:
csrr x, then csrw x, directly from U-mode (not through T-SBI)

Illegal instruction exception on every access (into S-mode when medeleg[2] = 1, else into M-mode)

2 accesses * implemented M-level trigger CSRs (5-7)

Sdtrig_trigger_modes
Sdtrig_trigger_modes_1
Sdtrig_mcontext_access

Native Triggers

cp_breakpoint_u

Triggers enabled for U-mode fire in U-mode

For each of UDB_SDTRIG_NUM_TRIGGERS in tselect, for each supported trigger type in {icount, mcontrol6}:
arm the trigger with tdata1.u = 1 (T-SBI)
run the U-mode instruction that matches it

Breakpoint exception taken from U-mode (into S-mode when medeleg[3] = 1, else into M-mode)

NUM_TRIGGERS * 2 types

Sdtrig_mcontrol6_u
Sdtrig_icount_u

cp_breakpoint_delegate_u

Breakpoints caused by triggers can be delegated

if S_SUPPORTED
medeleg[3] = {0/1} (written in M-mode: T-SBI does not write medeleg)
For each of UDB_SDTRIG_NUM_TRIGGERS in tselect, for each supported trigger type in {icount, mcontrol6}:
arm the trigger with tdata1.u = 1 (T-SBI)
run the U-mode instruction that fires it
After each case, rvtest_trap_count is written to the signature

Breakpoint exception taken into M when medeleg[3] = 0 and into S when medeleg[3] = 1

NUM_TRIGGERS * 2 types * 2 medeleg

Sdtrig_breakpoint_delegated

A Extension

Repeat for each of UDB_SDTRIG_NUM_TRIGGERS if UDB_SDTRIG_MCONTROL6_SUPPORTED_TRIGGERS[i]:
tselect = i

cp_lrsc_addr

lr instructions are loads
sc instructions are stores

if ZALRSC_SUPPORTED
tdata2 = {scratch/0}
tdata1.select = 0 (adr)
tdata1.XSL = {100/010/001}
if RV32:
Perform LR.W, SC.W 0x12345678 to scratch
if RV64:
Perform LR.D, SC.D 0x123456789ABCDEF0 to scratch

Breakpoint exception when mem access address matches tdata2 and
- sc is performed while Store = 1 or
- lr is performed while Load = 1

if RV32:
2 address * 3 XSL * 2 ops
if RV64:
2 address * 3 XSL * 4 ops

Sdtrig_Aext_lr_op
Sdtrig_Aext_sc_op

cp_lrsc_data

lr instructions are loads
sc instructions are stores

if ZALRSC_SUPPORTED
tdata1.select = 1 (data)
tdata1.XSL = {100/010/001}
if RV32:
tdata2 = {0x12345678/0}
Perform LR.W, SC.W 0x12345678 to scratch
if RV64:
tdata2 = {0x123456789ABCDEF0/0}
Perform LR.D, SC.D 0x123456789ABCDEF0 to scratch

Breakpoint exception when mem access data matches tdata2 and
- sc is performed while Store = 1 or
- lr is performed while Load = 1

2 tdata2 * 3 XSL * 2 ops (lr/sc of XLEN width; size=0 data matches are defined only for XLEN-wide accesses)

Sdtrig_Aext_lr_op
Sdtrig_Aext_sc_op

cp_amo

Amo is a load for the read portion and a store for the write portion

if ZAAMO_SUPPORTED
tdata2 = {scratch/0}
tdata1.select = 0 (adr)
tdata1.XSL = {100/010/001}
Perform each AMO (amoswap/add/and/or/xor/max/maxu/min/minu .w, and .d if RV64) to scratch with rd != x0

Breakpoint exception if load or store are set and the access address matches tdata2

2 address * 3 XSL * 9 (RV64 18) AMOs

Sdtrig_AMO_read
Sdtrig_AMO_read_addr
Sdtrig_AMO_store
Sdtrig_AMO_store_addr

Notes:
UNSPECIFIED whether failing SC instructions are stores; do not test.
UNSPECIFIED whether amo’s match on data: do not test

Combined Accesses

Repeat for each of UDB_SDTRIG_NUM_TRIGGERS if UDB_SDTRIG_MCONTROL6_SUPPORTED_TRIGGERS[i]:
tselect = i

UDB_VECTOR_SEW

cp_vector_load_store

Accesses match as if it performed a load/store of size SEW

if ZVL32B_SUPPORTED
tdata2 = {scratch/0}
tdata1.size = {0/1/2/3/4/5/6} (legal sizes of at most XLEN bits)
tdata1.select = 0 (adr)
tdata1.XSL = {010/001}
Vsetivli x0, 1, e{8/16/32/64}, m4, ta, ma (e64 only if ZVE64X_SUPPORTED)
Perform v{l/s}e{8/16/32/64}.v to scratch

Breakpoint exception if the tdata2 matches a address in the vector store and tdata1.size = SEW or 0

2 address * legal sizes (up to 7) * 4 SEW * 2 ops

Sdtrig_mult_mem_access

cp_vector_accesses

Accesses match as if happened individually

if ZVL32B_SUPPORTED
tdata2 = {scratch/scratch+8/0}
tdata1.select = 0 (adr)
tdata1.XSL = {010/001}
Vsetivli x0, {1/9}, e{8/16/32/64}, m4, ta, ma (e64 only if ZVE64X_SUPPORTED)
Perform v{l/s}e{8/16/32/64}.v to scratch

Breakpoint exception if the tdata2 = scratch
Breakpoint exception when tdata2 = scratch+8 and vl reaches it (AVL 9; vl = VLMAX < 9 for e64 at VLEN 128)

3 address * 2 Vector Lengths * 4 SEW * 2 ops

Sdtrig_mult_mem_access

cp_vector_mask

Masked vector operations do not match

if ZVL32B_SUPPORTED
tdata2 = {scratch+8}
tdata1.select = 0 (adr)
tdata1.XSL = {010/001}
Vsetivli x0, 9, e{8/16/32/64}, m4, ta, mu (e64 only if ZVE64X_SUPPORTED)
v0 = mask with the element at scratch+8 {active/inactive}
Perform v{l/s}e{8/16/32/64}.v to scratch, v0.t

Breakpoint exception when the element at tdata2 is active
No breakpoint exception when the element at tdata2 is masked off

2 mask states * 4 SEW * 2 ops

Sdtrig_mult_mem_access

Cache Operations

Repeat for each of UDB_SDTRIG_NUM_TRIGGERS if UDB_SDTRIG_MCONTROL6_SUPPORTED_TRIGGERS[i]:
tselect = i

Sdtrig_caches_stores_1
Sdtrig_caches_stores_2
Sdtrig_caches_stores_3

cp_cache_zicbom

cbo.clean, cbo.flush, and cbo.inval match as if they are stores

if ZICBOM_SUPPORTED
tdata2 = {scratch/scratch-1/scratch+block/0}
tdata1.select ={0/1}
tdata1.size = {0/1/2/3/4/5/6} (legal sizes of at most XLEN bits)
tdata1.XSL = {100/010/001}
Perform CBO.{CLEAN/FLUSH/INVAL} to {scratch}

Breakpoint exception when tdata2 = scratch and store = 1 and size = 0 and select = 0

4 addrs * 2 selects * legal sizes (up to 7) * 3 XSL * 3 ops

Sdtrig_cache_clears

cp_cache_zicboz

cbo.zero matches as if it is a store

if ZICBOZ_SUPPORTED
tdata2 = {scratch/scratch-1/scratch+block/0}
tdata1.select ={0/1}
tdata1.size = {0/1/2/3/4/5/6} (legal sizes of at most XLEN bits)
tdata1.XSL = {100/010/001}
Perform CBO.ZERO to scratch

Breakpoint exception when tdata2 = scratch and store = 1 and size = 0 and select = 0

4 addrs * 2 selects * legal sizes (up to 7) * 3 XSL

Sdtrig_cbo_zero

cp_cache_zicbop

The prefetch instructions don’t match at all.

if ZICBOP_SUPPORTED
tdata2 = {scratch/0}
tdata1.select ={0/1} (adr)
tdata1.size = 0
tdata1.XSL = 011
Perform PREFETCH.{i/r/w} to scratch

No exceptions

2 values * 2 selects * 3 ops

Sdtrig_prefetch

Mcontrol6 tests: test fire and don’t fire for each scenario

Repeat for each of UDB_SDTRIG_NUM_TRIGGERS if UDB_SDTRIG_MCONTROL6_SUPPORTED_TRIGGERS[i]:
tselect = i
tdata1 = 0
write tdata2 and tdata3 as necessary
tdata3 = 0 unless otherwise specified (textra = 0, controls context matching)
tdata1.type = 6 (mcontrol6)
tdata1.dmode = 0 (M-mode accessible)
tdata1.action = 0 (breakpoint)
tdata1.uncertainen = 0 (exact match)
unless otherwise specified:
tdata1.m/s/u/vs/vu = (1 for current mode, e.g. 1 in m)
tdata1.select = 0 (adr)
tdata1.size = 0 (any)
tdata1.chain = 0 (disabled)
tdata1.match = 0 (equal)
Perform an instruction that causes trigger to fire/not fire

cp_mcontrol6_priv_bits_u

An mcontrol6 trigger fires in U-mode only when its u bit is set

For each of UDB_SDTRIG_NUM_TRIGGERS in tselect:
mcontrol6 store address trigger on scratch (select = 0, XSL = 010)
tdata1.m/s/u = {u only, m and s only}
sw to scratch in U-mode

Breakpoint exception when tdata1.u = 1
No breakpoint when only the other modes' bits are set

NUM_TRIGGERS * 2 (own bit and fired, other bits only and not fired)

Sdtrig_mcontrol6_u

cp_mcontrol6_execute_adr

tdata2 = {PC address of add x0, x1, x2/0}
tdata1.select = 0 (adr)
tdata1.XSL = 8 combinations
perform add x0, x1, x2

Breakpoint exception on PC of add x0, x1, x2 if tdata2 points to it and tdata1.execute = 1

2 values * 8 XSL

Sdtrig_mcontrol6_u
Sdtrig_mcontrol6_select_address
Sdtrig_mcontrol6_execute
Sdtrig_mcontrol6_store
Sdtrig_mcontrol6_load

comments on test results: Exceptions on triggers when execute = 1

cp_mcontrol6_load_store_adr

tdata2 = {scratch/scratch+8/0}
tdata1.select = 0 (adr)
tdata1.XSL = 8 combinations
perform {SW/ LW 0x12345678} to scratch + {0/8}

Breakpoint exception on LW if access address matches tdata2 and tdata1.load = 1
Breakpoint exception on SW if access address matches tdata2 and tdata1.store = 1

3 addresses * 8 XSL * 2 ops * 2 offsets

Sdtrig_mcontrol6_u
Sdtrig_mcontrol6_select_address
Sdtrig_mcontrol6_execute
Sdtrig_mcontrol6_store
Sdtrig_mcontrol6_load

comments on test results: Exceptions when XSL = 2 or 1 when tdata2 = scratch

cp_mcontrol6_execute_data

tdata2 = {addi x0, x1, 0 opcode (0x00008013)/0x2}
tdata1.select = 1 (data)
tdata1.XSL = 8 combinations
perform addi x0, x1, 0
(not nop, whose opcode also appears in the test environment’s own code; no instruction in the test encodes as 0x2)
on RV64, size = 0 with a 32-bit instruction relies on the zero-extension in Sdtrig_mcontrol6_select_data

Breakpoint exception on fetched instruction if tdata2 matches opcode and tdata1.execute = 1

2 values * 8 XSL

Sdtrig_mcontrol6_select_data
Sdtrig_mcontrol6_execute
Sdtrig_mcontrol6_store
Sdtrig_mcontrol6_load

comments on test results: Exceptions when tdata2 = 0x00008013, and execute = 1

cp_mcontrol6_load_store_data

tdata2 = {random XLEN-wide value / the same value with bit 0 (RV32) or bit 32 (RV64) flipped}
tdata1.select = 1 (data)
tdata1.XSL = 8 combinations
perform {SW/LW (RV32), SD/LD (RV64)} of the value to scratch
(XLEN-wide accesses: with size = 0 a data match is only well-defined when the access size is XLEN)

Breakpoint exception on the load if access data matches tdata2 and tdata1.load = 1
Breakpoint exception on the store if access data matches tdata2 and tdata1.store = 1

8 XSL * 2 ops (tdata2 values not binned because the data a load reads is not visible to coverage)

Sdtrig_mcontrol6_select_data
Sdtrig_mcontrol6_execute
Sdtrig_mcontrol6_store
Sdtrig_mcontrol6_load

comments on test results: Exceptions when td2 = the stored value, and XSL = 1/2/3

cp_mcontrol6_execute_size

tdata2 = {addi x0, x1, 0 opcode/c.nop opcode}
tdata1.select = 1 (data)
tdata1.XSL = 111
tdata1.size = {0/1/2/3/4/5/6} (legal sizes of at most XLEN bits)
perform addi x0, x1, 0
if ZCA_SUPPORTED
perform c.nop
size = 0 with c.nop, or with addi on RV64, relies on the zero-extension in Sdtrig_mcontrol6_select_data

Breakpoint exception if the size of the instruction matches the trigger size in mcontrol6 and tdata1.execute = 1

2 values * legal sizes (up to 7) * 2 ops

Sdtrig_mcontrol6_size_8bit
Sdtrig_mcontrol6_size_16bit
Sdtrig_mcontrol6_size_32bit
Sdtrig_mcontrol6_size_48bit
Sdtrig_mcontrol6_size_64bit

comments on test results: Exceptions when td2 = op, size = 0. Note: warls size to zero

cp_mcontrol6_load_store_size

tdata2 = {scratch/0}
tdata1.select = 0 (adr)
tdata1.XSL = 011
tdata1.size = {0/1/2/3/5} (legal sizes of at most XLEN bits)
perform {lb/lbu/lh/lhu/lw/sb/sh/sw} to scratch with a random value
if RV64 supported, also perform {lwu/ld/sd}
if F_SUPPORTED, also perform {flw/fsw}
if D_SUPPORTED, also perform {fld/fsd}
if ZFH_SUPPORTED, also perform {flh/fsh}
if Q_SUPPORTED, also perform {flq/fsq}
if ZCA_SUPPORTED, also perform c.{lw/sw/lwsp/swsp}
if ZCA_SUPPORTED and RV64, also perform c.{ld/sd/ldsp/sdsp}
if ZCB_SUPPORTED, also perform c.{lbu/lh/lhu/sb/sh}
if ZCF_SUPPORTED and RV32, also perform c.{flw/flwsp/fsw/fswsp}
if ZCD_SUPPORTED, also perform c.{fld/fldsp/fsd/fsdsp}

Breakpoint exception if the size of the memory access matches the trigger size in mcontrol6

2 values * legal sizes (up to 5) * up to 36 instructions

Sdtrig_mcontrol6_size_8bit
Sdtrig_mcontrol6_size_16bit
Sdtrig_mcontrol6_size_32bit
Sdtrig_mcontrol6_size_64bit

Sizes 4 (48-bit) and 6 (128-bit) are not tested; size 6 is never written (Sail 0.16 disables sizes above XLEN)

cp_mcontrol6_match

Test boundaries for match conditions

tdata1.select = 1 (data)
tdata1.XSL= 010
tdata1.match = {0/2/3/8}
if RV32:
tdata2 = {0x12345678}
perform SW{0x0},{0x12345678-1} {0x12345678},{0x12345678+1},{0xFFFFFFFF} to scratch
if RV64:
tdata2 = {0x123456789ABCDEF0}
perform SD{0x0},{0x123456789ABCDEF0-1} {0x123456789ABCDEF0},{0x123456789ABCDEF0+1},{0xFFFFFFFFFFFFFFFF} to scratch

Breakpoint exception if the store data meets the condition set by tdata1.match

legal matches (up to 4) * 5 ops

Sdtrig_mcontrol6_match_equal
Sdtrig_mcontrol6_match_ge
Sdtrig_mcontrol6_match_lt
Sdtrig_mcontrol6_match_not_equal

cp_mcontrol6_match_napot

tdata1.select = 1 (data)
tdata1.XSL= 010
tdata1.match = {1/9}
if RV32:
tdata2 = 0xFFFFFFFF
for x in 0:min(UDB_SDTRIG_MCONTROL6_MASKMAX6, XLEN-1)-1 tdata2[x] = 0 (legal NAPOT sizes only)
perform SW{0x0}, {0x12345678}, {0xFFFFFFFF} to scratch
if RV64:
tdata2 = 0xFFFFFFFFFFFFFFFF
for x in 0:min(UDB_SDTRIG_MCONTROL6_MASKMAX6, XLEN-1)-1 tdata2[x] = 0 (legal NAPOT sizes only)
perform SD{0x0}, {0x123456789ABCDEF0},{0xFFFFFFFFFFFFFFFF} to scratch

Breakpoint exception if the store data meets the condition set by tdata1.match
(zero bit x is a NAPOT range of 2^(x+1) bytes, so every range from 2^1 to 2^min(maskmax6, XLEN-1) is tested)

legal matches (up to 2) * min(UDB_SDTRIG_MCONTROL6_MASKMAX6, XLEN-1) values * 3 ops

Sdtrig_mcontrol6_match_napot
Sdtrig_mcontrol6_match_not_napot
Sdtrig_mcontrol6_match_napot_legal
Sdtrig_mcontrol6_match_napot_mask

cp_mcontrol6_match_mask

tdata1.select = 1 (data)
tdata1.XSL= 010
tdata1.match = {4/5/12/13} (each value in UDB_SDTRIG_MCONTROL6_MATCH_LEGAL_VALUES)
tdata2[XLEN-1:XLEN/2] is the mask and tdata2[XLEN/2-1:0] the value
if RV32:
tdata2 = {0xF0F0_A0B0}
perform SW{0x0}, {0xF0F0_A0B0}, {0xFFFFFFFF},
low half {0x0000_A0B0}, {0x0000_A1B2}, {0x0000_F0F0}, {0x0001_A0B0},
high half {0xA0B0_0000}, {0xA1B2_0000}, {0xF0F0_0000}, {0xA0B0_0001} to scratch
if RV64:
tdata2 = {0xF0F0F0F0_A0B0C0D0}
perform SD{0x0}, {0xF0F0F0F0_A0B0C0D0}, {0xFFFFFFFFFFFFFFFF},
low half {0x00000000_A0B0C0D0}, {0x00000000_A1B2C3D4}, {0x00000000_F0F0F0F0}, {0x00000001_A0B0C0D0},
high half {0xA0B0C0D0_00000000}, {0xA1B2C3D4_00000000}, {0xF0F0F0F0_00000000}, {0xA0B0C0D0_00000001} to scratch
in each half: the value, differs only outside the mask, differs inside the mask, the value with the other half nonzero

Breakpoint exception if the store data meets the condition set by tdata1.match

legal matches (up to 4) * 11 values

Sdtrig_mcontrol6_match_mask_low
Sdtrig_mcontrol6_match_mask_high
Sdtrig_mcontrol6_match_not_mask_low
Sdtrig_mcontrol6_match_not_mask_high

cp_mcontrol6_match_size_store

Every legal match crossed with every legal size on a select = 1 store trigger in U-mode

As SdtrigSm cp_mcontrol6_match_size_store, with tdata1.u = 1 and the stores executed in U-mode.
tdata1 is written through T-SBI.

As SdtrigSm cp_mcontrol6_match_size_store

NTRIG * legal matches * legal sizes * {fired, not fired, other width}

Sdtrig_mcontrol6_comparisons
Sdtrig_mcontrol6_select_data

cp_mcontrol6_match_size_load

Every legal match crossed with every legal size on a select = 1 load trigger in U-mode

As SdtrigSm cp_mcontrol6_match_size_load, with tdata1.u = 1 and the loads executed in U-mode.
tdata1 is written through T-SBI.

As SdtrigSm cp_mcontrol6_match_size_load

NTRIG * legal matches * legal sizes * {fired, not fired, other width}

Sdtrig_mcontrol6_comparisons
Sdtrig_mcontrol6_select_data

MControl6 Chain

Repeat for each of UDB_SDTRIG_NUM_TRIGGERS if UDB_SDTRIG_MCONTROL6_SUPPORTED_TRIGGERS[i] and UDB_SDTRIG_MCONTROL6_SUPPORTED_TRIGGERS[i+1]:
tselect = i
write tdata2 and tdata3 as necessary
tdata3 = 0 unless otherwise specified (textra = 0, controls context matching)
tdata1.type = 6 (mcontrol6)
tdata1.dmode = 0 (M-mode accessible)
tdata1.action = 0 (breakpoint)
tdata1.uncertainen = 0 (exact match)
unless otherwise specified:
tdata1.m/s/u/vs/vu = (1 for current mode, e.g. 1 in m)
tdata1.select = 0 (adr)
tdata1.size = 0 (any)
tdata1.chain = 0 (disabled)
tdata1.match = 0 (equal)
Perform an instruction that causes trigger to fire/not fire

cp_mcontrol6_chain_adr

Trigger i (Tselect = i):
tdata1.select = 0 (address)
tdata1.chain = 1
tdata2 = {scratch}
Trigger i+1 (Tselect = i + 1):
tdata1.select = 1 (data)
tdata1.chain = 0
tdata2 = {random XLEN-wide value}
tdata1.XSL = 010
perform SW (RV32) / SD (RV64) {the value/0} to {scratch/scratch+8} (XLEN-wide, as size = 0 needs)

Breakpoint exception from final trigger in chain if all triggers match simultaneously

2 store values * 2 addresses

Sdtrig_mcontrol6_chain_start

comments on test results: Be careful of order when setting up chain, enable chain last

Notes:

uncertain and uncertainen not tested because optional and unpredictable

vs, vu deferred to SdtrigH

hit not tested because optional and implementation-dependent

action other than 0 not tested until those features are supported (e.g. SdtrigSdext/SdtrigTrace)

Icount tests: test fire and don’t fire for each scenario

Repeat for each of UDB_SDTRIG_NUM_TRIGGERS if UDB_SDTRIG_ICOUNT_SUPPORTED_TRIGGERS[i]:
tselect = i
tdata1 = 0
tdata3 = 0 unless otherwise specified (textra = 0, controls context matching)
tdata1.type = 3 (icount)
tdata1.dmode = 0 (M-mode accessible)
tdata1.action = 0 (breakpoint)
unless otherwise specified:
tdata1.m/s/u/vs/vu = (1 for current mode, e.g. 1 in m)
Perform an instruction that causes trigger to fire/not fire
After each case, the tdata1 readback (without hit, which is optional and not checked) and rvtest_trap_count
are written to the signature, so a fire or missing fire is reported at that case.

cp_icount_hardwired

if UDB_SDTRIG_ICOUNT_COUNT_HARDWIRED_1 (imperas-rv64-max; cp_icount_instr, cp_icount_eq0 and cp_icount_self_write
need a writable count and run otherwise):
tdata1.m/s/u/vs/vu = 11111
perform nop in U-mode
CSRR tdata1.m,s,u,vs,vu
CSRR tdata1.count,pending

breakpoint exception occurs,
m,s,u,vs,vu are cleared, pending is cleared

1

Sdtrig_icount_match_eq1

cp_icount_instr

tdata.pending = 0
tdata1.count = 9
tdata1.u = {0/1}
perform 9x nop in U-mode
CSRR tdata1
CSRR tval

Count decreases when the instruction retires after having been fetched in U-mode and tdata1.u = 1. Tval=0 after firing, pending=0 after firing.

2 priv bits (tdata1 readback: u clear and count unchanged, u set and counted to 0)

Sdtrig_icount_u
Sdtrig_icount_access
Sdtrig_icount_match1
Sdtrig_icount_match_gt1
Sdtrig_icount_pending
Sdtrig_icount_action0

cp_icount_instr_fire

icount fires after count instructions

cp_icount_instr with tdata1.u = 1: the breakpoint taken while the icount trigger armed with count = 9 is selected

Breakpoint exception with tval = 0, before the instruction after the 9th

1

Sdtrig_icount_u
Sdtrig_icount_match1
Sdtrig_icount_match_gt1
Sdtrig_icount_action0

cp_icount_trap

tdata1.count = 1
perform illegal instruction trap in U-mode, CSRR tdata1.count

Count decreases when a trap is taken from a privilege mode where the trigger is enabled

2 priv bits (tdata1 readback: u clear and count unchanged, u set and counted to 0)

Sdtrig_icount_match2
Sdtrig_icount_match_non_reexecuted
Sdtrig_icount_all_traps_match

cp_icount_trap_fire

A trap taken in a mode where the trigger is enabled is counted, and pending fires after the handler returns

cp_icount_trap with tdata1.u = 1: the breakpoint taken on the xRET that returns from the illegal-instruction trap

Breakpoint exception on return from the trap handler

1

Sdtrig_icount_match2
Sdtrig_icount_pending_set

cp_icount_eq0

tdata1.pending = {0/1}
CSRW tdata1.count = 0
perform 9x nop in U-mode
CSRR tdata1.count

Count stays at 0 until explicitly written
Breakpoint exception occurs when tdata1.pending = 1

2 pending (tdata1 readback: count stays 0, pending cleared)

Sdtrig_icount_count_zero

cp_icount_eq0_fire

A pending icount trigger fires before the next instruction

cp_icount_eq0 with tdata1.pending = 1: the breakpoint taken on return to U-mode after the CSRW that writes count = 0, pending = 1

Breakpoint exception before the next U-mode instruction (after the T-SBI return); pending is cleared

1

Sdtrig_icount_pending

Itrigger tests: test fire and don’t fire for each scenario

Repeat for each of UDB_SDTRIG_NUM_TRIGGERS if UDB_SDTRIG_ITRIGGER_SUPPORTED_TRIGGERS[i]:
tselect = i
tdata1 = 0
tdata3 = 0 unless otherwise specified (textra = 0, controls context matching)
tdata1.type = 4 (itrigger)
tdata1.dmode = 0 (M-mode accessible)
tdata1.action = 0 (breakpoint)
unless otherwise specified:
tdata1.m/s/u/vs/vu = (1 for current mode, e.g. 1 in m)
Perform an interrupt that causes trigger to fire/not fire

cp_itrigger_u

An itrigger is evaluated on a selected interrupt taken from U-mode and handled in S

tdata2[x] = 1 for x in {1,5,9,13} if INTERRUPTx_SUPPORTED
tdata1.u = {0/1}, mideleg[x] = 1
take interrupt x while executing in U-mode
After each case, rvtest_trap_count is written to the signature.

No breakpoint when tdata1.u = 0. With tdata1.u = 1 the trigger matches as the trap is taken; the breakpoint
(medeleg[3] = 1) is then taken in the S-mode handler, where harts using sstatus.SIE re-entrancy suppress it
and harts using tcontrol take it into M. cp_itrigger_s/u in SdtrigSm check firing with medeleg[3] = 0

NTRIG * 4 interrupts * 2 u bits

Sdtrig_itrigger_u

cp_itrigger_u_other

An itrigger does not fire on an interrupt tdata2 does not select

as cp_itrigger_u, taking another delegated S-level interrupt (5, or 1 when x = 5) instead of x

No breakpoint

NTRIG * 2 u bits

Sdtrig_itrigger_u

Etrigger tests: test fire and don’t fire for each scenario

Repeat for each of UDB_SDTRIG_NUM_TRIGGERS if UDB_SDTRIG_ETRIGGER_SUPPORTED_TRIGGERS[i]:
tselect = i
tdata1 = 0
tdata3 = 0 unless otherwise specified (textra, controls context matching)
tdata1.type = 5 (etrigger)
tdata1.dmode = 0 (M-mode accessible)
tdata1.action = 0 (breakpoint)
unless otherwise specified:
tdata1.m/s/u/vs/vu = (1 for current mode, e.g. 1 in m)

cp_etrigger_u

An etrigger is evaluated on a selected exception raised in U-mode

tdata2[x] = 1 for x in {1,2,5,7,8, and 12,13,15 with Sv}
tdata1.u = {0/1}, medeleg as the suite boots
raise exception x while executing in U-mode
After each case, rvtest_trap_count is written to the signature.

No breakpoint when tdata1.u = 0, or when the exception is handled in M (ecall from U).
The other exceptions are delegated and handled in S: with tdata1.u = 1 the breakpoint (medeleg[3] = 1) is
then taken in the S-mode handler, where harts using sstatus.SIE re-entrancy suppress it and harts using
tcontrol take it into M. cp_etrigger_s/u_deleg in SdtrigSm check firing with medeleg[3] = 0

NTRIG * 8 exceptions * 2 u bits

Sdtrig_etrigger_u

cp_etrigger_u_other

An etrigger does not fire on an exception tdata2 does not select

tdata2[x] = 1 for each x above and x in {0,3,4,6} and the other modes' ecalls, tdata1.u = {0/1}
raise an illegal instruction while executing in U-mode

No breakpoint

NTRIG * 2 u bits

Sdtrig_etrigger_u

Textra tests: test fire and don’t fire for each scenario

Repeat for each of UDB_SDTRIG_NUM_TRIGGERS if UDB_TDATA3_IMPLEMENTED:
tselect = i
tdata1 = 0
tdata1.dmode = 0 (M-mode accessible)
tdata1.action = 0 (breakpoint)
unless otherwise specified:
tdata3.mhselect = 0
tdata3.sselect = 0
tdata1.m/s/u/vs/vu = (1 for current mode, e.g. 1 in m)
other fields depending on trigger type should use the defaults defined in the sections above
Perform an instruction that causes trigger to fire/not fire

cp_textra_mcontext

only run tests if MCONTEXT_IMPLEMENTED:
repeat for each trigger type supported:
tdata3.mhselect = 4
if RV32:
mcontext[5:0] = 010101
tdata3.mhvalue = {010101/000000/010100}
if RV64:
mcontext[12:0] = 0x1555
tdata3.mhvalue = 0x{1555/0000/1554}
if ICOUNT_SUPPORTED:
tdata1.type = 3 (icount)
tdata1.count = 1
tdata2 = 0
perform nop in U-mode
if MCONTROL6_SUPPORTED
tdata1.type = 6 (mcontrol6)
tdata1.select = 1 (data)
tdata2 = {0x12345678 (RV32) / 0xEDCBA98712345678 (RV64)}
perform SW (RV32) / SD (RV64) of the same value (an XLEN-wide access, as size = 0 needs)
After each case, rvtest_trap_count is written to the signature.

Breakpoint exception if mhvalue equals mcontext

3 mhvalues * 2 trigger types (icount, mcontrol6)

Sdtrig_textra32_filter_modes
Sdtrig_icount_textra
Sdtrig_mcontrol6_textra
Sdtrig_textra32_mhselect_mcontext

cp_textra_scontext

only run tests if SCONTEXT_IMPLEMENTED:
repeat for each trigger type supported:
tdata3.sselect = 1
if RV32:
scontext = {00001234}
tdata3.svalue = 0x{0000/0034/1200/1234}
tdata3.sbytemask = 4 combinations
if RV64:
scontext = {0x12345678}
tdata3.svalue = 0x{00000000/12345600/12340078/12005678/00345678/12345678}
tdata3.sbytemask = {0000/0001/0010/0100/1000/1111}
if ICOUNT_SUPPORTED:
tdata1.type = 3 (icount)
tdata1.count = 1
tdata2 = 0
perform nop in U-mode
if MCONTROL6_SUPPORTED
tdata1.type = 6 (mcontrol6)
tdata1.select = 1 (data)
tdata2 = {0x12345678 (RV32) / 0xEDCBA98712345678 (RV64)}
perform SW (RV32) / SD (RV64) of the same value (an XLEN-wide access, as size = 0 needs)
After each case, rvtest_trap_count is written to the signature.

Breakpoint exception when svalue equals scontext and mask ignores A’s

if RV32:
4 svalues * 4 masks * 2 trigger types
if RV64:
6 svalues * 6 masks * 2 trigger types

Sdtrig_textra32_filter_modes
Sdtrig_icount_textra
Sdtrig_mcontrol6_textra
Sdtrig_textra32_sselect_scontext
Sdtrig_textra32_sbytemask
Sdtrig_textra64_sbytemask
Sdtrig_textra32_byte_granular
Sdtrig_textra64_byte_granular

cp_textra_scontext_all

With every scontext byte masked, the scontext compare always matches

only run tests if SCONTEXT_IMPLEMENTED:
as cp_textra_scontext, with tdata3.sselect = 1 and tdata3.sbytemask = all ones (RV32 11, RV64 1111)

Breakpoint exception for every svalue

2 trigger types

cp_textra_double_context

only run tests if MCONTEXT_IMPLEMENTED and SCONTEXT_IMPLEMENTED:
repeat for each trigger type supported:
tdata3.mhselect = {0/4}
tdata3.sselect = {0/1}
tdata3.sbytemask = 0
if RV32:
mcontext[5:0] = 111111
tdata3.mhvalue = {000000/111111}
if RV64:
mcontext[12:0] = 0x1FFF
tdata3.mhvalue = 0x{0000/1FFF}
if RV32:
scontext = 0x0000FFFF
tdata3.svalue = 0x{0000/FFFF}
if RV64:
scontext = 0xFFFFFFFF
tdata3.svalue = 0x{00000000/FFFFFFFF}
if ICOUNT_SUPPORTED:
tdata1.type = 3 (icount)
tdata1.count = 1
tdata2 = 0
perform nop in U-mode
if MCONTROL6_SUPPORTED
tdata1.type = 6 (mcontrol6)
tdata1.select = 1 (data)
tdata2 = {0x12345678 (RV32) / 0xEDCBA98712345678 (RV64)}
perform SW (RV32) / SD (RV64) of the same value (an XLEN-wide access, as size = 0 needs)
After each case, rvtest_trap_count is written to the signature.

Breakpoint exception when all enabled context numbers match

2 mhselect * 2 sselect * 2 mhvalue * 2 svalue

Sdtrig_textra32_mhselect_mcontext
Sdtrig_textra32_sselect_scontext
Sdtrig_textra32_mhselect_ignore
Sdtrig_textra32_sselect_ignore

Actions: only action 0 (breakpoint) is tested here (sufficient for RVA23). Eventually add SdtrigSdext with action 1, SdtrigEtrace for Trace 2-4, SdtrigExternal for 8-9

B.11. Miscellaneous Non-RV23 Privileged Extensions

B.11.1. Sm1p13 Machine Mode 1.13

Table 349. Sm1p13 Coverpoints
Coverpoint Goal Feature Description Expectation Bins Notes

cp_medelegh

RV32 only:
Write all 1s to medelegh and read back.

Match ref model

1

Sm_mcsr_cg/cp_mcsr_access

cp_mxlen_ro

misa.MXL is read only

Write all U,S,M values of misa.MXL and read back

Read back M-mode

3

Note : Already covered in cp_misa_mxl
Sm_mcsr_cg/cp_misa_mxl

cp_misa_b
cp_misa_v

misa.B and misa.V are correct

read, set, and clear, readback misa.B and misa.V

5

Sm_mcsr_cg/{cp_misa_b, cp_misa.v}

cp_mcause

mcause accepts sofware-check and hardware error

Write mcause = 18, 19, read back

Match ref model

2

Note : Already covered in cp_mcause_write_exception/
Sm_mcause_cg/cp_mcause_write_exception

cp_msip

msip write is reflected in mip.MSIP

Write {all 1s, all 0s} to memory-mapped msip register if it exists. Read back. Wait and then read mip.MSIP.
RVMODEL_MSIP_ADDRESS is undefined if msip does not exist (such as when mip.MSIP is read-only zero).

Match ref model

2

Sm_mcsr_cg/cp_msip

Notes:

NOTE : It’s tests and coverage files are under the S.py and S_coverage.svh respectvely with the guard of `ifdef SM1P13_SUPPORTED

LCOFI tested in Sscofpmf test plan

VS-mode counter overflow tested in Shlcofideleg

Hints with MXLEN > XLEN not tested

Hardware errors tested with Smrnmi

Software-check exceptions tested with Zicfilp and Zicfiss

hedelegh tested with hypervisor

cp_misaligned_atomicity_granule_pma is tested with Zama16b

Table 350. Sm1p13 Normative Rules
Normative Rule Rule Text Coverpoints

medelegh_sz_acc_enc_xlen32

When XLEN=32, medelegh is a 32-bit read/write register that aliases bits 63:32 of medeleg.

Sm_mcsr_cg/cp_mcsr_access/medelegh

misa_mxl_op_isa

The MXL (Machine XLEN) field encodes the native base integer ISA width as shown in norm:misa_mxl_enc.

Sm_mcsr_cg/cp_misa_mxl

misa_mxl_op_nz

If misa is nonzero, the MXL field indicates the effective XLEN in M-mode, a constant termed MXLEN.

Sm_mcsr_cg/cp_misa_mxl

xlen_le_mxlen

XLEN is never greater than MXLEN, but XLEN might be smaller than MXLEN in less-privileged modes.

Sm_mcsr_cg/cp_misa_mxl

misa_mxl_acc

The MXL field is read-only.

Sm_mcsr_cg/cp_misa_mxl

misa_mxl_enc

MXL|XLEN === 1|32¶2|64¶3|Reserved ===

Sm_mcsr_cg/cp_misa_mxl

misa_extensions_enc_txt

The Extensions field encodes the presence of the standard extensions, with a single bit per letter of the alphabet (bit 0 encodes presence of extension A, bit 1 encodes presence of extension B, through to bit 25 which encodes Z).

Sm_mcsr_cg/{cp_misa_b, cp_misa_v}

misa_extensions_enc_tbl

Bit|Character|Description === 0|`A`|Atomic extension¶1|`B`|B extension¶2|`C`|Compressed extension¶3|`D`|Double-precision floating-point extension¶4|`E`|RV32E/64E base ISA¶5|`F`|Single-precision floating-point extension¶6|`G`|Reserved¶7|`H`|Hypervisor extension¶8|`I`|RV32I/64I base ISA¶9|`J`|Reserved¶10|`K`|Reserved¶11|`L`|Reserved¶12|`M`|Integer Multiply/Divide extension¶13|`N`|Tentatively reserved for User-Level Interrupts extension¶14|`O`|Reserved¶15|`P`|Tentatively reserved for Packed-SIMD extension¶16|`Q`|Quad-precision floating-point extension¶17|`R`|Reserved¶18|`S`|Supervisor mode implemented¶19|`T`|Reserved¶20|`U`|User mode implemented¶21|`V`|Vector extension¶22|`W`|Reserved¶23|`X`|Non-standard extensions implemented¶24|`Y`|Reserved¶25|`Z`|Reserved ===

Sm_mcsr_cg/{cp_misa_b, cp_misa_v}

misa_extensions_warl_op

The Extensions field is a WARL field that can contain writable bits where the implementation allows the supported ISA to be modified.

Sm_mcsr_cg/{cp_misa_b, cp_misa_v}

mcause_exccode_enc_img

Interrupt|Exception Code|Description === 1 1 1 1|0 1 2 3|Reserved Supervisor software interrupt Reserved Machine software interrupt¶1 1 1 1|4 5 6 7|Reserved Supervisor timer interrupt Reserved Machine timer interrupt¶1 1 1 1|8 9 10 11|Reserved Supervisor external interrupt Reserved Machine external interrupt¶1 1 1 1|12 13 14-15 ≥16|Reserved Counter-overflow interrupt Reserved Designated for platform use¶0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0|0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20-23 24-31 32-47 48-63 ≥64|Instruction address misaligned Instruction access fault Illegal instruction Breakpoint Load address misaligned Load access fault Store/AMO address misaligned Store/AMO access fault Environment call from U-mode Environment call from S-mode Reserved Environment call from M-mode Instruction page fault Load page fault Reserved Store/AMO page fault Double trap Reserved Software check Hardware error Reserved Designated for custom use Reserved Designated for custom use Reserved ===

Sm_mcause_cg/cp_mcause_write_exception

msip_sz_acc

A hart’s memory-mapped msip register is a 32-bit read/write register

Sm_mcsr_cg/cp_msip

msip_enc

bits 31&#8205;&#8211;&#8205;1 read as zero and bit 0 contains the MSIP bit.

Sm_mcsr_cg/cp_msip

mip_msip_rdonly

MSIP is read-only in mip, and is written by accesses to memory-mapped control registers, which are used to provide machine-level interprocessor interrupts.

Sm_mcsr_cg/cp_msip

msip_update_max_time

When the memory-mapped msip register changes, it is guaranteed to be reflected in mip.⁠MSIP eventually, but not necessarily immediately.

Sm_mcsr_cg/cp_msip

UDB Parameters: None.

B.11.2. Smstateen Machine State Enable

Table 351. Smstateen Coverpoints
Coverpoint Goal Feature Description Expectation Bins Normative Rule

cp_mstateen_reset_val

On reset all mstateen CSRs' bits are initialized to zeros.

As first test after reset, read mstateen0-3. For RV32, also read msstateen0-3h

0

4-8 CSRs

mstateen_zero_initialization

cp_walking_ones

Bits are accessible

Write mstateen0-3 with walking ones & walking zero, and read each back.
For RV32, also write msstateen0-3h.

Access successful

4-8 CSRs * 128-64 walking ones/zero

mstateen_rv64_csrs
stateen_rv32_upper_bits_csrs
mstateen_bit_correspondence
stateen_warl_access
stateen_unimplemented_state_roz
stateen_reserved_roz
mstateen_bit_63_roz
mstateen0_enc_img
mstateen0_fcsr_roz
Ssqosid_Smstateen_srmcfg_requires_mstateen0

cp_csr_illegal_accesses

Each stateen CSR allows read/write access from its own and higher privilege modes and denies read/writeaccess from lower privilege modes

In U-mode (and S, VS and VU-mode if supported), write mstateen0-3 with all ones, and read it back.
For RV32, also write msstateen0-3h

Illegal instruction

4-8CSRs

stateen_op
stateen_illegal_state_access

cp_fcsr

fcsr controls access to fcsr when misa.F = 0

If Zfinx is supported:
with misa.F = 0 and mstateen0.fcsr, read and write fcsr

stateen0_fcsr_op
stateen0_fcsr0_misa_f0_illegal_fpu_instr

cp_jvt_access

jvt controls access

If Zcmt is supported:
With msstaten0.JVT = {0,1}, read and write jvt from the M, S if supported, else U

Always successful

stateen0_jvt_op

cp_envcfg

envcfg controls access to senvcfg

With mstateen0.envcfg = {0,1}, read and write sevncfg from M, S if supported, else U

Always successful

2 states x 2 accesses

mstateen0_envcfg_op

cp_csrind

csrind controls access

If Sscsrind supported:
With mstateen0.CSRIND = {0, 1}, read and write siselect. And with siselect having some value TBD, write and read sireg,
sireg2, sireg3, sireg4, sireg5, sireg6. M, S if supported, else U

Illegal instruction if 0 except in M-mode, else successful

2 states x 5 modes x 3 accesses x 7 regs

mstateen0_csrind_op

cp_aia

aia controls access

If Ssaia supported:
With msstateen.AIA = {0,1}, read and write all state introduced by Ssaia. M, S if supported, else U

Always successful

2 states x 2 accesses x ? regs

mstateen0_aia_op

cp_imsic

ismic controls access

If IMSIC supported:
With msstateen.IMSIC = {0,1}, read and write all state introduced by IMSIC (stopei?). M, S if supported, else U

Always successful

2 states x 2 accesses x ? regs

mstateen0_imsic_op

cp_context

sdtrig controls access

If Sdtrig supported:
With msstateen.CONTEXT = {0,1}, read and write scontext form M, S if supported, else U

Always successful

2 states x 2 accesses

Sdtrig_scontext_access
Sdtrig_scontext_accessibility
mstateen0_context_op

cp_p1p13

hedelegh controls access

If Sm1p13 and Hypervisor supported:
With msstateen.P1P13 = {0,1}, read and write hedelegh

Always successful

2 states x 2 accesses

mstateen0_p1p13_op

cp_srmcfg

srmcfg controls access

If Ssqosid supported:
With msstateen.SRMCFG = {0,1}, read and write srmcfg from M, S if supported, else U

Always successful

2 states x 2 accesses

mstateen0_srmcfg_op
Ssqosid_Smstateen_srmcfg_requires_mstateen0
Ssqosid_srmcfg_access_illegal_instruction

cp_ctr

ctr controls access

If Sctr supported:
With msstateen.CTR = {0,1}, read and write sctrl, sctrdepth, sctrstatus from M, S if supported, else U

Always successful

2 states x 2 accesses x 3 regs

mstateen_ctr1
mstateen_ctr0

cp_fcsr_fp_instrs

fcsr controls floating-point instructions when misa.F = 0

If Zfinx is supported:
with misa.F = 0 and mstateen0.fcsr = {0,1}, execute fadd.s, fcvt.w.s, fcvt.s.w, and fclass.s from S (if supported) and U-mode

Illegal instruction if 0, else successful

stateen0_fcsr0_misa_f0_illegal_fpu_instr

cp_mstateen_se_controls_sstateen

Bit 63 of mstateen0-3 controls access to sstateen0-3

For N = 0-3 and mstateenN bit 63 = {0,1}, read and write sstateenN from S-mode (and VS-mode if H is supported, with hstateenN bit 63 = 1), and check the value read.
For RV32, bit 63 is bit 31 of mstateenNh.

Illegal instruction if 0. If 1, access succeeds. sstateen1-3 read 0 (they have no defined bits).
Bit 63 may be read-only zero without the hypervisor extension; the bit = 1 bins are then unreachable.

4 CSRs * 2 states * 2 modes * 3 ops

stateen_op
stateen_illegal_state_access
stateen_reserved_roz
sstateen_vsmode_access_roz
mstateen_bit_63_op
mstateen0_se0_op

cp_mstateen_se_controls_hstateen

Bit 63 of mstateen0-3 controls access to hstateen0-3

If H is supported, for N = 0-3 and mstateenN bit 63 = {0,1}, read and write hstateenN from HS-mode.
For RV32, also access hstateenNh, where bit 63 is bit 31 of mstateenNh.

Illegal instruction if 0, else successful.

4-8 CSRs * 2 states * 3 ops

stateen_illegal_state_access
mstateen_bit_63_op

cp_mstateen0_se0_only_sstateen0

Bits that are zero in mstateen0 are read-only zero in sstateen0

With only mstateen0.SE0 set, set a walking one in sstateen0 with csrs and clear a walking zero with csrc, from M-mode and S-mode.

Every sstateen0 bit other than read-only ones stays zero.

mstateen_lower_priv_roz

cp_mstateen0_se0_only_hstateen0

Bits that are zero in mstateen0 are read-only zero in hstateen0

If H is supported, with only mstateen0.SE0 set, set a walking one in hstateen0 with csrs and clear a walking zero with csrc, from M-mode and HS-mode.

Every hstateen0 bit other than read-only ones stays zero.

mstateen_lower_priv_roz

Note: All of these tests are performed in M-mode unless otherwise noted.

Note: The feature and sstateen tests set and clear the mstateen bit and run from M, S, U, and (with H) VS and VU-mode. Each sets the bit in hstateen0 and sstateen0 after changing the mstateen bit, so only the mstateen bit changes the result. The coverpoints sample the bit in all three CSRs.

Note: Tests that set mstateen to all ones and vary hstateen0 and sstateen0 are in Ssstateen.

Note: Smstateen implies U-mode (otherwise there is no need for this extension)

Table 352. Smstateen Normative Rules
Normative Rule Rule Text Coverpoints

mstateen_rv64_csrs

For RV64 harts, this extension adds four new 64-bit CSRs at machine level: mstateen0 (Machine State Enable 0), mstateen1, mstateen2, and mstateen3.

{Smstateen_cg,Ssstateen_cg}/{cp_walking_ones}

hstateen_rv64_csrs

And if the hypervisor extension is implemented, another set of CSRs is added: hstateen0, hstateen1, hstateen2, and hstateen3.

Ssstateen_cg/cp_hstateen_walking_ones

stateen_rv32_upper_bits_csrs

For RV32, there are CSR addresses for accessing the upper 32 bits of corresponding machine-level and hypervisor CSRs: mstateen0h, mstateen1h, mstateen2h, mstateen3h, hstateen0h, hstateen1h, hstateen2h, and hstateen3h.

{Smstateen_cg,Ssstateen_cg}/{cp_walking_ones}

stateen_op

The stateen registers at each level control access to state at all less-privileged levels, but not at its own level.

{Smstateen_cg,Ssstateen_cg}/{cp_csr_illegal_accesses}, Smstateen_cg/cp_mstateen_se_controls_sstateen

stateen_illegal_state_access

Just as with the counteren CSRs, when a stateen CSR prevents access to state by less-privileged levels, an attempt in one of those privilege modes to execute an instruction that would read or write the protected state raises an illegal-instruction exception, or, if executing in VS or VU mode and the circumstances for a virtual-instruction exception apply, raises a virtual-instruction exception instead of an illegal-instruction exception.

{Smstateen_cg,Ssstateen_cg}/{cp_csr_illegal_accesses}, Smstateen_cg/{cp_mstateen_se_controls_sstateen, cp_mstateen_se_controls_hstateen}

stateen_implicit_state_update

When a stateen CSR prevents access to state for a privilege mode, attempting to execute in that privilege mode an instruction that implicitly updates the state without reading it may or may not raise an illegal-instruction or virtual-instruction exception.

Not tested: either behavior is permitted

mstateen_bit_correspondence

For every bit with a defined purpose in an sstateen CSR, the same bit is defined in the matching mstateen CSR to control access below machine level to the same state.

{Smstateen_cg,Ssstateen_cg}/{cp_walking_ones}

hstateen_encoding

With the hypervisor extension, the hstateen CSRs have identical encodings to the mstateen CSRs, except controlling accesses for a virtual machine (from VS and VU modes).

Ssstateen_cg/{cp_hstateen_walking_ones, cp_hstateen_illegal_accesses}

stateen_warl_access

Each standard-defined bit of a stateen CSR is WARL and may be read-only zero or one, subject to the following conditions.

{Smstateen_cg,Ssstateen_cg}/{cp_walking_ones}

stateen_unimplemented_state_roz

Bits in any stateen CSR that are defined to control state that a hart doesn’t implement are read-only zeros for that hart.

{Smstateen_cg,Ssstateen_cg}/{cp_walking_ones}

stateen_reserved_roz

Likewise, all reserved bits not yet given a defined meaning are also read-only zeros.

{Smstateen_cg,Ssstateen_cg}/{cp_walking_ones}, Smstateen_cg/cp_mstateen_se_controls_sstateen

mstateen_lower_priv_roz

For every bit in an mstateen CSR that is zero (whether read-only zero or set to zero), the same bit appears as read-only zero in the matching hstateen and sstateen CSRs.

Smstateen_cg/{cp_mstateen0_se0_only_sstateen0, cp_mstateen0_se0_only_hstateen0}

sstateen_vsmode_access_roz

For every bit in an hstateen CSR that is zero (whether read-only zero or set to zero), the same bit appears as read-only zero in sstateen when accessed in VS-mode.

Smstateen_cg/cp_mstateen_se_controls_sstateen, Ssstateen_cg/cp_hstateen_se_controls_sstateen

hstateen_ro1_bits

A bit in an hstateen CSR cannot be read-only one unless the same bit is read-only one in the matching mstateen CSR.

Ssstateen_cg/cp_hstateen_walking_ones

mstateen_zero_initialization

On reset, all writable mstateen bits are initialized by the hardware to zeros.

TODO: record the writable mstateen bits before the boot code writes them

mstateen_bit_63_op

For each mstateen CSR, bit 63 is defined to control access to the matching sstateen and hstateen CSRs.

Smstateen_cg/{cp_mstateen_se_controls_sstateen, cp_mstateen_se_controls_hstateen}

hstateen_bit_63_op

Likewise, bit 63 of each hstateen correspondingly controls access to the matching sstateen CSR.

Ssstateen_cg/cp_hstateen_se_controls_sstateen

mstateen_bit_63_roz

Bit 63 of each mstateen CSR may be read-only zero only if the hypervisor extension is not implemented and the matching supervisor-level sstateen CSR is all read-only zeros.

{Smstateen_cg,Ssstateen_cg}/{cp_walking_ones}

hstateen_bit_63_writable

Bit 63 of each hstateen CSR is always writable (not read-only).

Ssstateen_cg/cp_hstateen_walking_ones

mstateen0_enc_img

Smstateen_cg/cp_walking_ones

hstateen0_enc_img

Ssstateen_cg/cp_hstateen_walking_ones

stateen0_c_op

The C bit controls access to any and all custom state.

Not tested: custom state is non-standard and not certified

stateen0_fcsr_op

The FCSR bit controls access to fcsr for the case when floating-point instructions operate on x registers instead of f registers as specified by the Zfinx and related extensions (Zdinx, etc.).

Smstateen_cg/cp_fcsr, Ssstateen_cg/cp_fcsr

mstateen0_fcsr_roz

Whenever misa.F = 1, FCSR bit of mstateen0 is read-only zero (and hence read-only zero in hstateen0 and sstateen0 too).

Smstateen_cg/cp_walking_ones

stateen0_fcsr0_misa_f0_illegal_fpu_instr

For convenience, when the stateen CSRs are implemented and misa.F = 0, then if the FCSR bit of a controlling stateen0 CSR is zero, all floating-point instructions cause an illegal-instruction exception (or virtual-instruction exception, if relevant), as though they all access fcsr, regardless of whether they really do.

{Smstateen_cg,Ssstateen_cg}/{cp_fcsr, cp_fcsr_fp_instrs}

stateen0_jvt_op

The JVT bit controls access to the jvt CSR provided by the Zcmt extension.

Smstateen_cg/cp_jvt_access, Ssstateen_cg/cp_jvt

mstateen0_se0_op

The SE0 bit in mstateen0 controls access to the hstateen0, hstateen0h, and the sstateen0 CSRs.

Smstateen_cg/cp_mstateen_se_controls_sstateen

hstateen0_se0_op

The SE0 bit in hstateen0 controls access to the sstateen0 CSR.

Ssstateen_cg/cp_hstateen_se_controls_sstateen

mstateen0_envcfg_op

The ENVCFG bit in mstateen0 controls access to the henvcfg, henvcfgh, and the senvcfg CSRs.

Smstateen_cg/cp_envcfg

hstateen0_envcfg_op

The ENVCFG bit in hstateen0 controls access to the senvcfg CSRs.

Ssstateen_cg/cp_hstateen_envcfg

mstateen0_csrind_op

The CSRIND bit in mstateen0 controls access to the siselect, sireg*, vsiselect, and the vsireg* CSRs provided by the Sscsrind extensions.

Smstateen_cg/cp_csrind

hstateen0_csrind_op

The CSRIND bit in hstateen0 controls access to the siselect and the sireg*, (really vsiselect and vsireg*) CSRs provided by the Sscsrind extensions.

Ssstateen_cg/cp_hstateen_csrind

mstateen0_imsic_op

The IMSIC bit in mstateen0 controls access to the IMSIC state, including CSRs stopei and vstopei, provided by the Ssaia extension.

Smstateen_cg/cp_imsic

hstateen0_imsic_op

The IMSIC bit in hstateen0 controls access to the guest IMSIC state, including CSRs stopei (really vstopei), provided by the Ssaia extension.

Ssstateen_cg/cp_hstateen_imsic

mstateen0_aia_op

The AIA bit in mstateen0 controls access to all state introduced by the Ssaia extension and not controlled by either the CSRIND or the IMSIC bits.

Smstateen_cg/cp_aia

hstateen0_aia_op

The AIA bit in hstateen0 controls access to all state introduced by the Ssaia extension and not controlled by either the CSRIND or the IMSIC bits of hstateen0.

Ssstateen_cg/cp_hstateen_aia

mstateen0_context_op

The CONTEXT bit in mstateen0 controls access to the scontext and hcontext CSRs provided by the Sdtrig extension.

Smstateen_cg/cp_context

hstateen0_context_op

The CONTEXT bit in hstateen0 controls access to the scontext CSR provided by the Sdtrig extension.

Ssstateen_cg/cp_hstateen_context

mstateen0_p1p13_op

The P1P13 bit in mstateen0 controls access to the hedelegh introduced by Privileged Specification Version 1.13.

Smstateen_cg/cp_p1p13

mstateen0_srmcfg_op

The SRMCFG bit in mstateen0 controls access to the srmcfg CSR introduced by the Ssqosid ssqosid extension.

Smstateen_cg/cp_srmcfg

mstateen_ctr1

When mstateen0.CTR=1, accesses to CTR register state behave as described in CSRs and Entry Registers above, while SCTRCLR behaves as described in Supervisor CTR Clear Instruction.

Smstateen_cg/cp_ctr

mstateen_ctr0

When mstateen0.CTR=0 and the privilege mode is less privileged than M-mode, the following operations raise an illegal-instruction exception:

Smstateen_cg/cp_ctr

UDB Parameters: None.

B.11.3. Smcsrind Machine-Mode Indirect CSR Access

Smcsrind Coverpoints

No test plan yet.

Table 353. Smcsrind Normative Rules
Normative Rule Rule Text Coverpoints

miselect_op

The value of miselect determines which register is accessed upon read or write of each of the machine indirect alias CSRs (mireg*).

miselect_value_range

miselect value ranges are allocated to dependent extensions, which specify the register state accessible via each miregi register, for each miselect value.

miselect_warl

miselect is a WARL register.

miselect_min_sz

The miselect register implements at least enough bits to support all implemented miselect values (corresponding to the implemented extensions that utilize miselect/mireg* to indirectly access register state).

miselect_msb_op

Values of miselect with the most-significant bit set (bit XLEN - 1 = 1) are designated only for custom use, presumably for accessing custom registers through the alias CSRs. Values of miselect with the most-significant bit clear are designated only for standard use and are reserved until allocated to a standard architecture extension. If XLEN is changed, the most-significant bit of miselect moves to the new position, retaining its value from before.

mireg_access_on_legal_miselect

Attempts to access mireg* while miselect holds a number in an allocated and implemented range results in a specific behavior that, for each combination of miselect and miregi, is defined by the extension to which the miselect value is allocated.

siselect_min_range

The siselect register will support the value range 0..0xFFF at a minimum.

siselect_msb_op

Values of siselect with the most-significant bit set (bit XLEN - 1 = 1) are designated only for custom use, presumably for accessing custom registers through the alias CSRs. Values of siselect with the most-significant bit clear are designated only for standard use and are reserved until allocated to a standard architecture extension. If XLEN is changed, the most-significant bit of siselect moves to the new position, retaining its value from before.

sireg_access_on_illegal_siselect

The behavior upon accessing sireg* from M-mode or S-mode, while siselect holds a value that is not implemented at supervisor level, is UNSPECIFIED.

sireg_access_on_legal_siselect

Otherwise, attempts to access sireg* from M-mode or S-mode while siselect holds a number in a standard-defined and implemented range result in specific behavior that, for each combination of siselect and siregi, is defined by the extension to which the siselect value is allocated.

Sscsrind_smode_csrs_sz

Note that the widths of siselect and sireg* are always the current XLEN rather than SXLEN. Hence, for example, if MXLEN = 64 and SXLEN = 32, then these registers are 64 bits when the current privilege mode is M (running RV64 code) but 32 bits when the privilege mode is S (RV32 code).

vsiselect_min_range

The vsiselect register will support the value range 0..0xFFF at a minimum.

vsiselect_msb_op

Values of vsiselect with the most-significant bit set (bit XLEN - 1 = 1) are designated only for custom use, presumably for accessing custom registers through the alias CSRs. Values of vsiselect with the most-significant bit clear are designated only for standard use and are reserved until allocated to a standard architecture extension. If XLEN is changed, the most-significant bit of vsiselect moves to the new position, retaining its value from before.

Sscsrind_virtual_inst_fault

A virtual-instruction exception is raised for attempts from VS-mode or VU-mode to directly access vsiselect or vsireg*, or attempts from VU-mode to access siselect or sireg*.

vsireg_access_on_legal_vsiselect

Otherwise, while vsiselect holds a number in a standard-defined and implemented range, attempts to access vsireg* from a sufficiently privileged mode, or to access sireg* (really vsireg*) from VS-mode, result in specific behavior that, for each combination of vsiselect and vsiregi, is defined by the extension to which the vsiselect value is allocated.

Sscsrind_vsmode_csrs_sz

Like siselect and sireg*, the widths of vsiselect and vsireg* are always the current XLEN rather than VSXLEN. Hence, for example, if HSXLEN = 64 and VSXLEN = 32, then these registers are 64 bits when accessed by a hypervisor in HS-mode (running RV64 code) but 32 bits for a guest OS in VS-mode (RV32 code).

Sscsrind_csrs_access_control

If extension Smstateen is implemented together with Smcsrind, bit 60 of state-enable register mstateen0 controls access to siselect, sireg*, vsiselect, and vsireg*. When mstateen0[60]=0, an attempt to access one of these CSRs from a privilege mode less privileged than M-mode results in an illegal-instruction exception.

hypervisor_impl_csrs_access_control

If the hypervisor extension is implemented, the same bit is defined also in hypervisor CSR hstateen0, but controls access to only siselect and sireg* (really vsiselect and vsireg*), which is the state potentially accessible to a virtual machine executing in VS or VU-mode. When hstateen0[60]=0 and mstateen0[60]=1, all attempts from VS or VU-mode to access siselect or sireg* raise a virtual-instruction exception, not an illegal-instruction exception, regardless of the value of vsiselect or any other mstateen bit.

UDB Parameters: None.

B.11.4. Sscsrind Supervisor-Mode Indirect CSR Access

B.11.5. Smepmp Enhanced PMP

B.11.6. Smrnmi Machine-Mode Resumable Non-Maskable Interrupts

Smrnmi Coverpoints

No test plan yet.

Table 354. Smrnmi Normative Rules
Normative Rule Rule Text Coverpoints

mstatus_mdt_clr_mnret

When the Smdbltrp extension is implemented, the MNRET instruction, provided by the Smrnmi extension, sets the MDT bit to 0 if the new privilege mode is not M.

TODO: covered by the Smdbltrp suite (not yet written)

sstatus_sdt_clr_mnret

If the Ssdbltrp extension is also implemented, and the new privilege mode is U, VS, or VU, then sstatus.⁠SDT is also set to 0.

TODO: covered by the Ssdbltrp suite (not yet written)

vsstatus_sdt_clr_mnret

Additionally, if it is VU, then vsstatus.⁠SDT is also set to 0.

TODO: covered by the Ssdbltrp suite (not yet written): MNRET to VU-mode with Smdbltrp, Ssdbltrp, and H

trap_unexp_rnmi

When the Smrnmi extension is implemented, a trap caused by an RNMI is not considered an unexpected trap irrespective of the state of the MDT bit.

TODO: covered by the Smdbltrp suite (not yet written)

trap_unexp_mnstatus_nmie_0

a trap that occurs when executing in M-mode with mnstatus.⁠NMIE set to 0 is an unexpected trap.

trap_unexp_hndl_lead_in

In the event of a unexpected trap, the handling is as follows:

trap_unexp_hndl_rnmi

When the Smrnmi extension is implemented and mnstatus.⁠NMIE is 1, the hart traps to the RNMI interrupt trap handler. To deliver this trap, the mnepc and mncause registers are written with the values that the unexpected trap would have written to the mepc and mcause registers respectively. The privilege mode information fields in the mnstatus register are written to indicate M-mode and its NMIE field is set to 0.

trap_unexp_hndl_no_rnmi

When the Smrnmi extension is not implemented, or if the Smrnmi extension is implemented and mnstatus.⁠NMIE is 0, the hart enters a critical-error state without updating any architectural state, including the pc. This state involves ceasing execution, disabling all interrupts (including NMIs), and asserting a critical-error signal to the platform.

mnepc_invalid_convert

Prior to writing mnepc, implementations may convert an invalid address into some other invalid address that mnepc is capable of holding.

mnstatus_nmie_rst

If the Smrnmi extension is implemented, the mnstatus.NMIE field is reset to 0.

TODO: record mnstatus.NMIE before the boot code sets it

UDB Parameters: None.

B.11.7. Ssrnmi Supervisor-Mode Resumable Non-Maskable Interrupts

B.11.8. Smcntrpmf Counter Privilege Mode Filtering

B.11.9. Smcdeleg Counter Delegation

Smcdeleg Coverpoints

No test plan yet.

Table 355. Smcdeleg Normative Rules
Normative Rule Rule Text Coverpoints

Smcdeleg_Ssccfg_tandem

For a RISC-V hardware platform, Smcdeleg and Ssccfg must always be implemented in tandem.

Smcdeleg_cde_en

When the Smcdeleg/Ssccfg extensions are enabled (menvcfg.CDE=1), it further allows M-mode to delegate select counters to S-mode.

menvcfg_cde_op

If the Smcdeleg extension is implemented, the CDE (Counter Delegation Enable) bit controls whether Zicntr and Zihpm counters can be delegated to S-mode. When CDE=1, the Smcdeleg extension is enabled, see smcdeleg. When CDE=0, the Smcdeleg and Ssccfg extensions appear to be not implemented.

TODO: Smcdeleg with menvcfg.CDE = 0 and 1

Ssccfg_illegal_sireg_cde0

attempts to access any sireg* when menvcfg.CDE = 0;

Ssccfg_illegal_sireg3_6

attempts to access sireg3 or sireg6;

Ssccfg_illegal_sireg4_5_xlen64

attempts to access sireg4 or sireg5 when XLEN = 64;

Ssccfg_illegal_sireg_not_delegated

attempts to access sireg* when siselect = 0x41, or when the counter selected by siselect is not delegated to S-mode (the corresponding bit in mcounteren = 0).

Ssccfg_missing_extension_illegal

If any extension upon which the underlying state depends is not implemented, an attempt from M or S mode to access the given state through sireg* raises an illegal-instruction exception.

Ssccfg_hyp_vs_or_vu_access_vsireg_illegal

If the hypervisor (H) extension is also implemented, then as specified by extensions Smcsrind/Sscsrind, a virtual-instruction exception is raised for attempts from VS-mode or VU-mode to directly access vsiselect or vsireg*, or attempts from VU-mode to access siselect or sireg*. Furthermore, while vsiselect holds a value in the range 0x40-0x5F:

Ssccfg_hyp_m_s_vsireg_illegal

An attempt to access any vsireg* from M or S mode raises an illegal-instruction exception.

Ssccfg_hyp_vs_access_sireg_conditional

An attempt from VS-mode to access any sireg* (really vsireg*) raises an illegal-instruction exception if menvcfg.CDE = 0, or a virtual-instruction exception if menvcfg.CDE = 1.

Ssccfg_scountinhibit_exists

Smcdeleg/Ssccfg defines a new scountinhibit register, a masked alias of mcountinhibit.

Ssccfg_scountinhibit_delegated_rw

For counters delegated to S-mode, the associated mcountinhibit bits can be accessed via scountinhibit

Ssccfg_scountinhibit_nondelegated_ro

For counters not delegated to S-mode, the associated bits in scountinhibit are read-only zero.

Ssccfg_illegal_scountinhibit_cde0

When menvcfg.CDE=0, attempts to access scountinhibit raise an illegal-instruction exception.

Ssccfg_illegal_scountinhibit_vs_vu

When Supervisor Counter Delegation is enabled, attempts to access scountinhibit from VS-mode or VU-mode raise a virtual-instruction exception.

Ssccfg_virtual_scountovf_vs_vu

For implementations that support Smcdeleg/Ssccfg, Sscofpmf, and the H extension, when menvcfg.CDE=1, attempts to read scountovf from VS-mode or VU-mode raise a virtual-instruction exception.

Ssccfg_lcofi_mvip_mvien

For implementations that support Smcdeleg, Sscofpmf, and Smaia, the local-counter-overflow interrupt (LCOFI) bit (bit 13) in each of CSRs mvip and mvien is implemented and writable.

Ssccfg_lcofi_hvip_hvien

For implementations that support Smcdeleg/Ssccfg, Sscofpmf, Smaia/Ssaia, and the H extension, the LCOFI bit (bit 13) in each of hvip and hvien is implemented and writable.

UDB Parameters: None.

B.11.10. Ssccfg Counter Delegation

B.11.11. Smdbltrp Machine Double Traps

Smdbltrp Coverpoints

No test plan yet.

Table 356. Smdbltrp Normative Rules
Normative Rule Rule Text Coverpoints

mstatus_mie_clr_by_mdt

When the MDT bit is set to 1 by an explicit CSR write, the MIE (Machine Interrupt Enable) bit is cleared to 0.

TODO: covered by the Smdbltrp suite (not yet written)

mstatus_mie_clr_by_mdt_rv64

For RV64, this clearing occurs regardless of the value written, if any, to the MIE bit by the same write.

TODO: covered by the Smdbltrp suite (not yet written)

mstatus_mie_set_mdt_0

The MIE bit can only be set to 1 by an explicit CSR write if the MDT bit is already 0

TODO: covered by the Smdbltrp suite (not yet written)

mstatus_mie_set_mdt_0_rv64

or, for RV64, is being set to 0 by the same write

TODO: covered by the Smdbltrp suite (not yet written)

mstatus_mdt_rst

Upon reset, the MDT field is set to 1.

TODO: covered by the Smdbltrp suite (not yet written)

mstatus_mdt_not_set_rnmi

A trap caused by an RNMI does not set the MDT bit.

TODO: covered by the Smdbltrp suite (not yet written)

mstatus_mdt_clr_mret_sret

The MDT bit is set to 0.

TODO: covered by the Smdbltrp suite (not yet written)

mstatus_mdt_clr_mnret

When the Smdbltrp extension is implemented, the MNRET instruction, provided by the Smrnmi extension, sets the MDT bit to 0 if the new privilege mode is not M.

TODO: covered by the Smdbltrp suite (not yet written)

sstatus_sdt_clr_mret_sret

If the Ssdbltrp extension is also implemented, and the new privilege mode is U, VS, or VU, then sstatus.⁠SDT is also set to 0.

TODO: covered by the Smdbltrp suite (not yet written)

vsstatus_sdt_clr_mret_sret

Additionally, if it is VU, then vsstatus.⁠SDT is also set to 0.

TODO: covered by the Smdbltrp suite (not yet written)

trap_exp

When a trap is to be taken into M-mode, if the MDT bit is currently 0, it is then set to 1, and the trap is delivered as expected.

TODO: covered by the Smdbltrp suite (not yet written)

trap_unexp_mdt_1

However, if MDT is already set to 1, then this is an unexpected trap.

TODO: covered by the Smdbltrp suite (not yet written)

UDB Parameters: None.

B.11.12. Ssdbltrp Supervisor Double Traps

Ssdbltrp Coverpoints

No test plan yet.

Table 357. Ssdbltrp Normative Rules
Normative Rule Rule Text Coverpoints

sstatus_sdt

The S-mode-disable-trap (SDT) bit is a WARL field introduced by the Ssdbltrp extension to address double trap (See machine-double-trap) at privilege modes lower than M.

Sm_mcsr_cg/cp_mstatus_sdt_dte

sstatus_sdt_sstatus_sie_overwrite

When the SDT bit is set to 1 by an explicit CSR write, the SIE (Supervisor Interrupt Enable) bit is cleared to 0. This clearing occurs regardless of the value written, if any, to the SIE bit by the same write. The SIE bit can only be set to 1 by an explicit CSR write if the SDT bit is being set to 0 by the same write or is already 0.

TODO: covered by the Ssdbltrp suite (not yet written)

sstatus_sdt_trap

When a trap is to be taken into S-mode, if the SDT bit is currently 0, it is then set to 1, and the trap is delivered as expected.

TODO: covered by the Ssdbltrp suite (not yet written)

sstatus_sdt_unexpected_trap

However, if SDT is already set to 1, then this is an unexpected trap.

TODO: covered by the Ssdbltrp suite (not yet written): take a trap into S-mode with sstatus.SDT=1

sstatus_sdt_double_trap

In the event of an unexpected trap, a double-trap exception trap is delivered into M-mode.

TODO: covered by the Ssdbltrp suite (not yet written): check that a trap into S-mode with SDT=1 is delivered to M-mode

sstatus_sdt_double_trap_regs

To deliver this trap, the hart writes registers, except mcause and mtval2, with the same information that the unexpected trap would have written if it was taken into M-mode.

TODO: covered by the Ssdbltrp suite (not yet written): check mepc, mtval, and mstatus after a double trap

sstatus_sdt_double_trap_mtval2

The mtval2 register is then set to what would be otherwise written into the mcause register by the unexpected trap.

TODO: covered by the Ssdbltrp suite (not yet written): with H, check that mtval2 holds the unexpected trap’s cause

sstatus_sdt_double_trap_mcause

The mcause register is set to 16, the double-trap exception code.

TODO: covered by the Ssdbltrp suite (not yet written): check mcause=16 after a double trap

sstatus_sdt_sret

An SRET instruction sets the SDT bit to 0.

TODO: covered by the Ssdbltrp suite (not yet written)

menvcfg_dte_op

The Ssdbltrp extension adds the double-trap-enable (DTE) field in menvcfg. When menvcfg.DTE is zero, the implementation behaves as though Ssdbltrp is not implemented.

Sm_mcsr_cg/cp_mstatus_sdt_dte, TODO: covered by the Ssdbltrp suite (not yet written): traps into S-mode and SRET with menvcfg.DTE = 0 and 1

UDB Parameters: None.

B.11.13. Smctr Control Transfer Records

B.11.14. Ssqosid Quality-of-Service ID

Ssqosid Coverpoints

No test plan yet.

Table 358. Ssqosid Normative Rules
Normative Rule Rule Text Coverpoints

Ssqosid_srmcfg_introduced

To facilitate this, the QoS Identifiers extension (Ssqosid) introduces the srmcfg register, which configures a hart with two identifiers: a Resource Control ID (RCID) and a Monitoring Counter ID (MCID). These identifiers accompany each request issued by the hart to shared resource controllers.

Ssqosid_rcid_mcid_accompany_requests

The RCID and MCID accompany each request made by the hart to shared resource controllers. The RCID is used to determine the resource allocations (e.g., cache occupancy limits, memory bandwidth limits, etc.) to enforce. The MCID is used to identify a counter to monitor resource usage.

Ssqosid_srmcfg_register_size

The srmcfg register is an SXLEN-bit read/write register used to configure a Resource Control ID (RCID) and a Monitoring Counter ID (MCID). Both RCID and MCID are WARL fields.

Ssqosid_srmcfg_csr_applies_to_all_modes

The RCID and MCID configured in the srmcfg CSR apply to all privilege modes of software execution on that hart by default, but this behavior may be overridden by future extensions.

Ssqosid_Smstateen_srmcfg_requires_mstateen0

If extension Smstateen is implemented together with Ssqosid, then Ssqosid also requires the SRMCFG bit in mstateen0 to be implemented.

Smstateen_cg/{cp_walking_ones, cp_srmcfg}

Ssqosid_srmcfg_access_illegal_instruction

If mstateen0.SRMCFG is 0, attempts to access srmcfg in privilege modes less privileged than M-mode raise an illegal-instruction exception.

Smstateen_cg/cp_srmcfg

Ssqosid_srmcfg_access_virtual_instruction

If mstateen0.SRMCFG is 1 or if extension Smstateen is not implemented, attempts to access srmcfg when V=1 raise a virtual-instruction exception.

UDB Parameters: None.

TODO: This text is here to prevent Asciidoctor from rendering strangely after an empty table. Delete it when table is populated.

Appendix C: Non-ISA Test Plan

This chapter contains test plans for ratified RISC-V standards outside the Unprivileged and Privileged ISA specifications.

C.1. Debug

This section describes ISA and non-ISA debug-related extensions not required in RVA23.

External debug needs to be able to perform register I/O to the debug module, such as halting and resuming the core, sending abstract commands such as Access Register or Access Memory, or running code from the Program Buffer. This cannot be done from software running on the core because a program cannot halt and single step itself, so these tests will need additional testbench support. External debug is not in RVA23.

A suggested approach is to require all of DM, DTM, and Sdext supported together for systems with External Debug, and to have a testbench send JTAG commands via DTM to the DTM to exercise Debug Mode.

Note that Sdtrig is described in Section B.10.16.

C.1.1. DM Debug Module

C.1.2. DTM Debug Transport Module

C.1.3. Sdext Debug Extension

C.2. AIA Advanced Interrupt Architecture

This section describes AIA extension test plans.

C.2.1. Smaia Machine-Mode Advanced Interrupt Architecture

C.2.2. Ssaia Supervisor-Mode Advanced Interrupt Architecture

C.2.3. IMSIC Incoming MSI Controller

C.2.4. APLIC Advanced Platform-Level Interrupt Controller

C.3. I/O Memory Management Unit (IOMMU)

APLIC Coverpoints

This section describes IOMMU extension test plans.

C.3.1. IOMMU I/O Memory Management Unit

IOMMU Coverpoints

TODO: This text is here to prevent Asciidoctor from rendering strangely after an empty table. Delete it when table is populated.

Appendix D: UDB Parameters

Table 359 summarizes all of the UDB parameters that affect coverpoints in this testplan. Table 360 summarizes the UDB parameters that are not yet exercised.

Table 359. Used UDB Parameters
Parameter Dependent Coverpoints Defined By Description

ARCH_ID_VALUE

Sm_cg/cp_mcsr_access

Sm

The value of marchid The combination of mvendorid and marchid should uniquely identify the type of hart microarchitecture that is implemented.

COUNTINHIBIT_EN

Sm_cg/cp_inhibit

Sm

Indicates which hardware performance monitor counters can be disabled from mcountinhibit.

COUNTINHIBIT_EN[n] controls whether mcountinhibit.HPM<n> is writable. It does not depend on whether hpmcounter<n>/mhpmcounter<n> is read-only zero.

COUNTINHIBIT_EN[1] can never be true, since it corresponds to mcountinhibit.TM, which is always read-only-0.

HPM_COUNTER_EN

Zihpm_cg/cp_cntr_hpm

Sm

Whether each HPM counter is implemented in hardware.

HPM_COUNTER_EN[n] being false means hpmcounter<n>/mhpmcounter<n> and the corresponding mhpmevent<n> are not implemented and are hardwired read-only zero. (It does not mean the counter is implemented but currently stopped from counting; that is a separate, run-time concept controlled by mcountinhibit.)

There is one entry for each hpmcounter, indexed 0-31.

Indices 0-2 must be false: they are placeholders for the three counters (cycle/mcycle (CY), time ™, and instret/minstret (IR)) whose implementation this parameter does not control. These counters are associated with indexes 0, 1, and 2. The rest of the HPM counters logically follow at indexes 3-31. Index 3 in HPM_COUNTER_EN corresponds to mhpmcounter3. Index 31 in HPM_COUNTER_EN corresponds to mhpmcounter31.

IMP_ID_VALUE

Sm_cg/cp_mcsr_access

Sm

A unique encoding of the version of the processor implementation.

LRSC_FAIL_ON_NON_EXACT_LRSC

Zalrsc_cg/Zalrsc_sc_d_cg/cp_custom_sc_lr, Zalrsc_sc_w_cg/cp_custom_sc_addresses

Zalrsc

Whether or not a Store Conditional fails if its physical address and size do not exactly match the physical address and size of the last Load Reserved in program order (independent of whether or not the SC is in the current reservation set)

LRSC_FAIL_ON_VA_SYNONYM

Zalrsc_cg/Not tested because spec does not require any specific behavior

Zalrsc

Whether or not an sc.l/sc.d will fail if its VA does not match the VA of the prior lr.l/lr.d, even if the physical address of the SC and LR are the same

LRSC_MISALIGNED_BEHAVIOR

ExceptionsZalrsc_cg/cp_{load,store}_address_misaligned

Zalrsc

What to do when an LR/SC address is misaligned and MISALIGNED_AMO == false.

* 'always raise misaligned exception': self-explanatory * 'always raise access fault': self-explanatory * 'custom': Custom behavior; misaligned LR/SC may sometimes raise a misaligned exception and sometimes raise an access fault. Will lead to an 'unpredictable' call on any misaligned LR/SC access

LRSC_RESERVATION_STRATEGY

Zalrsc_cg/Zalrsc_sc_w_cg/cp_custom_sc_addresses

Zalrsc

Strategy used to handle reservation sets.

* "reserve naturally-aligned 64-byte region": Always reserve the 64-byte block containing the LR/SC address * "reserve naturally-aligned 128-byte region": Always reserve the 128-byte block containing the LR/SC address * "reserve exactly enough to cover the access": Always reserve exactly the LR/SC access, and no more * "custom": Custom behavior, leading to an 'unpredictable' call on any LR/SC

MARCHID_IMPLEMENTED

Sm_cg/cp_mcsr_access

Sm

* false: marchid is not implemented, and must be read-only-0 * true: marchid is implemented, and the value is determined by ARCH_ID_VALUE

MCOUNTENABLE_EN

Zicntr_cg/cp_cntr, Zihpm_cg/cp_cntr_hpm

Sm

Indicates which counters can be delegated via mcounteren.

MCOUNTENABLE_EN[n] controls whether mcounteren.HPM<n> is writable. It does not depend on whether hpmcounter<n>/mhpmcounter<n> is read-only zero.

MCOUNTENABLE_EN[0:2] must all be false if Zicntr is not implemented. MCOUNTENABLE_EN[3:31] must all be false if Zihpm is not implemented.

MIMPID_IMPLEMENTED

Sm_cg/cp_mcsr_access

Sm

* false: mimpid is not implemented, and must be read-only-0 * true: mimpid is implemented, and the value is determined by IMP_ID_VALUE

MISALIGNED_AMO

Zicfiss_cg/cp_ss_address_alignment_swap, Zicfiss_cg/cp_ss_address_alignment_swap_s

Zaamo

Whether or not the implementation supports misaligned atomics in main memory

MISALIGNED_LDST

ExceptionsSm_cg/cp_{load_address_misaligned, store_address_misaligned, cp_misaligned_priority_load, cp_misaligned_priority_store}

Sm

Does the implementation perform non-atomic misaligned loads and stores to main memory (does not affect misaligned support to device memory)? If not, the implementation always throws a misaligned exception.

MISALIGNED_LDST_EXCEPTION_PRIORITY

ExceptionsSm_cg/cp_misaligned_priority_load, cp_misaligned_priority_store, Zicfiss_cg/cp_ss_page_access_store_misaligned, Zicfiss_cg/cp_ss_page_access_store_misaligned_s

Sm

The relative priority of a load/store/AMO exception vs. load/store/AMO page-fault or access-fault exceptions.

May be one of:

[separator="!"] !=== ! low ! Misaligned load/store/AMO exceptions are always lower priority than load/store/AMO page-fault and access-fault exceptions. ! high ! Misaligned load/store/AMO exceptions are always higher priority than load/store/AMO page-fault and access-fault exceptions. !===

MISALIGNED_LDST_EXCEPTION_PRIORITY cannot be "high" when MISALIGNED_MAX_ATOMICITY_GRANULE_SIZE is non-zero, since the atomicity of an access cannot be determined in that case until after address translation.

MISA_CSR_IMPLEMENTED

Sm_cg/cp_mcsr_access

Sm

Options:

true:: The misa CSR returns a non-zero value.

false:: The misa CSR is read-only-0.

MTVAL_WIDTH

ExceptionsSm_cg/TODO

Sm

The number of implemented bits in the mtval CSR. This is the CSR that may be written when a trap is taken into M-mode with exception-specific information to assist software in handling the trap (e.g., address associated with exception).

Must be greater than or equal to max(PHYS_ADDR_WIDTH, VA_SIZE)

MTVEC_ACCESS

ExceptionsSm_cg/all exception coverpoints, InterruptsSm_cg/all exception coverpoints

Sm

Options:

ro:: mtvec is read-only.

rw:: mtvec is read-write, but may not accept all values.

MTVEC_BASE_ALIGNMENT_DIRECT

ExceptionsSm_cg/all exception coverpoints, InterruptsSm_cg/all exception coverpoints

Sm

Minimum alignment of the base pointer. Because mtvec excludes the two least-significant bits of the base, the minimum alignment cannot be less than 4.

MTVEC_BASE_ALIGNMENT_VECTORED

InterruptsSm_cg/all

Sm

Because mtvec excludes the two least-significant bits of the base, the minimum alignment cannot be less than 4.

MTVEC_ILLEGAL_WRITE_BEHAVIOR

ExceptionsSm_cg/all exception coverpoints, InterruptsSm_cg/all

Sm

Options:

retain:: When either mtvec.MODE or mtvec.BASE is illegal, mtvec will retain its current value

custom:: When either mtvec.MODE or mtvec.BASE is illegal, mtvec will obtain an unpredictable value

Other values may be added over time once other common behaviors are identified.

MTVEC_MODES

InterruptsSm_cg/TODO

Sm

Options:

0:: Direct; All traps set pc to mtvec.BASE 1:: Vectored; Asynchronous interrupts set pc to mtvec.BASE + 4 x cause.

If only one mode is given, mtvec.MODE is assumed to be read-only with that value. Otherwise, mtvec.MODE is read-write.

MXLEN

Sm_cg/all tests

Sm

XLEN in machine mode, specified in bits

NUM_USABLE_PMP_ENTRIES

Zicfiss_cg/cp_ss_pmp_permissions

Number of implemented PMP entries that are actually usable.

An implementation may implement PMP entries (NUM_PMP_ENTRIES) but hardwire some of them to zero (read-only zero). Such entries exist — their pmpaddrN/pmpNcfg registers are accessible and will not cause an exception from M-mode — but they cannot be configured to guard a region.

NUM_USABLE_PMP_ENTRIES gives the number of low-numbered entries that are writable/usable. Entries 0 through NUM_USABLE_PMP_ENTRIES-1 are usable; entries NUM_USABLE_PMP_ENTRIES through NUM_PMP_ENTRIES-1 are read-only zero.

Must be between 0 and NUM_PMP_ENTRIES, inclusive.

PMP_GRANULARITY

Zicfiss_cg/cp_ss_pmp_permissions

log2 of the smallest supported PMP region.

Generally, for systems with an MMU, should not be smaller than 12, as that would preclude caching PMP results in the TLB along with virtual memory translations

Note that PMP_GRANULARITY is equal to G+2 (not G) as described in the privileged architecture.

PMP_NAPOT_SUPPORTED

Zicfiss_cg/cp_ss_pmp_permissions

Whether or not the Naturally Aligned Power-Of-Two (NAPOT) PMP address matching mode is supported.

REPORT_CAUSE_IN_MTVAL_ON_SHADOW_STACK_SOFTWARE_CHECK

Zicfiss_cg/cp_ss_swcheck_mtval

Zicfiss

When true, mtval is written with the shadow stack cause (code=3) when a SoftwareCheck exception is raised into M-mode due to a shadow stack pop check instruction.

When false, mtval is written with 0.

REPORT_CAUSE_IN_STVAL_ON_SHADOW_STACK_SOFTWARE_CHECK

Zicfiss_cg/cp_sspopchk_mismatch, Zicfiss_cg/cp_sspopchk_mismatch_s

Zicfiss

When true, stval is written with the shadow stack cause (code=3) when a SoftwareCheck exception is raised into S-mode due to a shadow stack pop check instruction.

When false, stval is written with 0.

REPORT_CAUSE_IN_VSTVAL_ON_SHADOW_STACK_SOFTWARE_CHECK

Zicfiss_cg/Untested

Zicfiss

When true, vstval is written with the shadow stack cause (code=3) when a SoftwareCheck exception is raised into VS-mode due to a shadow stack pop check instruction.

When false, vstval is written with 0.

REPORT_ENCODING_IN_MTVAL_ON_ILLEGAL_INSTRUCTION

ExceptionsSm_cg/cp_illegal_instruction

Sm

Options:

* true: mtval is written with the encoding of an instruction causing an IllegalInstruction exception * false: mtval is written with 0 when an instruction causes an IllegalInstruction exception.

REPORT_VA_IN_MTVAL_ON_BREAKPOINT

ExceptionsSm_cg/cp_breakpoint

Sm

Options:

* true: mtval is written with the virtual PC of an EBREAK instruction (same information as mepc). * false: mtval is written with 0 on an EBREAK instruction.

Regardless, mtval is always written with a virtual PC when an external breakpoint is generated

REPORT_VA_IN_MTVAL_ON_INSTRUCTION_ACCESS_FAULT

ExceptionsSm_cg/cp_instr_access_fault

Sm

Options:

* true: mtval is written with the virtual address of a fetch causing the access fault * false: mtval is written with 0 when a fetch causes an access fault

REPORT_VA_IN_MTVAL_ON_INSTRUCTION_MISALIGNED

ExceptionsSm_cg/cp_instr_adr_misaligned_branch, cp_instr_misaligned_jal, cp_instr_misaligned_jalr

Sm

Options:

* true: mtval is written with the virtual address of a trapping misaligned fetch * false: mtval is written with 0 when a misaligned fetch traps

REPORT_VA_IN_MTVAL_ON_LOAD_ACCESS_FAULT

ExceptionsSm_cg/cp_load_access_fault

Sm

Options:

* true: mtval is written with the virtual address of a load causing the access fault * false: mtval is written with 0 when a load causes an access fault

REPORT_VA_IN_MTVAL_ON_LOAD_MISALIGNED

ExceptionsSm_cg/cp_load_address_misaligned

Sm

Options:

* true: mtval is written with the virtual address of a trapping misaligned load. * false: mtval is written with 0 when a misaligned load traps.

REPORT_VA_IN_MTVAL_ON_STORE_AMO_ACCESS_FAULT

ExceptionsSm_cg/cp_store_access_fault

Sm

Options:

* true: mtval is written with the virtual address of a store or AMO causing the access fault * false: mtval is written with 0 when a store or AMO causes an access fault

REPORT_VA_IN_MTVAL_ON_STORE_AMO_MISALIGNED

ExceptionsSm_cg/cp_store_address_misaligned

Sm

Options:

* true: mtval is written with the virtual address of a trapping misaligned store or AMO. * false: mtval is written with 0 when a misaligned store or AMO traps.

SCOUNTENABLE_EN

Zicntr_cg/cp_cntr, Zihpm_cg/cp_cntr_hpm

S

Indicates which counters can delegated via scounteren

SCOUNTENABLE_EN[n] controls whether scounteren.HPM<n> is writable. It does not depend on whether hpmcounter<n>/mhpmcounter<n> is read-only zero.

SCOUNTENABLE_EN[0:2] must all be false if Zicntr is not implemented. SCOUNTENABLE_EN[3:31] must all be false if Zihpm is not implemented.

STVEC_BASE_ALIGNMENT_VECTORED

InterruptsS_cg/all

S

Minimum alignment of the base pointer when stvec.MODE is Vectored. Because stvec excludes the two least-significant bits of the base, the minimum alignment cannot be less than 4 bytes.

STVEC_MODES

InterruptsS_cg/TODO

S

Options:

0:: Direct; All traps set pc to stvec.BASE 1:: Vectored; Asynchronous interrupts set pc to stvec.BASE + 4 x cause.

If only one mode is given, stvec.MODE is assumed to be read-only with that value. Otherwise, stvec.MODE is read-write.

TIME_CSR_IMPLEMENTED

Sm_cg/cp_mtime_write, Zicntr_cg/cp_cntr

Zicntr

Whether or not a real hardware time CSR exists. Implementations can either provide a real CSR or emulate access at M-mode.

Possible values:

true:: time/timeh exists, and accessing it will not cause an IllegalInstruction trap

false:: time/timeh does not exist. Accessing the CSR will cause an IllegalInstruction trap or enter an unpredictable state, depending on TRAP_ON_UNIMPLEMENTED_CSR. Privileged software may emulate the time CSR, or may pass the exception to a lower level.

TRAP_ON_EBREAK

ExceptionsSm_cg/cp_breakpoint

Sm

The spec states that implementations may handle EBREAKs transparently without raising a trap, in which case the EEI must provide a builtin.

TRAP_ON_ECALL_FROM_M

ExceptionsSm_cg/cp_ecall_m

Sm

The spec states that implementations may handle ECALLs transparently without raising a trap, in which case the EEI must provide a builtin.

VENDOR_ID_BANK

Sm_cg/cp_mcsr_access

Sm

Encodes the number of one-byte continuation codes in the Bank field of mvendorid.

iN JEDEC’s parlance, the bank number is one greater than the number of continuation codes; hence, the mvendorid Bank field encodes a value that is one less than the JEDEC bank number.

VENDOR_ID_OFFSET

Sm_cg/cp_mcsr_access

Sm

Encodes the final byte of a JEDEC manufactor ID, discarding the parity bit.

Table 360. Unused UDB Parameters
Parameter Defined By Description

ASID_WIDTH

S

Number of implemented ASID bits. Maximum is 16 for XLEN==64, and 9 for XLEN==32

CACHE_BLOCK_SIZE

Zicbom, Zicbop, Zicboz

The observable size of a cache block, in bytes. A cache block is a naturally aligned power-of-two (NAPOT) range of memory.

CONFIG_PTR_ADDRESS

Sm

The value returned from mconfigptr

DBG_HCONTEXT_WIDTH

Sdtrig

Specifies the size of HCONTEXT

DBG_SCONTEXT_WIDTH

Sdtrig

Specifies the size of SCONTEXT

DCSR_MPRVEN_TYPE

Sdtrig

Implementation of dcsr.MPRVEN is optional. It may be tied to either 0 or 1.

Behavior of the dcsr.MPRVEN bit: * 'read-only-0': tied to 0 * 'read-only-1': tied to 1 * 'rw': read-write

DCSR_STEPIE_TYPE

Sdtrig

Implementation of dcsr.STEPIE is optional. It may be tied to either 0 or 1.

Behavior of the dcsr.STEPIE bit: * 'read-only-0': tied to 0 * 'read-only-1': tied to 1 * 'rw': read-write

DCSR_STOPCOUNT_TYPE

Sdtrig

Implementation of dcsr.STOPCOUNT is optional. It may be tied to either 0 or 1.

Behavior of the dcsr.STOPCOUNT bit: * 'read-only-0': tied to 0 * 'read-only-1': tied to 1 * 'rw': read-write

DCSR_STOPTIME_TYPE

Sdtrig

Implementation of dcsr.STOPTIME is optional. It may be tied to either 0 or 1.

Behavior of the dcsr.STOPTIME bit: * 'read-only-0': tied to 0 * 'read-only-1': tied to 1 * 'rw': read-write

ELEN

Zvl32b

The maximum size in bits of a vector element that any operation can produce or consume.

FOLLOW_VTYPE_RESET_RECOMMENDATION

Zvl32b

It is recommended that at reset, vtype.vill is set, the remaining bits in vtype are zero, and vl is set to zero. If this parameter is set to true, this recommendation is followed. If it is false, at reset the respective fields will be UNDEFINED_LEGAL.

FORCE_UPGRADE_CBO_INVAL_TO_FLUSH

Zicbom

When true, an implementation prohibits setting menvcfg.CBIE == 11 such that all cbo.inval instructions either trap (when menvcfg.CBIE == '00') or flush (when menvcfg.CBIE == '01').

When false, an implementation allows a true INVAL operation for cbo.inval, and thus supports the setting menvcfg.CBIE == 11.

GSTAGE_MODE_BARE

H

Whether or not writing mode=Bare is supported in the hgatp register.

HCONTEXT_IMPLEMENTED

Sdtrig, H

Specifies if the hcontext CSR is implemented

HCOUNTENABLE_EN

H

Indicates which counters can delegated via hcounteren

HCOUNTENABLE_EN[n] controls whether hcounteren.HPM<n> is writable. It does not depend on whether hpmcounter<n>/mhpmcounter<n> is read-only zero.

HCOUNTENABLE_EN[0:2] must all be false if Zicntr is not implemented. HCOUNTENABLE_EN[3:31] must all be false if Zihpm is not implemented.

HPM_COUNTER10_WIDTH

Sm

The number of bits of precision implemented by mhpmcounter10.

This parameter exists only when HPM_COUNTER_EN[10] is true. The privileged specification allows an HPM counter to have up to 64 bits of precision.

HPM_COUNTER11_WIDTH

Sm

The number of bits of precision implemented by mhpmcounter11.

This parameter exists only when HPM_COUNTER_EN[11] is true. The privileged specification allows an HPM counter to have up to 64 bits of precision.

HPM_COUNTER12_WIDTH

Sm

The number of bits of precision implemented by mhpmcounter12.

This parameter exists only when HPM_COUNTER_EN[12] is true. The privileged specification allows an HPM counter to have up to 64 bits of precision.

HPM_COUNTER13_WIDTH

Sm

The number of bits of precision implemented by mhpmcounter13.

This parameter exists only when HPM_COUNTER_EN[13] is true. The privileged specification allows an HPM counter to have up to 64 bits of precision.

HPM_COUNTER14_WIDTH

Sm

The number of bits of precision implemented by mhpmcounter14.

This parameter exists only when HPM_COUNTER_EN[14] is true. The privileged specification allows an HPM counter to have up to 64 bits of precision.

HPM_COUNTER15_WIDTH

Sm

The number of bits of precision implemented by mhpmcounter15.

This parameter exists only when HPM_COUNTER_EN[15] is true. The privileged specification allows an HPM counter to have up to 64 bits of precision.

HPM_COUNTER16_WIDTH

Sm

The number of bits of precision implemented by mhpmcounter16.

This parameter exists only when HPM_COUNTER_EN[16] is true. The privileged specification allows an HPM counter to have up to 64 bits of precision.

HPM_COUNTER17_WIDTH

Sm

The number of bits of precision implemented by mhpmcounter17.

This parameter exists only when HPM_COUNTER_EN[17] is true. The privileged specification allows an HPM counter to have up to 64 bits of precision.

HPM_COUNTER18_WIDTH

Sm

The number of bits of precision implemented by mhpmcounter18.

This parameter exists only when HPM_COUNTER_EN[18] is true. The privileged specification allows an HPM counter to have up to 64 bits of precision.

HPM_COUNTER19_WIDTH

Sm

The number of bits of precision implemented by mhpmcounter19.

This parameter exists only when HPM_COUNTER_EN[19] is true. The privileged specification allows an HPM counter to have up to 64 bits of precision.

HPM_COUNTER20_WIDTH

Sm

The number of bits of precision implemented by mhpmcounter20.

This parameter exists only when HPM_COUNTER_EN[20] is true. The privileged specification allows an HPM counter to have up to 64 bits of precision.

HPM_COUNTER21_WIDTH

Sm

The number of bits of precision implemented by mhpmcounter21.

This parameter exists only when HPM_COUNTER_EN[21] is true. The privileged specification allows an HPM counter to have up to 64 bits of precision.

HPM_COUNTER22_WIDTH

Sm

The number of bits of precision implemented by mhpmcounter22.

This parameter exists only when HPM_COUNTER_EN[22] is true. The privileged specification allows an HPM counter to have up to 64 bits of precision.

HPM_COUNTER23_WIDTH

Sm

The number of bits of precision implemented by mhpmcounter23.

This parameter exists only when HPM_COUNTER_EN[23] is true. The privileged specification allows an HPM counter to have up to 64 bits of precision.

HPM_COUNTER24_WIDTH

Sm

The number of bits of precision implemented by mhpmcounter24.

This parameter exists only when HPM_COUNTER_EN[24] is true. The privileged specification allows an HPM counter to have up to 64 bits of precision.

HPM_COUNTER25_WIDTH

Sm

The number of bits of precision implemented by mhpmcounter25.

This parameter exists only when HPM_COUNTER_EN[25] is true. The privileged specification allows an HPM counter to have up to 64 bits of precision.

HPM_COUNTER26_WIDTH

Sm

The number of bits of precision implemented by mhpmcounter26.

This parameter exists only when HPM_COUNTER_EN[26] is true. The privileged specification allows an HPM counter to have up to 64 bits of precision.

HPM_COUNTER27_WIDTH

Sm

The number of bits of precision implemented by mhpmcounter27.

This parameter exists only when HPM_COUNTER_EN[27] is true. The privileged specification allows an HPM counter to have up to 64 bits of precision.

HPM_COUNTER28_WIDTH

Sm

The number of bits of precision implemented by mhpmcounter28.

This parameter exists only when HPM_COUNTER_EN[28] is true. The privileged specification allows an HPM counter to have up to 64 bits of precision.

HPM_COUNTER29_WIDTH

Sm

The number of bits of precision implemented by mhpmcounter29.

This parameter exists only when HPM_COUNTER_EN[29] is true. The privileged specification allows an HPM counter to have up to 64 bits of precision.

HPM_COUNTER30_WIDTH

Sm

The number of bits of precision implemented by mhpmcounter30.

This parameter exists only when HPM_COUNTER_EN[30] is true. The privileged specification allows an HPM counter to have up to 64 bits of precision.

HPM_COUNTER31_WIDTH

Sm

The number of bits of precision implemented by mhpmcounter31.

This parameter exists only when HPM_COUNTER_EN[31] is true. The privileged specification allows an HPM counter to have up to 64 bits of precision.

HPM_COUNTER3_WIDTH

Sm

The number of bits of precision implemented by mhpmcounter3.

This parameter exists only when HPM_COUNTER_EN[3] is true. The privileged specification allows an HPM counter to have up to 64 bits of precision.

HPM_COUNTER4_WIDTH

Sm

The number of bits of precision implemented by mhpmcounter4.

This parameter exists only when HPM_COUNTER_EN[4] is true. The privileged specification allows an HPM counter to have up to 64 bits of precision.

HPM_COUNTER5_WIDTH

Sm

The number of bits of precision implemented by mhpmcounter5.

This parameter exists only when HPM_COUNTER_EN[5] is true. The privileged specification allows an HPM counter to have up to 64 bits of precision.

HPM_COUNTER6_WIDTH

Sm

The number of bits of precision implemented by mhpmcounter6.

This parameter exists only when HPM_COUNTER_EN[6] is true. The privileged specification allows an HPM counter to have up to 64 bits of precision.

HPM_COUNTER7_WIDTH

Sm

The number of bits of precision implemented by mhpmcounter7.

This parameter exists only when HPM_COUNTER_EN[7] is true. The privileged specification allows an HPM counter to have up to 64 bits of precision.

HPM_COUNTER8_WIDTH

Sm

The number of bits of precision implemented by mhpmcounter8.

This parameter exists only when HPM_COUNTER_EN[8] is true. The privileged specification allows an HPM counter to have up to 64 bits of precision.

HPM_COUNTER9_WIDTH

Sm

The number of bits of precision implemented by mhpmcounter9.

This parameter exists only when HPM_COUNTER_EN[9] is true. The privileged specification allows an HPM counter to have up to 64 bits of precision.

HPM_EVENTS

Sm

List of defined event numbers that can be written into mhpmeventN

HSTATEEN_AIA_TYPE

Ssaia, H, Ssstateen

Behavior of the hstateen0.AIA bit:

* 'rw': read-write * 'read-only-0': read-only, fixed to 0 * 'read-only-1': read-only, fixed to 1

HSTATEEN_CONTEXT_TYPE

Sdtrig, H, Ssstateen

Behavior of the hstateen0.CONTEXT bit:

* 'rw': read-write * 'read-only-0': read-only, fixed to 0 * 'read-only-1': read-only, fixed to 1

HSTATEEN_CSRIND_TYPE

Sscsrind, H, Ssstateen

Behavior of the hstateen0.CSRIND bit:

* 'rw': read-write * 'read-only-0': read-only, fixed to 0 * 'read-only-1': read-only, fixed to 1

HSTATEEN_ENVCFG_TYPE

Behavior of the hstateen0.ENVCFG bit:

* 'rw': read-write * 'read-only-0': read-only, fixed to 0 * 'read-only-1': read-only, fixed to 1

HSTATEEN_IMSIC_TYPE

Ssaia, H, Ssstateen

Behavior of the hstateen0.IMSIC bit:

* 'rw': read-write * 'read-only-0': read-only, fixed to 0 * 'read-only-1': read-only, fixed to 1

HSTATEEN_JVT_TYPE

Zcmt, H, Ssstateen

Behavior of the hstateen0.JVT bit:

* 'rw': read-write * 'read-only-0': read-only, fixed to 0 * 'read-only-1': read-only, fixed to 1

HW_MSTATUS_FS_DIRTY_UPDATE

F, Sm

Indicates when hardware will write to mstatus.FS

Values are: [separator="!"] !=== h! precise ! Hardware writes mstatus.FS to the Dirty (3) state precisely when F registers are modified h! imprecise ! Hardware writes mstatus.FS imprecisely. This will result in a call to unpredictable() on any attempt to read mstatus or write FP state. !===

HW_MSTATUS_VS_DIRTY_UPDATE

Zvl32b, Sm

Indicates when hardware will write to mstatus.VS

Values are: [separator="!"] !=== h! precise ! Hardware writes mstatus.VS to the Dirty (3) state precisely when V registers are modified h! imprecise ! Hardware writes mstatus.VS imprecisely. This will result in a call to unpredictable() on any attempt to read mstatus or write vector state. !===

IGNORE_INVALID_VSATP_MODE_WRITES_WHEN_V_EQ_ZERO

H

Whether writes from M-mode, U-mode, or S-mode to vsatp with an illegal mode setting are ignored (as they are with satp), or if they are treated as WARL, leading to undpredictable behavior.

IMPRECISE_VECTOR_TRAP_SETTABLE

Zvl32b

Some profiles may provide a privileged configuration bit that selects between precise and imprecise vector trap behavior, allowing flexibility in how traps and partial updates are reported.

JVT_BASE_MASK

Zcmt

Mask representing the implemented bits of jvt.BASE. Includes the implicitly-zero bits of jvt.BASE, so JVT_BASE_MASK[5:0] must always be 0.

JVT_BASE_TYPE

Zcmt

Type of the jvt.BASE CSR field. One of:

* mask: jvt.BASE contains one or more implemented bits, which are indicated by JVT_BASE_MASK. * custom: Custom behavior. Will cause hart to enter 'unpredictable' state on a write to jvt.BASE.

JVT_READ_ONLY

Zcmt

If Zcmt is implemented, JVT is implemented, but can contain a read-only value

LEGAL_VSTART

Zvl32b

Implementations may raise illegal-instruction exceptions for vector instructions that specify a vstart value the implementation can never produce under the same vtype configuration (e.g., due to restrictions on supported strides or alignments).

MCID_WIDTH

Ssqosid

Number of bits used for the Monitoring Counter ID field (MCID). Default is 12.

MCONTEXT_IMPLEMENTED

Sdtrig

Specifies if the mcontext CSR is implemented

MCOUNTINHIBIT_IMPLEMENTED

Sm

Options:

true:: The mcountinhibit CSR is implemented and can be accessed in M-mode.

false:: The mcountinhibit CSR is not implemented. Accessing the CSR will cause an IllegalInstruction trap or enter an unpredictable state, depending on TRAP_ON_UNIMPLEMENTED_CSR.

MCTRCTL_CORSWAPINH_IMPLEMENTED

Smctr

Whether or not mctrctl.CORSWAPINH is implemented.

When not implemented mctrctl.CORSWAPINH will be read-only-zero.

MCTRCTL_CUSTOM_IMPLEMENTED

Smctr

Whether or not mctrctl.CUSTOM is implemented.

When not implemented mctrctl.CUSTOM will be read-only-zero.

MCTRCTL_DIRCALLINH_IMPLEMENTED

Smctr

Whether or not mctrctl.DIRCALLINH is implemented.

When not implemented mctrctl.DIRCALLINH will be read-only-zero.

MCTRCTL_DIRJMPINH_IMPLEMENTED

Smctr

Whether or not mctrctl.DIRJMPINH is implemented.

When not implemented mctrctl.DIRJMPINH will be read-only-zero.

MCTRCTL_DIRLJMPINH_IMPLEMENTED

Smctr

Whether or not mctrctl.DIRLJMPINH is implemented.

When not implemented mctrctl.DIRLJMPINH will be read-only-zero.

MCTRCTL_EXCINH_IMPLEMENTED

Smctr

Whether or not mctrctl.EXCINH is implemented.

When not implemented mctrctl.EXCINH will be read-only-zero.

MCTRCTL_INDCALLINH_IMPLEMENTED

Smctr

Whether or not mctrctl.INDCALLINH is implemented.

When not implemented mctrctl.INDCALLINH will be read-only-zero.

MCTRCTL_INDJMPINH_IMPLEMENTED

Smctr

Whether or not mctrctl.INDJMPINH is implemented.

When not implemented mctrctl.INDJMPINH will be read-only-zero.

MCTRCTL_INDLJMPINH_IMPLEMENTED

Smctr

Whether or not mctrctl.INDLJMPINH is implemented.

When not implemented mctrctl.INDLJMPINH will be read-only-zero.

MCTRCTL_INTRINH_IMPLEMENTED

Smctr

Whether or not mctrctl.INTRINH is implemented.

When not implemented mctrctl.INTRINH will be read-only-zero.

MCTRCTL_MTE_IMPLEMENTED

Smctr

Whether or not mctrctl.MTE is implemented.

When not implemented mctrctl.MTE will be read-only-zero.

MCTRCTL_NTBREN_IMPLEMENTED

Smctr

Whether or not mctrctl.NTBREN is implemented.

When not implemented mctrctl.NTBREN will be read-only-zero.

MCTRCTL_RASEMU_IMPLEMENTED

Smctr

Whether or not mctrctl.RASEMU is implemented.

When not implemented mctrctl.RASEMU will be read-only-zero.

MCTRCTL_RETINH_IMPLEMENTED

Smctr

Whether or not mctrctl.RETINH is implemented.

When not implemented mctrctl.RETINH will be read-only-zero.

MCTRCTL_STE_IMPLEMENTED

Smctr

Whether or not mctrctl.STE is implemented.

When not implemented mctrctl.STE will be read-only-zero.

MCTRCTL_TKBRINH_IMPLEMENTED

Smctr

Whether or not mctrctl.TKBRINH is implemented.

When not implemented mctrctl.TKBRINH will be read-only-zero.

MCTRCTL_TRETINH_IMPLEMENTED

Smctr

Whether or not mctrctl.TRETINH is implemented.

When not implemented mctrctl.TRETINH will be read-only-zero.

MEDELEG_DELEGATABLE

S

Indicates which synchronous exceptions can be delegated via medeleg.

Entry i corresponds to medeleg bit i, whose index is the exception code reported in mcause. When an entry is true, the corresponding medeleg bit is writable. When an entry is false, the corresponding medeleg bit is read-only zero.

An implementation may support any subset of the delegatable exceptions, but no bit of medeleg may be read-only one.

MEDELEG_DELEGATABLE[11] (environment call from M-mode) and MEDELEG_DELEGATABLE[16] (double trap) must always be false.

MEI_INTR_IMPL

Zicsr, Sm

Whether or not machine-level external interrupts are implemented.

Possible values:

true:: Machine-level external interrupts are implemented. mie.MEIE is writable, and mideleg.MEI is writable if MIDELEG_DELEGATABLE[11] is true.

false:: Machine-level external interrupts are not implemented. mie.MEIE and mideleg.MEI are read-only zero.

MIDELEG_DELEGATABLE

S

Indicates which interrupts can be delegated via mideleg.

Entry i corresponds to mideleg bit i, which uses the same bit layout as mip. When an entry is true, the corresponding interrupt can be delegated: the mideleg bit is writable, except for bits that are always delegated, which are read-only one. When an entry is false, the corresponding mideleg bit is read-only zero.

An unimplemented interrupt cannot be delegated, i.e., if STI_INTR_IMPL is false, MIDELEG_DELEGATABLE[5] must be false.

When the H extension is implemented, VSSI, VSTI, and VSEI are always delegated to HS-mode, so MIDELEG_DELEGATABLE[2], [6], and [10] must be true. SGEI is also always delegated when any guest external interrupts are implemented (NUM_EXTERNAL_GUEST_INTERRUPTS is nonzero), so MIDELEG_DELEGATABLE[12] must then be true; otherwise it must be false. When H is not implemented, all four must be false.

MISALIGNED_MAX_ATOMICITY_GRANULE_SIZE

Sm

When MISALIGNED_MAX_ATOMICITY_GRANULE_SIZE is 0, the hart cannot atomically perform a misaligned load/store/AMO. When a power of two, the hart can atomically load/store/AMO a misaligned access that is fully contained in a MISALIGNED_MAX_ATOMICITY_GRANULE_SIZE-aligned region.

[NOTE] Even if the hart is capable of performing a misaligned load/store/AMO atomically, a misaligned exception may still occur if the access does not have the appropriate Misaligned Atomicity Granule PMA set.

MISALIGNED_SPLIT_STRATEGY

Sm

Options:

* sequential_bytes: The load/store appears to be broken into byte-sized accesses that processed sequentially from smallest address to largest address * custom: Something else. Will result in a call to unpredictable() in the execution

MSI_INTR_IMPL

Zicsr, Sm

Whether or not machine-level software interrupts are implemented.

Possible values:

true:: Machine-level software interrupts are implemented. mie.MSIE is writable, and mideleg.MSI is writable if MIDELEG_DELEGATABLE[3] is true.

false:: Machine-level software interrupts are not implemented. mie.MSIE and mideleg.MSI are read-only zero.

MSTATEEN_AIA_TYPE

Ssaia

Behavior of the mstateen0.AIA bit:

* 'rw': read-write * 'read-only-0': read-only, fixed to 0 * 'read-only-1': read-only, fixed to 1

MSTATEEN_CONTEXT_TYPE

Sdtrig, Smstateen

Behavior of the mstateen0.CONTEXT bit:

* 'rw': read-write * 'read-only-0': read-only, fixed to 0 * 'read-only-1': read-only, fixed to 1

MSTATEEN_CSRIND_TYPE

Sscsrind, Smstateen

Behavior of the mstateen0.CSRIND bit:

* 'rw': read-write * 'read-only-0': read-only, fixed to 0 * 'read-only-1': read-only, fixed to 1

MSTATEEN_ENVCFG_TYPE

S, Smstateen

Behavior of the mstateen0.ENVCFG bit:

* 'rw': read-write * 'read-only-0': read-only, fixed to 0 * 'read-only-1': read-only, fixed to 1

MSTATEEN_IMSIC_TYPE

Ssaia

Behavior of the mstateen0.IMSIC bit:

* 'rw': read-write * 'read-only-0': read-only, fixed to 0 * 'read-only-1': read-only, fixed to 1

MSTATEEN_JVT_TYPE

Zcmt

Behavior of the mstateen0.JVT bit:

* 'rw': read-write * 'read-only-0': read-only, fixed to 0 * 'read-only-1': read-only, fixed to 1

MSTATUS_FS_LEGAL_VALUES

Sm, F, S

The set of values that mstatus.FS supports.

MSTATUS_VS_LEGAL_VALUES

Sm, Zvl32b, S

The set of values that mstatus.VS will accept from a software write.

MTI_INTR_IMPL

Zicsr, Sm

Whether or not machine-level timer interrupts are implemented.

Possible values:

true:: Machine-level timer interrupts are implemented. mie.MTIE and mtimecmp are writable, and mideleg.MTI is writable if MIDELEG_DELEGATABLE[7] is true.

false:: Machine-level timer interrupts are not implemented. mie.MTIE and mideleg.MTI are read-only zero. mtimecmp is optional and may be read-only zero.

MUTABLE_MISA_A

A, Sm

When the A extensions is supported, indicates whether or not the extension can be disabled in the misa.A bit.

MUTABLE_MISA_B

B, Sm

Indicates whether or not the B extension can be disabled with the misa.B bit.

MUTABLE_MISA_C

C, Sm

Indicates whether or not the C extension can be disabled with the misa.C bit.

MUTABLE_MISA_D

D, Sm

Indicates whether or not the D extension can be disabled with the misa.D bit.

MUTABLE_MISA_F

F, Sm

Indicates whether or not the F extension can be disabled with the misa.F bit.

MUTABLE_MISA_H

Sm, H

Indicates whether or not the H extension can be disabled with the misa.H bit.

MUTABLE_MISA_M

M, Sm

Indicates whether or not the M extension can be disabled with the misa.M bit.

MUTABLE_MISA_Q

Q, Sm

Indicates whether or not the Q extension can be disabled with the misa.Q bit.

MUTABLE_MISA_S

S, Sm

Indicates whether or not the S extension can be disabled with the misa.S bit.

MUTABLE_MISA_U

U, Sm

Indicates whether or not the U extension can be disabled with the misa.U bit.

MUTABLE_MISA_V

V, Sm

Indicates whether or not the V extension can be disabled with the misa.V bit.

M_MODE_ENDIANNESS

Sm

Options:

[separator="!"] !=== h! little ! M-mode data is always little endian h! big ! M-mode data is always big endian h! dynamic ! M-mode data can be either little or big endian, depending on the CSR field mstatus.MBE !===

NON_STANDARD_EXTENSION_IMPLEMENTED

Sm

If any non-standard extensions are implemented, this parameter must be true. This parameter is used as the reset value for misa.X.

NUM_EXTERNAL_GUEST_INTERRUPTS

H

Number of supported virtualized guest interrupts

Corresponds to the GEILEN parameter in the RVI specs

NUM_PMP_ENTRIES

Sm

Number of implemented PMP entries.

The architecture mandates that the number of implemented PMP registers must appear to be 0, 16, or 64, so NUM_PMP_ENTRIES must be one of those values. It directly determines which PMP registers exist: pmpaddr0-pmpaddr<N-1> and their corresponding pmpNcfg fields are implemented, and the rest are not. Accessing an unimplemented PMP register causes an IllegalInstruction when TRAP_ON_UNIMPLEMENTED_CSR is true.

[NOTE] pmpcfgN for an odd N never exists when XLEN == 64.

An implemented entry may still be read-only zero (but will never cause an exception). The number of entries that are actually usable is given by NUM_USABLE_PMP_ENTRIES.

PHYS_ADDR_WIDTH

Sm

Implementation-defined size of the physical address space.

PMA_GRANULARITY

Sm

Generally, for systems with an MMU, should not be smaller than 12, as that would preclude caching PMA results in the TLB along with virtual memory translations

PMP_NA4_SUPPORTED

Whether or not the Naturally Aligned four-byte (NA4) PMP address matching mode is supported.

PMP_TOR_SUPPORTED

Whether or not the Top-of-Range (TOR) PMP address matching mode is supported.

PRECISE_SYNCHRONOUS_EXCEPTIONS

Sm

If false, any exception not otherwise mandated to precise (e.g., PMP violation) will cause execution to enter an unpredictable state.

RCID_WIDTH

Ssqosid

Number of bits used for the Resource Control ID field (RCID). Default is 12.

REPORT_CAUSE_IN_MTVAL_ON_LANDING_PAD_SOFTWARE_CHECK

Zicfilp

When true, mtval is written with the landing pad fault cause (code=2) when a SoftwareCheck exception is raised into M-mode due to a landing pad error.

When false, mtval is written with 0.

REPORT_CAUSE_IN_STVAL_ON_LANDING_PAD_SOFTWARE_CHECK

Zicfilp

When true, stval is written with the landing pad fault cause (code=2) when a SoftwareCheck exception is raised into S-mode due to a landing pad error.

When false, stval is written with 0.

REPORT_CAUSE_IN_VSTVAL_ON_LANDING_PAD_SOFTWARE_CHECK

Zicfilp

When true, vstval is written with the landing pad fault cause (code=2) when a SoftwareCheck exception is raised into VS-mode due to a landing pad error.

When false, vstval is written with 0.

REPORT_ENCODING_IN_STVAL_ON_ILLEGAL_INSTRUCTION

S

When true, stval is written with the encoding of an instruction that causes an IllegalInstruction exception.

When false stval is written with 0 when an IllegalInstruction exception occurs.

REPORT_ENCODING_IN_VSTVAL_ON_ILLEGAL_INSTRUCTION

H

When true, vstval is written with the encoding of an instruction that causes an IllegalInstruction exception.

When false vstval is written with 0 when an IllegalInstruction exception occurs.

REPORT_ENCODING_IN_VSTVAL_ON_VIRTUAL_INSTRUCTION

H

When true, vstval is written with the encoding of an instruction that causes an VirualInstruction exception.

When false vstval is written with 0 when an VirtualInstruction exception occurs.

REPORT_GPA_IN_HTVAL_ON_GUEST_PAGE_FAULT

H

When true, htval is written with the Guest Physical Address, shifted right by 2, that caused a GuestPageFault exception.

When false, htval is written with 0 when a GuestPageFault exception occurs.

REPORT_GPA_IN_TVAL_ON_INSTRUCTION_GUEST_PAGE_FAULT

H

Whether or not GPA >> 2 is written into htval/mtval2 when an instruction guest page fault occurs.

If false, 0 will be written into htval/mtval2 on an instruction guest page fault.

REPORT_GPA_IN_TVAL_ON_INTERMEDIATE_GUEST_PAGE_FAULT

H

Whether or not GPA >> 2 is written into htval/mtval2 when a guest page fault occurs while walking a VS-mode page table.

If false, 0 will be written into htval/mtval2 on an intermediate guest page fault.

REPORT_GPA_IN_TVAL_ON_LOAD_GUEST_PAGE_FAULT

H

Whether or not GPA >> 2 is written into htval/mtval2 when a load guest page fault occurs.

If false, 0 will be written into htval/mtval2 on a load guest page fault.

REPORT_GPA_IN_TVAL_ON_STORE_AMO_GUEST_PAGE_FAULT

H

Whether or not GPA >> 2 is written into htval/mtval2 when a store/amo guest page fault occurs.

If false, 0 will be written into htval/mtval2 on a store/amo guest page fault.

REPORT_VA_IN_MTVAL_ON_INSTRUCTION_PAGE_FAULT

S

When true, mtval is written with the virtual PC of an instructino when fetch causes an InstructionPageFault.

WHen false, mtval is written with 0 when an instruction fetch causes an InstructionPageFault.

REPORT_VA_IN_MTVAL_ON_LOAD_PAGE_FAULT

S

When true, mtval is written with the virtual address of a load when it causes a LoadPageFault.

WHen false, mtval is written with 0 when a load causes a LoadPageFault.

REPORT_VA_IN_MTVAL_ON_STORE_AMO_PAGE_FAULT

S

When true, mtval is written with the virtual address of a store when it causes a StoreAmoPageFault.

WHen false, mtval is written with 0 when a store causes a StoreAmoPageFault.

REPORT_VA_IN_STVAL_ON_BREAKPOINT

S

When true, stval is written with the virtual PC of the EBREAK instruction (same information as mepc).

When false, stval is written with 0 on an EBREAK instruction.

Regardless, stval is always written with a virtual PC when an external breakpoint is generated

REPORT_VA_IN_STVAL_ON_INSTRUCTION_ACCESS_FAULT

S

When true, stval is written with the virtual PC of an instructino when fetch causes an InstructionAccessFault.

WHen false, stval is written with 0 when an instruction fetch causes an InstructionAccessFault.

REPORT_VA_IN_STVAL_ON_INSTRUCTION_MISALIGNED

S

When true, stval is written with the virtual PC when an instruction fetch is misaligned.

When false, stval is written with 0 when an instruction fetch is misaligned.

Note that when IALIGN=16 (i.e., when the C or one of the Zc* extensions are implemented), it is impossible to generate a misaligned fetch, and so this parameter has no effect.

REPORT_VA_IN_STVAL_ON_INSTRUCTION_PAGE_FAULT

S

When true, stval is written with the virtual PC of an instructino when fetch causes an InstructionPageFault.

WHen false, stval is written with 0 when an instruction fetch causes an InstructionPageFault.

REPORT_VA_IN_STVAL_ON_LOAD_ACCESS_FAULT

S

When true, stval is written with the virtual address of a load when it causes a LoadAccessFault.

WHen false, stval is written with 0 when a load causes a LoadAccessFault.

REPORT_VA_IN_STVAL_ON_LOAD_MISALIGNED

S

When true, stval is written with the virtual address of a load instruction when the address is misaligned and MISALIGNED_LDST is false.

When false, stval is written with 0 when a load address is misaligned and MISALIGNED_LDST is false.

REPORT_VA_IN_STVAL_ON_LOAD_PAGE_FAULT

S

When true, stval is written with the virtual address of a load when it causes a LoadPageFault.

WHen false, stval is written with 0 when a load causes a LoadPageFault.

REPORT_VA_IN_STVAL_ON_STORE_AMO_ACCESS_FAULT

S

When true, stval is written with the virtual address of a store when it causes a StoreAmoAccessFault.

WHen false, stval is written with 0 when a store causes a StoreAmoAccessFault.

REPORT_VA_IN_STVAL_ON_STORE_AMO_MISALIGNED

S

When true, stval is written with the virtual address of a store instruction when the address is misaligned and MISALIGNED_LDST is false.

When false, stval is written with 0 when a store address is misaligned and MISALIGNED_LDST is false.

REPORT_VA_IN_STVAL_ON_STORE_AMO_PAGE_FAULT

S

When true, stval is written with the virtual address of a store when it causes a StoreAmoPageFault.

WHen false, stval is written with 0 when a store causes a StoreAmoPageFault.

REPORT_VA_IN_VSTVAL_ON_BREAKPOINT

H

When true, vstval is written with the virtual PC of the EBREAK instruction (same information as mepc).

When false, vstval is written with 0 on an EBREAK instruction.

Regardless, vstval is always written with a virtual PC when an external breakpoint is generated.

REPORT_VA_IN_VSTVAL_ON_INSTRUCTION_ACCESS_FAULT

H

When true, vstval is written with the virtual PC of an instructino when fetch causes an InstructionAccessFault.

WHen false, vstval is written with 0 when an instruction fetch causes an InstructionAccessFault.

REPORT_VA_IN_VSTVAL_ON_INSTRUCTION_MISALIGNED

H

When true, vstval is written with the virtual PC when an instruction fetch is misaligned.

When false, vstval is written with 0 when an instruction fetch is misaligned.

Note that when IALIGN=16 (i.e., when the C or one of the Zc* extensions are implemented), it is impossible to generate a misaligned fetch, and so this parameter has no effect.

REPORT_VA_IN_VSTVAL_ON_INSTRUCTION_PAGE_FAULT

H

When true, vstval is written with the virtual PC of an instructino when fetch causes an InstructionPageFault.

WHen false, vstval is written with 0 when an instruction fetch causes an InstructionPageFault.

REPORT_VA_IN_VSTVAL_ON_LOAD_ACCESS_FAULT

H

When true, vstval is written with the virtual address of a load when it causes a LoadAccessFault.

WHen false, vstval is written with 0 when a load causes a LoadAccessFault.

REPORT_VA_IN_VSTVAL_ON_LOAD_MISALIGNED

H

When true, vstval is written with the virtual address of a load instruction when the address is misaligned and MISALIGNED_LDST is false.

When false, vstval is written with 0 when a load address is misaligned and MISALIGNED_LDST is false.

REPORT_VA_IN_VSTVAL_ON_LOAD_PAGE_FAULT

H

When true, vstval is written with the virtual address of a load when it causes a LoadPageFault.

WHen false, vstval is written with 0 when a load causes a LoadPageFault.

REPORT_VA_IN_VSTVAL_ON_STORE_AMO_ACCESS_FAULT

H

When true, vstval is written with the virtual address of a store when it causes a StoreAmoAccessFault.

WHen false, vstval is written with 0 when a store causes a StoreAmoAccessFault.

REPORT_VA_IN_VSTVAL_ON_STORE_AMO_MISALIGNED

H

When true, vstval is written with the virtual address of a store instruction when the address is misaligned and MISALIGNED_LDST is false.

When false, vstval is written with 0 when a store address is misaligned and MISALIGNED_LDST is false.

REPORT_VA_IN_VSTVAL_ON_STORE_AMO_PAGE_FAULT

H

When true, vstval is written with the virtual address of a store when it causes a StoreAmoPageFault.

WHen false, vstval is written with 0 when a store causes a StoreAmoPageFault.

RESERVED_VSET_X0X0_VILL_SET

Zvl32b

When rs1 = x0 and rd = x0, vset instructions act as if the current vector length in vl is used as the AVL. If vill is set or the configuration is reserved, implementations may set vill to indicate unsupported use of these encodings.

RESERVED_VSET_X0X0_VLMAX_CHANGE

Zvl32b

When rs1=x0 and rd=x0, the instructions operate as if the current vector length in vl is used as the AVL. Use of the vset instructions with a new SEW/LMUL ratio that would result in a change of VLMAX is reserved. Implementations may set vill in either case.

RVV_VL_WHEN_AVL_LT_DOUBLE_VLMAX

Zvl32b

The value assigned to VL when AVL < 2*VLMAX.

SATP_MODE_BARE

S

Whether or not satp.MODE == Bare is supported.

SCONTEXT_IMPLEMENTED

Sdtrig, S

Specifies if the scontext CSR is implemented

SCTRDEPTH_DEPTH_LEGAL_VALUES

Smctr

The set of supported actual depths for the Control Transfer Records (CTR) buffer.

SDTRIG_BREAKPOINT_REENTRANCY

Sdtrig

How the hart prevents triggers with action=0 (breakpoint exception) from re-firing inside their own handler (Debug spec 1.0, Sdtrig "Native Triggers").

* No_reentrancy_support: no specific support for reentrancy. * Use_interrupt_enables: triggers with action=0 do not match or fire in M-mode while mstatus.MIE is 0 (and likewise S/VS-mode with sstatus.SIE / vsstatus.SIE when delegated). * Use_tcontrol: tcontrol.mte and tcontrol.mpte are implemented, and medeleg[3] is hard-wired to 0.

SDTRIG_ETRIGGER_SUPPORTED_EXCEPTIONS

Sdtrig

The set of exception codes (mcause Exception Code) that etrigger can be enabled for, i.e. the bits of etrigger.tdata2 that are writable as 1.

Debug spec 1.0, etrigger: "Hardware may support only a subset of exceptions."

SDTRIG_ETRIGGER_SUPPORTED_TRIGGERS

Sdtrig

Indicates which triggers support etrigger. Entry i is true if the trigger selected by tselect=i supports etrigger. Must have exactly SDTRIG_NUM_TRIGGERS entries.

SDTRIG_ICOUNT_COUNT_HARDWIRED_1

Sdtrig

If true then icount.count is hard-wired to 1 for all icount triggers: it does not become 0 when the trigger matches, and icount.m, icount.s, icount.u, icount.vs, and icount.vu are cleared when the trigger fires. If false, icount.count is writable and becomes 0 when the trigger matches with a count of 1.

SDTRIG_ICOUNT_SELF_WRITE_SETS_PENDING

Sdtrig

If true, a write to tdata1 that configures an icount trigger with count=1 also sets icount.pending when the writing instruction itself matches the trigger. If false, the writing instruction does not make the trigger pending.

SDTRIG_ICOUNT_SUPPORTED_TRIGGERS

Sdtrig

Indicates which triggers support icount. Entry i is true if the trigger selected by tselect=i supports icount. Must have exactly SDTRIG_NUM_TRIGGERS entries.

SDTRIG_ITRIGGER_SUPPORTED_INTERRUPTS

Sdtrig

The set of interrupt codes (mcause Exception Code) that itrigger can be enabled for, i.e. the bits of itrigger.tdata2 that are writable as 1.

Debug spec 1.0, itrigger: "Hardware may only support a subset of interrupts for this trigger."

SDTRIG_ITRIGGER_SUPPORTED_TRIGGERS

Sdtrig

Indicates which triggers support itrigger. Entry i is true if the trigger selected by tselect=i supports itrigger. Must have exactly SDTRIG_NUM_TRIGGERS entries.

SDTRIG_MAX_CHAIN_LENGTH

Sdtrig

The maximum number of triggers in a trigger chain. A value of 1 means chaining is not supported. Cannot exceed SDTRIG_NUM_TRIGGERS.

Debug spec 1.0, mcontrol6.chain: "Implementations that wish to limit the maximum length of a trigger chain (eg. to meet timing requirements) may do so by zeroing chain in writes to mcontrol6 that would make the chain too long."

SDTRIG_MCONTROL6_EXECUTE_WRITABLE

Sdtrig

If true, mcontrol6.EXECUTE can be set to 1, so mcontrol6 triggers can match on instruction execution. If false, mcontrol6.EXECUTE is read-only 0. Since mcontrol6.EXECUTE resets to 0, 0 is always supported.

SDTRIG_MCONTROL6_LOAD_WRITABLE

Sdtrig

If true, mcontrol6.LOAD can be set to 1, so mcontrol6 triggers can match on loads. If false, mcontrol6.LOAD is read-only 0. Since mcontrol6.LOAD resets to 0, 0 is always supported.

SDTRIG_MCONTROL6_MASKMAX6

Sdtrig

In implementations that support match mode 1 (NAPOT), not all NAPOT ranges may be supported. All NAPOT ranges between 2^1 and 2^SDTRIG_MCONTROL6_MASKMAX6 are supported.

SDTRIG_MCONTROL6_MATCH_LEGAL_VALUES

Sdtrig

The set of values that mcontrol6.MATCH supports.

SDTRIG_MCONTROL6_SELECT_WRITABLE

Sdtrig

If true, mcontrol6.SELECT can be set to 1, so mcontrol6 triggers can match on data (select=1) as well as address. If false, mcontrol6.SELECT is read-only 0. Since mcontrol6.SELECT resets to 0, 0 is always supported.

SDTRIG_MCONTROL6_SIZE_LEGAL_VALUES

Sdtrig

The set of values that mcontrol6.SIZE supports (0: any, 1: 8-bit, 2: 16-bit, 3: 32-bit, 4: 48-bit, 5: 64-bit, 6: 128-bit).

SDTRIG_MCONTROL6_STORE_WRITABLE

Sdtrig

If true, mcontrol6.STORE can be set to 1, so mcontrol6 triggers can match on stores. If false, mcontrol6.STORE is read-only 0. Since mcontrol6.STORE resets to 0, 0 is always supported.

SDTRIG_MCONTROL6_SUPPORTED_TRIGGERS

Sdtrig

Indicates which triggers support mcontrol6. Entry i is true if the trigger selected by tselect=i supports mcontrol6. Must have exactly SDTRIG_NUM_TRIGGERS entries.

SDTRIG_M_WRITABLE

Sdtrig

If true, the M bit in every trigger type that has one (mcontrol, mcontrol6, icount, itrigger, etrigger) can be set to 1, so triggers can match in M-mode. If false, the M bit is read-only 0. Since the M bit resets to 0, 0 is always supported.

SDTRIG_NUM_TRIGGERS

Sdtrig

The number of triggers implemented. Triggers are indexed by tselect from 0 to SDTRIG_NUM_TRIGGERS - 1.

SDTRIG_S_WRITABLE

Sdtrig, S

If true, the S bit in every trigger type that has one (mcontrol, mcontrol6, icount, itrigger, etrigger) can be set to 1, so triggers can match in S/HS-mode. If false, the S bit is read-only 0. Since the S bit resets to 0, 0 is always supported.

SDTRIG_TEXTRA_MHSELECT_MCONTEXT_MATCH

Sdtrig

If true, textra.mhselect values 4 (and, with H, 1 and 5) are supported, matching on mcontext. Unsupported mhselect values are legalized to 0 (ignore).

SDTRIG_TEXTRA_MHSELECT_VMID_MATCH

Sdtrig, H

If true, textra.mhselect values 2 and 6 are supported, matching on the VMID in hgatp. Unsupported mhselect values are legalized to 0 (ignore).

SDTRIG_TEXTRA_MHVALUE_LEN

Sdtrig

The number of implemented textra.mhvalue bits. Bits above these are read-only zero.

SDTRIG_TEXTRA_SSELECT_ASID_MATCH

Sdtrig, S

If true, textra.sselect value 2 is supported, matching on the ASID in satp or vsatp. Unsupported sselect values are legalized to 0 (ignore).

SDTRIG_TEXTRA_SSELECT_SCONTEXT_MATCH

Sdtrig, S

If true, textra.sselect value 1 is supported, matching on scontext. Unsupported sselect values are legalized to 0 (ignore).

SDTRIG_TEXTRA_SVALUE_LEN

Sdtrig

The number of implemented textra.svalue bits. Bits above these are read-only zero.

SDTRIG_U_WRITABLE

Sdtrig, U

If true, the U bit in every trigger type that has one (mcontrol, mcontrol6, icount, itrigger, etrigger) can be set to 1, so triggers can match in U-mode. If false, the U bit is read-only 0. Since the U bit resets to 0, 0 is always supported.

SDTRIG_VS_WRITABLE

Sdtrig, H

If true, the VS bit in every trigger type that has one (mcontrol, mcontrol6, icount, itrigger, etrigger) can be set to 1, so triggers can match in VS-mode. If false, the VS bit is read-only 0. Since the VS bit resets to 0, 0 is always supported.

SDTRIG_VU_WRITABLE

Sdtrig, H

If true, the VU bit in every trigger type that has one (mcontrol, mcontrol6, icount, itrigger, etrigger) can be set to 1, so triggers can match in VU-mode. If false, the VU bit is read-only 0. Since the VU bit resets to 0, 0 is always supported.

SEI_INTR_IMPL

Zicsr, S

Whether or not supervisor-level external interrupts are implemented.

Possible values:

true:: Supervisor-level external interrupts are implemented. mie.SEIE is writable, and mideleg.SEI is writable if MIDELEG_DELEGATABLE[9] is true.

false:: Supervisor-level external interrupts are not implemented. mie.SEIE, mip.SEIP, and mideleg.SEI are read-only zero.

SEW_MIN

Zvl32b

Implementations must provide fractional LMUL settings that allow the narrowest supported element width (SEW) to occupy a fractional portion of a vector register relative to the widest supported SEW. In general, implementations must support LMUL >= SEW_MIN/ELEN, where SEW_MIN is the narrowest supported SEW and ELEN is the widest SEW.

SSEED_READ_ONLY_ZERO

Sm, Zkr, S

Indicates whether the mseccfg.SSEED field is hardwired read-only zero.

Options:

true:: mseccfg.SSEED is read-only zero.

false:: mseccfg.SSEED is writable.

SSI_INTR_IMPL

Zicsr, S

Whether or not supervisor-level software interrupts are implemented.

Possible values:

true:: Supervisor-level software interrupts are implemented. mie.SSIE is writable, and mideleg.SSI is writable if MIDELEG_DELEGATABLE[1] is true.

false:: Supervisor-level software interrupts are not implemented. mie.SSIE, mip.SSIP, and mideleg.SSI are read-only zero.

SSTATEEN_JVT_TYPE

Zcmt, Ssstateen

Behavior of the sstateen0.JVT bit:

* 'rw': read-write * 'read-only-0': read-only, fixed to 0 * 'read-only-1': read-only, fixed to 1

STI_INTR_IMPL

Zicsr, S

Whether or not supervisor-level timer interrupts are implemented. If Sstc is implemented, then STI_INTR_IMPL must be true.

Possible values:

true:: Supervisor-level timer interrupts are implemented. mie.STIE is writable, and mideleg.STI is writable if MIDELEG_DELEGATABLE[5] is true.

false:: Supervisor-level timer interrupts are not implemented. mie.STIE, mip.STIP, and mideleg.STI are read-only zero.

STVAL_WIDTH

S

The number of implemented bits in stval.

Must be greater than or equal to max(PHYS_ADDR_WIDTH, VA_SIZE)

SUPPORTED_PMLEN_SMMPM

Smmpm

The PMLEN values supported by the Smmpm pointer masking facility for M-mode, selected via the PMM field in mseccfg. PMLEN is the number of high-order bits of an address that are masked.

Options:

0:: PMLEN=0 (pointer masking is disabled) 7:: PMLEN=XLEN-57 (i.e., PMLEN=7 on RV64) 16:: PMLEN=XLEN-48 (i.e., PMLEN=16 on RV64)

The current standard only supports these values (zpm.adoc, tag norm:pmlen_supported_values). PMM=00 (pointer masking disabled, PMLEN=0) is mandatory and always available, so it is mandatory here.

SUPPORTED_PMLEN_SMNPM

Smnpm

The PMLEN values supported by the Smnpm pointer masking facility for the next privilege mode below M-mode (S/HS if S-mode is implemented, or U-mode otherwise), selected via the PMM field in menvcfg. PMLEN is the number of high-order bits of an address that are masked.

Options:

0:: PMLEN=0 (pointer masking is disabled) 7:: PMLEN=XLEN-57 (i.e., PMLEN=7 on RV64) 16:: PMLEN=XLEN-48 (i.e., PMLEN=16 on RV64)

The current standard only supports these values (zpm.adoc, tag norm:pmlen_supported_values). PMM=00 (pointer masking disabled, PMLEN=0) is mandatory and always available, so it is mandatory here.

SUPPORTED_PMLEN_SSNPM

Ssnpm

The PMLEN values supported by the Ssnpm pointer masking facility for the next privilege mode below S-mode (U-mode, and VS-/VU-modes if the H extension is present), selected via the PMM field in senvcfg. PMLEN is the number of high-order bits of an address that are masked.

Options:

0:: PMLEN=0 (pointer masking is disabled) 7:: PMLEN=XLEN-57 (i.e., PMLEN=7 on RV64) 16:: PMLEN=XLEN-48 (i.e., PMLEN=16 on RV64)

The current standard only supports these values (zpm.adoc, tag norm:pmlen_supported_values). PMM=00 (pointer masking disabled, PMLEN=0) is mandatory and always available, so it is mandatory here.

SUPPORT_FRACTIONAL_LMUL_BEYOND_REQUIRED

Zvl32b

For a given supported fractional LMUL setting, implementations must provide support for SEW settings covering the range from SEW_MIN up to LMUL * ELEN, inclusive. This ensures types narrower than the maximum SEW are supported when fractional LMULs are selected.

SV32X4_TRANSLATION

H

Whether or not Sv32x4 translation mode is supported.

SV32_VSMODE_TRANSLATION

H

Whether or not Sv32 translation is supported in first-stage (VS-stage) translation.

SV39X4_TRANSLATION

H

Whether or not Sv39x4 translation mode is supported.

SV39_VSMODE_TRANSLATION

H

Whether or not Sv39 translation is supported in first-stage (VS-stage) translation.

SV48X4_TRANSLATION

H

Whether or not Sv48x4 translation mode is supported.

SV48_VSMODE_TRANSLATION

H

Whether or not Sv48 translation is supported in first-stage (VS-stage) translation.

SV57X4_TRANSLATION

H

Whether or not Sv57x4 translation mode is supported.

SV57_VSMODE_TRANSLATION

H

Whether or not Sv57 translation is supported in first-stage (VS-stage) translation.

SXLEN

S

Set of XLENs supported in S-mode. Can be one of:

* [32]: SXLEN is always 32 * [64]: SXLEN is always 64 * [32, 64]: SXLEN can be changed (via mstatus.SXL) between 32 and 64

S_MODE_ENDIANNESS

S

Endianness of data in S-mode. Can be one of:

* little: S-mode data is always little endian * big: S-mode data is always big endian * dynamic: S-mode data can be either little or big endian, depending on the CSR field mstatus.SBE

TCONTROL_IMPLEMENTED

Sdtrig

Specifies if the tcontrol CSR is implemented

TDATA2_IMPLEMENTED

Sdtrig

Specifies if the tdata2 CSR is implemented.

Debug spec 1.0, tdata2: "This register is optional if no implemented triggers use it."

TDATA3_IMPLEMENTED

Sdtrig

Specifies if the tdata3 CSR is implemented.

Debug spec 1.0, tdata3: "This register is optional if no implemented triggers use it."

Must be true if any trigger supports type 2-6 (mcontrol, icount, itrigger, etrigger, mcontrol6).

TINST_VALUE_ON_BREAKPOINT

H

Value written into htinst/mtinst on a Breakpoint exception from VU/VS-mode.

Possible values: * "always zero": Always write the value zero * "custom": Write a custom value, which results in UNPREDICTABLE

TINST_VALUE_ON_FINAL_INSTRUCTION_GUEST_PAGE_FAULT

H

Value written into htinst/mtinst when there is an instruction guest-page fault on a final translation.

Possible values: * "always zero": Always write the value zero * "always pseudoinstruction": Always write the pseudoinstruction

TINST_VALUE_ON_FINAL_LOAD_GUEST_PAGE_FAULT

H

Value written into htinst/mtinst when there is a load guest-page fault on a final translation.

Possible values: * "always zero": Always write the value zero * "always pseudoinstruction": Always write the pseudoinstruction * "always transformed standard instruction": Always write the transformation of the standard instruction encoding * "custom": A custom value, which will cause an UNPREDICTABLE event.

TINST_VALUE_ON_FINAL_STORE_AMO_GUEST_PAGE_FAULT

H

Value written into htinst/mtinst when there is a store/AMO guest-page fault on a final translation.

Possible values: * "always zero": Always write the value zero * "always pseudoinstruction": Always write the pseudoinstruction * "always transformed standard instruction": Always write the transformation of the standard instruction encoding * "custom": A custom value, which will cause an UNPREDICTABLE event.

TINST_VALUE_ON_INSTRUCTION_ADDRESS_MISALIGNED

H

Value written into htinst/mtinst when there is an instruction address misaligned exception.

Possible values: * "always zero": Always write the value zero * "custom": Write a custom value, which results in UNPREDICTABLE

TINST_VALUE_ON_LOAD_ACCESS_FAULT

H

Value written into htinst/mtinst on an AccessFault exception from VU/VS-mode.

Possible values: * "always zero": Always write the value zero * "always transformed standard instruction": Always write a transformed standard instruction as defined by H * "custom": Write a custom value, which results in UNPREDICTABLE

TINST_VALUE_ON_LOAD_ADDRESS_MISALIGNED

H

Value written into htinst/mtinst on a LoadAddressMisaligned exception from VU/VS-mode.

Possible values: * "always zero": Always write the value zero * "always transformed standard instruction": Always write a transformed standard instruction as defined by H * "custom": Write a custom value, which results in UNPREDICTABLE

TINST_VALUE_ON_LOAD_PAGE_FAULT

H

Value written into htinst/mtinst on a LoadPageFault exception from VU/VS-mode.

Possible values: * "always zero": Always write the value zero * "always transformed standard instruction": Always write a transformed standard instruction as defined by H * "custom": Write a custom value, which results in UNPREDICTABLE

TINST_VALUE_ON_MCALL

H

Value written into htinst/mtinst on a MCall exception from VU/VS-mode.

Possible values: * "always zero": Always write the value zero * "custom": Write a custom value, which results in UNPREDICTABLE

TINST_VALUE_ON_SCALL

H

Value written into htinst/mtinst on a SCall exception from VU/VS-mode.

Possible values: * "always zero": Always write the value zero * "custom": Write a custom value, which results in UNPREDICTABLE

TINST_VALUE_ON_STORE_AMO_ACCESS_FAULT

H

Value written into htinst/mtinst on an AccessFault exception from VU/VS-mode.

Possible values: * "always zero": Always write the value zero * "always transformed standard instruction": Always write a transformed standard instruction as defined by H * "custom": Write a custom value, which results in UNPREDICTABLE

TINST_VALUE_ON_STORE_AMO_ADDRESS_MISALIGNED

H

Value written into htinst/mtinst on a StoreAmoAddressMisaligned exception from VU/VS-mode.

Possible values: * "always zero": Always write the value zero * "always transformed standard instruction": Always write a transformed standard instruction as defined by H * "custom": Write a custom value, which results in UNPREDICTABLE

TINST_VALUE_ON_STORE_AMO_PAGE_FAULT

H

Value written into htinst/mtinst on a StoreAmoPageFault exception from VU/VS-mode.

Possible values: * "always zero": Always write the value zero * "always transformed standard instruction": Always write a transformed standard instruction as defined by H * "custom": Write a custom value, which results in UNPREDICTABLE

TINST_VALUE_ON_UCALL

H

Value written into htinst/mtinst on a UCall exception from VU/VS-mode.

Possible values: * "always zero": Always write the value zero * "custom": Write a custom value, which results in UNPREDICTABLE

TINST_VALUE_ON_VIRTUAL_INSTRUCTION

H

Value written into htinst/mtinst on a VirtualInstruction exception from VU/VS-mode.

Possible values: * "always zero": Always write the value zero * "custom": Write a custom value, which results in UNPREDICTABLE

TINST_VALUE_ON_VSCALL

H

Value written into htinst/mtinst on a VSCall exception from VU/VS-mode.

Possible values: * "always zero": Always write the value zero * "custom": Write a custom value, which results in UNPREDICTABLE

TRAP_ON_ECALL_FROM_S

S

Whether or not an ECALL-from-S-mode causes a synchronous exception.

The spec states that implementations may handle ECALLs transparently without raising a trap, in which case the EEI must provide a builtin.

TRAP_ON_ECALL_FROM_U

U

Whether or not an ECALL-from-U-mode causes a synchronous exception.

The spec states that implementations may handle ECALLs transparently without raising a trap, in which case the EEI must provide a builtin.

TRAP_ON_ECALL_FROM_VS

H

Whether or not an ECALL-from-VS-mode causes a synchronous exception.

The spec states that implementations may handle ECALLs transparently without raising a trap, in which case the EEI must provide a builtin.

TRAP_ON_ILLEGAL_WLRL

Sm

Options:

* true: Writing an illegal value to a WLRL CSR field will cause an IllegalInstruction exception. * false: Writing an illegal value to a WLRL CSR field causes unpredictable behavior.

TRAP_ON_RESERVED_INSTRUCTION

Sm

Options:

* true: Fetching an unimplemented and/or undefined instruction from the standard/reserved opcode space will cause an IllegalInstruction exception. * false: Fetching an unimplemented and/or undefined instruction from the standard/reserved opcose space causes unpredictable behavior.

TRAP_ON_RESERVED_INSTRUCTION may be false while TRAP_ON_UNIMPLEMENTED_INSTRUCTION is true when a custom instruction is implemented in the standard/reserved opcode space.

TRAP_ON_SFENCE_VMA_WHEN_SATP_MODE_IS_READ_ONLY

S, Sv32, Sv39, Sv48, Sv57

For implementations that make satp.MODE read-only zero (always Bare, i.e., no virtual translation is implemented), attempts to execute an SFENCE.VMA instruction might raise an illegal-instruction exception.

TRAP_ON_SFENCE_VMA_WHEN_SATP_MODE_IS_READ_ONLY indicates whether or not that exception occurs.

TRAP_ON_SFENCE_VMA_WHEN_SATP_MODE_IS_READ_ONLY has no effect when some virtual translation mode is supported.

TRAP_ON_UNIMPLEMENTED_CSR

Sm

Options:

* true: Accessing an unimplemented CSR (via a Zicsr instruction) will cause an IllegalInstruction exception. * false: Accessing an unimplemented CSR (via a Zicsr instruction) will cause unpredictable behavior.

TRAP_ON_UNIMPLEMENTED_INSTRUCTION

Sm

Options:

* true: Fetching an unimplemented instruction will cause an IllegalInstruction exception. * false: Fetching an unimplemented instruction causes unpredictable behavior.

An unimplemented instruction is any instruction encoding that is not defined by the implementation. Custom instructions are considered implemented.

USEED_READ_ONLY_ZERO

Sm, Zkr, U

Indicates whether the mseccfg.USEED field is hardwired read-only zero.

Options:

true:: mseccfg.USEED is read-only zero.

false:: mseccfg.USEED is writable.

UXLEN

U

Set of XLENs supported in U-mode. When both 32 and 64 are supported, UXLEN can be changed, via mstatus.UXL, between 32 and 64.

U_MODE_ENDIANNESS

U

Endianness of data in U-mode. Can be one of:

* little: U-mode data is always little endian * big: U-mode data is always big endian * dynamic: U-mode data can be either little or big endian, depending on the CSR field mstatus.UBE

VECTOR_FF_NO_EXCEPTION_TRIM

Zvl32b

Implementations may process fewer than vl elements and reduce vl even when no exception occurs. However, if vstart == 0 and vl > 0, at least one element must be processed.

VECTOR_FF_SEG_EXCEPTION_PARTIAL_LOAD

Zvl32b

For fault-only-first segment loads, if an exception occurs partway through the zeroth segment, the trap is taken. If it occurs in a subsequent segment, vl may be reduced to the index of that segment. It is implementation-defined whether a partial subset of the segment is loaded before the trap.

VECTOR_FF_UPDATE_PAST_TRIM

Zvl32b

Fault-only-first (FF) load instructions may update active destination elements beyond the index that causes vector-length trimming, but not past the original vl. These spurious updates need not reflect the true memory contents; non-idempotent memory should only be accessed when the load is guaranteed not to be retried.

VECTOR_LOAD_PAST_TRAP

Zvl32b

Vector load instructions may overwrite active destination vector register group elements past the element index where a trap is reported; the behavior for elements beyond the trap index is implementation-defined.

VECTOR_LOAD_SEG_FF_OVERWRITE_ELEMENTS_AFTER_FAULT

Zvl32b

Fault-only-first segment load instructions may overwrite destination vector register group elements beyond the point where a trap is reported or where vl is trimmed; the exact values written may be implementation-defined.

VECTOR_LS_INDEX_MAX_EEW

Zvl32b

A profile may place an upper limit on the maximum supported index EEW used by vector load/store indexing. For example, some profiles may limit indexing to sizes no larger than XLEN or a fixed EEW value.

VECTOR_LS_MISALIGNED_LEGAL

Zvl32b

If an element accessed by a vector memory instruction is not naturally aligned to the size of the element, either the element is transferred successfully or an address misaligned exception is raised on that element. Support for misaligned vector memory accesses is independent of an implementation’s support for misaligned scalar memory accesses.

VECTOR_LS_SEG_PARTIAL_ACCESS

Zvl32b

If a trap occurs during access to a segment, it is implementation-defined whether some, all, or none of that segment’s element accesses are performed before the trap is taken.

VECTOR_LS_WHOLEREG_MISALIGNED_LEGAL

Zvl32b

Implementations may raise a misaligned address exception for whole-register loads/stores if the base address is not aligned to the maximum of the encoded EEW size (in bytes) or the implementation’s smallest supported SEW (in bytes).

VFREDUSUM_FINAL_NODE_ELEMENT_BEHAVIOR

Zvl32b

Implementations are permitted to insert an additional additive identity into the final reduction result, which may affect the final outcome when no active elements are present.

VFREDUSUM_INACTIVE_NODE_ELEMENT_BEHAVIOR

Zvl32b

A reduction node that receives an input derived solely from masked-off elements or elements beyond vl may either treat that input as the additive identity for the appropriate element width or copy the other input through unchanged to the node output.

VFREDUSUM_NAN

Zvl32b

The reduction tree structure must be deterministic for a given vtype and vl; as a consequence, implementations need not preserve NaN payloads when no elements are active. If no elements are active and the scalar input is NaN, implementations may canonicalize it (and raise an exception if it is a signaling NaN) or pass it through unchanged.

VFREDUSUM_NODE_ROUNDING_BEHAVIOR

Zvl32b

Each reduction operator computes an exact sum using an ideal scalar floating-point addition, then converts that result into a floating- point format with range and precision at least as large as the element SEW, rounding with the current dynamic rounding mode and raising exceptions as needed. Implementations may choose the exact range and precision per operator.

VILL_SET_ON_RESERVED_VTYPE

Zvl32b

Use of vtype encodings with LMUL < SEW_MIN/ELEN is reserved. Implementations may set the vill status bit to indicate such vtype encodings are unsupported, providing a software-visible indication of invalid vtype selections.

VLEN

Zvl32b

The number of bits in a single vector register.

VMID_WIDTH

H

Number of bits supported in hgatp.VMID (i.e., the supported width of a virtual machine ID).

VSSTAGE_MODE_BARE

H

Whether or not writing mode=Bare is supported in the vsatp register.

VSSTATUS_VS_EXISTS

Zvl32b

Some implementations provide a vsstatus.VS field even when the misa.V bit is clear. This parameter indicates whether vsstatus.VS exists independently of the misa.V setting.

VSTVEC_MODES

H

Options:

0:: Direct; All traps set pc to vstvec.BASE 1:: Vectored; Asynchronous interrupts set pc to vstvec.BASE + 4 x cause.

If only one mode is given, vstvec.MODE is assumed to be read-only with that value. Otherwise, vstvec.MODE is read-write.

VSXLEN

H

Set of XLENs supported in VS-mode. Can be one of:

* [32]: VSXLEN is always 32 * [64]: VSXLEN is always 64 * [32, 64]: VSXLEN can be changed (via hstatus.VSXL) between 32 and 64

VS_MODE_ENDIANNESS

H

Endianness of data in VS-mode. Can be one of:

* little: VS-mode data is always little endian * big: VS-mode data is always big endian * dynamic: VS-mode data can be either little or big endian, depending on the CSR field hstatus.VSBE

VUXLEN

H

Set of XLENs supported in VU-mode. When both 32 and 64 are supported, VUXLEN can be changed via vsstatus.UXL.

VU_MODE_ENDIANNESS

H

Endianness of data in VU-mode. Can be one of:

* little: VU-mode data is always little endian * big: VU-mode data is always big endian * dynamic: VU-mode data can be either little or big endian, depending on the CSR field vsstatus.UBE

WFI_FINITE

Sm

Options:

* true: WFI resumes execution after waiting for a finite amount of time * false: WFI may continue waiting until another event causes execution to resume

WFI_U_MODE

Sm

Options:

* true: WFI can be executed in U mode * false: Executing WFI in U mode raises an illegal instruction exception

ZAWRS_NTO_IS_NOP

Zawrs

When true, WRS.NTO completes immediately, behaving as a no-op, rather than stalling the hart.

Appendix E: Examples

This appendix gives examples of coverpoints and tests consistent with the test plan. These examples are not the only way to satisfy the testplan.

E.1. Unprivileged example: add

Coverage is in I_coverage.svh:

Listing 2. add Covergroup
covergroup I_add_cg with function sample(ins_t ins);
    option.per_instance = 0;
    cp_asm_count : coverpoint ins.ins_str == "add"  iff (ins.trap == 0 )  {
        //Number of times instruction is executed
        bins count[]  = {1};
    }
    cp_rs1 : coverpoint ins.get_gpr_reg(ins.current.rs1)  iff (ins.trap == 0 )  {
        //RS1 register assignment
    }
    cp_rs2 : coverpoint ins.get_gpr_reg(ins.current.rs2)  iff (ins.trap == 0 )  {
        //RS2 register assignment
    }
    cp_rd : coverpoint ins.get_gpr_reg(ins.current.rd)  iff (ins.trap == 0 )  {
        //RD register assignment
    }
    cp_rs1_edges : coverpoint unsigned'(ins.current.rs1_val)  iff (ins.trap == 0 )  {
        `ifdef UDB_MXLEN_32
            bins zero     = {0};
            bins one      = {32'b00000000000000000000000000000001};
            bins two      = {32'b00000000000000000000000000000010};
            bins min      = {32'b10000000000000000000000000000000};
            bins minp1    = {32'b10000000000000000000000000000001};
            bins max      = {32'b01111111111111111111111111111111};
            bins maxm1    = {32'b01111111111111111111111111111110};
            bins ones     = {32'b11111111111111111111111111111111};
            bins onesm1   = {32'b11111111111111111111111111111110};
            bins walkodd  = {32'b10101010101010101010101010101010};
            bins walkeven = {32'b01010101010101010101010101010101};
            wildcard bins random = {32'b01???????????????????????????010};
        `else
            bins zero     = {0};
            bins one      = {64'b0000000000000000000000000000000000000000000000000000000000000001};
            bins two      = {64'b0000000000000000000000000000000000000000000000000000000000000010};
            bins min      = {64'b1000000000000000000000000000000000000000000000000000000000000000};
            bins minp1    = {64'b1000000000000000000000000000000000000000000000000000000000000001};
            bins Wmax     = {64'b0000000000000000000000000000000011111111111111111111111111111111};
            bins Wmaxm1   = {64'b0000000000000000000000000000000011111111111111111111111111111110};
            bins Wmaxp1   = {64'b0000000000000000000000000000000100000000000000000000000000000000};
            bins Wmaxp2   = {64'b0000000000000000000000000000000100000000000000000000000000000001};
            bins W80      = {64'b0000000000000000000000000000000010000000000000000000000000000000};
            bins W7F      = {64'b0000000000000000000000000000000001111111111111111111111111111111};
            bins max      = {64'b0111111111111111111111111111111111111111111111111111111111111111};
            bins maxm1    = {64'b0111111111111111111111111111111111111111111111111111111111111110};
            bins ones     = {64'b1111111111111111111111111111111111111111111111111111111111111111};
            bins onesm1   = {64'b1111111111111111111111111111111111111111111111111111111111111110};
            bins walkodd  = {64'b1010101010101010101010101010101010101010101010101010101010101010};
            bins walkeven = {64'b0101010101010101010101010101010101010101010101010101010101010101};
            wildcard bins random = {64'b01???????????????????????????????????????????????????????????010};
        `endif
    }
    cp_rs2_edges : coverpoint unsigned'(ins.current.rs2_val)  iff (ins.trap == 0 )  {
        `ifdef UDB_MXLEN_32
            bins zero  =    {0};
 ...
        `else
            bins zero  = {0};
            ...
        `endif
    }
    cr_rs1_rs2_edges : cross cp_rs1_edges,cp_rs2_edges  iff (ins.trap == 0 )  {
        //Cross coverage of RS1 edges and RS2 edges
    }
    cmp_rs1_rs2 : coverpoint ins.get_gpr_reg(ins.current.rs1)  iff (ins.current.rs1 == ins.current.rs2 & ins.trap == 0 )  {
        //Compare assignments of all registers
    }
    cmp_rd_rs1 : coverpoint ins.get_gpr_reg(ins.current.rd)  iff (ins.current.rd == ins.current.rs1 & ins.trap == 0 )  {
        //Compare assignments of all registers
    }
    cmp_rd_rs2 : coverpoint ins.get_gpr_reg(ins.current.rd)  iff (ins.current.rd == ins.current.rs2 & ins.trap == 0 )  {
        //Compare assignments of all registers
    }
    cmp_rd_rs1_rs2 : coverpoint ins.get_gpr_reg(ins.current.rd)  iff (ins.current.rd == ins.current.rs1 & ins.current.rd == ins.current.rs2 & ins.trap == 0 )  {
        //Compare assignments of all registers
    }
    cp_gpr_hazard_rw : coverpoint check_gpr_hazards(ins.hart, ins.issue)  iff (ins.trap == 0 )  {
        //GPR Hazard
        bins hazards[]  = {NO_HAZARD, RAW_HAZARD, WAW_HAZARD, WAR_HAZARD};
    }
endgroup

Corresponding RV32 tests are in tests/rv32/I/I-add.S. Observe how the directed tests align with the coverpoints and bins. Register numbers and values are randomized unless they are swept by the coverpoint. The RVTEST_SIGUPD macro compares the result against an expected signature produced by a reference model. When register 0 is used, it is loaded with a random value, but hardwired to 0, so the reference model will show that it behaves as 0.

Listing 3. add Tests
# Testcase cp_rs1 (Test source rs1 = x0)
li x0, 0xb4e96718 # initialize rs1
li x24, 0xeaa512b3 # initialize rs2
add x25, x0, x24 # perform operation
RVTEST_SIGUPD(x3, x25)

# Testcase cp_rs1 (Test source rs1 = x1)
li x1, 0x81c4ef2a # initialize rs1
li x6, 0x917cfa69 # initialize rs2
add x7, x1, x6 # perform operation
RVTEST_SIGUPD(x3, x7)

...

# Testcase cp_rs1 (Test source rs1 = x31)
mv x21, x31 # switch signature pointer register to avoid conflict with test
li x31, 0x1508dd4e # initialize rs1
li x14, 0x830d07b0 # initialize rs2
add x11, x31, x14 # perform operation
RVTEST_SIGUPD(x21, x11)


# Testcase cp_rd (Test destination rd = x0)
li x19, 0x1d01c852 # initialize rs1
li x9, 0x1bfbf146 # initialize rs2
add x0, x19, x9 # perform operation
RVTEST_SIGUPD(x20, x0)

# Testcase cp_rd (Test destination rd = x1)
li x26, 0x1e3aafcf # initialize rs1
li x19, 0x986da37b # initialize rs2
add x1, x26, x19 # perform operation
RVTEST_SIGUPD(x20, x1)

...

# Testcase cr_rs1_rs2_edges (Test source rs1 = 0x0 rs2 = 0x0)
li x15, 0x00000000 # initialize rs1
li x5, 0x00000000 # initialize rs2
add x11, x15, x5 # perform operation
RVTEST_SIGUPD(x10, x11)

# Testcase cr_rs1_rs2_edges (Test source rs1 = 0x0 rs2 = 0x1)
li x1, 0x00000000 # initialize rs1
li x31, 0x00000001 # initialize rs2
add x20, x1, x31 # perform operation
RVTEST_SIGUPD(x10, x20)

# Testcase cr_rs1_rs2_edges (Test source rs1 = 0x0 rs2 = 0x2)
li x27, 0x00000000 # initialize rs1
li x3, 0x00000002 # initialize rs2
add x11, x27, x3 # perform operation
RVTEST_SIGUPD(x10, x11)

# Testcase cr_rs1_rs2_edges (Test source rs1 = 0x0 rs2 = 0x80000000)
li x8, 0x00000000 # initialize rs1
li x5, 0x80000000 # initialize rs2
add x16, x8, x5 # perform operation
RVTEST_SIGUPD(x10, x16)

E.2. Test case example: cr_rs1_rs2_edges bin with rs1 = 0x0, rs2 = 0x80000000

# Testcase cr_rs1_rs2_edges (Test source rs1 = 0x0 rs2 = 0x80000000)
li x8, 0x00000000 # initialize rs1 in randomly selected register
li x5, 0x80000000 # initialize rs2 in randomly selected register
add x16, x8, x5 # perform operation, write randomly selected destination register
# load expected value of 0x800000000 into x20 from table pointed to by x10. Check x20 against x16 and report mismatch
RVTEST_SIGUPD(x10, x16, x20)

RVTEST_SIGUPD macro:

if (RVTEST_SELFCHECK) # check result against signature
    LREG x20, 0(x10)
    beq x16, x20, 1f
    ecall
    1f:
else # generate signature
    SREG x16, 0(x10)
    addi x10, x10, WORDSIZE
    nop

1. Extended RVVI adds signals for virtual memory verification, including physical and virtual instruction and data addresses, and I/D TLB entries.
2. Portions of riscvISACOV that depend on proprietary Synopsys code such as a disassembler have been replaced with open-source equivalents
3. cp_asm_count is an exception, just counting the number of times the instruction was executed
4. Certain instructions are omitted if not supported for a given SEW. For example, widening add vwadd.vv is not supported for SEW=64, and vrgatherei16.v is not supported for SEW=8.