Reset processing on assert edge only to permit operations to be queued while reset is asserted

This commit is contained in:
Alex Forencich
2021-03-21 12:13:19 -07:00
parent 156fada616
commit 7fb8c4e28b
6 changed files with 187 additions and 183 deletions

View File

@@ -208,12 +208,6 @@ class AxiMasterWrite(Reset):
if self._process_write_resp_cr is not None: if self._process_write_resp_cr is not None:
self._process_write_resp_cr.kill() self._process_write_resp_cr.kill()
self._process_write_resp_cr = None self._process_write_resp_cr = None
else:
self.log.info("Reset de-asserted")
if self._process_write_cr is None:
self._process_write_cr = cocotb.scheduler.start_soon(self._process_write())
if self._process_write_resp_cr is None:
self._process_write_resp_cr = cocotb.scheduler.start_soon(self._process_write_resp())
self.aw_channel.clear() self.aw_channel.clear()
self.w_channel.clear() self.w_channel.clear()
@@ -251,6 +245,12 @@ class AxiMasterWrite(Reset):
self.in_flight_operations = 0 self.in_flight_operations = 0
self._idle.set() self._idle.set()
else:
self.log.info("Reset de-asserted")
if self._process_write_cr is None:
self._process_write_cr = cocotb.scheduler.start_soon(self._process_write())
if self._process_write_resp_cr is None:
self._process_write_resp_cr = cocotb.scheduler.start_soon(self._process_write_resp())
async def _process_write(self): async def _process_write(self):
while True: while True:
@@ -565,12 +565,6 @@ class AxiMasterRead(Reset):
if self._process_read_resp_cr is not None: if self._process_read_resp_cr is not None:
self._process_read_resp_cr.kill() self._process_read_resp_cr.kill()
self._process_read_resp_cr = None self._process_read_resp_cr = None
else:
self.log.info("Reset de-asserted")
if self._process_read_cr is None:
self._process_read_cr = cocotb.scheduler.start_soon(self._process_read())
if self._process_read_resp_cr is None:
self._process_read_resp_cr = cocotb.scheduler.start_soon(self._process_read_resp())
self.ar_channel.clear() self.ar_channel.clear()
self.r_channel.clear() self.r_channel.clear()
@@ -607,6 +601,12 @@ class AxiMasterRead(Reset):
self.in_flight_operations = 0 self.in_flight_operations = 0
self._idle.set() self._idle.set()
else:
self.log.info("Reset de-asserted")
if self._process_read_cr is None:
self._process_read_cr = cocotb.scheduler.start_soon(self._process_read())
if self._process_read_resp_cr is None:
self._process_read_resp_cr = cocotb.scheduler.start_soon(self._process_read_resp())
async def _process_read(self): async def _process_read(self):
while True: while True:

View File

@@ -75,14 +75,14 @@ class AxiRamWrite(Memory, Reset):
if self._process_write_cr is not None: if self._process_write_cr is not None:
self._process_write_cr.kill() self._process_write_cr.kill()
self._process_write_cr = None self._process_write_cr = None
else:
self.log.info("Reset de-asserted")
if self._process_write_cr is None:
self._process_write_cr = cocotb.scheduler.start_soon(self._process_write())
self.aw_channel.clear() self.aw_channel.clear()
self.w_channel.clear() self.w_channel.clear()
self.b_channel.clear() self.b_channel.clear()
else:
self.log.info("Reset de-asserted")
if self._process_write_cr is None:
self._process_write_cr = cocotb.scheduler.start_soon(self._process_write())
async def _process_write(self): async def _process_write(self):
while True: while True:
@@ -195,14 +195,14 @@ class AxiRamRead(Memory, Reset):
if self._process_read_cr is not None: if self._process_read_cr is not None:
self._process_read_cr.kill() self._process_read_cr.kill()
self._process_read_cr = None self._process_read_cr = None
self.ar_channel.clear()
self.r_channel.clear()
else: else:
self.log.info("Reset de-asserted") self.log.info("Reset de-asserted")
if self._process_read_cr is None: if self._process_read_cr is None:
self._process_read_cr = cocotb.scheduler.start_soon(self._process_read()) self._process_read_cr = cocotb.scheduler.start_soon(self._process_read())
self.ar_channel.clear()
self.r_channel.clear()
async def _process_read(self): async def _process_read(self):
while True: while True:
ar = await self.ar_channel.recv() ar = await self.ar_channel.recv()

View File

