备份代码,尚未测试,实现全自动化生成verilog测试代码
This commit is contained in:
@@ -3,6 +3,13 @@ from pyutils import *
|
||||
|
||||
def tc1():
|
||||
genPkt = GenPkt()
|
||||
|
||||
gen_file_def = "base_tc01"
|
||||
sm_idx = 0
|
||||
tc_des = "发送错误的数据包,导致设备出问题,出问题的设备在没有恢复的情况下,采取直通状态。\\n" \
|
||||
+ "清除中断后,错误消失,出问题的设备恢复正常。"
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#>>>>>>普通数据包 sm1,2个读
|
||||
genPkt.clean()
|
||||
@@ -14,14 +21,16 @@ def tc1():
|
||||
genPkt.addSubPkt(0x03, 0, 0xc0, 0x0, 64, None)
|
||||
#genPkt.addSubPkt(10, 2, 0x300, 0x2, 4, None)
|
||||
#genPkt.addSubPkt(11, 1, 0x300, 0x2, 4, None)
|
||||
|
||||
gen_file_def = "sm1_pkt"
|
||||
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))
|
||||
+genReadAckPktCode(gen_file_def, sm_idx)
|
||||
+genTcEndFrameCode(gen_file_def))
|
||||
|
||||
genPkt.gen("./generated/shin/%s.vh"%(gen_file_def, ), 1)
|
||||
|
||||
@@ -30,6 +39,13 @@ def tc1():
|
||||
|
||||
def tc2():
|
||||
genPkt = GenPkt()
|
||||
|
||||
|
||||
gen_file_def = "base_tc02"
|
||||
sm_idx = 0
|
||||
tc_des = "发送错误的数据包,导致设备出问题,出问题的设备在没有恢复的情况下,采取直通状态。\\n" \
|
||||
+ "清除中断后,错误消失,出问题的设备恢复正常。"
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#>>>>>>普通数据包 sm2,广播读
|
||||
genPkt.clean()
|
||||
@@ -41,14 +57,15 @@ def tc2():
|
||||
#genPkt.addSubPkt(10, 2, 0x300, 0x2, 4, None)
|
||||
#genPkt.addSubPkt(11, 1, 0x300, 0x2, 4, None)
|
||||
|
||||
|
||||
gen_file_def = "sm2_pkt"
|
||||
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))
|
||||
+genReadAckPktCode(gen_file_def, sm_idx)
|
||||
+genTcEndFrameCode(gen_file_def))
|
||||
genPkt.gen("./generated/shin/%s.vh"%(gen_file_def, ), 1)
|
||||
|
||||
return gen_file_def
|
||||
@@ -57,6 +74,12 @@ def tc2():
|
||||
|
||||
def tc3():
|
||||
genPkt = GenPkt()
|
||||
|
||||
gen_file_def = "base_tc03"
|
||||
sm_idx = 0
|
||||
tc_des = "发送错误的数据包,导致设备出问题,出问题的设备在没有恢复的情况下,采取直通状态。\\n" \
|
||||
+ "清除中断后,错误消失,出问题的设备恢复正常。"
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#>>>>>>交换数据 SMx, 两个广播写
|
||||
genPkt.clean()
|
||||
@@ -73,13 +96,15 @@ def tc3():
|
||||
data[i] = i + 1
|
||||
genPkt.addSubPkt(random.randint(0, 2048), 0, 0x0800, 0xe, 16, data) #0x1800, 0xe, 16, data)
|
||||
|
||||
gen_file_def = "sm3_pkt"
|
||||
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))
|
||||
+genReadAckPktCode(gen_file_def, sm_idx)
|
||||
+genTcEndFrameCode(gen_file_def))
|
||||
|
||||
genPkt.gen("./generated/shin/%s.vh"%(gen_file_def, ), 1)
|
||||
|
||||
@@ -88,6 +113,11 @@ def tc3():
|
||||
|
||||
def tc4():
|
||||
genPkt = GenPkt()
|
||||
|
||||
gen_file_def = "base_tc04"
|
||||
sm_idx = 0
|
||||
tc_des = "发送错误的数据包,导致设备出问题,出问题的设备在没有恢复的情况下,采取直通状态。\\n" \
|
||||
+ "清除中断后,错误消失,出问题的设备恢复正常。"
|
||||
#-------------------------------------------------------------------------
|
||||
#>>>>>>普通数据包,一个读、一个写,增加5个随机包(需要在文件里确认)
|
||||
genPkt.clean()
|
||||
@@ -104,20 +134,28 @@ def tc4():
|
||||
#genPkt.addSubPkt(10, 2, 0x300, 0x2, 4, None)
|
||||
#genPkt.addSubPkt(11, 1, 0x300, 0x2, 4, None)
|
||||
|
||||
|
||||
gen_file_def = "seq_0_pkt"
|
||||
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))
|
||||
+genReadAckPktCode(gen_file_def, sm_idx)
|
||||
+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 = "发送错误的数据包,导致设备出问题,出问题的设备在没有恢复的情况下,采取直通状态。\\n" \
|
||||
+ "清除中断后,错误消失,出问题的设备恢复正常。"
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#>>>>>>普通数据包0,用来操作sync
|
||||
genPkt.clean()
|
||||
@@ -176,14 +214,15 @@ def tc5():
|
||||
data[14] = ord('A')
|
||||
genPkt.addSubPkt(0x04, 0, 0x3800, 0x1, 64, data)
|
||||
|
||||
|
||||
gen_file_def = "seq_1_pkt"
|
||||
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))
|
||||
+genReadAckPktCode(gen_file_def, sm_idx)
|
||||
+genTcEndFrameCode(gen_file_def))
|
||||
|
||||
genPkt.gen("./generated/shin/%s.vh"%(gen_file_def, ), 1)
|
||||
return gen_file_def
|
||||
@@ -191,12 +230,19 @@ def tc5():
|
||||
|
||||
def tc6():
|
||||
genPkt = GenPkt()
|
||||
|
||||
gen_file_def = "base_tc06"
|
||||
sm_idx = 0
|
||||
tc_des = "发送错误的数据包,导致设备出问题,出问题的设备在没有恢复的情况下,采取直通状态。\\n" \
|
||||
+ "清除中断后,错误消失,出问题的设备恢复正常。"
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#>>>>>>普通数据包2
|
||||
genPkt.clean()
|
||||
genPkt.setPktType(0)
|
||||
|
||||
genPkt.addBeforeExc( genSlvSMWriteData(3, 1, 129)
|
||||
genPkt.addBeforeExc(genTcStartFrameCode(gen_file_def, tc_des)
|
||||
+genSlvSMWriteData(3, 1, 129)
|
||||
+ genSlvSMWriteData(4, 1, 140)
|
||||
+ genSlvSMWriteData(1, 1, 128)
|
||||
+ genSlvSMWriteData(2, 1, 152))
|
||||
@@ -211,13 +257,13 @@ def tc6():
|
||||
genPkt.addSubPkt(3, 0, 0x0316, 0x0, 2, b"\0"*2)
|
||||
genPkt.addSubPkt(4, 0, 0x031e, 0x0, 2, b"\0"*2)
|
||||
|
||||
gen_file_def = "seq_2_pkt"
|
||||
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))
|
||||
+genReadAckPktCode(gen_file_def, sm_idx)
|
||||
+genTcEndFrameCode(gen_file_def))
|
||||
|
||||
genPkt.gen("./generated/shin/%s.vh"%(gen_file_def, ), 1)
|
||||
|
||||
@@ -227,6 +273,12 @@ def tc6():
|
||||
|
||||
def tc7():
|
||||
genPkt = GenPkt()
|
||||
|
||||
gen_file_def = "base_tc07"
|
||||
sm_idx = 0
|
||||
tc_des = "发送错误的数据包,导致设备出问题,出问题的设备在没有恢复的情况下,采取直通状态。\\n" \
|
||||
+ "清除中断后,错误消失,出问题的设备恢复正常。"
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#>>>>>>普通数据包3
|
||||
genPkt.clean()
|
||||
@@ -240,13 +292,15 @@ def tc7():
|
||||
|
||||
genPkt.addSubPkt(2, 0, 0x0120, 0x2, 2, b"\x05"*32)
|
||||
|
||||
gen_file_def = "seq_3_pkt"
|
||||
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))
|
||||
+genReadAckPktCode(gen_file_def, sm_idx)
|
||||
+genTcEndFrameCode(gen_file_def))
|
||||
|
||||
genPkt.gen("./generated/shin/%s.vh"%(gen_file_def, ), 1)
|
||||
|
||||
@@ -255,6 +309,12 @@ def tc7():
|
||||
|
||||
def tc8():
|
||||
genPkt = GenPkt()
|
||||
|
||||
gen_file_def = "base_tc08"
|
||||
sm_idx = 0
|
||||
tc_des = "发送错误的数据包,导致设备出问题,出问题的设备在没有恢复的情况下,采取直通状态。\\n" \
|
||||
+ "清除中断后,错误消失,出问题的设备恢复正常。"
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#>>>>>>设置顺序地址
|
||||
genPkt.clean()
|
||||
@@ -266,14 +326,15 @@ def tc8():
|
||||
#subPkt参数:索引、索引类型、地址、命令、长度、数据
|
||||
genPkt.addSubPkt(0x0, 0, random.randint(0, 65535), 0xb, 2, data)
|
||||
|
||||
|
||||
gen_file_def = "set_addr_pkt"
|
||||
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))
|
||||
+genReadAckPktCode(gen_file_def, sm_idx)
|
||||
+genTcEndFrameCode(gen_file_def))
|
||||
|
||||
genPkt.gen("./generated/shin/%s.vh"%(gen_file_def, ), 1)
|
||||
|
||||
@@ -282,7 +343,6 @@ def tc8():
|
||||
def tc9():
|
||||
genPkt = GenPkt()
|
||||
|
||||
|
||||
gen_file_def = "base_tc09"
|
||||
sm_idx = 0
|
||||
tc_des = "测试RESET,仅复位主站和2号设备;链路和网络被破坏;发送广播包只能到1,2;3,4收不到。\\n" \
|
||||
|
||||
Reference in New Issue
Block a user