备份代码,尚未测试,实现全自动化生成verilog测试代码
This commit is contained in:
@@ -1632,23 +1632,6 @@ initial begin
|
|||||||
end
|
end
|
||||||
`endif
|
`endif
|
||||||
|
|
||||||
|
|
||||||
`ifdef ENABLE_WD1_TEST
|
|
||||||
begin:WD1_TEST
|
|
||||||
`BEGIN_TESTCASE(`ENABLE_WD1_TEST);
|
|
||||||
_t_start = $realtime;
|
|
||||||
#1000
|
|
||||||
$fdisplay(spidata_file, "\n\n测试用例: Watchdog 测试用1");
|
|
||||||
$display("read&write @ %d", s_ShinTop_Mst.interface__io_cReg_timeStamp);
|
|
||||||
|
|
||||||
`include "wd_tc1.vh"
|
|
||||||
|
|
||||||
_t_end = $realtime;
|
|
||||||
$fdisplay(spidata_file, "该测试用例运行时间:%t\n", _t_end - _t_start);
|
|
||||||
`END_TESTCASE(`ENABLE_WD1_TEST);
|
|
||||||
end
|
|
||||||
`endif
|
|
||||||
|
|
||||||
`include "tc_runlist.vh"
|
`include "tc_runlist.vh"
|
||||||
|
|
||||||
#1000000
|
#1000000
|
||||||
|
|||||||
@@ -1,35 +1,39 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
#encoding=utf-8
|
#encoding=utf-8
|
||||||
from pyutils import *
|
from pyutils import *
|
||||||
from testcase import readregs, ebmmu, detect, errorPkt, watchdog, broadcast, sync, base
|
from testcase import environment, readregs, ebmmu, detect, errorPkt, watchdog, broadcast, sync, base
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
environment.bringup()
|
||||||
|
|
||||||
detect.tc1()
|
detect.tc1()
|
||||||
detect.tc2()
|
detect.tc2()
|
||||||
|
|
||||||
#add_tc_2_runlist(errorPkt.tc1())
|
#add_tc_2_runlist(errorPkt.tc1())
|
||||||
#add_tc_2_runlist(errorPkt.tc2())
|
#add_tc_2_runlist(errorPkt.tc2())
|
||||||
errorPkt.tc3()
|
#add_tc_2_runlist(errorPkt.tc3())
|
||||||
add_tc_2_runlist(errorPkt.tc4())
|
#add_tc_2_runlist(errorPkt.tc4())
|
||||||
|
|
||||||
base.tc1()
|
'''
|
||||||
base.tc2()
|
add_tc_2_runlist(base.tc1())
|
||||||
base.tc3()
|
add_tc_2_runlist(base.tc2())
|
||||||
base.tc4()
|
add_tc_2_runlist(base.tc3())
|
||||||
base.tc5()
|
add_tc_2_runlist(base.tc4())
|
||||||
base.tc6()
|
add_tc_2_runlist(base.tc5())
|
||||||
base.tc7()
|
add_tc_2_runlist(base.tc6())
|
||||||
base.tc8()
|
add_tc_2_runlist(base.tc7())
|
||||||
|
add_tc_2_runlist(base.tc8())
|
||||||
#add_tc_2_runlist(base.tc9())
|
#add_tc_2_runlist(base.tc9())
|
||||||
|
|
||||||
broadcast.tc1()
|
add_tc_2_runlist(broadcast.tc1())
|
||||||
broadcast.tc2()
|
add_tc_2_runlist(broadcast.tc2())
|
||||||
broadcast.tc3()
|
add_tc_2_runlist(broadcast.tc3())
|
||||||
|
|
||||||
sync.tc1()
|
add_tc_2_runlist(sync.tc1())
|
||||||
sync.tc2()
|
add_tc_2_runlist(sync.tc2())
|
||||||
sync.tc3()
|
add_tc_2_runlist(sync.tc3())
|
||||||
sync.tc4()
|
add_tc_2_runlist(sync.tc4())
|
||||||
|
'''
|
||||||
|
|
||||||
'''
|
'''
|
||||||
add_tc_2_runlist(ebmmu.tc1())
|
add_tc_2_runlist(ebmmu.tc1())
|
||||||
@@ -50,7 +54,9 @@ if __name__ == '__main__':
|
|||||||
add_tc_2_runlist(ebmmu.tc16())
|
add_tc_2_runlist(ebmmu.tc16())
|
||||||
'''
|
'''
|
||||||
|
|
||||||
watchdog.tc1()
|
add_tc_2_runlist(watchdog.tc1())
|
||||||
|
|
||||||
|
environment.teardown()
|
||||||
|
|
||||||
gen_tc_runlist()
|
gen_tc_runlist()
|
||||||
|
|
||||||
|
|||||||
@@ -382,4 +382,6 @@ def genTcEndFrameCode(tcname):
|
|||||||
+'''\t\t$fdisplay(spidata_file, "该测试用例运行时间:%t\\n", _t_end - _t_start);\n'''\
|
+'''\t\t$fdisplay(spidata_file, "该测试用例运行时间:%t\\n", _t_end - _t_start);\n'''\
|
||||||
+f'''\t\t`END_TESTCASE("{__pre_gen_log_path}/{tcname}_result.log");\n'''\
|
+f'''\t\t`END_TESTCASE("{__pre_gen_log_path}/{tcname}_result.log");\n'''\
|
||||||
+'''\tend\n'''
|
+'''\tend\n'''
|
||||||
|
|
||||||
|
def genMessage(msg):
|
||||||
|
return f'''\t\t$fdisplay(spidata_file, "{msg}");\n'''
|
||||||
@@ -5,4 +5,5 @@ from .detect import *
|
|||||||
from .errorPkt import *
|
from .errorPkt import *
|
||||||
from .watchdog import *
|
from .watchdog import *
|
||||||
from .broadcast import *
|
from .broadcast import *
|
||||||
from .sync import *
|
from .sync import *
|
||||||
|
from .environment import *
|
||||||
@@ -3,6 +3,13 @@ from pyutils import *
|
|||||||
|
|
||||||
def tc1():
|
def tc1():
|
||||||
genPkt = GenPkt()
|
genPkt = GenPkt()
|
||||||
|
|
||||||
|
gen_file_def = "base_tc01"
|
||||||
|
sm_idx = 0
|
||||||
|
tc_des = "发送错误的数据包,导致设备出问题,出问题的设备在没有恢复的情况下,采取直通状态。\\n" \
|
||||||
|
+ "清除中断后,错误消失,出问题的设备恢复正常。"
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#>>>>>>普通数据包 sm1,2个读
|
#>>>>>>普通数据包 sm1,2个读
|
||||||
genPkt.clean()
|
genPkt.clean()
|
||||||
@@ -14,14 +21,16 @@ def tc1():
|
|||||||
genPkt.addSubPkt(0x03, 0, 0xc0, 0x0, 64, None)
|
genPkt.addSubPkt(0x03, 0, 0xc0, 0x0, 64, None)
|
||||||
#genPkt.addSubPkt(10, 2, 0x300, 0x2, 4, None)
|
#genPkt.addSubPkt(10, 2, 0x300, 0x2, 4, None)
|
||||||
#genPkt.addSubPkt(11, 1, 0x300, 0x2, 4, None)
|
#genPkt.addSubPkt(11, 1, 0x300, 0x2, 4, None)
|
||||||
|
|
||||||
gen_file_def = "sm1_pkt"
|
|
||||||
sm_idx = 1
|
sm_idx = 1
|
||||||
|
|
||||||
|
genPkt.addBeforeExc(genTcStartFrameCode(gen_file_def, tc_des))
|
||||||
|
|
||||||
|
|
||||||
genPkt.addAfterExc(genWriteTransLenCode(gen_file_def, sm_idx)
|
genPkt.addAfterExc(genWriteTransLenCode(gen_file_def, sm_idx)
|
||||||
+genWriteTransPktCode(gen_file_def, sm_idx)
|
+genWriteTransPktCode(gen_file_def, sm_idx)
|
||||||
+genTrgTransPktCode(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)
|
genPkt.gen("./generated/shin/%s.vh"%(gen_file_def, ), 1)
|
||||||
|
|
||||||
@@ -30,6 +39,13 @@ def tc1():
|
|||||||
|
|
||||||
def tc2():
|
def tc2():
|
||||||
genPkt = GenPkt()
|
genPkt = GenPkt()
|
||||||
|
|
||||||
|
|
||||||
|
gen_file_def = "base_tc02"
|
||||||
|
sm_idx = 0
|
||||||
|
tc_des = "发送错误的数据包,导致设备出问题,出问题的设备在没有恢复的情况下,采取直通状态。\\n" \
|
||||||
|
+ "清除中断后,错误消失,出问题的设备恢复正常。"
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#>>>>>>普通数据包 sm2,广播读
|
#>>>>>>普通数据包 sm2,广播读
|
||||||
genPkt.clean()
|
genPkt.clean()
|
||||||
@@ -41,14 +57,15 @@ def tc2():
|
|||||||
#genPkt.addSubPkt(10, 2, 0x300, 0x2, 4, None)
|
#genPkt.addSubPkt(10, 2, 0x300, 0x2, 4, None)
|
||||||
#genPkt.addSubPkt(11, 1, 0x300, 0x2, 4, None)
|
#genPkt.addSubPkt(11, 1, 0x300, 0x2, 4, None)
|
||||||
|
|
||||||
|
|
||||||
gen_file_def = "sm2_pkt"
|
|
||||||
sm_idx = 2
|
sm_idx = 2
|
||||||
|
|
||||||
|
genPkt.addBeforeExc(genTcStartFrameCode(gen_file_def, tc_des))
|
||||||
|
|
||||||
genPkt.addAfterExc(genWriteTransLenCode(gen_file_def, sm_idx)
|
genPkt.addAfterExc(genWriteTransLenCode(gen_file_def, sm_idx)
|
||||||
+genWriteTransPktCode(gen_file_def, sm_idx)
|
+genWriteTransPktCode(gen_file_def, sm_idx)
|
||||||
+genTrgTransPktCode(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)
|
genPkt.gen("./generated/shin/%s.vh"%(gen_file_def, ), 1)
|
||||||
|
|
||||||
return gen_file_def
|
return gen_file_def
|
||||||
@@ -57,6 +74,12 @@ def tc2():
|
|||||||
|
|
||||||
def tc3():
|
def tc3():
|
||||||
genPkt = GenPkt()
|
genPkt = GenPkt()
|
||||||
|
|
||||||
|
gen_file_def = "base_tc03"
|
||||||
|
sm_idx = 0
|
||||||
|
tc_des = "发送错误的数据包,导致设备出问题,出问题的设备在没有恢复的情况下,采取直通状态。\\n" \
|
||||||
|
+ "清除中断后,错误消失,出问题的设备恢复正常。"
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#>>>>>>交换数据 SMx, 两个广播写
|
#>>>>>>交换数据 SMx, 两个广播写
|
||||||
genPkt.clean()
|
genPkt.clean()
|
||||||
@@ -73,13 +96,15 @@ def tc3():
|
|||||||
data[i] = i + 1
|
data[i] = i + 1
|
||||||
genPkt.addSubPkt(random.randint(0, 2048), 0, 0x0800, 0xe, 16, data) #0x1800, 0xe, 16, data)
|
genPkt.addSubPkt(random.randint(0, 2048), 0, 0x0800, 0xe, 16, data) #0x1800, 0xe, 16, data)
|
||||||
|
|
||||||
gen_file_def = "sm3_pkt"
|
|
||||||
sm_idx = 3
|
sm_idx = 3
|
||||||
|
|
||||||
|
genPkt.addBeforeExc(genTcStartFrameCode(gen_file_def, tc_des))
|
||||||
|
|
||||||
genPkt.addAfterExc(genWriteTransLenCode(gen_file_def, sm_idx)
|
genPkt.addAfterExc(genWriteTransLenCode(gen_file_def, sm_idx)
|
||||||
+genWriteTransPktCode(gen_file_def, sm_idx)
|
+genWriteTransPktCode(gen_file_def, sm_idx)
|
||||||
+genTrgTransPktCode(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)
|
genPkt.gen("./generated/shin/%s.vh"%(gen_file_def, ), 1)
|
||||||
|
|
||||||
@@ -88,6 +113,11 @@ def tc3():
|
|||||||
|
|
||||||
def tc4():
|
def tc4():
|
||||||
genPkt = GenPkt()
|
genPkt = GenPkt()
|
||||||
|
|
||||||
|
gen_file_def = "base_tc04"
|
||||||
|
sm_idx = 0
|
||||||
|
tc_des = "发送错误的数据包,导致设备出问题,出问题的设备在没有恢复的情况下,采取直通状态。\\n" \
|
||||||
|
+ "清除中断后,错误消失,出问题的设备恢复正常。"
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#>>>>>>普通数据包,一个读、一个写,增加5个随机包(需要在文件里确认)
|
#>>>>>>普通数据包,一个读、一个写,增加5个随机包(需要在文件里确认)
|
||||||
genPkt.clean()
|
genPkt.clean()
|
||||||
@@ -104,20 +134,28 @@ def tc4():
|
|||||||
#genPkt.addSubPkt(10, 2, 0x300, 0x2, 4, None)
|
#genPkt.addSubPkt(10, 2, 0x300, 0x2, 4, None)
|
||||||
#genPkt.addSubPkt(11, 1, 0x300, 0x2, 4, None)
|
#genPkt.addSubPkt(11, 1, 0x300, 0x2, 4, None)
|
||||||
|
|
||||||
|
|
||||||
gen_file_def = "seq_0_pkt"
|
|
||||||
sm_idx = 0
|
sm_idx = 0
|
||||||
|
|
||||||
|
genPkt.addBeforeExc(genTcStartFrameCode(gen_file_def, tc_des))
|
||||||
|
|
||||||
genPkt.addAfterExc(genWriteTransLenCode(gen_file_def, sm_idx)
|
genPkt.addAfterExc(genWriteTransLenCode(gen_file_def, sm_idx)
|
||||||
+genWriteTransPktCode(gen_file_def, sm_idx)
|
+genWriteTransPktCode(gen_file_def, sm_idx)
|
||||||
+genTrgTransPktCode(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)
|
genPkt.gen("./generated/shin/%s.vh"%(gen_file_def, ), 1)
|
||||||
|
|
||||||
return gen_file_def
|
return gen_file_def
|
||||||
|
|
||||||
def tc5():
|
def tc5():
|
||||||
genPkt = GenPkt()
|
genPkt = GenPkt()
|
||||||
|
|
||||||
|
gen_file_def = "base_tc05"
|
||||||
|
sm_idx = 0
|
||||||
|
tc_des = "发送错误的数据包,导致设备出问题,出问题的设备在没有恢复的情况下,采取直通状态。\\n" \
|
||||||
|
+ "清除中断后,错误消失,出问题的设备恢复正常。"
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#>>>>>>普通数据包0,用来操作sync
|
#>>>>>>普通数据包0,用来操作sync
|
||||||
genPkt.clean()
|
genPkt.clean()
|
||||||
@@ -176,14 +214,15 @@ def tc5():
|
|||||||
data[14] = ord('A')
|
data[14] = ord('A')
|
||||||
genPkt.addSubPkt(0x04, 0, 0x3800, 0x1, 64, data)
|
genPkt.addSubPkt(0x04, 0, 0x3800, 0x1, 64, data)
|
||||||
|
|
||||||
|
|
||||||
gen_file_def = "seq_1_pkt"
|
|
||||||
sm_idx = 0
|
sm_idx = 0
|
||||||
|
|
||||||
|
genPkt.addBeforeExc(genTcStartFrameCode(gen_file_def, tc_des))
|
||||||
|
|
||||||
genPkt.addAfterExc(genWriteTransLenCode(gen_file_def, sm_idx)
|
genPkt.addAfterExc(genWriteTransLenCode(gen_file_def, sm_idx)
|
||||||
+genWriteTransPktCode(gen_file_def, sm_idx)
|
+genWriteTransPktCode(gen_file_def, sm_idx)
|
||||||
+genTrgTransPktCode(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)
|
genPkt.gen("./generated/shin/%s.vh"%(gen_file_def, ), 1)
|
||||||
return gen_file_def
|
return gen_file_def
|
||||||
@@ -191,12 +230,19 @@ def tc5():
|
|||||||
|
|
||||||
def tc6():
|
def tc6():
|
||||||
genPkt = GenPkt()
|
genPkt = GenPkt()
|
||||||
|
|
||||||
|
gen_file_def = "base_tc06"
|
||||||
|
sm_idx = 0
|
||||||
|
tc_des = "发送错误的数据包,导致设备出问题,出问题的设备在没有恢复的情况下,采取直通状态。\\n" \
|
||||||
|
+ "清除中断后,错误消失,出问题的设备恢复正常。"
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#>>>>>>普通数据包2
|
#>>>>>>普通数据包2
|
||||||
genPkt.clean()
|
genPkt.clean()
|
||||||
genPkt.setPktType(0)
|
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(4, 1, 140)
|
||||||
+ genSlvSMWriteData(1, 1, 128)
|
+ genSlvSMWriteData(1, 1, 128)
|
||||||
+ genSlvSMWriteData(2, 1, 152))
|
+ genSlvSMWriteData(2, 1, 152))
|
||||||
@@ -211,13 +257,13 @@ def tc6():
|
|||||||
genPkt.addSubPkt(3, 0, 0x0316, 0x0, 2, b"\0"*2)
|
genPkt.addSubPkt(3, 0, 0x0316, 0x0, 2, b"\0"*2)
|
||||||
genPkt.addSubPkt(4, 0, 0x031e, 0x0, 2, b"\0"*2)
|
genPkt.addSubPkt(4, 0, 0x031e, 0x0, 2, b"\0"*2)
|
||||||
|
|
||||||
gen_file_def = "seq_2_pkt"
|
|
||||||
sm_idx = 0
|
sm_idx = 0
|
||||||
|
|
||||||
genPkt.addAfterExc(genWriteTransLenCode(gen_file_def, sm_idx)
|
genPkt.addAfterExc(genWriteTransLenCode(gen_file_def, sm_idx)
|
||||||
+genWriteTransPktCode(gen_file_def, sm_idx)
|
+genWriteTransPktCode(gen_file_def, sm_idx)
|
||||||
+genTrgTransPktCode(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)
|
genPkt.gen("./generated/shin/%s.vh"%(gen_file_def, ), 1)
|
||||||
|
|
||||||
@@ -227,6 +273,12 @@ def tc6():
|
|||||||
|
|
||||||
def tc7():
|
def tc7():
|
||||||
genPkt = GenPkt()
|
genPkt = GenPkt()
|
||||||
|
|
||||||
|
gen_file_def = "base_tc07"
|
||||||
|
sm_idx = 0
|
||||||
|
tc_des = "发送错误的数据包,导致设备出问题,出问题的设备在没有恢复的情况下,采取直通状态。\\n" \
|
||||||
|
+ "清除中断后,错误消失,出问题的设备恢复正常。"
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#>>>>>>普通数据包3
|
#>>>>>>普通数据包3
|
||||||
genPkt.clean()
|
genPkt.clean()
|
||||||
@@ -240,13 +292,15 @@ def tc7():
|
|||||||
|
|
||||||
genPkt.addSubPkt(2, 0, 0x0120, 0x2, 2, b"\x05"*32)
|
genPkt.addSubPkt(2, 0, 0x0120, 0x2, 2, b"\x05"*32)
|
||||||
|
|
||||||
gen_file_def = "seq_3_pkt"
|
|
||||||
sm_idx = 0
|
sm_idx = 0
|
||||||
|
|
||||||
|
genPkt.addBeforeExc(genTcStartFrameCode(gen_file_def, tc_des))
|
||||||
|
|
||||||
genPkt.addAfterExc(genWriteTransLenCode(gen_file_def, sm_idx)
|
genPkt.addAfterExc(genWriteTransLenCode(gen_file_def, sm_idx)
|
||||||
+genWriteTransPktCode(gen_file_def, sm_idx)
|
+genWriteTransPktCode(gen_file_def, sm_idx)
|
||||||
+genTrgTransPktCode(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)
|
genPkt.gen("./generated/shin/%s.vh"%(gen_file_def, ), 1)
|
||||||
|
|
||||||
@@ -255,6 +309,12 @@ def tc7():
|
|||||||
|
|
||||||
def tc8():
|
def tc8():
|
||||||
genPkt = GenPkt()
|
genPkt = GenPkt()
|
||||||
|
|
||||||
|
gen_file_def = "base_tc08"
|
||||||
|
sm_idx = 0
|
||||||
|
tc_des = "发送错误的数据包,导致设备出问题,出问题的设备在没有恢复的情况下,采取直通状态。\\n" \
|
||||||
|
+ "清除中断后,错误消失,出问题的设备恢复正常。"
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#>>>>>>设置顺序地址
|
#>>>>>>设置顺序地址
|
||||||
genPkt.clean()
|
genPkt.clean()
|
||||||
@@ -266,14 +326,15 @@ def tc8():
|
|||||||
#subPkt参数:索引、索引类型、地址、命令、长度、数据
|
#subPkt参数:索引、索引类型、地址、命令、长度、数据
|
||||||
genPkt.addSubPkt(0x0, 0, random.randint(0, 65535), 0xb, 2, data)
|
genPkt.addSubPkt(0x0, 0, random.randint(0, 65535), 0xb, 2, data)
|
||||||
|
|
||||||
|
|
||||||
gen_file_def = "set_addr_pkt"
|
|
||||||
sm_idx = 0
|
sm_idx = 0
|
||||||
|
|
||||||
|
genPkt.addBeforeExc(genTcStartFrameCode(gen_file_def, tc_des))
|
||||||
|
|
||||||
genPkt.addAfterExc(genWriteTransLenCode(gen_file_def, sm_idx)
|
genPkt.addAfterExc(genWriteTransLenCode(gen_file_def, sm_idx)
|
||||||
+genWriteTransPktCode(gen_file_def, sm_idx)
|
+genWriteTransPktCode(gen_file_def, sm_idx)
|
||||||
+genTrgTransPktCode(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)
|
genPkt.gen("./generated/shin/%s.vh"%(gen_file_def, ), 1)
|
||||||
|
|
||||||
@@ -282,7 +343,6 @@ def tc8():
|
|||||||
def tc9():
|
def tc9():
|
||||||
genPkt = GenPkt()
|
genPkt = GenPkt()
|
||||||
|
|
||||||
|
|
||||||
gen_file_def = "base_tc09"
|
gen_file_def = "base_tc09"
|
||||||
sm_idx = 0
|
sm_idx = 0
|
||||||
tc_des = "测试RESET,仅复位主站和2号设备;链路和网络被破坏;发送广播包只能到1,2;3,4收不到。\\n" \
|
tc_des = "测试RESET,仅复位主站和2号设备;链路和网络被破坏;发送广播包只能到1,2;3,4收不到。\\n" \
|
||||||
|
|||||||
@@ -3,6 +3,13 @@ from pyutils import *
|
|||||||
|
|
||||||
def tc1():
|
def tc1():
|
||||||
genPkt = GenPkt()
|
genPkt = GenPkt()
|
||||||
|
|
||||||
|
|
||||||
|
gen_file_def = "broadcast_tc01"
|
||||||
|
sm_idx = 0
|
||||||
|
tc_des = "发送错误的数据包,导致设备出问题,出问题的设备在没有恢复的情况下,采取直通状态。\\n" \
|
||||||
|
+ "清除中断后,错误消失,出问题的设备恢复正常。"
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#>>>>>>广播读
|
#>>>>>>广播读
|
||||||
genPkt.clean()
|
genPkt.clean()
|
||||||
@@ -20,13 +27,16 @@ def tc1():
|
|||||||
genPkt.addSubPkt(random.randint(0, 2048), 0, 0xc0, 0xd, 4, b"\0"*4)
|
genPkt.addSubPkt(random.randint(0, 2048), 0, 0xc0, 0xd, 4, b"\0"*4)
|
||||||
|
|
||||||
|
|
||||||
gen_file_def = "bc_r_pkt"
|
#gen_file_def = "bc_r_pkt"
|
||||||
sm_idx = 0
|
sm_idx = 0
|
||||||
|
|
||||||
|
genPkt.addBeforeExc(genTcStartFrameCode(gen_file_def, tc_des))
|
||||||
|
|
||||||
genPkt.addAfterExc(genWriteTransLenCode(gen_file_def, sm_idx)
|
genPkt.addAfterExc(genWriteTransLenCode(gen_file_def, sm_idx)
|
||||||
+genWriteTransPktCode(gen_file_def, sm_idx)
|
+genWriteTransPktCode(gen_file_def, sm_idx)
|
||||||
+genTrgTransPktCode(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)
|
genPkt.gen("./generated/shin/%s.vh"%(gen_file_def, ), 1)
|
||||||
return gen_file_def
|
return gen_file_def
|
||||||
@@ -35,6 +45,12 @@ def tc1():
|
|||||||
|
|
||||||
def tc2():
|
def tc2():
|
||||||
genPkt = GenPkt()
|
genPkt = GenPkt()
|
||||||
|
|
||||||
|
gen_file_def = "broadcast_tc02"
|
||||||
|
sm_idx = 0
|
||||||
|
tc_des = "发送错误的数据包,导致设备出问题,出问题的设备在没有恢复的情况下,采取直通状态。\\n" \
|
||||||
|
+ "清除中断后,错误消失,出问题的设备恢复正常。"
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#>>>>>>广播写
|
#>>>>>>广播写
|
||||||
genPkt.clean()
|
genPkt.clean()
|
||||||
@@ -51,13 +67,15 @@ def tc2():
|
|||||||
data[i] = i + 1
|
data[i] = i + 1
|
||||||
genPkt.addSubPkt(random.randint(0, 2048), 0, 0x0800, 0xe, 32, data)
|
genPkt.addSubPkt(random.randint(0, 2048), 0, 0x0800, 0xe, 32, data)
|
||||||
|
|
||||||
gen_file_def = "bc_w_pkt"
|
|
||||||
sm_idx = 0
|
sm_idx = 0
|
||||||
|
|
||||||
|
genPkt.addBeforeExc(genTcStartFrameCode(gen_file_def, tc_des))
|
||||||
|
|
||||||
genPkt.addAfterExc(genWriteTransLenCode(gen_file_def, sm_idx)
|
genPkt.addAfterExc(genWriteTransLenCode(gen_file_def, sm_idx)
|
||||||
+genWriteTransPktCode(gen_file_def, sm_idx)
|
+genWriteTransPktCode(gen_file_def, sm_idx)
|
||||||
+genTrgTransPktCode(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)
|
genPkt.gen("./generated/shin/%s.vh"%(gen_file_def, ), 1)
|
||||||
return gen_file_def
|
return gen_file_def
|
||||||
@@ -65,6 +83,13 @@ def tc2():
|
|||||||
|
|
||||||
def tc3():
|
def tc3():
|
||||||
genPkt = GenPkt()
|
genPkt = GenPkt()
|
||||||
|
|
||||||
|
|
||||||
|
gen_file_def = "broadcast_tc03"
|
||||||
|
sm_idx = 0
|
||||||
|
tc_des = "发送错误的数据包,导致设备出问题,出问题的设备在没有恢复的情况下,采取直通状态。\\n" \
|
||||||
|
+ "清除中断后,错误消失,出问题的设备恢复正常。"
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#>>>>>>广播读写
|
#>>>>>>广播读写
|
||||||
genPkt.clean()
|
genPkt.clean()
|
||||||
@@ -76,13 +101,15 @@ def tc3():
|
|||||||
data[i] = i + 1
|
data[i] = i + 1
|
||||||
genPkt.addSubPkt(random.randint(0, 2048), 0, 0x00c0, 0xf, 4, data)
|
genPkt.addSubPkt(random.randint(0, 2048), 0, 0x00c0, 0xf, 4, data)
|
||||||
|
|
||||||
gen_file_def = "bc_rw_pkt"
|
|
||||||
sm_idx = 0
|
sm_idx = 0
|
||||||
|
|
||||||
|
genPkt.addBeforeExc(genTcStartFrameCode(gen_file_def, tc_des))
|
||||||
|
|
||||||
genPkt.addAfterExc(genWriteTransLenCode(gen_file_def, sm_idx)
|
genPkt.addAfterExc(genWriteTransLenCode(gen_file_def, sm_idx)
|
||||||
+genWriteTransPktCode(gen_file_def, sm_idx)
|
+genWriteTransPktCode(gen_file_def, sm_idx)
|
||||||
+genTrgTransPktCode(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)
|
genPkt.gen("./generated/shin/%s.vh"%(gen_file_def, ), 1)
|
||||||
return gen_file_def
|
return gen_file_def
|
||||||
|
|||||||
41
tb/shinTest/testcase/environment.py
Normal file
41
tb/shinTest/testcase/environment.py
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
from pyutils import *
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def bringup():
|
||||||
|
gen_file_def = "sys_bringup"
|
||||||
|
sm_idx = 0
|
||||||
|
tc_des = "发送错误的数据包,导致设备出问题,出问题的设备在没有恢复的情况下,采取直通状态。\\n" \
|
||||||
|
+ "清除中断后,错误消失,出问题的设备恢复正常。"
|
||||||
|
|
||||||
|
genPkt = GenPkt()
|
||||||
|
|
||||||
|
genPkt.clean()
|
||||||
|
|
||||||
|
genPkt.addBeforeExc(genTcStartFrameCode(gen_file_def, tc_des))
|
||||||
|
|
||||||
|
main_dev = [0x01, ]
|
||||||
|
slave_dev =[0x02, ]
|
||||||
|
genPkt.addAfterExc(genIFRwDataCode(0, 0x0, True, 1, main_dev)
|
||||||
|
+"#5000\n"
|
||||||
|
+genIFRwDataCode(1, 0x0, True, 1, slave_dev)
|
||||||
|
+genIFRwDataCode(2, 0x0, True, 1, slave_dev)
|
||||||
|
+genIFRwDataCode(3, 0x0, True, 1, slave_dev)
|
||||||
|
+genIFRwDataCode(4, 0x0, True, 1, slave_dev)
|
||||||
|
+genMessage("--读取寄存器,检查相关的配置")
|
||||||
|
+genIFRwDataCode(1, 0x0, False, 1)
|
||||||
|
+genIFRwDataCode(1, 0x0, False, 1)
|
||||||
|
+genIFRwDataCode(2, 0x0, False, 1)
|
||||||
|
+genIFRwDataCode(3, 0x0, False, 1)
|
||||||
|
+genIFRwDataCode(4, 0x0, False, 1)
|
||||||
|
)
|
||||||
|
|
||||||
|
genPkt.gen("./generated/shin/%s.vh"%(gen_file_def, ), 1)
|
||||||
|
add_tc_2_runlist(gen_file_def)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def teardown():
|
||||||
|
#add_tc_2_runlist("")
|
||||||
|
pass
|
||||||
@@ -145,6 +145,12 @@ def tc2():
|
|||||||
|
|
||||||
def tc3():
|
def tc3():
|
||||||
random.seed(int(time.time() * 1000))
|
random.seed(int(time.time() * 1000))
|
||||||
|
|
||||||
|
gen_file_def = "error_pkt_tc03"
|
||||||
|
sm_idx = 0
|
||||||
|
tc_des = "发送错误的数据包,导致设备出问题,出问题的设备在没有恢复的情况下,采取直通状态。\\n" \
|
||||||
|
+ "清除中断后,错误消失,出问题的设备恢复正常。"
|
||||||
|
|
||||||
genPkt = GenPkt()
|
genPkt = GenPkt()
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#>>>>>>错误的数据包3
|
#>>>>>>错误的数据包3
|
||||||
@@ -155,13 +161,15 @@ def tc3():
|
|||||||
data.append(random.randint(0, 255))
|
data.append(random.randint(0, 255))
|
||||||
|
|
||||||
genPkt.setPkt(2, data)
|
genPkt.setPkt(2, data)
|
||||||
gen_file_def = "err_pkt3"
|
|
||||||
sm_idx = 0
|
sm_idx = 0
|
||||||
|
|
||||||
|
genPkt.addBeforeExc(genTcStartFrameCode(gen_file_def, tc_des))
|
||||||
|
|
||||||
genPkt.addAfterExc(genWriteTransLenCode(gen_file_def, sm_idx)
|
genPkt.addAfterExc(genWriteTransLenCode(gen_file_def, sm_idx)
|
||||||
+genWriteTransPktCode(gen_file_def, sm_idx)
|
+genWriteTransPktCode(gen_file_def, sm_idx)
|
||||||
+genTrgTransPktCode(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)
|
genPkt.gen("./generated/shin/%s.vh"%(gen_file_def, ), 1)
|
||||||
return gen_file_def
|
return gen_file_def
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,12 @@ from pyutils import *
|
|||||||
|
|
||||||
def tc1():
|
def tc1():
|
||||||
genPkt = GenPkt()
|
genPkt = GenPkt()
|
||||||
|
|
||||||
|
gen_file_def = "sync_tc01"
|
||||||
|
sm_idx = 0
|
||||||
|
tc_des = "发送错误的数据包,导致设备出问题,出问题的设备在没有恢复的情况下,采取直通状态。\\n" \
|
||||||
|
+ "清除中断后,错误消失,出问题的设备恢复正常。"
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#>>>>>>同步数据包
|
#>>>>>>同步数据包
|
||||||
genPkt.clean()
|
genPkt.clean()
|
||||||
@@ -12,16 +18,17 @@ def tc1():
|
|||||||
genPkt.addSubPkt(0x0, 0, random.randint(0, 65535), 0xc, 12, b'\0'*12)
|
genPkt.addSubPkt(0x0, 0, random.randint(0, 65535), 0xc, 12, b'\0'*12)
|
||||||
|
|
||||||
|
|
||||||
genPkt.addBeforeExc(genEnableInsertTimeCode(0xa))
|
genPkt.addBeforeExc(genTcStartFrameCode(gen_file_def, tc_des)
|
||||||
|
+genEnableInsertTimeCode(0xa))
|
||||||
|
|
||||||
gen_file_def = "sync_pkt"
|
|
||||||
sm_idx = 0
|
sm_idx = 0
|
||||||
|
|
||||||
genPkt.addAfterExc(genWriteTransLenCode(gen_file_def, sm_idx)
|
genPkt.addAfterExc(genWriteTransLenCode(gen_file_def, sm_idx)
|
||||||
+genWriteTransPktCode(gen_file_def, sm_idx)
|
+genWriteTransPktCode(gen_file_def, sm_idx)
|
||||||
+genTrgTransPktCode(gen_file_def, sm_idx)
|
+genTrgTransPktCode(gen_file_def, sm_idx)
|
||||||
+genReadAckPktCode(gen_file_def, sm_idx)
|
+genReadAckPktCode(gen_file_def, sm_idx)
|
||||||
+genCheckInsertTimeCode()) #+genDisableInsertTimeCode())
|
+genCheckInsertTimeCode()
|
||||||
|
+genTcEndFrameCode(gen_file_def)) #+genDisableInsertTimeCode())
|
||||||
|
|
||||||
|
|
||||||
genPkt.gen("./generated/shin/%s.vh"%(gen_file_def, ), 1)
|
genPkt.gen("./generated/shin/%s.vh"%(gen_file_def, ), 1)
|
||||||
@@ -30,6 +37,12 @@ def tc1():
|
|||||||
|
|
||||||
def tc2():
|
def tc2():
|
||||||
genPkt = GenPkt()
|
genPkt = GenPkt()
|
||||||
|
|
||||||
|
gen_file_def = "sync_tc02"
|
||||||
|
sm_idx = 0
|
||||||
|
tc_des = "发送错误的数据包,导致设备出问题,出问题的设备在没有恢复的情况下,采取直通状态。\\n" \
|
||||||
|
+ "清除中断后,错误消失,出问题的设备恢复正常。"
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#>>>>>>设置同步信号的数据包,在波形中确认定时的有效性
|
#>>>>>>设置同步信号的数据包,在波形中确认定时的有效性
|
||||||
genPkt.clean()
|
genPkt.clean()
|
||||||
@@ -64,13 +77,15 @@ def tc2():
|
|||||||
|
|
||||||
genPkt.addSubPkt(random.randint(0, 2048), 0, 0x120, 0xe, 0x28, data)
|
genPkt.addSubPkt(random.randint(0, 2048), 0, 0x120, 0xe, 0x28, data)
|
||||||
|
|
||||||
gen_file_def = "sync_sig_pkt"
|
|
||||||
sm_idx = 0
|
sm_idx = 0
|
||||||
|
|
||||||
|
genPkt.addBeforeExc(genTcStartFrameCode(gen_file_def, tc_des))
|
||||||
|
|
||||||
genPkt.addAfterExc(genWriteTransLenCode(gen_file_def, sm_idx)
|
genPkt.addAfterExc(genWriteTransLenCode(gen_file_def, sm_idx)
|
||||||
+genWriteTransPktCode(gen_file_def, sm_idx)
|
+genWriteTransPktCode(gen_file_def, sm_idx)
|
||||||
+genTrgTransPktCode(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)
|
genPkt.gen("./generated/shin/%s.vh"%(gen_file_def, ), 1)
|
||||||
@@ -79,17 +94,22 @@ def tc2():
|
|||||||
|
|
||||||
|
|
||||||
def tc3():
|
def tc3():
|
||||||
genPkt = GenPkt()
|
genPkt = GenPkt()
|
||||||
|
|
||||||
|
gen_file_def = "sync_tc03"
|
||||||
|
sm_idx = 0
|
||||||
|
tc_des = "发送错误的数据包,导致设备出问题,出问题的设备在没有恢复的情况下,采取直通状态。\\n" \
|
||||||
|
+ "清除中断后,错误消失,出问题的设备恢复正常。"
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#>>>>>>设置同步信号的数据包2
|
#>>>>>>设置同步信号的数据包2
|
||||||
genPkt.clean()
|
genPkt.clean()
|
||||||
genPkt.setPktType(0)
|
genPkt.setPktType(0)
|
||||||
gen_file_def = "sync_sig2_pkt"
|
|
||||||
sm_idx = 3
|
sm_idx = 3
|
||||||
|
|
||||||
genPkt.addBeforeExc(
|
genPkt.addBeforeExc(genTcStartFrameCode(gen_file_def, tc_des)
|
||||||
'''spi_trans( (16'h0100), (`SPI_READ), (8), (`IF_IDX(0)));\n'''
|
+ '''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 = 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''')
|
+ '''_temp_time = _temp_time + 32'h3000;\n\n''')
|
||||||
|
|
||||||
@@ -166,7 +186,8 @@ def tc3():
|
|||||||
genPkt.addAfterExc(genWriteTransLenCode(gen_file_def, sm_idx)
|
genPkt.addAfterExc(genWriteTransLenCode(gen_file_def, sm_idx)
|
||||||
+genWriteTransPktCode(gen_file_def, sm_idx)
|
+genWriteTransPktCode(gen_file_def, sm_idx)
|
||||||
+genTrgTransPktCode(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)
|
genPkt.gen("./generated/shin/%s.vh"%(gen_file_def,), 1)
|
||||||
return gen_file_def
|
return gen_file_def
|
||||||
@@ -175,15 +196,20 @@ def tc3():
|
|||||||
|
|
||||||
def tc4():
|
def tc4():
|
||||||
genPkt = GenPkt()
|
genPkt = GenPkt()
|
||||||
|
|
||||||
|
gen_file_def = "sync_tc04"
|
||||||
|
sm_idx = 0
|
||||||
|
tc_des = "发送错误的数据包,导致设备出问题,出问题的设备在没有恢复的情况下,采取直通状态。\\n" \
|
||||||
|
+ "清除中断后,错误消失,出问题的设备恢复正常。"
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#>>>>>>设置同步信号的数据包3
|
#>>>>>>设置同步信号的数据包3
|
||||||
genPkt.clean()
|
genPkt.clean()
|
||||||
genPkt.setPktType(0)
|
genPkt.setPktType(0)
|
||||||
gen_file_def = "sync_sig3_pkt"
|
|
||||||
sm_idx = 3
|
sm_idx = 3
|
||||||
|
|
||||||
genPkt.addBeforeExc(
|
genPkt.addBeforeExc(genTcStartFrameCode(gen_file_def, tc_des)
|
||||||
'''spi_trans( (16'h0100), (`SPI_READ), (8), (`IF_IDX(0)));\n'''
|
+ '''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 = 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''')
|
+ '''_temp_time = _temp_time + 32'h3000;\n\n''')
|
||||||
|
|
||||||
@@ -283,7 +309,8 @@ def tc4():
|
|||||||
genPkt.addAfterExc(genWriteTransLenCode(gen_file_def, sm_idx)
|
genPkt.addAfterExc(genWriteTransLenCode(gen_file_def, sm_idx)
|
||||||
+genWriteTransPktCode(gen_file_def, sm_idx)
|
+genWriteTransPktCode(gen_file_def, sm_idx)
|
||||||
+genTrgTransPktCode(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)
|
genPkt.gen("./generated/shin/%s.vh"%(gen_file_def,), 1)
|
||||||
return gen_file_def
|
return gen_file_def
|
||||||
|
|||||||
@@ -2,6 +2,13 @@ from pyutils import *
|
|||||||
|
|
||||||
def tc1():
|
def tc1():
|
||||||
genPkt = GenPkt()
|
genPkt = GenPkt()
|
||||||
|
|
||||||
|
|
||||||
|
gen_file_def = "watchdog_tc01"
|
||||||
|
sm_idx = 0
|
||||||
|
tc_des = "发送错误的数据包,导致设备出问题,出问题的设备在没有恢复的情况下,采取直通状态。\\n" \
|
||||||
|
+ "清除中断后,错误消失,出问题的设备恢复正常。"
|
||||||
|
|
||||||
#--------------------------------------------------------------------------
|
#--------------------------------------------------------------------------
|
||||||
#>>>>>> 测试用例1 看门狗测试
|
#>>>>>> 测试用例1 看门狗测试
|
||||||
genPkt.clean()
|
genPkt.clean()
|
||||||
@@ -16,7 +23,8 @@ def tc1():
|
|||||||
data = 0xffffffff ##清除中断
|
data = 0xffffffff ##清除中断
|
||||||
data2 = [data&0xff, (data>>8)&0xff, (data>>16)&0xff, (data>>24)&0xff]
|
data2 = [data&0xff, (data>>8)&0xff, (data>>16)&0xff, (data>>24)&0xff]
|
||||||
|
|
||||||
genPkt.addBeforeExc( genIFRwDataCode(1, 0x404, True, 4, data0)
|
genPkt.addBeforeExc(genTcStartFrameCode(gen_file_def, tc_des)
|
||||||
|
+ genIFRwDataCode(1, 0x404, True, 4, data0)
|
||||||
+ genIFRwDataCode(1, 0x40C, True, 4, data1)
|
+ genIFRwDataCode(1, 0x40C, True, 4, data1)
|
||||||
+ genIFRwDataCode(1, 0x078, True, 4, data2)
|
+ genIFRwDataCode(1, 0x078, True, 4, data2)
|
||||||
+ genIFRwDataCode(2, 0x078, True, 4, data2)
|
+ genIFRwDataCode(2, 0x078, True, 4, data2)
|
||||||
@@ -41,7 +49,6 @@ def tc1():
|
|||||||
#subPkt参数:索引、索引类型、地址、命令、长度、数据
|
#subPkt参数:索引、索引类型、地址、命令、长度、数据
|
||||||
genPkt.addSubPkt(1, 0, 0x800, 0x1, 0x50, data)
|
genPkt.addSubPkt(1, 0, 0x800, 0x1, 0x50, data)
|
||||||
|
|
||||||
gen_file_def = "wd_tc1"
|
|
||||||
sm_idx = 0
|
sm_idx = 0
|
||||||
|
|
||||||
genPkt.addAfterExc(genWriteTransLenCode(gen_file_def, sm_idx)
|
genPkt.addAfterExc(genWriteTransLenCode(gen_file_def, sm_idx)
|
||||||
@@ -54,7 +61,8 @@ def tc1():
|
|||||||
+genIFRwDataCode(2, 0x074, False, 0x04)
|
+genIFRwDataCode(2, 0x074, False, 0x04)
|
||||||
+genIFRwDataCode(3, 0x074, False, 0x04)
|
+genIFRwDataCode(3, 0x074, False, 0x04)
|
||||||
+genIFRwDataCode(4, 0x074, False, 0x04)
|
+genIFRwDataCode(4, 0x074, False, 0x04)
|
||||||
+genIFRwDataCode(1, 0x400, False, 0x04))
|
+genIFRwDataCode(1, 0x400, False, 0x04)
|
||||||
|
+genTcEndFrameCode(gen_file_def))
|
||||||
|
|
||||||
genPkt.gen("./generated/shin/%s.vh"%(gen_file_def, ), 1)
|
genPkt.gen("./generated/shin/%s.vh"%(gen_file_def, ), 1)
|
||||||
return gen_file_def
|
return gen_file_def
|
||||||
|
|||||||
Reference in New Issue
Block a user