diff --git a/README.md b/README.md index 6c28acb..2d677b9 100644 --- a/README.md +++ b/README.md @@ -93,6 +93,7 @@ The `GmiiPhy` class provides a model of a GMII PHY chip. It wraps instances of * `count()`: returns the number of items in the queue (all) * `empty()`: returns _True_ if the queue is empty (all) * `idle()`: returns _True_ if no transfer is in progress (all) or if the queue is not empty (source) +* `clear()`: drop all data in queue (all) * `wait()`: wait for idle (source) * `wait(timeout=0, timeout_unit='ns')`: wait for frame received (sink) @@ -196,6 +197,7 @@ The `MiiPhy` class provides a model of an MII PHY chip. It wraps instances of ` * `count()`: returns the number of items in the queue (all) * `empty()`: returns _True_ if the queue is empty (all) * `idle()`: returns _True_ if no transfer is in progress (all) or if the queue is not empty (source) +* `clear()`: drop all data in queue (all) * `wait()`: wait for idle (source) * `wait(timeout=0, timeout_unit='ns')`: wait for frame received (sink) @@ -277,6 +279,7 @@ The `RgmiiPhy` class provides a model of an RGMII PHY chip. It wraps instances * `count()`: returns the number of items in the queue (all) * `empty()`: returns _True_ if the queue is empty (all) * `idle()`: returns _True_ if no transfer is in progress (all) or if the queue is not empty (source) +* `clear()`: drop all data in queue (all) * `wait()`: wait for idle (source) * `wait(timeout=0, timeout_unit='ns')`: wait for frame received (sink) @@ -342,6 +345,7 @@ To receive data with an `XgmiiSink`, call `recv()` or `recv_nowait()`. Optional * `count()`: returns the number of items in the queue (all) * `empty()`: returns _True_ if the queue is empty (all) * `idle()`: returns _True_ if no transfer is in progress (all) or if the queue is not empty (source) +* `clear()`: drop all data in queue (all) * `wait()`: wait for idle (source) * `wait(timeout=0, timeout_unit='ns')`: wait for frame received (sink) diff --git a/cocotbext/eth/gmii.py b/cocotbext/eth/gmii.py index ecdcd71..e839308 100644 --- a/cocotbext/eth/gmii.py +++ b/cocotbext/eth/gmii.py @@ -176,6 +176,11 @@ class GmiiSource(Reset): def idle(self): return self.empty() and not self.active + def clear(self): + self.queue.clear() + self.queue_occupancy_bytes = 0 + self.queue_occupancy_frames = 0 + async def wait(self): while not self.idle(): await RisingEdge(self.clock) @@ -315,6 +320,11 @@ class GmiiSink(Reset): def idle(self): return not self.active + def clear(self): + self.queue.clear() + self.queue_occupancy_bytes = 0 + self.queue_occupancy_frames = 0 + async def wait(self, timeout=0, timeout_unit=None): if not self.empty(): return diff --git a/cocotbext/eth/mii.py b/cocotbext/eth/mii.py index f62302f..f1d7395 100644 --- a/cocotbext/eth/mii.py +++ b/cocotbext/eth/mii.py @@ -94,6 +94,11 @@ class MiiSource(Reset): def idle(self): return self.empty() and not self.active + def clear(self): + self.queue.clear() + self.queue_occupancy_bytes = 0 + self.queue_occupancy_frames = 0 + async def wait(self): while not self.idle(): await RisingEdge(self.clock) @@ -226,6 +231,11 @@ class MiiSink(Reset): def idle(self): return not self.active + def clear(self): + self.queue.clear() + self.queue_occupancy_bytes = 0 + self.queue_occupancy_frames = 0 + async def wait(self, timeout=0, timeout_unit=None): if not self.empty(): return diff --git a/cocotbext/eth/rgmii.py b/cocotbext/eth/rgmii.py index 8c816dd..de44d6a 100644 --- a/cocotbext/eth/rgmii.py +++ b/cocotbext/eth/rgmii.py @@ -92,6 +92,11 @@ class RgmiiSource(Reset): def idle(self): return self.empty() and not self.active + def clear(self): + self.queue.clear() + self.queue_occupancy_bytes = 0 + self.queue_occupancy_frames = 0 + async def wait(self): while not self.idle(): await RisingEdge(self.clock) @@ -237,6 +242,11 @@ class RgmiiSink(Reset): def idle(self): return not self.active + def clear(self): + self.queue.clear() + self.queue_occupancy_bytes = 0 + self.queue_occupancy_frames = 0 + async def wait(self, timeout=0, timeout_unit=None): if not self.empty(): return diff --git a/cocotbext/eth/xgmii.py b/cocotbext/eth/xgmii.py index 77f88ad..42ec42c 100644 --- a/cocotbext/eth/xgmii.py +++ b/cocotbext/eth/xgmii.py @@ -182,6 +182,11 @@ class XgmiiSource(Reset): def idle(self): return self.empty() and not self.active + def clear(self): + self.queue.clear() + self.queue_occupancy_bytes = 0 + self.queue_occupancy_frames = 0 + async def wait(self): while not self.idle(): await RisingEdge(self.clock) @@ -335,6 +340,11 @@ class XgmiiSink(Reset): def idle(self): return not self.active + def clear(self): + self.queue.clear() + self.queue_occupancy_bytes = 0 + self.queue_occupancy_frames = 0 + async def wait(self, timeout=0, timeout_unit=None): if not self.empty(): return