Skip to content

Commit

Permalink
Fixed flake errors and updated version
Browse files Browse the repository at this point in the history
Signed-off-by: Anderson Ignacio <anderson@aignacio.com>
  • Loading branch information
aignacio committed Nov 12, 2023
1 parent 5908129 commit 3b6a0c2
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 19 deletions.
55 changes: 37 additions & 18 deletions cocotbext/ahb/ahb_bus.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,36 +4,55 @@
# License : MIT license <Check LICENSE>
# Author : Anderson I. da Silva (aignacio) <anderson@aignacio.com>
# 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
from typing import Any


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
Expand All @@ -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):
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.1.7"
__version__ = "0.1.8"

0 comments on commit 3b6a0c2

Please sign in to comment.