cpu/vexriscv: Simplify CFU integration, use Cfu.v as default CFU when not specified and rename argument to --cpu-cfu.
This commit is contained in:
parent
87bb10f43b
commit
78bdde0424
2
CHANGES
2
CHANGES
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
[> Added Features
|
[> Added Features
|
||||||
-----------------
|
-----------------
|
||||||
-
|
- cpu/vexriscv: Add CFU support.
|
||||||
|
|
||||||
[> API changes/Deprecation
|
[> API changes/Deprecation
|
||||||
--------------------------
|
--------------------------
|
||||||
|
|
|
@ -101,7 +101,7 @@ class VexRiscv(CPU, AutoCSR):
|
||||||
gcc_triple = CPU_GCC_TRIPLE_RISCV32
|
gcc_triple = CPU_GCC_TRIPLE_RISCV32
|
||||||
linker_output_format = "elf32-littleriscv"
|
linker_output_format = "elf32-littleriscv"
|
||||||
nop = "nop"
|
nop = "nop"
|
||||||
io_regions = {0x80000000: 0x80000000} # origin, length
|
io_regions = {0x80000000: 0x80000000} # Origin, Length
|
||||||
|
|
||||||
# Memory Mapping.
|
# Memory Mapping.
|
||||||
@property
|
@property
|
||||||
|
@ -121,7 +121,7 @@ class VexRiscv(CPU, AutoCSR):
|
||||||
flags += " -D__vexriscv__"
|
flags += " -D__vexriscv__"
|
||||||
return flags
|
return flags
|
||||||
|
|
||||||
def __init__(self, platform, variant="standard", with_timer=False):
|
def __init__(self, platform, variant="standard", with_timer=False, cfu=None):
|
||||||
self.platform = platform
|
self.platform = platform
|
||||||
self.variant = variant
|
self.variant = variant
|
||||||
self.human_name = CPU_VARIANTS.get(variant, "VexRiscv")
|
self.human_name = CPU_VARIANTS.get(variant, "VexRiscv")
|
||||||
|
@ -174,6 +174,9 @@ class VexRiscv(CPU, AutoCSR):
|
||||||
if "debug" in variant:
|
if "debug" in variant:
|
||||||
self.add_debug()
|
self.add_debug()
|
||||||
|
|
||||||
|
if "cfu" in variant:
|
||||||
|
self.add_cfu(cfu_filename="Cfu.v" if cfu is None else cfu)
|
||||||
|
|
||||||
def set_reset_address(self, reset_address):
|
def set_reset_address(self, reset_address):
|
||||||
assert not hasattr(self, "reset_address")
|
assert not hasattr(self, "reset_address")
|
||||||
self.reset_address = reset_address
|
self.reset_address = reset_address
|
||||||
|
@ -268,6 +271,10 @@ class VexRiscv(CPU, AutoCSR):
|
||||||
)
|
)
|
||||||
|
|
||||||
def add_cfu(self, cfu_filename):
|
def add_cfu(self, cfu_filename):
|
||||||
|
# Check CFU presence.
|
||||||
|
if not os.path.exists(cfu_filename):
|
||||||
|
raise OSError(f"Unable to find VexRiscv CFU plugin {cfu_filename}.")
|
||||||
|
|
||||||
# CFU Layout.
|
# CFU Layout.
|
||||||
cfu_bus_layout = [
|
cfu_bus_layout = [
|
||||||
("cmd", [
|
("cmd", [
|
||||||
|
|
|
@ -71,6 +71,7 @@ class SoCCore(LiteXSoC):
|
||||||
cpu_reset_address = None,
|
cpu_reset_address = None,
|
||||||
cpu_variant = None,
|
cpu_variant = None,
|
||||||
cpu_cls = None,
|
cpu_cls = None,
|
||||||
|
cpu_cfu = None,
|
||||||
|
|
||||||
# CFU parameters
|
# CFU parameters
|
||||||
cfu_filename = None,
|
cfu_filename = None,
|
||||||
|
@ -186,8 +187,9 @@ class SoCCore(LiteXSoC):
|
||||||
self.add_cpu(
|
self.add_cpu(
|
||||||
name = str(cpu_type),
|
name = str(cpu_type),
|
||||||
variant = "standard" if cpu_variant is None else cpu_variant,
|
variant = "standard" if cpu_variant is None else cpu_variant,
|
||||||
|
reset_address = None if integrated_rom_size else cpu_reset_address,
|
||||||
cls = cpu_cls,
|
cls = cpu_cls,
|
||||||
reset_address = None if integrated_rom_size else cpu_reset_address)
|
cfu = cpu_cfu)
|
||||||
|
|
||||||
# Add User's interrupts
|
# Add User's interrupts
|
||||||
if self.irq.enabled:
|
if self.irq.enabled:
|
||||||
|
@ -220,11 +222,6 @@ class SoCCore(LiteXSoC):
|
||||||
if timer_uptime:
|
if timer_uptime:
|
||||||
self.timer0.add_uptime()
|
self.timer0.add_uptime()
|
||||||
|
|
||||||
# Add CFU
|
|
||||||
if cfu_filename:
|
|
||||||
assert(cpu_type == "vexriscv")
|
|
||||||
self.cpu.add_cfu(cfu_filename=cfu_filename)
|
|
||||||
|
|
||||||
# Methods --------------------------------------------------------------------------------------
|
# Methods --------------------------------------------------------------------------------------
|
||||||
|
|
||||||
def add_interrupt(self, interrupt_name, interrupt_id=None, use_loc_if_exists=False):
|
def add_interrupt(self, interrupt_name, interrupt_id=None, use_loc_if_exists=False):
|
||||||
|
@ -300,6 +297,7 @@ def soc_core_args(parser):
|
||||||
parser.add_argument("--cpu-type", default=None, help="Select CPU: {}, (default=vexriscv).".format(", ".join(iter(cpu.CPUS.keys()))))
|
parser.add_argument("--cpu-type", default=None, help="Select CPU: {}, (default=vexriscv).".format(", ".join(iter(cpu.CPUS.keys()))))
|
||||||
parser.add_argument("--cpu-variant", default=None, help="CPU variant (default=standard).")
|
parser.add_argument("--cpu-variant", default=None, help="CPU variant (default=standard).")
|
||||||
parser.add_argument("--cpu-reset-address", default=None, type=auto_int, help="CPU reset address (default=None : Boot from Integrated ROM).")
|
parser.add_argument("--cpu-reset-address", default=None, type=auto_int, help="CPU reset address (default=None : Boot from Integrated ROM).")
|
||||||
|
parser.add_argument("--cpu-cfu", default=None, help="Optional CPU CFU file/instance to add to the CPU.")
|
||||||
|
|
||||||
# Controller parameters
|
# Controller parameters
|
||||||
parser.add_argument("--no-ctrl", action="store_true", help="Disable Controller (default=False).")
|
parser.add_argument("--no-ctrl", action="store_true", help="Disable Controller (default=False).")
|
||||||
|
@ -337,9 +335,6 @@ def soc_core_args(parser):
|
||||||
# L2 Cache
|
# L2 Cache
|
||||||
parser.add_argument("--l2-size", default=8192, type=auto_int, help="L2 cache size (default=8192).")
|
parser.add_argument("--l2-size", default=8192, type=auto_int, help="L2 cache size (default=8192).")
|
||||||
|
|
||||||
# CFU
|
|
||||||
parser.add_argument("--cfu-filename", default=None, help="CFU verilog filename.")
|
|
||||||
|
|
||||||
def soc_core_argdict(args):
|
def soc_core_argdict(args):
|
||||||
r = dict()
|
r = dict()
|
||||||
for a in inspect.getargspec(SoCCore.__init__).args:
|
for a in inspect.getargspec(SoCCore.__init__).args:
|
||||||
|
|
Loading…
Reference in New Issue