class WriteDataMonitor(Infrastructure): def __init__(self,name,parent,axi,dut): Infrastructure.__init__(self,name,parent) self.axi = axi self.dut = dut self.dataScoreboard = ScorboardInOrder("scoreboard", self) def createInfrastructure(self): StreamMonitor(self.axi.aw, self.onWriteCmd, self.dut.clk, self.dut.reset) StreamMonitor(self.axi.w, self.onWriteData, self.dut.clk, self.dut.reset) def onWriteCmd(self,cmd): for i in range(cmd.len + 1): writeData = Transaction() writeData.data = cmd.addr + i writeData.strb = (cmd.addr + i) & 0xF writeData.last = 1 if i == cmd.len else 0 self.dataScoreboard.refPush(writeData) def onWriteData(self,trans): self.dataScoreboard.uutPush(trans)
class WriteDataMonitor(Infrastructure): def __init__(self,name,parent,axi,dut): Infrastructure.__init__(self,name,parent) self.axi = axi self.dut = dut self.dataScoreboard = ScorboardInOrder("scoreboard", self) def createInfrastructure(self): StreamMonitor(self.axi.aw, self.onWriteCmd, self.dut.clk, self.dut.reset) StreamMonitor(self.axi.w, self.onWriteData, self.dut.clk, self.dut.reset) def onWriteCmd(self,cmd): for i in xrange(cmd.len + 1): writeData = Transaction() writeData.data = cmd.addr + i writeData.strb = (cmd.addr + i) & 0xF writeData.last = 1 if i == cmd.len else 0 self.dataScoreboard.refPush(writeData) def onWriteData(self,trans): self.dataScoreboard.uutPush(trans)
class StreamFifoTester(Infrastructure): def __init__(self, name, parent, pushStream, popStream, transactionGenerator, dutCounterTarget, clk, reset): Infrastructure.__init__(self, name, parent) self.pushStream = pushStream self.popStream = popStream self.clk = clk self.reset = reset self.dutCounter = 0 self.closeIt = False self.transactionGenerator = transactionGenerator self.dutCounterTarget = dutCounterTarget self.pushRandomizer = BoolRandomizer() self.scoreboard = ScorboardInOrder("scoreboard", self) def createInfrastructure(self): StreamDriverMaster(self.pushStream, self.genPush, self.clk, self.reset) StreamDriverSlave(self.popStream, self.clk, self.reset) StreamMonitor(self.popStream, self.onUut, self.clk, self.reset) StreamMonitor(self.pushStream, self.onRef, self.clk, self.reset) def startPhase(self, phase): Infrastructure.startPhase(self, phase) if phase == PHASE_WAIT_TASKS_END: self.closeIt = True def genPush(self): if not self.closeIt and self.pushRandomizer.get(): return self.transactionGenerator() def onUut(self, uut): self.dutCounter += 1 self.scoreboard.uutPush(uut) def onRef(self, uut): self.scoreboard.refPush(uut) def canPhaseProgress(self, phase): return self.dutCounter > self.dutCounterTarget