@@ -151,12 +151,6 @@ class AxiLiteMasterWrite(Reset):
if self._process_write_resp_cr is not None: if self._process_write_resp_cr is not None:
self._process_write_resp_cr.kill() self._process_write_resp_cr.kill()
self._process_write_resp_cr = None self._process_write_resp_cr = None
else:
self.log.info("Reset de-asserted")
if self._process_write_cr is None:
self._process_write_cr = cocotb.scheduler.start_soon(self._process_write())
if self._process_write_resp_cr is None:
self._process_write_resp_cr = cocotb.scheduler.start_soon(self._process_write_resp())
self.aw_channel.clear() self.aw_channel.clear()
self.w_channel.clear() self.w_channel.clear()
@@ -194,6 +188,12 @@ class AxiLiteMasterWrite(Reset):
self.in_flight_operations = 0 self.in_flight_operations = 0
self._idle.set() self._idle.set()
else:
self.log.info("Reset de-asserted")
if self._process_write_cr is None:
self._process_write_cr = cocotb.scheduler.start_soon(self._process_write())
if self._process_write_resp_cr is None:
self._process_write_resp_cr = cocotb.scheduler.start_soon(self._process_write_resp())
async def _process_write(self): async def _process_write(self):
while True: while True:
@@ -384,12 +384,6 @@ class AxiLiteMasterRead(Reset):
if self._process_read_resp_cr is not None: if self._process_read_resp_cr is not None:
self._process_read_resp_cr.kill() self._process_read_resp_cr.kill()
self._process_read_resp_cr = None self._process_read_resp_cr = None
else:
self.log.info("Reset de-asserted")
if self._process_read_cr is None:
self._process_read_cr = cocotb.scheduler.start_soon(self._process_read())
if self._process_read_resp_cr is None:
self._process_read_resp_cr = cocotb.scheduler.start_soon(self._process_read_resp())
self.ar_channel.clear() self.ar_channel.clear()
self.r_channel.clear() self.r_channel.clear()
@@ -426,6 +420,12 @@ class AxiLiteMasterRead(Reset):
self.in_flight_operations = 0 self.in_flight_operations = 0
self._idle.set() self._idle.set()
else:
self.log.info("Reset de-asserted")
if self._process_read_cr is None:
self._process_read_cr = cocotb.scheduler.start_soon(self._process_read())
if self._process_read_resp_cr is None:
self._process_read_resp_cr = cocotb.scheduler.start_soon(self._process_read_resp())
async def _process_read(self): async def _process_read(self):
while True: while True:

View File

@@ -72,14 +72,14 @@ class AxiLiteRamWrite(Memory, Reset):
if self._process_write_cr is not None: if self._process_write_cr is not None:
self._process_write_cr.kill() self._process_write_cr.kill()
self._process_write_cr = None self._process_write_cr = None
else:
self.log.info("Reset de-asserted")
if self._process_write_cr is None:
self._process_write_cr = cocotb.scheduler.start_soon(self._process_write())
self.aw_channel.clear() self.aw_channel.clear()
self.w_channel.clear() self.w_channel.clear()
self.b_channel.clear() self.b_channel.clear()
else:
self.log.info("Reset de-asserted")
if self._process_write_cr is None:
self._process_write_cr = cocotb.scheduler.start_soon(self._process_write())
async def _process_write(self): async def _process_write(self):
while True: while True:
@@ -150,14 +150,14 @@ class AxiLiteRamRead(Memory, Reset):
if self._process_read_cr is not None: if self._process_read_cr is not None:
self._process_read_cr.kill() self._process_read_cr.kill()
self._process_read_cr = None self._process_read_cr = None
self.ar_channel.clear()
self.r_channel.clear()
else: else:
self.log.info("Reset de-asserted") self.log.info("Reset de-asserted")
if self._process_read_cr is None: if self._process_read_cr is None:
self._process_read_cr = cocotb.scheduler.start_soon(self._process_read()) self._process_read_cr = cocotb.scheduler.start_soon(self._process_read())
self.ar_channel.clear()
self.r_channel.clear()
async def _process_read(self): async def _process_read(self):
while True: while True:
ar = await self.ar_channel.recv() ar = await self.ar_channel.recv()

View File

@@ -365,13 +365,13 @@ class AxiStreamBase(Reset):
if self._run_cr is not None: if self._run_cr is not None:
self._run_cr.kill() self._run_cr.kill()
self._run_cr = None self._run_cr = None
self.active = False
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.scheduler.start_soon(self._run()) self._run_cr = cocotb.scheduler.start_soon(self._run())
self.active = False
async def _run(self): async def _run(self):
raise NotImplementedError() raise NotImplementedError()
@@ -441,6 +441,7 @@ class AxiStreamSource(AxiStreamBase, AxiStreamPause):
def _handle_reset(self, state): def _handle_reset(self, state):
super()._handle_reset(state) super()._handle_reset(state)
if state:
self.bus.tdata <= 0 self.bus.tdata <= 0
if hasattr(self.bus, "tvalid"): if hasattr(self.bus, "tvalid"):
self.bus.tvalid <= 0 self.bus.tvalid <= 0
@@ -659,6 +660,7 @@ class AxiStreamSink(AxiStreamMonitor, AxiStreamPause):
def _handle_reset(self, state): def _handle_reset(self, state):
super()._handle_reset(state) super()._handle_reset(state)
if state:
if hasattr(self.bus, "tready"): if hasattr(self.bus, "tready"):
self.bus.tready <= 0 self.bus.tready <= 0

View File

@@ -143,13 +143,13 @@ class StreamBase(Reset):
if self._run_cr is not None: if self._run_cr is not None:
self._run_cr.kill() self._run_cr.kill()
self._run_cr = None self._run_cr = None
self.active = False
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.scheduler.start_soon(self._run()) self._run_cr = cocotb.scheduler.start_soon(self._run())
self.active = False
async def _run(self): async def _run(self):
raise NotImplementedError() raise NotImplementedError()
@@ -205,6 +205,7 @@ class StreamSource(StreamBase, StreamPause):
def _handle_reset(self, state): def _handle_reset(self, state):
super()._handle_reset(state) super()._handle_reset(state)
if state:
if self.valid is not None: if self.valid is not None:
self.valid <= 0 self.valid <= 0
@@ -295,6 +296,7 @@ class StreamSink(StreamMonitor, StreamPause):
def _handle_reset(self, state): def _handle_reset(self, state):
super()._handle_reset(state) super()._handle_reset(state)
if state:
if self.ready is not None: if self.ready is not None:
self.ready <= 0 self.ready <= 0