Source code for hwtLib.handshaked.compBase

from hwt.interfaces.std import Handshaked, HandshakeSync
from hwt.pyUtils.arrayQuery import where
from hwt.synthesizer.unit import Unit


[docs]class HandshakedCompBase(Unit):
[docs] def __init__(self, hsIntfCls): """ :param hsIntfCls: class of interface which should be used as interface of this unit """ assert(issubclass(hsIntfCls, (Handshaked, HandshakeSync))), hsIntfCls self.intfCls = hsIntfCls Unit.__init__(self)
[docs] def _config(self): self.intfCls._config(self)
[docs] def getVld(self, intf): return intf.vld
[docs] def getRd(self, intf): return intf.rd
[docs] def getData(self, intf): rd = self.getRd(intf) vld = self.getVld(intf) return list(where(intf._interfaces, lambda x: (x is not rd) and (x is not vld)))