def __init__(self,name,parent,dut):
        Infrastructure.__init__(self,name,parent)

        self.txCmdScordboard = ScorboardInOrder("txCmdScordboard",self)
        self.txDataScordboard = ScorboardInOrder("txDataScordboard",self)
        StreamMonitor(Stream(dut,"io_tx_cmd"), self.txCmdScordboard.uutPush, dut.clk, dut.reset)
        StreamMonitor(Stream(dut, "io_tx_data"), self.txDataScordboard.uutPush, dut.clk, dut.reset)

        cmd = Transaction()
        cmd.ip = 0x33445566
        cmd.dstPort = 0x3456
        cmd.srcPort = 37984
        cmd.length  = 1+8
        self.txCmdScordboard.refPush(cmd)

        cmd = Transaction()
        cmd.ip = 0x44556677
        cmd.dstPort = 0x4567
        cmd.srcPort = 37984
        cmd.length  = 1+8
        self.txCmdScordboard.refPush(cmd)

        for i in range(2):
            data = Transaction()
            data.fragment = 0x22
            data.last = 0
            self.txDataScordboard.refPush(data)
            message = "test1234"
            for f in range(len(message)):
                data = Transaction()
                data.fragment = ord(message[f])
                data.last = (f == len(message)-1)
                self.txDataScordboard.refPush(data)
    def genRxCmd(self):
        while self.getPhase() != PHASE_SIM:
            yield None

        trans = Transaction()
        trans.ip = 0x11223344
        trans.srcPort = 0x1234
        trans.dstPort = 0x1111
        trans.length  = 2
        trans.nextDelay = 6
        yield trans

        trans = Transaction()
        trans.ip = 0x22334455
        trans.srcPort = 0x2345
        trans.dstPort = 37984
        trans.length  = 2
        trans.nextDelay = 3
        yield trans

        trans = Transaction()
        trans.ip = 0x33445566
        trans.srcPort = 0x3456
        trans.dstPort = 37984
        trans.length  = 1
        trans.nextDelay = 6
        yield trans

        trans = Transaction()
        trans.ip = 0x44556677
        trans.srcPort = 0x4567
        trans.dstPort = 37984
        trans.length  = 1
        trans.nextDelay = 6
        yield trans

        while True:
            yield None
Beispiel #3
0
    def rxThread(self):
        while True:
            data, addr = self.sock.recvfrom(2048)
            print "received message:", data, addr

            cmdTrans = Transaction()
            ipSplit = addr[0].split(".")
            cmdTrans.ip = 0
            for i in range(4):
                cmdTrans.ip |= int(ipSplit[i]) << (i * 8)
            cmdTrans.srcPort = addr[1]
            cmdTrans.dstPort = SERVER_PORT
            cmdTrans.length = len(data)
            self.rxCmdQueue.put(cmdTrans)

            for i in range(len(data)):
                dataTrans = Transaction()
                dataTrans.last = (i == len(data) - 1)
                dataTrans.fragment = ord(data[i])
                self.rxDataQueue.put(dataTrans)

            self.clkTocken[0] += 1000