diff --git a/cocotbext/ahb/ahb_slave.py b/cocotbext/ahb/ahb_slave.py index 79ec319..a46d418 100644 --- a/cocotbext/ahb/ahb_slave.py +++ b/cocotbext/ahb/ahb_slave.py @@ -4,7 +4,7 @@ # License : MIT license # Author : Anderson I. da Silva (aignacio) # Date : 16.10.2023 -# Last Modified Date: 09.06.2024 +# Last Modified Date: 09.09.2024 import cocotb import logging @@ -45,7 +45,9 @@ def __init__( self._init_bus() self.log.info(f"AHB ({name}) slave") self.log.info("cocotbext-ahb version %s", __version__) - self.log.info(f"Copyright (c) {datetime.datetime.now().year} Anderson Ignacio da Silva") + self.log.info( + f"Copyright (c) {datetime.datetime.now().year} Anderson Ignacio da Silva" + ) self.log.info("https://github.com/aignacio/cocotbext-ahb") cocotb.start_soon(self._proc_txn()) @@ -88,10 +90,24 @@ async def _proc_txn(self): self.bus.hresp.value = AHBResp.OKAY if self.bp is not None: - ready = next(self.bp) + if self.bus.hsel_exist and self.bus.hsel.value.is_resolvable: + if self.bus.hsel.value == 0: + ready = True + else: + ready = next(self.bp) + else: + ready = next(self.bp) + + if rd_start is False and wr_start is False: + ready = True # slave cannot bp on address phase + else: ready = True + if self.rst.value.is_resolvable: + if self.rst.value == 0: # Active 0 + ready = True + if ready: self.bus.hready.value = 1 diff --git a/cocotbext/ahb/version.py b/cocotbext/ahb/version.py index 334b899..a8d4557 100644 --- a/cocotbext/ahb/version.py +++ b/cocotbext/ahb/version.py @@ -1 +1 @@ -__version__ = "0.3.4" +__version__ = "0.3.5"