def getmem(addr, len, flags): testUtil.runCycles(RUN_CYCLES) req = (getsingleword(6) + [0, 0, 0xA4, 0x01] + getsingleword(flags) + getdoubleword(addr) + getsingleword(len)) testUtil.writeUsFifo(req) testUtil.writeEot() # read data data = [] lenExp = len if (flags & 0x0008): lenExp += int(len / 8) if (flags & 0x0010): lenExp += int(len / 8) for i in range(0, int(-(-float(lenExp) // 4))): data += list(testUtil.readDsEntryReturnVal()) readLen = testUtil.readDsEntryReturnVal() if (getsingleword(lenExp) != list(readLen)): print getsingleword(lenExp) print list(readLen) raise Exception("Invalid Length") expResp = [ 0xc0, 0xde, 0xa4, 0x01, 0x0, 0x0, 0x0, 0x0, 0x00, 0x0, 0x0, 0x03 ] testUtil.readDsFifo(expResp) testUtil.readEot() return data[:lenExp]
def getscom(addr, expStatus=[0, 0, 0, 0], HWPffdc=False): req = ([0, 0, 0, 4] + [0, 0, 0xA2, 0x01] + getdoubleword(addr)) testUtil.writeUsFifo(req) testUtil.writeEot() expData = ([0xc0, 0xde, 0xa2, 0x01] + expStatus) success = False if (expStatus == [0, 0, 0, 0]): success = True data = [0] * 8 if (success): data = testUtil.readDsEntryReturnVal() data += testUtil.readDsEntryReturnVal() testUtil.readDsFifo(expData) if (not success and HWPffdc): testUtil.extractHWPFFDC() #flush out distance testUtil.readDsEntryReturnVal() testUtil.readEot() val = 0 for i in range(0, 8): val |= data[i] << ((7 - i) * 8) return val
def getsram(addr, mode, length, primStatus, secStatus): req = (getsingleword(0x05) + getsingleword(0xa403) + getsingleword(mode) + getsingleword(addr) + getsingleword(length)) testUtil.runCycles(10000000) testUtil.writeUsFifo(req) testUtil.writeEot() data = [] if ((primStatus != 0) or (secStatus != 0)): length = 0 for i in range(0, int(-(-float(length) // 4))): data += list(testUtil.readDsEntryReturnVal()) readLen = testUtil.readDsEntryReturnVal() if (getsingleword(length) != list(readLen)): print getsingleword(length) print list(readLen) raise Exception("Invalid Length") expResp = (getsingleword(0xc0dea403) + gethalfword(primStatus) + gethalfword(secStatus) + getsingleword(0x03)) testUtil.readDsFifo(expResp) testUtil.readEot() return data[:length]
def main(): testUtil.runCycles(10000000) print("\nStarting putscom test") testUtil.writeUsFifo(PUTSCOM_TESTDATA) testUtil.writeEot() testUtil.readDsFifo(PUTSCOM_EXPDATA) testUtil.readEot() print("\nStarting invalid putscom test") testUtil.writeUsFifo(PUTSCOM_TESTDATA_INVALID) testUtil.writeEot() testUtil.readDsFifo(PUTSCOM_EXPDATA_INVALID) testUtil.extractHWPFFDC() #flush out distance testUtil.readDsEntryReturnVal() testUtil.readEot() print("\nStarting getscom test") testUtil.writeUsFifo(GETSCOM_TESTDATA) testUtil.writeEot() testUtil.readDsFifo(GETSCOM_EXPDATA) testUtil.readEot() print("\nStarting invalid getscom test") testUtil.writeUsFifo(GETSCOM_TESTDATA_INVALID) testUtil.writeEot() testUtil.readDsFifo(GETSCOM_EXPDATA_INVALID) testUtil.extractHWPFFDC() #flush out distance testUtil.readDsEntryReturnVal() testUtil.readEot()
def putScomUnderMask(addr, data, mask, expStatus=[0, 0, 0, 0]): req = ([0, 0, 0, 8, 0, 0, 0xA2, 0x04] + getdoubleword(addr) + getdoubleword(data) + getdoubleword(mask)) testUtil.writeUsFifo(req) testUtil.writeEot() expData = ([0xc0, 0xde, 0xa2, 0x04] + expStatus) success = False if (expStatus == [0, 0, 0, 0]): success = True testUtil.readDsFifo(expData) #flush out distance testUtil.readDsEntryReturnVal() testUtil.readEot()
def modifyScom(operation, addr, data, expStatus=[0, 0, 0, 0]): req = ([0, 0, 0, 7, 0, 0, 0xA2, 0x03] + getsingleword(operation) + getdoubleword(addr) + getdoubleword(data)) testUtil.writeUsFifo(req) testUtil.writeEot() expData = ([0xc0, 0xde, 0xa2, 0x03] + expStatus) success = False if (expStatus == [0, 0, 0, 0]): success = True testUtil.readDsFifo(expData) #flush out distance testUtil.readDsEntryReturnVal() testUtil.readEot()
def main(): testUtil.runCycles(10000000) #Try an invalid data case testUtil.writeUsFifo(INST_INVALID_TESTDATA) testUtil.writeEot() testUtil.readDsFifo(INST_INVALID_EXPDATA_ERR) testUtil.readEot() # Control Instruction Message - Stop testUtil.writeUsFifo(INST_STOP_0_0_TESTDATA_WITH_WARN_FLG) testUtil.writeEot() testUtil.readDsFifo(INST_EXPDATA) testUtil.readEot() testUtil.writeUsFifo(INST_STOP_0_1_TESTDATA_WITH_WARN_FLG) testUtil.writeEot() testUtil.readDsFifo(INST_EXPDATA) testUtil.readEot() testUtil.writeUsFifo(INST_STOP_0_2_TESTDATA_WITH_WARN_FLG) testUtil.writeEot() testUtil.readDsFifo(INST_EXPDATA) testUtil.readEot() testUtil.writeUsFifo(INST_STOP_0_3_TESTDATA_WITH_WARN_FLG) testUtil.writeEot() testUtil.readDsFifo(INST_EXPDATA) testUtil.readEot() testUtil.writeUsFifo(INST_STOP_0_0_TESTDATA_WITHOUT_WARN_FLG) testUtil.writeEot() testUtil.readDsFifo(STOP_INST_EXPDATA_ERR_WTH_FFDC) testUtil.extractHWPFFDC() #flush out distance testUtil.readDsEntryReturnVal() testUtil.readEot() testUtil.writeUsFifo(INST_STOP_0_1_TESTDATA_WITHOUT_WARN_FLG) testUtil.writeEot() testUtil.readDsFifo(STOP_INST_EXPDATA_ERR_WTH_FFDC) testUtil.extractHWPFFDC() #flush out distance testUtil.readDsEntryReturnVal() testUtil.readEot() testUtil.writeUsFifo(INST_STOP_0_2_TESTDATA_WITHOUT_WARN_FLG) testUtil.writeEot() testUtil.readDsFifo(STOP_INST_EXPDATA_ERR_WTH_FFDC) testUtil.extractHWPFFDC() #flush out distance testUtil.readDsEntryReturnVal() testUtil.readEot() testUtil.writeUsFifo(INST_STOP_0_3_TESTDATA_WITHOUT_WARN_FLG) testUtil.writeEot() testUtil.readDsFifo(STOP_INST_EXPDATA_ERR_WTH_FFDC) testUtil.extractHWPFFDC() #flush out distance testUtil.readDsEntryReturnVal() testUtil.readEot() #stop all thread in core0 testUtil.writeUsFifo(INST_STOP0_ALL_TESTDATA_WITH_WARN_FLG) testUtil.writeEot() testUtil.readDsFifo(INST_EXPDATA) testUtil.readEot() testUtil.writeUsFifo(INST_STOP0_ALL_TESTDATA_WITHOUT_WARN_FLG) testUtil.writeEot() testUtil.readDsFifo(STOP_INST_EXPDATA_ERR_WTH_FFDC) testUtil.extractHWPFFDC() #flush out distance testUtil.readDsEntryReturnVal() testUtil.readEot() # Control Instruction Message - Start testUtil.writeUsFifo(INST_START_0_0_TESTDATA_WITH_WARN_FLG) testUtil.writeEot() testUtil.readDsFifo(INST_EXPDATA) testUtil.readEot() testUtil.writeUsFifo(INST_START_0_1_TESTDATA_WITH_WARN_FLG) testUtil.writeEot() testUtil.readDsFifo(INST_EXPDATA) testUtil.readEot() testUtil.writeUsFifo(INST_START_0_2_TESTDATA_WITH_WARN_FLG) testUtil.writeEot() testUtil.readDsFifo(INST_EXPDATA) testUtil.readEot() testUtil.writeUsFifo(INST_START_0_3_TESTDATA_WITH_WARN_FLG) testUtil.writeEot() testUtil.readDsFifo(INST_EXPDATA) testUtil.readEot() testUtil.writeUsFifo(INST_START_0_0_TESTDATA_WITHOUT_WARN_FLG) testUtil.writeEot() testUtil.readDsFifo(START_INST_EXPDATA_ERR_WTH_FFDC) testUtil.extractHWPFFDC() #flush out distance testUtil.readDsEntryReturnVal() testUtil.readEot() testUtil.writeUsFifo(INST_START_0_1_TESTDATA_WITHOUT_WARN_FLG) testUtil.writeEot() testUtil.readDsFifo(START_INST_EXPDATA_ERR_WTH_FFDC) testUtil.extractHWPFFDC() #flush out distance testUtil.readDsEntryReturnVal() testUtil.readEot() testUtil.writeUsFifo(INST_START_0_2_TESTDATA_WITHOUT_WARN_FLG) testUtil.writeEot() testUtil.readDsFifo(START_INST_EXPDATA_ERR_WTH_FFDC) testUtil.extractHWPFFDC() #flush out distance testUtil.readDsEntryReturnVal() testUtil.readEot() testUtil.writeUsFifo(INST_START_0_3_TESTDATA_WITHOUT_WARN_FLG) testUtil.writeEot() testUtil.readDsFifo(START_INST_EXPDATA_ERR_WTH_FFDC) testUtil.extractHWPFFDC() #flush out distance testUtil.readDsEntryReturnVal() testUtil.readEot() #start all thread in core0 testUtil.writeUsFifo(INST_START0_ALL_TESTDATA_WITH_WARN_FLG) testUtil.writeEot() testUtil.readDsFifo(INST_EXPDATA) testUtil.readEot() testUtil.writeUsFifo(INST_START0_ALL_TESTDATA_WITHOUT_WARN_FLG) testUtil.writeEot() testUtil.readDsFifo(START_INST_EXPDATA_ERR_WTH_FFDC) testUtil.extractHWPFFDC() #flush out distance testUtil.readDsEntryReturnVal() testUtil.readEot() # Control Instruction Message - Step testUtil.writeUsFifo(INST_STEP_0_0_TESTDATA_WITH_WARN_FLG) testUtil.writeEot() testUtil.readDsFifo(INST_EXPDATA) testUtil.readEot() testUtil.writeUsFifo(INST_STEP_0_1_TESTDATA_WITH_WARN_FLG) testUtil.writeEot() testUtil.readDsFifo(INST_EXPDATA) testUtil.readEot() testUtil.writeUsFifo(INST_STEP_0_2_TESTDATA_WITH_WARN_FLG) testUtil.writeEot() testUtil.readDsFifo(INST_EXPDATA) testUtil.readEot() testUtil.writeUsFifo(INST_STEP_0_3_TESTDATA_WITH_WARN_FLG) testUtil.writeEot() testUtil.readDsFifo(INST_EXPDATA) testUtil.readEot() testUtil.writeUsFifo(INST_STEP_0_0_TESTDATA_WITHOUT_WARN_FLG) testUtil.writeEot() testUtil.readDsFifo(STEP_INST_EXPDATA_ERR_WTH_FFDC) testUtil.extractHWPFFDC() #flush out distance testUtil.readDsEntryReturnVal() testUtil.readEot() testUtil.writeUsFifo(INST_STEP_0_1_TESTDATA_WITHOUT_WARN_FLG) testUtil.writeEot() testUtil.readDsFifo(STEP_INST_EXPDATA_ERR_WTH_FFDC) testUtil.extractHWPFFDC() #flush out distance testUtil.readDsEntryReturnVal() testUtil.readEot() testUtil.writeUsFifo(INST_STEP_0_2_TESTDATA_WITHOUT_WARN_FLG) testUtil.writeEot() testUtil.readDsFifo(STEP_INST_EXPDATA_ERR_WTH_FFDC) testUtil.extractHWPFFDC() #flush out distance testUtil.readDsEntryReturnVal() testUtil.readEot() testUtil.writeUsFifo(INST_STEP_0_3_TESTDATA_WITHOUT_WARN_FLG) testUtil.writeEot() testUtil.readDsFifo(STEP_INST_EXPDATA_ERR_WTH_FFDC) testUtil.extractHWPFFDC() #flush out distance testUtil.readDsEntryReturnVal() testUtil.readEot() #step all thread in core0 testUtil.writeUsFifo(INST_STEP0_ALL_TESTDATA_WITH_WARN_FLG) testUtil.writeEot() testUtil.readDsFifo(INST_EXPDATA) testUtil.readEot() testUtil.writeUsFifo(INST_STEP0_ALL_TESTDATA_WITHOUT_WARN_FLG) testUtil.writeEot() testUtil.readDsFifo(STEP_INST_EXPDATA_ERR_WTH_FFDC) testUtil.extractHWPFFDC() #flush out distance testUtil.readDsEntryReturnVal() testUtil.readEot() # Control Instruction Message - Sreset testUtil.writeUsFifo(INST_SRESET_0_0_TESTDATA_WITH_WARN_FLG) testUtil.writeEot() testUtil.readDsFifo(INST_EXPDATA) testUtil.readEot() testUtil.writeUsFifo(INST_SRESET_0_1_TESTDATA_WITH_WARN_FLG) testUtil.writeEot() testUtil.readDsFifo(INST_EXPDATA) testUtil.readEot() testUtil.writeUsFifo(INST_SRESET_0_2_TESTDATA_WITH_WARN_FLG) testUtil.writeEot() testUtil.readDsFifo(INST_EXPDATA) testUtil.readEot() testUtil.writeUsFifo(INST_SRESET_0_3_TESTDATA_WITH_WARN_FLG) testUtil.writeEot() testUtil.readDsFifo(INST_EXPDATA) testUtil.readEot() testUtil.writeUsFifo(INST_SRESET_0_0_TESTDATA_WITHOUT_WARN_FLG) testUtil.writeEot() testUtil.readDsFifo(INST_EXPDATA) testUtil.readEot() testUtil.writeUsFifo(INST_SRESET_0_1_TESTDATA_WITHOUT_WARN_FLG) testUtil.writeEot() testUtil.readDsFifo(INST_EXPDATA) testUtil.readEot() testUtil.writeUsFifo(INST_SRESET_0_2_TESTDATA_WITHOUT_WARN_FLG) testUtil.writeEot() testUtil.readDsFifo(INST_EXPDATA) testUtil.readEot() testUtil.writeUsFifo(INST_SRESET_0_3_TESTDATA_WITHOUT_WARN_FLG) testUtil.writeEot() testUtil.readDsFifo(INST_EXPDATA) testUtil.readEot() #step all thread in core0 testUtil.writeUsFifo(INST_SRESET0_ALL_TESTDATA_WITH_WARN_FLG) testUtil.writeEot() testUtil.readDsFifo(INST_EXPDATA) testUtil.readEot() testUtil.writeUsFifo(INST_SRESET0_ALL_TESTDATA_WITHOUT_WARN_FLG) testUtil.writeEot() testUtil.readDsFifo(INST_EXPDATA) testUtil.readEot()
def main(): testUtil.runCycles(10000000) # Generate FSPI rc testScomUtil.getscom(0x0A000000, [0x00, 0xFE, 0x00, 0x11], True) testUtil.writeUsFifo(TESTDATA) testUtil.writeEot() print("\n HWP internal ffdc") testUtil.extractHWPFFDC(True) print("\n SBE internal ffdc") data = testUtil.readDsEntryReturnVal() magicBytes = ((data[0] << 8) | data[1]) if (magicBytes == 0xFFDC): print("\nMagic Bytes Match") else: raise Exception('data mistmach') packLen = ((data[2] << 8) | data[3]) print("\nFFDC package length = " + str(packLen)) # extract Sequence ID, Command class and command data = testUtil.readDsEntryReturnVal() seqId = ((data[0] << 24) | (data[1] << 16)) cmdClass = data[2] cmd = data[3] print("\n SeqId [" + str(seqId) + "] CmdClass [" + str(cmdClass) + "] Cmd [" + str(cmd) + "]") data = testUtil.readDsEntryReturnVal() fapiRc = ((data[0] << 24) | (data[1] << 16) | (data[2] << 8) | data[3]) print("\nFAPI rc = " + str(hex(fapiRc))) data = testUtil.readDsEntryReturnVal() primaryStatus = ((data[0] << 8) | data[1]) secondaryStatus = ((data[2] << 8) | data[3]) print ("\nPrimary Status " + str(hex(primaryStatus)) + " Secondary Status "\ + str(hex(secondaryStatus))) data = testUtil.readDsEntryReturnVal() commitID = ((data[0] << 24) | (data[1] << 16) | (data[2] << 8) | data[3]) print("\ncommitID = " + str(hex(commitID))) data = testUtil.readDsEntryReturnVal() ddLevel = ((data[0] << 24) | (data[1] << 16) | (data[2] << 8) | data[3]) print("\nddLevel = " + str(hex(ddLevel))) data = testUtil.readDsEntryReturnVal() header = ((data[0] << 24) | (data[1] << 16) | (data[2] << 8) | data[3]) print("\nHeader = " + str(hex(header))) for i in range(0, (bin(header).count("1"))): #read user data id data = testUtil.readDsEntryReturnVal() id = (data[0] << 8) | data[1] print "User data Id [" + str(hex(id)) + "]" len = (data[2] << 8) | data[3] #if it is trace field SBE_FFDC_TRACE_DUMP fileName = "" if (id == 0x0002): fileName = "trace.bin" print("\nlength of trace dump " + str(len)) #if it is trace field SBE_FFDC_ATTR_DUMP elif (id == 0x0001): fileName = "attr.bin" print("\nlength of attr dump " + str(len)) myBin = open(fileName, 'wb') print("\nwriting " + fileName) loopCount = (len) / 4 for j in range(0, loopCount): data = testUtil.readDsEntryReturnVal() myBin.write(bytearray(data)) print("write to a file Done") myBin.close() print("Read the Expected data") testUtil.readDsFifo(EXPDATA) print("Read Eot") testUtil.readEot()