Skip to content

Commit 54a0364

Browse files
committed
register: add vexriscv-specific registers
VexRiscv contains its own custom registers for external interrupt mapping. Add these registers under the `register::vexriscv` namespace, and prefix the assembly routines with "v-" in order to avoid ambiguity with e.g. `sip` and `mip` registers. Signed-off-by: Sean Cross <[email protected]>
1 parent 459421d commit 54a0364

File tree

8 files changed

+48
-0
lines changed

8 files changed

+48
-0
lines changed

asm.S

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,3 +273,10 @@ RW(0x7A3, tdata3) // Third Debug/Trace trigger data register
273273
RW(0x7B0, dcsr) // Debug control and status register
274274
RW(0x7B1, dpc) // Debug PC
275275
RW(0x7B2, dscratch) // Debug scratch register
276+
277+
// VexRiscv custom registers
278+
RW(0xBC0, vmim) // Machine IRQ Mask
279+
RO(0xFC0, vmip) // Machine IRQ Pending
280+
RW(0x9C0, vsim) // Supervisor IRQ Mask
281+
RO(0xDC0, vsip) // Supervisor IRQ Pending
282+
RO(0xCC0, vdci) // DCache Info

src/register/mod.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,3 +108,7 @@ pub use self::mhpmeventx::*;
108108

109109

110110
// TODO: Debug Mode Registers
111+
112+
113+
// Vexriscv custom CSRs
114+
pub mod vexriscv;

src/register/vexriscv/dci.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
//! vexriscv dci register -- dcache info
2+
//!
3+
//! This register is only available if the core was built with
4+
//! `DBusCachedPlugin` enabled and `csrInfo` set to `true`.
5+
//!
6+
//! See
7+
//! [DBusCachedPlugin.scala](https://github.com/SpinalHDL/VexRiscv/blob/95237b23ea2d658cb3e0aa77680ca2851ef5d882/src/main/scala/vexriscv/plugin/DBusCachedPlugin.scala#L358)
8+
//! for more information.
9+
10+
read_csr_as_usize!(0xCC0, __read_vdci);

src/register/vexriscv/mim.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
//! vexriscv mim register -- machine irq mask
2+
3+
read_csr_as_usize!(0xBC0, __read_vmim);
4+
write_csr_as_usize!(0xBC0, __write_vmim);

src/register/vexriscv/mip.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
//! vexriscv mip register -- machine irq pending
2+
3+
read_csr_as_usize!(0xFC0, __read_vmip);

src/register/vexriscv/mod.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
//! VexRiscv CSRs
2+
//!
3+
//! [VexRiscv](https://github.com/SpinalHDL/VexRiscv) is a RISC-V softcore
4+
//! written in Scala. It is highly configurable, and can be built with features
5+
//! such as a dcache and an external interrupt controller.
6+
//!
7+
//! These features use vendor-specific CSRs, which are available using this
8+
//! module.
9+
pub mod dci;
10+
pub mod mim;
11+
pub mod mip;
12+
pub mod sim;
13+
pub mod sip;

src/register/vexriscv/sim.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
//! vexriscv sim register -- supervisor irq mask
2+
3+
read_csr_as_usize!(0x9C0, __read_vsim);
4+
write_csr_as_usize!(0x9C0, __write_vsim);

src/register/vexriscv/sip.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
//! vexriscv sip register -- supervisor irq pending
2+
3+
read_csr_as_usize!(0xDC0, __read_vsip);

0 commit comments

Comments
 (0)