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

Move preamble out of gmii endpoint

This commit is contained in:
Alex Forencich 2015-03-03 23:47:27 -08:00
parent 23fa1f1207
commit 47a3a50b65
4 changed files with 26 additions and 15 deletions

View File

@ -58,7 +58,6 @@ def GMIISource(clk, rst,
frame = fifo.get()
if name is not None:
print("[%s] Sending frame %s" % (name, repr(frame)))
frame = '\x55\x55\x55\x55\x55\x55\x55\xD5'+bytearray(frame)
txd.next = frame.pop(0)
tx_en.next = 1
else:
@ -85,12 +84,12 @@ def GMIISink(clk, rst,
frame = None
else:
if rx_dv:
if frame is None and rxd == 0xD5:
if frame is None:
frame = []
elif frame is not None:
frame.append(int(rxd))
frame.append(int(rxd))
elif frame is not None:
if len(frame) > 0:
frame = bytearray(frame)
if fifo is not None:
fifo.put(frame)
if name is not None:

View File

@ -265,7 +265,7 @@ def bench():
axis_frame = test_frame.build_axis_fcs()
gmii_source_queue.put(axis_frame)
gmii_source_queue.put(b'\x55\x55\x55\x55\x55\x55\x55\xD5'+bytearray(axis_frame))
yield clk.posedge
yield clk.posedge
@ -314,8 +314,10 @@ def bench():
if not gmii_sink_queue.empty():
rx_frame = gmii_sink_queue.get()
assert rx_frame[0:8] == bytearray(b'\x55\x55\x55\x55\x55\x55\x55\xD5')
eth_frame = eth_ep.EthFrame()
eth_frame.parse_axis_fcs(bytearray(rx_frame))
eth_frame.parse_axis_fcs(rx_frame[8:])
print(hex(eth_frame.eth_fcs))
print(hex(eth_frame.calc_fcs()))

View File

@ -179,7 +179,7 @@ def bench():
axis_frame = test_frame.build_axis_fcs()
source_queue.put(axis_frame)
source_queue.put(b'\x55\x55\x55\x55\x55\x55\x55\xD5'+bytearray(axis_frame))
yield clk.posedge
yield clk.posedge
@ -224,8 +224,8 @@ def bench():
axis_frame1 = test_frame1.build_axis_fcs()
axis_frame2 = test_frame2.build_axis_fcs()
source_queue.put(axis_frame1)
source_queue.put(axis_frame2)
source_queue.put(b'\x55\x55\x55\x55\x55\x55\x55\xD5'+bytearray(axis_frame1))
source_queue.put(b'\x55\x55\x55\x55\x55\x55\x55\xD5'+bytearray(axis_frame2))
yield clk.posedge
yield clk.posedge
@ -290,8 +290,8 @@ def bench():
error_bad_frame_asserted.next = 0
error_bad_fcs_asserted.next = 0
source_queue.put(axis_frame1)
source_queue.put(axis_frame2)
source_queue.put(b'\x55\x55\x55\x55\x55\x55\x55\xD5'+bytearray(axis_frame1))
source_queue.put(b'\x55\x55\x55\x55\x55\x55\x55\xD5'+bytearray(axis_frame2))
yield clk.posedge
yield clk.posedge

View File

@ -190,8 +190,10 @@ def bench():
if not sink_queue.empty():
rx_frame = sink_queue.get()
assert rx_frame[0:8] == bytearray(b'\x55\x55\x55\x55\x55\x55\x55\xD5')
eth_frame = eth_ep.EthFrame()
eth_frame.parse_axis_fcs(bytearray(rx_frame))
eth_frame.parse_axis_fcs(rx_frame[8:])
print(hex(eth_frame.eth_fcs))
print(hex(eth_frame.calc_fcs()))
@ -243,8 +245,10 @@ def bench():
if not sink_queue.empty():
rx_frame = sink_queue.get()
assert rx_frame[0:8] == bytearray(b'\x55\x55\x55\x55\x55\x55\x55\xD5')
eth_frame = eth_ep.EthFrame()
eth_frame.parse_axis_fcs(bytearray(rx_frame))
eth_frame.parse_axis_fcs(rx_frame[8:])
print(hex(eth_frame.eth_fcs))
print(hex(eth_frame.calc_fcs()))
@ -260,8 +264,10 @@ def bench():
if not sink_queue.empty():
rx_frame = sink_queue.get()
assert rx_frame[0:8] == bytearray(b'\x55\x55\x55\x55\x55\x55\x55\xD5')
eth_frame = eth_ep.EthFrame()
eth_frame.parse_axis_fcs(bytearray(rx_frame))
eth_frame.parse_axis_fcs(rx_frame[8:])
print(hex(eth_frame.eth_fcs))
print(hex(eth_frame.calc_fcs()))
@ -315,14 +321,18 @@ def bench():
if not sink_queue.empty():
rx_frame = sink_queue.get()
assert rx_frame[0:8] == bytearray(b'\x55\x55\x55\x55\x55\x55\x55\xD5')
# bad packet
rx_frame = None
if not sink_queue.empty():
rx_frame = sink_queue.get()
assert rx_frame[0:8] == bytearray(b'\x55\x55\x55\x55\x55\x55\x55\xD5')
eth_frame = eth_ep.EthFrame()
eth_frame.parse_axis_fcs(bytearray(rx_frame))
eth_frame.parse_axis_fcs(rx_frame[8:])
print(hex(eth_frame.eth_fcs))
print(hex(eth_frame.calc_fcs()))