mirror of
https://github.com/fpganinja/taxi.git
synced 2025-12-12 18:18:39 -08:00
eth: Support 32 bit mode in BASE-R PHY
Signed-off-by: Alex Forencich <alex@alexforencich.com>
This commit is contained in:
@@ -16,6 +16,7 @@ import sys
|
||||
|
||||
import cocotb_test.simulator
|
||||
|
||||
import pytest
|
||||
import cocotb
|
||||
from cocotb.clock import Clock
|
||||
from cocotb.triggers import RisingEdge
|
||||
@@ -41,8 +42,13 @@ class TB:
|
||||
self.log = logging.getLogger("cocotb.tb")
|
||||
self.log.setLevel(logging.DEBUG)
|
||||
|
||||
cocotb.start_soon(Clock(dut.tx_clk, 6.4, units="ns").start())
|
||||
cocotb.start_soon(Clock(dut.rx_clk, 6.4, units="ns").start())
|
||||
if len(dut.xgmii_txd) == 64:
|
||||
self.clk_period = 6.4
|
||||
else:
|
||||
self.clk_period = 3.2
|
||||
|
||||
cocotb.start_soon(Clock(dut.tx_clk, self.clk_period, units="ns").start())
|
||||
cocotb.start_soon(Clock(dut.rx_clk, self.clk_period, units="ns").start())
|
||||
|
||||
self.xgmii_source = XgmiiSource(dut.xgmii_txd, dut.xgmii_txc, dut.tx_clk, dut.tx_rst)
|
||||
self.xgmii_sink = XgmiiSink(dut.xgmii_rxd, dut.xgmii_rxc, dut.rx_clk, dut.rx_rst)
|
||||
@@ -232,7 +238,8 @@ def process_f_files(files):
|
||||
return list(lst.values())
|
||||
|
||||
|
||||
def test_taxi_eth_phy_10g(request):
|
||||
@pytest.mark.parametrize("data_w", [32, 64])
|
||||
def test_taxi_eth_phy_10g(request, data_w):
|
||||
dut = "taxi_eth_phy_10g"
|
||||
module = os.path.splitext(os.path.basename(__file__))[0]
|
||||
toplevel = dut
|
||||
@@ -246,7 +253,7 @@ def test_taxi_eth_phy_10g(request):
|
||||
|
||||
parameters = {}
|
||||
|
||||
parameters['DATA_W'] = 64
|
||||
parameters['DATA_W'] = data_w
|
||||
parameters['CTRL_W'] = parameters['DATA_W'] // 8
|
||||
parameters['HDR_W'] = 2
|
||||
parameters['TX_GBX_IF_EN'] = 0
|
||||
|
||||
@@ -17,7 +17,7 @@ RTL_DIR = ../../rtl
|
||||
LIB_DIR = ../../lib
|
||||
TAXI_SRC_DIR = $(LIB_DIR)/taxi/src
|
||||
|
||||
DUT = taxi_xgmii_baser_dec_64
|
||||
DUT = taxi_xgmii_baser_dec
|
||||
COCOTB_TEST_MODULES = test_$(DUT)
|
||||
COCOTB_TOPLEVEL = $(DUT)
|
||||
MODULE = $(COCOTB_TEST_MODULES)
|
||||
@@ -14,6 +14,7 @@ import logging
|
||||
import os
|
||||
import sys
|
||||
|
||||
import pytest
|
||||
import cocotb_test.simulator
|
||||
|
||||
import cocotb
|
||||
@@ -41,9 +42,21 @@ class TB:
|
||||
self.log = logging.getLogger("cocotb.tb")
|
||||
self.log.setLevel(logging.DEBUG)
|
||||
|
||||
cocotb.start_soon(Clock(dut.clk, 6.4, units="ns").start())
|
||||
if len(dut.xgmii_rxd) == 64:
|
||||
self.clk_period = 6.4
|
||||
else:
|
||||
self.clk_period = 3.2
|
||||
|
||||
self.source = BaseRSerdesSource(dut.encoded_rx_data, dut.encoded_rx_hdr, dut.clk, scramble=False)
|
||||
cocotb.start_soon(Clock(dut.clk, self.clk_period, units="ns").start())
|
||||
|
||||
self.source = BaseRSerdesSource(
|
||||
data=dut.encoded_rx_data,
|
||||
data_valid=dut.encoded_rx_data_valid,
|
||||
hdr=dut.encoded_rx_hdr,
|
||||
hdr_valid=dut.encoded_rx_hdr_valid,
|
||||
clock=dut.clk,
|
||||
scramble=False
|
||||
)
|
||||
self.sink = XgmiiSink(dut.xgmii_rxd, dut.xgmii_rxc, dut.clk, dut.rst)
|
||||
|
||||
dut.encoded_rx_data_valid.setimmediatevalue(1)
|
||||
@@ -214,8 +227,9 @@ def process_f_files(files):
|
||||
return list(lst.values())
|
||||
|
||||
|
||||
def test_taxi_xgmii_baser_dec_64(request):
|
||||
dut = "taxi_xgmii_baser_dec_64"
|
||||
@pytest.mark.parametrize("data_w", [32, 64])
|
||||
def test_taxi_xgmii_baser_dec(request, data_w):
|
||||
dut = "taxi_xgmii_baser_dec"
|
||||
module = os.path.splitext(os.path.basename(__file__))[0]
|
||||
toplevel = dut
|
||||
|
||||
@@ -227,7 +241,7 @@ def test_taxi_xgmii_baser_dec_64(request):
|
||||
|
||||
parameters = {}
|
||||
|
||||
parameters['DATA_W'] = 64
|
||||
parameters['DATA_W'] = data_w
|
||||
parameters['CTRL_W'] = parameters['DATA_W'] // 8
|
||||
parameters['HDR_W'] = 2
|
||||
parameters['GBX_IF_EN'] = 0
|
||||
@@ -17,7 +17,7 @@ RTL_DIR = ../../rtl
|
||||
LIB_DIR = ../../lib
|
||||
TAXI_SRC_DIR = $(LIB_DIR)/taxi/src
|
||||
|
||||
DUT = taxi_xgmii_baser_enc_64
|
||||
DUT = taxi_xgmii_baser_enc
|
||||
COCOTB_TEST_MODULES = test_$(DUT)
|
||||
COCOTB_TOPLEVEL = $(DUT)
|
||||
MODULE = $(COCOTB_TEST_MODULES)
|
||||
@@ -14,6 +14,7 @@ import logging
|
||||
import os
|
||||
import sys
|
||||
|
||||
import pytest
|
||||
import cocotb_test.simulator
|
||||
|
||||
import cocotb
|
||||
@@ -41,10 +42,22 @@ class TB:
|
||||
self.log = logging.getLogger("cocotb.tb")
|
||||
self.log.setLevel(logging.DEBUG)
|
||||
|
||||
cocotb.start_soon(Clock(dut.clk, 6.4, units="ns").start())
|
||||
if len(dut.xgmii_txd) == 64:
|
||||
self.clk_period = 6.4
|
||||
else:
|
||||
self.clk_period = 3.2
|
||||
|
||||
cocotb.start_soon(Clock(dut.clk, self.clk_period, units="ns").start())
|
||||
|
||||
self.source = XgmiiSource(dut.xgmii_txd, dut.xgmii_txc, dut.clk, dut.rst)
|
||||
self.sink = BaseRSerdesSink(dut.encoded_tx_data, dut.encoded_tx_hdr, dut.clk, scramble=False)
|
||||
self.sink = BaseRSerdesSink(
|
||||
data=dut.encoded_tx_data,
|
||||
data_valid=dut.encoded_tx_data_valid,
|
||||
hdr=dut.encoded_tx_hdr,
|
||||
hdr_valid=dut.encoded_tx_hdr_valid,
|
||||
clock=dut.clk,
|
||||
scramble=False
|
||||
)
|
||||
|
||||
dut.xgmii_tx_valid.setimmediatevalue(1)
|
||||
dut.tx_gbx_sync_in.setimmediatevalue(0)
|
||||
@@ -185,12 +198,13 @@ if cocotb.SIM_NAME:
|
||||
factory.add_option("force_offset_start", [False, True])
|
||||
factory.generate_tests()
|
||||
|
||||
factory = TestFactory(run_test_alignment)
|
||||
factory.add_option("payload_data", [incrementing_payload])
|
||||
factory.add_option("ifg", [12])
|
||||
factory.add_option("enable_dic", [True, False])
|
||||
factory.add_option("force_offset_start", [False, True])
|
||||
factory.generate_tests()
|
||||
if len(cocotb.top.xgmii_txd) == 64:
|
||||
factory = TestFactory(run_test_alignment)
|
||||
factory.add_option("payload_data", [incrementing_payload])
|
||||
factory.add_option("ifg", [12])
|
||||
factory.add_option("enable_dic", [True, False])
|
||||
factory.add_option("force_offset_start", [False, True])
|
||||
factory.generate_tests()
|
||||
|
||||
|
||||
# cocotb-test
|
||||
@@ -214,8 +228,9 @@ def process_f_files(files):
|
||||
return list(lst.values())
|
||||
|
||||
|
||||
def test_taxi_xgmii_baser_enc_64(request):
|
||||
dut = "taxi_xgmii_baser_enc_64"
|
||||
@pytest.mark.parametrize("data_w", [32, 64])
|
||||
def test_taxi_xgmii_baser_enc(request, data_w):
|
||||
dut = "taxi_xgmii_baser_enc"
|
||||
module = os.path.splitext(os.path.basename(__file__))[0]
|
||||
toplevel = dut
|
||||
|
||||
@@ -227,7 +242,7 @@ def test_taxi_xgmii_baser_enc_64(request):
|
||||
|
||||
parameters = {}
|
||||
|
||||
parameters['DATA_W'] = 64
|
||||
parameters['DATA_W'] = data_w
|
||||
parameters['CTRL_W'] = parameters['DATA_W'] // 8
|
||||
parameters['HDR_W'] = 2
|
||||
parameters['GBX_IF_EN'] = 0
|
||||
Reference in New Issue
Block a user