增加新的测试用例,仿真实际中的情况
This commit is contained in:
@@ -48,6 +48,7 @@ if __name__ == '__main__':
|
|||||||
#add_tc_2_runlist(sync.tc4())
|
#add_tc_2_runlist(sync.tc4())
|
||||||
#add_tc_2_runlist(sync.tc5())
|
#add_tc_2_runlist(sync.tc5())
|
||||||
#add_tc_2_runlist(sync.tc6())
|
#add_tc_2_runlist(sync.tc6())
|
||||||
|
add_tc_2_runlist(sync.tc7())
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -73,8 +74,8 @@ if __name__ == '__main__':
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
add_tc_2_runlist(watchdog.tc1())
|
#add_tc_2_runlist(watchdog.tc1())
|
||||||
add_tc_2_runlist(watchdog.tc2())
|
#add_tc_2_runlist(watchdog.tc2())
|
||||||
|
|
||||||
environment.teardown()
|
environment.teardown()
|
||||||
|
|
||||||
|
|||||||
@@ -1102,8 +1102,356 @@ def tc6():
|
|||||||
+genIFRwDataCode(2, 0x74, False, 4)
|
+genIFRwDataCode(2, 0x74, False, 4)
|
||||||
+genIFRwDataCode(3, 0x74, False, 4)
|
+genIFRwDataCode(3, 0x74, False, 4)
|
||||||
+genIFRwDataCode(4, 0x74, False, 4)
|
+genIFRwDataCode(4, 0x74, False, 4)
|
||||||
|
|
||||||
|
#+"#5000000"
|
||||||
|
#+genIFRwDataCode(0, 0x40, True, 4, [0x01, 0x00, 0x66, 0x79])
|
||||||
+genTcEndFrameCode(gen_file_def)) #+genDisableInsertTimeCode())
|
+genTcEndFrameCode(gen_file_def)) #+genDisableInsertTimeCode())
|
||||||
|
|
||||||
|
|
||||||
genPkt.gen("./generated/shin/%s.vh"%(gen_file_def, ), 1, True, gen_file_def_ap)
|
genPkt.gen("./generated/shin/%s.vh"%(gen_file_def, ), 1, True, gen_file_def_ap)
|
||||||
|
return gen_file_def
|
||||||
|
|
||||||
|
|
||||||
|
def tc7():
|
||||||
|
genPkt = GenPkt()
|
||||||
|
|
||||||
|
gen_file_def = "sync_tc07"
|
||||||
|
sm_idx = 0
|
||||||
|
tc_des = ("同步后,SYNC信号采用脉冲触发,4个设备,4个周期;先用广播包发送公共周期;然后3,4,\\n"
|
||||||
|
"2设备单独指定周期。该同步数据之前没有补广播包。如果紧跟嗅探包而不是普通包之后,可能会影响同步。\\n"
|
||||||
|
"期望是无论前面发送得是什么包,都不会影响同步的效果。一段时间后,重新同步,期望不要打断sync\\n"
|
||||||
|
"信号的输出。需要在波形文件里查看具体的效果。"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
#>>>>>>设置同步信号的数据包
|
||||||
|
genPkt.clean()
|
||||||
|
genPkt.setPktType(0)
|
||||||
|
sm_idx = 3
|
||||||
|
|
||||||
|
genPkt.addBeforeExc(genTcStartFrameCode(gen_file_def, tc_des)
|
||||||
|
+genEnableInsertTimeCode(0xa)
|
||||||
|
+ '''spi_trans( (16'h0100), (`SPI_READ), (8), (`IF_IDX(0)));\n'''
|
||||||
|
+ '''_temp_time = rxBuf[3] + (rxBuf[4] << 8) + (rxBuf[5] << 16) + (rxBuf[6] << 24) + (rxBuf[7] << 32) + (rxBuf[8] << 40) + (rxBuf[9] << 48) + (rxBuf[10] << 56);\n'''
|
||||||
|
+ '''_temp_time = _temp_time + 32'h3000;\n\n''')
|
||||||
|
|
||||||
|
genPkt.addSubPkt(0x0, 0, 0x0, 0xc, 12, b'\0'*12)
|
||||||
|
|
||||||
|
#subPkt参数:索引、索引类型、地址、命令、长度、数据
|
||||||
|
data = [0,] * 100 #bytearray(b"\0" * 100)
|
||||||
|
data[0] = 0x0f #地址0x120
|
||||||
|
data[2] = 0xa
|
||||||
|
data[4] = 0xa
|
||||||
|
data[6] = 0xa
|
||||||
|
data[8] = 0xa
|
||||||
|
|
||||||
|
data[16] = '''(_temp_time & 8'hff)''' #地址0x130, sync同步点
|
||||||
|
data[17] = '''(_temp_time >> 8) & 8'hff''' #地址0x131
|
||||||
|
data[18] = '''(_temp_time >> 16) & 8'hff'''
|
||||||
|
data[19] = '''(_temp_time >> 24) & 8'hff'''
|
||||||
|
|
||||||
|
data[24] = 0x80 #地址0x138, sync周期 4B
|
||||||
|
data[25] = 0x00 #地址0x139
|
||||||
|
|
||||||
|
data[28] = 0x0 #sync1偏移
|
||||||
|
data[29] = 0x0
|
||||||
|
|
||||||
|
data[36] = 0x0#sync3偏移
|
||||||
|
data[37] = 0x0
|
||||||
|
|
||||||
|
genPkt.addSubPkt(0, 0, 0x120, 0xe, 0x28, data)
|
||||||
|
|
||||||
|
data = [0,] * 100 #bytearray(b"\0" * 100)
|
||||||
|
data[0] = 0x0f #地址0x120
|
||||||
|
data[2] = 0xa
|
||||||
|
data[4] = 0xa
|
||||||
|
data[6] = 0xa
|
||||||
|
data[8] = 0xa
|
||||||
|
|
||||||
|
data[16] = '''(_temp_time & 8'hff)''' #地址0x130, sync同步点
|
||||||
|
data[17] = '''(_temp_time >> 8) & 8'hff''' #地址0x131
|
||||||
|
data[18] = '''(_temp_time >> 16) & 8'hff'''
|
||||||
|
data[19] = '''(_temp_time >> 24) & 8'hff'''
|
||||||
|
|
||||||
|
data[24] = 0x00 #地址0x138, sync周期 4B
|
||||||
|
data[25] = 0x01 #地址0x139
|
||||||
|
|
||||||
|
data[28] = 0x0 #sync1偏移
|
||||||
|
data[29] = 0x0
|
||||||
|
|
||||||
|
data[36] = 0x0 #sync3偏移
|
||||||
|
data[37] = 0x0
|
||||||
|
|
||||||
|
genPkt.addSubPkt(3, 0, 0x120, 0x1, 0x28, data)
|
||||||
|
|
||||||
|
data = [0,] * 100 #bytearray(b"\0" * 100)
|
||||||
|
data[0] = 0x0f #地址0x120
|
||||||
|
data[2] = 0xa
|
||||||
|
data[4] = 0xa
|
||||||
|
data[6] = 0xa
|
||||||
|
data[8] = 0xa
|
||||||
|
|
||||||
|
data[16] = '''(_temp_time & 8'hff)''' #地址0x130, sync同步点
|
||||||
|
data[17] = '''(_temp_time >> 8) & 8'hff''' #地址0x131
|
||||||
|
data[18] = '''(_temp_time >> 16) & 8'hff'''
|
||||||
|
data[19] = '''(_temp_time >> 24) & 8'hff'''
|
||||||
|
|
||||||
|
data[24] = 0x00 #地址0x138, sync周期 4B
|
||||||
|
data[25] = 0x02 #地址0x139
|
||||||
|
|
||||||
|
data[28] = 0x0 #sync1偏移
|
||||||
|
data[29] = 0x0
|
||||||
|
|
||||||
|
data[36] = 0x0 #sync3偏移
|
||||||
|
data[37] = 0x0
|
||||||
|
|
||||||
|
genPkt.addSubPkt(4, 0, 0x120, 0x1, 0x28, data)
|
||||||
|
|
||||||
|
data = [0,] * 100 #bytearray(b"\0" * 100)
|
||||||
|
data[0] = 0x0f #地址0x120
|
||||||
|
data[2] = 0xa
|
||||||
|
data[4] = 0xa
|
||||||
|
data[6] = 0xa
|
||||||
|
data[8] = 0xa
|
||||||
|
|
||||||
|
data[16] = '''(_temp_time & 8'hff)''' #地址0x130, sync同步点
|
||||||
|
data[17] = '''(_temp_time >> 8) & 8'hff''' #地址0x131
|
||||||
|
data[18] = '''(_temp_time >> 16) & 8'hff'''
|
||||||
|
data[19] = '''(_temp_time >> 24) & 8'hff'''
|
||||||
|
|
||||||
|
data[24] = 0x00 #地址0x138, sync周期 4B
|
||||||
|
data[25] = 0x04 #地址0x139genPkt.addBeforeExc(
|
||||||
|
|
||||||
|
data[28] = 0x0 #sync1偏移
|
||||||
|
data[29] = 0x0
|
||||||
|
|
||||||
|
data[36] = 0x0 #sync3偏移
|
||||||
|
data[37] = 0x0
|
||||||
|
|
||||||
|
genPkt.addSubPkt(2, 0, 0x120, 0x1, 0x28, data)
|
||||||
|
|
||||||
|
#gen_file_def_ap = gen_file_def + "_rw01"
|
||||||
|
genPkt.addAfterExc(genWriteTransLenCode(gen_file_def, sm_idx)
|
||||||
|
+genWriteTransPktCode(gen_file_def, sm_idx)
|
||||||
|
+genTrgTransPktCode(gen_file_def, sm_idx)
|
||||||
|
+genReadAckPktCode(gen_file_def, sm_idx)
|
||||||
|
|
||||||
|
+genMessageCode("--读取中断")
|
||||||
|
+genIFRwDataCode(0, 0x74, False, 4)
|
||||||
|
+genIFRwDataCode(1, 0x74, False, 4)
|
||||||
|
+genIFRwDataCode(2, 0x74, False, 4)
|
||||||
|
+genIFRwDataCode(3, 0x74, False, 4)
|
||||||
|
+genIFRwDataCode(4, 0x74, False, 4)
|
||||||
|
|
||||||
|
+genMessageCode("--清除中断")
|
||||||
|
+genIFRwDataCode(0, 0x78, True, 4, [0xff, 0xff, 0xff, 0xff])
|
||||||
|
+genIFRwDataCode(1, 0x78, True, 4, [0xff, 0xff, 0xff, 0xff])
|
||||||
|
+genIFRwDataCode(2, 0x78, True, 4, [0xff, 0xff, 0xff, 0xff])
|
||||||
|
+genIFRwDataCode(3, 0x78, True, 4, [0xff, 0xff, 0xff, 0xff])
|
||||||
|
+genIFRwDataCode(4, 0x78, True, 4, [0xff, 0xff, 0xff, 0xff])
|
||||||
|
|
||||||
|
+genMessageCode("--读取中断")
|
||||||
|
+genIFRwDataCode(0, 0x74, False, 4)
|
||||||
|
+genIFRwDataCode(1, 0x74, False, 4)
|
||||||
|
+genIFRwDataCode(2, 0x74, False, 4)
|
||||||
|
+genIFRwDataCode(3, 0x74, False, 4)
|
||||||
|
+genIFRwDataCode(4, 0x74, False, 4)
|
||||||
|
)
|
||||||
|
|
||||||
|
genPkt.gen("./generated/shin/%s.vh"%(gen_file_def,), 1)
|
||||||
|
|
||||||
|
#>>>>>>同步数据包
|
||||||
|
genPkt.clean()
|
||||||
|
genPkt.setPktType(0)
|
||||||
|
|
||||||
|
#subPkt参数:索引、索引类型、地址、命令、长度、数据
|
||||||
|
genPkt.addSubPkt(0x0, 0, 0x0, 0xc, 12, [0, ] * 12)
|
||||||
|
genPkt.addSubPkt(0x0, 0, 0x0, 0xd, 10, [0, ] * 10)
|
||||||
|
genPkt.addSubPkt(0x0, 0, 0x0, 0xd, 10, [0, ] * 10)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
genPkt.addBeforeExc(genEnableInsertTimeCode(0xa))# + 18 + 18))
|
||||||
|
|
||||||
|
sm_idx = 0
|
||||||
|
|
||||||
|
gen_file_def_ap = gen_file_def + "_rw02"
|
||||||
|
|
||||||
|
genPkt.addAfterExc(genWriteTransLenCode(gen_file_def_ap, sm_idx)
|
||||||
|
+genWriteTransPktCode(gen_file_def_ap, sm_idx)
|
||||||
|
+genTrgTransPktCode(gen_file_def_ap, sm_idx)
|
||||||
|
+genReadAckPktCode(gen_file_def_ap, sm_idx)
|
||||||
|
+genCheckInsertTimeCode()
|
||||||
|
+genMessageCode("--读取中断")
|
||||||
|
+genIFRwDataCode(0, 0x74, False, 4)
|
||||||
|
+genIFRwDataCode(1, 0x74, False, 4)
|
||||||
|
+genIFRwDataCode(2, 0x74, False, 4)
|
||||||
|
+genIFRwDataCode(3, 0x74, False, 4)
|
||||||
|
+genIFRwDataCode(4, 0x74, False, 4)
|
||||||
|
|
||||||
|
+genMessageCode("--清除中断")
|
||||||
|
+genIFRwDataCode(0, 0x78, True, 4, [0xff, 0xff, 0xff, 0xff])
|
||||||
|
+genIFRwDataCode(1, 0x78, True, 4, [0xff, 0xff, 0xff, 0xff])
|
||||||
|
+genIFRwDataCode(2, 0x78, True, 4, [0xff, 0xff, 0xff, 0xff])
|
||||||
|
+genIFRwDataCode(3, 0x78, True, 4, [0xff, 0xff, 0xff, 0xff])
|
||||||
|
+genIFRwDataCode(4, 0x78, True, 4, [0xff, 0xff, 0xff, 0xff])
|
||||||
|
|
||||||
|
+genMessageCode("--读取中断")
|
||||||
|
+genIFRwDataCode(0, 0x74, False, 4)
|
||||||
|
+genIFRwDataCode(1, 0x74, False, 4)
|
||||||
|
+genIFRwDataCode(2, 0x74, False, 4)
|
||||||
|
+genIFRwDataCode(3, 0x74, False, 4)
|
||||||
|
+genIFRwDataCode(4, 0x74, False, 4)
|
||||||
|
|
||||||
|
+"#5000000"
|
||||||
|
+genIFRwDataCode(0, 0x40, True, 4, [0x01, 0x00, 0x66, 0x79])
|
||||||
|
) #+genDisableInsertTimeCode())
|
||||||
|
|
||||||
|
|
||||||
|
genPkt.gen("./generated/shin/%s.vh"%(gen_file_def, ), 1, True, gen_file_def_ap)
|
||||||
|
|
||||||
|
genPkt.clean()
|
||||||
|
genPkt.setPktType(0)
|
||||||
|
sm_idx = 3
|
||||||
|
|
||||||
|
genPkt.addBeforeExc("\n#5000\n"
|
||||||
|
+genIFRwDataCode(0, 0x09, True, 1, [0, ], False, iface=1)
|
||||||
|
|
||||||
|
+genIFRwDataCode(0, 0x74, False, 4)
|
||||||
|
+genIFRwDataCode(0, 0x40, False, 4)
|
||||||
|
+genIFRwDataCode(0, 0x00, True, 1, [0x1, ])
|
||||||
|
+genEnableInsertTimeCode(0xa)
|
||||||
|
+ '''spi_trans( (16'h0100), (`SPI_READ), (8), (`IF_IDX(0)));\n'''
|
||||||
|
+ '''_temp_time = rxBuf[3] + (rxBuf[4] << 8) + (rxBuf[5] << 16) + (rxBuf[6] << 24) + (rxBuf[7] << 32) + (rxBuf[8] << 40) + (rxBuf[9] << 48) + (rxBuf[10] << 56);\n'''
|
||||||
|
+ '''_temp_time = _temp_time + 32'h3000;\n\n''')
|
||||||
|
|
||||||
|
genPkt.addSubPkt(0x0, 0, 0x0, 0xc, 12, b'\0'*12)
|
||||||
|
|
||||||
|
#subPkt参数:索引、索引类型、地址、命令、长度、数据
|
||||||
|
data = [0,] * 100 #bytearray(b"\0" * 100)
|
||||||
|
data[0] = 0x0f #地址0x120
|
||||||
|
data[2] = 0xa
|
||||||
|
data[4] = 0xa
|
||||||
|
data[6] = 0xa
|
||||||
|
data[8] = 0xa
|
||||||
|
|
||||||
|
data[16] = '''(_temp_time & 8'hff)''' #地址0x130, sync同步点
|
||||||
|
data[17] = '''(_temp_time >> 8) & 8'hff''' #地址0x131
|
||||||
|
data[18] = '''(_temp_time >> 16) & 8'hff'''
|
||||||
|
data[19] = '''(_temp_time >> 24) & 8'hff'''
|
||||||
|
|
||||||
|
data[24] = 0x80 #地址0x138, sync周期 4B
|
||||||
|
data[25] = 0x00 #地址0x139
|
||||||
|
|
||||||
|
data[28] = 0x0 #sync1偏移
|
||||||
|
data[29] = 0x0
|
||||||
|
|
||||||
|
data[36] = 0x0#sync3偏移
|
||||||
|
data[37] = 0x0
|
||||||
|
|
||||||
|
genPkt.addSubPkt(0, 0, 0x120, 0xe, 0x28, data)
|
||||||
|
|
||||||
|
data = [0,] * 100 #bytearray(b"\0" * 100)
|
||||||
|
data[0] = 0x0f #地址0x120
|
||||||
|
data[2] = 0xa
|
||||||
|
data[4] = 0xa
|
||||||
|
data[6] = 0xa
|
||||||
|
data[8] = 0xa
|
||||||
|
|
||||||
|
data[16] = '''(_temp_time & 8'hff)''' #地址0x130, sync同步点
|
||||||
|
data[17] = '''(_temp_time >> 8) & 8'hff''' #地址0x131
|
||||||
|
data[18] = '''(_temp_time >> 16) & 8'hff'''
|
||||||
|
data[19] = '''(_temp_time >> 24) & 8'hff'''
|
||||||
|
|
||||||
|
data[24] = 0x00 #地址0x138, sync周期 4B
|
||||||
|
data[25] = 0x01 #地址0x139
|
||||||
|
|
||||||
|
data[28] = 0x0 #sync1偏移
|
||||||
|
data[29] = 0x0
|
||||||
|
|
||||||
|
data[36] = 0x0 #sync3偏移
|
||||||
|
data[37] = 0x0
|
||||||
|
|
||||||
|
genPkt.addSubPkt(3, 0, 0x120, 0x1, 0x28, data)
|
||||||
|
|
||||||
|
data = [0,] * 100 #bytearray(b"\0" * 100)
|
||||||
|
data[0] = 0x0f #地址0x120
|
||||||
|
data[2] = 0xa
|
||||||
|
data[4] = 0xa
|
||||||
|
data[6] = 0xa
|
||||||
|
data[8] = 0xa
|
||||||
|
|
||||||
|
data[16] = '''(_temp_time & 8'hff)''' #地址0x130, sync同步点
|
||||||
|
data[17] = '''(_temp_time >> 8) & 8'hff''' #地址0x131
|
||||||
|
data[18] = '''(_temp_time >> 16) & 8'hff'''
|
||||||
|
data[19] = '''(_temp_time >> 24) & 8'hff'''
|
||||||
|
|
||||||
|
data[24] = 0x00 #地址0x138, sync周期 4B
|
||||||
|
data[25] = 0x02 #地址0x139
|
||||||
|
|
||||||
|
data[28] = 0x0 #sync1偏移
|
||||||
|
data[29] = 0x0
|
||||||
|
|
||||||
|
data[36] = 0x0 #sync3偏移
|
||||||
|
data[37] = 0x0
|
||||||
|
|
||||||
|
genPkt.addSubPkt(4, 0, 0x120, 0x1, 0x28, data)
|
||||||
|
|
||||||
|
data = [0,] * 100 #bytearray(b"\0" * 100)
|
||||||
|
data[0] = 0x0f #地址0x120
|
||||||
|
data[2] = 0xa
|
||||||
|
data[4] = 0xa
|
||||||
|
data[6] = 0xa
|
||||||
|
data[8] = 0xa
|
||||||
|
|
||||||
|
data[16] = '''(_temp_time & 8'hff)''' #地址0x130, sync同步点
|
||||||
|
data[17] = '''(_temp_time >> 8) & 8'hff''' #地址0x131
|
||||||
|
data[18] = '''(_temp_time >> 16) & 8'hff'''
|
||||||
|
data[19] = '''(_temp_time >> 24) & 8'hff'''
|
||||||
|
|
||||||
|
data[24] = 0x00 #地址0x138, sync周期 4B
|
||||||
|
data[25] = 0x04 #地址0x139genPkt.addBeforeExc(
|
||||||
|
|
||||||
|
data[28] = 0x0 #sync1偏移
|
||||||
|
data[29] = 0x0
|
||||||
|
|
||||||
|
data[36] = 0x0 #sync3偏移
|
||||||
|
data[37] = 0x0
|
||||||
|
|
||||||
|
genPkt.addSubPkt(2, 0, 0x120, 0x1, 0x28, data)
|
||||||
|
|
||||||
|
gen_file_def_ap = gen_file_def + "_rw03"
|
||||||
|
genPkt.addAfterExc(genWriteTransLenCode(gen_file_def_ap, sm_idx)
|
||||||
|
+genWriteTransPktCode(gen_file_def_ap, sm_idx)
|
||||||
|
+genTrgTransPktCode(gen_file_def_ap, sm_idx)
|
||||||
|
+genReadAckPktCode(gen_file_def_ap, sm_idx)
|
||||||
|
|
||||||
|
+genMessageCode("--读取中断")
|
||||||
|
+genIFRwDataCode(0, 0x74, False, 4)
|
||||||
|
+genIFRwDataCode(1, 0x74, False, 4)
|
||||||
|
+genIFRwDataCode(2, 0x74, False, 4)
|
||||||
|
+genIFRwDataCode(3, 0x74, False, 4)
|
||||||
|
+genIFRwDataCode(4, 0x74, False, 4)
|
||||||
|
|
||||||
|
+genMessageCode("--清除中断")
|
||||||
|
+genIFRwDataCode(0, 0x78, True, 4, [0xff, 0xff, 0xff, 0xff])
|
||||||
|
+genIFRwDataCode(1, 0x78, True, 4, [0xff, 0xff, 0xff, 0xff])
|
||||||
|
+genIFRwDataCode(2, 0x78, True, 4, [0xff, 0xff, 0xff, 0xff])
|
||||||
|
+genIFRwDataCode(3, 0x78, True, 4, [0xff, 0xff, 0xff, 0xff])
|
||||||
|
+genIFRwDataCode(4, 0x78, True, 4, [0xff, 0xff, 0xff, 0xff])
|
||||||
|
|
||||||
|
+genMessageCode("--读取中断")
|
||||||
|
+genIFRwDataCode(0, 0x74, False, 4)
|
||||||
|
+genIFRwDataCode(1, 0x74, False, 4)
|
||||||
|
+genIFRwDataCode(2, 0x74, False, 4)
|
||||||
|
+genIFRwDataCode(3, 0x74, False, 4)
|
||||||
|
+genIFRwDataCode(4, 0x74, False, 4)
|
||||||
|
+genTcEndFrameCode(gen_file_def)
|
||||||
|
)
|
||||||
|
|
||||||
|
genPkt.gen("./generated/shin/%s.vh"%(gen_file_def,), 1, True, gen_file_def_ap)
|
||||||
|
|
||||||
|
|
||||||
return gen_file_def
|
return gen_file_def
|
||||||
Reference in New Issue
Block a user