diff --git a/cocotbext/ahb/ahb_bus.py b/cocotbext/ahb/ahb_bus.py index 1edd622..4e5bd8d 100644 --- a/cocotbext/ahb/ahb_bus.py +++ b/cocotbext/ahb/ahb_bus.py @@ -4,7 +4,7 @@ # License : MIT license # Author : Anderson I. da Silva (aignacio) # Date : 08.10.2023 -# Last Modified Date: 22.10.2023 +# Last Modified Date: 12.11.2023 from cocotb_bus.drivers import Bus from cocotb.handle import SimHandleBase @@ -12,28 +12,47 @@ class AHBBus(Bus): - _signals = ["haddr", "hsize", "htrans", "hwdata", - "hrdata", "hwrite", "hready", "hresp"] - - _optional_signals = ["hburst", "hmastlock", "hprot", "hnonsec", - "hexcl", "hmaster", "hexokay", "hsel", "hready_in"] - - def __init__(self, entity: SimHandleBase = None, - prefix: str = None, **kwargs: Any) -> None: - - name = prefix if prefix is not None else entity._name + '_ahb_bus' - - #Handle default signals or signals overrided at an upper level + _signals = [ + "haddr", + "hsize", + "htrans", + "hwdata", + "hrdata", + "hwrite", + "hready", + "hresp", + ] + + _optional_signals = [ + "hburst", + "hmastlock", + "hprot", + "hnonsec", + "hexcl", + "hmaster", + "hexokay", + "hsel", + "hready_in", + ] + + def __init__( + self, entity: SimHandleBase = None, prefix: str = None, **kwargs: Any + ) -> None: + name = prefix if prefix is not None else entity._name + "_ahb_bus" + + # Handle default signals or signals overrided at an upper level if "signals" not in kwargs: kwargs["signals"] = self._signals else: entity._log.info(f"AHB ({name}) master use provided signals mapping") - #Handle default optional_signals or optional_signals overrided at an upper level + # Handle default optional_signals or optional_signals overrided at an upper level if "optional_signals" not in kwargs: kwargs["optional_signals"] = self._signals else: - entity._log.info(f"AHB ({name}) master use provided optional_signals mapping") + entity._log.info( + f"AHB ({name}) master use provided optional_signals mapping" + ) super().__init__(entity, prefix, **kwargs) self.entity = entity @@ -51,15 +70,15 @@ def addr_width(self): @property def hsel_exist(self): - return True if 'hsel' in self._signals else False + return True if "hsel" in self._signals else False @property def hready_in_exist(self): - return True if 'hready_in' in self._signals else False + return True if "hready_in" in self._signals else False @property def hburst_exist(self): - return True if 'hburst' in self._signals else False + return True if "hburst" in self._signals else False @classmethod def from_entity(cls, entity, **kwargs): diff --git a/cocotbext/ahb/version.py b/cocotbext/ahb/version.py index f1380ee..9cb17e7 100644 --- a/cocotbext/ahb/version.py +++ b/cocotbext/ahb/version.py @@ -1 +1 @@ -__version__ = "0.1.7" +__version__ = "0.1.8"