mirror of
https://github.com/enjoy-digital/litex.git
synced 2025-01-04 09:52:26 -05:00
Merge pull request #1124 from tcal-x/cfu-finalize
Defer adding the CFU instance until cpu.do_finalize().
This commit is contained in:
commit
d3b493d4e8
1 changed files with 7 additions and 5 deletions
|
@ -276,7 +276,7 @@ class VexRiscv(CPU, AutoCSR):
|
||||||
if not os.path.exists(cfu_filename):
|
if not os.path.exists(cfu_filename):
|
||||||
raise OSError(f"Unable to find VexRiscv CFU plugin {cfu_filename}.")
|
raise OSError(f"Unable to find VexRiscv CFU plugin {cfu_filename}.")
|
||||||
|
|
||||||
# CFU Layout.
|
# CFU:CPU Bus Layout.
|
||||||
cfu_bus_layout = [
|
cfu_bus_layout = [
|
||||||
("cmd", [
|
("cmd", [
|
||||||
("valid", 1),
|
("valid", 1),
|
||||||
|
@ -296,11 +296,11 @@ class VexRiscv(CPU, AutoCSR):
|
||||||
]),
|
]),
|
||||||
]
|
]
|
||||||
|
|
||||||
# CFU Bus.
|
# The CFU:CPU Bus.
|
||||||
self.cfu_bus = cfu_bus = Record(cfu_bus_layout)
|
self.cfu_bus = cfu_bus = Record(cfu_bus_layout)
|
||||||
|
|
||||||
# Add CFU.
|
# Connect CFU to the CFU:CPU bus.
|
||||||
self.specials += Instance("Cfu",
|
self.cfu_params = dict(
|
||||||
i_cmd_valid = cfu_bus.cmd.valid,
|
i_cmd_valid = cfu_bus.cmd.valid,
|
||||||
o_cmd_ready = cfu_bus.cmd.ready,
|
o_cmd_ready = cfu_bus.cmd.ready,
|
||||||
i_cmd_payload_function_id = cfu_bus.cmd.payload.function_id,
|
i_cmd_payload_function_id = cfu_bus.cmd.payload.function_id,
|
||||||
|
@ -314,7 +314,7 @@ class VexRiscv(CPU, AutoCSR):
|
||||||
)
|
)
|
||||||
self.platform.add_source(cfu_filename)
|
self.platform.add_source(cfu_filename)
|
||||||
|
|
||||||
# Connect CFU to CPU.
|
# Connect CPU to the CFU:CPU bus.
|
||||||
self.cpu_params.update(
|
self.cpu_params.update(
|
||||||
o_CfuPlugin_bus_cmd_valid = cfu_bus.cmd.valid,
|
o_CfuPlugin_bus_cmd_valid = cfu_bus.cmd.valid,
|
||||||
i_CfuPlugin_bus_cmd_ready = cfu_bus.cmd.ready,
|
i_CfuPlugin_bus_cmd_ready = cfu_bus.cmd.ready,
|
||||||
|
@ -361,3 +361,5 @@ class VexRiscv(CPU, AutoCSR):
|
||||||
if not self.external_variant:
|
if not self.external_variant:
|
||||||
self.add_sources(self.platform, self.variant)
|
self.add_sources(self.platform, self.variant)
|
||||||
self.specials += Instance("VexRiscv", **self.cpu_params)
|
self.specials += Instance("VexRiscv", **self.cpu_params)
|
||||||
|
if hasattr(self, "cfu_params"):
|
||||||
|
self.specials += Instance("Cfu", **self.cfu_params)
|
||||||
|
|
Loading…
Reference in a new issue