998 lines
40 KiB
Python
998 lines
40 KiB
Python
from pyutils import *
|
||
|
||
|
||
def tc1():
|
||
genPkt = GenPkt()
|
||
|
||
gen_file_def = "base_tc01"
|
||
sm_idx = 0
|
||
tc_des = "发送一个包,多个子包,单播读,测试SM1发送数据。检查中断、检查SMx的状态。\\n"
|
||
|
||
|
||
#-------------------------------------------------------------------------
|
||
#>>>>>>普通数据包 sm1,2个读
|
||
genPkt.clean()
|
||
genPkt.setPktType(0)
|
||
|
||
#subPkt参数:索引、索引类型、地址、命令、长度、数据
|
||
#genPkt.addSubPkt(0x02, 0, 0x0830, 0x2, 56, None)
|
||
genPkt.addSubPkt(0x01, 0, 0x00, 0x0, 64, None)
|
||
genPkt.addSubPkt(0x03, 0, 0xc0, 0x0, 64, None)
|
||
#genPkt.addSubPkt(10, 2, 0x300, 0x2, 4, None)
|
||
#genPkt.addSubPkt(11, 1, 0x300, 0x2, 4, None)
|
||
sm_idx = 1
|
||
|
||
genPkt.addBeforeExc(genTcStartFrameCode(gen_file_def, tc_des))
|
||
|
||
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)
|
||
|
||
+genTcEndFrameCode(gen_file_def))
|
||
|
||
genPkt.gen("./generated/shin/%s.vh"%(gen_file_def, ), 1)
|
||
|
||
return gen_file_def
|
||
|
||
|
||
def tc2():
|
||
genPkt = GenPkt()
|
||
|
||
|
||
gen_file_def = "base_tc02"
|
||
sm_idx = 0
|
||
tc_des = "广播读,一次性读取从0x0开始的128个字节的数据。读的时候,报文中的数据和对应的\\n"\
|
||
+ "寄存器数据位与后放入报文中。"
|
||
|
||
#-------------------------------------------------------------------------
|
||
#>>>>>>普通数据包 sm2,广播读
|
||
genPkt.clean()
|
||
genPkt.setPktType(0)
|
||
|
||
#subPkt参数:索引、索引类型、地址、命令、长度、数据
|
||
genPkt.addSubPkt(0x01, 0, 0x00, 0xd, 128, None)
|
||
|
||
sm_idx = 2
|
||
|
||
genPkt.addBeforeExc(genTcStartFrameCode(gen_file_def, tc_des))
|
||
|
||
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)
|
||
|
||
+genTcEndFrameCode(gen_file_def))
|
||
genPkt.gen("./generated/shin/%s.vh"%(gen_file_def, ), 1)
|
||
|
||
return gen_file_def
|
||
|
||
|
||
|
||
def tc3():
|
||
genPkt = GenPkt()
|
||
|
||
gen_file_def = "base_tc03"
|
||
sm_idx = 0
|
||
tc_des = "广播写,发送数据长度到每个设备中;然后再紧跟发送的数据。\\n" \
|
||
+ "所有从站接收到相同的数据。"
|
||
|
||
#-------------------------------------------------------------------------
|
||
#>>>>>>交换数据 SMx, 两个广播写
|
||
genPkt.clean()
|
||
genPkt.setPktType(0)
|
||
|
||
#subPkt参数:索引、索引类型、地址、命令、长度、数据
|
||
data = bytearray(b"\0" * 10)
|
||
data[0] = 16
|
||
data[1] = 0
|
||
genPkt.addSubPkt(1278, 0, 0x0302, 0xe, 2, data)
|
||
|
||
data = bytearray(b"\0"*100)
|
||
for i in range(100):
|
||
data[i] = i + 1
|
||
genPkt.addSubPkt(1188, 0, 0x0800, 0xe, 16, data)
|
||
|
||
sm_idx = 3
|
||
|
||
genPkt.addBeforeExc(genTcStartFrameCode(gen_file_def, tc_des))
|
||
|
||
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("--读取广播写入的数据")
|
||
+genSlvSMReadData(1, 0, 16)
|
||
+genSlvSMReadData(2, 0, 16)
|
||
+genSlvSMReadData(3, 0, 16)
|
||
+genSlvSMReadData(4, 0, 16)
|
||
|
||
+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)
|
||
|
||
return gen_file_def
|
||
|
||
|
||
def tc4():
|
||
genPkt = GenPkt()
|
||
|
||
gen_file_def = "base_tc04"
|
||
sm_idx = 0
|
||
tc_des = "发送带有超出系统顺序地址和顺序编号的子包,子包中有写入、有读取;没有处理的包\\n" \
|
||
+ "其工作计数应为0。"
|
||
#-------------------------------------------------------------------------
|
||
#>>>>>>普通数据包,一个读、一个写,增加5个随机包(需要在文件里确认)
|
||
genPkt.clean()
|
||
genPkt.setPktType(0)
|
||
|
||
#subPkt参数:索引、索引类型、地址、命令、长度、数据
|
||
genPkt.addSubPkt(0x01, 0, 0x0840, 0x1, 56, None)
|
||
genPkt.addSubPkt(0x03, 0, 0x1040, 0x0, 56, None)
|
||
for i in range(5):
|
||
genPkt.addSubPkt(3288+i, 0,
|
||
0xDF00+i, 0x0,
|
||
56, None)
|
||
|
||
sm_idx = 0
|
||
|
||
genPkt.addBeforeExc(genTcStartFrameCode(gen_file_def, tc_des))
|
||
|
||
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)
|
||
|
||
|
||
+genTcEndFrameCode(gen_file_def))
|
||
|
||
genPkt.gen("./generated/shin/%s.vh"%(gen_file_def, ), 1)
|
||
|
||
return gen_file_def
|
||
|
||
def tc5():
|
||
genPkt = GenPkt()
|
||
|
||
gen_file_def = "base_tc05"
|
||
sm_idx = 0
|
||
tc_des = "发送单播子包,向4个从设备分别写入数据。\\n"
|
||
|
||
#-------------------------------------------------------------------------
|
||
#>>>>>>普通数据包0,用来操作sync
|
||
genPkt.clean()
|
||
genPkt.setPktType(0)
|
||
|
||
sm_size = 64
|
||
|
||
data = bytearray(b"\0"*100)
|
||
data[0] = 0 #0x0300
|
||
data[1] = 0 #0x0301
|
||
data[2] = sm_size #0x302 长度1
|
||
data[3] = 0 #0x303 长度2
|
||
data[4] = 0
|
||
data[5] = 0
|
||
data[6] = sm_size
|
||
data[7] = 0
|
||
data[8] = 0
|
||
data[9] = 0
|
||
data[10] = sm_size
|
||
data[11] = 0
|
||
data[12] = 0
|
||
data[13] = 0
|
||
data[14] = sm_size
|
||
data[15] = 0
|
||
|
||
|
||
#subPkt参数:索引、索引类型、地址、命令、长度、数据
|
||
genPkt.addSubPkt(0x02, 0, 0x0300, 0x1, 4, data) #sm0
|
||
genPkt.addSubPkt(0x01, 0, 0x0308, 0x1, 4, data) #sm2
|
||
genPkt.addSubPkt(0x03, 0, 0x0310, 0x1, 4, data) #sm4
|
||
genPkt.addSubPkt(0x04, 0, 0x0318, 0x1, 4, data) #sm6
|
||
|
||
|
||
data = bytearray(b"\0"*100)
|
||
for i in range(sm_size):
|
||
data[i] = i
|
||
data[10] = ord('B')
|
||
data[11] = ord('A')
|
||
genPkt.addSubPkt(0x02, 0, 0x0800, 0x1, sm_size, data)
|
||
|
||
data = bytearray(b"\0"*100)
|
||
for i in range(sm_size):
|
||
data[i] = i
|
||
data[11] = ord('B')
|
||
data[12] = ord('A')
|
||
genPkt.addSubPkt(0x01, 0, 0x1800, 0x1, sm_size, data)
|
||
|
||
data = bytearray(b"\0"*100)
|
||
for i in range(sm_size):
|
||
data[i] = i
|
||
data[12] = ord('B')
|
||
data[13] = ord('A')
|
||
genPkt.addSubPkt(0x03, 0, 0x2800, 0x1, sm_size, data)
|
||
|
||
data = bytearray(b"\0"*100)
|
||
for i in range(sm_size):
|
||
data[i] = i
|
||
data[13] = ord('B')
|
||
data[14] = ord('A')
|
||
genPkt.addSubPkt(0x04, 0, 0x3800, 0x1, sm_size, data)
|
||
|
||
sm_idx = 0
|
||
|
||
genPkt.addBeforeExc(genTcStartFrameCode(gen_file_def, tc_des))
|
||
|
||
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)
|
||
|
||
+genSlvSMReadData(1, 2, sm_size)
|
||
+genSlvSMReadData(2, 0, sm_size)
|
||
+genSlvSMReadData(3, 4, sm_size)
|
||
+genSlvSMReadData(4, 6, sm_size)
|
||
|
||
+genTcEndFrameCode(gen_file_def))
|
||
|
||
genPkt.gen("./generated/shin/%s.vh"%(gen_file_def, ), 1)
|
||
return gen_file_def
|
||
|
||
|
||
def tc6():
|
||
genPkt = GenPkt()
|
||
|
||
gen_file_def = "base_tc06"
|
||
sm_idx = 0
|
||
tc_des = "从4个从站中读取数据,并从对应的位置读取SM1中的数据长度。\\n"
|
||
|
||
#-------------------------------------------------------------------------
|
||
#>>>>>>普通数据包2
|
||
genPkt.clean()
|
||
genPkt.setPktType(0)
|
||
|
||
genPkt.addBeforeExc(genTcStartFrameCode(gen_file_def, tc_des)
|
||
+ genSlvSMWriteData(3, 1, 129)
|
||
+ genSlvSMWriteData(4, 1, 140)
|
||
+ genSlvSMWriteData(1, 1, 128)
|
||
+ genSlvSMWriteData(2, 1, 152))
|
||
|
||
#subPkt参数:索引、索引类型、地址、命令、长度、数据
|
||
genPkt.addSubPkt(3, 0, 0x1000, 0x0, 129, b"\0"*129)
|
||
genPkt.addSubPkt(4, 0, 0x1000, 0x0, 140, b"\0"*140)
|
||
genPkt.addSubPkt(1, 0, 0x1000, 0x0, 128, b"\0"*128)
|
||
genPkt.addSubPkt(2, 0, 0x1000, 0x0, 152, b"\0"*152)
|
||
genPkt.addSubPkt(1, 0, 0x0306, 0x0, 2, b"\0"*2)
|
||
genPkt.addSubPkt(2, 0, 0x0306, 0x0, 2, b"\0"*2)
|
||
genPkt.addSubPkt(3, 0, 0x0306, 0x0, 2, b"\0"*2)
|
||
genPkt.addSubPkt(4, 0, 0x0306, 0x0, 2, b"\0"*2)
|
||
|
||
sm_idx = 0
|
||
|
||
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)
|
||
|
||
+genTcEndFrameCode(gen_file_def))
|
||
|
||
genPkt.gen("./generated/shin/%s.vh"%(gen_file_def, ), 1)
|
||
|
||
return gen_file_def
|
||
|
||
|
||
|
||
def tc7():
|
||
genPkt = GenPkt()
|
||
|
||
gen_file_def = "base_tc07"
|
||
sm_idx = 0
|
||
tc_des = "读写命令,写入0x100开始的32B寄存器,这32B寄存器实际上是只读寄存器。\\n" \
|
||
+ "检查是否真的写入,读取的值,子报文的状态。"
|
||
|
||
#-------------------------------------------------------------------------
|
||
#>>>>>>普通数据包3
|
||
genPkt.clean()
|
||
genPkt.setPktType(0)
|
||
|
||
#subPkt参数:索引、索引类型、地址、命令、长度、数据
|
||
genPkt.addSubPkt(3, 0, 0x0100, 0x2, 32, b"\0"*129)
|
||
genPkt.addSubPkt(4, 0, 0x0100, 0x2, 32, b"\0"*140)
|
||
genPkt.addSubPkt(1, 0, 0x0100, 0x2, 32, b"\0"*128)
|
||
genPkt.addSubPkt(2, 0, 0x0100, 0x2, 32, b"\0"*152)
|
||
|
||
genPkt.addSubPkt(2, 0, 0x0120, 0x2, 2, b"\x05"*32)
|
||
|
||
sm_idx = 0
|
||
|
||
genPkt.addBeforeExc(genTcStartFrameCode(gen_file_def, tc_des))
|
||
|
||
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)
|
||
|
||
+genTcEndFrameCode(gen_file_def))
|
||
|
||
genPkt.gen("./generated/shin/%s.vh"%(gen_file_def, ), 1)
|
||
|
||
return gen_file_def
|
||
|
||
def tc8():
|
||
genPkt = GenPkt()
|
||
|
||
gen_file_def = "base_tc08"
|
||
sm_idx = 0
|
||
tc_des = "测试RESET,仅复位主站和2号设备;链路和网络被破坏;发送广播包只能到1,2;3,4收不到。\\n" \
|
||
+ "通过嗅探包、设置顺序地址命令等重新建立网络。"
|
||
|
||
#>>>>>>设置顺序地址
|
||
genPkt.clean()
|
||
genPkt.setPktType(0)
|
||
|
||
reset_data = [0x01, 0x00, 0x66, 0x79]
|
||
main_dev = [0x01, ]
|
||
slave_dev = [0x02, ]
|
||
|
||
genPkt.addBeforeExc(genTcStartFrameCode(gen_file_def, tc_des)
|
||
+genIFRwDataCode(0, 0x78, False, 4)
|
||
+genIFRwDataCode(0, 0x40, True, 4, reset_data)
|
||
+genIFRwDataCode(2, 0x40, True, 4, reset_data)
|
||
+genIFRwDataCode(0, 0x74, False, 4)
|
||
+genIFRwDataCode(2, 0x74, False, 4)
|
||
+"\n#5000\n"
|
||
+genIFRwDataCode(0, 0x40, False, 4)
|
||
+genIFRwDataCode(2, 0x40, False, 4)
|
||
+genIFRwDataCode(0, 0x00, True, 1, main_dev)
|
||
+genIFRwDataCode(2, 0x00, True, 1, slave_dev)
|
||
)
|
||
|
||
|
||
data = [0,] * 128
|
||
|
||
|
||
#subPkt参数:索引、索引类型、地址、命令、长度、数据
|
||
genPkt.addSubPkt(0x0, 0, 0x0, 0xd, 128, data)
|
||
|
||
|
||
sm_idx = 0
|
||
|
||
|
||
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)
|
||
)
|
||
genPkt.gen("./generated/shin/%s.vh"%(gen_file_def, ), 1)
|
||
|
||
#------------------------------------------------------------------------------
|
||
genPkt.clean()
|
||
genPkt.setPktType(1)
|
||
|
||
genPkt.addBeforeExc(genIFRwDataCode(1, 0xc0, False, 4)
|
||
+genIFRwDataCode(2, 0xc0, False, 4)
|
||
+genIFRwDataCode(3, 0xc0, False, 4)
|
||
+genIFRwDataCode(4, 0xc0, False, 4)
|
||
)
|
||
|
||
gen_file_def_ap = gen_file_def + "_rw01"
|
||
sm_idx = 0
|
||
|
||
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)
|
||
#+genTcEndFrameCode(gen_file_def)
|
||
+genIFRwDataCode(1, 0xc0, False, 4)
|
||
+genIFRwDataCode(2, 0xc0, False, 4)
|
||
+genIFRwDataCode(3, 0xc0, False, 4)
|
||
+genIFRwDataCode(4, 0xc0, False, 4)
|
||
)
|
||
|
||
genPkt.gen("./generated/shin/%s.vh"%(gen_file_def, ), 1, True, gen_file_def_ap)
|
||
|
||
#------------------------------------------------------------------------------
|
||
genPkt.clean()
|
||
genPkt.setPktType(0)
|
||
|
||
gen_file_def_ap = gen_file_def + "_rw02"
|
||
sm_idx = 0
|
||
|
||
data = [0x3f, 0xff]
|
||
genPkt.addSubPkt(0x0, 0, 0x0, 0xb, 2, data)
|
||
|
||
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)
|
||
#+genTcEndFrameCode(gen_file_def)
|
||
+genIFRwDataCode(1, 0xc0, False, 4)
|
||
+genIFRwDataCode(2, 0xc0, False, 4)
|
||
+genIFRwDataCode(3, 0xc0, False, 4)
|
||
+genIFRwDataCode(4, 0xc0, False, 4)
|
||
)
|
||
|
||
genPkt.gen("./generated/shin/%s.vh"%(gen_file_def, ), 1, True, gen_file_def_ap)
|
||
|
||
|
||
#------------------------------------------------------------------------------
|
||
genPkt.clean()
|
||
genPkt.setPktType(1)
|
||
|
||
genPkt.addBeforeExc(genIFRwDataCode(1, 0xc0, False, 4)
|
||
+genIFRwDataCode(2, 0xc0, False, 4)
|
||
+genIFRwDataCode(3, 0xc0, False, 4)
|
||
+genIFRwDataCode(4, 0xc0, False, 4)
|
||
)
|
||
|
||
gen_file_def_ap = gen_file_def + "_rw03"
|
||
sm_idx = 0
|
||
|
||
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)
|
||
+genIFRwDataCode(1, 0xc0, False, 4)
|
||
+genIFRwDataCode(2, 0xc0, False, 4)
|
||
+genIFRwDataCode(3, 0xc0, False, 4)
|
||
+genIFRwDataCode(4, 0xc0, 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
|
||
|
||
|
||
def tc9():
|
||
genPkt = GenPkt()
|
||
|
||
gen_file_def = "base_tc09"
|
||
sm_idx = 0
|
||
tc_des = "发送超过带有64个子包的读。检查子包的状态、中断、统计等信息。"
|
||
|
||
#-------------------------------------------------------------------------
|
||
#>>>>>>设置顺序地址
|
||
genPkt.clean()
|
||
genPkt.setPktType(0)
|
||
|
||
data = [0, ] * 32
|
||
#subPkt参数:索引、索引类型、地址、命令、长度、数据
|
||
genPkt.addSubPkt(0x1, 0, 0x0000, 0x0, 4, data)
|
||
genPkt.addSubPkt(0x1, 0, 0x0100, 0x0, 8, data)
|
||
genPkt.addSubPkt(0x1, 0, 0x0200, 0x0, 16, data)
|
||
genPkt.addSubPkt(0x1, 0, 0x0300, 0x0, 4, data)
|
||
|
||
genPkt.addSubPkt(0x2, 0, 0x0000, 0x0, 4, data)
|
||
genPkt.addSubPkt(0x2, 0, 0x0100, 0x0, 8, data)
|
||
genPkt.addSubPkt(0x2, 0, 0x0200, 0x0, 16, data)
|
||
genPkt.addSubPkt(0x2, 0, 0x0300, 0x0, 4, data)
|
||
|
||
genPkt.addSubPkt(0x3, 0, 0x0000, 0x0, 4, data)
|
||
genPkt.addSubPkt(0x3, 0, 0x0100, 0x0, 8, data)
|
||
genPkt.addSubPkt(0x3, 0, 0x0200, 0x0, 16, data)
|
||
genPkt.addSubPkt(0x3, 0, 0x0300, 0x0, 4, data)
|
||
|
||
genPkt.addSubPkt(0x4, 0, 0x0000, 0x0, 4, data)
|
||
genPkt.addSubPkt(0x4, 0, 0x0100, 0x0, 8, data)
|
||
genPkt.addSubPkt(0x4, 0, 0x0200, 0x0, 16, data)
|
||
genPkt.addSubPkt(0x4, 0, 0x0300, 0x0, 4, data)
|
||
|
||
genPkt.addSubPkt(0x5, 0, 0x0000, 0x0, 4, data)
|
||
genPkt.addSubPkt(0x5, 0, 0x0100, 0x0, 8, data)
|
||
genPkt.addSubPkt(0x5, 0, 0x0200, 0x0, 16, data)
|
||
genPkt.addSubPkt(0x5, 0, 0x0300, 0x0, 4, data)
|
||
|
||
genPkt.addSubPkt(0x6, 0, 0x0000, 0x0, 4, data)
|
||
genPkt.addSubPkt(0x6, 0, 0x0100, 0x0, 8, data)
|
||
genPkt.addSubPkt(0x6, 0, 0x0200, 0x0, 16, data)
|
||
genPkt.addSubPkt(0x6, 0, 0x0300, 0x0, 4, data)
|
||
|
||
genPkt.addSubPkt(0x3, 0, 0x0000, 0x0, 4, data)
|
||
genPkt.addSubPkt(0x3, 0, 0x0100, 0x0, 8, data)
|
||
genPkt.addSubPkt(0x3, 0, 0x0200, 0x0, 16, data)
|
||
genPkt.addSubPkt(0x3, 0, 0x0300, 0x0, 4, data)
|
||
|
||
genPkt.addSubPkt(0x4, 0, 0x0000, 0x0, 4, data)
|
||
genPkt.addSubPkt(0x4, 0, 0x0100, 0x0, 8, data)
|
||
genPkt.addSubPkt(0x4, 0, 0x0200, 0x0, 16, data)
|
||
genPkt.addSubPkt(0x4, 0, 0x0300, 0x0, 4, data)
|
||
|
||
genPkt.addSubPkt(0x1, 0, 0x0000, 0x0, 4, data)
|
||
genPkt.addSubPkt(0x1, 0, 0x0100, 0x0, 8, data)
|
||
genPkt.addSubPkt(0x1, 0, 0x0200, 0x0, 16, data)
|
||
genPkt.addSubPkt(0x1, 0, 0x0300, 0x0, 4, data)
|
||
|
||
genPkt.addSubPkt(0x2, 0, 0x0000, 0x0, 4, data)
|
||
genPkt.addSubPkt(0x2, 0, 0x0100, 0x0, 8, data)
|
||
genPkt.addSubPkt(0x2, 0, 0x0200, 0x0, 16, data)
|
||
genPkt.addSubPkt(0x2, 0, 0x0300, 0x0, 4, data)
|
||
|
||
genPkt.addSubPkt(0x3, 0, 0x0000, 0x0, 4, data)
|
||
genPkt.addSubPkt(0x3, 0, 0x0100, 0x0, 8, data)
|
||
genPkt.addSubPkt(0x3, 0, 0x0200, 0x0, 16, data)
|
||
genPkt.addSubPkt(0x3, 0, 0x0300, 0x0, 4, data)
|
||
|
||
genPkt.addSubPkt(0x4, 0, 0x0000, 0x0, 4, data)
|
||
genPkt.addSubPkt(0x4, 0, 0x0100, 0x0, 8, data)
|
||
genPkt.addSubPkt(0x4, 0, 0x0200, 0x0, 16, data)
|
||
genPkt.addSubPkt(0x4, 0, 0x0300, 0x0, 4, data)
|
||
|
||
genPkt.addSubPkt(0x1, 0, 0x0000, 0x0, 4, data)
|
||
genPkt.addSubPkt(0x1, 0, 0x0100, 0x0, 8, data)
|
||
genPkt.addSubPkt(0x1, 0, 0x0200, 0x0, 16, data)
|
||
genPkt.addSubPkt(0x1, 0, 0x0300, 0x0, 4, data)
|
||
|
||
genPkt.addSubPkt(0x2, 0, 0x0000, 0x0, 4, data)
|
||
genPkt.addSubPkt(0x2, 0, 0x0100, 0x0, 8, data)
|
||
genPkt.addSubPkt(0x2, 0, 0x0200, 0x0, 16, data)
|
||
genPkt.addSubPkt(0x2, 0, 0x0300, 0x0, 4, data)
|
||
|
||
genPkt.addSubPkt(0x3, 0, 0x0000, 0x0, 4, data)
|
||
genPkt.addSubPkt(0x3, 0, 0x0100, 0x0, 8, data)
|
||
genPkt.addSubPkt(0x3, 0, 0x0200, 0x0, 16, data)
|
||
genPkt.addSubPkt(0x3, 0, 0x0300, 0x0, 4, data)
|
||
|
||
genPkt.addSubPkt(0x4, 0, 0x0000, 0x0, 4, data)
|
||
genPkt.addSubPkt(0x4, 0, 0x0100, 0x0, 8, data)
|
||
genPkt.addSubPkt(0x4, 0, 0x0200, 0x0, 16, data)
|
||
genPkt.addSubPkt(0x4, 0, 0x0300, 0x0, 4, data)
|
||
|
||
data = [0, ] * 128
|
||
genPkt.addSubPkt(0x1, 0, 0x0180, 0x0, 128, data)
|
||
genPkt.addSubPkt(0x2, 0, 0x0180, 0x0, 128, data)
|
||
genPkt.addSubPkt(0x3, 0, 0x0180, 0x0, 128, data)
|
||
genPkt.addSubPkt(0x4, 0, 0x0180, 0x0, 128, data)
|
||
|
||
sm_idx = 0
|
||
|
||
custom_data1 = list(range(1, 129))
|
||
custom_data2 = list(range(1*2, 129*2, 2))
|
||
custom_data3 = list(range(1*3, 129*3, 3))
|
||
custom_data4 = list(range(1*4, 129*4, 4))
|
||
genPkt.addBeforeExc(genTcStartFrameCode(gen_file_def, tc_des)
|
||
+genIFRwDataCode(1, 0x180, True, 128, custom_data1)
|
||
+genIFRwDataCode(2, 0x180, True, 128, custom_data2)
|
||
+genIFRwDataCode(3, 0x180, True, 128, custom_data3)
|
||
+genIFRwDataCode(4, 0x180, True, 128, custom_data4)
|
||
)
|
||
|
||
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)
|
||
|
||
+genTcEndFrameCode(gen_file_def))
|
||
|
||
genPkt.gen("./generated/shin/%s.vh"%(gen_file_def, ), 1)
|
||
|
||
return gen_file_def
|
||
|
||
def tc10():
|
||
genPkt = GenPkt()
|
||
|
||
gen_file_def = "base_tc10"
|
||
sm_idx = 0
|
||
tc_des = "发送超过带有64个子包的写。检查子包的状态、中断、统计等信息。"
|
||
|
||
#-------------------------------------------------------------------------
|
||
#>>>>>>设置顺序地址
|
||
genPkt.clean()
|
||
genPkt.setPktType(0)
|
||
|
||
for i in range(1, 5):
|
||
data = [0, ] * 32
|
||
genPkt.addSubPkt(i, 0, 0x0302, 1, 2, [0x40, 0x00])
|
||
genPkt.addSubPkt(i, 0, 0x0800, 1, 4, [i + 1, 2, 3, 4])
|
||
genPkt.addSubPkt(i, 0, 0x0804, 1, 4, [5, 6, 7, 8])
|
||
genPkt.addSubPkt(i, 0, 0x0808, 1, 4, [9, 10, 11, 12])
|
||
genPkt.addSubPkt(i, 0, 0x080c, 1, 4, [13, 14, 15, 16])
|
||
genPkt.addSubPkt(i, 0, 0x0810, 1, 4, [17, 18, 19, 20])
|
||
genPkt.addSubPkt(i, 0, 0x0814, 1, 4, [21, 22, 23, 24])
|
||
genPkt.addSubPkt(i, 0, 0x0818, 1, 4, [25, 26, 27, 28])
|
||
genPkt.addSubPkt(i, 0, 0x081c, 1, 4, [29, 30, 31, 32])
|
||
genPkt.addSubPkt(i, 0, 0x0820, 1, 4, [1, 2, 3, 4])
|
||
genPkt.addSubPkt(i, 0, 0x0824, 1, 4, [5, 6, 7, 8])
|
||
genPkt.addSubPkt(i, 0, 0x0828, 1, 4, [9, 10, 11, 12])
|
||
genPkt.addSubPkt(i, 0, 0x082c, 1, 4, [13, 14, 15, 16])
|
||
genPkt.addSubPkt(i, 0, 0x0830, 1, 4, [17, 18, 19, 20])
|
||
genPkt.addSubPkt(i, 0, 0x0834, 1, 4, [21, 22, 23, 24])
|
||
genPkt.addSubPkt(i, 0, 0x0838, 1, 4, [25, 26, 27, 28])
|
||
genPkt.addSubPkt(i, 0, 0x083c, 1, 4, [29, 30, 31, 32])
|
||
|
||
genPkt.addBeforeExc(genTcStartFrameCode(gen_file_def, tc_des)
|
||
)
|
||
|
||
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)
|
||
|
||
+genSlvSMReadData(1, 0, 0x40)
|
||
+genSlvSMReadData(2, 0, 0x40)
|
||
+genSlvSMReadData(3, 0, 0x40)
|
||
+genSlvSMReadData(4, 0, 0x40)
|
||
|
||
+genIFRwDataCode(0, 0x80, False, 48)
|
||
+genIFRwDataCode(1, 0x80, False, 48)
|
||
+genIFRwDataCode(2, 0x80, False, 48)
|
||
+genIFRwDataCode(3, 0x80, False, 48)
|
||
+genIFRwDataCode(4, 0x80, False, 48)
|
||
|
||
+genTcEndFrameCode(gen_file_def)
|
||
)
|
||
|
||
genPkt.gen("./generated/shin/%s.vh"%(gen_file_def, ), 1)
|
||
|
||
return gen_file_def
|
||
|
||
def tc11():
|
||
genPkt = GenPkt()
|
||
|
||
gen_file_def = "base_tc11"
|
||
sm_idx = 0
|
||
tc_des = "清除统计信息,从SPI侧清0,清0是失败的。因为统计寄存器对于SPI侧来说是只读寄存器。\\n"
|
||
|
||
#-------------------------------------------------------------------------
|
||
#>>>>>>设置顺序地址
|
||
genPkt.clean()
|
||
genPkt.setPktType(0)
|
||
op_size = 24
|
||
|
||
|
||
data = [0, ] * op_size
|
||
genPkt.addBeforeExc(genTcStartFrameCode(gen_file_def, tc_des)
|
||
+genIFRwDataCode(0, 0x80, True, op_size, data)
|
||
+genIFRwDataCode(1, 0x80, True, op_size, data)
|
||
+genIFRwDataCode(2, 0x80, True, op_size, data)
|
||
+genIFRwDataCode(3, 0x80, True, op_size, data)
|
||
+genIFRwDataCode(4, 0x80, True, op_size, data)
|
||
)
|
||
|
||
genPkt.addAfterExc( genIFRwDataCode(0, 0x80, False, op_size)
|
||
+genIFRwDataCode(1, 0x80, False, op_size)
|
||
+genIFRwDataCode(2, 0x80, False, op_size)
|
||
+genIFRwDataCode(3, 0x80, False, op_size)
|
||
+genIFRwDataCode(4, 0x80, False, op_size)
|
||
|
||
+genTcEndFrameCode(gen_file_def)
|
||
)
|
||
|
||
genPkt.gen("./generated/shin/%s.vh"%(gen_file_def, ), 1)
|
||
|
||
return gen_file_def
|
||
|
||
|
||
def tc12():
|
||
genPkt = GenPkt()
|
||
|
||
gen_file_def = "base_tc12"
|
||
sm_idx = 0
|
||
tc_des = "清除统计信息,从LVDS侧清0,清0是成功的。\\n"
|
||
|
||
#-------------------------------------------------------------------------
|
||
#>>>>>>设置顺序地址
|
||
genPkt.clean()
|
||
genPkt.setPktType(0)
|
||
op_size = 24
|
||
|
||
|
||
data = [0, ] * op_size
|
||
genPkt.addBeforeExc(genTcStartFrameCode(gen_file_def, tc_des)
|
||
)
|
||
|
||
genPkt.addSubPkt(0, 0, 0x80, 0xe, op_size, data)
|
||
|
||
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)
|
||
|
||
+genIFRwDataCode(0, 0x80, False, op_size)
|
||
+genIFRwDataCode(1, 0x80, False, op_size)
|
||
+genIFRwDataCode(2, 0x80, False, op_size)
|
||
+genIFRwDataCode(3, 0x80, False, op_size)
|
||
+genIFRwDataCode(4, 0x80, False, op_size)
|
||
|
||
+genTcEndFrameCode(gen_file_def)
|
||
)
|
||
|
||
genPkt.gen("./generated/shin/%s.vh"%(gen_file_def, ), 1)
|
||
|
||
return gen_file_def
|
||
|
||
|
||
|
||
def tc13():
|
||
genPkt = GenPkt()
|
||
|
||
gen_file_def = "base_tc13"
|
||
sm_idx = 0
|
||
tc_des = "测试事件寄存器组。先要同步一下时间,然后测试Latch0的锁定。\\n"
|
||
|
||
|
||
|
||
genPkt.clean()
|
||
genPkt.setPktType(0)
|
||
|
||
#subPkt参数:索引、索引类型、地址、命令、长度、数据
|
||
genPkt.addSubPkt(0x0, 0, 0x0, 0xc, 12, b'\0'*12)
|
||
|
||
|
||
genPkt.addBeforeExc(genTcStartFrameCode(gen_file_def, tc_des)
|
||
+genEnableInsertTimeCode(0xa))
|
||
|
||
sm_idx = 0
|
||
|
||
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)
|
||
+genCheckInsertTimeCode()
|
||
)
|
||
|
||
genPkt.gen("./generated/shin/%s.vh"%(gen_file_def, ), 1)
|
||
#-------------------------------------------------------------------------
|
||
#>>>>>>设置顺序地址
|
||
genPkt.clean()
|
||
genPkt.setPktType(0)
|
||
|
||
gen_file_def_ap = gen_file_def + "_rw01"
|
||
genPkt.addBeforeExc(genMessageCode("--读取事件寄存器组")
|
||
+genIFRwDataCode(0, 0x500, False, 0x48)
|
||
|
||
+genMessageCode("--设置事件")
|
||
+genIFRwDataCode(0, 0x500, True, 2, [0x0F, 0x00] )
|
||
|
||
+genMessageCode("--读取事件寄存器组")
|
||
+genIFRwDataCode(0, 0x500, False, 0x48)
|
||
)
|
||
|
||
genPkt.addAfterExc("latch0 <= 1;\n"
|
||
+"#5000\n"
|
||
+"latch0 <= 0;\n"
|
||
+"#5000\n"
|
||
+"latch0 <= 1;\n"
|
||
+"#5000\n"
|
||
+"latch0 <= 0;\n"
|
||
+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)
|
||
|
||
+genMessageCode("--读取事件寄存器组")
|
||
+genIFRwDataCode(0, 0x500, False, 0x48)
|
||
|
||
+genTcEndFrameCode(gen_file_def)
|
||
)
|
||
|
||
genPkt.gen("./generated/shin/%s.vh"%(gen_file_def, ), 1, True, gen_file_def_ap)
|
||
|
||
return gen_file_def |