Skip to content

Commit

Permalink
Scoreboard working with non-pip txn
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 Jun 15, 2024
1 parent d9e5859 commit c53f28a
Show file tree
Hide file tree
Showing 5 changed files with 10,168 additions and 2,898 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -134,3 +134,4 @@ output
run_dir/
.nox/*
.DS_Store
*.txt
20 changes: 12 additions & 8 deletions cocotbext/ahb/ahb_master.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) <anderson@aignacio.com>
# Date : 08.10.2023
# Last Modified Date: 09.06.2024
# Last Modified Date: 15.06.2024

import cocotb
import logging
Expand Down Expand Up @@ -43,7 +43,9 @@ def __init__(
self._init_bus()
self.log.info(f"AHB ({name}) master")
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")

def _init_bus(self) -> None:
Expand Down Expand Up @@ -269,15 +271,17 @@ async def write(
if size is None:
size = [self.bus._data_width // 8 for _ in range(len(address))]
else:
if not isinstance(size, list):
size = [size]
for sz in size:
AHBLiteMaster._check_size(sz, len(self.bus.hwdata) // 8)

# Convert all inputs into lists, if not already

if not isinstance(value, list):
value = [value]
if not isinstance(size, list):
size = [size]
# if not isinstance(size, list):
# size = [size]

# First check if the input sizes are correct
if len(address) != len(value):
Expand Down Expand Up @@ -330,13 +334,13 @@ async def read(
if size is None:
size = [self.bus._data_width // 8 for _ in range(len(address))]
else:
# Convert all inputs into lists, if not already
if not isinstance(size, list):
size = [size]

for sz in size:
AHBLiteMaster._check_size(sz, len(self.bus.hwdata) // 8)

# Convert all inputs into lists, if not already
if not isinstance(size, list):
size = [size]

# First check if the input sizes are correct
if len(address) != len(size):
raise Exception(
Expand Down
16 changes: 15 additions & 1 deletion cocotbext/ahb/ahb_monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,11 +254,25 @@ def __init__(

def __str__(self):
return (
f"AHBTxn Details:\n"
f"AHB Txn Details:\n"
f" Address: 0x{self.addr:08X}\n"
f" Size: {2**self.size} bytes (0x{self.size:03X})\n"
f" Mode: {'Write' if self.mode == 1 else 'Read'} (0x{self.mode:01X})\n"
f" Response: {'OKAY' if self.resp == 0 else 'ERROR'} (0x{self.resp:02X})\n"
f" Write Data: 0x{self.wdata:08X}\n"
f" Read Data: 0x{self.rdata:08X}\n"
)

def __eq__(self, other):
# We have to override the default python comparison method for this class
# because the Scoreboard class will compare the txns
if isinstance(other, AHBTxn):
return (
self.addr == other.addr
and self.size == other.size
and self.mode == other.mode
and self.resp == other.resp
and self.wdata == other.wdata
and self.rdata == other.rdata
)
return False
Loading

0 comments on commit c53f28a

Please sign in to comment.