1
0
mirror of https://github.com/corundum/corundum.git synced 2025-01-30 08:32:52 +08:00

Add get_data_credits to TLP

This commit is contained in:
Alex Forencich 2019-12-07 00:54:16 -08:00
parent 7567db1818
commit d561195dc8

View File

@ -546,6 +546,10 @@ class TLP(object):
"""Return size of TLP in bytes, including overhead""" """Return size of TLP in bytes, including overhead"""
return self.get_size()+12 return self.get_size()+12
def get_data_credits(self):
"""Return size of TLP in data credits (1 credit per 4 DW)"""
return int((len(self.data)+3)/4)
def pack(self): def pack(self):
"""Pack TLP as DWORD array""" """Pack TLP as DWORD array"""
pkt = [] pkt = []