修正python生成包的顺序错误,导致硬件发包错误
This commit is contained in:
@@ -7,17 +7,17 @@ class GenPkt(object):
|
||||
def __init__(self):
|
||||
super(GenPkt, self).__init__()
|
||||
|
||||
self.pkt_buf = list() #bytearray(b'\0' * 2048)
|
||||
self.pkt_buf = [] #list() #bytearray(b'\0' * 2048)
|
||||
self.pkt_type = 0
|
||||
self.pkt_sub_pkt = 0
|
||||
self.sub_pkt = list()
|
||||
self.sub_pkt = [] #list()
|
||||
self.pkt_data = None
|
||||
|
||||
def clean(self):
|
||||
self.pkt_buf = list() #bytearray(b'\0' * 2048)
|
||||
self.pkt_buf = []#list() #bytearray(b'\0' * 2048)
|
||||
self.pkt_type = 0
|
||||
self.pkt_sub_pkt = 0
|
||||
self.sub_pkt = list()
|
||||
self.sub_pkt = []#list()
|
||||
self.pkt_data = None
|
||||
|
||||
def setPktType(self, type):
|
||||
@@ -42,9 +42,9 @@ class GenPkt(object):
|
||||
def addAfterExc(self, str):
|
||||
self.sub_pkt.append([2, str])
|
||||
|
||||
def addSubPkt(self, dev_idx, ptype, addr, cmd, len, data):
|
||||
if (len > 2032):
|
||||
print('Error, bad subpkt len:%d', len)
|
||||
def addSubPkt(self, dev_idx, ptype, addr, cmd, l, data):
|
||||
if (l > 2032):
|
||||
print('Error, bad subpkt len:%d', l)
|
||||
return
|
||||
if not (ptype in [0, 2]):
|
||||
print('Error, bad subpkt type:', ptype)
|
||||
@@ -54,7 +54,8 @@ class GenPkt(object):
|
||||
return
|
||||
|
||||
self.pkt_sub_pkt = self.pkt_sub_pkt + 1
|
||||
self.sub_pkt.append([0, dev_idx, ptype, addr, cmd, len, data])
|
||||
self.sub_pkt.append([0, dev_idx, ptype, addr, cmd, l, data])
|
||||
#print(len(self.sub_pkt), hex(cmd))
|
||||
|
||||
def gen(self, filename="pkt_verilog_test.v", filetype=0, appendgen=False, gen_name=None):
|
||||
gen_pkt_type = 0
|
||||
|
||||
Reference in New Issue
Block a user