Riscv Plic
Riscv Plic
Specification
Version 1.0, 09/2021
Table of Contents
Change Log . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
3. Memory Map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
4. Register Width . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
5. Interrupt Priorities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
7. Interrupt Enables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
8. Priority Thresholds. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Contributors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Change Log | Page 1
Change Log
Date Version Description
It is licensed under the Creative Commons Attribution 4.0 International License (CC-BY 4.0). The full license
text is available at creativecommons.org/licenses/by/4.0/.
Chapter 1. Introduction
This document contains the RISC-V platform-level interrupt controller (PLIC) specification (was removed from
RISC-V Privileged Spec v1.11-draft) , which defines an interrupt controller specifically designed to work in the
context of RISC-V systems. The PLIC multiplexes various device interrupts onto the external interrupt lines of
Hart contexts, with hardware support for interrupt priorities.
This specification defines the general PLIC architecture and the operation parameters. PLIC supports up-to 1023
interrupts (0 is reserved) and 15872 contexts, but the actual number of interrupts and context depends on the
PLIC implementation. However, the implement must adhere to the offset of each register within the PLIC
operation parameters. The PLIC which claimed as PLIC-Compliant standard PLIC should follow the
implementations mentioned in sections below.
Sections below describe the control register blocks of PLIC operation parameters.
The base address of Interrupt Source Priority block within PLIC Memory Map region is fixed at 0x000000.
A pending bit in the PLIC core can be cleared by setting the associated enable bit then performing a claim.
The base address of Interrupt Pending Bits block within PLIC Memory Map region is fixed at 0x001000.
Interrupt Interrupt Pending Bit 1024 / 8 = This is a continuously memory block contains
Pending Bits of Interrupt Source 128(0x80) bytes PLIC Interrupt Pending Bits. Each Interrupt
#0 to #N Pending Bit occupies 1-bit from this register
block.
The context is referred to the specific privilege mode in the specific Hart of specific RISC-V processor instance.
For example, in an 4-core system with 2-way SMT, you have 8 harts and probably at least two privilege modes
per hart: machine mode and supervisor mode. (ref: github.com/torvalds/linux/blob/
5bfc75d92efd494db37f5c4c173d3639d4772966/Documentation/devicetree/bindings/interrupt-controller/
sifive%2Cplic-1.0.0.yaml)
How PLIC organizes interrupts for the contexts (Hart and privilege mode) is out of RISC-V PLIC specification
scope, however it must be spec-out in vendor’s PLIC specification.
The base address of Interrupt Enable Bits block within PLIC Memory Map region is fixed at 0x002000.
Interrupt Interrupt Enable Bit (1024 / 8) * 15872 This is a continuously memory block contains
Enable Bits of Interrupt Source = PLIC Interrupt Enable Bits of 15872 contexts.
#0 to #1023 for 2031616(0x1f0000) Each Interrupt Enable Bit occupies 1-bit from
15872 contexts bytes this register block and total 15872 Interrupt
Enable Bit blocks
The base address of Priority Thresholds register block is located at 4K alignement starts from offset 0x200000.
Priority Priority Threshold 4096 * 15872 = This is the register of Priority Thresholds setting
Threshold for 15872 contexts 65011712(0x3e00000 for each conetxt
) bytes
Interrupt Claim Interrupt Claim 4096 * 15872 = This is the register used to acquire interrupt ID
Register Process for 15872 65011712(0x3e00000 for each conetxt
contexts ) bytes
Interrupt Interrupt Completion 4096 * 15872 = This is register to write to complete Interrupt
Completion for 15872 contexts 65011712(0x3e00000 process
Register ) bytes
Contributors
Abner Chang <[email protected]>
Robert Balas <[email protected]>
Campbell He
Chunchi Che
Drew Barbier <[email protected]>
Jeff Scheel <[email protected]>
Jessica Clarke
Palmer Dabbelt <[email protected]>
Rongcui Dong
Yan <[email protected]>