Skip to content

Commit

Permalink
bench/serwb/demo: Demonstrate use of multiple SERIOs over the same link.
Browse files Browse the repository at this point in the history
  • Loading branch information
enjoy-digital committed Feb 29, 2024
1 parent 620e6c6 commit 5a98f2e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
7 changes: 4 additions & 3 deletions bench/serwb/demo/ecpix5.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ def __init__(self, platform, with_analyzer=False):

# SerIO.
# ------
self.serio = SERIOCore(serwb_core=self.serwb_master_core)
self.serio0 = SERIOCore(serwb_core=self.serwb_master_core, port=1)
self.serio1 = SERIOCore(serwb_core=self.serwb_master_core, port=2)

# Leds -------------------------------------------------------------------------------------
leds_pads = []
Expand All @@ -107,8 +108,8 @@ def __init__(self, platform, with_analyzer=False):
self.comb += [
leds_pads[0].eq(~self.serwb_master_phy.init.ready),
leds_pads[1].eq(~self.serwb_master_phy.init.error),
leds_pads[2].eq(self.serio.o[0]), # Counter from Slave through SerIO.
leds_pads[3].eq(self.serio.o[1]), # Counter from Slave through SerIO.
leds_pads[2].eq(self.serio0.o[1]), # Counter from Slave through SerIO.
leds_pads[3].eq(self.serio1.o[1]), # Counter from Slave through SerIO.
]

# Analyzer ---------------------------------------------------------------------------------
Expand Down
6 changes: 4 additions & 2 deletions bench/serwb/demo/icebreaker.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,15 @@ def __init__(self, platform, with_analyzer=False):

# SerIO.
# ------
self.serio = SERIOCore(serwb_core=self.serwb_slave_core)
self.serio0 = SERIOCore(serwb_core=self.serwb_slave_core, port=1)
self.serio1 = SERIOCore(serwb_core=self.serwb_slave_core, port=2)

# Increment Inputs every 100ms as PoC.
# ------------------------------------
self.serio_timer = WaitTimer(100e-3*sys_clk_freq)
self.comb += self.serio_timer.wait.eq(~self.serio_timer.done)
self.sync += If(self.serio_timer.done, self.serio.i.eq(self.serio.i + 1))
self.sync += If(self.serio_timer.done, self.serio0.i.eq(self.serio0.i + 1))
self.sync += If(self.serio_timer.done, self.serio1.i.eq(self.serio1.i + 2))

# Leds -------------------------------------------------------------------------------------
self.comb += [
Expand Down

0 comments on commit 5a98f2e

Please sign in to comment.