Source code for hwtLib.amba.axi_intf_common

from hwt.hdl.constants import DIRECTION
from hwt.interfaces.std import VectSignal, Signal, HandshakeSync
from hwt.synthesizer.interface import Interface
from hwt.synthesizer.param import Param
from pycocotb.hdlSimulator import HdlSimulator


[docs]class Axi_id(Interface):
[docs] def _config(self, default_id_width=0): self.ID_WIDTH = Param(default_id_width)
[docs] def _declr(self): if self.ID_WIDTH: self.id = VectSignal(self.ID_WIDTH)
[docs]class Axi_user(Interface):
[docs] def _config(self): self.USER_WIDTH = Param(0)
[docs] def _declr(self): if self.USER_WIDTH: self.user = VectSignal(self.USER_WIDTH)
[docs]class Axi_strb(Interface):
[docs] def _declr(self): self.strb = VectSignal(self.DATA_WIDTH // 8)
[docs]class Axi_hs(HandshakeSync): """ AXI handshake interface with ready and valid signal (same as HandshakeSync just vld is valid and rd is ready) transaction happens when both ready and valid are high :ivar ~.ready: when high slave is ready to receive data :ivar ~.valid: when high master is sending data to slave """
[docs] def _declr(self): self.ready = Signal(masterDir=DIRECTION.IN) self.valid = Signal()
[docs] def _initSimAgent(self, sim: HdlSimulator): raise NotImplementedError()
[docs]def AxiMap(prefix, listOfNames, d=None): if d is None: d = {} for n in listOfNames: d[n] = (prefix + n).upper() return d