Use start_soon instead of fork
This commit is contained in:
@@ -262,9 +262,9 @@ class EthMacTx(Reset):
|
|||||||
else:
|
else:
|
||||||
self.log.info("Reset de-asserted")
|
self.log.info("Reset de-asserted")
|
||||||
if self._run_cr is None:
|
if self._run_cr is None:
|
||||||
self._run_cr = cocotb.fork(self._run())
|
self._run_cr = cocotb.start_soon(self._run())
|
||||||
if self._run_ts_cr is None and self.ptp_ts:
|
if self._run_ts_cr is None and self.ptp_ts:
|
||||||
self._run_ts_cr = cocotb.fork(self._run_ts())
|
self._run_ts_cr = cocotb.start_soon(self._run_ts())
|
||||||
|
|
||||||
async def _run(self):
|
async def _run(self):
|
||||||
frame = None
|
frame = None
|
||||||
@@ -477,7 +477,7 @@ class EthMacRx(Reset):
|
|||||||
else:
|
else:
|
||||||
self.log.info("Reset de-asserted")
|
self.log.info("Reset de-asserted")
|
||||||
if self._run_cr is None:
|
if self._run_cr is None:
|
||||||
self._run_cr = cocotb.fork(self._run())
|
self._run_cr = cocotb.start_soon(self._run())
|
||||||
|
|
||||||
async def _run(self):
|
async def _run(self):
|
||||||
frame = None
|
frame = None
|
||||||
|
|||||||
@@ -254,7 +254,7 @@ class GmiiSource(Reset):
|
|||||||
else:
|
else:
|
||||||
self.log.info("Reset de-asserted")
|
self.log.info("Reset de-asserted")
|
||||||
if self._run_cr is None:
|
if self._run_cr is None:
|
||||||
self._run_cr = cocotb.fork(self._run())
|
self._run_cr = cocotb.start_soon(self._run())
|
||||||
|
|
||||||
async def _run(self):
|
async def _run(self):
|
||||||
frame = None
|
frame = None
|
||||||
@@ -424,7 +424,7 @@ class GmiiSink(Reset):
|
|||||||
else:
|
else:
|
||||||
self.log.info("Reset de-asserted")
|
self.log.info("Reset de-asserted")
|
||||||
if self._run_cr is None:
|
if self._run_cr is None:
|
||||||
self._run_cr = cocotb.fork(self._run())
|
self._run_cr = cocotb.start_soon(self._run())
|
||||||
|
|
||||||
async def _run(self):
|
async def _run(self):
|
||||||
frame = None
|
frame = None
|
||||||
@@ -521,12 +521,12 @@ class GmiiPhy:
|
|||||||
self._clock_cr.kill()
|
self._clock_cr.kill()
|
||||||
|
|
||||||
if self.speed == 1000e6:
|
if self.speed == 1000e6:
|
||||||
self._clock_cr = cocotb.fork(self._run_clocks(8*1e9/self.speed))
|
self._clock_cr = cocotb.start_soon(self._run_clocks(8*1e9/self.speed))
|
||||||
self.tx.mii_mode = False
|
self.tx.mii_mode = False
|
||||||
self.rx.mii_mode = False
|
self.rx.mii_mode = False
|
||||||
self.tx.clock = self.gtx_clk
|
self.tx.clock = self.gtx_clk
|
||||||
else:
|
else:
|
||||||
self._clock_cr = cocotb.fork(self._run_clocks(4*1e9/self.speed))
|
self._clock_cr = cocotb.start_soon(self._run_clocks(4*1e9/self.speed))
|
||||||
self.tx.mii_mode = True
|
self.tx.mii_mode = True
|
||||||
self.rx.mii_mode = True
|
self.rx.mii_mode = True
|
||||||
self.tx.clock = self.tx_clk
|
self.tx.clock = self.tx_clk
|
||||||
|
|||||||
@@ -155,7 +155,7 @@ class MiiSource(Reset):
|
|||||||
else:
|
else:
|
||||||
self.log.info("Reset de-asserted")
|
self.log.info("Reset de-asserted")
|
||||||
if self._run_cr is None:
|
if self._run_cr is None:
|
||||||
self._run_cr = cocotb.fork(self._run())
|
self._run_cr = cocotb.start_soon(self._run())
|
||||||
|
|
||||||
async def _run(self):
|
async def _run(self):
|
||||||
frame = None
|
frame = None
|
||||||
@@ -315,7 +315,7 @@ class MiiSink(Reset):
|
|||||||
else:
|
else:
|
||||||
self.log.info("Reset de-asserted")
|
self.log.info("Reset de-asserted")
|
||||||
if self._run_cr is None:
|
if self._run_cr is None:
|
||||||
self._run_cr = cocotb.fork(self._run())
|
self._run_cr = cocotb.start_soon(self._run())
|
||||||
|
|
||||||
async def _run(self):
|
async def _run(self):
|
||||||
frame = None
|
frame = None
|
||||||
@@ -406,7 +406,7 @@ class MiiPhy:
|
|||||||
if self._clock_cr is not None:
|
if self._clock_cr is not None:
|
||||||
self._clock_cr.kill()
|
self._clock_cr.kill()
|
||||||
|
|
||||||
self._clock_cr = cocotb.fork(self._run_clocks(4*1e9/self.speed))
|
self._clock_cr = cocotb.start_soon(self._run_clocks(4*1e9/self.speed))
|
||||||
|
|
||||||
async def _run_clocks(self, period):
|
async def _run_clocks(self, period):
|
||||||
half_period = get_sim_steps(period / 2.0, 'ns')
|
half_period = get_sim_steps(period / 2.0, 'ns')
|
||||||
|
|||||||
@@ -205,7 +205,7 @@ class PtpClock(Reset):
|
|||||||
else:
|
else:
|
||||||
self.log.info("Reset de-asserted")
|
self.log.info("Reset de-asserted")
|
||||||
if self._run_cr is None:
|
if self._run_cr is None:
|
||||||
self._run_cr = cocotb.fork(self._run())
|
self._run_cr = cocotb.start_soon(self._run())
|
||||||
|
|
||||||
async def _run(self):
|
async def _run(self):
|
||||||
clock_edge_event = RisingEdge(self.clock)
|
clock_edge_event = RisingEdge(self.clock)
|
||||||
@@ -290,7 +290,7 @@ class PtpClockSimTime:
|
|||||||
if self.pps is not None:
|
if self.pps is not None:
|
||||||
self.pps.value = 0
|
self.pps.value = 0
|
||||||
|
|
||||||
self._run_cr = cocotb.fork(self._run())
|
self._run_cr = cocotb.start_soon(self._run())
|
||||||
|
|
||||||
def get_ts_96(self):
|
def get_ts_96(self):
|
||||||
return (self.ts_96_s << 48) | (self.ts_96_ns << 16) | self.ts_96_fns
|
return (self.ts_96_s << 48) | (self.ts_96_ns << 16) | self.ts_96_fns
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ class Reset:
|
|||||||
self._reset_state = True
|
self._reset_state = True
|
||||||
|
|
||||||
if reset_signal is not None:
|
if reset_signal is not None:
|
||||||
cocotb.fork(self._run_reset(reset_signal, bool(active_level)))
|
cocotb.start_soon(self._run_reset(reset_signal, bool(active_level)))
|
||||||
|
|
||||||
self._update_reset()
|
self._update_reset()
|
||||||
|
|
||||||
|
|||||||
@@ -153,7 +153,7 @@ class RgmiiSource(Reset):
|
|||||||
else:
|
else:
|
||||||
self.log.info("Reset de-asserted")
|
self.log.info("Reset de-asserted")
|
||||||
if self._run_cr is None:
|
if self._run_cr is None:
|
||||||
self._run_cr = cocotb.fork(self._run())
|
self._run_cr = cocotb.start_soon(self._run())
|
||||||
|
|
||||||
async def _run(self):
|
async def _run(self):
|
||||||
frame = None
|
frame = None
|
||||||
@@ -333,7 +333,7 @@ class RgmiiSink(Reset):
|
|||||||
else:
|
else:
|
||||||
self.log.info("Reset de-asserted")
|
self.log.info("Reset de-asserted")
|
||||||
if self._run_cr is None:
|
if self._run_cr is None:
|
||||||
self._run_cr = cocotb.fork(self._run())
|
self._run_cr = cocotb.start_soon(self._run())
|
||||||
|
|
||||||
async def _run(self):
|
async def _run(self):
|
||||||
frame = None
|
frame = None
|
||||||
@@ -440,11 +440,11 @@ class RgmiiPhy:
|
|||||||
self._clock_cr.kill()
|
self._clock_cr.kill()
|
||||||
|
|
||||||
if self.speed == 1000e6:
|
if self.speed == 1000e6:
|
||||||
self._clock_cr = cocotb.fork(self._run_clock(8*1e9/self.speed))
|
self._clock_cr = cocotb.start_soon(self._run_clock(8*1e9/self.speed))
|
||||||
self.tx.mii_mode = False
|
self.tx.mii_mode = False
|
||||||
self.rx.mii_mode = False
|
self.rx.mii_mode = False
|
||||||
else:
|
else:
|
||||||
self._clock_cr = cocotb.fork(self._run_clock(4*1e9/self.speed))
|
self._clock_cr = cocotb.start_soon(self._run_clock(4*1e9/self.speed))
|
||||||
self.tx.mii_mode = True
|
self.tx.mii_mode = True
|
||||||
self.rx.mii_mode = True
|
self.rx.mii_mode = True
|
||||||
|
|
||||||
|
|||||||
@@ -263,7 +263,7 @@ class XgmiiSource(Reset):
|
|||||||
else:
|
else:
|
||||||
self.log.info("Reset de-asserted")
|
self.log.info("Reset de-asserted")
|
||||||
if self._run_cr is None:
|
if self._run_cr is None:
|
||||||
self._run_cr = cocotb.fork(self._run())
|
self._run_cr = cocotb.start_soon(self._run())
|
||||||
|
|
||||||
async def _run(self):
|
async def _run(self):
|
||||||
frame = None
|
frame = None
|
||||||
@@ -452,7 +452,7 @@ class XgmiiSink(Reset):
|
|||||||
else:
|
else:
|
||||||
self.log.info("Reset de-asserted")
|
self.log.info("Reset de-asserted")
|
||||||
if self._run_cr is None:
|
if self._run_cr is None:
|
||||||
self._run_cr = cocotb.fork(self._run())
|
self._run_cr = cocotb.start_soon(self._run())
|
||||||
|
|
||||||
async def _run(self):
|
async def _run(self):
|
||||||
frame = None
|
frame = None
|
||||||
|
|||||||
@@ -45,8 +45,8 @@ class TB:
|
|||||||
self.log = logging.getLogger("cocotb.tb")
|
self.log = logging.getLogger("cocotb.tb")
|
||||||
self.log.setLevel(logging.DEBUG)
|
self.log.setLevel(logging.DEBUG)
|
||||||
|
|
||||||
cocotb.fork(Clock(dut.tx_clk, 6.4, units="ns").start())
|
cocotb.start_soon(Clock(dut.tx_clk, 6.4, units="ns").start())
|
||||||
cocotb.fork(Clock(dut.rx_clk, 6.4, units="ns").start())
|
cocotb.start_soon(Clock(dut.rx_clk, 6.4, units="ns").start())
|
||||||
|
|
||||||
self.mac = EthMac(
|
self.mac = EthMac(
|
||||||
tx_clk=dut.tx_clk,
|
tx_clk=dut.tx_clk,
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ class TB:
|
|||||||
self._enable_generator = None
|
self._enable_generator = None
|
||||||
self._enable_cr = None
|
self._enable_cr = None
|
||||||
|
|
||||||
cocotb.fork(Clock(dut.clk, 2, units="ns").start())
|
cocotb.start_soon(Clock(dut.clk, 2, units="ns").start())
|
||||||
|
|
||||||
self.source = GmiiSource(dut.gmii_d, dut.gmii_er, dut.gmii_en,
|
self.source = GmiiSource(dut.gmii_d, dut.gmii_er, dut.gmii_en,
|
||||||
dut.clk, dut.rst, dut.gmii_clk_en, dut.gmii_mii_sel)
|
dut.clk, dut.rst, dut.gmii_clk_en, dut.gmii_mii_sel)
|
||||||
@@ -76,7 +76,7 @@ class TB:
|
|||||||
self._enable_generator = generator
|
self._enable_generator = generator
|
||||||
|
|
||||||
if self._enable_generator is not None:
|
if self._enable_generator is not None:
|
||||||
self._enable_cr = cocotb.fork(self._run_enable())
|
self._enable_cr = cocotb.start_soon(self._run_enable())
|
||||||
|
|
||||||
def clear_enable_generator(self):
|
def clear_enable_generator(self):
|
||||||
self.set_enable_generator(None)
|
self.set_enable_generator(None)
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ class TB:
|
|||||||
self.log = logging.getLogger("cocotb.tb")
|
self.log = logging.getLogger("cocotb.tb")
|
||||||
self.log.setLevel(logging.DEBUG)
|
self.log.setLevel(logging.DEBUG)
|
||||||
|
|
||||||
cocotb.fork(Clock(dut.phy_gtx_clk, 8, units="ns").start())
|
cocotb.start_soon(Clock(dut.phy_gtx_clk, 8, units="ns").start())
|
||||||
|
|
||||||
self.gmii_phy = GmiiPhy(dut.phy_txd, dut.phy_tx_er, dut.phy_tx_en, dut.phy_tx_clk, dut.phy_gtx_clk,
|
self.gmii_phy = GmiiPhy(dut.phy_txd, dut.phy_tx_er, dut.phy_tx_en, dut.phy_tx_clk, dut.phy_gtx_clk,
|
||||||
dut.phy_rxd, dut.phy_rx_er, dut.phy_rx_dv, dut.phy_rx_clk, dut.phy_rst, speed=speed)
|
dut.phy_rxd, dut.phy_rx_er, dut.phy_rx_dv, dut.phy_rx_clk, dut.phy_rst, speed=speed)
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ class TB:
|
|||||||
self._enable_generator = None
|
self._enable_generator = None
|
||||||
self._enable_cr = None
|
self._enable_cr = None
|
||||||
|
|
||||||
cocotb.fork(Clock(dut.clk, 2, units="ns").start())
|
cocotb.start_soon(Clock(dut.clk, 2, units="ns").start())
|
||||||
|
|
||||||
self.source = MiiSource(dut.mii_d, dut.mii_er, dut.mii_en,
|
self.source = MiiSource(dut.mii_d, dut.mii_er, dut.mii_en,
|
||||||
dut.clk, dut.rst, dut.mii_clk_en)
|
dut.clk, dut.rst, dut.mii_clk_en)
|
||||||
@@ -75,7 +75,7 @@ class TB:
|
|||||||
self._enable_generator = generator
|
self._enable_generator = generator
|
||||||
|
|
||||||
if self._enable_generator is not None:
|
if self._enable_generator is not None:
|
||||||
self._enable_cr = cocotb.fork(self._run_enable())
|
self._enable_cr = cocotb.start_soon(self._run_enable())
|
||||||
|
|
||||||
def clear_enable_generator(self):
|
def clear_enable_generator(self):
|
||||||
self.set_enable_generator(None)
|
self.set_enable_generator(None)
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ class TB:
|
|||||||
self.log = logging.getLogger("cocotb.tb")
|
self.log = logging.getLogger("cocotb.tb")
|
||||||
self.log.setLevel(logging.DEBUG)
|
self.log.setLevel(logging.DEBUG)
|
||||||
|
|
||||||
cocotb.fork(Clock(dut.clk, 6.4, units="ns").start())
|
cocotb.start_soon(Clock(dut.clk, 6.4, units="ns").start())
|
||||||
|
|
||||||
self.ptp_clock = PtpClock(
|
self.ptp_clock = PtpClock(
|
||||||
ts_96=dut.ts_96,
|
ts_96=dut.ts_96,
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ class TB:
|
|||||||
self.log = logging.getLogger("cocotb.tb")
|
self.log = logging.getLogger("cocotb.tb")
|
||||||
self.log.setLevel(logging.DEBUG)
|
self.log.setLevel(logging.DEBUG)
|
||||||
|
|
||||||
cocotb.fork(Clock(dut.clk, 6.4, units="ns").start())
|
cocotb.start_soon(Clock(dut.clk, 6.4, units="ns").start())
|
||||||
|
|
||||||
self.ptp_clock = PtpClockSimTime(
|
self.ptp_clock = PtpClockSimTime(
|
||||||
ts_96=dut.ts_96,
|
ts_96=dut.ts_96,
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ class TB:
|
|||||||
self._enable_generator = None
|
self._enable_generator = None
|
||||||
self._enable_cr = None
|
self._enable_cr = None
|
||||||
|
|
||||||
cocotb.fork(Clock(dut.clk, 2, units="ns").start())
|
cocotb.start_soon(Clock(dut.clk, 2, units="ns").start())
|
||||||
|
|
||||||
self.source = RgmiiSource(dut.rgmii_d, dut.rgmii_ctl, dut.clk, dut.rst, dut.rgmii_clk_en, dut.rgmii_mii_sel)
|
self.source = RgmiiSource(dut.rgmii_d, dut.rgmii_ctl, dut.clk, dut.rst, dut.rgmii_clk_en, dut.rgmii_mii_sel)
|
||||||
self.sink = RgmiiSink(dut.rgmii_d, dut.rgmii_ctl, dut.clk, dut.rst, dut.rgmii_clk_en, dut.rgmii_mii_sel)
|
self.sink = RgmiiSink(dut.rgmii_d, dut.rgmii_ctl, dut.clk, dut.rst, dut.rgmii_clk_en, dut.rgmii_mii_sel)
|
||||||
@@ -74,7 +74,7 @@ class TB:
|
|||||||
self._enable_generator = generator
|
self._enable_generator = generator
|
||||||
|
|
||||||
if self._enable_generator is not None:
|
if self._enable_generator is not None:
|
||||||
self._enable_cr = cocotb.fork(self._run_enable())
|
self._enable_cr = cocotb.start_soon(self._run_enable())
|
||||||
|
|
||||||
def clear_enable_generator(self):
|
def clear_enable_generator(self):
|
||||||
self.set_enable_generator(None)
|
self.set_enable_generator(None)
|
||||||
|
|||||||
@@ -45,11 +45,11 @@ class TB:
|
|||||||
self.log.setLevel(logging.DEBUG)
|
self.log.setLevel(logging.DEBUG)
|
||||||
|
|
||||||
if speed == 1000e6:
|
if speed == 1000e6:
|
||||||
cocotb.fork(Clock(dut.phy_tx_clk, 8, units="ns").start())
|
cocotb.start_soon(Clock(dut.phy_tx_clk, 8, units="ns").start())
|
||||||
elif speed == 100e6:
|
elif speed == 100e6:
|
||||||
cocotb.fork(Clock(dut.phy_tx_clk, 40, units="ns").start())
|
cocotb.start_soon(Clock(dut.phy_tx_clk, 40, units="ns").start())
|
||||||
elif speed == 10e6:
|
elif speed == 10e6:
|
||||||
cocotb.fork(Clock(dut.phy_tx_clk, 400, units="ns").start())
|
cocotb.start_soon(Clock(dut.phy_tx_clk, 400, units="ns").start())
|
||||||
|
|
||||||
self.rgmii_phy = RgmiiPhy(dut.phy_txd, dut.phy_tx_ctl, dut.phy_tx_clk,
|
self.rgmii_phy = RgmiiPhy(dut.phy_txd, dut.phy_tx_ctl, dut.phy_tx_clk,
|
||||||
dut.phy_rxd, dut.phy_rx_ctl, dut.phy_rx_clk, dut.phy_rst, speed=speed)
|
dut.phy_rxd, dut.phy_rx_ctl, dut.phy_rx_clk, dut.phy_rst, speed=speed)
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ class TB:
|
|||||||
self._enable_generator = None
|
self._enable_generator = None
|
||||||
self._enable_cr = None
|
self._enable_cr = None
|
||||||
|
|
||||||
cocotb.fork(Clock(dut.clk, 2, units="ns").start())
|
cocotb.start_soon(Clock(dut.clk, 2, units="ns").start())
|
||||||
|
|
||||||
self.source = XgmiiSource(dut.xgmii_d, dut.xgmii_c, dut.clk, dut.rst, dut.xgmii_clk_en)
|
self.source = XgmiiSource(dut.xgmii_d, dut.xgmii_c, dut.clk, dut.rst, dut.xgmii_clk_en)
|
||||||
self.sink = XgmiiSink(dut.xgmii_d, dut.xgmii_c, dut.clk, dut.rst, dut.xgmii_clk_en)
|
self.sink = XgmiiSink(dut.xgmii_d, dut.xgmii_c, dut.clk, dut.rst, dut.xgmii_clk_en)
|
||||||
@@ -74,7 +74,7 @@ class TB:
|
|||||||
self._enable_generator = generator
|
self._enable_generator = generator
|
||||||
|
|
||||||
if self._enable_generator is not None:
|
if self._enable_generator is not None:
|
||||||
self._enable_cr = cocotb.fork(self._run_enable())
|
self._enable_cr = cocotb.start_soon(self._run_enable())
|
||||||
|
|
||||||
def clear_enable_generator(self):
|
def clear_enable_generator(self):
|
||||||
self.set_enable_generator(None)
|
self.set_enable_generator(None)
|
||||||
|
|||||||
Reference in New Issue
Block a user