hwt/interfaces/agents/handshaked.py
def driver(self, sim):
        """
        Push data to interface

        set vld high and wait on rd in high then pass new data
        """
        r = sim.read

        # pop new data if there are not any pending
        if self.actualData is NOP and self.data:
            self.actualData = self.data.popleft()

        doSend = self.actualData is not NOP

        # update data on signals if is required
        if self.actualData is not self._lastWritten:
            if doSend:
                self.doWrite(sim, self.actualData)
            else:
                self.doWrite(sim, None)
            self._lastWritten = self.actualData

        en = self.notReset(sim)
        vld = int(en and doSend)
        if self._lastVld is not vld:
            self.wrVld(sim.write, vld)
            self._lastVld = vld

        if not self._enabled:
            # we can not check rd it in this function because we can not wait
            # because we can be reactivated in this same time
            sim.add_process(self.checkIfRdWillBeValid(sim))
            return

        # wait of response of slave
        yield sim.waitOnCombUpdate()

        rd = self.isRd(r)
        assert rd.vldMask, (sim.now, self.intf,
                            "rd signal in invalid state")
        if not vld:
            return

        if rd.val:
            # slave did read data, take new one
            if self._debugOutput is not None:
                self._debugOutput.write("%s, wrote, %d: %r\n" % (
                    self.intf._getFullName(),
                    sim.now,
                    self.actualData))

            a = self.actualData
            # pop new data, because actual was read by slave
            if self.data:
                self.actualData = self.data.popleft()
            else:
                self.actualData = NOP

            # try to run onDriverWriteAck if there is any
            onDriverWriteAck = getattr(self, "onDriverWriteAck", None)
            if onDriverWriteAck is not None:
                onDriverWriteAck(sim)

            onDone = getattr(a, "onDone", None)
            if onDone is not None:
                onDone(sim)
def driver(self, sim):
        """
        Push data to interface

        set vld high and wait on rd in high then pass new data
        """
        r = sim.read

        # pop new data if there are not any pending
        if self.actualData is NOP and self.data:
            self.actualData = self.data.popleft()

        doSend = self.actualData is not NOP

        # update data on signals if is required
        if self.actualData is not self._lastWritten:
            if doSend:
                self.doWrite(sim, self.actualData)
            else:
                self.doWrite(sim, None)
            self._lastWritten = self.actualData

        en = self.notReset(sim)
        vld = int(en and doSend)
        if self._lastVld is not vld:
            self.wrVld(sim.write, vld)
            self._lastVld = vld

        if not self._enabled:
            # we can not check rd it in this function because we can not wait
            # because we can be reactivated in this same time
            sim.add_process(self.checkIfRdWillBeValid(sim))
            return

        # wait of response of slave
        yield sim.waitOnCombUpdate()

        rd = self.isRd(r)
        assert rd.vldMask, (sim.now, self.intf,
                            "rd signal in invalid state")
        if not vld:
            return

        if rd.val:
            # slave did read data, take new one
            if self._debugOutput is not None:
                self._debugOutput.write("%s, wrote, %d: %r\n" % (
                    self.intf._getFullName(),
                    sim.now,
                    self.actualData))

            a = self.actualData
            # pop new data, because actual was read by slave
            if self.data:
                self.actualData = self.data.popleft()
            else:
                self.actualData = NOP

            # try to run onDriverWriteAck if there is any
            onDriverWriteAck = getattr(self, "onDriverWriteAck", None)
            if onDriverWriteAck is not None:
                onDriverWriteAck(sim)

            onDone = getattr(a, "onDone", None)
            if onDone is not None:
                onDone(sim)
def driver ( self , sim ) : r = sim . read # pop new data if there are not any pending if self . actualData is NOP and self . data : self . actualData = self . data . popleft ( ) doSend = self . actualData is not NOP # update data on signals if is required if self . actualData is not self . _lastWritten : if doSend : self . doWrite ( sim , self . actualData ) else : self . doWrite ( sim , None ) self . _lastWritten = self . actualData en = self . notReset ( sim ) vld = int ( en and doSend ) if self . _lastVld is not vld : self . wrVld ( sim . write , vld ) self . _lastVld = vld if not self . _enabled : # we can not check rd it in this function because we can not wait # because we can be reactivated in this same time sim . add_process ( self . checkIfRdWillBeValid ( sim ) ) return # wait of response of slave yield sim . waitOnCombUpdate ( ) rd = self . isRd ( r ) assert rd . vldMask , ( sim . now , self . intf , "rd signal in invalid state" ) if not vld : return if rd . val : # slave did read data, take new one if self . _debugOutput is not None : self . _debugOutput . write ( "%s, wrote, %d: %r\n" % ( self . intf . _getFullName ( ) , sim . now , self . actualData ) ) a = self . actualData # pop new data, because actual was read by slave if self . data : self . actualData = self . data . popleft ( ) else : self . actualData = NOP # try to run onDriverWriteAck if there is any onDriverWriteAck = getattr ( self , "onDriverWriteAck" , None ) if onDriverWriteAck is not None : onDriverWriteAck ( sim ) onDone = getattr ( a , "onDone" , None ) if onDone is not None : onDone ( sim )
Push data to interface

        set vld high and wait on rd in high then pass new data
Push data to interface