Skip to content

Commit

Permalink
use names for access size types
Browse files Browse the repository at this point in the history
  • Loading branch information
M0stafaRady committed Oct 14, 2024
1 parent dcdc359 commit 33ae574
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion bus_env/bus_agent/bus_ahb_monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ async def address_phase(self, tr):
try:
tr.size = self.vif.HSIZE.value
except AttributeError:
tr.size = 2
tr.size = bus_item.WORD_ACCESS
tr = self.monitor_optional_signals_address(tr)
return tr

Expand Down
5 changes: 4 additions & 1 deletion bus_env/bus_item.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ class bus_item(UVMSequenceItem):
NOPE = 3 # Insert a no-op in the sequence
counter = 0

WORD_ACCESS = 2
HALF_WORD_ACCESS = 1
BYTE_ACCESS = 0
def __init__(self, name="bus_item"):
super().__init__(name)
self.tag = name
Expand All @@ -30,7 +33,7 @@ def __init__(self, name="bus_item"):
self.rand("kind", [bus_item.READ, bus_item.WRITE])
self.id = bus_item.counter
bus_item.counter += 1
self.size = 2 # 2 for word, 1 for half word, 0 for byte
self.size = bus_item.WORD_ACCESS # 2 for word, 1 for half word, 0 for byte

def convert2string(self):
if self.kind == bus_item.RESET:
Expand Down
2 changes: 1 addition & 1 deletion bus_env/bus_logger/bus_logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def bus_log(self, transaction, header_logged=False):
if type(transaction.data) is not int
else f"{hex(transaction.data)}"
)
size = f"{'word' if transaction.size == 2 else 'half word' if transaction.size == 1 else 'byte'}"
size = f"{'word' if transaction.size == bus_item.WORD_ACCESS else 'half word' if transaction.size == bus_item.HALF_WORD_ACCESS else 'byte'}"
# Now, assemble your table_data with the pre-formatted fields
table_data = [f"{sim_time}", f"{operation}", f"{address}", f"{data}", f"{size}"]
table = self.format_row(table_data)
Expand Down

0 comments on commit 33ae574

Please sign in to comment.