Merge pull request #1876 from trabucayre/vexriscv_configurable_clint_csr_addr

soc/cores/cpu/vexriscv_smp/core: allowing configure CSR/CLINT base address by overriding default value or using args
This commit is contained in:
enjoy-digital 2024-01-23 16:27:16 +01:00 committed by GitHub
commit 1be3f0297d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 35 additions and 26 deletions

View File

@ -57,6 +57,9 @@ class VexRiscvSMP(CPU):
with_rvc = False
dtlb_size = 4
itlb_size = 4
csr_base = 0xf000_0000
clint_base = 0xf001_0000
plic_base = 0xf0c0_0000
# Command line configuration arguments.
@staticmethod
@ -83,6 +86,9 @@ class VexRiscvSMP(CPU):
cpu_group.add_argument("--dtlb-size", default=4, help="Data TLB size.")
cpu_group.add_argument("--itlb-size", default=4, help="Instruction TLB size.")
cpu_group.add_argument("--expose-time", action="store_true", help="Add CLINT time output.")
cpu_group.add_argument("--csr-base", default="0xf0000000", help="CSR base address.")
cpu_group.add_argument("--clint-base", default="0xf0010000", help="CLINT base address.")
cpu_group.add_argument("--plic-base", default="0xf0c00000", help="PLIC base address.")
@staticmethod
def args_read(args):
@ -120,6 +126,9 @@ class VexRiscvSMP(CPU):
VexRiscvSMP.with_rvc = True
if(args.dtlb_size): VexRiscvSMP.dtlb_size = int(args.dtlb_size)
if(args.itlb_size): VexRiscvSMP.itlb_size = int(args.itlb_size)
if(args.csr_base): VexRiscvSMP.csr_base = int(args.csr_base, 16)
if(args.clint_base): VexRiscvSMP.clint_base = int(args.clint_base, 16)
if(args.plic_base): VexRiscvSMP.plic_base = int(args.plic_base, 16)
# ABI.
@staticmethod
@ -146,9 +155,9 @@ class VexRiscvSMP(CPU):
"rom": 0x0000_0000,
"sram": 0x1000_0000,
"main_ram": 0x4000_0000,
"csr": 0xf000_0000,
"clint": 0xf001_0000,
"plic": 0xf0c0_0000,
"csr": VexRiscvSMP.csr_base,
"clint": VexRiscvSMP.clint_base,
"plic": VexRiscvSMP.plic_base,
}
# GCC Flags.