diff --git a/bus_env/bus_agent/bus_ahb_monitor.py b/bus_env/bus_agent/bus_ahb_monitor.py index 6d7cea1..99fd4bd 100644 --- a/bus_env/bus_agent/bus_ahb_monitor.py +++ b/bus_env/bus_agent/bus_ahb_monitor.py @@ -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 diff --git a/bus_env/bus_item.py b/bus_env/bus_item.py index 12215d7..976e8bb 100644 --- a/bus_env/bus_item.py +++ b/bus_env/bus_item.py @@ -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 @@ -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: diff --git a/bus_env/bus_logger/bus_logger.py b/bus_env/bus_logger/bus_logger.py index 1b943f1..0f4bdb6 100644 --- a/bus_env/bus_logger/bus_logger.py +++ b/bus_env/bus_logger/bus_logger.py @@ -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)