hwt/interfaces/agents/handshaked.py
def monitor(self, sim):
        """
        Collect data from interface
        """
        r = sim.read
        if self.notReset(sim):
            # update rd signal only if required
            if self._lastRd is not 1:
                self.wrRd(sim.write, 1)
                self._lastRd = 1

                # try to run onMonitorReady if there is any
                try:
                    onMonitorReady = self.onMonitorReady
                except AttributeError:
                    onMonitorReady = None

                if onMonitorReady is not None:
                    onMonitorReady(sim)

            # wait for response of master
            yield sim.waitOnCombUpdate()
            vld = self.isVld(r)
            assert vld.vldMask, (sim.now, self.intf,
                                 "vld signal is in invalid state")

            if vld.val:
                # master responded with positive ack, do read data
                d = self.doRead(sim)
                if self._debugOutput is not None:
                    self._debugOutput.write(
                        "%s, read, %d: %r\n" % (
                            self.intf._getFullName(),
                            sim.now, d))
                self.data.append(d)
                if self._afterRead is not None:
                    self._afterRead(sim)
        else:
            if self._lastRd is not 0:
                # can not receive, say it to masters
                self.wrRd(sim.write, 0)
                self._lastRd = 0
def monitor(self, sim):
        """
        Collect data from interface
        """
        r = sim.read
        if self.notReset(sim):
            # update rd signal only if required
            if self._lastRd is not 1:
                self.wrRd(sim.write, 1)
                self._lastRd = 1

                # try to run onMonitorReady if there is any
                try:
                    onMonitorReady = self.onMonitorReady
                except AttributeError:
                    onMonitorReady = None

                if onMonitorReady is not None:
                    onMonitorReady(sim)

            # wait for response of master
            yield sim.waitOnCombUpdate()
            vld = self.isVld(r)
            assert vld.vldMask, (sim.now, self.intf,
                                 "vld signal is in invalid state")

            if vld.val:
                # master responded with positive ack, do read data
                d = self.doRead(sim)
                if self._debugOutput is not None:
                    self._debugOutput.write(
                        "%s, read, %d: %r\n" % (
                            self.intf._getFullName(),
                            sim.now, d))
                self.data.append(d)
                if self._afterRead is not None:
                    self._afterRead(sim)
        else:
            if self._lastRd is not 0:
                # can not receive, say it to masters
                self.wrRd(sim.write, 0)
                self._lastRd = 0
def monitor ( self , sim ) : r = sim . read if self . notReset ( sim ) : # update rd signal only if required if self . _lastRd is not 1 : self . wrRd ( sim . write , 1 ) self . _lastRd = 1 # try to run onMonitorReady if there is any try : onMonitorReady = self . onMonitorReady except AttributeError : onMonitorReady = None if onMonitorReady is not None : onMonitorReady ( sim ) # wait for response of master yield sim . waitOnCombUpdate ( ) vld = self . isVld ( r ) assert vld . vldMask , ( sim . now , self . intf , "vld signal is in invalid state" ) if vld . val : # master responded with positive ack, do read data d = self . doRead ( sim ) if self . _debugOutput is not None : self . _debugOutput . write ( "%s, read, %d: %r\n" % ( self . intf . _getFullName ( ) , sim . now , d ) ) self . data . append ( d ) if self . _afterRead is not None : self . _afterRead ( sim ) else : if self . _lastRd is not 0 : # can not receive, say it to masters self . wrRd ( sim . write , 0 ) self . _lastRd = 0
Collect data from interface
Collect data from interface