Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move cpu reboot addr register to separate platform independent object #7

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions hw/foboot-bitstream.py
Original file line number Diff line number Diff line change
Expand Up @@ -378,20 +378,23 @@ def __init__(self, pads):
)


class CPUReset(Module, AutoCSR):
def __init__(self, parent):
self.addr = CSRStorage(size=32)

class SBWarmBoot(Module, AutoCSR):
def __init__(self, parent):
self.ctrl = CSRStorage(size=8)
self.addr = CSRStorage(size=32)
do_reset = Signal()
do_warmboot = Signal()
self.comb += [
# "Reset Key" is 0xac (0b101011xx)
do_reset.eq(self.ctrl.storage[2] & self.ctrl.storage[3] & ~self.ctrl.storage[4]
# "WarmBoot Key" is 0xac (0b101011xx)
do_warmboot.eq(self.ctrl.storage[2] & self.ctrl.storage[3] & ~self.ctrl.storage[4]
& self.ctrl.storage[5] & ~self.ctrl.storage[6] & self.ctrl.storage[7])
]
self.specials += Instance("SB_WARMBOOT",
i_S0 = self.ctrl.storage[0],
i_S1 = self.ctrl.storage[1],
i_BOOT = do_reset,
i_BOOT = do_warmboot,
)
parent.config["BITSTREAM_SYNC_HEADER1"] = 0x7e99aa7e
parent.config["BITSTREAM_SYNC_HEADER2"] = 0x7eaa997e
Expand Down Expand Up @@ -672,6 +675,7 @@ class BaseSoC(SoCCore):
"reboot": 12,
"rgb": 13,
"version": 14,
"cpureset": 15,
}

mem_map = {
Expand Down Expand Up @@ -762,8 +766,9 @@ def __init__(self, platform, boot_source="rand",
self.picorvspi.bus, size=self.picorvspi.size)

self.submodules.reboot = SBWarmBoot(self)
self.submodules.cpureset = CPUReset(self)
self.cpu.cpu_params.update(
i_externalResetVector=self.reboot.addr.storage,
i_externalResetVector=self.cpureset.addr.storage,
)

self.submodules.rgb = SBLED(platform.request("led"))
Expand Down