1
0
mirror of https://github.com/corundum/corundum.git synced 2025-02-06 08:38:23 +08:00

Move ifg parameter

This commit is contained in:
Alex Forencich 2019-01-16 13:23:02 -08:00
parent b8b504682a
commit bf94ef56b8

View File

@ -121,9 +121,11 @@ class XGMIIFrame(object):
class XGMIISource(object): class XGMIISource(object):
def __init__(self): def __init__(self, ifg=12, enable_dic=True):
self.has_logic = False self.has_logic = False
self.queue = [] self.queue = []
self.ifg = ifg
self.enable_dic = enable_dic
def send(self, frame): def send(self, frame):
self.queue.append(XGMIIFrame(frame)) self.queue.append(XGMIIFrame(frame))
@ -140,7 +142,6 @@ class XGMIISource(object):
txd, txd,
txc, txc,
enable=True, enable=True,
ifg=12,
name=None name=None
): ):
@ -173,7 +174,7 @@ class XGMIISource(object):
ifg_cnt = 0 ifg_cnt = 0
deficit_idle_cnt = 0 deficit_idle_cnt = 0
elif enable: elif enable:
if ifg_cnt > bw-1: if (ifg_cnt > bw-1 and self.enable_dic) or ifg_cnt > 0:
ifg_cnt -= bw ifg_cnt -= bw
txd.next = 0x0707070707070707 if bw == 8 else 0x07070707 txd.next = 0x0707070707070707 if bw == 8 else 0x07070707
txc.next = 0xff if bw == 8 else 0xf txc.next = 0xff if bw == 8 else 0xf
@ -186,7 +187,7 @@ class XGMIISource(object):
d |= dl.pop(0) << (8*i) d |= dl.pop(0) << (8*i)
c |= cl.pop(0) << i c |= cl.pop(0) << i
if not dl: if not dl:
ifg_cnt = max(ifg, 12) - (bw-i) + deficit_idle_cnt ifg_cnt = self.ifg - (bw-i) + deficit_idle_cnt
else: else:
d |= XGMII_IDLE << (8*i) d |= XGMII_IDLE << (8*i)
c |= 1 << i c |= 1 << i
@ -222,7 +223,7 @@ class XGMIISource(object):
d |= dl.pop(0) << (8*i) d |= dl.pop(0) << (8*i)
c |= cl.pop(0) << i c |= cl.pop(0) << i
if not dl: if not dl:
ifg_cnt = max(ifg, 12) - (bw-i) + deficit_idle_cnt ifg_cnt = self.ifg - (bw-i) + deficit_idle_cnt
else: else:
d |= XGMII_IDLE << (8*i) d |= XGMII_IDLE << (8*i)
c |= 1 << i c |= 1 << i