mirror of
https://github.com/fpganinja/taxi.git
synced 2025-12-07 16:28:40 -08:00
eth: Avoid hardcoding clock period
Signed-off-by: Alex Forencich <alex@alexforencich.com>
This commit is contained in:
@@ -145,7 +145,7 @@ async def run_test(dut, gbx_cfg=None, payload_lengths=None, payload_data=None, i
|
|||||||
|
|
||||||
if rx_frame.start_lane == 4:
|
if rx_frame.start_lane == 4:
|
||||||
# start in lane 4 reports 1 full cycle delay, so subtract half clock period
|
# start in lane 4 reports 1 full cycle delay, so subtract half clock period
|
||||||
rx_frame_sfd_ns -= 3.2
|
rx_frame_sfd_ns -= tb.clk_period/2
|
||||||
|
|
||||||
tb.log.info("TX frame PTP TS: %f ns", ptp_ts_ns)
|
tb.log.info("TX frame PTP TS: %f ns", ptp_ts_ns)
|
||||||
tb.log.info("RX frame SFD sim time: %f ns", rx_frame_sfd_ns)
|
tb.log.info("RX frame SFD sim time: %f ns", rx_frame_sfd_ns)
|
||||||
@@ -155,7 +155,7 @@ async def run_test(dut, gbx_cfg=None, payload_lengths=None, payload_data=None, i
|
|||||||
assert rx_frame.check_fcs()
|
assert rx_frame.check_fcs()
|
||||||
assert rx_frame.ctrl is None
|
assert rx_frame.ctrl is None
|
||||||
if gbx_cfg is None:
|
if gbx_cfg is None:
|
||||||
assert abs(rx_frame_sfd_ns - ptp_ts_ns - 12.8) < 0.01
|
assert abs(rx_frame_sfd_ns - ptp_ts_ns - tb.clk_period*2) < 0.01
|
||||||
|
|
||||||
assert tb.sink.empty()
|
assert tb.sink.empty()
|
||||||
|
|
||||||
@@ -222,7 +222,7 @@ async def run_test_alignment(dut, gbx_cfg=None, payload_data=None, ifg=12):
|
|||||||
|
|
||||||
if rx_frame.start_lane == 4:
|
if rx_frame.start_lane == 4:
|
||||||
# start in lane 4 reports 1 full cycle delay, so subtract half clock period
|
# start in lane 4 reports 1 full cycle delay, so subtract half clock period
|
||||||
rx_frame_sfd_ns -= 3.2
|
rx_frame_sfd_ns -= tb.clk_period/2
|
||||||
|
|
||||||
tb.log.info("TX frame PTP TS: %f ns", ptp_ts_ns)
|
tb.log.info("TX frame PTP TS: %f ns", ptp_ts_ns)
|
||||||
tb.log.info("RX frame SFD sim time: %f ns", rx_frame_sfd_ns)
|
tb.log.info("RX frame SFD sim time: %f ns", rx_frame_sfd_ns)
|
||||||
@@ -232,7 +232,7 @@ async def run_test_alignment(dut, gbx_cfg=None, payload_data=None, ifg=12):
|
|||||||
assert rx_frame.check_fcs()
|
assert rx_frame.check_fcs()
|
||||||
assert rx_frame.ctrl is None
|
assert rx_frame.ctrl is None
|
||||||
if gbx_cfg is None:
|
if gbx_cfg is None:
|
||||||
assert abs(rx_frame_sfd_ns - ptp_ts_ns - 12.8) < 0.01
|
assert abs(rx_frame_sfd_ns - ptp_ts_ns - tb.clk_period*2) < 0.01
|
||||||
|
|
||||||
start_lane.append(rx_frame.start_lane)
|
start_lane.append(rx_frame.start_lane)
|
||||||
|
|
||||||
|
|||||||
@@ -252,7 +252,7 @@ async def run_test_tx_alignment(dut, payload_data=None, ifg=12):
|
|||||||
|
|
||||||
if rx_frame.start_lane == 4:
|
if rx_frame.start_lane == 4:
|
||||||
# start in lane 4 reports 1 full cycle delay, so subtract half clock period
|
# start in lane 4 reports 1 full cycle delay, so subtract half clock period
|
||||||
rx_frame_sfd_ns -= 3.2
|
rx_frame_sfd_ns -= tb.clk_period/2
|
||||||
|
|
||||||
tb.log.info("TX frame PTP TS: %f ns", ptp_ts_ns)
|
tb.log.info("TX frame PTP TS: %f ns", ptp_ts_ns)
|
||||||
tb.log.info("RX frame SFD sim time: %f ns", rx_frame_sfd_ns)
|
tb.log.info("RX frame SFD sim time: %f ns", rx_frame_sfd_ns)
|
||||||
|
|||||||
@@ -227,7 +227,7 @@ async def run_test_tx_alignment(dut, payload_data=None, ifg=12):
|
|||||||
|
|
||||||
if rx_frame.start_lane == 4:
|
if rx_frame.start_lane == 4:
|
||||||
# start in lane 4 reports 1 full cycle delay, so subtract half clock period
|
# start in lane 4 reports 1 full cycle delay, so subtract half clock period
|
||||||
rx_frame_sfd_ns -= 3.2
|
rx_frame_sfd_ns -= tb.clk_period/2
|
||||||
|
|
||||||
tb.log.info("TX frame PTP TS: %f ns", ptp_ts_ns)
|
tb.log.info("TX frame PTP TS: %f ns", ptp_ts_ns)
|
||||||
tb.log.info("RX frame SFD sim time: %f ns", rx_frame_sfd_ns)
|
tb.log.info("RX frame SFD sim time: %f ns", rx_frame_sfd_ns)
|
||||||
|
|||||||
@@ -297,7 +297,7 @@ async def run_test_tx_alignment(dut, gbx_cfg=None, payload_data=None, ifg=12):
|
|||||||
|
|
||||||
if rx_frame.start_lane == 4:
|
if rx_frame.start_lane == 4:
|
||||||
# start in lane 4 reports 1 full cycle delay, so subtract half clock period
|
# start in lane 4 reports 1 full cycle delay, so subtract half clock period
|
||||||
rx_frame_sfd_ns -= 3.2
|
rx_frame_sfd_ns -= tb.clk_period/2
|
||||||
|
|
||||||
tb.log.info("TX frame PTP TS: %f ns", ptp_ts_ns)
|
tb.log.info("TX frame PTP TS: %f ns", ptp_ts_ns)
|
||||||
tb.log.info("RX frame SFD sim time: %f ns", rx_frame_sfd_ns)
|
tb.log.info("RX frame SFD sim time: %f ns", rx_frame_sfd_ns)
|
||||||
|
|||||||
@@ -273,7 +273,7 @@ async def run_test_tx_alignment(dut, gbx_cfg=None, payload_data=None, ifg=12):
|
|||||||
|
|
||||||
if rx_frame.start_lane == 4:
|
if rx_frame.start_lane == 4:
|
||||||
# start in lane 4 reports 1 full cycle delay, so subtract half clock period
|
# start in lane 4 reports 1 full cycle delay, so subtract half clock period
|
||||||
rx_frame_sfd_ns -= 3.2
|
rx_frame_sfd_ns -= tb.clk_period/2
|
||||||
|
|
||||||
tb.log.info("TX frame PTP TS: %f ns", ptp_ts_ns)
|
tb.log.info("TX frame PTP TS: %f ns", ptp_ts_ns)
|
||||||
tb.log.info("RX frame SFD sim time: %f ns", rx_frame_sfd_ns)
|
tb.log.info("RX frame SFD sim time: %f ns", rx_frame_sfd_ns)
|
||||||
|
|||||||
Reference in New Issue
Block a user