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
[docs]class Axi_id(Interface):
[docs] def _config(self):
self.ID_WIDTH = Param(1)
[docs] def _declr(self):
self.id = VectSignal(self.ID_WIDTH)
[docs]class Axi_user(Interface):
[docs] def _config(self):
self.USER_WIDTH = Param(1)
[docs] def _declr(self):
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):
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