Skip to content

Commit

Permalink
liteeth/1000basex: add basic PCS loopback test
Browse files Browse the repository at this point in the history
sbourdeauducq committed Nov 19, 2017
1 parent be3c1a9 commit 30ea1a4
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions misoc/test/test_pcs_1000basex.py
Original file line number Diff line number Diff line change
@@ -12,6 +12,13 @@ def __init__(self):
self.comb += self.rx.decoder.input.eq(self.tx.encoder.output[0])


class PCSLoopback(Module):
def __init__(self):
self.submodules.pcs = ClockDomainsRenamer({"eth_tx": "sys", "eth_rx": "sys"})(
PCS(check_period=16/125e6, more_ack_time=16/125e6))
self.comb += self.pcs.tbi_rx.eq(self.pcs.tbi_tx)


class TestPCS(unittest.TestCase):
def test_trxpaths_config(self):
config_reg_values = [0x2341, 0x814e, 0x1ea8]
@@ -72,3 +79,18 @@ def receive():

run_simulation(dut, [transmit(), receive()])
self.assertEqual(received_packets, packets)

def test_pcs(self):
dut = PCSLoopback()

def test():
for i in range(8):
yield
link_up = yield dut.pcs.link_up
self.assertEqual(link_up, 0)
for i in range(50):
yield
link_up = yield dut.pcs.link_up
self.assertEqual(link_up, 1)

run_simulation(dut, test())

0 comments on commit 30ea1a4

Please sign in to comment.