From aa28113c07682cef3b1e33fb8785651fe7a7bc43 Mon Sep 17 00:00:00 2001 From: bacon Date: Wed, 17 Sep 2025 14:40:15 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E5=A2=9E=E5=8A=A00xa=E5=8D=8F=E8=AE=AE?= =?UTF-8?q?=E5=AD=90=E6=8A=A5=E6=96=87=E7=9A=84=E6=B5=8B=E8=AF=95,?= =?UTF-8?q?=E5=9B=A0=E4=B8=BA=E4=B8=8E=E6=97=B6=E9=97=B4=E7=9B=B8=E5=85=B3?= =?UTF-8?q?,=E6=B5=8B=E8=AF=95=E8=8C=83=E5=9B=B4=E8=BF=98=E8=BE=83?= =?UTF-8?q?=E7=AA=84,=E7=9B=AE=E5=89=8D=E4=BB=85=E4=BB=85=E6=98=AF?= =?UTF-8?q?=E5=86=92=E7=83=9F=E6=B5=8B=E8=AF=95,=E8=B2=8C=E4=BC=BC?= =?UTF-8?q?=E6=98=AF=E8=BF=87=E5=85=B3=E7=9A=84.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tb/shinTest/pyutils/GenPkt.py | 2 +- tb/shinTest/testcase/sync.py | 481 +++++++++++++++++++++++++++++++++- 2 files changed, 481 insertions(+), 2 deletions(-) diff --git a/tb/shinTest/pyutils/GenPkt.py b/tb/shinTest/pyutils/GenPkt.py index aa21d21..6de469d 100644 --- a/tb/shinTest/pyutils/GenPkt.py +++ b/tb/shinTest/pyutils/GenPkt.py @@ -49,7 +49,7 @@ class GenPkt(object): if not (ptype in [0, 2]): print('Error, bad subpkt type:', ptype) return - if not (cmd in [0, 1, 2, 0xb, 0xc, 0xd, 0xe, 0xf]): + if not (cmd in [0, 1, 2, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf]): print('Error, bad cmd:', cmd) return diff --git a/tb/shinTest/testcase/sync.py b/tb/shinTest/testcase/sync.py index 6cf31ca..bade095 100644 --- a/tb/shinTest/testcase/sync.py +++ b/tb/shinTest/testcase/sync.py @@ -1550,4 +1550,483 @@ def tc7(): genPkt.gen("./generated/shin/%s.vh"%(gen_file_def,), 1, True, gen_file_def_ap) - return gen_file_def \ No newline at end of file + return gen_file_def + + +def tc8(): + genPkt = GenPkt() + + gen_file_def = "sync_tc08" + 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) + genPkt.addSubPkt(0, 0, 0x18, 0xe, 2, [0x1, 0x58]) + + #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) + genPkt.addSubPkt(0, 0, 0x18, 0xe, 2, [0x0, 0x58]) + + #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, 0xa, 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 = 1 + + genPkt.addBeforeExc("\n#5000\n" + +genIFRwDataCode(0, 0x09, True, 1, [0, ], False, iface=1) + +using_proper_transcode(0) + + +genIFRwDataCode(0, 0x74, False, 4) + #+genIFRwDataCode(0, 0x40, False, 4) + +genIFRwDataCode(0, 0x00, True, 1, [0x1, ]) + ) + + genPkt.addSubPkt(0x0, 0, 0x180, 0xd, 10, b'\0'*10) + + 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) + ) + + genPkt.gen("./generated/shin/%s.vh"%(gen_file_def,), 1, True, gen_file_def_ap) + + + genPkt.clean() + genPkt.setPktType(0) + sm_idx = 1 + + + genPkt.addBeforeExc(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''' + + '''txBuf[3] = 8'h0f;\n''' + + '''txBuf[4] = 8'h00;\n''' + + '''txBuf[5] = 8'h0a;\n''' + + '''txBuf[6] = 8'h00;\n''' + + '''txBuf[7] = 8'h0a;\n''' + + '''txBuf[8] = 8'h00;\n''' + + '''txBuf[9] = 8'h0a;\n''' + + '''txBuf[10] = 8'h00;\n''' + + '''txBuf[11] = 8'h01;\n''' + + '''txBuf[12] = 8'h00;\n''' + + '''txBuf[19] = (_temp_time & 8'hff);\n''' + + '''txBuf[20] = ( (_temp_time >> 8) & 8'hff);\n''' + + '''txBuf[21] = ((_temp_time >> 16) & 8'hff);\n''' + + '''txBuf[22] = ((_temp_time >> 24) & 8'hff);\n''' + + '''txBuf[23] = ((_temp_time >> 32) & 8'hff);\n''' + + '''txBuf[24] = 0;\n''' + + '''txBuf[25] = 0;\n''' + + '''txBuf[26] = 0;\n''' + + '''txBuf[27] = 8'h80;\n''' + + '''txBuf[28] = 8'h00;\n''' + + '''txBuf[29] = 8'h00;\n''' + + '''txBuf[30] = 8'h00;\n''' + + '''txBuf[31] = 8'h00;\n''' + + '''txBuf[32] = 8'h00;\n''' + + '''txBuf[33] = 8'h00;\n''' + + '''txBuf[34] = 8'h00;\n''' + + '''txBuf[35] = 8'h00;\n''' + + '''txBuf[36] = 8'h00;\n''' + + '''txBuf[37] = 8'h00;\n''' + + '''txBuf[38] = 8'h00;\n''' + + '''txBuf[39] = 8'h00;\n''' + + '''txBuf[40] = 8'h00;\n''' + + '''txBuf[41] = 8'h00;\n''' + + '''txBuf[42] = 8'h00;\n''' + + '''txBuf[43] = 8'h00;\n''' + + '''spi_trans( (16'h0120), (`SPI_WRITE), (40), (`IF_IDX(0)));\n''' + ) + + genPkt.addSubPkt(0x0, 0, 0x0, 0xc, 12, b'\0'*12) + genPkt.addSubPkt(0, 0, 0x18, 0xe, 2, [0x1, 0x58]) + #subPkt参数:索引、索引类型、地址、命令、长度、数据 + data = [0,] * 100 #bytearray(b"\0" * 100) + data[0] = 0x0f #地址0x120 + data[1] = 0x0 + data[2] = 0xa + data[3] = 0x0 + data[4] = 0xa + data[5] = 0x0 + 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) + genPkt.addSubPkt(0, 0, 0x18, 0xe, 2, [0x0, 0x58]) + + gen_file_def_ap = gen_file_def + "_rw04" + 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) + + ) + + genPkt.gen("./generated/shin/%s.vh"%(gen_file_def,), 1, True, gen_file_def_ap) + + #>>>>>>同步数据包 + genPkt.clean() + genPkt.setPktType(0) + + #subPkt参数:索引、索引类型、地址、命令、长度、数据 + genPkt.addSubPkt(0x0, 0, 0x0, 0xa, 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 + "_rw05" + + 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) + + +genTcEndFrameCode(gen_file_def) + ) #+genDisableInsertTimeCode()) + + + genPkt.gen("./generated/shin/%s.vh"%(gen_file_def, ), 1, True, gen_file_def_ap) + + return gen_file_def From 759218b57037de8850bb230246287769d54205f0 Mon Sep 17 00:00:00 2001 From: RuigeLee Date: Wed, 17 Sep 2025 17:29:19 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=BE=AE=E8=B0=83?= =?UTF-8?q?=E6=96=B9=E5=90=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/scala/backBoard/shin/SlaveParser.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/scala/backBoard/shin/SlaveParser.scala b/src/main/scala/backBoard/shin/SlaveParser.scala index e4ff481..a36f43a 100644 --- a/src/main/scala/backBoard/shin/SlaveParser.scala +++ b/src/main/scala/backBoard/shin/SlaveParser.scala @@ -945,8 +945,8 @@ trait SlaveParserSync{ this: SlaveParserBase => ( isDownRecPing & downSubMsgHeadInfo(0).devIndex === 0.U & downSubMsgHeadInfo(0).operator === SUBMSG_OPERATOR_SYNCA ) | ( ~isDownRecPing & downSubMsgHeadInfo(1).devIndex === 0.U & downSubMsgHeadInfo(1).operator === SUBMSG_OPERATOR_SYNCA ) ){ - addr64_op1 := deltaFinal //组合逻辑 - addr64_op2 := subOp2(deltaFinalPre) //组合逻辑 + addr64_op1 := deltaFinalPre //组合逻辑 + addr64_op2 := subOp2(deltaFinal) //组合逻辑 addrConflict(4) := true.B //组合逻辑 deltaFinal := MuxCase( deltaFinalPre, Seq( //时序逻辑 ( addr64_res.asSInt < -10.S ) -> ( deltaFinal - 10.U ), From db799c5622dab80100d04131469385ea743a0da4 Mon Sep 17 00:00:00 2001 From: bacon Date: Wed, 17 Sep 2025 21:55:53 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=EF=BC=8C=E6=B5=8B=E8=AF=950xa=E7=9A=84=E5=91=BD=E4=BB=A4?= =?UTF-8?q?=EF=BC=8C=E6=96=B9=E5=90=91=E6=AD=A3=E7=A1=AE=EF=BC=8C=E9=9C=80?= =?UTF-8?q?=E8=A6=81=E7=BB=BC=E5=90=88=E5=88=B0FPGA=E5=B9=B3=E5=8F=B0?= =?UTF-8?q?=E4=B8=8A=E8=BF=9B=E4=B8=80=E6=AD=A5=E6=B5=8B=E8=AF=95=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tb/shinTest/gen_pkt.py | 5 +- tb/shinTest/testcase/sync.py | 107 ++++++++++++++++++++++++++++++++--- 2 files changed, 103 insertions(+), 9 deletions(-) diff --git a/tb/shinTest/gen_pkt.py b/tb/shinTest/gen_pkt.py index 8ec63b3..29a1353 100755 --- a/tb/shinTest/gen_pkt.py +++ b/tb/shinTest/gen_pkt.py @@ -62,9 +62,11 @@ if __name__ == '__main__': add_tc_2_runlist(errorPkt.tc38()) #''' + ''' add_tc_2_runlist(rwregs.tc1()) - #add_tc_2_runlist(rwregs.tc2()) + add_tc_2_runlist(rwregs.tc2()) add_tc_2_runlist(rwregs.tc3()) + #''' ''' add_tc_2_runlist(base.tc1()) @@ -115,6 +117,7 @@ if __name__ == '__main__': add_tc_2_runlist(sync.tc6()) add_tc_2_runlist(sync.tc7()) #''' + add_tc_2_runlist(sync.tc8()) ''' add_tc_2_runlist(ebmmu.tc1()) diff --git a/tb/shinTest/testcase/sync.py b/tb/shinTest/testcase/sync.py index bade095..a310889 100644 --- a/tb/shinTest/testcase/sync.py +++ b/tb/shinTest/testcase/sync.py @@ -1712,9 +1712,6 @@ def tc8(): genPkt.addSubPkt(0x0, 0, 0x0, 0xa, 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)) @@ -1748,13 +1745,107 @@ def tc8(): +genIFRwDataCode(3, 0x74, False, 4) +genIFRwDataCode(4, 0x74, False, 4) - +"#5000000" + +"#50000" +genIFRwDataCode(0, 0x40, True, 4, [0x01, 0x00, 0x66, 0x79]) + + +"#50000" + +genIFRwDataCode(1, 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(1) + sm_idx = 1 + + genPkt.addBeforeExc("\n#5000\n" + +genIFRwDataCode(0, 0x09, True, 1, [0, ], False, iface=1) + +using_proper_transcode(0) + + +genIFRwDataCode(0, 0x74, False, 4) + +genIFRwDataCode(0, 0x00, True, 1, [0x1, ]) + +genIFRwDataCode(0, 0x78, True, 4, [0xff, 0xff, 0xff, 0xff]) + + +genIFRwDataCode(1, 0x09, True, 1, [0, ], False, iface=1) + +using_proper_transcode(1) + +genIFRwDataCode(1, 0x74, False, 4) + +genIFRwDataCode(1, 0x00, True, 1, [0x2, ]) + + +genIFRwDataCode(1, 0x78, True, 4, [0xff, 0xff, 0xff, 0xff]) + ) + + 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) + ) + + genPkt.gen("./generated/shin/%s.vh"%(gen_file_def,), 1, True, gen_file_def_ap) + + + genPkt.clean() + genPkt.setPktType(0) + sm_idx = 1 + + genPkt.addSubPkt(0x0, 0, 0, 0xb, 2, [0x3f, 0xff]) + + + gen_file_def_ap = gen_file_def + "_rw04" + + 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) + ) + + genPkt.gen("./generated/shin/%s.vh"%(gen_file_def,), 1, True, gen_file_def_ap) + + + genPkt.clean() genPkt.setPktType(0) @@ -1771,7 +1862,7 @@ def tc8(): genPkt.addSubPkt(0x0, 0, 0x180, 0xd, 10, b'\0'*10) - gen_file_def_ap = gen_file_def + "_rw03" + gen_file_def_ap = gen_file_def + "_rw05" genPkt.addAfterExc(genWriteTransLenCode(gen_file_def_ap, sm_idx) +genWriteTransPktCode(gen_file_def_ap, sm_idx) +genTrgTransPktCode(gen_file_def_ap, sm_idx) @@ -1849,7 +1940,7 @@ def tc8(): + '''spi_trans( (16'h0120), (`SPI_WRITE), (40), (`IF_IDX(0)));\n''' ) - genPkt.addSubPkt(0x0, 0, 0x0, 0xc, 12, b'\0'*12) + genPkt.addSubPkt(0x0, 0, 0x0, 0xa, 12, b'\0'*12) genPkt.addSubPkt(0, 0, 0x18, 0xe, 2, [0x1, 0x58]) #subPkt参数:索引、索引类型、地址、命令、长度、数据 data = [0,] * 100 #bytearray(b"\0" * 100) @@ -1948,7 +2039,7 @@ def tc8(): genPkt.addSubPkt(2, 0, 0x120, 0x1, 0x28, data) genPkt.addSubPkt(0, 0, 0x18, 0xe, 2, [0x0, 0x58]) - gen_file_def_ap = gen_file_def + "_rw04" + gen_file_def_ap = gen_file_def + "_rw06" genPkt.addAfterExc(genWriteTransLenCode(gen_file_def_ap, sm_idx) +genWriteTransPktCode(gen_file_def_ap, sm_idx) +genTrgTransPktCode(gen_file_def_ap, sm_idx) @@ -1995,7 +2086,7 @@ def tc8(): sm_idx = 0 - gen_file_def_ap = gen_file_def + "_rw05" + gen_file_def_ap = gen_file_def + "_rw07" genPkt.addAfterExc(genWriteTransLenCode(gen_file_def_ap, sm_idx) +genWriteTransPktCode(gen_file_def_ap, sm_idx)