Skip to content

Commit 30af64c

Browse files
bors[bot]xobs
andauthored
Merge #37
37: Add support for custom vexriscv instructions r=Disasm a=xobs This adds a new namespace under "registers" to support the custom interrupt controller on vexriscv. Co-authored-by: Sean Cross <[email protected]>
2 parents 459421d + f54f90f commit 30af64c

14 files changed

+67
-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

assemble.ps1

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
New-Item -Force -Name bin -Type Directory
2+
3+
# remove existing blobs because otherwise this will append object files to the old blobs
4+
Remove-Item -Force bin/*.a
5+
6+
$crate = "riscv"
7+
8+
riscv64-unknown-elf-gcc -c -mabi=ilp32 -march=rv32i asm.S -o bin/$crate.o
9+
riscv64-unknown-elf-ar crs bin/riscv32i-unknown-none-elf.a bin/$crate.o
10+
11+
riscv64-unknown-elf-gcc -c -mabi=ilp32 -march=rv32imc asm.S -o bin/$crate.o
12+
riscv64-unknown-elf-ar crs bin/riscv32imac-unknown-none-elf.a bin/$crate.o
13+
riscv64-unknown-elf-ar crs bin/riscv32imc-unknown-none-elf.a bin/$crate.o
14+
15+
riscv64-unknown-elf-gcc -c -mabi=lp64 -march=rv64imac asm.S -o bin/$crate.o
16+
riscv64-unknown-elf-ar crs bin/riscv64imac-unknown-none-elf.a bin/$crate.o
17+
riscv64-unknown-elf-ar crs bin/riscv64gc-unknown-none-elf.a bin/$crate.o
18+
19+
Remove-Item bin/$crate.o

bin/riscv32i-unknown-none-elf.a

1.46 KB
Binary file not shown.

bin/riscv32imac-unknown-none-elf.a

1.44 KB
Binary file not shown.

bin/riscv32imc-unknown-none-elf.a

1.44 KB
Binary file not shown.

bin/riscv64gc-unknown-none-elf.a

1.92 KB
Binary file not shown.

bin/riscv64imac-unknown-none-elf.a

1.92 KB
Binary file not shown.

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);

0 commit comments

Comments
 (0)