Skip to content

Commit

Permalink
Included hready_in into slave AHB check for txn completion
Browse files Browse the repository at this point in the history
Signed-off-by: Anderson Ignacio da Silva <anderson@aignacio.com>
  • Loading branch information
aignacio committed Sep 9, 2024
1 parent 63d8f99 commit 2264912
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
12 changes: 9 additions & 3 deletions cocotbext/ahb/ahb_slave.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,20 @@ async def _proc_txn(self):
if self.rst.value.is_resolvable:
if self.rst_act_low:
if self.rst.value == 0: # Active 0
self.log.warn("Slave AHB reset issued")
self._init_bus()
else:
if self.rst.value == 1: # Active 1
self.log.warn("Slave AHB reset issued")
self._init_bus()

# Wait for a txn
await RisingEdge(self.clk)

if self.bus.hready_in_exist:
cur_hready_in = copy.deepcopy(self.bus.hready_in.value)
else:
cur_hready_in = 1
cur_hready = copy.deepcopy(self.bus.hready.value)
cur_hresp = copy.deepcopy(self.bus.hresp.value)

Expand All @@ -103,19 +109,19 @@ async def _proc_txn(self):
self.bus.hresp.value = AHBResp.ERROR
error = False
else:
if rd_start and cur_hready:
if rd_start and cur_hready and cur_hready_in:
rd_start = False
self.bus.hrdata.value = 0

if wr_start and cur_hready:
if wr_start and cur_hready and cur_hready_in:
wr_start = False
if txn_type == AHBWrite.WRITE:
wr = self._wr(txn_addr, txn_size, self.bus.hwdata.value)
self.bus.hrdata.value = wr
self.bus.hresp.value = AHBResp.OKAY

# Check for new txn
if (cur_hready == 1) and self._check_inputs() and self._check_valid_txn():
if cur_hready and self._check_inputs() and self._check_valid_txn():
txn_addr = self.bus.haddr.value
txn_size = AHBSize(self.bus.hsize.value)
txn_type = AHBWrite(self.bus.hwrite.value)
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.9"
__version__ = "0.4.0"

0 comments on commit 2264912

Please sign in to comment.