Skip to content

Commit

Permalink
Fixed hready beh. of AHB slave to match AMBA ARM spec
Browse files Browse the repository at this point in the history
Signed-off-by: Anderson Ignacio da Silva <[email protected]>
  • Loading branch information
aignacio committed Sep 9, 2024
1 parent a164bfc commit cc8c817
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
22 changes: 19 additions & 3 deletions cocotbext/ahb/ahb_slave.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# License : MIT license <Check LICENSE>
# Author : Anderson I. da Silva (aignacio) <[email protected]>
# Date : 16.10.2023
# Last Modified Date: 09.06.2024
# Last Modified Date: 09.09.2024

import cocotb
import logging
Expand Down Expand Up @@ -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())
Expand Down Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion cocotbext/ahb/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.3.4"
__version__ = "0.3.5"

0 comments on commit cc8c817

Please sign in to comment.