Skip to content

Commit

Permalink
cpu/urv: Fix Instruction Bus conversion to Wishbone and only keep it …
Browse files Browse the repository at this point in the history
…now that working.
  • Loading branch information
enjoy-digital committed Nov 5, 2024
1 parent 0170462 commit 20b0e98
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 36 deletions.
48 changes: 17 additions & 31 deletions litex/soc/cores/cpu/urv/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,39 +119,25 @@ def __init__(self, platform, variant="standard"):

# uRV Instruction Bus.
# --------------------
if True:
from litex.soc.integration.common import get_mem_data
self.rom = Memory(32, depth=131072//4)
self.rom_port = self.rom.get_port()

self.sync += im_valid.eq(1),
self.comb += [
self.rom_port.adr.eq(im_addr[2:]),
im_data.eq(self.rom_port.dat_r),
]
else:
# FIXME: Try to implement im_bus -> Wishbone correctly (if possible).
im_addr_d = Signal(32, reset=0xffffffff)
self.sync += im_addr_d.eq(im_addr)
self.i_fsm = i_fsm = FSM(reset_state="IDLE")
i_fsm.act("IDLE",
If(im_addr != im_addr_d,
NextValue(im_valid, 0),
NextState("READ")
)
self.i_fsm = i_fsm = FSM(reset_state="IDLE")
i_fsm.act("IDLE",
If(im_rd,
NextValue(im_valid, 0),
NextState("READ")
)
i_fsm.act("READ",
ibus.stb.eq(1),
ibus.cyc.eq(1),
ibus.we.eq(0),
ibus.adr.eq(im_addr),
ibus.sel.eq(0b1111),
If(ibus.ack,
NextValue(im_valid, 1),
NextValue(im_data, ibus.dat_r),
NextState("IDLE")
)
)
i_fsm.act("READ",
ibus.stb.eq(1),
ibus.cyc.eq(1),
ibus.we.eq(0),
ibus.adr.eq(im_addr),
ibus.sel.eq(0b1111),
If(ibus.ack,
NextValue(im_valid, 1),
NextValue(im_data, ibus.dat_r),
NextState("IDLE")
)
)

# uRV Data Bus.
# -------------
Expand Down
5 changes: 0 additions & 5 deletions litex/soc/integration/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,11 +339,6 @@ def _initialize_rom_software(self):
# Initialize SoC with with BIOS data.
self.soc.init_rom(name="rom", contents=bios_data)

# FIXME: Remove uRV ROM Init Workaround.
from litex.soc.cores.cpu.urv import uRV
if isinstance(self.soc.cpu, uRV):
self.soc.cpu.rom.init = bios_data

def build(self, **kwargs):
# Pass Output Directory to Platform.
self.soc.platform.output_dir = self.output_dir
Expand Down

0 comments on commit 20b0e98

Please sign in to comment.