Skip to content

Commit

Permalink
gateware: bootloader: rev2: Re-fixed the synchronizers for the CDC to…
Browse files Browse the repository at this point in the history
… hopefully fix timing issues
  • Loading branch information
lethalbit committed Jan 15, 2025
1 parent 8f1c98d commit e1aed54
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions squishy/gateware/bootloader/rev2.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,24 +237,34 @@ def elaborate(self, platform: SquishyPlatformType | None) -> Module:
]


m.submodules.ffs_reboot = FFSynchronizer(self.trigger_reboot, trigger_reboot)
m.submodules.ffs_dl_finish = FFSynchronizer(self.dl_finish, dl_finish)
m.submodules.ffs_dl_size = FFSynchronizer(self.dl_size, dl_size)
m.submodules.ffs_dl_start = FFSynchronizer(self.dl_start, dl_start)
m.submodules.ffs_dl_completed = FFSynchronizer(self.dl_completed, dl_completed)
m.submodules.ffs_dl_done = FFSynchronizer(dl_done, self.dl_done, o_domain = 'usb')
m.submodules.ffs_slot_sel = FFSynchronizer(self.slot_selection, slot_selection)
m.submodules.ffs_dl_read = FFSynchronizer(dl_ready, self.dl_ready, o_domain = 'usb')
m.submodules.ffs_reboot = FFSynchronizer(self.trigger_reboot, trigger_reboot)
m.submodules.ffs_dl_size = FFSynchronizer(self.dl_size, dl_size, stages = 3)
m.submodules.ffs_dl_done = FFSynchronizer(dl_done, self.dl_done, o_domain = 'usb')
m.submodules.ffs_slot_sel = FFSynchronizer(self.slot_selection, slot_selection)
m.submodules.ffs_dl_read = FFSynchronizer(dl_ready, self.dl_ready, o_domain = 'usb')

m.submodules.ps_slot_ack = ps_slot_ack = PulseSynchronizer(i_domain = 'sync', o_domain = 'usb')
m.submodules.ps_slot_chg = ps_slot_cng = PulseSynchronizer(i_domain = 'usb', o_domain = 'sync')

m.submodules.ps_dl_start = ps_dl_start = PulseSynchronizer(i_domain = 'usb', o_domain = 'sync')
m.submodules.ps_dl_completed = ps_dl_completed = PulseSynchronizer(i_domain = 'usb', o_domain = 'sync')
m.submodules.ps_dl_finish = ps_dl_finish = PulseSynchronizer(i_domain = 'usb', o_domain = 'sync')

m.d.comb += [
ps_slot_ack.i.eq(slot_ack),
self.slot_ack.eq(ps_slot_ack.o),
ps_slot_cng.i.eq(self.slot_changed),
slot_changed.eq(ps_slot_cng.o),

ps_dl_start.i.eq(self.dl_start),
dl_start.eq(ps_dl_start.o),

ps_dl_completed.i.eq(self.dl_completed),
dl_completed.eq(ps_dl_completed.o),

ps_dl_finish.i.eq(self.dl_finish),
dl_finish.eq(ps_dl_finish.o),

psram.finish.eq(dl_finish),
dl_done.eq(psram.done),
psram.start_w.eq(dl_start),
Expand Down

0 comments on commit e1aed54

Please sign in to comment.