mirror of
https://github.com/corundum/corundum.git
synced 2025-01-16 08:12:53 +08:00
Procedural generation of testbench drivers
Signed-off-by: Alex Forencich <alex@alexforencich.com>
This commit is contained in:
parent
6a6d1f0ac0
commit
a052b0eb32
@ -276,55 +276,38 @@ class TB(object):
|
||||
cocotb.start_soon(Clock(dut.ptp_sample_clk, 8, units="ns").start())
|
||||
|
||||
# Ethernet
|
||||
cocotb.start_soon(Clock(dut.qsfp0_rx_clk, 3.102, units="ns").start())
|
||||
cocotb.start_soon(Clock(dut.qsfp0_tx_clk, 3.102, units="ns").start())
|
||||
self.qsfp_mac = []
|
||||
|
||||
self.qsfp0_mac = EthMac(
|
||||
tx_clk=dut.qsfp0_tx_clk,
|
||||
tx_rst=dut.qsfp0_tx_rst,
|
||||
tx_bus=AxiStreamBus.from_prefix(dut, "qsfp0_tx_axis"),
|
||||
tx_ptp_time=dut.qsfp0_tx_ptp_time,
|
||||
tx_ptp_ts=dut.qsfp0_tx_ptp_ts,
|
||||
tx_ptp_ts_tag=dut.qsfp0_tx_ptp_ts_tag,
|
||||
tx_ptp_ts_valid=dut.qsfp0_tx_ptp_ts_valid,
|
||||
rx_clk=dut.qsfp0_rx_clk,
|
||||
rx_rst=dut.qsfp0_rx_rst,
|
||||
rx_bus=AxiStreamBus.from_prefix(dut, "qsfp0_rx_axis"),
|
||||
rx_ptp_time=dut.qsfp0_rx_ptp_time,
|
||||
ifg=12, speed=100e9
|
||||
)
|
||||
for k in range(2):
|
||||
cocotb.start_soon(Clock(getattr(dut, f"qsfp{k}_rx_clk"), 3.102, units="ns").start())
|
||||
cocotb.start_soon(Clock(getattr(dut, f"qsfp{k}_tx_clk"), 3.102, units="ns").start())
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp1_rx_clk, 3.102, units="ns").start())
|
||||
cocotb.start_soon(Clock(dut.qsfp1_tx_clk, 3.102, units="ns").start())
|
||||
mac = EthMac(
|
||||
tx_clk=getattr(dut, f"qsfp{k}_tx_clk"),
|
||||
tx_rst=getattr(dut, f"qsfp{k}_tx_rst"),
|
||||
tx_bus=AxiStreamBus.from_prefix(dut, f"qsfp{k}_tx_axis"),
|
||||
tx_ptp_time=getattr(dut, f"qsfp{k}_tx_ptp_time"),
|
||||
tx_ptp_ts=getattr(dut, f"qsfp{k}_tx_ptp_ts"),
|
||||
tx_ptp_ts_tag=getattr(dut, f"qsfp{k}_tx_ptp_ts_tag"),
|
||||
tx_ptp_ts_valid=getattr(dut, f"qsfp{k}_tx_ptp_ts_valid"),
|
||||
rx_clk=getattr(dut, f"qsfp{k}_rx_clk"),
|
||||
rx_rst=getattr(dut, f"qsfp{k}_rx_rst"),
|
||||
rx_bus=AxiStreamBus.from_prefix(dut, f"qsfp{k}_rx_axis"),
|
||||
rx_ptp_time=getattr(dut, f"qsfp{k}_rx_ptp_time"),
|
||||
ifg=12, speed=100e9
|
||||
)
|
||||
|
||||
self.qsfp1_mac = EthMac(
|
||||
tx_clk=dut.qsfp1_tx_clk,
|
||||
tx_rst=dut.qsfp1_tx_rst,
|
||||
tx_bus=AxiStreamBus.from_prefix(dut, "qsfp1_tx_axis"),
|
||||
tx_ptp_time=dut.qsfp1_tx_ptp_time,
|
||||
tx_ptp_ts=dut.qsfp1_tx_ptp_ts,
|
||||
tx_ptp_ts_tag=dut.qsfp1_tx_ptp_ts_tag,
|
||||
tx_ptp_ts_valid=dut.qsfp1_tx_ptp_ts_valid,
|
||||
rx_clk=dut.qsfp1_rx_clk,
|
||||
rx_rst=dut.qsfp1_rx_rst,
|
||||
rx_bus=AxiStreamBus.from_prefix(dut, "qsfp1_rx_axis"),
|
||||
rx_ptp_time=dut.qsfp1_rx_ptp_time,
|
||||
ifg=12, speed=100e9
|
||||
)
|
||||
self.qsfp_mac.append(mac)
|
||||
|
||||
dut.qsfp0_rx_status.setimmediatevalue(1)
|
||||
getattr(dut, f"qsfp{k}_rx_status").setimmediatevalue(1)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp0_drp_clk, 8, units="ns").start())
|
||||
dut.qsfp0_drp_rst.setimmediatevalue(0)
|
||||
dut.qsfp0_drp_do.setimmediatevalue(0)
|
||||
dut.qsfp0_drp_rdy.setimmediatevalue(0)
|
||||
cocotb.start_soon(Clock(getattr(dut, f"qsfp{k}_drp_clk"), 8, units="ns").start())
|
||||
getattr(dut, f"qsfp{k}_drp_rst").setimmediatevalue(0)
|
||||
getattr(dut, f"qsfp{k}_drp_do").setimmediatevalue(0)
|
||||
getattr(dut, f"qsfp{k}_drp_rdy").setimmediatevalue(0)
|
||||
|
||||
dut.qsfp1_rx_status.setimmediatevalue(1)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp1_drp_clk, 8, units="ns").start())
|
||||
dut.qsfp1_drp_rst.setimmediatevalue(0)
|
||||
dut.qsfp1_drp_do.setimmediatevalue(0)
|
||||
dut.qsfp1_drp_rdy.setimmediatevalue(0)
|
||||
getattr(dut, f"qsfp{k}_modprsl").setimmediatevalue(0)
|
||||
getattr(dut, f"qsfp{k}_intl").setimmediatevalue(1)
|
||||
|
||||
dut.fpga_i2c_scl_i.setimmediatevalue(1)
|
||||
dut.fpga_i2c_sda_i.setimmediatevalue(1)
|
||||
@ -335,31 +318,23 @@ class TB(object):
|
||||
dut.fpga_smbus_scl_i.setimmediatevalue(1)
|
||||
dut.fpga_smbus_sda_i.setimmediatevalue(1)
|
||||
|
||||
dut.qsfp0_modprsl.setimmediatevalue(0)
|
||||
dut.qsfp0_intl.setimmediatevalue(1)
|
||||
|
||||
dut.qsfp1_modprsl.setimmediatevalue(0)
|
||||
dut.qsfp1_intl.setimmediatevalue(1)
|
||||
|
||||
self.loopback_enable = False
|
||||
cocotb.start_soon(self._run_loopback())
|
||||
|
||||
async def init(self):
|
||||
|
||||
self.dut.ptp_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp0_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp0_tx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp1_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp1_tx_rst.setimmediatevalue(0)
|
||||
for k in range(2):
|
||||
getattr(self.dut, f"qsfp{k}_rx_rst").setimmediatevalue(0)
|
||||
getattr(self.dut, f"qsfp{k}_tx_rst").setimmediatevalue(0)
|
||||
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
|
||||
self.dut.ptp_rst.setimmediatevalue(1)
|
||||
self.dut.qsfp0_rx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfp0_tx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfp1_rx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfp1_tx_rst.setimmediatevalue(1)
|
||||
for k in range(2):
|
||||
getattr(self.dut, f"qsfp{k}_rx_rst").setimmediatevalue(1)
|
||||
getattr(self.dut, f"qsfp{k}_tx_rst").setimmediatevalue(1)
|
||||
|
||||
await FallingEdge(self.dut.rst_250mhz)
|
||||
await Timer(100, 'ns')
|
||||
@ -368,10 +343,9 @@ class TB(object):
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
|
||||
self.dut.ptp_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp0_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp0_tx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp1_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp1_tx_rst.setimmediatevalue(0)
|
||||
for k in range(2):
|
||||
getattr(self.dut, f"qsfp{k}_rx_rst").setimmediatevalue(0)
|
||||
getattr(self.dut, f"qsfp{k}_tx_rst").setimmediatevalue(0)
|
||||
|
||||
await self.rc.enumerate()
|
||||
|
||||
@ -380,10 +354,9 @@ class TB(object):
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
|
||||
if self.loopback_enable:
|
||||
if not self.qsfp0_mac.tx.empty():
|
||||
await self.qsfp0_mac.rx.send(await self.qsfp0_mac.tx.recv())
|
||||
if not self.qsfp1_mac.tx.empty():
|
||||
await self.qsfp1_mac.rx.send(await self.qsfp1_mac.tx.recv())
|
||||
for mac in self.qsfp_mac:
|
||||
if not mac.tx.empty():
|
||||
await mac.rx.send(await mac.tx.recv())
|
||||
|
||||
|
||||
@cocotb.test()
|
||||
@ -414,10 +387,10 @@ async def run_test_nic(dut):
|
||||
|
||||
await tb.driver.interfaces[0].start_xmit(data, 0)
|
||||
|
||||
pkt = await tb.qsfp0_mac.tx.recv()
|
||||
pkt = await tb.qsfp_mac[0].tx.recv()
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
|
||||
await tb.qsfp0_mac.rx.send(pkt)
|
||||
await tb.qsfp_mac[0].rx.send(pkt)
|
||||
|
||||
pkt = await tb.driver.interfaces[0].recv()
|
||||
|
||||
@ -426,10 +399,10 @@ async def run_test_nic(dut):
|
||||
|
||||
# await tb.driver.interfaces[1].start_xmit(data, 0)
|
||||
|
||||
# pkt = await tb.qsfp1_mac.tx.recv()
|
||||
# pkt = await tb.qsfp_mac[1].tx.recv()
|
||||
# tb.log.info("Packet: %s", pkt)
|
||||
|
||||
# await tb.qsfp1_mac.rx.send(pkt)
|
||||
# await tb.qsfp_mac[1].rx.send(pkt)
|
||||
|
||||
# pkt = await tb.driver.interfaces[1].recv()
|
||||
|
||||
@ -449,10 +422,10 @@ async def run_test_nic(dut):
|
||||
|
||||
await tb.driver.interfaces[0].start_xmit(test_pkt2.build(), 0, 34, 6)
|
||||
|
||||
pkt = await tb.qsfp0_mac.tx.recv()
|
||||
pkt = await tb.qsfp_mac[0].tx.recv()
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
|
||||
await tb.qsfp0_mac.rx.send(pkt)
|
||||
await tb.qsfp_mac[0].rx.send(pkt)
|
||||
|
||||
pkt = await tb.driver.interfaces[0].recv()
|
||||
|
||||
|
@ -276,55 +276,31 @@ class TB(object):
|
||||
cocotb.start_soon(Clock(dut.ptp_sample_clk, 8, units="ns").start())
|
||||
|
||||
# Ethernet
|
||||
cocotb.start_soon(Clock(dut.qsfp0_rx_clk_1, 2.56, units="ns").start())
|
||||
self.qsfp0_1_source = XgmiiSource(dut.qsfp0_rxd_1, dut.qsfp0_rxc_1, dut.qsfp0_rx_clk_1, dut.qsfp0_rx_rst_1)
|
||||
cocotb.start_soon(Clock(dut.qsfp0_tx_clk_1, 2.56, units="ns").start())
|
||||
self.qsfp0_1_sink = XgmiiSink(dut.qsfp0_txd_1, dut.qsfp0_txc_1, dut.qsfp0_tx_clk_1, dut.qsfp0_tx_rst_1)
|
||||
self.qsfp_source = []
|
||||
self.qsfp_sink = []
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp0_rx_clk_2, 2.56, units="ns").start())
|
||||
self.qsfp0_2_source = XgmiiSource(dut.qsfp0_rxd_2, dut.qsfp0_rxc_2, dut.qsfp0_rx_clk_2, dut.qsfp0_rx_rst_2)
|
||||
cocotb.start_soon(Clock(dut.qsfp0_tx_clk_2, 2.56, units="ns").start())
|
||||
self.qsfp0_2_sink = XgmiiSink(dut.qsfp0_txd_2, dut.qsfp0_txc_2, dut.qsfp0_tx_clk_2, dut.qsfp0_tx_rst_2)
|
||||
for x in range(2):
|
||||
sources = []
|
||||
sinks = []
|
||||
for y in range(1, 5):
|
||||
cocotb.start_soon(Clock(getattr(dut, f"qsfp{x}_rx_clk_{y}"), 2.56, units="ns").start())
|
||||
source = XgmiiSource(getattr(dut, f"qsfp{x}_rxd_{y}"), getattr(dut, f"qsfp{x}_rxc_{y}"), getattr(dut, f"qsfp{x}_rx_clk_{y}"), getattr(dut, f"qsfp{x}_rx_rst_{y}"))
|
||||
sources.append(source)
|
||||
cocotb.start_soon(Clock(getattr(dut, f"qsfp{x}_tx_clk_{y}"), 2.56, units="ns").start())
|
||||
sink = XgmiiSink(getattr(dut, f"qsfp{x}_txd_{y}"), getattr(dut, f"qsfp{x}_txc_{y}"), getattr(dut, f"qsfp{x}_tx_clk_{y}"), getattr(dut, f"qsfp{x}_tx_rst_{y}"))
|
||||
sinks.append(sink)
|
||||
getattr(dut, f"qsfp{x}_rx_status_{y}").setimmediatevalue(1)
|
||||
getattr(dut, f"qsfp{x}_rx_error_count_{y}").setimmediatevalue(0)
|
||||
self.qsfp_source.append(sources)
|
||||
self.qsfp_sink.append(sinks)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp0_rx_clk_3, 2.56, units="ns").start())
|
||||
self.qsfp0_3_source = XgmiiSource(dut.qsfp0_rxd_3, dut.qsfp0_rxc_3, dut.qsfp0_rx_clk_3, dut.qsfp0_rx_rst_3)
|
||||
cocotb.start_soon(Clock(dut.qsfp0_tx_clk_3, 2.56, units="ns").start())
|
||||
self.qsfp0_3_sink = XgmiiSink(dut.qsfp0_txd_3, dut.qsfp0_txc_3, dut.qsfp0_tx_clk_3, dut.qsfp0_tx_rst_3)
|
||||
cocotb.start_soon(Clock(getattr(dut, f"qsfp{x}_drp_clk"), 8, units="ns").start())
|
||||
getattr(dut, f"qsfp{x}_drp_rst").setimmediatevalue(0)
|
||||
getattr(dut, f"qsfp{x}_drp_do").setimmediatevalue(0)
|
||||
getattr(dut, f"qsfp{x}_drp_rdy").setimmediatevalue(0)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp0_rx_clk_4, 2.56, units="ns").start())
|
||||
self.qsfp0_4_source = XgmiiSource(dut.qsfp0_rxd_4, dut.qsfp0_rxc_4, dut.qsfp0_rx_clk_4, dut.qsfp0_rx_rst_4)
|
||||
cocotb.start_soon(Clock(dut.qsfp0_tx_clk_4, 2.56, units="ns").start())
|
||||
self.qsfp0_4_sink = XgmiiSink(dut.qsfp0_txd_4, dut.qsfp0_txc_4, dut.qsfp0_tx_clk_4, dut.qsfp0_tx_rst_4)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp1_rx_clk_1, 2.56, units="ns").start())
|
||||
self.qsfp1_1_source = XgmiiSource(dut.qsfp1_rxd_1, dut.qsfp1_rxc_1, dut.qsfp1_rx_clk_1, dut.qsfp1_rx_rst_1)
|
||||
cocotb.start_soon(Clock(dut.qsfp1_tx_clk_1, 2.56, units="ns").start())
|
||||
self.qsfp1_1_sink = XgmiiSink(dut.qsfp1_txd_1, dut.qsfp1_txc_1, dut.qsfp1_tx_clk_1, dut.qsfp1_tx_rst_1)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp1_rx_clk_2, 2.56, units="ns").start())
|
||||
self.qsfp1_2_source = XgmiiSource(dut.qsfp1_rxd_2, dut.qsfp1_rxc_2, dut.qsfp1_rx_clk_2, dut.qsfp1_rx_rst_2)
|
||||
cocotb.start_soon(Clock(dut.qsfp1_tx_clk_2, 2.56, units="ns").start())
|
||||
self.qsfp1_2_sink = XgmiiSink(dut.qsfp1_txd_2, dut.qsfp1_txc_2, dut.qsfp1_tx_clk_2, dut.qsfp1_tx_rst_2)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp1_rx_clk_3, 2.56, units="ns").start())
|
||||
self.qsfp1_3_source = XgmiiSource(dut.qsfp1_rxd_3, dut.qsfp1_rxc_3, dut.qsfp1_rx_clk_3, dut.qsfp1_rx_rst_3)
|
||||
cocotb.start_soon(Clock(dut.qsfp1_tx_clk_3, 2.56, units="ns").start())
|
||||
self.qsfp1_3_sink = XgmiiSink(dut.qsfp1_txd_3, dut.qsfp1_txc_3, dut.qsfp1_tx_clk_3, dut.qsfp1_tx_rst_3)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp1_rx_clk_4, 2.56, units="ns").start())
|
||||
self.qsfp1_4_source = XgmiiSource(dut.qsfp1_rxd_4, dut.qsfp1_rxc_4, dut.qsfp1_rx_clk_4, dut.qsfp1_rx_rst_4)
|
||||
cocotb.start_soon(Clock(dut.qsfp1_tx_clk_4, 2.56, units="ns").start())
|
||||
self.qsfp1_4_sink = XgmiiSink(dut.qsfp1_txd_4, dut.qsfp1_txc_4, dut.qsfp1_tx_clk_4, dut.qsfp1_tx_rst_4)
|
||||
|
||||
dut.qsfp0_rx_status_1.setimmediatevalue(1)
|
||||
dut.qsfp0_rx_status_2.setimmediatevalue(1)
|
||||
dut.qsfp0_rx_status_3.setimmediatevalue(1)
|
||||
dut.qsfp0_rx_status_4.setimmediatevalue(1)
|
||||
|
||||
dut.qsfp1_rx_status_1.setimmediatevalue(1)
|
||||
dut.qsfp1_rx_status_2.setimmediatevalue(1)
|
||||
dut.qsfp1_rx_status_3.setimmediatevalue(1)
|
||||
dut.qsfp1_rx_status_4.setimmediatevalue(1)
|
||||
getattr(dut, f"qsfp{x}_modprsl").setimmediatevalue(0)
|
||||
getattr(dut, f"qsfp{x}_intl").setimmediatevalue(1)
|
||||
|
||||
dut.fpga_i2c_scl_i.setimmediatevalue(1)
|
||||
dut.fpga_i2c_sda_i.setimmediatevalue(1)
|
||||
@ -335,75 +311,25 @@ class TB(object):
|
||||
dut.fpga_smbus_scl_i.setimmediatevalue(1)
|
||||
dut.fpga_smbus_sda_i.setimmediatevalue(1)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp0_drp_clk, 8, units="ns").start())
|
||||
dut.qsfp0_drp_rst.setimmediatevalue(0)
|
||||
dut.qsfp0_drp_do.setimmediatevalue(0)
|
||||
dut.qsfp0_drp_rdy.setimmediatevalue(0)
|
||||
|
||||
dut.qsfp0_rx_error_count_1.setimmediatevalue(0)
|
||||
dut.qsfp0_rx_error_count_2.setimmediatevalue(0)
|
||||
dut.qsfp0_rx_error_count_3.setimmediatevalue(0)
|
||||
dut.qsfp0_rx_error_count_4.setimmediatevalue(0)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp1_drp_clk, 8, units="ns").start())
|
||||
dut.qsfp1_drp_rst.setimmediatevalue(0)
|
||||
dut.qsfp1_drp_do.setimmediatevalue(0)
|
||||
dut.qsfp1_drp_rdy.setimmediatevalue(0)
|
||||
|
||||
dut.qsfp1_rx_error_count_1.setimmediatevalue(0)
|
||||
dut.qsfp1_rx_error_count_2.setimmediatevalue(0)
|
||||
dut.qsfp1_rx_error_count_3.setimmediatevalue(0)
|
||||
dut.qsfp1_rx_error_count_4.setimmediatevalue(0)
|
||||
|
||||
dut.qsfp0_modprsl.setimmediatevalue(0)
|
||||
dut.qsfp0_intl.setimmediatevalue(1)
|
||||
|
||||
dut.qsfp1_modprsl.setimmediatevalue(0)
|
||||
dut.qsfp1_intl.setimmediatevalue(1)
|
||||
|
||||
self.loopback_enable = False
|
||||
cocotb.start_soon(self._run_loopback())
|
||||
|
||||
async def init(self):
|
||||
|
||||
self.dut.ptp_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp0_rx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp0_tx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp0_rx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp0_tx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp0_rx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp0_tx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp0_rx_rst_4.setimmediatevalue(0)
|
||||
self.dut.qsfp0_tx_rst_4.setimmediatevalue(0)
|
||||
self.dut.qsfp1_rx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp1_tx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp1_rx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp1_tx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp1_rx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp1_tx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp1_rx_rst_4.setimmediatevalue(0)
|
||||
self.dut.qsfp1_tx_rst_4.setimmediatevalue(0)
|
||||
for x in range(2):
|
||||
for y in range(1, 5):
|
||||
getattr(self.dut, f"qsfp{x}_rx_rst_{y}").setimmediatevalue(0)
|
||||
getattr(self.dut, f"qsfp{x}_tx_rst_{y}").setimmediatevalue(0)
|
||||
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
|
||||
self.dut.ptp_rst.setimmediatevalue(1)
|
||||
self.dut.qsfp0_rx_rst_1.setimmediatevalue(1)
|
||||
self.dut.qsfp0_tx_rst_1.setimmediatevalue(1)
|
||||
self.dut.qsfp0_rx_rst_2.setimmediatevalue(1)
|
||||
self.dut.qsfp0_tx_rst_2.setimmediatevalue(1)
|
||||
self.dut.qsfp0_rx_rst_3.setimmediatevalue(1)
|
||||
self.dut.qsfp0_tx_rst_3.setimmediatevalue(1)
|
||||
self.dut.qsfp0_rx_rst_4.setimmediatevalue(1)
|
||||
self.dut.qsfp0_tx_rst_4.setimmediatevalue(1)
|
||||
self.dut.qsfp1_rx_rst_1.setimmediatevalue(1)
|
||||
self.dut.qsfp1_tx_rst_1.setimmediatevalue(1)
|
||||
self.dut.qsfp1_rx_rst_2.setimmediatevalue(1)
|
||||
self.dut.qsfp1_tx_rst_2.setimmediatevalue(1)
|
||||
self.dut.qsfp1_rx_rst_3.setimmediatevalue(1)
|
||||
self.dut.qsfp1_tx_rst_3.setimmediatevalue(1)
|
||||
self.dut.qsfp1_rx_rst_4.setimmediatevalue(1)
|
||||
self.dut.qsfp1_tx_rst_4.setimmediatevalue(1)
|
||||
for x in range(2):
|
||||
for y in range(1, 5):
|
||||
getattr(self.dut, f"qsfp{x}_rx_rst_{y}").setimmediatevalue(1)
|
||||
getattr(self.dut, f"qsfp{x}_tx_rst_{y}").setimmediatevalue(1)
|
||||
|
||||
await FallingEdge(self.dut.rst_250mhz)
|
||||
await Timer(100, 'ns')
|
||||
@ -412,22 +338,10 @@ class TB(object):
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
|
||||
self.dut.ptp_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp0_rx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp0_tx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp0_rx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp0_tx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp0_rx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp0_tx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp0_rx_rst_4.setimmediatevalue(0)
|
||||
self.dut.qsfp0_tx_rst_4.setimmediatevalue(0)
|
||||
self.dut.qsfp1_rx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp1_tx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp1_rx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp1_tx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp1_rx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp1_tx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp1_rx_rst_4.setimmediatevalue(0)
|
||||
self.dut.qsfp1_tx_rst_4.setimmediatevalue(0)
|
||||
for x in range(2):
|
||||
for y in range(1, 5):
|
||||
getattr(self.dut, f"qsfp{x}_rx_rst_{y}").setimmediatevalue(0)
|
||||
getattr(self.dut, f"qsfp{x}_tx_rst_{y}").setimmediatevalue(0)
|
||||
|
||||
await self.rc.enumerate()
|
||||
|
||||
@ -436,22 +350,10 @@ class TB(object):
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
|
||||
if self.loopback_enable:
|
||||
if not self.qsfp0_1_sink.empty():
|
||||
await self.qsfp0_1_source.send(await self.qsfp0_1_sink.recv())
|
||||
if not self.qsfp0_2_sink.empty():
|
||||
await self.qsfp0_2_source.send(await self.qsfp0_2_sink.recv())
|
||||
if not self.qsfp0_3_sink.empty():
|
||||
await self.qsfp0_3_source.send(await self.qsfp0_3_sink.recv())
|
||||
if not self.qsfp0_4_sink.empty():
|
||||
await self.qsfp0_4_source.send(await self.qsfp0_4_sink.recv())
|
||||
if not self.qsfp1_1_sink.empty():
|
||||
await self.qsfp1_1_source.send(await self.qsfp1_1_sink.recv())
|
||||
if not self.qsfp1_2_sink.empty():
|
||||
await self.qsfp1_2_source.send(await self.qsfp1_2_sink.recv())
|
||||
if not self.qsfp1_3_sink.empty():
|
||||
await self.qsfp1_3_source.send(await self.qsfp1_3_sink.recv())
|
||||
if not self.qsfp1_4_sink.empty():
|
||||
await self.qsfp1_4_source.send(await self.qsfp1_4_sink.recv())
|
||||
for x in range(len(self.qsfp_sink)):
|
||||
for y in range(len(self.qsfp_sink[x])):
|
||||
if not self.qsfp_sink[x][y].empty():
|
||||
await self.qsfp_source[x][y].send(await self.qsfp_sink[x][y].recv())
|
||||
|
||||
|
||||
@cocotb.test()
|
||||
@ -482,10 +384,10 @@ async def run_test_nic(dut):
|
||||
|
||||
await tb.driver.interfaces[0].start_xmit(data, 0)
|
||||
|
||||
pkt = await tb.qsfp0_1_sink.recv()
|
||||
pkt = await tb.qsfp_sink[0][0].recv()
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
|
||||
await tb.qsfp0_1_source.send(pkt)
|
||||
await tb.qsfp_source[0][0].send(pkt)
|
||||
|
||||
pkt = await tb.driver.interfaces[0].recv()
|
||||
|
||||
@ -494,10 +396,10 @@ async def run_test_nic(dut):
|
||||
|
||||
# await tb.driver.interfaces[1].start_xmit(data, 0)
|
||||
|
||||
# pkt = await tb.qsfp1_1_sink.recv()
|
||||
# pkt = await tb.qsfp_sink.r[1][0]ecv()
|
||||
# tb.log.info("Packet: %s", pkt)
|
||||
|
||||
# await tb.qsfp1_1_source.send(pkt)
|
||||
# await tb.qsfp_source[1][0].send(pkt)
|
||||
|
||||
# pkt = await tb.driver.interfaces[1].recv()
|
||||
|
||||
@ -517,10 +419,10 @@ async def run_test_nic(dut):
|
||||
|
||||
await tb.driver.interfaces[0].start_xmit(test_pkt2.build(), 0, 34, 6)
|
||||
|
||||
pkt = await tb.qsfp0_1_sink.recv()
|
||||
pkt = await tb.qsfp_sink[0][0].recv()
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
|
||||
await tb.qsfp0_1_source.send(pkt)
|
||||
await tb.qsfp_source[0][0].send(pkt)
|
||||
|
||||
pkt = await tb.driver.interfaces[0].recv()
|
||||
|
||||
|
@ -199,125 +199,23 @@ class TB(object):
|
||||
cocotb.start_soon(Clock(dut.ptp_sample_clk, 8, units="ns").start())
|
||||
|
||||
# Ethernet
|
||||
cocotb.start_soon(Clock(dut.qsfp0_rx_clk_1, 2.56, units="ns").start())
|
||||
self.qsfp0_1_source = XgmiiSource(dut.qsfp0_rxd_1, dut.qsfp0_rxc_1, dut.qsfp0_rx_clk_1, dut.qsfp0_rx_rst_1)
|
||||
cocotb.start_soon(Clock(dut.qsfp0_tx_clk_1, 2.56, units="ns").start())
|
||||
self.qsfp0_1_sink = XgmiiSink(dut.qsfp0_txd_1, dut.qsfp0_txc_1, dut.qsfp0_tx_clk_1, dut.qsfp0_tx_rst_1)
|
||||
self.qsfp_source = []
|
||||
self.qsfp_sink = []
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp0_rx_clk_2, 2.56, units="ns").start())
|
||||
self.qsfp0_2_source = XgmiiSource(dut.qsfp0_rxd_2, dut.qsfp0_rxc_2, dut.qsfp0_rx_clk_2, dut.qsfp0_rx_rst_2)
|
||||
cocotb.start_soon(Clock(dut.qsfp0_tx_clk_2, 2.56, units="ns").start())
|
||||
self.qsfp0_2_sink = XgmiiSink(dut.qsfp0_txd_2, dut.qsfp0_txc_2, dut.qsfp0_tx_clk_2, dut.qsfp0_tx_rst_2)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp0_rx_clk_3, 2.56, units="ns").start())
|
||||
self.qsfp0_3_source = XgmiiSource(dut.qsfp0_rxd_3, dut.qsfp0_rxc_3, dut.qsfp0_rx_clk_3, dut.qsfp0_rx_rst_3)
|
||||
cocotb.start_soon(Clock(dut.qsfp0_tx_clk_3, 2.56, units="ns").start())
|
||||
self.qsfp0_3_sink = XgmiiSink(dut.qsfp0_txd_3, dut.qsfp0_txc_3, dut.qsfp0_tx_clk_3, dut.qsfp0_tx_rst_3)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp0_rx_clk_4, 2.56, units="ns").start())
|
||||
self.qsfp0_4_source = XgmiiSource(dut.qsfp0_rxd_4, dut.qsfp0_rxc_4, dut.qsfp0_rx_clk_4, dut.qsfp0_rx_rst_4)
|
||||
cocotb.start_soon(Clock(dut.qsfp0_tx_clk_4, 2.56, units="ns").start())
|
||||
self.qsfp0_4_sink = XgmiiSink(dut.qsfp0_txd_4, dut.qsfp0_txc_4, dut.qsfp0_tx_clk_4, dut.qsfp0_tx_rst_4)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp1_rx_clk_1, 2.56, units="ns").start())
|
||||
self.qsfp1_1_source = XgmiiSource(dut.qsfp1_rxd_1, dut.qsfp1_rxc_1, dut.qsfp1_rx_clk_1, dut.qsfp1_rx_rst_1)
|
||||
cocotb.start_soon(Clock(dut.qsfp1_tx_clk_1, 2.56, units="ns").start())
|
||||
self.qsfp1_1_sink = XgmiiSink(dut.qsfp1_txd_1, dut.qsfp1_txc_1, dut.qsfp1_tx_clk_1, dut.qsfp1_tx_rst_1)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp1_rx_clk_2, 2.56, units="ns").start())
|
||||
self.qsfp1_2_source = XgmiiSource(dut.qsfp1_rxd_2, dut.qsfp1_rxc_2, dut.qsfp1_rx_clk_2, dut.qsfp1_rx_rst_2)
|
||||
cocotb.start_soon(Clock(dut.qsfp1_tx_clk_2, 2.56, units="ns").start())
|
||||
self.qsfp1_2_sink = XgmiiSink(dut.qsfp1_txd_2, dut.qsfp1_txc_2, dut.qsfp1_tx_clk_2, dut.qsfp1_tx_rst_2)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp1_rx_clk_3, 2.56, units="ns").start())
|
||||
self.qsfp1_3_source = XgmiiSource(dut.qsfp1_rxd_3, dut.qsfp1_rxc_3, dut.qsfp1_rx_clk_3, dut.qsfp1_rx_rst_3)
|
||||
cocotb.start_soon(Clock(dut.qsfp1_tx_clk_3, 2.56, units="ns").start())
|
||||
self.qsfp1_3_sink = XgmiiSink(dut.qsfp1_txd_3, dut.qsfp1_txc_3, dut.qsfp1_tx_clk_3, dut.qsfp1_tx_rst_3)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp1_rx_clk_4, 2.56, units="ns").start())
|
||||
self.qsfp1_4_source = XgmiiSource(dut.qsfp1_rxd_4, dut.qsfp1_rxc_4, dut.qsfp1_rx_clk_4, dut.qsfp1_rx_rst_4)
|
||||
cocotb.start_soon(Clock(dut.qsfp1_tx_clk_4, 2.56, units="ns").start())
|
||||
self.qsfp1_4_sink = XgmiiSink(dut.qsfp1_txd_4, dut.qsfp1_txc_4, dut.qsfp1_tx_clk_4, dut.qsfp1_tx_rst_4)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp2_rx_clk_1, 2.56, units="ns").start())
|
||||
self.qsfp2_1_source = XgmiiSource(dut.qsfp2_rxd_1, dut.qsfp2_rxc_1, dut.qsfp2_rx_clk_1, dut.qsfp2_rx_rst_1)
|
||||
cocotb.start_soon(Clock(dut.qsfp2_tx_clk_1, 2.56, units="ns").start())
|
||||
self.qsfp2_1_sink = XgmiiSink(dut.qsfp2_txd_1, dut.qsfp2_txc_1, dut.qsfp2_tx_clk_1, dut.qsfp2_tx_rst_1)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp2_rx_clk_2, 2.56, units="ns").start())
|
||||
self.qsfp2_2_source = XgmiiSource(dut.qsfp2_rxd_2, dut.qsfp2_rxc_2, dut.qsfp2_rx_clk_2, dut.qsfp2_rx_rst_2)
|
||||
cocotb.start_soon(Clock(dut.qsfp2_tx_clk_2, 2.56, units="ns").start())
|
||||
self.qsfp2_2_sink = XgmiiSink(dut.qsfp2_txd_2, dut.qsfp2_txc_2, dut.qsfp2_tx_clk_2, dut.qsfp2_tx_rst_2)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp2_rx_clk_3, 2.56, units="ns").start())
|
||||
self.qsfp2_3_source = XgmiiSource(dut.qsfp2_rxd_3, dut.qsfp2_rxc_3, dut.qsfp2_rx_clk_3, dut.qsfp2_rx_rst_3)
|
||||
cocotb.start_soon(Clock(dut.qsfp2_tx_clk_3, 2.56, units="ns").start())
|
||||
self.qsfp2_3_sink = XgmiiSink(dut.qsfp2_txd_3, dut.qsfp2_txc_3, dut.qsfp2_tx_clk_3, dut.qsfp2_tx_rst_3)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp2_rx_clk_4, 2.56, units="ns").start())
|
||||
self.qsfp2_4_source = XgmiiSource(dut.qsfp2_rxd_4, dut.qsfp2_rxc_4, dut.qsfp2_rx_clk_4, dut.qsfp2_rx_rst_4)
|
||||
cocotb.start_soon(Clock(dut.qsfp2_tx_clk_4, 2.56, units="ns").start())
|
||||
self.qsfp2_4_sink = XgmiiSink(dut.qsfp2_txd_4, dut.qsfp2_txc_4, dut.qsfp2_tx_clk_4, dut.qsfp2_tx_rst_4)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp3_rx_clk_1, 2.56, units="ns").start())
|
||||
self.qsfp3_1_source = XgmiiSource(dut.qsfp3_rxd_1, dut.qsfp3_rxc_1, dut.qsfp3_rx_clk_1, dut.qsfp3_rx_rst_1)
|
||||
cocotb.start_soon(Clock(dut.qsfp3_tx_clk_1, 2.56, units="ns").start())
|
||||
self.qsfp3_1_sink = XgmiiSink(dut.qsfp3_txd_1, dut.qsfp3_txc_1, dut.qsfp3_tx_clk_1, dut.qsfp3_tx_rst_1)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp3_rx_clk_2, 2.56, units="ns").start())
|
||||
self.qsfp3_2_source = XgmiiSource(dut.qsfp3_rxd_2, dut.qsfp3_rxc_2, dut.qsfp3_rx_clk_2, dut.qsfp3_rx_rst_2)
|
||||
cocotb.start_soon(Clock(dut.qsfp3_tx_clk_2, 2.56, units="ns").start())
|
||||
self.qsfp3_2_sink = XgmiiSink(dut.qsfp3_txd_2, dut.qsfp3_txc_2, dut.qsfp3_tx_clk_2, dut.qsfp3_tx_rst_2)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp3_rx_clk_3, 2.56, units="ns").start())
|
||||
self.qsfp3_3_source = XgmiiSource(dut.qsfp3_rxd_3, dut.qsfp3_rxc_3, dut.qsfp3_rx_clk_3, dut.qsfp3_rx_rst_3)
|
||||
cocotb.start_soon(Clock(dut.qsfp3_tx_clk_3, 2.56, units="ns").start())
|
||||
self.qsfp3_3_sink = XgmiiSink(dut.qsfp3_txd_3, dut.qsfp3_txc_3, dut.qsfp3_tx_clk_3, dut.qsfp3_tx_rst_3)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp3_rx_clk_4, 2.56, units="ns").start())
|
||||
self.qsfp3_4_source = XgmiiSource(dut.qsfp3_rxd_4, dut.qsfp3_rxc_4, dut.qsfp3_rx_clk_4, dut.qsfp3_rx_rst_4)
|
||||
cocotb.start_soon(Clock(dut.qsfp3_tx_clk_4, 2.56, units="ns").start())
|
||||
self.qsfp3_4_sink = XgmiiSink(dut.qsfp3_txd_4, dut.qsfp3_txc_4, dut.qsfp3_tx_clk_4, dut.qsfp3_tx_rst_4)
|
||||
|
||||
dut.qsfp0_rx_status_1.setimmediatevalue(1)
|
||||
dut.qsfp0_rx_status_2.setimmediatevalue(1)
|
||||
dut.qsfp0_rx_status_3.setimmediatevalue(1)
|
||||
dut.qsfp0_rx_status_4.setimmediatevalue(1)
|
||||
|
||||
dut.qsfp1_rx_status_1.setimmediatevalue(1)
|
||||
dut.qsfp1_rx_status_2.setimmediatevalue(1)
|
||||
dut.qsfp1_rx_status_3.setimmediatevalue(1)
|
||||
dut.qsfp1_rx_status_4.setimmediatevalue(1)
|
||||
|
||||
dut.qsfp2_rx_status_1.setimmediatevalue(1)
|
||||
dut.qsfp2_rx_status_2.setimmediatevalue(1)
|
||||
dut.qsfp2_rx_status_3.setimmediatevalue(1)
|
||||
dut.qsfp2_rx_status_4.setimmediatevalue(1)
|
||||
|
||||
dut.qsfp3_rx_status_1.setimmediatevalue(1)
|
||||
dut.qsfp3_rx_status_2.setimmediatevalue(1)
|
||||
dut.qsfp3_rx_status_3.setimmediatevalue(1)
|
||||
dut.qsfp3_rx_status_4.setimmediatevalue(1)
|
||||
|
||||
dut.qsfp0_rx_error_count_1.setimmediatevalue(0)
|
||||
dut.qsfp0_rx_error_count_2.setimmediatevalue(0)
|
||||
dut.qsfp0_rx_error_count_3.setimmediatevalue(0)
|
||||
dut.qsfp0_rx_error_count_4.setimmediatevalue(0)
|
||||
|
||||
dut.qsfp1_rx_error_count_1.setimmediatevalue(0)
|
||||
dut.qsfp1_rx_error_count_2.setimmediatevalue(0)
|
||||
dut.qsfp1_rx_error_count_3.setimmediatevalue(0)
|
||||
dut.qsfp1_rx_error_count_4.setimmediatevalue(0)
|
||||
|
||||
dut.qsfp2_rx_error_count_1.setimmediatevalue(0)
|
||||
dut.qsfp2_rx_error_count_2.setimmediatevalue(0)
|
||||
dut.qsfp2_rx_error_count_3.setimmediatevalue(0)
|
||||
dut.qsfp2_rx_error_count_4.setimmediatevalue(0)
|
||||
|
||||
dut.qsfp3_rx_error_count_1.setimmediatevalue(0)
|
||||
dut.qsfp3_rx_error_count_2.setimmediatevalue(0)
|
||||
dut.qsfp3_rx_error_count_3.setimmediatevalue(0)
|
||||
dut.qsfp3_rx_error_count_4.setimmediatevalue(0)
|
||||
for x in range(4):
|
||||
sources = []
|
||||
sinks = []
|
||||
for y in range(1, 5):
|
||||
cocotb.start_soon(Clock(getattr(dut, f"qsfp{x}_rx_clk_{y}"), 2.56, units="ns").start())
|
||||
source = XgmiiSource(getattr(dut, f"qsfp{x}_rxd_{y}"), getattr(dut, f"qsfp{x}_rxc_{y}"), getattr(dut, f"qsfp{x}_rx_clk_{y}"), getattr(dut, f"qsfp{x}_rx_rst_{y}"))
|
||||
sources.append(source)
|
||||
cocotb.start_soon(Clock(getattr(dut, f"qsfp{x}_tx_clk_{y}"), 2.56, units="ns").start())
|
||||
sink = XgmiiSink(getattr(dut, f"qsfp{x}_txd_{y}"), getattr(dut, f"qsfp{x}_txc_{y}"), getattr(dut, f"qsfp{x}_tx_clk_{y}"), getattr(dut, f"qsfp{x}_tx_rst_{y}"))
|
||||
sinks.append(sink)
|
||||
getattr(dut, f"qsfp{x}_rx_status_{y}").setimmediatevalue(1)
|
||||
getattr(dut, f"qsfp{x}_rx_error_count_{y}").setimmediatevalue(0)
|
||||
self.qsfp_source.append(sources)
|
||||
self.qsfp_sink.append(sinks)
|
||||
|
||||
dut.fpga_i2c_scl_i.setimmediatevalue(1)
|
||||
dut.fpga_i2c_sda_i.setimmediatevalue(1)
|
||||
@ -329,75 +227,19 @@ class TB(object):
|
||||
async def init(self):
|
||||
|
||||
self.dut.ptp_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp0_rx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp0_tx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp0_rx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp0_tx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp0_rx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp0_tx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp0_rx_rst_4.setimmediatevalue(0)
|
||||
self.dut.qsfp0_tx_rst_4.setimmediatevalue(0)
|
||||
self.dut.qsfp1_rx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp1_tx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp1_rx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp1_tx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp1_rx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp1_tx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp1_rx_rst_4.setimmediatevalue(0)
|
||||
self.dut.qsfp1_tx_rst_4.setimmediatevalue(0)
|
||||
self.dut.qsfp2_rx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp2_tx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp2_rx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp2_tx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp2_rx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp2_tx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp2_rx_rst_4.setimmediatevalue(0)
|
||||
self.dut.qsfp2_tx_rst_4.setimmediatevalue(0)
|
||||
self.dut.qsfp3_rx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp3_tx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp3_rx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp3_tx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp3_rx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp3_tx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp3_rx_rst_4.setimmediatevalue(0)
|
||||
self.dut.qsfp3_tx_rst_4.setimmediatevalue(0)
|
||||
for x in range(4):
|
||||
for y in range(1, 5):
|
||||
getattr(self.dut, f"qsfp{x}_rx_rst_{y}").setimmediatevalue(0)
|
||||
getattr(self.dut, f"qsfp{x}_tx_rst_{y}").setimmediatevalue(0)
|
||||
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
|
||||
self.dut.ptp_rst.setimmediatevalue(1)
|
||||
self.dut.qsfp0_rx_rst_1.setimmediatevalue(1)
|
||||
self.dut.qsfp0_tx_rst_1.setimmediatevalue(1)
|
||||
self.dut.qsfp0_rx_rst_2.setimmediatevalue(1)
|
||||
self.dut.qsfp0_tx_rst_2.setimmediatevalue(1)
|
||||
self.dut.qsfp0_rx_rst_3.setimmediatevalue(1)
|
||||
self.dut.qsfp0_tx_rst_3.setimmediatevalue(1)
|
||||
self.dut.qsfp0_rx_rst_4.setimmediatevalue(1)
|
||||
self.dut.qsfp0_tx_rst_4.setimmediatevalue(1)
|
||||
self.dut.qsfp1_rx_rst_1.setimmediatevalue(1)
|
||||
self.dut.qsfp1_tx_rst_1.setimmediatevalue(1)
|
||||
self.dut.qsfp1_rx_rst_2.setimmediatevalue(1)
|
||||
self.dut.qsfp1_tx_rst_2.setimmediatevalue(1)
|
||||
self.dut.qsfp1_rx_rst_3.setimmediatevalue(1)
|
||||
self.dut.qsfp1_tx_rst_3.setimmediatevalue(1)
|
||||
self.dut.qsfp1_rx_rst_4.setimmediatevalue(1)
|
||||
self.dut.qsfp1_tx_rst_4.setimmediatevalue(1)
|
||||
self.dut.qsfp2_rx_rst_1.setimmediatevalue(1)
|
||||
self.dut.qsfp2_tx_rst_1.setimmediatevalue(1)
|
||||
self.dut.qsfp2_rx_rst_2.setimmediatevalue(1)
|
||||
self.dut.qsfp2_tx_rst_2.setimmediatevalue(1)
|
||||
self.dut.qsfp2_rx_rst_3.setimmediatevalue(1)
|
||||
self.dut.qsfp2_tx_rst_3.setimmediatevalue(1)
|
||||
self.dut.qsfp2_rx_rst_4.setimmediatevalue(1)
|
||||
self.dut.qsfp2_tx_rst_4.setimmediatevalue(1)
|
||||
self.dut.qsfp3_rx_rst_1.setimmediatevalue(1)
|
||||
self.dut.qsfp3_tx_rst_1.setimmediatevalue(1)
|
||||
self.dut.qsfp3_rx_rst_2.setimmediatevalue(1)
|
||||
self.dut.qsfp3_tx_rst_2.setimmediatevalue(1)
|
||||
self.dut.qsfp3_rx_rst_3.setimmediatevalue(1)
|
||||
self.dut.qsfp3_tx_rst_3.setimmediatevalue(1)
|
||||
self.dut.qsfp3_rx_rst_4.setimmediatevalue(1)
|
||||
self.dut.qsfp3_tx_rst_4.setimmediatevalue(1)
|
||||
for x in range(4):
|
||||
for y in range(1, 5):
|
||||
getattr(self.dut, f"qsfp{x}_rx_rst_{y}").setimmediatevalue(1)
|
||||
getattr(self.dut, f"qsfp{x}_tx_rst_{y}").setimmediatevalue(1)
|
||||
|
||||
await FallingEdge(self.dut.rst_250mhz)
|
||||
await Timer(100, 'ns')
|
||||
@ -406,38 +248,10 @@ class TB(object):
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
|
||||
self.dut.ptp_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp0_rx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp0_tx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp0_rx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp0_tx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp0_rx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp0_tx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp0_rx_rst_4.setimmediatevalue(0)
|
||||
self.dut.qsfp0_tx_rst_4.setimmediatevalue(0)
|
||||
self.dut.qsfp1_rx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp1_tx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp1_rx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp1_tx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp1_rx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp1_tx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp1_rx_rst_4.setimmediatevalue(0)
|
||||
self.dut.qsfp1_tx_rst_4.setimmediatevalue(0)
|
||||
self.dut.qsfp2_rx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp2_tx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp2_rx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp2_tx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp2_rx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp2_tx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp2_rx_rst_4.setimmediatevalue(0)
|
||||
self.dut.qsfp2_tx_rst_4.setimmediatevalue(0)
|
||||
self.dut.qsfp3_rx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp3_tx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp3_rx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp3_tx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp3_rx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp3_tx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp3_rx_rst_4.setimmediatevalue(0)
|
||||
self.dut.qsfp3_tx_rst_4.setimmediatevalue(0)
|
||||
for x in range(4):
|
||||
for y in range(1, 5):
|
||||
getattr(self.dut, f"qsfp{x}_rx_rst_{y}").setimmediatevalue(0)
|
||||
getattr(self.dut, f"qsfp{x}_tx_rst_{y}").setimmediatevalue(0)
|
||||
|
||||
await self.rc.enumerate()
|
||||
|
||||
@ -446,38 +260,10 @@ class TB(object):
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
|
||||
if self.loopback_enable:
|
||||
if not self.qsfp0_1_sink.empty():
|
||||
await self.qsfp0_1_source.send(await self.qsfp0_1_sink.recv())
|
||||
if not self.qsfp0_2_sink.empty():
|
||||
await self.qsfp0_2_source.send(await self.qsfp0_2_sink.recv())
|
||||
if not self.qsfp0_3_sink.empty():
|
||||
await self.qsfp0_3_source.send(await self.qsfp0_3_sink.recv())
|
||||
if not self.qsfp0_4_sink.empty():
|
||||
await self.qsfp0_4_source.send(await self.qsfp0_4_sink.recv())
|
||||
if not self.qsfp1_1_sink.empty():
|
||||
await self.qsfp1_1_source.send(await self.qsfp1_1_sink.recv())
|
||||
if not self.qsfp1_2_sink.empty():
|
||||
await self.qsfp1_2_source.send(await self.qsfp1_2_sink.recv())
|
||||
if not self.qsfp1_3_sink.empty():
|
||||
await self.qsfp1_3_source.send(await self.qsfp1_3_sink.recv())
|
||||
if not self.qsfp1_4_sink.empty():
|
||||
await self.qsfp1_4_source.send(await self.qsfp1_4_sink.recv())
|
||||
if not self.qsfp2_1_sink.empty():
|
||||
await self.qsfp2_1_source.send(await self.qsfp2_1_sink.recv())
|
||||
if not self.qsfp2_2_sink.empty():
|
||||
await self.qsfp2_2_source.send(await self.qsfp2_2_sink.recv())
|
||||
if not self.qsfp2_3_sink.empty():
|
||||
await self.qsfp2_3_source.send(await self.qsfp2_3_sink.recv())
|
||||
if not self.qsfp2_4_sink.empty():
|
||||
await self.qsfp2_4_source.send(await self.qsfp2_4_sink.recv())
|
||||
if not self.qsfp3_1_sink.empty():
|
||||
await self.qsfp3_1_source.send(await self.qsfp3_1_sink.recv())
|
||||
if not self.qsfp3_2_sink.empty():
|
||||
await self.qsfp3_2_source.send(await self.qsfp3_2_sink.recv())
|
||||
if not self.qsfp3_3_sink.empty():
|
||||
await self.qsfp3_3_source.send(await self.qsfp3_3_sink.recv())
|
||||
if not self.qsfp3_4_sink.empty():
|
||||
await self.qsfp3_4_source.send(await self.qsfp3_4_sink.recv())
|
||||
for x in range(len(self.qsfp_sink)):
|
||||
for y in range(len(self.qsfp_sink[x])):
|
||||
if not self.qsfp_sink[x][y].empty():
|
||||
await self.qsfp_source[x][y].send(await self.qsfp_sink[x][y].recv())
|
||||
|
||||
|
||||
@cocotb.test()
|
||||
@ -508,10 +294,10 @@ async def run_test_nic(dut):
|
||||
|
||||
await tb.driver.interfaces[0].start_xmit(data, 0)
|
||||
|
||||
pkt = await tb.qsfp0_1_sink.recv()
|
||||
pkt = await tb.qsfp_sink[0][0].recv()
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
|
||||
await tb.qsfp0_1_source.send(pkt)
|
||||
await tb.qsfp_source[0][0].send(pkt)
|
||||
|
||||
pkt = await tb.driver.interfaces[0].recv()
|
||||
|
||||
@ -520,10 +306,10 @@ async def run_test_nic(dut):
|
||||
|
||||
# await tb.driver.interfaces[1].start_xmit(data, 0)
|
||||
|
||||
# pkt = await tb.qsfp1_1_sink.recv()
|
||||
# pkt = await tb.qsfp_sink[1][0].recv()
|
||||
# tb.log.info("Packet: %s", pkt)
|
||||
|
||||
# await tb.qsfp1_1_source.send(pkt)
|
||||
# await tb.qsfp_source[1][0].send(pkt)
|
||||
|
||||
# pkt = await tb.driver.interfaces[1].recv()
|
||||
|
||||
@ -543,10 +329,10 @@ async def run_test_nic(dut):
|
||||
|
||||
await tb.driver.interfaces[0].start_xmit(test_pkt2.build(), 0, 34, 6)
|
||||
|
||||
pkt = await tb.qsfp0_1_sink.recv()
|
||||
pkt = await tb.qsfp_sink[0][0].recv()
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
|
||||
await tb.qsfp0_1_source.send(pkt)
|
||||
await tb.qsfp_source[0][0].send(pkt)
|
||||
|
||||
pkt = await tb.driver.interfaces[0].recv()
|
||||
|
||||
|
@ -276,61 +276,40 @@ class TB(object):
|
||||
cocotb.start_soon(Clock(dut.ptp_sample_clk, 8, units="ns").start())
|
||||
|
||||
# Ethernet
|
||||
cocotb.start_soon(Clock(dut.qsfp_0_rx_clk, 3.102, units="ns").start())
|
||||
cocotb.start_soon(Clock(dut.qsfp_0_tx_clk, 3.102, units="ns").start())
|
||||
self.qsfp_mac = []
|
||||
|
||||
self.qsfp_0_mac = EthMac(
|
||||
tx_clk=dut.qsfp_0_tx_clk,
|
||||
tx_rst=dut.qsfp_0_tx_rst,
|
||||
tx_bus=AxiStreamBus.from_prefix(dut, "qsfp_0_tx_axis"),
|
||||
tx_ptp_time=dut.qsfp_0_tx_ptp_time,
|
||||
tx_ptp_ts=dut.qsfp_0_tx_ptp_ts,
|
||||
tx_ptp_ts_tag=dut.qsfp_0_tx_ptp_ts_tag,
|
||||
tx_ptp_ts_valid=dut.qsfp_0_tx_ptp_ts_valid,
|
||||
rx_clk=dut.qsfp_0_rx_clk,
|
||||
rx_rst=dut.qsfp_0_rx_rst,
|
||||
rx_bus=AxiStreamBus.from_prefix(dut, "qsfp_0_rx_axis"),
|
||||
rx_ptp_time=dut.qsfp_0_rx_ptp_time,
|
||||
ifg=12, speed=100e9
|
||||
)
|
||||
for k in range(2):
|
||||
cocotb.start_soon(Clock(getattr(dut, f"qsfp_{k}_rx_clk"), 3.102, units="ns").start())
|
||||
cocotb.start_soon(Clock(getattr(dut, f"qsfp_{k}_tx_clk"), 3.102, units="ns").start())
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp_1_rx_clk, 3.102, units="ns").start())
|
||||
cocotb.start_soon(Clock(dut.qsfp_1_tx_clk, 3.102, units="ns").start())
|
||||
mac = EthMac(
|
||||
tx_clk=getattr(dut, f"qsfp_{k}_tx_clk"),
|
||||
tx_rst=getattr(dut, f"qsfp_{k}_tx_rst"),
|
||||
tx_bus=AxiStreamBus.from_prefix(dut, f"qsfp_{k}_tx_axis"),
|
||||
tx_ptp_time=getattr(dut, f"qsfp_{k}_tx_ptp_time"),
|
||||
tx_ptp_ts=getattr(dut, f"qsfp_{k}_tx_ptp_ts"),
|
||||
tx_ptp_ts_tag=getattr(dut, f"qsfp_{k}_tx_ptp_ts_tag"),
|
||||
tx_ptp_ts_valid=getattr(dut, f"qsfp_{k}_tx_ptp_ts_valid"),
|
||||
rx_clk=getattr(dut, f"qsfp_{k}_rx_clk"),
|
||||
rx_rst=getattr(dut, f"qsfp_{k}_rx_rst"),
|
||||
rx_bus=AxiStreamBus.from_prefix(dut, f"qsfp_{k}_rx_axis"),
|
||||
rx_ptp_time=getattr(dut, f"qsfp_{k}_rx_ptp_time"),
|
||||
ifg=12, speed=100e9
|
||||
)
|
||||
|
||||
self.qsfp_1_mac = EthMac(
|
||||
tx_clk=dut.qsfp_1_tx_clk,
|
||||
tx_rst=dut.qsfp_1_tx_rst,
|
||||
tx_bus=AxiStreamBus.from_prefix(dut, "qsfp_1_tx_axis"),
|
||||
tx_ptp_time=dut.qsfp_1_tx_ptp_time,
|
||||
tx_ptp_ts=dut.qsfp_1_tx_ptp_ts,
|
||||
tx_ptp_ts_tag=dut.qsfp_1_tx_ptp_ts_tag,
|
||||
tx_ptp_ts_valid=dut.qsfp_1_tx_ptp_ts_valid,
|
||||
rx_clk=dut.qsfp_1_rx_clk,
|
||||
rx_rst=dut.qsfp_1_rx_rst,
|
||||
rx_bus=AxiStreamBus.from_prefix(dut, "qsfp_1_rx_axis"),
|
||||
rx_ptp_time=dut.qsfp_1_rx_ptp_time,
|
||||
ifg=12, speed=100e9
|
||||
)
|
||||
self.qsfp_mac.append(mac)
|
||||
|
||||
dut.qsfp_0_rx_status.setimmediatevalue(1)
|
||||
getattr(dut, f"qsfp_{k}_rx_status").setimmediatevalue(1)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp_0_drp_clk, 8, units="ns").start())
|
||||
dut.qsfp_0_drp_rst.setimmediatevalue(0)
|
||||
dut.qsfp_0_drp_do.setimmediatevalue(0)
|
||||
dut.qsfp_0_drp_rdy.setimmediatevalue(0)
|
||||
cocotb.start_soon(Clock(getattr(dut, f"qsfp_{k}_drp_clk"), 8, units="ns").start())
|
||||
getattr(dut, f"qsfp_{k}_drp_rst").setimmediatevalue(0)
|
||||
getattr(dut, f"qsfp_{k}_drp_do").setimmediatevalue(0)
|
||||
getattr(dut, f"qsfp_{k}_drp_rdy").setimmediatevalue(0)
|
||||
|
||||
dut.qsfp_1_rx_status.setimmediatevalue(1)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp_1_drp_clk, 8, units="ns").start())
|
||||
dut.qsfp_1_drp_rst.setimmediatevalue(0)
|
||||
dut.qsfp_1_drp_do.setimmediatevalue(0)
|
||||
dut.qsfp_1_drp_rdy.setimmediatevalue(0)
|
||||
getattr(dut, f"qsfp_{k}_modprs_l").setimmediatevalue(0)
|
||||
|
||||
dut.user_sw.setimmediatevalue(0)
|
||||
|
||||
dut.qsfp_0_modprs_l.setimmediatevalue(0)
|
||||
dut.qsfp_1_modprs_l.setimmediatevalue(0)
|
||||
|
||||
dut.qsfp_int_l.setimmediatevalue(1)
|
||||
dut.qsfp_i2c_scl_i.setimmediatevalue(1)
|
||||
dut.qsfp_i2c_sda_i.setimmediatevalue(1)
|
||||
@ -347,19 +326,17 @@ class TB(object):
|
||||
async def init(self):
|
||||
|
||||
self.dut.ptp_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp_0_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp_0_tx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp_1_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp_1_tx_rst.setimmediatevalue(0)
|
||||
for k in range(2):
|
||||
getattr(self.dut, f"qsfp_{k}_rx_rst").setimmediatevalue(0)
|
||||
getattr(self.dut, f"qsfp_{k}_tx_rst").setimmediatevalue(0)
|
||||
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
|
||||
self.dut.ptp_rst.setimmediatevalue(1)
|
||||
self.dut.qsfp_0_rx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfp_0_tx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfp_1_rx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfp_1_tx_rst.setimmediatevalue(1)
|
||||
for k in range(2):
|
||||
getattr(self.dut, f"qsfp_{k}_rx_rst").setimmediatevalue(1)
|
||||
getattr(self.dut, f"qsfp_{k}_tx_rst").setimmediatevalue(1)
|
||||
|
||||
await FallingEdge(self.dut.rst_250mhz)
|
||||
await Timer(100, 'ns')
|
||||
@ -368,10 +345,9 @@ class TB(object):
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
|
||||
self.dut.ptp_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp_0_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp_0_tx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp_1_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp_1_tx_rst.setimmediatevalue(0)
|
||||
for k in range(2):
|
||||
getattr(self.dut, f"qsfp_{k}_rx_rst").setimmediatevalue(0)
|
||||
getattr(self.dut, f"qsfp_{k}_tx_rst").setimmediatevalue(0)
|
||||
|
||||
await self.rc.enumerate()
|
||||
|
||||
@ -380,10 +356,9 @@ class TB(object):
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
|
||||
if self.loopback_enable:
|
||||
if not self.qsfp_0_mac.tx.empty():
|
||||
await self.qsfp_0_mac.rx.send(await self.qsfp_0_mac.tx.recv())
|
||||
if not self.qsfp_1_mac.tx.empty():
|
||||
await self.qsfp_1_mac.rx.send(await self.qsfp_1_mac.tx.recv())
|
||||
for mac in self.qsfp_mac:
|
||||
if not mac.tx.empty():
|
||||
await mac.rx.send(await mac.tx.recv())
|
||||
|
||||
|
||||
@cocotb.test()
|
||||
@ -414,10 +389,10 @@ async def run_test_nic(dut):
|
||||
|
||||
await tb.driver.interfaces[0].start_xmit(data, 0)
|
||||
|
||||
pkt = await tb.qsfp_0_mac.tx.recv()
|
||||
pkt = await tb.qsfp_mac[0].tx.recv()
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
|
||||
await tb.qsfp_0_mac.rx.send(pkt)
|
||||
await tb.qsfp_mac[0].rx.send(pkt)
|
||||
|
||||
pkt = await tb.driver.interfaces[0].recv()
|
||||
|
||||
@ -426,10 +401,10 @@ async def run_test_nic(dut):
|
||||
|
||||
# await tb.driver.interfaces[1].start_xmit(data, 0)
|
||||
|
||||
# pkt = await tb.qsfp_1_mac.tx.recv()
|
||||
# pkt = await tb.qsfp_mac[1].tx.recv()
|
||||
# tb.log.info("Packet: %s", pkt)
|
||||
|
||||
# await tb.qsfp_1_mac.rx.send(pkt)
|
||||
# await tb.qsfp_mac[1].rx.send(pkt)
|
||||
|
||||
# pkt = await tb.driver.interfaces[1].recv()
|
||||
|
||||
@ -449,10 +424,10 @@ async def run_test_nic(dut):
|
||||
|
||||
await tb.driver.interfaces[0].start_xmit(test_pkt2.build(), 0, 34, 6)
|
||||
|
||||
pkt = await tb.qsfp_0_mac.tx.recv()
|
||||
pkt = await tb.qsfp_mac[0].tx.recv()
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
|
||||
await tb.qsfp_0_mac.rx.send(pkt)
|
||||
await tb.qsfp_mac[0].rx.send(pkt)
|
||||
|
||||
pkt = await tb.driver.interfaces[0].recv()
|
||||
|
||||
|
@ -276,81 +276,33 @@ class TB(object):
|
||||
cocotb.start_soon(Clock(dut.ptp_sample_clk, 8, units="ns").start())
|
||||
|
||||
# Ethernet
|
||||
cocotb.start_soon(Clock(dut.qsfp_0_rx_clk_0, 2.56, units="ns").start())
|
||||
self.qsfp_0_0_source = XgmiiSource(dut.qsfp_0_rxd_0, dut.qsfp_0_rxc_0, dut.qsfp_0_rx_clk_0, dut.qsfp_0_rx_rst_0)
|
||||
cocotb.start_soon(Clock(dut.qsfp_0_tx_clk_0, 2.56, units="ns").start())
|
||||
self.qsfp_0_0_sink = XgmiiSink(dut.qsfp_0_txd_0, dut.qsfp_0_txc_0, dut.qsfp_0_tx_clk_0, dut.qsfp_0_tx_rst_0)
|
||||
self.qsfp_source = []
|
||||
self.qsfp_sink = []
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp_0_rx_clk_1, 2.56, units="ns").start())
|
||||
self.qsfp_0_1_source = XgmiiSource(dut.qsfp_0_rxd_1, dut.qsfp_0_rxc_1, dut.qsfp_0_rx_clk_1, dut.qsfp_0_rx_rst_1)
|
||||
cocotb.start_soon(Clock(dut.qsfp_0_tx_clk_1, 2.56, units="ns").start())
|
||||
self.qsfp_0_1_sink = XgmiiSink(dut.qsfp_0_txd_1, dut.qsfp_0_txc_1, dut.qsfp_0_tx_clk_1, dut.qsfp_0_tx_rst_1)
|
||||
for x in range(2):
|
||||
sources = []
|
||||
sinks = []
|
||||
for y in range(4):
|
||||
cocotb.start_soon(Clock(getattr(dut, f"qsfp_{x}_rx_clk_{y}"), 2.56, units="ns").start())
|
||||
source = XgmiiSource(getattr(dut, f"qsfp_{x}_rxd_{y}"), getattr(dut, f"qsfp_{x}_rxc_{y}"), getattr(dut, f"qsfp_{x}_rx_clk_{y}"), getattr(dut, f"qsfp_{x}_rx_rst_{y}"))
|
||||
sources.append(source)
|
||||
cocotb.start_soon(Clock(getattr(dut, f"qsfp_{x}_tx_clk_{y}"), 2.56, units="ns").start())
|
||||
sink = XgmiiSink(getattr(dut, f"qsfp_{x}_txd_{y}"), getattr(dut, f"qsfp_{x}_txc_{y}"), getattr(dut, f"qsfp_{x}_tx_clk_{y}"), getattr(dut, f"qsfp_{x}_tx_rst_{y}"))
|
||||
sinks.append(sink)
|
||||
getattr(dut, f"qsfp_{x}_rx_status_{y}").setimmediatevalue(1)
|
||||
getattr(dut, f"qsfp_{x}_rx_error_count_{y}").setimmediatevalue(0)
|
||||
self.qsfp_source.append(sources)
|
||||
self.qsfp_sink.append(sinks)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp_0_rx_clk_2, 2.56, units="ns").start())
|
||||
self.qsfp_0_2_source = XgmiiSource(dut.qsfp_0_rxd_2, dut.qsfp_0_rxc_2, dut.qsfp_0_rx_clk_2, dut.qsfp_0_rx_rst_2)
|
||||
cocotb.start_soon(Clock(dut.qsfp_0_tx_clk_2, 2.56, units="ns").start())
|
||||
self.qsfp_0_2_sink = XgmiiSink(dut.qsfp_0_txd_2, dut.qsfp_0_txc_2, dut.qsfp_0_tx_clk_2, dut.qsfp_0_tx_rst_2)
|
||||
cocotb.start_soon(Clock(getattr(dut, f"qsfp_{x}_drp_clk"), 8, units="ns").start())
|
||||
getattr(dut, f"qsfp_{x}_drp_rst").setimmediatevalue(0)
|
||||
getattr(dut, f"qsfp_{x}_drp_do").setimmediatevalue(0)
|
||||
getattr(dut, f"qsfp_{x}_drp_rdy").setimmediatevalue(0)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp_0_rx_clk_3, 2.56, units="ns").start())
|
||||
self.qsfp_0_3_source = XgmiiSource(dut.qsfp_0_rxd_3, dut.qsfp_0_rxc_3, dut.qsfp_0_rx_clk_3, dut.qsfp_0_rx_rst_3)
|
||||
cocotb.start_soon(Clock(dut.qsfp_0_tx_clk_3, 2.56, units="ns").start())
|
||||
self.qsfp_0_3_sink = XgmiiSink(dut.qsfp_0_txd_3, dut.qsfp_0_txc_3, dut.qsfp_0_tx_clk_3, dut.qsfp_0_tx_rst_3)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp_1_rx_clk_0, 2.56, units="ns").start())
|
||||
self.qsfp_1_0_source = XgmiiSource(dut.qsfp_1_rxd_0, dut.qsfp_1_rxc_0, dut.qsfp_1_rx_clk_0, dut.qsfp_1_rx_rst_0)
|
||||
cocotb.start_soon(Clock(dut.qsfp_1_tx_clk_0, 2.56, units="ns").start())
|
||||
self.qsfp_1_0_sink = XgmiiSink(dut.qsfp_1_txd_0, dut.qsfp_1_txc_0, dut.qsfp_1_tx_clk_0, dut.qsfp_1_tx_rst_0)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp_1_rx_clk_1, 2.56, units="ns").start())
|
||||
self.qsfp_1_1_source = XgmiiSource(dut.qsfp_1_rxd_1, dut.qsfp_1_rxc_1, dut.qsfp_1_rx_clk_1, dut.qsfp_1_rx_rst_1)
|
||||
cocotb.start_soon(Clock(dut.qsfp_1_tx_clk_1, 2.56, units="ns").start())
|
||||
self.qsfp_1_1_sink = XgmiiSink(dut.qsfp_1_txd_1, dut.qsfp_1_txc_1, dut.qsfp_1_tx_clk_1, dut.qsfp_1_tx_rst_1)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp_1_rx_clk_2, 2.56, units="ns").start())
|
||||
self.qsfp_1_2_source = XgmiiSource(dut.qsfp_1_rxd_2, dut.qsfp_1_rxc_2, dut.qsfp_1_rx_clk_2, dut.qsfp_1_rx_rst_2)
|
||||
cocotb.start_soon(Clock(dut.qsfp_1_tx_clk_2, 2.56, units="ns").start())
|
||||
self.qsfp_1_2_sink = XgmiiSink(dut.qsfp_1_txd_2, dut.qsfp_1_txc_2, dut.qsfp_1_tx_clk_2, dut.qsfp_1_tx_rst_2)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp_1_rx_clk_3, 2.56, units="ns").start())
|
||||
self.qsfp_1_3_source = XgmiiSource(dut.qsfp_1_rxd_3, dut.qsfp_1_rxc_3, dut.qsfp_1_rx_clk_3, dut.qsfp_1_rx_rst_3)
|
||||
cocotb.start_soon(Clock(dut.qsfp_1_tx_clk_3, 2.56, units="ns").start())
|
||||
self.qsfp_1_3_sink = XgmiiSink(dut.qsfp_1_txd_3, dut.qsfp_1_txc_3, dut.qsfp_1_tx_clk_3, dut.qsfp_1_tx_rst_3)
|
||||
|
||||
dut.qsfp_0_rx_status_0.setimmediatevalue(1)
|
||||
dut.qsfp_0_rx_status_1.setimmediatevalue(1)
|
||||
dut.qsfp_0_rx_status_2.setimmediatevalue(1)
|
||||
dut.qsfp_0_rx_status_3.setimmediatevalue(1)
|
||||
|
||||
dut.qsfp_1_rx_status_0.setimmediatevalue(1)
|
||||
dut.qsfp_1_rx_status_1.setimmediatevalue(1)
|
||||
dut.qsfp_1_rx_status_2.setimmediatevalue(1)
|
||||
dut.qsfp_1_rx_status_3.setimmediatevalue(1)
|
||||
getattr(dut, f"qsfp_{x}_modprs_l").setimmediatevalue(0)
|
||||
|
||||
dut.user_sw.setimmediatevalue(0)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp_0_drp_clk, 8, units="ns").start())
|
||||
dut.qsfp_0_drp_rst.setimmediatevalue(0)
|
||||
dut.qsfp_0_drp_do.setimmediatevalue(0)
|
||||
dut.qsfp_0_drp_rdy.setimmediatevalue(0)
|
||||
|
||||
dut.qsfp_0_rx_error_count_0.setimmediatevalue(0)
|
||||
dut.qsfp_0_rx_error_count_1.setimmediatevalue(0)
|
||||
dut.qsfp_0_rx_error_count_2.setimmediatevalue(0)
|
||||
dut.qsfp_0_rx_error_count_3.setimmediatevalue(0)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp_1_drp_clk, 8, units="ns").start())
|
||||
dut.qsfp_1_drp_rst.setimmediatevalue(0)
|
||||
dut.qsfp_1_drp_do.setimmediatevalue(0)
|
||||
dut.qsfp_1_drp_rdy.setimmediatevalue(0)
|
||||
|
||||
dut.qsfp_1_rx_error_count_0.setimmediatevalue(0)
|
||||
dut.qsfp_1_rx_error_count_1.setimmediatevalue(0)
|
||||
dut.qsfp_1_rx_error_count_2.setimmediatevalue(0)
|
||||
dut.qsfp_1_rx_error_count_3.setimmediatevalue(0)
|
||||
|
||||
dut.qsfp_0_modprs_l.setimmediatevalue(0)
|
||||
dut.qsfp_1_modprs_l.setimmediatevalue(0)
|
||||
|
||||
dut.qsfp_int_l.setimmediatevalue(1)
|
||||
dut.qsfp_i2c_scl_i.setimmediatevalue(1)
|
||||
dut.qsfp_i2c_sda_i.setimmediatevalue(1)
|
||||
@ -367,43 +319,19 @@ class TB(object):
|
||||
async def init(self):
|
||||
|
||||
self.dut.ptp_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp_0_rx_rst_0.setimmediatevalue(0)
|
||||
self.dut.qsfp_0_tx_rst_0.setimmediatevalue(0)
|
||||
self.dut.qsfp_0_rx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp_0_tx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp_0_rx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp_0_tx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp_0_rx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp_0_tx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp_1_rx_rst_0.setimmediatevalue(0)
|
||||
self.dut.qsfp_1_tx_rst_0.setimmediatevalue(0)
|
||||
self.dut.qsfp_1_rx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp_1_tx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp_1_rx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp_1_tx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp_1_rx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp_1_tx_rst_3.setimmediatevalue(0)
|
||||
for x in range(2):
|
||||
for y in range(4):
|
||||
getattr(self.dut, f"qsfp_{x}_rx_rst_{y}").setimmediatevalue(0)
|
||||
getattr(self.dut, f"qsfp_{x}_tx_rst_{y}").setimmediatevalue(0)
|
||||
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
|
||||
self.dut.ptp_rst.setimmediatevalue(1)
|
||||
self.dut.qsfp_0_rx_rst_0.setimmediatevalue(1)
|
||||
self.dut.qsfp_0_tx_rst_0.setimmediatevalue(1)
|
||||
self.dut.qsfp_0_rx_rst_1.setimmediatevalue(1)
|
||||
self.dut.qsfp_0_tx_rst_1.setimmediatevalue(1)
|
||||
self.dut.qsfp_0_rx_rst_2.setimmediatevalue(1)
|
||||
self.dut.qsfp_0_tx_rst_2.setimmediatevalue(1)
|
||||
self.dut.qsfp_0_rx_rst_3.setimmediatevalue(1)
|
||||
self.dut.qsfp_0_tx_rst_3.setimmediatevalue(1)
|
||||
self.dut.qsfp_1_rx_rst_0.setimmediatevalue(1)
|
||||
self.dut.qsfp_1_tx_rst_0.setimmediatevalue(1)
|
||||
self.dut.qsfp_1_rx_rst_1.setimmediatevalue(1)
|
||||
self.dut.qsfp_1_tx_rst_1.setimmediatevalue(1)
|
||||
self.dut.qsfp_1_rx_rst_2.setimmediatevalue(1)
|
||||
self.dut.qsfp_1_tx_rst_2.setimmediatevalue(1)
|
||||
self.dut.qsfp_1_rx_rst_3.setimmediatevalue(1)
|
||||
self.dut.qsfp_1_tx_rst_3.setimmediatevalue(1)
|
||||
for x in range(2):
|
||||
for y in range(4):
|
||||
getattr(self.dut, f"qsfp_{x}_rx_rst_{y}").setimmediatevalue(1)
|
||||
getattr(self.dut, f"qsfp_{x}_tx_rst_{y}").setimmediatevalue(1)
|
||||
|
||||
await FallingEdge(self.dut.rst_250mhz)
|
||||
await Timer(100, 'ns')
|
||||
@ -412,22 +340,10 @@ class TB(object):
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
|
||||
self.dut.ptp_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp_0_rx_rst_0.setimmediatevalue(0)
|
||||
self.dut.qsfp_0_tx_rst_0.setimmediatevalue(0)
|
||||
self.dut.qsfp_0_rx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp_0_tx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp_0_rx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp_0_tx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp_0_rx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp_0_tx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp_1_rx_rst_0.setimmediatevalue(0)
|
||||
self.dut.qsfp_1_tx_rst_0.setimmediatevalue(0)
|
||||
self.dut.qsfp_1_rx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp_1_tx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp_1_rx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp_1_tx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp_1_rx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp_1_tx_rst_3.setimmediatevalue(0)
|
||||
for x in range(2):
|
||||
for y in range(4):
|
||||
getattr(self.dut, f"qsfp_{x}_rx_rst_{y}").setimmediatevalue(0)
|
||||
getattr(self.dut, f"qsfp_{x}_tx_rst_{y}").setimmediatevalue(0)
|
||||
|
||||
await self.rc.enumerate()
|
||||
|
||||
@ -436,22 +352,10 @@ class TB(object):
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
|
||||
if self.loopback_enable:
|
||||
if not self.qsfp_0_0_sink.empty():
|
||||
await self.qsfp_0_0_source.send(await self.qsfp_0_0_sink.recv())
|
||||
if not self.qsfp_0_1_sink.empty():
|
||||
await self.qsfp_0_1_source.send(await self.qsfp_0_1_sink.recv())
|
||||
if not self.qsfp_0_2_sink.empty():
|
||||
await self.qsfp_0_2_source.send(await self.qsfp_0_2_sink.recv())
|
||||
if not self.qsfp_0_3_sink.empty():
|
||||
await self.qsfp_0_3_source.send(await self.qsfp_0_3_sink.recv())
|
||||
if not self.qsfp_1_0_sink.empty():
|
||||
await self.qsfp_1_0_source.send(await self.qsfp_1_0_sink.recv())
|
||||
if not self.qsfp_1_1_sink.empty():
|
||||
await self.qsfp_1_1_source.send(await self.qsfp_1_1_sink.recv())
|
||||
if not self.qsfp_1_2_sink.empty():
|
||||
await self.qsfp_1_2_source.send(await self.qsfp_1_2_sink.recv())
|
||||
if not self.qsfp_1_3_sink.empty():
|
||||
await self.qsfp_1_3_source.send(await self.qsfp_1_3_sink.recv())
|
||||
for x in range(len(self.qsfp_sink)):
|
||||
for y in range(len(self.qsfp_sink[x])):
|
||||
if not self.qsfp_sink[x][y].empty():
|
||||
await self.qsfp_source[x][y].send(await self.qsfp_sink[x][y].recv())
|
||||
|
||||
|
||||
@cocotb.test()
|
||||
@ -482,10 +386,10 @@ async def run_test_nic(dut):
|
||||
|
||||
await tb.driver.interfaces[0].start_xmit(data, 0)
|
||||
|
||||
pkt = await tb.qsfp_0_0_sink.recv()
|
||||
pkt = await tb.qsfp_sink[0][0].recv()
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
|
||||
await tb.qsfp_0_0_source.send(pkt)
|
||||
await tb.qsfp_source[0][0].send(pkt)
|
||||
|
||||
pkt = await tb.driver.interfaces[0].recv()
|
||||
|
||||
@ -494,10 +398,10 @@ async def run_test_nic(dut):
|
||||
|
||||
# await tb.driver.interfaces[1].start_xmit(data, 0)
|
||||
|
||||
# pkt = await tb.qsfp_1_0_sink.recv()
|
||||
# pkt = await tb.qsfp_sink[1][0].recv()
|
||||
# tb.log.info("Packet: %s", pkt)
|
||||
|
||||
# await tb.qsfp_1_0_source.send(pkt)
|
||||
# await tb.qsfp_source[1][0].send(pkt)
|
||||
|
||||
# pkt = await tb.driver.interfaces[1].recv()
|
||||
|
||||
@ -517,10 +421,10 @@ async def run_test_nic(dut):
|
||||
|
||||
await tb.driver.interfaces[0].start_xmit(test_pkt2.build(), 0, 34, 6)
|
||||
|
||||
pkt = await tb.qsfp_0_0_sink.recv()
|
||||
pkt = await tb.qsfp_sink[0][0].recv()
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
|
||||
await tb.qsfp_0_0_source.send(pkt)
|
||||
await tb.qsfp_source[0][0].send(pkt)
|
||||
|
||||
pkt = await tb.driver.interfaces[0].recv()
|
||||
|
||||
|
@ -276,67 +276,44 @@ class TB(object):
|
||||
cocotb.start_soon(Clock(dut.ptp_sample_clk, 8, units="ns").start())
|
||||
|
||||
# Ethernet
|
||||
cocotb.start_soon(Clock(dut.qsfp0_rx_clk, 3.102, units="ns").start())
|
||||
cocotb.start_soon(Clock(dut.qsfp0_tx_clk, 3.102, units="ns").start())
|
||||
self.qsfp_mac = []
|
||||
|
||||
self.qsfp0_mac = EthMac(
|
||||
tx_clk=dut.qsfp0_tx_clk,
|
||||
tx_rst=dut.qsfp0_tx_rst,
|
||||
tx_bus=AxiStreamBus.from_prefix(dut, "qsfp0_tx_axis"),
|
||||
tx_ptp_time=dut.qsfp0_tx_ptp_time,
|
||||
tx_ptp_ts=dut.qsfp0_tx_ptp_ts,
|
||||
tx_ptp_ts_tag=dut.qsfp0_tx_ptp_ts_tag,
|
||||
tx_ptp_ts_valid=dut.qsfp0_tx_ptp_ts_valid,
|
||||
rx_clk=dut.qsfp0_rx_clk,
|
||||
rx_rst=dut.qsfp0_rx_rst,
|
||||
rx_bus=AxiStreamBus.from_prefix(dut, "qsfp0_rx_axis"),
|
||||
rx_ptp_time=dut.qsfp0_rx_ptp_time,
|
||||
ifg=12, speed=100e9
|
||||
)
|
||||
for k in range(2):
|
||||
cocotb.start_soon(Clock(getattr(dut, f"qsfp{k}_rx_clk"), 3.102, units="ns").start())
|
||||
cocotb.start_soon(Clock(getattr(dut, f"qsfp{k}_tx_clk"), 3.102, units="ns").start())
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp1_rx_clk, 3.102, units="ns").start())
|
||||
cocotb.start_soon(Clock(dut.qsfp1_tx_clk, 3.102, units="ns").start())
|
||||
mac = EthMac(
|
||||
tx_clk=getattr(dut, f"qsfp{k}_tx_clk"),
|
||||
tx_rst=getattr(dut, f"qsfp{k}_tx_rst"),
|
||||
tx_bus=AxiStreamBus.from_prefix(dut, f"qsfp{k}_tx_axis"),
|
||||
tx_ptp_time=getattr(dut, f"qsfp{k}_tx_ptp_time"),
|
||||
tx_ptp_ts=getattr(dut, f"qsfp{k}_tx_ptp_ts"),
|
||||
tx_ptp_ts_tag=getattr(dut, f"qsfp{k}_tx_ptp_ts_tag"),
|
||||
tx_ptp_ts_valid=getattr(dut, f"qsfp{k}_tx_ptp_ts_valid"),
|
||||
rx_clk=getattr(dut, f"qsfp{k}_rx_clk"),
|
||||
rx_rst=getattr(dut, f"qsfp{k}_rx_rst"),
|
||||
rx_bus=AxiStreamBus.from_prefix(dut, f"qsfp{k}_rx_axis"),
|
||||
rx_ptp_time=getattr(dut, f"qsfp{k}_rx_ptp_time"),
|
||||
ifg=12, speed=100e9
|
||||
)
|
||||
|
||||
self.qsfp1_mac = EthMac(
|
||||
tx_clk=dut.qsfp1_tx_clk,
|
||||
tx_rst=dut.qsfp1_tx_rst,
|
||||
tx_bus=AxiStreamBus.from_prefix(dut, "qsfp1_tx_axis"),
|
||||
tx_ptp_time=dut.qsfp1_tx_ptp_time,
|
||||
tx_ptp_ts=dut.qsfp1_tx_ptp_ts,
|
||||
tx_ptp_ts_tag=dut.qsfp1_tx_ptp_ts_tag,
|
||||
tx_ptp_ts_valid=dut.qsfp1_tx_ptp_ts_valid,
|
||||
rx_clk=dut.qsfp1_rx_clk,
|
||||
rx_rst=dut.qsfp1_rx_rst,
|
||||
rx_bus=AxiStreamBus.from_prefix(dut, "qsfp1_rx_axis"),
|
||||
rx_ptp_time=dut.qsfp1_rx_ptp_time,
|
||||
ifg=12, speed=100e9
|
||||
)
|
||||
self.qsfp_mac.append(mac)
|
||||
|
||||
dut.qsfp0_rx_status.setimmediatevalue(1)
|
||||
getattr(dut, f"qsfp{k}_rx_status").setimmediatevalue(1)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp0_drp_clk, 8, units="ns").start())
|
||||
dut.qsfp0_drp_rst.setimmediatevalue(0)
|
||||
dut.qsfp0_drp_do.setimmediatevalue(0)
|
||||
dut.qsfp0_drp_rdy.setimmediatevalue(0)
|
||||
cocotb.start_soon(Clock(getattr(dut, f"qsfp{k}_drp_clk"), 8, units="ns").start())
|
||||
getattr(dut, f"qsfp{k}_drp_rst").setimmediatevalue(0)
|
||||
getattr(dut, f"qsfp{k}_drp_do").setimmediatevalue(0)
|
||||
getattr(dut, f"qsfp{k}_drp_rdy").setimmediatevalue(0)
|
||||
|
||||
dut.qsfp1_rx_status.setimmediatevalue(1)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp1_drp_clk, 8, units="ns").start())
|
||||
dut.qsfp1_drp_rst.setimmediatevalue(0)
|
||||
dut.qsfp1_drp_do.setimmediatevalue(0)
|
||||
dut.qsfp1_drp_rdy.setimmediatevalue(0)
|
||||
getattr(dut, f"qsfp{k}_modprsl").setimmediatevalue(0)
|
||||
getattr(dut, f"qsfp{k}_intl").setimmediatevalue(0)
|
||||
|
||||
dut.sw.setimmediatevalue(0)
|
||||
|
||||
dut.i2c_scl_i.setimmediatevalue(1)
|
||||
dut.i2c_sda_i.setimmediatevalue(1)
|
||||
|
||||
dut.qsfp0_modprsl.setimmediatevalue(0)
|
||||
dut.qsfp0_intl.setimmediatevalue(1)
|
||||
|
||||
dut.qsfp1_modprsl.setimmediatevalue(0)
|
||||
dut.qsfp1_intl.setimmediatevalue(1)
|
||||
|
||||
dut.qspi_dq_i.setimmediatevalue(0)
|
||||
|
||||
self.cms_ram = AxiLiteRam(AxiLiteBus.from_prefix(dut, "m_axil_cms"), dut.m_axil_cms_clk, dut.m_axil_cms_rst, size=256*1024)
|
||||
@ -347,19 +324,17 @@ class TB(object):
|
||||
async def init(self):
|
||||
|
||||
self.dut.ptp_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp0_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp0_tx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp1_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp1_tx_rst.setimmediatevalue(0)
|
||||
for k in range(2):
|
||||
getattr(self.dut, f"qsfp{k}_rx_rst").setimmediatevalue(0)
|
||||
getattr(self.dut, f"qsfp{k}_tx_rst").setimmediatevalue(0)
|
||||
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
|
||||
self.dut.ptp_rst.setimmediatevalue(1)
|
||||
self.dut.qsfp0_rx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfp0_tx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfp1_rx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfp1_tx_rst.setimmediatevalue(1)
|
||||
for k in range(2):
|
||||
getattr(self.dut, f"qsfp{k}_rx_rst").setimmediatevalue(1)
|
||||
getattr(self.dut, f"qsfp{k}_tx_rst").setimmediatevalue(1)
|
||||
|
||||
await FallingEdge(self.dut.rst_250mhz)
|
||||
await Timer(100, 'ns')
|
||||
@ -368,10 +343,9 @@ class TB(object):
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
|
||||
self.dut.ptp_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp0_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp0_tx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp1_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp1_tx_rst.setimmediatevalue(0)
|
||||
for k in range(2):
|
||||
getattr(self.dut, f"qsfp{k}_rx_rst").setimmediatevalue(0)
|
||||
getattr(self.dut, f"qsfp{k}_tx_rst").setimmediatevalue(0)
|
||||
|
||||
await self.rc.enumerate()
|
||||
|
||||
@ -380,10 +354,9 @@ class TB(object):
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
|
||||
if self.loopback_enable:
|
||||
if not self.qsfp0_mac.tx.empty():
|
||||
await self.qsfp0_mac.rx.send(await self.qsfp0_mac.tx.recv())
|
||||
if not self.qsfp1_mac.tx.empty():
|
||||
await self.qsfp1_mac.rx.send(await self.qsfp1_mac.tx.recv())
|
||||
for mac in self.qsfp_mac:
|
||||
if not mac.tx.empty():
|
||||
await mac.rx.send(await mac.tx.recv())
|
||||
|
||||
|
||||
@cocotb.test()
|
||||
@ -414,10 +387,10 @@ async def run_test_nic(dut):
|
||||
|
||||
await tb.driver.interfaces[0].start_xmit(data, 0)
|
||||
|
||||
pkt = await tb.qsfp0_mac.tx.recv()
|
||||
pkt = await tb.qsfp_mac[0].tx.recv()
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
|
||||
await tb.qsfp0_mac.rx.send(pkt)
|
||||
await tb.qsfp_mac[0].rx.send(pkt)
|
||||
|
||||
pkt = await tb.driver.interfaces[0].recv()
|
||||
|
||||
@ -426,10 +399,10 @@ async def run_test_nic(dut):
|
||||
|
||||
# await tb.driver.interfaces[1].start_xmit(data, 0)
|
||||
|
||||
# pkt = await tb.qsfp1_mac.tx.recv()
|
||||
# pkt = await tb.qsfp_mac[1].tx.recv()
|
||||
# tb.log.info("Packet: %s", pkt)
|
||||
|
||||
# await tb.qsfp1_mac.rx.send(pkt)
|
||||
# await tb.qsfp_mac[1].rx.send(pkt)
|
||||
|
||||
# pkt = await tb.driver.interfaces[1].recv()
|
||||
|
||||
@ -449,10 +422,10 @@ async def run_test_nic(dut):
|
||||
|
||||
await tb.driver.interfaces[0].start_xmit(test_pkt2.build(), 0, 34, 6)
|
||||
|
||||
pkt = await tb.qsfp0_mac.tx.recv()
|
||||
pkt = await tb.qsfp_mac[0].tx.recv()
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
|
||||
await tb.qsfp0_mac.rx.send(pkt)
|
||||
await tb.qsfp_mac[0].rx.send(pkt)
|
||||
|
||||
pkt = await tb.driver.interfaces[0].recv()
|
||||
|
||||
|
@ -276,87 +276,37 @@ class TB(object):
|
||||
cocotb.start_soon(Clock(dut.ptp_sample_clk, 8, units="ns").start())
|
||||
|
||||
# Ethernet
|
||||
cocotb.start_soon(Clock(dut.qsfp0_rx_clk_1, 2.56, units="ns").start())
|
||||
self.qsfp0_1_source = XgmiiSource(dut.qsfp0_rxd_1, dut.qsfp0_rxc_1, dut.qsfp0_rx_clk_1, dut.qsfp0_rx_rst_1)
|
||||
cocotb.start_soon(Clock(dut.qsfp0_tx_clk_1, 2.56, units="ns").start())
|
||||
self.qsfp0_1_sink = XgmiiSink(dut.qsfp0_txd_1, dut.qsfp0_txc_1, dut.qsfp0_tx_clk_1, dut.qsfp0_tx_rst_1)
|
||||
self.qsfp_source = []
|
||||
self.qsfp_sink = []
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp0_rx_clk_2, 2.56, units="ns").start())
|
||||
self.qsfp0_2_source = XgmiiSource(dut.qsfp0_rxd_2, dut.qsfp0_rxc_2, dut.qsfp0_rx_clk_2, dut.qsfp0_rx_rst_2)
|
||||
cocotb.start_soon(Clock(dut.qsfp0_tx_clk_2, 2.56, units="ns").start())
|
||||
self.qsfp0_2_sink = XgmiiSink(dut.qsfp0_txd_2, dut.qsfp0_txc_2, dut.qsfp0_tx_clk_2, dut.qsfp0_tx_rst_2)
|
||||
for x in range(2):
|
||||
sources = []
|
||||
sinks = []
|
||||
for y in range(1, 5):
|
||||
cocotb.start_soon(Clock(getattr(dut, f"qsfp{x}_rx_clk_{y}"), 2.56, units="ns").start())
|
||||
source = XgmiiSource(getattr(dut, f"qsfp{x}_rxd_{y}"), getattr(dut, f"qsfp{x}_rxc_{y}"), getattr(dut, f"qsfp{x}_rx_clk_{y}"), getattr(dut, f"qsfp{x}_rx_rst_{y}"))
|
||||
sources.append(source)
|
||||
cocotb.start_soon(Clock(getattr(dut, f"qsfp{x}_tx_clk_{y}"), 2.56, units="ns").start())
|
||||
sink = XgmiiSink(getattr(dut, f"qsfp{x}_txd_{y}"), getattr(dut, f"qsfp{x}_txc_{y}"), getattr(dut, f"qsfp{x}_tx_clk_{y}"), getattr(dut, f"qsfp{x}_tx_rst_{y}"))
|
||||
sinks.append(sink)
|
||||
getattr(dut, f"qsfp{x}_rx_status_{y}").setimmediatevalue(1)
|
||||
getattr(dut, f"qsfp{x}_rx_error_count_{y}").setimmediatevalue(0)
|
||||
self.qsfp_source.append(sources)
|
||||
self.qsfp_sink.append(sinks)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp0_rx_clk_3, 2.56, units="ns").start())
|
||||
self.qsfp0_3_source = XgmiiSource(dut.qsfp0_rxd_3, dut.qsfp0_rxc_3, dut.qsfp0_rx_clk_3, dut.qsfp0_rx_rst_3)
|
||||
cocotb.start_soon(Clock(dut.qsfp0_tx_clk_3, 2.56, units="ns").start())
|
||||
self.qsfp0_3_sink = XgmiiSink(dut.qsfp0_txd_3, dut.qsfp0_txc_3, dut.qsfp0_tx_clk_3, dut.qsfp0_tx_rst_3)
|
||||
cocotb.start_soon(Clock(getattr(dut, f"qsfp{x}_drp_clk"), 8, units="ns").start())
|
||||
getattr(dut, f"qsfp{x}_drp_rst").setimmediatevalue(0)
|
||||
getattr(dut, f"qsfp{x}_drp_do").setimmediatevalue(0)
|
||||
getattr(dut, f"qsfp{x}_drp_rdy").setimmediatevalue(0)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp0_rx_clk_4, 2.56, units="ns").start())
|
||||
self.qsfp0_4_source = XgmiiSource(dut.qsfp0_rxd_4, dut.qsfp0_rxc_4, dut.qsfp0_rx_clk_4, dut.qsfp0_rx_rst_4)
|
||||
cocotb.start_soon(Clock(dut.qsfp0_tx_clk_4, 2.56, units="ns").start())
|
||||
self.qsfp0_4_sink = XgmiiSink(dut.qsfp0_txd_4, dut.qsfp0_txc_4, dut.qsfp0_tx_clk_4, dut.qsfp0_tx_rst_4)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp1_rx_clk_1, 2.56, units="ns").start())
|
||||
self.qsfp1_1_source = XgmiiSource(dut.qsfp1_rxd_1, dut.qsfp1_rxc_1, dut.qsfp1_rx_clk_1, dut.qsfp1_rx_rst_1)
|
||||
cocotb.start_soon(Clock(dut.qsfp1_tx_clk_1, 2.56, units="ns").start())
|
||||
self.qsfp1_1_sink = XgmiiSink(dut.qsfp1_txd_1, dut.qsfp1_txc_1, dut.qsfp1_tx_clk_1, dut.qsfp1_tx_rst_1)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp1_rx_clk_2, 2.56, units="ns").start())
|
||||
self.qsfp1_2_source = XgmiiSource(dut.qsfp1_rxd_2, dut.qsfp1_rxc_2, dut.qsfp1_rx_clk_2, dut.qsfp1_rx_rst_2)
|
||||
cocotb.start_soon(Clock(dut.qsfp1_tx_clk_2, 2.56, units="ns").start())
|
||||
self.qsfp1_2_sink = XgmiiSink(dut.qsfp1_txd_2, dut.qsfp1_txc_2, dut.qsfp1_tx_clk_2, dut.qsfp1_tx_rst_2)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp1_rx_clk_3, 2.56, units="ns").start())
|
||||
self.qsfp1_3_source = XgmiiSource(dut.qsfp1_rxd_3, dut.qsfp1_rxc_3, dut.qsfp1_rx_clk_3, dut.qsfp1_rx_rst_3)
|
||||
cocotb.start_soon(Clock(dut.qsfp1_tx_clk_3, 2.56, units="ns").start())
|
||||
self.qsfp1_3_sink = XgmiiSink(dut.qsfp1_txd_3, dut.qsfp1_txc_3, dut.qsfp1_tx_clk_3, dut.qsfp1_tx_rst_3)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp1_rx_clk_4, 2.56, units="ns").start())
|
||||
self.qsfp1_4_source = XgmiiSource(dut.qsfp1_rxd_4, dut.qsfp1_rxc_4, dut.qsfp1_rx_clk_4, dut.qsfp1_rx_rst_4)
|
||||
cocotb.start_soon(Clock(dut.qsfp1_tx_clk_4, 2.56, units="ns").start())
|
||||
self.qsfp1_4_sink = XgmiiSink(dut.qsfp1_txd_4, dut.qsfp1_txc_4, dut.qsfp1_tx_clk_4, dut.qsfp1_tx_rst_4)
|
||||
|
||||
dut.qsfp0_rx_status_1.setimmediatevalue(1)
|
||||
dut.qsfp0_rx_status_2.setimmediatevalue(1)
|
||||
dut.qsfp0_rx_status_3.setimmediatevalue(1)
|
||||
dut.qsfp0_rx_status_4.setimmediatevalue(1)
|
||||
|
||||
dut.qsfp1_rx_status_1.setimmediatevalue(1)
|
||||
dut.qsfp1_rx_status_2.setimmediatevalue(1)
|
||||
dut.qsfp1_rx_status_3.setimmediatevalue(1)
|
||||
dut.qsfp1_rx_status_4.setimmediatevalue(1)
|
||||
getattr(dut, f"qsfp{x}_modprsl").setimmediatevalue(0)
|
||||
getattr(dut, f"qsfp{x}_intl").setimmediatevalue(1)
|
||||
|
||||
dut.sw.setimmediatevalue(0)
|
||||
|
||||
dut.i2c_scl_i.setimmediatevalue(1)
|
||||
dut.i2c_sda_i.setimmediatevalue(1)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp0_drp_clk, 8, units="ns").start())
|
||||
dut.qsfp0_drp_rst.setimmediatevalue(0)
|
||||
dut.qsfp0_drp_do.setimmediatevalue(0)
|
||||
dut.qsfp0_drp_rdy.setimmediatevalue(0)
|
||||
|
||||
dut.qsfp0_rx_error_count_1.setimmediatevalue(0)
|
||||
dut.qsfp0_rx_error_count_2.setimmediatevalue(0)
|
||||
dut.qsfp0_rx_error_count_3.setimmediatevalue(0)
|
||||
dut.qsfp0_rx_error_count_4.setimmediatevalue(0)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp1_drp_clk, 8, units="ns").start())
|
||||
dut.qsfp1_drp_rst.setimmediatevalue(0)
|
||||
dut.qsfp1_drp_do.setimmediatevalue(0)
|
||||
dut.qsfp1_drp_rdy.setimmediatevalue(0)
|
||||
|
||||
dut.qsfp1_rx_error_count_1.setimmediatevalue(0)
|
||||
dut.qsfp1_rx_error_count_2.setimmediatevalue(0)
|
||||
dut.qsfp1_rx_error_count_3.setimmediatevalue(0)
|
||||
dut.qsfp1_rx_error_count_4.setimmediatevalue(0)
|
||||
|
||||
dut.qsfp0_modprsl.setimmediatevalue(0)
|
||||
dut.qsfp0_intl.setimmediatevalue(1)
|
||||
|
||||
dut.qsfp1_modprsl.setimmediatevalue(0)
|
||||
dut.qsfp1_intl.setimmediatevalue(1)
|
||||
|
||||
dut.qspi_dq_i.setimmediatevalue(0)
|
||||
|
||||
self.cms_ram = AxiLiteRam(AxiLiteBus.from_prefix(dut, "m_axil_cms"), dut.m_axil_cms_clk, dut.m_axil_cms_rst, size=256*1024)
|
||||
@ -367,43 +317,19 @@ class TB(object):
|
||||
async def init(self):
|
||||
|
||||
self.dut.ptp_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp0_rx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp0_tx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp0_rx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp0_tx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp0_rx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp0_tx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp0_rx_rst_4.setimmediatevalue(0)
|
||||
self.dut.qsfp0_tx_rst_4.setimmediatevalue(0)
|
||||
self.dut.qsfp1_rx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp1_tx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp1_rx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp1_tx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp1_rx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp1_tx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp1_rx_rst_4.setimmediatevalue(0)
|
||||
self.dut.qsfp1_tx_rst_4.setimmediatevalue(0)
|
||||
for x in range(2):
|
||||
for y in range(1, 5):
|
||||
getattr(self.dut, f"qsfp{x}_rx_rst_{y}").setimmediatevalue(0)
|
||||
getattr(self.dut, f"qsfp{x}_tx_rst_{y}").setimmediatevalue(0)
|
||||
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
|
||||
self.dut.ptp_rst.setimmediatevalue(1)
|
||||
self.dut.qsfp0_rx_rst_1.setimmediatevalue(1)
|
||||
self.dut.qsfp0_tx_rst_1.setimmediatevalue(1)
|
||||
self.dut.qsfp0_rx_rst_2.setimmediatevalue(1)
|
||||
self.dut.qsfp0_tx_rst_2.setimmediatevalue(1)
|
||||
self.dut.qsfp0_rx_rst_3.setimmediatevalue(1)
|
||||
self.dut.qsfp0_tx_rst_3.setimmediatevalue(1)
|
||||
self.dut.qsfp0_rx_rst_4.setimmediatevalue(1)
|
||||
self.dut.qsfp0_tx_rst_4.setimmediatevalue(1)
|
||||
self.dut.qsfp1_rx_rst_1.setimmediatevalue(1)
|
||||
self.dut.qsfp1_tx_rst_1.setimmediatevalue(1)
|
||||
self.dut.qsfp1_rx_rst_2.setimmediatevalue(1)
|
||||
self.dut.qsfp1_tx_rst_2.setimmediatevalue(1)
|
||||
self.dut.qsfp1_rx_rst_3.setimmediatevalue(1)
|
||||
self.dut.qsfp1_tx_rst_3.setimmediatevalue(1)
|
||||
self.dut.qsfp1_rx_rst_4.setimmediatevalue(1)
|
||||
self.dut.qsfp1_tx_rst_4.setimmediatevalue(1)
|
||||
for x in range(2):
|
||||
for y in range(1, 5):
|
||||
getattr(self.dut, f"qsfp{x}_rx_rst_{y}").setimmediatevalue(1)
|
||||
getattr(self.dut, f"qsfp{x}_tx_rst_{y}").setimmediatevalue(1)
|
||||
|
||||
await FallingEdge(self.dut.rst_250mhz)
|
||||
await Timer(100, 'ns')
|
||||
@ -412,22 +338,10 @@ class TB(object):
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
|
||||
self.dut.ptp_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp0_rx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp0_tx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp0_rx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp0_tx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp0_rx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp0_tx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp0_rx_rst_4.setimmediatevalue(0)
|
||||
self.dut.qsfp0_tx_rst_4.setimmediatevalue(0)
|
||||
self.dut.qsfp1_rx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp1_tx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp1_rx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp1_tx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp1_rx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp1_tx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp1_rx_rst_4.setimmediatevalue(0)
|
||||
self.dut.qsfp1_tx_rst_4.setimmediatevalue(0)
|
||||
for x in range(2):
|
||||
for y in range(1, 5):
|
||||
getattr(self.dut, f"qsfp{x}_rx_rst_{y}").setimmediatevalue(0)
|
||||
getattr(self.dut, f"qsfp{x}_tx_rst_{y}").setimmediatevalue(0)
|
||||
|
||||
await self.rc.enumerate()
|
||||
|
||||
@ -436,22 +350,10 @@ class TB(object):
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
|
||||
if self.loopback_enable:
|
||||
if not self.qsfp0_1_sink.empty():
|
||||
await self.qsfp0_1_source.send(await self.qsfp0_1_sink.recv())
|
||||
if not self.qsfp0_2_sink.empty():
|
||||
await self.qsfp0_2_source.send(await self.qsfp0_2_sink.recv())
|
||||
if not self.qsfp0_3_sink.empty():
|
||||
await self.qsfp0_3_source.send(await self.qsfp0_3_sink.recv())
|
||||
if not self.qsfp0_4_sink.empty():
|
||||
await self.qsfp0_4_source.send(await self.qsfp0_4_sink.recv())
|
||||
if not self.qsfp1_1_sink.empty():
|
||||
await self.qsfp1_1_source.send(await self.qsfp1_1_sink.recv())
|
||||
if not self.qsfp1_2_sink.empty():
|
||||
await self.qsfp1_2_source.send(await self.qsfp1_2_sink.recv())
|
||||
if not self.qsfp1_3_sink.empty():
|
||||
await self.qsfp1_3_source.send(await self.qsfp1_3_sink.recv())
|
||||
if not self.qsfp1_4_sink.empty():
|
||||
await self.qsfp1_4_source.send(await self.qsfp1_4_sink.recv())
|
||||
for x in range(len(self.qsfp_sink)):
|
||||
for y in range(len(self.qsfp_sink[x])):
|
||||
if not self.qsfp_sink[x][y].empty():
|
||||
await self.qsfp_source[x][y].send(await self.qsfp_sink[x][y].recv())
|
||||
|
||||
|
||||
@cocotb.test()
|
||||
@ -482,10 +384,10 @@ async def run_test_nic(dut):
|
||||
|
||||
await tb.driver.interfaces[0].start_xmit(data, 0)
|
||||
|
||||
pkt = await tb.qsfp0_1_sink.recv()
|
||||
pkt = await tb.qsfp_sink[0][0].recv()
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
|
||||
await tb.qsfp0_1_source.send(pkt)
|
||||
await tb.qsfp_source[0][0].send(pkt)
|
||||
|
||||
pkt = await tb.driver.interfaces[0].recv()
|
||||
|
||||
@ -494,10 +396,10 @@ async def run_test_nic(dut):
|
||||
|
||||
# await tb.driver.interfaces[1].start_xmit(data, 0)
|
||||
|
||||
# pkt = await tb.qsfp1_1_sink.recv()
|
||||
# pkt = await tb.qsfp_sink[1][0].recv()
|
||||
# tb.log.info("Packet: %s", pkt)
|
||||
|
||||
# await tb.qsfp1_1_source.send(pkt)
|
||||
# await tb.qsfp_source[1][0].send(pkt)
|
||||
|
||||
# pkt = await tb.driver.interfaces[1].recv()
|
||||
|
||||
@ -517,10 +419,10 @@ async def run_test_nic(dut):
|
||||
|
||||
await tb.driver.interfaces[0].start_xmit(test_pkt2.build(), 0, 34, 6)
|
||||
|
||||
pkt = await tb.qsfp0_1_sink.recv()
|
||||
pkt = await tb.qsfp_sink[0][0].recv()
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
|
||||
await tb.qsfp0_1_source.send(pkt)
|
||||
await tb.qsfp_source[0][0].send(pkt)
|
||||
|
||||
pkt = await tb.driver.interfaces[0].recv()
|
||||
|
||||
|
@ -276,67 +276,44 @@ class TB(object):
|
||||
cocotb.start_soon(Clock(dut.ptp_sample_clk, 8, units="ns").start())
|
||||
|
||||
# Ethernet
|
||||
cocotb.start_soon(Clock(dut.qsfp0_rx_clk, 3.102, units="ns").start())
|
||||
cocotb.start_soon(Clock(dut.qsfp0_tx_clk, 3.102, units="ns").start())
|
||||
self.qsfp_mac = []
|
||||
|
||||
self.qsfp0_mac = EthMac(
|
||||
tx_clk=dut.qsfp0_tx_clk,
|
||||
tx_rst=dut.qsfp0_tx_rst,
|
||||
tx_bus=AxiStreamBus.from_prefix(dut, "qsfp0_tx_axis"),
|
||||
tx_ptp_time=dut.qsfp0_tx_ptp_time,
|
||||
tx_ptp_ts=dut.qsfp0_tx_ptp_ts,
|
||||
tx_ptp_ts_tag=dut.qsfp0_tx_ptp_ts_tag,
|
||||
tx_ptp_ts_valid=dut.qsfp0_tx_ptp_ts_valid,
|
||||
rx_clk=dut.qsfp0_rx_clk,
|
||||
rx_rst=dut.qsfp0_rx_rst,
|
||||
rx_bus=AxiStreamBus.from_prefix(dut, "qsfp0_rx_axis"),
|
||||
rx_ptp_time=dut.qsfp0_rx_ptp_time,
|
||||
ifg=12, speed=100e9
|
||||
)
|
||||
for k in range(2):
|
||||
cocotb.start_soon(Clock(getattr(dut, f"qsfp{k}_rx_clk"), 3.102, units="ns").start())
|
||||
cocotb.start_soon(Clock(getattr(dut, f"qsfp{k}_tx_clk"), 3.102, units="ns").start())
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp1_rx_clk, 3.102, units="ns").start())
|
||||
cocotb.start_soon(Clock(dut.qsfp1_tx_clk, 3.102, units="ns").start())
|
||||
mac = EthMac(
|
||||
tx_clk=getattr(dut, f"qsfp{k}_tx_clk"),
|
||||
tx_rst=getattr(dut, f"qsfp{k}_tx_rst"),
|
||||
tx_bus=AxiStreamBus.from_prefix(dut, f"qsfp{k}_tx_axis"),
|
||||
tx_ptp_time=getattr(dut, f"qsfp{k}_tx_ptp_time"),
|
||||
tx_ptp_ts=getattr(dut, f"qsfp{k}_tx_ptp_ts"),
|
||||
tx_ptp_ts_tag=getattr(dut, f"qsfp{k}_tx_ptp_ts_tag"),
|
||||
tx_ptp_ts_valid=getattr(dut, f"qsfp{k}_tx_ptp_ts_valid"),
|
||||
rx_clk=getattr(dut, f"qsfp{k}_rx_clk"),
|
||||
rx_rst=getattr(dut, f"qsfp{k}_rx_rst"),
|
||||
rx_bus=AxiStreamBus.from_prefix(dut, f"qsfp{k}_rx_axis"),
|
||||
rx_ptp_time=getattr(dut, f"qsfp{k}_rx_ptp_time"),
|
||||
ifg=12, speed=100e9
|
||||
)
|
||||
|
||||
self.qsfp1_mac = EthMac(
|
||||
tx_clk=dut.qsfp1_tx_clk,
|
||||
tx_rst=dut.qsfp1_tx_rst,
|
||||
tx_bus=AxiStreamBus.from_prefix(dut, "qsfp1_tx_axis"),
|
||||
tx_ptp_time=dut.qsfp1_tx_ptp_time,
|
||||
tx_ptp_ts=dut.qsfp1_tx_ptp_ts,
|
||||
tx_ptp_ts_tag=dut.qsfp1_tx_ptp_ts_tag,
|
||||
tx_ptp_ts_valid=dut.qsfp1_tx_ptp_ts_valid,
|
||||
rx_clk=dut.qsfp1_rx_clk,
|
||||
rx_rst=dut.qsfp1_rx_rst,
|
||||
rx_bus=AxiStreamBus.from_prefix(dut, "qsfp1_rx_axis"),
|
||||
rx_ptp_time=dut.qsfp1_rx_ptp_time,
|
||||
ifg=12, speed=100e9
|
||||
)
|
||||
self.qsfp_mac.append(mac)
|
||||
|
||||
dut.qsfp0_rx_status.setimmediatevalue(1)
|
||||
getattr(dut, f"qsfp{k}_rx_status").setimmediatevalue(1)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp0_drp_clk, 8, units="ns").start())
|
||||
dut.qsfp0_drp_rst.setimmediatevalue(0)
|
||||
dut.qsfp0_drp_do.setimmediatevalue(0)
|
||||
dut.qsfp0_drp_rdy.setimmediatevalue(0)
|
||||
cocotb.start_soon(Clock(getattr(dut, f"qsfp{k}_drp_clk"), 8, units="ns").start())
|
||||
getattr(dut, f"qsfp{k}_drp_rst").setimmediatevalue(0)
|
||||
getattr(dut, f"qsfp{k}_drp_do").setimmediatevalue(0)
|
||||
getattr(dut, f"qsfp{k}_drp_rdy").setimmediatevalue(0)
|
||||
|
||||
dut.qsfp1_rx_status.setimmediatevalue(1)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp1_drp_clk, 8, units="ns").start())
|
||||
dut.qsfp1_drp_rst.setimmediatevalue(0)
|
||||
dut.qsfp1_drp_do.setimmediatevalue(0)
|
||||
dut.qsfp1_drp_rdy.setimmediatevalue(0)
|
||||
getattr(dut, f"qsfp{k}_modprsl").setimmediatevalue(0)
|
||||
getattr(dut, f"qsfp{k}_intl").setimmediatevalue(0)
|
||||
|
||||
dut.sw.setimmediatevalue(0)
|
||||
|
||||
dut.i2c_scl_i.setimmediatevalue(1)
|
||||
dut.i2c_sda_i.setimmediatevalue(1)
|
||||
|
||||
dut.qsfp0_modprsl.setimmediatevalue(0)
|
||||
dut.qsfp0_intl.setimmediatevalue(1)
|
||||
|
||||
dut.qsfp1_modprsl.setimmediatevalue(0)
|
||||
dut.qsfp1_intl.setimmediatevalue(1)
|
||||
|
||||
dut.qspi_dq_i.setimmediatevalue(0)
|
||||
|
||||
self.cms_ram = AxiLiteRam(AxiLiteBus.from_prefix(dut, "m_axil_cms"), dut.m_axil_cms_clk, dut.m_axil_cms_rst, size=256*1024)
|
||||
@ -347,19 +324,17 @@ class TB(object):
|
||||
async def init(self):
|
||||
|
||||
self.dut.ptp_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp0_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp0_tx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp1_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp1_tx_rst.setimmediatevalue(0)
|
||||
for k in range(2):
|
||||
getattr(self.dut, f"qsfp{k}_rx_rst").setimmediatevalue(0)
|
||||
getattr(self.dut, f"qsfp{k}_tx_rst").setimmediatevalue(0)
|
||||
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
|
||||
self.dut.ptp_rst.setimmediatevalue(1)
|
||||
self.dut.qsfp0_rx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfp0_tx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfp1_rx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfp1_tx_rst.setimmediatevalue(1)
|
||||
for k in range(2):
|
||||
getattr(self.dut, f"qsfp{k}_rx_rst").setimmediatevalue(1)
|
||||
getattr(self.dut, f"qsfp{k}_tx_rst").setimmediatevalue(1)
|
||||
|
||||
await FallingEdge(self.dut.rst_250mhz)
|
||||
await Timer(100, 'ns')
|
||||
@ -368,10 +343,9 @@ class TB(object):
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
|
||||
self.dut.ptp_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp0_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp0_tx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp1_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp1_tx_rst.setimmediatevalue(0)
|
||||
for k in range(2):
|
||||
getattr(self.dut, f"qsfp{k}_rx_rst").setimmediatevalue(0)
|
||||
getattr(self.dut, f"qsfp{k}_tx_rst").setimmediatevalue(0)
|
||||
|
||||
await self.rc.enumerate()
|
||||
|
||||
@ -380,10 +354,9 @@ class TB(object):
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
|
||||
if self.loopback_enable:
|
||||
if not self.qsfp0_mac.tx.empty():
|
||||
await self.qsfp0_mac.rx.send(await self.qsfp0_mac.tx.recv())
|
||||
if not self.qsfp1_mac.tx.empty():
|
||||
await self.qsfp1_mac.rx.send(await self.qsfp1_mac.tx.recv())
|
||||
for mac in self.qsfp_mac:
|
||||
if not mac.tx.empty():
|
||||
await mac.rx.send(await mac.tx.recv())
|
||||
|
||||
|
||||
@cocotb.test()
|
||||
@ -414,10 +387,10 @@ async def run_test_nic(dut):
|
||||
|
||||
await tb.driver.interfaces[0].start_xmit(data, 0)
|
||||
|
||||
pkt = await tb.qsfp0_mac.tx.recv()
|
||||
pkt = await tb.qsfp_mac[0].tx.recv()
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
|
||||
await tb.qsfp0_mac.rx.send(pkt)
|
||||
await tb.qsfp_mac[0].rx.send(pkt)
|
||||
|
||||
pkt = await tb.driver.interfaces[0].recv()
|
||||
|
||||
@ -426,10 +399,10 @@ async def run_test_nic(dut):
|
||||
|
||||
# await tb.driver.interfaces[1].start_xmit(data, 0)
|
||||
|
||||
# pkt = await tb.qsfp1_mac.tx.recv()
|
||||
# pkt = await tb.qsfp_mac[1].tx.recv()
|
||||
# tb.log.info("Packet: %s", pkt)
|
||||
|
||||
# await tb.qsfp1_mac.rx.send(pkt)
|
||||
# await tb.qsfp_mac[1].rx.send(pkt)
|
||||
|
||||
# pkt = await tb.driver.interfaces[1].recv()
|
||||
|
||||
@ -449,10 +422,10 @@ async def run_test_nic(dut):
|
||||
|
||||
await tb.driver.interfaces[0].start_xmit(test_pkt2.build(), 0, 34, 6)
|
||||
|
||||
pkt = await tb.qsfp0_mac.tx.recv()
|
||||
pkt = await tb.qsfp_mac[0].tx.recv()
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
|
||||
await tb.qsfp0_mac.rx.send(pkt)
|
||||
await tb.qsfp_mac[0].rx.send(pkt)
|
||||
|
||||
pkt = await tb.driver.interfaces[0].recv()
|
||||
|
||||
|
@ -276,87 +276,37 @@ class TB(object):
|
||||
cocotb.start_soon(Clock(dut.ptp_sample_clk, 8, units="ns").start())
|
||||
|
||||
# Ethernet
|
||||
cocotb.start_soon(Clock(dut.qsfp0_rx_clk_1, 2.56, units="ns").start())
|
||||
self.qsfp0_1_source = XgmiiSource(dut.qsfp0_rxd_1, dut.qsfp0_rxc_1, dut.qsfp0_rx_clk_1, dut.qsfp0_rx_rst_1)
|
||||
cocotb.start_soon(Clock(dut.qsfp0_tx_clk_1, 2.56, units="ns").start())
|
||||
self.qsfp0_1_sink = XgmiiSink(dut.qsfp0_txd_1, dut.qsfp0_txc_1, dut.qsfp0_tx_clk_1, dut.qsfp0_tx_rst_1)
|
||||
self.qsfp_source = []
|
||||
self.qsfp_sink = []
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp0_rx_clk_2, 2.56, units="ns").start())
|
||||
self.qsfp0_2_source = XgmiiSource(dut.qsfp0_rxd_2, dut.qsfp0_rxc_2, dut.qsfp0_rx_clk_2, dut.qsfp0_rx_rst_2)
|
||||
cocotb.start_soon(Clock(dut.qsfp0_tx_clk_2, 2.56, units="ns").start())
|
||||
self.qsfp0_2_sink = XgmiiSink(dut.qsfp0_txd_2, dut.qsfp0_txc_2, dut.qsfp0_tx_clk_2, dut.qsfp0_tx_rst_2)
|
||||
for x in range(2):
|
||||
sources = []
|
||||
sinks = []
|
||||
for y in range(1, 5):
|
||||
cocotb.start_soon(Clock(getattr(dut, f"qsfp{x}_rx_clk_{y}"), 2.56, units="ns").start())
|
||||
source = XgmiiSource(getattr(dut, f"qsfp{x}_rxd_{y}"), getattr(dut, f"qsfp{x}_rxc_{y}"), getattr(dut, f"qsfp{x}_rx_clk_{y}"), getattr(dut, f"qsfp{x}_rx_rst_{y}"))
|
||||
sources.append(source)
|
||||
cocotb.start_soon(Clock(getattr(dut, f"qsfp{x}_tx_clk_{y}"), 2.56, units="ns").start())
|
||||
sink = XgmiiSink(getattr(dut, f"qsfp{x}_txd_{y}"), getattr(dut, f"qsfp{x}_txc_{y}"), getattr(dut, f"qsfp{x}_tx_clk_{y}"), getattr(dut, f"qsfp{x}_tx_rst_{y}"))
|
||||
sinks.append(sink)
|
||||
getattr(dut, f"qsfp{x}_rx_status_{y}").setimmediatevalue(1)
|
||||
getattr(dut, f"qsfp{x}_rx_error_count_{y}").setimmediatevalue(0)
|
||||
self.qsfp_source.append(sources)
|
||||
self.qsfp_sink.append(sinks)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp0_rx_clk_3, 2.56, units="ns").start())
|
||||
self.qsfp0_3_source = XgmiiSource(dut.qsfp0_rxd_3, dut.qsfp0_rxc_3, dut.qsfp0_rx_clk_3, dut.qsfp0_rx_rst_3)
|
||||
cocotb.start_soon(Clock(dut.qsfp0_tx_clk_3, 2.56, units="ns").start())
|
||||
self.qsfp0_3_sink = XgmiiSink(dut.qsfp0_txd_3, dut.qsfp0_txc_3, dut.qsfp0_tx_clk_3, dut.qsfp0_tx_rst_3)
|
||||
cocotb.start_soon(Clock(getattr(dut, f"qsfp{x}_drp_clk"), 8, units="ns").start())
|
||||
getattr(dut, f"qsfp{x}_drp_rst").setimmediatevalue(0)
|
||||
getattr(dut, f"qsfp{x}_drp_do").setimmediatevalue(0)
|
||||
getattr(dut, f"qsfp{x}_drp_rdy").setimmediatevalue(0)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp0_rx_clk_4, 2.56, units="ns").start())
|
||||
self.qsfp0_4_source = XgmiiSource(dut.qsfp0_rxd_4, dut.qsfp0_rxc_4, dut.qsfp0_rx_clk_4, dut.qsfp0_rx_rst_4)
|
||||
cocotb.start_soon(Clock(dut.qsfp0_tx_clk_4, 2.56, units="ns").start())
|
||||
self.qsfp0_4_sink = XgmiiSink(dut.qsfp0_txd_4, dut.qsfp0_txc_4, dut.qsfp0_tx_clk_4, dut.qsfp0_tx_rst_4)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp1_rx_clk_1, 2.56, units="ns").start())
|
||||
self.qsfp1_1_source = XgmiiSource(dut.qsfp1_rxd_1, dut.qsfp1_rxc_1, dut.qsfp1_rx_clk_1, dut.qsfp1_rx_rst_1)
|
||||
cocotb.start_soon(Clock(dut.qsfp1_tx_clk_1, 2.56, units="ns").start())
|
||||
self.qsfp1_1_sink = XgmiiSink(dut.qsfp1_txd_1, dut.qsfp1_txc_1, dut.qsfp1_tx_clk_1, dut.qsfp1_tx_rst_1)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp1_rx_clk_2, 2.56, units="ns").start())
|
||||
self.qsfp1_2_source = XgmiiSource(dut.qsfp1_rxd_2, dut.qsfp1_rxc_2, dut.qsfp1_rx_clk_2, dut.qsfp1_rx_rst_2)
|
||||
cocotb.start_soon(Clock(dut.qsfp1_tx_clk_2, 2.56, units="ns").start())
|
||||
self.qsfp1_2_sink = XgmiiSink(dut.qsfp1_txd_2, dut.qsfp1_txc_2, dut.qsfp1_tx_clk_2, dut.qsfp1_tx_rst_2)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp1_rx_clk_3, 2.56, units="ns").start())
|
||||
self.qsfp1_3_source = XgmiiSource(dut.qsfp1_rxd_3, dut.qsfp1_rxc_3, dut.qsfp1_rx_clk_3, dut.qsfp1_rx_rst_3)
|
||||
cocotb.start_soon(Clock(dut.qsfp1_tx_clk_3, 2.56, units="ns").start())
|
||||
self.qsfp1_3_sink = XgmiiSink(dut.qsfp1_txd_3, dut.qsfp1_txc_3, dut.qsfp1_tx_clk_3, dut.qsfp1_tx_rst_3)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp1_rx_clk_4, 2.56, units="ns").start())
|
||||
self.qsfp1_4_source = XgmiiSource(dut.qsfp1_rxd_4, dut.qsfp1_rxc_4, dut.qsfp1_rx_clk_4, dut.qsfp1_rx_rst_4)
|
||||
cocotb.start_soon(Clock(dut.qsfp1_tx_clk_4, 2.56, units="ns").start())
|
||||
self.qsfp1_4_sink = XgmiiSink(dut.qsfp1_txd_4, dut.qsfp1_txc_4, dut.qsfp1_tx_clk_4, dut.qsfp1_tx_rst_4)
|
||||
|
||||
dut.qsfp0_rx_status_1.setimmediatevalue(1)
|
||||
dut.qsfp0_rx_status_2.setimmediatevalue(1)
|
||||
dut.qsfp0_rx_status_3.setimmediatevalue(1)
|
||||
dut.qsfp0_rx_status_4.setimmediatevalue(1)
|
||||
|
||||
dut.qsfp1_rx_status_1.setimmediatevalue(1)
|
||||
dut.qsfp1_rx_status_2.setimmediatevalue(1)
|
||||
dut.qsfp1_rx_status_3.setimmediatevalue(1)
|
||||
dut.qsfp1_rx_status_4.setimmediatevalue(1)
|
||||
getattr(dut, f"qsfp{x}_modprsl").setimmediatevalue(0)
|
||||
getattr(dut, f"qsfp{x}_intl").setimmediatevalue(1)
|
||||
|
||||
dut.sw.setimmediatevalue(0)
|
||||
|
||||
dut.i2c_scl_i.setimmediatevalue(1)
|
||||
dut.i2c_sda_i.setimmediatevalue(1)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp0_drp_clk, 8, units="ns").start())
|
||||
dut.qsfp0_drp_rst.setimmediatevalue(0)
|
||||
dut.qsfp0_drp_do.setimmediatevalue(0)
|
||||
dut.qsfp0_drp_rdy.setimmediatevalue(0)
|
||||
|
||||
dut.qsfp0_rx_error_count_1.setimmediatevalue(0)
|
||||
dut.qsfp0_rx_error_count_2.setimmediatevalue(0)
|
||||
dut.qsfp0_rx_error_count_3.setimmediatevalue(0)
|
||||
dut.qsfp0_rx_error_count_4.setimmediatevalue(0)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp1_drp_clk, 8, units="ns").start())
|
||||
dut.qsfp1_drp_rst.setimmediatevalue(0)
|
||||
dut.qsfp1_drp_do.setimmediatevalue(0)
|
||||
dut.qsfp1_drp_rdy.setimmediatevalue(0)
|
||||
|
||||
dut.qsfp1_rx_error_count_1.setimmediatevalue(0)
|
||||
dut.qsfp1_rx_error_count_2.setimmediatevalue(0)
|
||||
dut.qsfp1_rx_error_count_3.setimmediatevalue(0)
|
||||
dut.qsfp1_rx_error_count_4.setimmediatevalue(0)
|
||||
|
||||
dut.qsfp0_modprsl.setimmediatevalue(0)
|
||||
dut.qsfp0_intl.setimmediatevalue(1)
|
||||
|
||||
dut.qsfp1_modprsl.setimmediatevalue(0)
|
||||
dut.qsfp1_intl.setimmediatevalue(1)
|
||||
|
||||
dut.qspi_dq_i.setimmediatevalue(0)
|
||||
|
||||
self.cms_ram = AxiLiteRam(AxiLiteBus.from_prefix(dut, "m_axil_cms"), dut.m_axil_cms_clk, dut.m_axil_cms_rst, size=256*1024)
|
||||
@ -367,43 +317,19 @@ class TB(object):
|
||||
async def init(self):
|
||||
|
||||
self.dut.ptp_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp0_rx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp0_tx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp0_rx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp0_tx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp0_rx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp0_tx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp0_rx_rst_4.setimmediatevalue(0)
|
||||
self.dut.qsfp0_tx_rst_4.setimmediatevalue(0)
|
||||
self.dut.qsfp1_rx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp1_tx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp1_rx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp1_tx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp1_rx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp1_tx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp1_rx_rst_4.setimmediatevalue(0)
|
||||
self.dut.qsfp1_tx_rst_4.setimmediatevalue(0)
|
||||
for x in range(2):
|
||||
for y in range(1, 5):
|
||||
getattr(self.dut, f"qsfp{x}_rx_rst_{y}").setimmediatevalue(0)
|
||||
getattr(self.dut, f"qsfp{x}_tx_rst_{y}").setimmediatevalue(0)
|
||||
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
|
||||
self.dut.ptp_rst.setimmediatevalue(1)
|
||||
self.dut.qsfp0_rx_rst_1.setimmediatevalue(1)
|
||||
self.dut.qsfp0_tx_rst_1.setimmediatevalue(1)
|
||||
self.dut.qsfp0_rx_rst_2.setimmediatevalue(1)
|
||||
self.dut.qsfp0_tx_rst_2.setimmediatevalue(1)
|
||||
self.dut.qsfp0_rx_rst_3.setimmediatevalue(1)
|
||||
self.dut.qsfp0_tx_rst_3.setimmediatevalue(1)
|
||||
self.dut.qsfp0_rx_rst_4.setimmediatevalue(1)
|
||||
self.dut.qsfp0_tx_rst_4.setimmediatevalue(1)
|
||||
self.dut.qsfp1_rx_rst_1.setimmediatevalue(1)
|
||||
self.dut.qsfp1_tx_rst_1.setimmediatevalue(1)
|
||||
self.dut.qsfp1_rx_rst_2.setimmediatevalue(1)
|
||||
self.dut.qsfp1_tx_rst_2.setimmediatevalue(1)
|
||||
self.dut.qsfp1_rx_rst_3.setimmediatevalue(1)
|
||||
self.dut.qsfp1_tx_rst_3.setimmediatevalue(1)
|
||||
self.dut.qsfp1_rx_rst_4.setimmediatevalue(1)
|
||||
self.dut.qsfp1_tx_rst_4.setimmediatevalue(1)
|
||||
for x in range(2):
|
||||
for y in range(1, 5):
|
||||
getattr(self.dut, f"qsfp{x}_rx_rst_{y}").setimmediatevalue(1)
|
||||
getattr(self.dut, f"qsfp{x}_tx_rst_{y}").setimmediatevalue(1)
|
||||
|
||||
await FallingEdge(self.dut.rst_250mhz)
|
||||
await Timer(100, 'ns')
|
||||
@ -412,22 +338,10 @@ class TB(object):
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
|
||||
self.dut.ptp_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp0_rx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp0_tx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp0_rx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp0_tx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp0_rx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp0_tx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp0_rx_rst_4.setimmediatevalue(0)
|
||||
self.dut.qsfp0_tx_rst_4.setimmediatevalue(0)
|
||||
self.dut.qsfp1_rx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp1_tx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp1_rx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp1_tx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp1_rx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp1_tx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp1_rx_rst_4.setimmediatevalue(0)
|
||||
self.dut.qsfp1_tx_rst_4.setimmediatevalue(0)
|
||||
for x in range(2):
|
||||
for y in range(1, 5):
|
||||
getattr(self.dut, f"qsfp{x}_rx_rst_{y}").setimmediatevalue(0)
|
||||
getattr(self.dut, f"qsfp{x}_tx_rst_{y}").setimmediatevalue(0)
|
||||
|
||||
await self.rc.enumerate()
|
||||
|
||||
@ -436,22 +350,10 @@ class TB(object):
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
|
||||
if self.loopback_enable:
|
||||
if not self.qsfp0_1_sink.empty():
|
||||
await self.qsfp0_1_source.send(await self.qsfp0_1_sink.recv())
|
||||
if not self.qsfp0_2_sink.empty():
|
||||
await self.qsfp0_2_source.send(await self.qsfp0_2_sink.recv())
|
||||
if not self.qsfp0_3_sink.empty():
|
||||
await self.qsfp0_3_source.send(await self.qsfp0_3_sink.recv())
|
||||
if not self.qsfp0_4_sink.empty():
|
||||
await self.qsfp0_4_source.send(await self.qsfp0_4_sink.recv())
|
||||
if not self.qsfp1_1_sink.empty():
|
||||
await self.qsfp1_1_source.send(await self.qsfp1_1_sink.recv())
|
||||
if not self.qsfp1_2_sink.empty():
|
||||
await self.qsfp1_2_source.send(await self.qsfp1_2_sink.recv())
|
||||
if not self.qsfp1_3_sink.empty():
|
||||
await self.qsfp1_3_source.send(await self.qsfp1_3_sink.recv())
|
||||
if not self.qsfp1_4_sink.empty():
|
||||
await self.qsfp1_4_source.send(await self.qsfp1_4_sink.recv())
|
||||
for x in range(len(self.qsfp_sink)):
|
||||
for y in range(len(self.qsfp_sink[x])):
|
||||
if not self.qsfp_sink[x][y].empty():
|
||||
await self.qsfp_source[x][y].send(await self.qsfp_sink[x][y].recv())
|
||||
|
||||
|
||||
@cocotb.test()
|
||||
@ -482,10 +384,10 @@ async def run_test_nic(dut):
|
||||
|
||||
await tb.driver.interfaces[0].start_xmit(data, 0)
|
||||
|
||||
pkt = await tb.qsfp0_1_sink.recv()
|
||||
pkt = await tb.qsfp_sink[0][0].recv()
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
|
||||
await tb.qsfp0_1_source.send(pkt)
|
||||
await tb.qsfp_source[0][0].send(pkt)
|
||||
|
||||
pkt = await tb.driver.interfaces[0].recv()
|
||||
|
||||
@ -494,10 +396,10 @@ async def run_test_nic(dut):
|
||||
|
||||
# await tb.driver.interfaces[1].start_xmit(data, 0)
|
||||
|
||||
# pkt = await tb.qsfp1_1_sink.recv()
|
||||
# pkt = await tb.qsfp_sink[1][0].recv()
|
||||
# tb.log.info("Packet: %s", pkt)
|
||||
|
||||
# await tb.qsfp1_1_source.send(pkt)
|
||||
# await tb.qsfp_source[1][0].send(pkt)
|
||||
|
||||
# pkt = await tb.driver.interfaces[1].recv()
|
||||
|
||||
@ -517,10 +419,10 @@ async def run_test_nic(dut):
|
||||
|
||||
await tb.driver.interfaces[0].start_xmit(test_pkt2.build(), 0, 34, 6)
|
||||
|
||||
pkt = await tb.qsfp0_1_sink.recv()
|
||||
pkt = await tb.qsfp_sink[0][0].recv()
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
|
||||
await tb.qsfp0_1_source.send(pkt)
|
||||
await tb.qsfp_source[0][0].send(pkt)
|
||||
|
||||
pkt = await tb.driver.interfaces[0].recv()
|
||||
|
||||
|
@ -276,55 +276,35 @@ class TB(object):
|
||||
cocotb.start_soon(Clock(dut.ptp_sample_clk, 8, units="ns").start())
|
||||
|
||||
# Ethernet
|
||||
cocotb.start_soon(Clock(dut.qsfp0_rx_clk, 3.102, units="ns").start())
|
||||
cocotb.start_soon(Clock(dut.qsfp0_tx_clk, 3.102, units="ns").start())
|
||||
self.qsfp_mac = []
|
||||
|
||||
self.qsfp0_mac = EthMac(
|
||||
tx_clk=dut.qsfp0_tx_clk,
|
||||
tx_rst=dut.qsfp0_tx_rst,
|
||||
tx_bus=AxiStreamBus.from_prefix(dut, "qsfp0_tx_axis"),
|
||||
tx_ptp_time=dut.qsfp0_tx_ptp_time,
|
||||
tx_ptp_ts=dut.qsfp0_tx_ptp_ts,
|
||||
tx_ptp_ts_tag=dut.qsfp0_tx_ptp_ts_tag,
|
||||
tx_ptp_ts_valid=dut.qsfp0_tx_ptp_ts_valid,
|
||||
rx_clk=dut.qsfp0_rx_clk,
|
||||
rx_rst=dut.qsfp0_rx_rst,
|
||||
rx_bus=AxiStreamBus.from_prefix(dut, "qsfp0_rx_axis"),
|
||||
rx_ptp_time=dut.qsfp0_rx_ptp_time,
|
||||
ifg=12, speed=100e9
|
||||
)
|
||||
for k in range(2):
|
||||
cocotb.start_soon(Clock(getattr(dut, f"qsfp{k}_rx_clk"), 3.102, units="ns").start())
|
||||
cocotb.start_soon(Clock(getattr(dut, f"qsfp{k}_tx_clk"), 3.102, units="ns").start())
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp1_rx_clk, 3.102, units="ns").start())
|
||||
cocotb.start_soon(Clock(dut.qsfp1_tx_clk, 3.102, units="ns").start())
|
||||
mac = EthMac(
|
||||
tx_clk=getattr(dut, f"qsfp{k}_tx_clk"),
|
||||
tx_rst=getattr(dut, f"qsfp{k}_tx_rst"),
|
||||
tx_bus=AxiStreamBus.from_prefix(dut, f"qsfp{k}_tx_axis"),
|
||||
tx_ptp_time=getattr(dut, f"qsfp{k}_tx_ptp_time"),
|
||||
tx_ptp_ts=getattr(dut, f"qsfp{k}_tx_ptp_ts"),
|
||||
tx_ptp_ts_tag=getattr(dut, f"qsfp{k}_tx_ptp_ts_tag"),
|
||||
tx_ptp_ts_valid=getattr(dut, f"qsfp{k}_tx_ptp_ts_valid"),
|
||||
rx_clk=getattr(dut, f"qsfp{k}_rx_clk"),
|
||||
rx_rst=getattr(dut, f"qsfp{k}_rx_rst"),
|
||||
rx_bus=AxiStreamBus.from_prefix(dut, f"qsfp{k}_rx_axis"),
|
||||
rx_ptp_time=getattr(dut, f"qsfp{k}_rx_ptp_time"),
|
||||
ifg=12, speed=100e9
|
||||
)
|
||||
|
||||
self.qsfp1_mac = EthMac(
|
||||
tx_clk=dut.qsfp1_tx_clk,
|
||||
tx_rst=dut.qsfp1_tx_rst,
|
||||
tx_bus=AxiStreamBus.from_prefix(dut, "qsfp1_tx_axis"),
|
||||
tx_ptp_time=dut.qsfp1_tx_ptp_time,
|
||||
tx_ptp_ts=dut.qsfp1_tx_ptp_ts,
|
||||
tx_ptp_ts_tag=dut.qsfp1_tx_ptp_ts_tag,
|
||||
tx_ptp_ts_valid=dut.qsfp1_tx_ptp_ts_valid,
|
||||
rx_clk=dut.qsfp1_rx_clk,
|
||||
rx_rst=dut.qsfp1_rx_rst,
|
||||
rx_bus=AxiStreamBus.from_prefix(dut, "qsfp1_rx_axis"),
|
||||
rx_ptp_time=dut.qsfp1_rx_ptp_time,
|
||||
ifg=12, speed=100e9
|
||||
)
|
||||
self.qsfp_mac.append(mac)
|
||||
|
||||
dut.qsfp0_rx_status.setimmediatevalue(1)
|
||||
getattr(dut, f"qsfp{k}_rx_status").setimmediatevalue(1)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp0_drp_clk, 8, units="ns").start())
|
||||
dut.qsfp0_drp_rst.setimmediatevalue(0)
|
||||
dut.qsfp0_drp_do.setimmediatevalue(0)
|
||||
dut.qsfp0_drp_rdy.setimmediatevalue(0)
|
||||
|
||||
dut.qsfp1_rx_status.setimmediatevalue(1)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp1_drp_clk, 8, units="ns").start())
|
||||
dut.qsfp1_drp_rst.setimmediatevalue(0)
|
||||
dut.qsfp1_drp_do.setimmediatevalue(0)
|
||||
dut.qsfp1_drp_rdy.setimmediatevalue(0)
|
||||
cocotb.start_soon(Clock(getattr(dut, f"qsfp{k}_drp_clk"), 8, units="ns").start())
|
||||
getattr(dut, f"qsfp{k}_drp_rst").setimmediatevalue(0)
|
||||
getattr(dut, f"qsfp{k}_drp_do").setimmediatevalue(0)
|
||||
getattr(dut, f"qsfp{k}_drp_rdy").setimmediatevalue(0)
|
||||
|
||||
dut.qspi_dq_i.setimmediatevalue(0)
|
||||
|
||||
@ -336,19 +316,17 @@ class TB(object):
|
||||
async def init(self):
|
||||
|
||||
self.dut.ptp_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp0_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp0_tx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp1_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp1_tx_rst.setimmediatevalue(0)
|
||||
for k in range(2):
|
||||
getattr(self.dut, f"qsfp{k}_rx_rst").setimmediatevalue(0)
|
||||
getattr(self.dut, f"qsfp{k}_tx_rst").setimmediatevalue(0)
|
||||
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
|
||||
self.dut.ptp_rst.setimmediatevalue(1)
|
||||
self.dut.qsfp0_rx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfp0_tx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfp1_rx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfp1_tx_rst.setimmediatevalue(1)
|
||||
for k in range(2):
|
||||
getattr(self.dut, f"qsfp{k}_rx_rst").setimmediatevalue(1)
|
||||
getattr(self.dut, f"qsfp{k}_tx_rst").setimmediatevalue(1)
|
||||
|
||||
await FallingEdge(self.dut.rst_250mhz)
|
||||
await Timer(100, 'ns')
|
||||
@ -357,10 +335,9 @@ class TB(object):
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
|
||||
self.dut.ptp_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp0_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp0_tx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp1_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp1_tx_rst.setimmediatevalue(0)
|
||||
for k in range(2):
|
||||
getattr(self.dut, f"qsfp{k}_rx_rst").setimmediatevalue(0)
|
||||
getattr(self.dut, f"qsfp{k}_tx_rst").setimmediatevalue(0)
|
||||
|
||||
await self.rc.enumerate()
|
||||
|
||||
@ -369,10 +346,9 @@ class TB(object):
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
|
||||
if self.loopback_enable:
|
||||
if not self.qsfp0_mac.tx.empty():
|
||||
await self.qsfp0_mac.rx.send(await self.qsfp0_mac.tx.recv())
|
||||
if not self.qsfp1_mac.tx.empty():
|
||||
await self.qsfp1_mac.rx.send(await self.qsfp1_mac.tx.recv())
|
||||
for mac in self.qsfp_mac:
|
||||
if not mac.tx.empty():
|
||||
await mac.rx.send(await mac.tx.recv())
|
||||
|
||||
|
||||
@cocotb.test()
|
||||
@ -403,10 +379,10 @@ async def run_test_nic(dut):
|
||||
|
||||
await tb.driver.interfaces[0].start_xmit(data, 0)
|
||||
|
||||
pkt = await tb.qsfp0_mac.tx.recv()
|
||||
pkt = await tb.qsfp_mac[0].tx.recv()
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
|
||||
await tb.qsfp0_mac.rx.send(pkt)
|
||||
await tb.qsfp_mac[0].rx.send(pkt)
|
||||
|
||||
pkt = await tb.driver.interfaces[0].recv()
|
||||
|
||||
@ -415,10 +391,10 @@ async def run_test_nic(dut):
|
||||
|
||||
# await tb.driver.interfaces[1].start_xmit(data, 0)
|
||||
|
||||
# pkt = await tb.qsfp1_mac.tx.recv()
|
||||
# pkt = await tb.qsfp_mac[1].tx.recv()
|
||||
# tb.log.info("Packet: %s", pkt)
|
||||
|
||||
# await tb.qsfp1_mac.rx.send(pkt)
|
||||
# await tb.qsfp_mac[1].rx.send(pkt)
|
||||
|
||||
# pkt = await tb.driver.interfaces[1].recv()
|
||||
|
||||
@ -438,10 +414,10 @@ async def run_test_nic(dut):
|
||||
|
||||
await tb.driver.interfaces[0].start_xmit(test_pkt2.build(), 0, 34, 6)
|
||||
|
||||
pkt = await tb.qsfp0_mac.tx.recv()
|
||||
pkt = await tb.qsfp_mac[0].tx.recv()
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
|
||||
await tb.qsfp0_mac.rx.send(pkt)
|
||||
await tb.qsfp_mac[0].rx.send(pkt)
|
||||
|
||||
pkt = await tb.driver.interfaces[0].recv()
|
||||
|
||||
|
@ -276,75 +276,28 @@ class TB(object):
|
||||
cocotb.start_soon(Clock(dut.ptp_sample_clk, 8, units="ns").start())
|
||||
|
||||
# Ethernet
|
||||
cocotb.start_soon(Clock(dut.qsfp0_rx_clk_1, 2.56, units="ns").start())
|
||||
self.qsfp0_1_source = XgmiiSource(dut.qsfp0_rxd_1, dut.qsfp0_rxc_1, dut.qsfp0_rx_clk_1, dut.qsfp0_rx_rst_1)
|
||||
cocotb.start_soon(Clock(dut.qsfp0_tx_clk_1, 2.56, units="ns").start())
|
||||
self.qsfp0_1_sink = XgmiiSink(dut.qsfp0_txd_1, dut.qsfp0_txc_1, dut.qsfp0_tx_clk_1, dut.qsfp0_tx_rst_1)
|
||||
self.qsfp_source = []
|
||||
self.qsfp_sink = []
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp0_rx_clk_2, 2.56, units="ns").start())
|
||||
self.qsfp0_2_source = XgmiiSource(dut.qsfp0_rxd_2, dut.qsfp0_rxc_2, dut.qsfp0_rx_clk_2, dut.qsfp0_rx_rst_2)
|
||||
cocotb.start_soon(Clock(dut.qsfp0_tx_clk_2, 2.56, units="ns").start())
|
||||
self.qsfp0_2_sink = XgmiiSink(dut.qsfp0_txd_2, dut.qsfp0_txc_2, dut.qsfp0_tx_clk_2, dut.qsfp0_tx_rst_2)
|
||||
for x in range(2):
|
||||
sources = []
|
||||
sinks = []
|
||||
for y in range(1, 5):
|
||||
cocotb.start_soon(Clock(getattr(dut, f"qsfp{x}_rx_clk_{y}"), 2.56, units="ns").start())
|
||||
source = XgmiiSource(getattr(dut, f"qsfp{x}_rxd_{y}"), getattr(dut, f"qsfp{x}_rxc_{y}"), getattr(dut, f"qsfp{x}_rx_clk_{y}"), getattr(dut, f"qsfp{x}_rx_rst_{y}"))
|
||||
sources.append(source)
|
||||
cocotb.start_soon(Clock(getattr(dut, f"qsfp{x}_tx_clk_{y}"), 2.56, units="ns").start())
|
||||
sink = XgmiiSink(getattr(dut, f"qsfp{x}_txd_{y}"), getattr(dut, f"qsfp{x}_txc_{y}"), getattr(dut, f"qsfp{x}_tx_clk_{y}"), getattr(dut, f"qsfp{x}_tx_rst_{y}"))
|
||||
sinks.append(sink)
|
||||
getattr(dut, f"qsfp{x}_rx_status_{y}").setimmediatevalue(1)
|
||||
getattr(dut, f"qsfp{x}_rx_error_count_{y}").setimmediatevalue(0)
|
||||
self.qsfp_source.append(sources)
|
||||
self.qsfp_sink.append(sinks)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp0_rx_clk_3, 2.56, units="ns").start())
|
||||
self.qsfp0_3_source = XgmiiSource(dut.qsfp0_rxd_3, dut.qsfp0_rxc_3, dut.qsfp0_rx_clk_3, dut.qsfp0_rx_rst_3)
|
||||
cocotb.start_soon(Clock(dut.qsfp0_tx_clk_3, 2.56, units="ns").start())
|
||||
self.qsfp0_3_sink = XgmiiSink(dut.qsfp0_txd_3, dut.qsfp0_txc_3, dut.qsfp0_tx_clk_3, dut.qsfp0_tx_rst_3)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp0_rx_clk_4, 2.56, units="ns").start())
|
||||
self.qsfp0_4_source = XgmiiSource(dut.qsfp0_rxd_4, dut.qsfp0_rxc_4, dut.qsfp0_rx_clk_4, dut.qsfp0_rx_rst_4)
|
||||
cocotb.start_soon(Clock(dut.qsfp0_tx_clk_4, 2.56, units="ns").start())
|
||||
self.qsfp0_4_sink = XgmiiSink(dut.qsfp0_txd_4, dut.qsfp0_txc_4, dut.qsfp0_tx_clk_4, dut.qsfp0_tx_rst_4)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp1_rx_clk_1, 2.56, units="ns").start())
|
||||
self.qsfp1_1_source = XgmiiSource(dut.qsfp1_rxd_1, dut.qsfp1_rxc_1, dut.qsfp1_rx_clk_1, dut.qsfp1_rx_rst_1)
|
||||
cocotb.start_soon(Clock(dut.qsfp1_tx_clk_1, 2.56, units="ns").start())
|
||||
self.qsfp1_1_sink = XgmiiSink(dut.qsfp1_txd_1, dut.qsfp1_txc_1, dut.qsfp1_tx_clk_1, dut.qsfp1_tx_rst_1)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp1_rx_clk_2, 2.56, units="ns").start())
|
||||
self.qsfp1_2_source = XgmiiSource(dut.qsfp1_rxd_2, dut.qsfp1_rxc_2, dut.qsfp1_rx_clk_2, dut.qsfp1_rx_rst_2)
|
||||
cocotb.start_soon(Clock(dut.qsfp1_tx_clk_2, 2.56, units="ns").start())
|
||||
self.qsfp1_2_sink = XgmiiSink(dut.qsfp1_txd_2, dut.qsfp1_txc_2, dut.qsfp1_tx_clk_2, dut.qsfp1_tx_rst_2)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp1_rx_clk_3, 2.56, units="ns").start())
|
||||
self.qsfp1_3_source = XgmiiSource(dut.qsfp1_rxd_3, dut.qsfp1_rxc_3, dut.qsfp1_rx_clk_3, dut.qsfp1_rx_rst_3)
|
||||
cocotb.start_soon(Clock(dut.qsfp1_tx_clk_3, 2.56, units="ns").start())
|
||||
self.qsfp1_3_sink = XgmiiSink(dut.qsfp1_txd_3, dut.qsfp1_txc_3, dut.qsfp1_tx_clk_3, dut.qsfp1_tx_rst_3)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp1_rx_clk_4, 2.56, units="ns").start())
|
||||
self.qsfp1_4_source = XgmiiSource(dut.qsfp1_rxd_4, dut.qsfp1_rxc_4, dut.qsfp1_rx_clk_4, dut.qsfp1_rx_rst_4)
|
||||
cocotb.start_soon(Clock(dut.qsfp1_tx_clk_4, 2.56, units="ns").start())
|
||||
self.qsfp1_4_sink = XgmiiSink(dut.qsfp1_txd_4, dut.qsfp1_txc_4, dut.qsfp1_tx_clk_4, dut.qsfp1_tx_rst_4)
|
||||
|
||||
dut.qsfp0_rx_status_1.setimmediatevalue(1)
|
||||
dut.qsfp0_rx_status_2.setimmediatevalue(1)
|
||||
dut.qsfp0_rx_status_3.setimmediatevalue(1)
|
||||
dut.qsfp0_rx_status_4.setimmediatevalue(1)
|
||||
|
||||
dut.qsfp1_rx_status_1.setimmediatevalue(1)
|
||||
dut.qsfp1_rx_status_2.setimmediatevalue(1)
|
||||
dut.qsfp1_rx_status_3.setimmediatevalue(1)
|
||||
dut.qsfp1_rx_status_4.setimmediatevalue(1)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp0_drp_clk, 8, units="ns").start())
|
||||
dut.qsfp0_drp_rst.setimmediatevalue(0)
|
||||
dut.qsfp0_drp_do.setimmediatevalue(0)
|
||||
dut.qsfp0_drp_rdy.setimmediatevalue(0)
|
||||
|
||||
dut.qsfp0_rx_error_count_1.setimmediatevalue(0)
|
||||
dut.qsfp0_rx_error_count_2.setimmediatevalue(0)
|
||||
dut.qsfp0_rx_error_count_3.setimmediatevalue(0)
|
||||
dut.qsfp0_rx_error_count_4.setimmediatevalue(0)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp1_drp_clk, 8, units="ns").start())
|
||||
dut.qsfp1_drp_rst.setimmediatevalue(0)
|
||||
dut.qsfp1_drp_do.setimmediatevalue(0)
|
||||
dut.qsfp1_drp_rdy.setimmediatevalue(0)
|
||||
|
||||
dut.qsfp1_rx_error_count_1.setimmediatevalue(0)
|
||||
dut.qsfp1_rx_error_count_2.setimmediatevalue(0)
|
||||
dut.qsfp1_rx_error_count_3.setimmediatevalue(0)
|
||||
dut.qsfp1_rx_error_count_4.setimmediatevalue(0)
|
||||
cocotb.start_soon(Clock(getattr(dut, f"qsfp{x}_drp_clk"), 8, units="ns").start())
|
||||
getattr(dut, f"qsfp{x}_drp_rst").setimmediatevalue(0)
|
||||
getattr(dut, f"qsfp{x}_drp_do").setimmediatevalue(0)
|
||||
getattr(dut, f"qsfp{x}_drp_rdy").setimmediatevalue(0)
|
||||
|
||||
dut.qspi_dq_i.setimmediatevalue(0)
|
||||
|
||||
@ -356,43 +309,19 @@ class TB(object):
|
||||
async def init(self):
|
||||
|
||||
self.dut.ptp_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp0_rx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp0_tx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp0_rx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp0_tx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp0_rx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp0_tx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp0_rx_rst_4.setimmediatevalue(0)
|
||||
self.dut.qsfp0_tx_rst_4.setimmediatevalue(0)
|
||||
self.dut.qsfp1_rx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp1_tx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp1_rx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp1_tx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp1_rx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp1_tx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp1_rx_rst_4.setimmediatevalue(0)
|
||||
self.dut.qsfp1_tx_rst_4.setimmediatevalue(0)
|
||||
for x in range(2):
|
||||
for y in range(1, 5):
|
||||
getattr(self.dut, f"qsfp{x}_rx_rst_{y}").setimmediatevalue(0)
|
||||
getattr(self.dut, f"qsfp{x}_tx_rst_{y}").setimmediatevalue(0)
|
||||
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
|
||||
self.dut.ptp_rst.setimmediatevalue(1)
|
||||
self.dut.qsfp0_rx_rst_1.setimmediatevalue(1)
|
||||
self.dut.qsfp0_tx_rst_1.setimmediatevalue(1)
|
||||
self.dut.qsfp0_rx_rst_2.setimmediatevalue(1)
|
||||
self.dut.qsfp0_tx_rst_2.setimmediatevalue(1)
|
||||
self.dut.qsfp0_rx_rst_3.setimmediatevalue(1)
|
||||
self.dut.qsfp0_tx_rst_3.setimmediatevalue(1)
|
||||
self.dut.qsfp0_rx_rst_4.setimmediatevalue(1)
|
||||
self.dut.qsfp0_tx_rst_4.setimmediatevalue(1)
|
||||
self.dut.qsfp1_rx_rst_1.setimmediatevalue(1)
|
||||
self.dut.qsfp1_tx_rst_1.setimmediatevalue(1)
|
||||
self.dut.qsfp1_rx_rst_2.setimmediatevalue(1)
|
||||
self.dut.qsfp1_tx_rst_2.setimmediatevalue(1)
|
||||
self.dut.qsfp1_rx_rst_3.setimmediatevalue(1)
|
||||
self.dut.qsfp1_tx_rst_3.setimmediatevalue(1)
|
||||
self.dut.qsfp1_rx_rst_4.setimmediatevalue(1)
|
||||
self.dut.qsfp1_tx_rst_4.setimmediatevalue(1)
|
||||
for x in range(2):
|
||||
for y in range(1, 5):
|
||||
getattr(self.dut, f"qsfp{x}_rx_rst_{y}").setimmediatevalue(1)
|
||||
getattr(self.dut, f"qsfp{x}_tx_rst_{y}").setimmediatevalue(1)
|
||||
|
||||
await FallingEdge(self.dut.rst_250mhz)
|
||||
await Timer(100, 'ns')
|
||||
@ -401,22 +330,10 @@ class TB(object):
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
|
||||
self.dut.ptp_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp0_rx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp0_tx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp0_rx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp0_tx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp0_rx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp0_tx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp0_rx_rst_4.setimmediatevalue(0)
|
||||
self.dut.qsfp0_tx_rst_4.setimmediatevalue(0)
|
||||
self.dut.qsfp1_rx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp1_tx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp1_rx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp1_tx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp1_rx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp1_tx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp1_rx_rst_4.setimmediatevalue(0)
|
||||
self.dut.qsfp1_tx_rst_4.setimmediatevalue(0)
|
||||
for x in range(2):
|
||||
for y in range(1, 5):
|
||||
getattr(self.dut, f"qsfp{x}_rx_rst_{y}").setimmediatevalue(0)
|
||||
getattr(self.dut, f"qsfp{x}_tx_rst_{y}").setimmediatevalue(0)
|
||||
|
||||
await self.rc.enumerate()
|
||||
|
||||
@ -425,22 +342,10 @@ class TB(object):
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
|
||||
if self.loopback_enable:
|
||||
if not self.qsfp0_1_sink.empty():
|
||||
await self.qsfp0_1_source.send(await self.qsfp0_1_sink.recv())
|
||||
if not self.qsfp0_2_sink.empty():
|
||||
await self.qsfp0_2_source.send(await self.qsfp0_2_sink.recv())
|
||||
if not self.qsfp0_3_sink.empty():
|
||||
await self.qsfp0_3_source.send(await self.qsfp0_3_sink.recv())
|
||||
if not self.qsfp0_4_sink.empty():
|
||||
await self.qsfp0_4_source.send(await self.qsfp0_4_sink.recv())
|
||||
if not self.qsfp1_1_sink.empty():
|
||||
await self.qsfp1_1_source.send(await self.qsfp1_1_sink.recv())
|
||||
if not self.qsfp1_2_sink.empty():
|
||||
await self.qsfp1_2_source.send(await self.qsfp1_2_sink.recv())
|
||||
if not self.qsfp1_3_sink.empty():
|
||||
await self.qsfp1_3_source.send(await self.qsfp1_3_sink.recv())
|
||||
if not self.qsfp1_4_sink.empty():
|
||||
await self.qsfp1_4_source.send(await self.qsfp1_4_sink.recv())
|
||||
for x in range(len(self.qsfp_sink)):
|
||||
for y in range(len(self.qsfp_sink[x])):
|
||||
if not self.qsfp_sink[x][y].empty():
|
||||
await self.qsfp_source[x][y].send(await self.qsfp_sink[x][y].recv())
|
||||
|
||||
|
||||
@cocotb.test()
|
||||
@ -471,10 +376,10 @@ async def run_test_nic(dut):
|
||||
|
||||
await tb.driver.interfaces[0].start_xmit(data, 0)
|
||||
|
||||
pkt = await tb.qsfp0_1_sink.recv()
|
||||
pkt = await tb.qsfp_sink[0][0].recv()
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
|
||||
await tb.qsfp0_1_source.send(pkt)
|
||||
await tb.qsfp_source[0][0].send(pkt)
|
||||
|
||||
pkt = await tb.driver.interfaces[0].recv()
|
||||
|
||||
@ -483,10 +388,10 @@ async def run_test_nic(dut):
|
||||
|
||||
# await tb.driver.interfaces[1].start_xmit(data, 0)
|
||||
|
||||
# pkt = await tb.qsfp1_1_sink.recv()
|
||||
# pkt = await tb.qsfp_sink[1][0].recv()
|
||||
# tb.log.info("Packet: %s", pkt)
|
||||
|
||||
# await tb.qsfp1_1_source.send(pkt)
|
||||
# await tb.qsfp_source[1][0].send(pkt)
|
||||
|
||||
# pkt = await tb.driver.interfaces[1].recv()
|
||||
|
||||
@ -506,10 +411,10 @@ async def run_test_nic(dut):
|
||||
|
||||
await tb.driver.interfaces[0].start_xmit(test_pkt2.build(), 0, 34, 6)
|
||||
|
||||
pkt = await tb.qsfp0_1_sink.recv()
|
||||
pkt = await tb.qsfp_sink[0][0].recv()
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
|
||||
await tb.qsfp0_1_source.send(pkt)
|
||||
await tb.qsfp_source[0][0].send(pkt)
|
||||
|
||||
pkt = await tb.driver.interfaces[0].recv()
|
||||
|
||||
|
@ -276,41 +276,24 @@ class TB(object):
|
||||
cocotb.start_soon(Clock(dut.ptp_sample_clk, 8, units="ns").start())
|
||||
|
||||
# Ethernet
|
||||
cocotb.start_soon(Clock(dut.qsfp_rx_clk_1, 2.56, units="ns").start())
|
||||
self.qsfp_1_source = XgmiiSource(dut.qsfp_rxd_1, dut.qsfp_rxc_1, dut.qsfp_rx_clk_1, dut.qsfp_rx_rst_1)
|
||||
cocotb.start_soon(Clock(dut.qsfp_tx_clk_1, 2.56, units="ns").start())
|
||||
self.qsfp_1_sink = XgmiiSink(dut.qsfp_txd_1, dut.qsfp_txc_1, dut.qsfp_tx_clk_1, dut.qsfp_tx_rst_1)
|
||||
self.qsfp_source = []
|
||||
self.qsfp_sink = []
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp_rx_clk_2, 2.56, units="ns").start())
|
||||
self.qsfp_2_source = XgmiiSource(dut.qsfp_rxd_2, dut.qsfp_rxc_2, dut.qsfp_rx_clk_2, dut.qsfp_rx_rst_2)
|
||||
cocotb.start_soon(Clock(dut.qsfp_tx_clk_2, 2.56, units="ns").start())
|
||||
self.qsfp_2_sink = XgmiiSink(dut.qsfp_txd_2, dut.qsfp_txc_2, dut.qsfp_tx_clk_2, dut.qsfp_tx_rst_2)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp_rx_clk_3, 2.56, units="ns").start())
|
||||
self.qsfp_3_source = XgmiiSource(dut.qsfp_rxd_3, dut.qsfp_rxc_3, dut.qsfp_rx_clk_3, dut.qsfp_rx_rst_3)
|
||||
cocotb.start_soon(Clock(dut.qsfp_tx_clk_3, 2.56, units="ns").start())
|
||||
self.qsfp_3_sink = XgmiiSink(dut.qsfp_txd_3, dut.qsfp_txc_3, dut.qsfp_tx_clk_3, dut.qsfp_tx_rst_3)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp_rx_clk_4, 2.56, units="ns").start())
|
||||
self.qsfp_4_source = XgmiiSource(dut.qsfp_rxd_4, dut.qsfp_rxc_4, dut.qsfp_rx_clk_4, dut.qsfp_rx_rst_4)
|
||||
cocotb.start_soon(Clock(dut.qsfp_tx_clk_4, 2.56, units="ns").start())
|
||||
self.qsfp_4_sink = XgmiiSink(dut.qsfp_txd_4, dut.qsfp_txc_4, dut.qsfp_tx_clk_4, dut.qsfp_tx_rst_4)
|
||||
|
||||
dut.qsfp_rx_status_1.setimmediatevalue(1)
|
||||
dut.qsfp_rx_status_2.setimmediatevalue(1)
|
||||
dut.qsfp_rx_status_3.setimmediatevalue(1)
|
||||
dut.qsfp_rx_status_4.setimmediatevalue(1)
|
||||
for y in range(1, 5):
|
||||
cocotb.start_soon(Clock(getattr(dut, f"qsfp_rx_clk_{y}"), 2.56, units="ns").start())
|
||||
source = XgmiiSource(getattr(dut, f"qsfp_rxd_{y}"), getattr(dut, f"qsfp_rxc_{y}"), getattr(dut, f"qsfp_rx_clk_{y}"), getattr(dut, f"qsfp_rx_rst_{y}"))
|
||||
self.qsfp_source.append(source)
|
||||
cocotb.start_soon(Clock(getattr(dut, f"qsfp_tx_clk_{y}"), 2.56, units="ns").start())
|
||||
sink = XgmiiSink(getattr(dut, f"qsfp_txd_{y}"), getattr(dut, f"qsfp_txc_{y}"), getattr(dut, f"qsfp_tx_clk_{y}"), getattr(dut, f"qsfp_tx_rst_{y}"))
|
||||
self.qsfp_sink.append(sink)
|
||||
getattr(dut, f"qsfp_rx_status_{y}").setimmediatevalue(1)
|
||||
getattr(dut, f"qsfp_rx_error_count_{y}").setimmediatevalue(0)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp_drp_clk, 8, units="ns").start())
|
||||
dut.qsfp_drp_rst.setimmediatevalue(0)
|
||||
dut.qsfp_drp_do.setimmediatevalue(0)
|
||||
dut.qsfp_drp_rdy.setimmediatevalue(0)
|
||||
|
||||
dut.qsfp_rx_error_count_1.setimmediatevalue(0)
|
||||
dut.qsfp_rx_error_count_2.setimmediatevalue(0)
|
||||
dut.qsfp_rx_error_count_3.setimmediatevalue(0)
|
||||
dut.qsfp_rx_error_count_4.setimmediatevalue(0)
|
||||
|
||||
dut.qspi_dq_i.setimmediatevalue(0)
|
||||
|
||||
self.cms_ram = AxiLiteRam(AxiLiteBus.from_prefix(dut, "m_axil_cms"), dut.m_axil_cms_clk, dut.m_axil_cms_rst, size=256*1024)
|
||||
@ -321,27 +304,17 @@ class TB(object):
|
||||
async def init(self):
|
||||
|
||||
self.dut.ptp_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp_rx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp_tx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp_rx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp_tx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp_rx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp_tx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp_rx_rst_4.setimmediatevalue(0)
|
||||
self.dut.qsfp_tx_rst_4.setimmediatevalue(0)
|
||||
for y in range(1, 5):
|
||||
getattr(self.dut, f"qsfp_rx_rst_{y}").setimmediatevalue(0)
|
||||
getattr(self.dut, f"qsfp_tx_rst_{y}").setimmediatevalue(0)
|
||||
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
|
||||
self.dut.ptp_rst.setimmediatevalue(1)
|
||||
self.dut.qsfp_rx_rst_1.setimmediatevalue(1)
|
||||
self.dut.qsfp_tx_rst_1.setimmediatevalue(1)
|
||||
self.dut.qsfp_rx_rst_2.setimmediatevalue(1)
|
||||
self.dut.qsfp_tx_rst_2.setimmediatevalue(1)
|
||||
self.dut.qsfp_rx_rst_3.setimmediatevalue(1)
|
||||
self.dut.qsfp_tx_rst_3.setimmediatevalue(1)
|
||||
self.dut.qsfp_rx_rst_4.setimmediatevalue(1)
|
||||
self.dut.qsfp_tx_rst_4.setimmediatevalue(1)
|
||||
for y in range(1, 5):
|
||||
getattr(self.dut, f"qsfp_rx_rst_{y}").setimmediatevalue(1)
|
||||
getattr(self.dut, f"qsfp_tx_rst_{y}").setimmediatevalue(1)
|
||||
|
||||
await FallingEdge(self.dut.rst_250mhz)
|
||||
await Timer(100, 'ns')
|
||||
@ -350,14 +323,9 @@ class TB(object):
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
|
||||
self.dut.ptp_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp_rx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp_tx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp_rx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp_tx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp_rx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp_tx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp_rx_rst_4.setimmediatevalue(0)
|
||||
self.dut.qsfp_tx_rst_4.setimmediatevalue(0)
|
||||
for y in range(1, 5):
|
||||
getattr(self.dut, f"qsfp_rx_rst_{y}").setimmediatevalue(0)
|
||||
getattr(self.dut, f"qsfp_tx_rst_{y}").setimmediatevalue(0)
|
||||
|
||||
await self.rc.enumerate()
|
||||
|
||||
@ -366,14 +334,9 @@ class TB(object):
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
|
||||
if self.loopback_enable:
|
||||
if not self.qsfp_1_sink.empty():
|
||||
await self.qsfp_1_source.send(await self.qsfp_1_sink.recv())
|
||||
if not self.qsfp_2_sink.empty():
|
||||
await self.qsfp_2_source.send(await self.qsfp_2_sink.recv())
|
||||
if not self.qsfp_3_sink.empty():
|
||||
await self.qsfp_3_source.send(await self.qsfp_3_sink.recv())
|
||||
if not self.qsfp_4_sink.empty():
|
||||
await self.qsfp_4_source.send(await self.qsfp_4_sink.recv())
|
||||
for x in range(len(self.qsfp_sink)):
|
||||
if not self.qsfp_sink[x].empty():
|
||||
await self.qsfp_source[x].send(await self.qsfp_sink[x].recv())
|
||||
|
||||
|
||||
@cocotb.test()
|
||||
@ -403,10 +366,10 @@ async def run_test_nic(dut):
|
||||
|
||||
await tb.driver.interfaces[0].start_xmit(data, 0)
|
||||
|
||||
pkt = await tb.qsfp_1_sink.recv()
|
||||
pkt = await tb.qsfp_sink[0].recv()
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
|
||||
await tb.qsfp_1_source.send(pkt)
|
||||
await tb.qsfp_source[0].send(pkt)
|
||||
|
||||
pkt = await tb.driver.interfaces[0].recv()
|
||||
|
||||
@ -426,10 +389,10 @@ async def run_test_nic(dut):
|
||||
|
||||
await tb.driver.interfaces[0].start_xmit(test_pkt2.build(), 0, 34, 6)
|
||||
|
||||
pkt = await tb.qsfp_1_sink.recv()
|
||||
pkt = await tb.qsfp_sink[0].recv()
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
|
||||
await tb.qsfp_1_source.send(pkt)
|
||||
await tb.qsfp_source[0].send(pkt)
|
||||
|
||||
pkt = await tb.driver.interfaces[0].recv()
|
||||
|
||||
|
@ -254,93 +254,42 @@ class TB(object):
|
||||
cocotb.start_soon(Clock(dut.ptp_sample_clk, 10, units="ns").start())
|
||||
|
||||
# Ethernet
|
||||
cocotb.start_soon(Clock(dut.qsfpdda_mac_1_clk, 2.482, units="ns").start())
|
||||
self.qsfpdd_mac = []
|
||||
|
||||
self.qsfpdda_mac_1 = EthMac(
|
||||
tx_clk=dut.qsfpdda_mac_1_clk,
|
||||
tx_rst=dut.qsfpdda_mac_1_rst,
|
||||
tx_bus=AxiStreamBus.from_prefix(dut, "qsfpdda_mac_1_tx_axis"),
|
||||
tx_ptp_time=dut.qsfpdda_mac_1_ptp_time,
|
||||
tx_ptp_ts=dut.qsfpdda_mac_1_tx_ptp_ts,
|
||||
tx_ptp_ts_tag=dut.qsfpdda_mac_1_tx_ptp_ts_tag,
|
||||
tx_ptp_ts_valid=dut.qsfpdda_mac_1_tx_ptp_ts_valid,
|
||||
rx_clk=dut.qsfpdda_mac_1_clk,
|
||||
rx_rst=dut.qsfpdda_mac_1_rst,
|
||||
rx_bus=AxiStreamBus.from_prefix(dut, "qsfpdda_mac_1_rx_axis"),
|
||||
rx_ptp_time=dut.qsfpdda_mac_1_ptp_time,
|
||||
ifg=12, speed=100e9
|
||||
)
|
||||
for x in "ab":
|
||||
macs = []
|
||||
for y in range(1, 3):
|
||||
cocotb.start_soon(Clock(getattr(dut, f"qsfpdd{x}_mac_{y}_clk"), 2.482, units="ns").start())
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfpdda_mac_2_clk, 2.482, units="ns").start())
|
||||
mac = EthMac(
|
||||
tx_clk=getattr(dut, f"qsfpdd{x}_mac_{y}_clk"),
|
||||
tx_rst=getattr(dut, f"qsfpdd{x}_mac_{y}_rst"),
|
||||
tx_bus=AxiStreamBus.from_prefix(dut, f"qsfpdd{x}_mac_{y}_tx_axis"),
|
||||
tx_ptp_time=getattr(dut, f"qsfpdd{x}_mac_{y}_ptp_time"),
|
||||
tx_ptp_ts=getattr(dut, f"qsfpdd{x}_mac_{y}_tx_ptp_ts"),
|
||||
tx_ptp_ts_tag=getattr(dut, f"qsfpdd{x}_mac_{y}_tx_ptp_ts_tag"),
|
||||
tx_ptp_ts_valid=getattr(dut, f"qsfpdd{x}_mac_{y}_tx_ptp_ts_valid"),
|
||||
rx_clk=getattr(dut, f"qsfpdd{x}_mac_{y}_clk"),
|
||||
rx_rst=getattr(dut, f"qsfpdd{x}_mac_{y}_rst"),
|
||||
rx_bus=AxiStreamBus.from_prefix(dut, f"qsfpdd{x}_mac_{y}_rx_axis"),
|
||||
rx_ptp_time=getattr(dut, f"qsfpdd{x}_mac_{y}_ptp_time"),
|
||||
ifg=12, speed=100e9
|
||||
)
|
||||
|
||||
self.qsfpdda_mac_2 = EthMac(
|
||||
tx_clk=dut.qsfpdda_mac_2_clk,
|
||||
tx_rst=dut.qsfpdda_mac_2_rst,
|
||||
tx_bus=AxiStreamBus.from_prefix(dut, "qsfpdda_mac_2_tx_axis"),
|
||||
tx_ptp_time=dut.qsfpdda_mac_2_ptp_time,
|
||||
tx_ptp_ts=dut.qsfpdda_mac_2_tx_ptp_ts,
|
||||
tx_ptp_ts_tag=dut.qsfpdda_mac_2_tx_ptp_ts_tag,
|
||||
tx_ptp_ts_valid=dut.qsfpdda_mac_2_tx_ptp_ts_valid,
|
||||
rx_clk=dut.qsfpdda_mac_2_clk,
|
||||
rx_rst=dut.qsfpdda_mac_2_rst,
|
||||
rx_bus=AxiStreamBus.from_prefix(dut, "qsfpdda_mac_2_rx_axis"),
|
||||
rx_ptp_time=dut.qsfpdda_mac_2_ptp_time,
|
||||
ifg=12, speed=100e9
|
||||
)
|
||||
macs.append(mac)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfpddb_mac_1_clk, 2.482, units="ns").start())
|
||||
getattr(dut, f"qsfpdd{x}_mac_{y}_rx_status").setimmediatevalue(1)
|
||||
|
||||
self.qsfpddb_mac_1 = EthMac(
|
||||
tx_clk=dut.qsfpddb_mac_1_clk,
|
||||
tx_rst=dut.qsfpddb_mac_1_rst,
|
||||
tx_bus=AxiStreamBus.from_prefix(dut, "qsfpddb_mac_1_tx_axis"),
|
||||
tx_ptp_time=dut.qsfpddb_mac_1_ptp_time,
|
||||
tx_ptp_ts=dut.qsfpddb_mac_1_tx_ptp_ts,
|
||||
tx_ptp_ts_tag=dut.qsfpddb_mac_1_tx_ptp_ts_tag,
|
||||
tx_ptp_ts_valid=dut.qsfpddb_mac_1_tx_ptp_ts_valid,
|
||||
rx_clk=dut.qsfpddb_mac_1_clk,
|
||||
rx_rst=dut.qsfpddb_mac_1_rst,
|
||||
rx_bus=AxiStreamBus.from_prefix(dut, "qsfpddb_mac_1_rx_axis"),
|
||||
rx_ptp_time=dut.qsfpddb_mac_1_ptp_time,
|
||||
ifg=12, speed=100e9
|
||||
)
|
||||
self.qsfpdd_mac.append(macs)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfpddb_mac_2_clk, 2.482, units="ns").start())
|
||||
|
||||
self.qsfpddb_mac_2 = EthMac(
|
||||
tx_clk=dut.qsfpddb_mac_2_clk,
|
||||
tx_rst=dut.qsfpddb_mac_2_rst,
|
||||
tx_bus=AxiStreamBus.from_prefix(dut, "qsfpddb_mac_2_tx_axis"),
|
||||
tx_ptp_time=dut.qsfpddb_mac_2_ptp_time,
|
||||
tx_ptp_ts=dut.qsfpddb_mac_2_tx_ptp_ts,
|
||||
tx_ptp_ts_tag=dut.qsfpddb_mac_2_tx_ptp_ts_tag,
|
||||
tx_ptp_ts_valid=dut.qsfpddb_mac_2_tx_ptp_ts_valid,
|
||||
rx_clk=dut.qsfpddb_mac_2_clk,
|
||||
rx_rst=dut.qsfpddb_mac_2_rst,
|
||||
rx_bus=AxiStreamBus.from_prefix(dut, "qsfpddb_mac_2_rx_axis"),
|
||||
rx_ptp_time=dut.qsfpddb_mac_2_ptp_time,
|
||||
ifg=12, speed=100e9
|
||||
)
|
||||
|
||||
dut.qsfpdda_mac_1_rx_status.setimmediatevalue(1)
|
||||
dut.qsfpdda_mac_2_rx_status.setimmediatevalue(1)
|
||||
|
||||
dut.qsfpddb_mac_1_rx_status.setimmediatevalue(1)
|
||||
dut.qsfpddb_mac_2_rx_status.setimmediatevalue(1)
|
||||
getattr(dut, f"qsfpdd{x}_interrupt_n").setimmediatevalue(1)
|
||||
getattr(dut, f"qsfpdd{x}_mod_prs_n").setimmediatevalue(0)
|
||||
getattr(dut, f"qsfpdd{x}_scl_i").setimmediatevalue(1)
|
||||
getattr(dut, f"qsfpdd{x}_sda_i").setimmediatevalue(1)
|
||||
|
||||
dut.button.setimmediatevalue(0)
|
||||
dut.sw.setimmediatevalue(0)
|
||||
|
||||
dut.qsfpdda_interrupt_n.setimmediatevalue(1)
|
||||
dut.qsfpdda_mod_prs_n.setimmediatevalue(0)
|
||||
dut.qsfpdda_scl_i.setimmediatevalue(1)
|
||||
dut.qsfpdda_sda_i.setimmediatevalue(1)
|
||||
|
||||
dut.qsfpddb_interrupt_n.setimmediatevalue(1)
|
||||
dut.qsfpddb_mod_prs_n.setimmediatevalue(0)
|
||||
dut.qsfpddb_scl_i.setimmediatevalue(1)
|
||||
dut.qsfpddb_sda_i.setimmediatevalue(1)
|
||||
|
||||
# dut.qspi_dq_i.setimmediatevalue(0)
|
||||
|
||||
self.loopback_enable = False
|
||||
@ -349,19 +298,17 @@ class TB(object):
|
||||
async def init(self):
|
||||
|
||||
self.dut.ptp_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpdda_mac_1_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpdda_mac_2_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpddb_mac_1_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpddb_mac_2_rst.setimmediatevalue(0)
|
||||
for x in "ab":
|
||||
for y in range(1, 3):
|
||||
getattr(self.dut, f"qsfpdd{x}_mac_{y}_rst").setimmediatevalue(0)
|
||||
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
|
||||
self.dut.ptp_rst.setimmediatevalue(1)
|
||||
self.dut.qsfpdda_mac_1_rst.setimmediatevalue(1)
|
||||
self.dut.qsfpdda_mac_2_rst.setimmediatevalue(1)
|
||||
self.dut.qsfpddb_mac_1_rst.setimmediatevalue(1)
|
||||
self.dut.qsfpddb_mac_2_rst.setimmediatevalue(1)
|
||||
for x in "ab":
|
||||
for y in range(1, 3):
|
||||
getattr(self.dut, f"qsfpdd{x}_mac_{y}_rst").setimmediatevalue(1)
|
||||
|
||||
await FallingEdge(self.dut.rst_250mhz)
|
||||
await Timer(100, 'ns')
|
||||
@ -370,10 +317,9 @@ class TB(object):
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
|
||||
self.dut.ptp_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpdda_mac_1_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpdda_mac_2_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpddb_mac_1_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpddb_mac_2_rst.setimmediatevalue(0)
|
||||
for x in "ab":
|
||||
for y in range(1, 3):
|
||||
getattr(self.dut, f"qsfpdd{x}_mac_{y}_rst").setimmediatevalue(0)
|
||||
|
||||
await self.rc.enumerate()
|
||||
|
||||
@ -382,14 +328,10 @@ class TB(object):
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
|
||||
if self.loopback_enable:
|
||||
if not self.qsfpdda_mac_1.tx.empty():
|
||||
await self.qsfpdda_mac_1.rx.send(await self.qsfpdda_mac_1.tx.recv())
|
||||
if not self.qsfpdda_mac_2.tx.empty():
|
||||
await self.qsfpdda_mac_2.rx.send(await self.qsfpdda_mac_2.tx.recv())
|
||||
if not self.qsfpddb_mac_1.tx.empty():
|
||||
await self.qsfpddb_mac_1.rx.send(await self.qsfpddb_mac_1.tx.recv())
|
||||
if not self.qsfpddb_mac_2.tx.empty():
|
||||
await self.qsfpddb_mac_2.rx.send(await self.qsfpddb_mac_2.tx.recv())
|
||||
for macs in self.qsfpdd_mac:
|
||||
for mac in macs:
|
||||
if not mac.tx.empty():
|
||||
await mac.rx.send(await mac.tx.recv())
|
||||
|
||||
|
||||
@cocotb.test()
|
||||
@ -420,10 +362,10 @@ async def run_test_nic(dut):
|
||||
|
||||
await tb.driver.interfaces[0].start_xmit(data, 0)
|
||||
|
||||
pkt = await tb.qsfpdda_mac_1.tx.recv()
|
||||
pkt = await tb.qsfpdd_mac[0][0].tx.recv()
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
|
||||
await tb.qsfpdda_mac_1.rx.send(pkt)
|
||||
await tb.qsfpdd_mac[0][0].rx.send(pkt)
|
||||
|
||||
pkt = await tb.driver.interfaces[0].recv()
|
||||
|
||||
@ -432,10 +374,10 @@ async def run_test_nic(dut):
|
||||
|
||||
# await tb.driver.interfaces[1].start_xmit(data, 0)
|
||||
|
||||
# pkt = await tb.qsfpddb_mac_1.tx.recv()
|
||||
# pkt = await tb.qsfpdd_mac[1][0].tx.recv()
|
||||
# tb.log.info("Packet: %s", pkt)
|
||||
|
||||
# await tb.qsfpddb_mac_1.rx.send(pkt)
|
||||
# await tb.qsfpdd_mac[1][0].rx.send(pkt)
|
||||
|
||||
# pkt = await tb.driver.interfaces[1].recv()
|
||||
|
||||
@ -455,10 +397,10 @@ async def run_test_nic(dut):
|
||||
|
||||
await tb.driver.interfaces[0].start_xmit(test_pkt2.build(), 0, 34, 6)
|
||||
|
||||
pkt = await tb.qsfpdda_mac_1.tx.recv()
|
||||
pkt = await tb.qsfpdd_mac[0][0].tx.recv()
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
|
||||
await tb.qsfpdda_mac_1.rx.send(pkt)
|
||||
await tb.qsfpdd_mac[0][0].rx.send(pkt)
|
||||
|
||||
pkt = await tb.driver.interfaces[0].recv()
|
||||
|
||||
|
@ -254,325 +254,43 @@ class TB(object):
|
||||
cocotb.start_soon(Clock(dut.ptp_sample_clk, 10, units="ns").start())
|
||||
|
||||
# Ethernet
|
||||
cocotb.start_soon(Clock(dut.qsfpdda_mac_1_rx_clk, 2.482, units="ns").start())
|
||||
cocotb.start_soon(Clock(dut.qsfpdda_mac_1_tx_clk, 2.482, units="ns").start())
|
||||
self.qsfpdd_mac = []
|
||||
|
||||
self.qsfpdda_mac_1 = EthMac(
|
||||
tx_clk=dut.qsfpdda_mac_1_tx_clk,
|
||||
tx_rst=dut.qsfpdda_mac_1_tx_rst,
|
||||
tx_bus=AxiStreamBus.from_prefix(dut, "qsfpdda_mac_1_tx_axis"),
|
||||
tx_ptp_time=dut.qsfpdda_mac_1_tx_ptp_time,
|
||||
tx_ptp_ts=dut.qsfpdda_mac_1_tx_ptp_ts,
|
||||
tx_ptp_ts_tag=dut.qsfpdda_mac_1_tx_ptp_ts_tag,
|
||||
tx_ptp_ts_valid=dut.qsfpdda_mac_1_tx_ptp_ts_valid,
|
||||
rx_clk=dut.qsfpdda_mac_1_rx_clk,
|
||||
rx_rst=dut.qsfpdda_mac_1_rx_rst,
|
||||
rx_bus=AxiStreamBus.from_prefix(dut, "qsfpdda_mac_1_rx_axis"),
|
||||
rx_ptp_time=dut.qsfpdda_mac_1_rx_ptp_time,
|
||||
ifg=12, speed=25e9
|
||||
)
|
||||
for x in "ab":
|
||||
macs = []
|
||||
for y in range(1, 9):
|
||||
cocotb.start_soon(Clock(getattr(dut, f"qsfpdd{x}_mac_{y}_rx_clk"), 2.482, units="ns").start())
|
||||
cocotb.start_soon(Clock(getattr(dut, f"qsfpdd{x}_mac_{y}_tx_clk"), 2.482, units="ns").start())
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfpdda_mac_2_rx_clk, 2.482, units="ns").start())
|
||||
cocotb.start_soon(Clock(dut.qsfpdda_mac_2_tx_clk, 2.482, units="ns").start())
|
||||
mac = EthMac(
|
||||
tx_clk=getattr(dut, f"qsfpdd{x}_mac_{y}_tx_clk"),
|
||||
tx_rst=getattr(dut, f"qsfpdd{x}_mac_{y}_tx_rst"),
|
||||
tx_bus=AxiStreamBus.from_prefix(dut, f"qsfpdd{x}_mac_{y}_tx_axis"),
|
||||
tx_ptp_time=getattr(dut, f"qsfpdd{x}_mac_{y}_tx_ptp_time"),
|
||||
tx_ptp_ts=getattr(dut, f"qsfpdd{x}_mac_{y}_tx_ptp_ts"),
|
||||
tx_ptp_ts_tag=getattr(dut, f"qsfpdd{x}_mac_{y}_tx_ptp_ts_tag"),
|
||||
tx_ptp_ts_valid=getattr(dut, f"qsfpdd{x}_mac_{y}_tx_ptp_ts_valid"),
|
||||
rx_clk=getattr(dut, f"qsfpdd{x}_mac_{y}_rx_clk"),
|
||||
rx_rst=getattr(dut, f"qsfpdd{x}_mac_{y}_rx_rst"),
|
||||
rx_bus=AxiStreamBus.from_prefix(dut, f"qsfpdd{x}_mac_{y}_rx_axis"),
|
||||
rx_ptp_time=getattr(dut, f"qsfpdd{x}_mac_{y}_rx_ptp_time"),
|
||||
ifg=12, speed=25e9
|
||||
)
|
||||
|
||||
self.qsfpdda_mac_2 = EthMac(
|
||||
tx_clk=dut.qsfpdda_mac_2_tx_clk,
|
||||
tx_rst=dut.qsfpdda_mac_2_tx_rst,
|
||||
tx_bus=AxiStreamBus.from_prefix(dut, "qsfpdda_mac_2_tx_axis"),
|
||||
tx_ptp_time=dut.qsfpdda_mac_2_tx_ptp_time,
|
||||
tx_ptp_ts=dut.qsfpdda_mac_2_tx_ptp_ts,
|
||||
tx_ptp_ts_tag=dut.qsfpdda_mac_2_tx_ptp_ts_tag,
|
||||
tx_ptp_ts_valid=dut.qsfpdda_mac_2_tx_ptp_ts_valid,
|
||||
rx_clk=dut.qsfpdda_mac_2_rx_clk,
|
||||
rx_rst=dut.qsfpdda_mac_2_rx_rst,
|
||||
rx_bus=AxiStreamBus.from_prefix(dut, "qsfpdda_mac_2_rx_axis"),
|
||||
rx_ptp_time=dut.qsfpdda_mac_2_rx_ptp_time,
|
||||
ifg=12, speed=25e9
|
||||
)
|
||||
macs.append(mac)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfpdda_mac_3_rx_clk, 2.482, units="ns").start())
|
||||
cocotb.start_soon(Clock(dut.qsfpdda_mac_3_tx_clk, 2.482, units="ns").start())
|
||||
getattr(dut, f"qsfpdd{x}_mac_{y}_rx_status").setimmediatevalue(1)
|
||||
|
||||
self.qsfpdda_mac_3 = EthMac(
|
||||
tx_clk=dut.qsfpdda_mac_3_tx_clk,
|
||||
tx_rst=dut.qsfpdda_mac_3_tx_rst,
|
||||
tx_bus=AxiStreamBus.from_prefix(dut, "qsfpdda_mac_3_tx_axis"),
|
||||
tx_ptp_time=dut.qsfpdda_mac_3_tx_ptp_time,
|
||||
tx_ptp_ts=dut.qsfpdda_mac_3_tx_ptp_ts,
|
||||
tx_ptp_ts_tag=dut.qsfpdda_mac_3_tx_ptp_ts_tag,
|
||||
tx_ptp_ts_valid=dut.qsfpdda_mac_3_tx_ptp_ts_valid,
|
||||
rx_clk=dut.qsfpdda_mac_3_rx_clk,
|
||||
rx_rst=dut.qsfpdda_mac_3_rx_rst,
|
||||
rx_bus=AxiStreamBus.from_prefix(dut, "qsfpdda_mac_3_rx_axis"),
|
||||
rx_ptp_time=dut.qsfpdda_mac_3_rx_ptp_time,
|
||||
ifg=12, speed=25e9
|
||||
)
|
||||
self.qsfpdd_mac.append(macs)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfpdda_mac_4_rx_clk, 2.482, units="ns").start())
|
||||
cocotb.start_soon(Clock(dut.qsfpdda_mac_4_tx_clk, 2.482, units="ns").start())
|
||||
|
||||
self.qsfpdda_mac_4 = EthMac(
|
||||
tx_clk=dut.qsfpdda_mac_4_tx_clk,
|
||||
tx_rst=dut.qsfpdda_mac_4_tx_rst,
|
||||
tx_bus=AxiStreamBus.from_prefix(dut, "qsfpdda_mac_4_tx_axis"),
|
||||
tx_ptp_time=dut.qsfpdda_mac_4_tx_ptp_time,
|
||||
tx_ptp_ts=dut.qsfpdda_mac_4_tx_ptp_ts,
|
||||
tx_ptp_ts_tag=dut.qsfpdda_mac_4_tx_ptp_ts_tag,
|
||||
tx_ptp_ts_valid=dut.qsfpdda_mac_4_tx_ptp_ts_valid,
|
||||
rx_clk=dut.qsfpdda_mac_4_rx_clk,
|
||||
rx_rst=dut.qsfpdda_mac_4_rx_rst,
|
||||
rx_bus=AxiStreamBus.from_prefix(dut, "qsfpdda_mac_4_rx_axis"),
|
||||
rx_ptp_time=dut.qsfpdda_mac_4_rx_ptp_time,
|
||||
ifg=12, speed=25e9
|
||||
)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfpdda_mac_5_rx_clk, 2.482, units="ns").start())
|
||||
cocotb.start_soon(Clock(dut.qsfpdda_mac_5_tx_clk, 2.482, units="ns").start())
|
||||
|
||||
self.qsfpdda_mac_5 = EthMac(
|
||||
tx_clk=dut.qsfpdda_mac_5_tx_clk,
|
||||
tx_rst=dut.qsfpdda_mac_5_tx_rst,
|
||||
tx_bus=AxiStreamBus.from_prefix(dut, "qsfpdda_mac_5_tx_axis"),
|
||||
tx_ptp_time=dut.qsfpdda_mac_5_tx_ptp_time,
|
||||
tx_ptp_ts=dut.qsfpdda_mac_5_tx_ptp_ts,
|
||||
tx_ptp_ts_tag=dut.qsfpdda_mac_5_tx_ptp_ts_tag,
|
||||
tx_ptp_ts_valid=dut.qsfpdda_mac_5_tx_ptp_ts_valid,
|
||||
rx_clk=dut.qsfpdda_mac_5_rx_clk,
|
||||
rx_rst=dut.qsfpdda_mac_5_rx_rst,
|
||||
rx_bus=AxiStreamBus.from_prefix(dut, "qsfpdda_mac_5_rx_axis"),
|
||||
rx_ptp_time=dut.qsfpdda_mac_5_rx_ptp_time,
|
||||
ifg=12, speed=25e9
|
||||
)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfpdda_mac_6_rx_clk, 2.482, units="ns").start())
|
||||
cocotb.start_soon(Clock(dut.qsfpdda_mac_6_tx_clk, 2.482, units="ns").start())
|
||||
|
||||
self.qsfpdda_mac_6 = EthMac(
|
||||
tx_clk=dut.qsfpdda_mac_6_tx_clk,
|
||||
tx_rst=dut.qsfpdda_mac_6_tx_rst,
|
||||
tx_bus=AxiStreamBus.from_prefix(dut, "qsfpdda_mac_6_tx_axis"),
|
||||
tx_ptp_time=dut.qsfpdda_mac_6_tx_ptp_time,
|
||||
tx_ptp_ts=dut.qsfpdda_mac_6_tx_ptp_ts,
|
||||
tx_ptp_ts_tag=dut.qsfpdda_mac_6_tx_ptp_ts_tag,
|
||||
tx_ptp_ts_valid=dut.qsfpdda_mac_6_tx_ptp_ts_valid,
|
||||
rx_clk=dut.qsfpdda_mac_6_rx_clk,
|
||||
rx_rst=dut.qsfpdda_mac_6_rx_rst,
|
||||
rx_bus=AxiStreamBus.from_prefix(dut, "qsfpdda_mac_6_rx_axis"),
|
||||
rx_ptp_time=dut.qsfpdda_mac_6_rx_ptp_time,
|
||||
ifg=12, speed=25e9
|
||||
)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfpdda_mac_7_rx_clk, 2.482, units="ns").start())
|
||||
cocotb.start_soon(Clock(dut.qsfpdda_mac_7_tx_clk, 2.482, units="ns").start())
|
||||
|
||||
self.qsfpdda_mac_7 = EthMac(
|
||||
tx_clk=dut.qsfpdda_mac_7_tx_clk,
|
||||
tx_rst=dut.qsfpdda_mac_7_tx_rst,
|
||||
tx_bus=AxiStreamBus.from_prefix(dut, "qsfpdda_mac_7_tx_axis"),
|
||||
tx_ptp_time=dut.qsfpdda_mac_7_tx_ptp_time,
|
||||
tx_ptp_ts=dut.qsfpdda_mac_7_tx_ptp_ts,
|
||||
tx_ptp_ts_tag=dut.qsfpdda_mac_7_tx_ptp_ts_tag,
|
||||
tx_ptp_ts_valid=dut.qsfpdda_mac_7_tx_ptp_ts_valid,
|
||||
rx_clk=dut.qsfpdda_mac_7_rx_clk,
|
||||
rx_rst=dut.qsfpdda_mac_7_rx_rst,
|
||||
rx_bus=AxiStreamBus.from_prefix(dut, "qsfpdda_mac_7_rx_axis"),
|
||||
rx_ptp_time=dut.qsfpdda_mac_7_rx_ptp_time,
|
||||
ifg=12, speed=25e9
|
||||
)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfpdda_mac_8_rx_clk, 2.482, units="ns").start())
|
||||
cocotb.start_soon(Clock(dut.qsfpdda_mac_8_tx_clk, 2.482, units="ns").start())
|
||||
|
||||
self.qsfpdda_mac_8 = EthMac(
|
||||
tx_clk=dut.qsfpdda_mac_8_tx_clk,
|
||||
tx_rst=dut.qsfpdda_mac_8_tx_rst,
|
||||
tx_bus=AxiStreamBus.from_prefix(dut, "qsfpdda_mac_8_tx_axis"),
|
||||
tx_ptp_time=dut.qsfpdda_mac_8_tx_ptp_time,
|
||||
tx_ptp_ts=dut.qsfpdda_mac_8_tx_ptp_ts,
|
||||
tx_ptp_ts_tag=dut.qsfpdda_mac_8_tx_ptp_ts_tag,
|
||||
tx_ptp_ts_valid=dut.qsfpdda_mac_8_tx_ptp_ts_valid,
|
||||
rx_clk=dut.qsfpdda_mac_8_rx_clk,
|
||||
rx_rst=dut.qsfpdda_mac_8_rx_rst,
|
||||
rx_bus=AxiStreamBus.from_prefix(dut, "qsfpdda_mac_8_rx_axis"),
|
||||
rx_ptp_time=dut.qsfpdda_mac_8_rx_ptp_time,
|
||||
ifg=12, speed=25e9
|
||||
)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfpddb_mac_1_rx_clk, 2.482, units="ns").start())
|
||||
cocotb.start_soon(Clock(dut.qsfpddb_mac_1_tx_clk, 2.482, units="ns").start())
|
||||
|
||||
self.qsfpddb_mac_1 = EthMac(
|
||||
tx_clk=dut.qsfpddb_mac_1_tx_clk,
|
||||
tx_rst=dut.qsfpddb_mac_1_tx_rst,
|
||||
tx_bus=AxiStreamBus.from_prefix(dut, "qsfpddb_mac_1_tx_axis"),
|
||||
tx_ptp_time=dut.qsfpddb_mac_1_tx_ptp_time,
|
||||
tx_ptp_ts=dut.qsfpddb_mac_1_tx_ptp_ts,
|
||||
tx_ptp_ts_tag=dut.qsfpddb_mac_1_tx_ptp_ts_tag,
|
||||
tx_ptp_ts_valid=dut.qsfpddb_mac_1_tx_ptp_ts_valid,
|
||||
rx_clk=dut.qsfpddb_mac_1_rx_clk,
|
||||
rx_rst=dut.qsfpddb_mac_1_rx_rst,
|
||||
rx_bus=AxiStreamBus.from_prefix(dut, "qsfpddb_mac_1_rx_axis"),
|
||||
rx_ptp_time=dut.qsfpddb_mac_1_rx_ptp_time,
|
||||
ifg=12, speed=25e9
|
||||
)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfpddb_mac_2_rx_clk, 2.482, units="ns").start())
|
||||
cocotb.start_soon(Clock(dut.qsfpddb_mac_2_tx_clk, 2.482, units="ns").start())
|
||||
|
||||
self.qsfpddb_mac_2 = EthMac(
|
||||
tx_clk=dut.qsfpddb_mac_2_tx_clk,
|
||||
tx_rst=dut.qsfpddb_mac_2_tx_rst,
|
||||
tx_bus=AxiStreamBus.from_prefix(dut, "qsfpddb_mac_2_tx_axis"),
|
||||
tx_ptp_time=dut.qsfpddb_mac_2_tx_ptp_time,
|
||||
tx_ptp_ts=dut.qsfpddb_mac_2_tx_ptp_ts,
|
||||
tx_ptp_ts_tag=dut.qsfpddb_mac_2_tx_ptp_ts_tag,
|
||||
tx_ptp_ts_valid=dut.qsfpddb_mac_2_tx_ptp_ts_valid,
|
||||
rx_clk=dut.qsfpddb_mac_2_rx_clk,
|
||||
rx_rst=dut.qsfpddb_mac_2_rx_rst,
|
||||
rx_bus=AxiStreamBus.from_prefix(dut, "qsfpddb_mac_2_rx_axis"),
|
||||
rx_ptp_time=dut.qsfpddb_mac_2_rx_ptp_time,
|
||||
ifg=12, speed=25e9
|
||||
)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfpddb_mac_3_rx_clk, 2.482, units="ns").start())
|
||||
cocotb.start_soon(Clock(dut.qsfpddb_mac_3_tx_clk, 2.482, units="ns").start())
|
||||
|
||||
self.qsfpddb_mac_3 = EthMac(
|
||||
tx_clk=dut.qsfpddb_mac_3_tx_clk,
|
||||
tx_rst=dut.qsfpddb_mac_3_tx_rst,
|
||||
tx_bus=AxiStreamBus.from_prefix(dut, "qsfpddb_mac_3_tx_axis"),
|
||||
tx_ptp_time=dut.qsfpddb_mac_3_tx_ptp_time,
|
||||
tx_ptp_ts=dut.qsfpddb_mac_3_tx_ptp_ts,
|
||||
tx_ptp_ts_tag=dut.qsfpddb_mac_3_tx_ptp_ts_tag,
|
||||
tx_ptp_ts_valid=dut.qsfpddb_mac_3_tx_ptp_ts_valid,
|
||||
rx_clk=dut.qsfpddb_mac_3_rx_clk,
|
||||
rx_rst=dut.qsfpddb_mac_3_rx_rst,
|
||||
rx_bus=AxiStreamBus.from_prefix(dut, "qsfpddb_mac_3_rx_axis"),
|
||||
rx_ptp_time=dut.qsfpddb_mac_3_rx_ptp_time,
|
||||
ifg=12, speed=25e9
|
||||
)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfpddb_mac_4_rx_clk, 2.482, units="ns").start())
|
||||
cocotb.start_soon(Clock(dut.qsfpddb_mac_4_tx_clk, 2.482, units="ns").start())
|
||||
|
||||
self.qsfpddb_mac_4 = EthMac(
|
||||
tx_clk=dut.qsfpddb_mac_4_tx_clk,
|
||||
tx_rst=dut.qsfpddb_mac_4_tx_rst,
|
||||
tx_bus=AxiStreamBus.from_prefix(dut, "qsfpddb_mac_4_tx_axis"),
|
||||
tx_ptp_time=dut.qsfpddb_mac_4_tx_ptp_time,
|
||||
tx_ptp_ts=dut.qsfpddb_mac_4_tx_ptp_ts,
|
||||
tx_ptp_ts_tag=dut.qsfpddb_mac_4_tx_ptp_ts_tag,
|
||||
tx_ptp_ts_valid=dut.qsfpddb_mac_4_tx_ptp_ts_valid,
|
||||
rx_clk=dut.qsfpddb_mac_4_rx_clk,
|
||||
rx_rst=dut.qsfpddb_mac_4_rx_rst,
|
||||
rx_bus=AxiStreamBus.from_prefix(dut, "qsfpddb_mac_4_rx_axis"),
|
||||
rx_ptp_time=dut.qsfpddb_mac_4_rx_ptp_time,
|
||||
ifg=12, speed=25e9
|
||||
)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfpddb_mac_5_rx_clk, 2.482, units="ns").start())
|
||||
cocotb.start_soon(Clock(dut.qsfpddb_mac_5_tx_clk, 2.482, units="ns").start())
|
||||
|
||||
self.qsfpddb_mac_5 = EthMac(
|
||||
tx_clk=dut.qsfpddb_mac_5_tx_clk,
|
||||
tx_rst=dut.qsfpddb_mac_5_tx_rst,
|
||||
tx_bus=AxiStreamBus.from_prefix(dut, "qsfpddb_mac_5_tx_axis"),
|
||||
tx_ptp_time=dut.qsfpddb_mac_5_tx_ptp_time,
|
||||
tx_ptp_ts=dut.qsfpddb_mac_5_tx_ptp_ts,
|
||||
tx_ptp_ts_tag=dut.qsfpddb_mac_5_tx_ptp_ts_tag,
|
||||
tx_ptp_ts_valid=dut.qsfpddb_mac_5_tx_ptp_ts_valid,
|
||||
rx_clk=dut.qsfpddb_mac_5_rx_clk,
|
||||
rx_rst=dut.qsfpddb_mac_5_rx_rst,
|
||||
rx_bus=AxiStreamBus.from_prefix(dut, "qsfpddb_mac_5_rx_axis"),
|
||||
rx_ptp_time=dut.qsfpddb_mac_5_rx_ptp_time,
|
||||
ifg=12, speed=25e9
|
||||
)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfpddb_mac_6_rx_clk, 2.482, units="ns").start())
|
||||
cocotb.start_soon(Clock(dut.qsfpddb_mac_6_tx_clk, 2.482, units="ns").start())
|
||||
|
||||
self.qsfpddb_mac_6 = EthMac(
|
||||
tx_clk=dut.qsfpddb_mac_6_tx_clk,
|
||||
tx_rst=dut.qsfpddb_mac_6_tx_rst,
|
||||
tx_bus=AxiStreamBus.from_prefix(dut, "qsfpddb_mac_6_tx_axis"),
|
||||
tx_ptp_time=dut.qsfpddb_mac_6_tx_ptp_time,
|
||||
tx_ptp_ts=dut.qsfpddb_mac_6_tx_ptp_ts,
|
||||
tx_ptp_ts_tag=dut.qsfpddb_mac_6_tx_ptp_ts_tag,
|
||||
tx_ptp_ts_valid=dut.qsfpddb_mac_6_tx_ptp_ts_valid,
|
||||
rx_clk=dut.qsfpddb_mac_6_rx_clk,
|
||||
rx_rst=dut.qsfpddb_mac_6_rx_rst,
|
||||
rx_bus=AxiStreamBus.from_prefix(dut, "qsfpddb_mac_6_rx_axis"),
|
||||
rx_ptp_time=dut.qsfpddb_mac_6_rx_ptp_time,
|
||||
ifg=12, speed=25e9
|
||||
)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfpddb_mac_7_rx_clk, 2.482, units="ns").start())
|
||||
cocotb.start_soon(Clock(dut.qsfpddb_mac_7_tx_clk, 2.482, units="ns").start())
|
||||
|
||||
self.qsfpddb_mac_7 = EthMac(
|
||||
tx_clk=dut.qsfpddb_mac_7_tx_clk,
|
||||
tx_rst=dut.qsfpddb_mac_7_tx_rst,
|
||||
tx_bus=AxiStreamBus.from_prefix(dut, "qsfpddb_mac_7_tx_axis"),
|
||||
tx_ptp_time=dut.qsfpddb_mac_7_tx_ptp_time,
|
||||
tx_ptp_ts=dut.qsfpddb_mac_7_tx_ptp_ts,
|
||||
tx_ptp_ts_tag=dut.qsfpddb_mac_7_tx_ptp_ts_tag,
|
||||
tx_ptp_ts_valid=dut.qsfpddb_mac_7_tx_ptp_ts_valid,
|
||||
rx_clk=dut.qsfpddb_mac_7_rx_clk,
|
||||
rx_rst=dut.qsfpddb_mac_7_rx_rst,
|
||||
rx_bus=AxiStreamBus.from_prefix(dut, "qsfpddb_mac_7_rx_axis"),
|
||||
rx_ptp_time=dut.qsfpddb_mac_7_rx_ptp_time,
|
||||
ifg=12, speed=25e9
|
||||
)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfpddb_mac_8_rx_clk, 2.482, units="ns").start())
|
||||
cocotb.start_soon(Clock(dut.qsfpddb_mac_8_tx_clk, 2.482, units="ns").start())
|
||||
|
||||
self.qsfpddb_mac_8 = EthMac(
|
||||
tx_clk=dut.qsfpddb_mac_8_tx_clk,
|
||||
tx_rst=dut.qsfpddb_mac_8_tx_rst,
|
||||
tx_bus=AxiStreamBus.from_prefix(dut, "qsfpddb_mac_8_tx_axis"),
|
||||
tx_ptp_time=dut.qsfpddb_mac_8_tx_ptp_time,
|
||||
tx_ptp_ts=dut.qsfpddb_mac_8_tx_ptp_ts,
|
||||
tx_ptp_ts_tag=dut.qsfpddb_mac_8_tx_ptp_ts_tag,
|
||||
tx_ptp_ts_valid=dut.qsfpddb_mac_8_tx_ptp_ts_valid,
|
||||
rx_clk=dut.qsfpddb_mac_8_rx_clk,
|
||||
rx_rst=dut.qsfpddb_mac_8_rx_rst,
|
||||
rx_bus=AxiStreamBus.from_prefix(dut, "qsfpddb_mac_8_rx_axis"),
|
||||
rx_ptp_time=dut.qsfpddb_mac_8_rx_ptp_time,
|
||||
ifg=12, speed=25e9
|
||||
)
|
||||
|
||||
dut.qsfpdda_mac_1_rx_status.setimmediatevalue(1)
|
||||
dut.qsfpdda_mac_2_rx_status.setimmediatevalue(1)
|
||||
dut.qsfpdda_mac_3_rx_status.setimmediatevalue(1)
|
||||
dut.qsfpdda_mac_4_rx_status.setimmediatevalue(1)
|
||||
dut.qsfpdda_mac_5_rx_status.setimmediatevalue(1)
|
||||
dut.qsfpdda_mac_6_rx_status.setimmediatevalue(1)
|
||||
dut.qsfpdda_mac_7_rx_status.setimmediatevalue(1)
|
||||
dut.qsfpdda_mac_8_rx_status.setimmediatevalue(1)
|
||||
|
||||
dut.qsfpddb_mac_1_rx_status.setimmediatevalue(1)
|
||||
dut.qsfpddb_mac_2_rx_status.setimmediatevalue(1)
|
||||
dut.qsfpddb_mac_3_rx_status.setimmediatevalue(1)
|
||||
dut.qsfpddb_mac_4_rx_status.setimmediatevalue(1)
|
||||
dut.qsfpddb_mac_5_rx_status.setimmediatevalue(1)
|
||||
dut.qsfpddb_mac_6_rx_status.setimmediatevalue(1)
|
||||
dut.qsfpddb_mac_7_rx_status.setimmediatevalue(1)
|
||||
dut.qsfpddb_mac_8_rx_status.setimmediatevalue(1)
|
||||
getattr(dut, f"qsfpdd{x}_interrupt_n").setimmediatevalue(1)
|
||||
getattr(dut, f"qsfpdd{x}_mod_prs_n").setimmediatevalue(0)
|
||||
getattr(dut, f"qsfpdd{x}_scl_i").setimmediatevalue(1)
|
||||
getattr(dut, f"qsfpdd{x}_sda_i").setimmediatevalue(1)
|
||||
|
||||
dut.button.setimmediatevalue(0)
|
||||
dut.sw.setimmediatevalue(0)
|
||||
|
||||
dut.qsfpdda_interrupt_n.setimmediatevalue(1)
|
||||
dut.qsfpdda_mod_prs_n.setimmediatevalue(0)
|
||||
dut.qsfpdda_scl_i.setimmediatevalue(1)
|
||||
dut.qsfpdda_sda_i.setimmediatevalue(1)
|
||||
|
||||
dut.qsfpddb_interrupt_n.setimmediatevalue(1)
|
||||
dut.qsfpddb_mod_prs_n.setimmediatevalue(0)
|
||||
dut.qsfpddb_scl_i.setimmediatevalue(1)
|
||||
dut.qsfpddb_sda_i.setimmediatevalue(1)
|
||||
|
||||
# dut.qspi_dq_i.setimmediatevalue(0)
|
||||
|
||||
self.loopback_enable = False
|
||||
@ -581,75 +299,19 @@ class TB(object):
|
||||
async def init(self):
|
||||
|
||||
self.dut.ptp_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpdda_mac_1_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpdda_mac_1_tx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpdda_mac_2_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpdda_mac_2_tx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpdda_mac_3_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpdda_mac_3_tx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpdda_mac_4_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpdda_mac_4_tx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpdda_mac_5_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpdda_mac_5_tx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpdda_mac_6_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpdda_mac_6_tx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpdda_mac_7_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpdda_mac_7_tx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpdda_mac_8_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpdda_mac_8_tx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpddb_mac_1_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpddb_mac_1_tx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpddb_mac_2_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpddb_mac_2_tx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpddb_mac_3_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpddb_mac_3_tx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpddb_mac_4_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpddb_mac_4_tx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpddb_mac_5_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpddb_mac_5_tx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpddb_mac_6_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpddb_mac_6_tx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpddb_mac_7_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpddb_mac_7_tx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpddb_mac_8_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpddb_mac_8_tx_rst.setimmediatevalue(0)
|
||||
for x in "ab":
|
||||
for y in range(1, 9):
|
||||
getattr(self.dut, f"qsfpdd{x}_mac_{y}_rx_rst").setimmediatevalue(0)
|
||||
getattr(self.dut, f"qsfpdd{x}_mac_{y}_tx_rst").setimmediatevalue(0)
|
||||
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
|
||||
self.dut.ptp_rst.setimmediatevalue(1)
|
||||
self.dut.qsfpdda_mac_1_rx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfpdda_mac_1_tx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfpdda_mac_2_rx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfpdda_mac_2_tx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfpdda_mac_3_rx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfpdda_mac_3_tx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfpdda_mac_4_rx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfpdda_mac_4_tx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfpdda_mac_5_rx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfpdda_mac_5_tx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfpdda_mac_6_rx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfpdda_mac_6_tx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfpdda_mac_7_rx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfpdda_mac_7_tx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfpdda_mac_8_rx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfpdda_mac_8_tx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfpddb_mac_1_rx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfpddb_mac_1_tx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfpddb_mac_2_rx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfpddb_mac_2_tx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfpddb_mac_3_rx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfpddb_mac_3_tx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfpddb_mac_4_rx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfpddb_mac_4_tx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfpddb_mac_5_rx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfpddb_mac_5_tx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfpddb_mac_6_rx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfpddb_mac_6_tx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfpddb_mac_7_rx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfpddb_mac_7_tx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfpddb_mac_8_rx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfpddb_mac_8_tx_rst.setimmediatevalue(1)
|
||||
for x in "ab":
|
||||
for y in range(1, 9):
|
||||
getattr(self.dut, f"qsfpdd{x}_mac_{y}_rx_rst").setimmediatevalue(1)
|
||||
getattr(self.dut, f"qsfpdd{x}_mac_{y}_tx_rst").setimmediatevalue(1)
|
||||
|
||||
await FallingEdge(self.dut.rst_250mhz)
|
||||
await Timer(100, 'ns')
|
||||
@ -658,38 +320,10 @@ class TB(object):
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
|
||||
self.dut.ptp_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpdda_mac_1_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpdda_mac_1_tx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpdda_mac_2_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpdda_mac_2_tx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpdda_mac_3_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpdda_mac_3_tx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpdda_mac_4_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpdda_mac_4_tx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpdda_mac_5_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpdda_mac_5_tx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpdda_mac_6_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpdda_mac_6_tx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpdda_mac_7_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpdda_mac_7_tx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpdda_mac_8_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpdda_mac_8_tx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpddb_mac_1_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpddb_mac_1_tx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpddb_mac_2_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpddb_mac_2_tx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpddb_mac_3_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpddb_mac_3_tx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpddb_mac_4_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpddb_mac_4_tx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpddb_mac_5_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpddb_mac_5_tx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpddb_mac_6_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpddb_mac_6_tx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpddb_mac_7_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpddb_mac_7_tx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpddb_mac_8_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpddb_mac_8_tx_rst.setimmediatevalue(0)
|
||||
for x in "ab":
|
||||
for y in range(1, 9):
|
||||
getattr(self.dut, f"qsfpdd{x}_mac_{y}_rx_rst").setimmediatevalue(0)
|
||||
getattr(self.dut, f"qsfpdd{x}_mac_{y}_tx_rst").setimmediatevalue(0)
|
||||
|
||||
await self.rc.enumerate()
|
||||
|
||||
@ -698,38 +332,10 @@ class TB(object):
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
|
||||
if self.loopback_enable:
|
||||
if not self.qsfpdda_mac_1.tx.empty():
|
||||
await self.qsfpdda_mac_1.rx.send(await self.qsfpdda_mac_1.tx.recv())
|
||||
if not self.qsfpdda_mac_2.tx.empty():
|
||||
await self.qsfpdda_mac_2.rx.send(await self.qsfpdda_mac_2.tx.recv())
|
||||
if not self.qsfpdda_mac_3.tx.empty():
|
||||
await self.qsfpdda_mac_3.rx.send(await self.qsfpdda_mac_3.tx.recv())
|
||||
if not self.qsfpdda_mac_4.tx.empty():
|
||||
await self.qsfpdda_mac_4.rx.send(await self.qsfpdda_mac_4.tx.recv())
|
||||
if not self.qsfpdda_mac_5.tx.empty():
|
||||
await self.qsfpdda_mac_5.rx.send(await self.qsfpdda_mac_5.tx.recv())
|
||||
if not self.qsfpdda_mac_6.tx.empty():
|
||||
await self.qsfpdda_mac_6.rx.send(await self.qsfpdda_mac_6.tx.recv())
|
||||
if not self.qsfpdda_mac_7.tx.empty():
|
||||
await self.qsfpdda_mac_7.rx.send(await self.qsfpdda_mac_7.tx.recv())
|
||||
if not self.qsfpdda_mac_8.tx.empty():
|
||||
await self.qsfpdda_mac_8.rx.send(await self.qsfpdda_mac_8.tx.recv())
|
||||
if not self.qsfpddb_mac_1.tx.empty():
|
||||
await self.qsfpddb_mac_1.rx.send(await self.qsfpddb_mac_1.tx.recv())
|
||||
if not self.qsfpddb_mac_2.tx.empty():
|
||||
await self.qsfpddb_mac_2.rx.send(await self.qsfpddb_mac_2.tx.recv())
|
||||
if not self.qsfpddb_mac_3.tx.empty():
|
||||
await self.qsfpddb_mac_3.rx.send(await self.qsfpddb_mac_3.tx.recv())
|
||||
if not self.qsfpddb_mac_4.tx.empty():
|
||||
await self.qsfpddb_mac_4.rx.send(await self.qsfpddb_mac_4.tx.recv())
|
||||
if not self.qsfpddb_mac_5.tx.empty():
|
||||
await self.qsfpddb_mac_5.rx.send(await self.qsfpddb_mac_5.tx.recv())
|
||||
if not self.qsfpddb_mac_6.tx.empty():
|
||||
await self.qsfpddb_mac_6.rx.send(await self.qsfpddb_mac_6.tx.recv())
|
||||
if not self.qsfpddb_mac_7.tx.empty():
|
||||
await self.qsfpddb_mac_7.rx.send(await self.qsfpddb_mac_7.tx.recv())
|
||||
if not self.qsfpddb_mac_8.tx.empty():
|
||||
await self.qsfpddb_mac_8.rx.send(await self.qsfpddb_mac_8.tx.recv())
|
||||
for macs in self.qsfpdd_mac:
|
||||
for mac in macs:
|
||||
if not mac.tx.empty():
|
||||
await mac.rx.send(await mac.tx.recv())
|
||||
|
||||
|
||||
@cocotb.test()
|
||||
@ -760,10 +366,10 @@ async def run_test_nic(dut):
|
||||
|
||||
await tb.driver.interfaces[0].start_xmit(data, 0)
|
||||
|
||||
pkt = await tb.qsfpdda_mac_1.tx.recv()
|
||||
pkt = await tb.qsfpdd_mac[0][0].tx.recv()
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
|
||||
await tb.qsfpdda_mac_1.rx.send(pkt)
|
||||
await tb.qsfpdd_mac[0][0].rx.send(pkt)
|
||||
|
||||
pkt = await tb.driver.interfaces[0].recv()
|
||||
|
||||
@ -772,10 +378,10 @@ async def run_test_nic(dut):
|
||||
|
||||
# await tb.driver.interfaces[1].start_xmit(data, 0)
|
||||
|
||||
# pkt = await tb.qsfpddb_mac_1.tx.recv()
|
||||
# pkt = await tb.qsfpdd_mac[1][0].tx.recv()
|
||||
# tb.log.info("Packet: %s", pkt)
|
||||
|
||||
# await tb.qsfpddb_mac_1.rx.send(pkt)
|
||||
# await tb.qsfpdd_mac[1][0].rx.send(pkt)
|
||||
|
||||
# pkt = await tb.driver.interfaces[1].recv()
|
||||
|
||||
@ -795,10 +401,10 @@ async def run_test_nic(dut):
|
||||
|
||||
await tb.driver.interfaces[0].start_xmit(test_pkt2.build(), 0, 34, 6)
|
||||
|
||||
pkt = await tb.qsfpdda_mac_1.tx.recv()
|
||||
pkt = await tb.qsfpdd_mac[0][0].tx.recv()
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
|
||||
await tb.qsfpdda_mac_1.rx.send(pkt)
|
||||
await tb.qsfpdd_mac[0][0].rx.send(pkt)
|
||||
|
||||
pkt = await tb.driver.interfaces[0].recv()
|
||||
|
||||
|
@ -254,43 +254,29 @@ class TB(object):
|
||||
cocotb.start_soon(Clock(dut.ptp_sample_clk, 10, units="ns").start())
|
||||
|
||||
# Ethernet
|
||||
cocotb.start_soon(Clock(dut.qsfp1_mac_clk, 2.482, units="ns").start())
|
||||
self.qsfp_mac = []
|
||||
|
||||
self.qsfp1_mac = EthMac(
|
||||
tx_clk=dut.qsfp1_mac_clk,
|
||||
tx_rst=dut.qsfp1_mac_rst,
|
||||
tx_bus=AxiStreamBus.from_prefix(dut, "qsfp1_mac_tx_axis"),
|
||||
tx_ptp_time=dut.qsfp1_mac_ptp_time,
|
||||
tx_ptp_ts=dut.qsfp1_mac_tx_ptp_ts,
|
||||
tx_ptp_ts_tag=dut.qsfp1_mac_tx_ptp_ts_tag,
|
||||
tx_ptp_ts_valid=dut.qsfp1_mac_tx_ptp_ts_valid,
|
||||
rx_clk=dut.qsfp1_mac_clk,
|
||||
rx_rst=dut.qsfp1_mac_rst,
|
||||
rx_bus=AxiStreamBus.from_prefix(dut, "qsfp1_mac_rx_axis"),
|
||||
rx_ptp_time=dut.qsfp1_mac_ptp_time,
|
||||
ifg=12, speed=100e9
|
||||
)
|
||||
for k in range(1, 3):
|
||||
cocotb.start_soon(Clock(getattr(dut, f"qsfp{k}_mac_clk"), 2.482, units="ns").start())
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp2_mac_clk, 2.482, units="ns").start())
|
||||
mac = EthMac(
|
||||
tx_clk=getattr(dut, f"qsfp{k}_mac_clk"),
|
||||
tx_rst=getattr(dut, f"qsfp{k}_mac_rst"),
|
||||
tx_bus=AxiStreamBus.from_prefix(dut, f"qsfp{k}_mac_tx_axis"),
|
||||
tx_ptp_time=getattr(dut, f"qsfp{k}_mac_ptp_time"),
|
||||
tx_ptp_ts=getattr(dut, f"qsfp{k}_mac_tx_ptp_ts"),
|
||||
tx_ptp_ts_tag=getattr(dut, f"qsfp{k}_mac_tx_ptp_ts_tag"),
|
||||
tx_ptp_ts_valid=getattr(dut, f"qsfp{k}_mac_tx_ptp_ts_valid"),
|
||||
rx_clk=getattr(dut, f"qsfp{k}_mac_clk"),
|
||||
rx_rst=getattr(dut, f"qsfp{k}_mac_rst"),
|
||||
rx_bus=AxiStreamBus.from_prefix(dut, f"qsfp{k}_mac_rx_axis"),
|
||||
rx_ptp_time=getattr(dut, f"qsfp{k}_mac_ptp_time"),
|
||||
ifg=12, speed=100e9
|
||||
)
|
||||
|
||||
self.qsfp2_mac = EthMac(
|
||||
tx_clk=dut.qsfp2_mac_clk,
|
||||
tx_rst=dut.qsfp2_mac_rst,
|
||||
tx_bus=AxiStreamBus.from_prefix(dut, "qsfp2_mac_tx_axis"),
|
||||
tx_ptp_time=dut.qsfp2_mac_ptp_time,
|
||||
tx_ptp_ts=dut.qsfp2_mac_tx_ptp_ts,
|
||||
tx_ptp_ts_tag=dut.qsfp2_mac_tx_ptp_ts_tag,
|
||||
tx_ptp_ts_valid=dut.qsfp2_mac_tx_ptp_ts_valid,
|
||||
rx_clk=dut.qsfp2_mac_clk,
|
||||
rx_rst=dut.qsfp2_mac_rst,
|
||||
rx_bus=AxiStreamBus.from_prefix(dut, "qsfp2_mac_rx_axis"),
|
||||
rx_ptp_time=dut.qsfp2_mac_ptp_time,
|
||||
ifg=12, speed=100e9
|
||||
)
|
||||
self.qsfp_mac.append(mac)
|
||||
|
||||
dut.qsfp1_mac_rx_status.setimmediatevalue(1)
|
||||
|
||||
dut.qsfp2_mac_rx_status.setimmediatevalue(1)
|
||||
getattr(dut, f"qsfp{k}_mac_rx_status").setimmediatevalue(1)
|
||||
|
||||
dut.user_pb.setimmediatevalue(0)
|
||||
|
||||
@ -303,15 +289,15 @@ class TB(object):
|
||||
async def init(self):
|
||||
|
||||
self.dut.ptp_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp1_mac_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp2_mac_rst.setimmediatevalue(0)
|
||||
for k in range(1, 3):
|
||||
getattr(self.dut, f"qsfp{k}_mac_rst").setimmediatevalue(0)
|
||||
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
|
||||
self.dut.ptp_rst.setimmediatevalue(1)
|
||||
self.dut.qsfp1_mac_rst.setimmediatevalue(1)
|
||||
self.dut.qsfp2_mac_rst.setimmediatevalue(1)
|
||||
for k in range(1, 3):
|
||||
getattr(self.dut, f"qsfp{k}_mac_rst").setimmediatevalue(1)
|
||||
|
||||
await FallingEdge(self.dut.rst_250mhz)
|
||||
await Timer(100, 'ns')
|
||||
@ -320,8 +306,8 @@ class TB(object):
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
|
||||
self.dut.ptp_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp1_mac_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp2_mac_rst.setimmediatevalue(0)
|
||||
for k in range(1, 3):
|
||||
getattr(self.dut, f"qsfp{k}_mac_rst").setimmediatevalue(0)
|
||||
|
||||
await self.rc.enumerate()
|
||||
|
||||
@ -330,10 +316,9 @@ class TB(object):
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
|
||||
if self.loopback_enable:
|
||||
if not self.qsfp1_mac.tx.empty():
|
||||
await self.qsfp1_mac.rx.send(await self.qsfp1_mac.tx.recv())
|
||||
if not self.qsfp2_mac.tx.empty():
|
||||
await self.qsfp2_mac.rx.send(await self.qsfp2_mac.tx.recv())
|
||||
for mac in self.qsfp_mac:
|
||||
if not mac.tx.empty():
|
||||
await mac.rx.send(await mac.tx.recv())
|
||||
|
||||
|
||||
@cocotb.test()
|
||||
@ -364,10 +349,10 @@ async def run_test_nic(dut):
|
||||
|
||||
await tb.driver.interfaces[0].start_xmit(data, 0)
|
||||
|
||||
pkt = await tb.qsfp1_mac.tx.recv()
|
||||
pkt = await tb.qsfp_mac[0].tx.recv()
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
|
||||
await tb.qsfp1_mac.rx.send(pkt)
|
||||
await tb.qsfp_mac[0].rx.send(pkt)
|
||||
|
||||
pkt = await tb.driver.interfaces[0].recv()
|
||||
|
||||
@ -376,10 +361,10 @@ async def run_test_nic(dut):
|
||||
|
||||
# await tb.driver.interfaces[1].start_xmit(data, 0)
|
||||
|
||||
# pkt = await tb.qsfp2_mac.tx.recv()
|
||||
# pkt = await tb.qsfp_mac[1].tx.recv()
|
||||
# tb.log.info("Packet: %s", pkt)
|
||||
|
||||
# await tb.qsfp2_mac.rx.send(pkt)
|
||||
# await tb.qsfp_mac[1].rx.send(pkt)
|
||||
|
||||
# pkt = await tb.driver.interfaces[1].recv()
|
||||
|
||||
@ -399,10 +384,10 @@ async def run_test_nic(dut):
|
||||
|
||||
await tb.driver.interfaces[0].start_xmit(test_pkt2.build(), 0, 34, 6)
|
||||
|
||||
pkt = await tb.qsfp1_mac.tx.recv()
|
||||
pkt = await tb.qsfp_mac[0].tx.recv()
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
|
||||
await tb.qsfp1_mac.rx.send(pkt)
|
||||
await tb.qsfp_mac[0].rx.send(pkt)
|
||||
|
||||
pkt = await tb.driver.interfaces[0].recv()
|
||||
|
||||
|
@ -254,159 +254,34 @@ class TB(object):
|
||||
cocotb.start_soon(Clock(dut.ptp_sample_clk, 10, units="ns").start())
|
||||
|
||||
# Ethernet
|
||||
cocotb.start_soon(Clock(dut.qsfp1_mac_1_rx_clk, 2.482, units="ns").start())
|
||||
cocotb.start_soon(Clock(dut.qsfp1_mac_1_tx_clk, 2.482, units="ns").start())
|
||||
self.qsfp_mac = []
|
||||
|
||||
self.qsfp1_mac_1 = EthMac(
|
||||
tx_clk=dut.qsfp1_mac_1_tx_clk,
|
||||
tx_rst=dut.qsfp1_mac_1_tx_rst,
|
||||
tx_bus=AxiStreamBus.from_prefix(dut, "qsfp1_mac_1_tx_axis"),
|
||||
tx_ptp_time=dut.qsfp1_mac_1_tx_ptp_time,
|
||||
tx_ptp_ts=dut.qsfp1_mac_1_tx_ptp_ts,
|
||||
tx_ptp_ts_tag=dut.qsfp1_mac_1_tx_ptp_ts_tag,
|
||||
tx_ptp_ts_valid=dut.qsfp1_mac_1_tx_ptp_ts_valid,
|
||||
rx_clk=dut.qsfp1_mac_1_rx_clk,
|
||||
rx_rst=dut.qsfp1_mac_1_rx_rst,
|
||||
rx_bus=AxiStreamBus.from_prefix(dut, "qsfp1_mac_1_rx_axis"),
|
||||
rx_ptp_time=dut.qsfp1_mac_1_rx_ptp_time,
|
||||
ifg=12, speed=10e9
|
||||
)
|
||||
for x in range(1, 3):
|
||||
macs = []
|
||||
for y in range(1, 5):
|
||||
cocotb.start_soon(Clock(getattr(dut, f"qsfp{x}_mac_{y}_rx_clk"), 2.482, units="ns").start())
|
||||
cocotb.start_soon(Clock(getattr(dut, f"qsfp{x}_mac_{y}_tx_clk"), 2.482, units="ns").start())
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp1_mac_2_rx_clk, 2.482, units="ns").start())
|
||||
cocotb.start_soon(Clock(dut.qsfp1_mac_2_tx_clk, 2.482, units="ns").start())
|
||||
mac = EthMac(
|
||||
tx_clk=getattr(dut, f"qsfp{x}_mac_{y}_tx_clk"),
|
||||
tx_rst=getattr(dut, f"qsfp{x}_mac_{y}_tx_rst"),
|
||||
tx_bus=AxiStreamBus.from_prefix(dut, f"qsfp{x}_mac_{y}_tx_axis"),
|
||||
tx_ptp_time=getattr(dut, f"qsfp{x}_mac_{y}_tx_ptp_time"),
|
||||
tx_ptp_ts=getattr(dut, f"qsfp{x}_mac_{y}_tx_ptp_ts"),
|
||||
tx_ptp_ts_tag=getattr(dut, f"qsfp{x}_mac_{y}_tx_ptp_ts_tag"),
|
||||
tx_ptp_ts_valid=getattr(dut, f"qsfp{x}_mac_{y}_tx_ptp_ts_valid"),
|
||||
rx_clk=getattr(dut, f"qsfp{x}_mac_{y}_rx_clk"),
|
||||
rx_rst=getattr(dut, f"qsfp{x}_mac_{y}_rx_rst"),
|
||||
rx_bus=AxiStreamBus.from_prefix(dut, f"qsfp{x}_mac_{y}_rx_axis"),
|
||||
rx_ptp_time=getattr(dut, f"qsfp{x}_mac_{y}_rx_ptp_time"),
|
||||
ifg=12, speed=25e9
|
||||
)
|
||||
|
||||
self.qsfp1_mac_2 = EthMac(
|
||||
tx_clk=dut.qsfp1_mac_2_tx_clk,
|
||||
tx_rst=dut.qsfp1_mac_2_tx_rst,
|
||||
tx_bus=AxiStreamBus.from_prefix(dut, "qsfp1_mac_2_tx_axis"),
|
||||
tx_ptp_time=dut.qsfp1_mac_2_tx_ptp_time,
|
||||
tx_ptp_ts=dut.qsfp1_mac_2_tx_ptp_ts,
|
||||
tx_ptp_ts_tag=dut.qsfp1_mac_2_tx_ptp_ts_tag,
|
||||
tx_ptp_ts_valid=dut.qsfp1_mac_2_tx_ptp_ts_valid,
|
||||
rx_clk=dut.qsfp1_mac_2_rx_clk,
|
||||
rx_rst=dut.qsfp1_mac_2_rx_rst,
|
||||
rx_bus=AxiStreamBus.from_prefix(dut, "qsfp1_mac_2_rx_axis"),
|
||||
rx_ptp_time=dut.qsfp1_mac_2_rx_ptp_time,
|
||||
ifg=12, speed=10e9
|
||||
)
|
||||
macs.append(mac)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp1_mac_3_rx_clk, 2.482, units="ns").start())
|
||||
cocotb.start_soon(Clock(dut.qsfp1_mac_3_tx_clk, 2.482, units="ns").start())
|
||||
getattr(dut, f"qsfp{x}_mac_{y}_rx_status").setimmediatevalue(1)
|
||||
|
||||
self.qsfp1_mac_3 = EthMac(
|
||||
tx_clk=dut.qsfp1_mac_3_tx_clk,
|
||||
tx_rst=dut.qsfp1_mac_3_tx_rst,
|
||||
tx_bus=AxiStreamBus.from_prefix(dut, "qsfp1_mac_3_tx_axis"),
|
||||
tx_ptp_time=dut.qsfp1_mac_3_tx_ptp_time,
|
||||
tx_ptp_ts=dut.qsfp1_mac_3_tx_ptp_ts,
|
||||
tx_ptp_ts_tag=dut.qsfp1_mac_3_tx_ptp_ts_tag,
|
||||
tx_ptp_ts_valid=dut.qsfp1_mac_3_tx_ptp_ts_valid,
|
||||
rx_clk=dut.qsfp1_mac_3_rx_clk,
|
||||
rx_rst=dut.qsfp1_mac_3_rx_rst,
|
||||
rx_bus=AxiStreamBus.from_prefix(dut, "qsfp1_mac_3_rx_axis"),
|
||||
rx_ptp_time=dut.qsfp1_mac_3_rx_ptp_time,
|
||||
ifg=12, speed=10e9
|
||||
)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp1_mac_4_rx_clk, 2.482, units="ns").start())
|
||||
cocotb.start_soon(Clock(dut.qsfp1_mac_4_tx_clk, 2.482, units="ns").start())
|
||||
|
||||
self.qsfp1_mac_4 = EthMac(
|
||||
tx_clk=dut.qsfp1_mac_4_tx_clk,
|
||||
tx_rst=dut.qsfp1_mac_4_tx_rst,
|
||||
tx_bus=AxiStreamBus.from_prefix(dut, "qsfp1_mac_4_tx_axis"),
|
||||
tx_ptp_time=dut.qsfp1_mac_4_tx_ptp_time,
|
||||
tx_ptp_ts=dut.qsfp1_mac_4_tx_ptp_ts,
|
||||
tx_ptp_ts_tag=dut.qsfp1_mac_4_tx_ptp_ts_tag,
|
||||
tx_ptp_ts_valid=dut.qsfp1_mac_4_tx_ptp_ts_valid,
|
||||
rx_clk=dut.qsfp1_mac_4_rx_clk,
|
||||
rx_rst=dut.qsfp1_mac_4_rx_rst,
|
||||
rx_bus=AxiStreamBus.from_prefix(dut, "qsfp1_mac_4_rx_axis"),
|
||||
rx_ptp_time=dut.qsfp1_mac_4_rx_ptp_time,
|
||||
ifg=12, speed=10e9
|
||||
)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp2_mac_1_rx_clk, 2.482, units="ns").start())
|
||||
cocotb.start_soon(Clock(dut.qsfp2_mac_1_tx_clk, 2.482, units="ns").start())
|
||||
|
||||
self.qsfp2_mac_1 = EthMac(
|
||||
tx_clk=dut.qsfp2_mac_1_tx_clk,
|
||||
tx_rst=dut.qsfp2_mac_1_tx_rst,
|
||||
tx_bus=AxiStreamBus.from_prefix(dut, "qsfp2_mac_1_tx_axis"),
|
||||
tx_ptp_time=dut.qsfp2_mac_1_tx_ptp_time,
|
||||
tx_ptp_ts=dut.qsfp2_mac_1_tx_ptp_ts,
|
||||
tx_ptp_ts_tag=dut.qsfp2_mac_1_tx_ptp_ts_tag,
|
||||
tx_ptp_ts_valid=dut.qsfp2_mac_1_tx_ptp_ts_valid,
|
||||
rx_clk=dut.qsfp2_mac_1_rx_clk,
|
||||
rx_rst=dut.qsfp2_mac_1_rx_rst,
|
||||
rx_bus=AxiStreamBus.from_prefix(dut, "qsfp2_mac_1_rx_axis"),
|
||||
rx_ptp_time=dut.qsfp2_mac_1_rx_ptp_time,
|
||||
ifg=12, speed=10e9
|
||||
)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp2_mac_2_rx_clk, 2.482, units="ns").start())
|
||||
cocotb.start_soon(Clock(dut.qsfp2_mac_2_tx_clk, 2.482, units="ns").start())
|
||||
|
||||
self.qsfp2_mac_2 = EthMac(
|
||||
tx_clk=dut.qsfp2_mac_2_tx_clk,
|
||||
tx_rst=dut.qsfp2_mac_2_tx_rst,
|
||||
tx_bus=AxiStreamBus.from_prefix(dut, "qsfp2_mac_2_tx_axis"),
|
||||
tx_ptp_time=dut.qsfp2_mac_2_tx_ptp_time,
|
||||
tx_ptp_ts=dut.qsfp2_mac_2_tx_ptp_ts,
|
||||
tx_ptp_ts_tag=dut.qsfp2_mac_2_tx_ptp_ts_tag,
|
||||
tx_ptp_ts_valid=dut.qsfp2_mac_2_tx_ptp_ts_valid,
|
||||
rx_clk=dut.qsfp2_mac_2_rx_clk,
|
||||
rx_rst=dut.qsfp2_mac_2_rx_rst,
|
||||
rx_bus=AxiStreamBus.from_prefix(dut, "qsfp2_mac_2_rx_axis"),
|
||||
rx_ptp_time=dut.qsfp2_mac_2_rx_ptp_time,
|
||||
ifg=12, speed=10e9
|
||||
)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp2_mac_3_rx_clk, 2.482, units="ns").start())
|
||||
cocotb.start_soon(Clock(dut.qsfp2_mac_3_tx_clk, 2.482, units="ns").start())
|
||||
|
||||
self.qsfp2_mac_3 = EthMac(
|
||||
tx_clk=dut.qsfp2_mac_3_tx_clk,
|
||||
tx_rst=dut.qsfp2_mac_3_tx_rst,
|
||||
tx_bus=AxiStreamBus.from_prefix(dut, "qsfp2_mac_3_tx_axis"),
|
||||
tx_ptp_time=dut.qsfp2_mac_3_tx_ptp_time,
|
||||
tx_ptp_ts=dut.qsfp2_mac_3_tx_ptp_ts,
|
||||
tx_ptp_ts_tag=dut.qsfp2_mac_3_tx_ptp_ts_tag,
|
||||
tx_ptp_ts_valid=dut.qsfp2_mac_3_tx_ptp_ts_valid,
|
||||
rx_clk=dut.qsfp2_mac_3_rx_clk,
|
||||
rx_rst=dut.qsfp2_mac_3_rx_rst,
|
||||
rx_bus=AxiStreamBus.from_prefix(dut, "qsfp2_mac_3_rx_axis"),
|
||||
rx_ptp_time=dut.qsfp2_mac_3_rx_ptp_time,
|
||||
ifg=12, speed=10e9
|
||||
)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp2_mac_4_rx_clk, 2.482, units="ns").start())
|
||||
cocotb.start_soon(Clock(dut.qsfp2_mac_4_tx_clk, 2.482, units="ns").start())
|
||||
|
||||
self.qsfp2_mac_4 = EthMac(
|
||||
tx_clk=dut.qsfp2_mac_4_tx_clk,
|
||||
tx_rst=dut.qsfp2_mac_4_tx_rst,
|
||||
tx_bus=AxiStreamBus.from_prefix(dut, "qsfp2_mac_4_tx_axis"),
|
||||
tx_ptp_time=dut.qsfp2_mac_4_tx_ptp_time,
|
||||
tx_ptp_ts=dut.qsfp2_mac_4_tx_ptp_ts,
|
||||
tx_ptp_ts_tag=dut.qsfp2_mac_4_tx_ptp_ts_tag,
|
||||
tx_ptp_ts_valid=dut.qsfp2_mac_4_tx_ptp_ts_valid,
|
||||
rx_clk=dut.qsfp2_mac_4_rx_clk,
|
||||
rx_rst=dut.qsfp2_mac_4_rx_rst,
|
||||
rx_bus=AxiStreamBus.from_prefix(dut, "qsfp2_mac_4_rx_axis"),
|
||||
rx_ptp_time=dut.qsfp2_mac_4_rx_ptp_time,
|
||||
ifg=12, speed=10e9
|
||||
)
|
||||
|
||||
dut.qsfp1_mac_1_rx_status.setimmediatevalue(1)
|
||||
dut.qsfp1_mac_2_rx_status.setimmediatevalue(1)
|
||||
dut.qsfp1_mac_3_rx_status.setimmediatevalue(1)
|
||||
dut.qsfp1_mac_4_rx_status.setimmediatevalue(1)
|
||||
|
||||
dut.qsfp2_mac_1_rx_status.setimmediatevalue(1)
|
||||
dut.qsfp2_mac_2_rx_status.setimmediatevalue(1)
|
||||
dut.qsfp2_mac_3_rx_status.setimmediatevalue(1)
|
||||
dut.qsfp2_mac_4_rx_status.setimmediatevalue(1)
|
||||
self.qsfp_mac.append(macs)
|
||||
|
||||
dut.user_pb.setimmediatevalue(0)
|
||||
|
||||
@ -419,43 +294,19 @@ class TB(object):
|
||||
async def init(self):
|
||||
|
||||
self.dut.ptp_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp1_mac_1_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp1_mac_1_tx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp1_mac_2_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp1_mac_2_tx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp1_mac_3_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp1_mac_3_tx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp1_mac_4_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp1_mac_4_tx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp2_mac_1_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp2_mac_1_tx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp2_mac_2_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp2_mac_2_tx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp2_mac_3_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp2_mac_3_tx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp2_mac_4_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp2_mac_4_tx_rst.setimmediatevalue(0)
|
||||
for x in range(1, 3):
|
||||
for y in range(1, 5):
|
||||
getattr(self.dut, f"qsfp{x}_mac_{y}_rx_rst").setimmediatevalue(0)
|
||||
getattr(self.dut, f"qsfp{x}_mac_{y}_tx_rst").setimmediatevalue(0)
|
||||
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
|
||||
self.dut.ptp_rst.setimmediatevalue(1)
|
||||
self.dut.qsfp1_mac_1_rx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfp1_mac_1_tx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfp1_mac_2_rx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfp1_mac_2_tx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfp1_mac_3_rx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfp1_mac_3_tx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfp1_mac_4_rx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfp1_mac_4_tx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfp2_mac_1_rx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfp2_mac_1_tx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfp2_mac_2_rx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfp2_mac_2_tx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfp2_mac_3_rx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfp2_mac_3_tx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfp2_mac_4_rx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfp2_mac_4_tx_rst.setimmediatevalue(1)
|
||||
for x in range(1, 3):
|
||||
for y in range(1, 5):
|
||||
getattr(self.dut, f"qsfp{x}_mac_{y}_rx_rst").setimmediatevalue(1)
|
||||
getattr(self.dut, f"qsfp{x}_mac_{y}_tx_rst").setimmediatevalue(1)
|
||||
|
||||
await FallingEdge(self.dut.rst_250mhz)
|
||||
await Timer(100, 'ns')
|
||||
@ -464,22 +315,10 @@ class TB(object):
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
|
||||
self.dut.ptp_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp1_mac_1_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp1_mac_1_tx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp1_mac_2_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp1_mac_2_tx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp1_mac_3_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp1_mac_3_tx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp1_mac_4_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp1_mac_4_tx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp2_mac_1_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp2_mac_1_tx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp2_mac_2_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp2_mac_2_tx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp2_mac_3_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp2_mac_3_tx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp2_mac_4_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp2_mac_4_tx_rst.setimmediatevalue(0)
|
||||
for x in range(1, 3):
|
||||
for y in range(1, 5):
|
||||
getattr(self.dut, f"qsfp{x}_mac_{y}_rx_rst").setimmediatevalue(0)
|
||||
getattr(self.dut, f"qsfp{x}_mac_{y}_tx_rst").setimmediatevalue(0)
|
||||
|
||||
await self.rc.enumerate()
|
||||
|
||||
@ -488,22 +327,10 @@ class TB(object):
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
|
||||
if self.loopback_enable:
|
||||
if not self.qsfp1_mac_1.tx.empty():
|
||||
await self.qsfp1_mac_1.rx.send(await self.qsfp1_mac_1.tx.recv())
|
||||
if not self.qsfp1_mac_2.tx.empty():
|
||||
await self.qsfp1_mac_2.rx.send(await self.qsfp1_mac_2.tx.recv())
|
||||
if not self.qsfp1_mac_3.tx.empty():
|
||||
await self.qsfp1_mac_3.rx.send(await self.qsfp1_mac_3.tx.recv())
|
||||
if not self.qsfp1_mac_4.tx.empty():
|
||||
await self.qsfp1_mac_4.rx.send(await self.qsfp1_mac_4.tx.recv())
|
||||
if not self.qsfp2_mac_1.tx.empty():
|
||||
await self.qsfp2_mac_1.rx.send(await self.qsfp2_mac_1.tx.recv())
|
||||
if not self.qsfp2_mac_2.tx.empty():
|
||||
await self.qsfp2_mac_2.rx.send(await self.qsfp2_mac_2.tx.recv())
|
||||
if not self.qsfp2_mac_3.tx.empty():
|
||||
await self.qsfp2_mac_3.rx.send(await self.qsfp2_mac_3.tx.recv())
|
||||
if not self.qsfp2_mac_4.tx.empty():
|
||||
await self.qsfp2_mac_4.rx.send(await self.qsfp2_mac_4.tx.recv())
|
||||
for macs in self.qsfp_mac:
|
||||
for mac in macs:
|
||||
if not mac.tx.empty():
|
||||
await mac.rx.send(await mac.tx.recv())
|
||||
|
||||
|
||||
@cocotb.test()
|
||||
@ -534,10 +361,10 @@ async def run_test_nic(dut):
|
||||
|
||||
await tb.driver.interfaces[0].start_xmit(data, 0)
|
||||
|
||||
pkt = await tb.qsfp1_mac_1.tx.recv()
|
||||
pkt = await tb.qsfp_mac[0][0].tx.recv()
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
|
||||
await tb.qsfp1_mac_1.rx.send(pkt)
|
||||
await tb.qsfp_mac[0][0].rx.send(pkt)
|
||||
|
||||
pkt = await tb.driver.interfaces[0].recv()
|
||||
|
||||
@ -546,10 +373,10 @@ async def run_test_nic(dut):
|
||||
|
||||
# await tb.driver.interfaces[1].start_xmit(data, 0)
|
||||
|
||||
# pkt = await tb.qsfp2_mac_1.tx.recv()
|
||||
# pkt = await tb.qsfp_mac[1][0].tx.recv()
|
||||
# tb.log.info("Packet: %s", pkt)
|
||||
|
||||
# await tb.qsfp2_mac_1.rx.send(pkt)
|
||||
# await tb.qsfp_mac[1][0].rx.send(pkt)
|
||||
|
||||
# pkt = await tb.driver.interfaces[1].recv()
|
||||
|
||||
@ -569,10 +396,10 @@ async def run_test_nic(dut):
|
||||
|
||||
await tb.driver.interfaces[0].start_xmit(test_pkt2.build(), 0, 34, 6)
|
||||
|
||||
pkt = await tb.qsfp1_mac_1.tx.recv()
|
||||
pkt = await tb.qsfp_mac[0][0].tx.recv()
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
|
||||
await tb.qsfp1_mac_1.rx.send(pkt)
|
||||
await tb.qsfp_mac[0][0].rx.send(pkt)
|
||||
|
||||
pkt = await tb.driver.interfaces[0].recv()
|
||||
|
||||
|
@ -199,71 +199,26 @@ class TB(object):
|
||||
cocotb.start_soon(Clock(dut.ptp_sample_clk, 8, units="ns").start())
|
||||
|
||||
# Ethernet
|
||||
cocotb.start_soon(Clock(dut.qsfp0_rx_clk_1, 2.56, units="ns").start())
|
||||
self.qsfp0_1_source = XgmiiSource(dut.qsfp0_rxd_1, dut.qsfp0_rxc_1, dut.qsfp0_rx_clk_1, dut.qsfp0_rx_rst_1)
|
||||
cocotb.start_soon(Clock(dut.qsfp0_tx_clk_1, 2.56, units="ns").start())
|
||||
self.qsfp0_1_sink = XgmiiSink(dut.qsfp0_txd_1, dut.qsfp0_txc_1, dut.qsfp0_tx_clk_1, dut.qsfp0_tx_rst_1)
|
||||
self.qsfp_source = []
|
||||
self.qsfp_sink = []
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp0_rx_clk_2, 2.56, units="ns").start())
|
||||
self.qsfp0_2_source = XgmiiSource(dut.qsfp0_rxd_2, dut.qsfp0_rxc_2, dut.qsfp0_rx_clk_2, dut.qsfp0_rx_rst_2)
|
||||
cocotb.start_soon(Clock(dut.qsfp0_tx_clk_2, 2.56, units="ns").start())
|
||||
self.qsfp0_2_sink = XgmiiSink(dut.qsfp0_txd_2, dut.qsfp0_txc_2, dut.qsfp0_tx_clk_2, dut.qsfp0_tx_rst_2)
|
||||
for x in range(2):
|
||||
sources = []
|
||||
sinks = []
|
||||
for y in range(1, 5):
|
||||
cocotb.start_soon(Clock(getattr(dut, f"qsfp{x}_rx_clk_{y}"), 2.56, units="ns").start())
|
||||
source = XgmiiSource(getattr(dut, f"qsfp{x}_rxd_{y}"), getattr(dut, f"qsfp{x}_rxc_{y}"), getattr(dut, f"qsfp{x}_rx_clk_{y}"), getattr(dut, f"qsfp{x}_rx_rst_{y}"))
|
||||
sources.append(source)
|
||||
cocotb.start_soon(Clock(getattr(dut, f"qsfp{x}_tx_clk_{y}"), 2.56, units="ns").start())
|
||||
sink = XgmiiSink(getattr(dut, f"qsfp{x}_txd_{y}"), getattr(dut, f"qsfp{x}_txc_{y}"), getattr(dut, f"qsfp{x}_tx_clk_{y}"), getattr(dut, f"qsfp{x}_tx_rst_{y}"))
|
||||
sinks.append(sink)
|
||||
getattr(dut, f"qsfp{x}_rx_status_{y}").setimmediatevalue(1)
|
||||
getattr(dut, f"qsfp{x}_rx_error_count_{y}").setimmediatevalue(0)
|
||||
self.qsfp_source.append(sources)
|
||||
self.qsfp_sink.append(sinks)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp0_rx_clk_3, 2.56, units="ns").start())
|
||||
self.qsfp0_3_source = XgmiiSource(dut.qsfp0_rxd_3, dut.qsfp0_rxc_3, dut.qsfp0_rx_clk_3, dut.qsfp0_rx_rst_3)
|
||||
cocotb.start_soon(Clock(dut.qsfp0_tx_clk_3, 2.56, units="ns").start())
|
||||
self.qsfp0_3_sink = XgmiiSink(dut.qsfp0_txd_3, dut.qsfp0_txc_3, dut.qsfp0_tx_clk_3, dut.qsfp0_tx_rst_3)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp0_rx_clk_4, 2.56, units="ns").start())
|
||||
self.qsfp0_4_source = XgmiiSource(dut.qsfp0_rxd_4, dut.qsfp0_rxc_4, dut.qsfp0_rx_clk_4, dut.qsfp0_rx_rst_4)
|
||||
cocotb.start_soon(Clock(dut.qsfp0_tx_clk_4, 2.56, units="ns").start())
|
||||
self.qsfp0_4_sink = XgmiiSink(dut.qsfp0_txd_4, dut.qsfp0_txc_4, dut.qsfp0_tx_clk_4, dut.qsfp0_tx_rst_4)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp1_rx_clk_1, 2.56, units="ns").start())
|
||||
self.qsfp1_1_source = XgmiiSource(dut.qsfp1_rxd_1, dut.qsfp1_rxc_1, dut.qsfp1_rx_clk_1, dut.qsfp1_rx_rst_1)
|
||||
cocotb.start_soon(Clock(dut.qsfp1_tx_clk_1, 2.56, units="ns").start())
|
||||
self.qsfp1_1_sink = XgmiiSink(dut.qsfp1_txd_1, dut.qsfp1_txc_1, dut.qsfp1_tx_clk_1, dut.qsfp1_tx_rst_1)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp1_rx_clk_2, 2.56, units="ns").start())
|
||||
self.qsfp1_2_source = XgmiiSource(dut.qsfp1_rxd_2, dut.qsfp1_rxc_2, dut.qsfp1_rx_clk_2, dut.qsfp1_rx_rst_2)
|
||||
cocotb.start_soon(Clock(dut.qsfp1_tx_clk_2, 2.56, units="ns").start())
|
||||
self.qsfp1_2_sink = XgmiiSink(dut.qsfp1_txd_2, dut.qsfp1_txc_2, dut.qsfp1_tx_clk_2, dut.qsfp1_tx_rst_2)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp1_rx_clk_3, 2.56, units="ns").start())
|
||||
self.qsfp1_3_source = XgmiiSource(dut.qsfp1_rxd_3, dut.qsfp1_rxc_3, dut.qsfp1_rx_clk_3, dut.qsfp1_rx_rst_3)
|
||||
cocotb.start_soon(Clock(dut.qsfp1_tx_clk_3, 2.56, units="ns").start())
|
||||
self.qsfp1_3_sink = XgmiiSink(dut.qsfp1_txd_3, dut.qsfp1_txc_3, dut.qsfp1_tx_clk_3, dut.qsfp1_tx_rst_3)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp1_rx_clk_4, 2.56, units="ns").start())
|
||||
self.qsfp1_4_source = XgmiiSource(dut.qsfp1_rxd_4, dut.qsfp1_rxc_4, dut.qsfp1_rx_clk_4, dut.qsfp1_rx_rst_4)
|
||||
cocotb.start_soon(Clock(dut.qsfp1_tx_clk_4, 2.56, units="ns").start())
|
||||
self.qsfp1_4_sink = XgmiiSink(dut.qsfp1_txd_4, dut.qsfp1_txc_4, dut.qsfp1_tx_clk_4, dut.qsfp1_tx_rst_4)
|
||||
|
||||
dut.qsfp0_rx_status_1.setimmediatevalue(1)
|
||||
dut.qsfp0_rx_status_2.setimmediatevalue(1)
|
||||
dut.qsfp0_rx_status_3.setimmediatevalue(1)
|
||||
dut.qsfp0_rx_status_4.setimmediatevalue(1)
|
||||
|
||||
dut.qsfp1_rx_status_1.setimmediatevalue(1)
|
||||
dut.qsfp1_rx_status_2.setimmediatevalue(1)
|
||||
dut.qsfp1_rx_status_3.setimmediatevalue(1)
|
||||
dut.qsfp1_rx_status_4.setimmediatevalue(1)
|
||||
|
||||
dut.qsfp0_rx_error_count_1.setimmediatevalue(0)
|
||||
dut.qsfp0_rx_error_count_2.setimmediatevalue(0)
|
||||
dut.qsfp0_rx_error_count_3.setimmediatevalue(0)
|
||||
dut.qsfp0_rx_error_count_4.setimmediatevalue(0)
|
||||
|
||||
dut.qsfp1_rx_error_count_1.setimmediatevalue(0)
|
||||
dut.qsfp1_rx_error_count_2.setimmediatevalue(0)
|
||||
dut.qsfp1_rx_error_count_3.setimmediatevalue(0)
|
||||
dut.qsfp1_rx_error_count_4.setimmediatevalue(0)
|
||||
|
||||
dut.qsfp0_modprs_l.setimmediatevalue(0)
|
||||
dut.qsfp0_int_l.setimmediatevalue(1)
|
||||
|
||||
dut.qsfp1_modprs_l.setimmediatevalue(0)
|
||||
dut.qsfp1_int_l.setimmediatevalue(1)
|
||||
getattr(dut, f"qsfp{x}_modprs_l").setimmediatevalue(0)
|
||||
getattr(dut, f"qsfp{x}_int_l").setimmediatevalue(1)
|
||||
|
||||
dut.qsfp_i2c_scl_i.setimmediatevalue(1)
|
||||
dut.qsfp_i2c_sda_i.setimmediatevalue(1)
|
||||
@ -274,43 +229,19 @@ class TB(object):
|
||||
async def init(self):
|
||||
|
||||
self.dut.ptp_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp0_rx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp0_tx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp0_rx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp0_tx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp0_rx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp0_tx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp0_rx_rst_4.setimmediatevalue(0)
|
||||
self.dut.qsfp0_tx_rst_4.setimmediatevalue(0)
|
||||
self.dut.qsfp1_rx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp1_tx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp1_rx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp1_tx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp1_rx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp1_tx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp1_rx_rst_4.setimmediatevalue(0)
|
||||
self.dut.qsfp1_tx_rst_4.setimmediatevalue(0)
|
||||
for x in range(2):
|
||||
for y in range(1, 5):
|
||||
getattr(self.dut, f"qsfp{x}_rx_rst_{y}").setimmediatevalue(0)
|
||||
getattr(self.dut, f"qsfp{x}_tx_rst_{y}").setimmediatevalue(0)
|
||||
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
|
||||
self.dut.ptp_rst.setimmediatevalue(1)
|
||||
self.dut.qsfp0_rx_rst_1.setimmediatevalue(1)
|
||||
self.dut.qsfp0_tx_rst_1.setimmediatevalue(1)
|
||||
self.dut.qsfp0_rx_rst_2.setimmediatevalue(1)
|
||||
self.dut.qsfp0_tx_rst_2.setimmediatevalue(1)
|
||||
self.dut.qsfp0_rx_rst_3.setimmediatevalue(1)
|
||||
self.dut.qsfp0_tx_rst_3.setimmediatevalue(1)
|
||||
self.dut.qsfp0_rx_rst_4.setimmediatevalue(1)
|
||||
self.dut.qsfp0_tx_rst_4.setimmediatevalue(1)
|
||||
self.dut.qsfp1_rx_rst_1.setimmediatevalue(1)
|
||||
self.dut.qsfp1_tx_rst_1.setimmediatevalue(1)
|
||||
self.dut.qsfp1_rx_rst_2.setimmediatevalue(1)
|
||||
self.dut.qsfp1_tx_rst_2.setimmediatevalue(1)
|
||||
self.dut.qsfp1_rx_rst_3.setimmediatevalue(1)
|
||||
self.dut.qsfp1_tx_rst_3.setimmediatevalue(1)
|
||||
self.dut.qsfp1_rx_rst_4.setimmediatevalue(1)
|
||||
self.dut.qsfp1_tx_rst_4.setimmediatevalue(1)
|
||||
for x in range(2):
|
||||
for y in range(1, 5):
|
||||
getattr(self.dut, f"qsfp{x}_rx_rst_{y}").setimmediatevalue(1)
|
||||
getattr(self.dut, f"qsfp{x}_tx_rst_{y}").setimmediatevalue(1)
|
||||
|
||||
await FallingEdge(self.dut.rst_250mhz)
|
||||
await Timer(100, 'ns')
|
||||
@ -319,22 +250,10 @@ class TB(object):
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
|
||||
self.dut.ptp_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp0_rx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp0_tx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp0_rx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp0_tx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp0_rx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp0_tx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp0_rx_rst_4.setimmediatevalue(0)
|
||||
self.dut.qsfp0_tx_rst_4.setimmediatevalue(0)
|
||||
self.dut.qsfp1_rx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp1_tx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp1_rx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp1_tx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp1_rx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp1_tx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp1_rx_rst_4.setimmediatevalue(0)
|
||||
self.dut.qsfp1_tx_rst_4.setimmediatevalue(0)
|
||||
for x in range(2):
|
||||
for y in range(1, 5):
|
||||
getattr(self.dut, f"qsfp{x}_rx_rst_{y}").setimmediatevalue(0)
|
||||
getattr(self.dut, f"qsfp{x}_tx_rst_{y}").setimmediatevalue(0)
|
||||
|
||||
await self.rc.enumerate()
|
||||
|
||||
@ -343,22 +262,10 @@ class TB(object):
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
|
||||
if self.loopback_enable:
|
||||
if not self.qsfp0_1_sink.empty():
|
||||
await self.qsfp0_1_source.send(await self.qsfp0_1_sink.recv())
|
||||
if not self.qsfp0_2_sink.empty():
|
||||
await self.qsfp0_2_source.send(await self.qsfp0_2_sink.recv())
|
||||
if not self.qsfp0_3_sink.empty():
|
||||
await self.qsfp0_3_source.send(await self.qsfp0_3_sink.recv())
|
||||
if not self.qsfp0_4_sink.empty():
|
||||
await self.qsfp0_4_source.send(await self.qsfp0_4_sink.recv())
|
||||
if not self.qsfp1_1_sink.empty():
|
||||
await self.qsfp1_1_source.send(await self.qsfp1_1_sink.recv())
|
||||
if not self.qsfp1_2_sink.empty():
|
||||
await self.qsfp1_2_source.send(await self.qsfp1_2_sink.recv())
|
||||
if not self.qsfp1_3_sink.empty():
|
||||
await self.qsfp1_3_source.send(await self.qsfp1_3_sink.recv())
|
||||
if not self.qsfp1_4_sink.empty():
|
||||
await self.qsfp1_4_source.send(await self.qsfp1_4_sink.recv())
|
||||
for x in range(len(self.qsfp_sink)):
|
||||
for y in range(len(self.qsfp_sink[x])):
|
||||
if not self.qsfp_sink[x][y].empty():
|
||||
await self.qsfp_source[x][y].send(await self.qsfp_sink[x][y].recv())
|
||||
|
||||
|
||||
@cocotb.test()
|
||||
@ -389,10 +296,10 @@ async def run_test_nic(dut):
|
||||
|
||||
await tb.driver.interfaces[0].start_xmit(data, 0)
|
||||
|
||||
pkt = await tb.qsfp0_1_sink.recv()
|
||||
pkt = await tb.qsfp_sink[0][0].recv()
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
|
||||
await tb.qsfp0_1_source.send(pkt)
|
||||
await tb.qsfp_source[0][0].send(pkt)
|
||||
|
||||
pkt = await tb.driver.interfaces[0].recv()
|
||||
|
||||
@ -401,10 +308,10 @@ async def run_test_nic(dut):
|
||||
|
||||
# await tb.driver.interfaces[1].start_xmit(data, 0)
|
||||
|
||||
# pkt = await tb.qsfp1_1_sink.recv()
|
||||
# pkt = await tb.qsfp_sink[1][0].recv()
|
||||
# tb.log.info("Packet: %s", pkt)
|
||||
|
||||
# await tb.qsfp1_1_source.send(pkt)
|
||||
# await tb.qsfp_source[1][0].send(pkt)
|
||||
|
||||
# pkt = await tb.driver.interfaces[1].recv()
|
||||
|
||||
@ -424,10 +331,10 @@ async def run_test_nic(dut):
|
||||
|
||||
await tb.driver.interfaces[0].start_xmit(test_pkt2.build(), 0, 34, 6)
|
||||
|
||||
pkt = await tb.qsfp0_1_sink.recv()
|
||||
pkt = await tb.qsfp_sink[0][0].recv()
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
|
||||
await tb.qsfp0_1_source.send(pkt)
|
||||
await tb.qsfp_source[0][0].send(pkt)
|
||||
|
||||
pkt = await tb.driver.interfaces[0].recv()
|
||||
|
||||
|
@ -254,89 +254,40 @@ class TB(object):
|
||||
cocotb.start_soon(Clock(dut.ptp_sample_clk, 10, units="ns").start())
|
||||
|
||||
# Ethernet
|
||||
cocotb.start_soon(Clock(dut.qsfpdd0_mac_1_clk, 2.482, units="ns").start())
|
||||
self.qsfpdd_mac = []
|
||||
|
||||
self.qsfpdd0_mac_1 = EthMac(
|
||||
tx_clk=dut.qsfpdd0_mac_1_clk,
|
||||
tx_rst=dut.qsfpdd0_mac_1_rst,
|
||||
tx_bus=AxiStreamBus.from_prefix(dut, "qsfpdd0_mac_1_tx_axis"),
|
||||
tx_ptp_time=dut.qsfpdd0_mac_1_ptp_time,
|
||||
tx_ptp_ts=dut.qsfpdd0_mac_1_tx_ptp_ts,
|
||||
tx_ptp_ts_tag=dut.qsfpdd0_mac_1_tx_ptp_ts_tag,
|
||||
tx_ptp_ts_valid=dut.qsfpdd0_mac_1_tx_ptp_ts_valid,
|
||||
rx_clk=dut.qsfpdd0_mac_1_clk,
|
||||
rx_rst=dut.qsfpdd0_mac_1_rst,
|
||||
rx_bus=AxiStreamBus.from_prefix(dut, "qsfpdd0_mac_1_rx_axis"),
|
||||
rx_ptp_time=dut.qsfpdd0_mac_1_ptp_time,
|
||||
ifg=12, speed=100e9
|
||||
)
|
||||
for x in range(2):
|
||||
macs = []
|
||||
for y in range(1, 3):
|
||||
cocotb.start_soon(Clock(getattr(dut, f"qsfpdd{x}_mac_{y}_clk"), 2.482, units="ns").start())
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfpdd0_mac_2_clk, 2.482, units="ns").start())
|
||||
mac = EthMac(
|
||||
tx_clk=getattr(dut, f"qsfpdd{x}_mac_{y}_clk"),
|
||||
tx_rst=getattr(dut, f"qsfpdd{x}_mac_{y}_rst"),
|
||||
tx_bus=AxiStreamBus.from_prefix(dut, f"qsfpdd{x}_mac_{y}_tx_axis"),
|
||||
tx_ptp_time=getattr(dut, f"qsfpdd{x}_mac_{y}_ptp_time"),
|
||||
tx_ptp_ts=getattr(dut, f"qsfpdd{x}_mac_{y}_tx_ptp_ts"),
|
||||
tx_ptp_ts_tag=getattr(dut, f"qsfpdd{x}_mac_{y}_tx_ptp_ts_tag"),
|
||||
tx_ptp_ts_valid=getattr(dut, f"qsfpdd{x}_mac_{y}_tx_ptp_ts_valid"),
|
||||
rx_clk=getattr(dut, f"qsfpdd{x}_mac_{y}_clk"),
|
||||
rx_rst=getattr(dut, f"qsfpdd{x}_mac_{y}_rst"),
|
||||
rx_bus=AxiStreamBus.from_prefix(dut, f"qsfpdd{x}_mac_{y}_rx_axis"),
|
||||
rx_ptp_time=getattr(dut, f"qsfpdd{x}_mac_{y}_ptp_time"),
|
||||
ifg=12, speed=100e9
|
||||
)
|
||||
|
||||
self.qsfpdd0_mac_2 = EthMac(
|
||||
tx_clk=dut.qsfpdd0_mac_2_clk,
|
||||
tx_rst=dut.qsfpdd0_mac_2_rst,
|
||||
tx_bus=AxiStreamBus.from_prefix(dut, "qsfpdd0_mac_2_tx_axis"),
|
||||
tx_ptp_time=dut.qsfpdd0_mac_2_ptp_time,
|
||||
tx_ptp_ts=dut.qsfpdd0_mac_2_tx_ptp_ts,
|
||||
tx_ptp_ts_tag=dut.qsfpdd0_mac_2_tx_ptp_ts_tag,
|
||||
tx_ptp_ts_valid=dut.qsfpdd0_mac_2_tx_ptp_ts_valid,
|
||||
rx_clk=dut.qsfpdd0_mac_2_clk,
|
||||
rx_rst=dut.qsfpdd0_mac_2_rst,
|
||||
rx_bus=AxiStreamBus.from_prefix(dut, "qsfpdd0_mac_2_rx_axis"),
|
||||
rx_ptp_time=dut.qsfpdd0_mac_2_ptp_time,
|
||||
ifg=12, speed=100e9
|
||||
)
|
||||
macs.append(mac)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfpdd1_mac_1_clk, 2.482, units="ns").start())
|
||||
getattr(dut, f"qsfpdd{x}_mac_{y}_rx_status").setimmediatevalue(1)
|
||||
|
||||
self.qsfpdd1_mac_1 = EthMac(
|
||||
tx_clk=dut.qsfpdd1_mac_1_clk,
|
||||
tx_rst=dut.qsfpdd1_mac_1_rst,
|
||||
tx_bus=AxiStreamBus.from_prefix(dut, "qsfpdd1_mac_1_tx_axis"),
|
||||
tx_ptp_time=dut.qsfpdd1_mac_1_ptp_time,
|
||||
tx_ptp_ts=dut.qsfpdd1_mac_1_tx_ptp_ts,
|
||||
tx_ptp_ts_tag=dut.qsfpdd1_mac_1_tx_ptp_ts_tag,
|
||||
tx_ptp_ts_valid=dut.qsfpdd1_mac_1_tx_ptp_ts_valid,
|
||||
rx_clk=dut.qsfpdd1_mac_1_clk,
|
||||
rx_rst=dut.qsfpdd1_mac_1_rst,
|
||||
rx_bus=AxiStreamBus.from_prefix(dut, "qsfpdd1_mac_1_rx_axis"),
|
||||
rx_ptp_time=dut.qsfpdd1_mac_1_ptp_time,
|
||||
ifg=12, speed=100e9
|
||||
)
|
||||
self.qsfpdd_mac.append(macs)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfpdd1_mac_2_clk, 2.482, units="ns").start())
|
||||
|
||||
self.qsfpdd1_mac_2 = EthMac(
|
||||
tx_clk=dut.qsfpdd1_mac_2_clk,
|
||||
tx_rst=dut.qsfpdd1_mac_2_rst,
|
||||
tx_bus=AxiStreamBus.from_prefix(dut, "qsfpdd1_mac_2_tx_axis"),
|
||||
tx_ptp_time=dut.qsfpdd1_mac_2_ptp_time,
|
||||
tx_ptp_ts=dut.qsfpdd1_mac_2_tx_ptp_ts,
|
||||
tx_ptp_ts_tag=dut.qsfpdd1_mac_2_tx_ptp_ts_tag,
|
||||
tx_ptp_ts_valid=dut.qsfpdd1_mac_2_tx_ptp_ts_valid,
|
||||
rx_clk=dut.qsfpdd1_mac_2_clk,
|
||||
rx_rst=dut.qsfpdd1_mac_2_rst,
|
||||
rx_bus=AxiStreamBus.from_prefix(dut, "qsfpdd1_mac_2_rx_axis"),
|
||||
rx_ptp_time=dut.qsfpdd1_mac_2_ptp_time,
|
||||
ifg=12, speed=100e9
|
||||
)
|
||||
|
||||
dut.qsfpdd0_mac_1_rx_status.setimmediatevalue(1)
|
||||
dut.qsfpdd0_mac_2_rx_status.setimmediatevalue(1)
|
||||
|
||||
dut.qsfpdd1_mac_1_rx_status.setimmediatevalue(1)
|
||||
dut.qsfpdd1_mac_2_rx_status.setimmediatevalue(1)
|
||||
getattr(dut, f"qsfpdd{x}_modprs_l").setimmediatevalue(0)
|
||||
getattr(dut, f"qsfpdd{x}_int_l").setimmediatevalue(1)
|
||||
|
||||
dut.fpga_i2c_scl_i.setimmediatevalue(1)
|
||||
dut.fpga_i2c_sda_i.setimmediatevalue(1)
|
||||
|
||||
dut.qsfpdd0_modprs_l.setimmediatevalue(0)
|
||||
dut.qsfpdd0_int_l.setimmediatevalue(1)
|
||||
|
||||
dut.qsfpdd1_modprs_l.setimmediatevalue(0)
|
||||
dut.qsfpdd1_int_l.setimmediatevalue(1)
|
||||
|
||||
dut.qsfpdd_i2c_scl_i.setimmediatevalue(1)
|
||||
dut.qsfpdd_i2c_sda_i.setimmediatevalue(1)
|
||||
|
||||
@ -346,19 +297,17 @@ class TB(object):
|
||||
async def init(self):
|
||||
|
||||
self.dut.ptp_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpdd0_mac_1_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpdd0_mac_2_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpdd1_mac_1_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpdd1_mac_2_rst.setimmediatevalue(0)
|
||||
for x in range(2):
|
||||
for y in range(1, 3):
|
||||
getattr(self.dut, f"qsfpdd{x}_mac_{y}_rst").setimmediatevalue(0)
|
||||
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
|
||||
self.dut.ptp_rst.setimmediatevalue(1)
|
||||
self.dut.qsfpdd0_mac_1_rst.setimmediatevalue(1)
|
||||
self.dut.qsfpdd0_mac_2_rst.setimmediatevalue(1)
|
||||
self.dut.qsfpdd1_mac_1_rst.setimmediatevalue(1)
|
||||
self.dut.qsfpdd1_mac_2_rst.setimmediatevalue(1)
|
||||
for x in range(2):
|
||||
for y in range(1, 3):
|
||||
getattr(self.dut, f"qsfpdd{x}_mac_{y}_rst").setimmediatevalue(1)
|
||||
|
||||
await FallingEdge(self.dut.rst_250mhz)
|
||||
await Timer(100, 'ns')
|
||||
@ -367,10 +316,9 @@ class TB(object):
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
|
||||
self.dut.ptp_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpdd0_mac_1_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpdd0_mac_2_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpdd1_mac_1_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpdd1_mac_2_rst.setimmediatevalue(0)
|
||||
for x in range(2):
|
||||
for y in range(1, 3):
|
||||
getattr(self.dut, f"qsfpdd{x}_mac_{y}_rst").setimmediatevalue(0)
|
||||
|
||||
await self.rc.enumerate()
|
||||
|
||||
@ -379,14 +327,10 @@ class TB(object):
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
|
||||
if self.loopback_enable:
|
||||
if not self.qsfpdd0_mac_1.tx.empty():
|
||||
await self.qsfpdd0_mac_1.rx.send(await self.qsfpdd0_mac_1.tx.recv())
|
||||
if not self.qsfpdd0_mac_2.tx.empty():
|
||||
await self.qsfpdd0_mac_2.rx.send(await self.qsfpdd0_mac_2.tx.recv())
|
||||
if not self.qsfpdd1_mac_1.tx.empty():
|
||||
await self.qsfpdd1_mac_1.rx.send(await self.qsfpdd1_mac_1.tx.recv())
|
||||
if not self.qsfpdd1_mac_2.tx.empty():
|
||||
await self.qsfpdd1_mac_2.rx.send(await self.qsfpdd1_mac_2.tx.recv())
|
||||
for macs in self.qsfpdd_mac:
|
||||
for mac in macs:
|
||||
if not mac.tx.empty():
|
||||
await mac.rx.send(await mac.tx.recv())
|
||||
|
||||
|
||||
@cocotb.test()
|
||||
@ -417,10 +361,10 @@ async def run_test_nic(dut):
|
||||
|
||||
await tb.driver.interfaces[0].start_xmit(data, 0)
|
||||
|
||||
pkt = await tb.qsfpdd0_mac_1.tx.recv()
|
||||
pkt = await tb.qsfpdd_mac[0][0].tx.recv()
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
|
||||
await tb.qsfpdd0_mac_1.rx.send(pkt)
|
||||
await tb.qsfpdd_mac[0][0].rx.send(pkt)
|
||||
|
||||
pkt = await tb.driver.interfaces[0].recv()
|
||||
|
||||
@ -429,10 +373,10 @@ async def run_test_nic(dut):
|
||||
|
||||
# await tb.driver.interfaces[1].start_xmit(data, 0)
|
||||
|
||||
# pkt = await tb.qsfpdd1_mac_1.tx.recv()
|
||||
# pkt = await tb.qsfpdd_mac[1][0].tx.recv()
|
||||
# tb.log.info("Packet: %s", pkt)
|
||||
|
||||
# await tb.qsfpdd1_mac_1.rx.send(pkt)
|
||||
# await tb.qsfpdd_mac[1][0].rx.send(pkt)
|
||||
|
||||
# pkt = await tb.driver.interfaces[1].recv()
|
||||
|
||||
@ -452,10 +396,10 @@ async def run_test_nic(dut):
|
||||
|
||||
await tb.driver.interfaces[0].start_xmit(test_pkt2.build(), 0, 34, 6)
|
||||
|
||||
pkt = await tb.qsfpdd0_mac_1.tx.recv()
|
||||
pkt = await tb.qsfpdd_mac[0][0].tx.recv()
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
|
||||
await tb.qsfpdd0_mac_1.rx.send(pkt)
|
||||
await tb.qsfpdd_mac[0][0].rx.send(pkt)
|
||||
|
||||
pkt = await tb.driver.interfaces[0].recv()
|
||||
|
||||
|
@ -254,321 +254,41 @@ class TB(object):
|
||||
cocotb.start_soon(Clock(dut.ptp_sample_clk, 10, units="ns").start())
|
||||
|
||||
# Ethernet
|
||||
cocotb.start_soon(Clock(dut.qsfpdd0_mac_1_rx_clk, 2.482, units="ns").start())
|
||||
cocotb.start_soon(Clock(dut.qsfpdd0_mac_1_tx_clk, 2.482, units="ns").start())
|
||||
self.qsfpdd_mac = []
|
||||
|
||||
self.qsfpdd0_mac_1 = EthMac(
|
||||
tx_clk=dut.qsfpdd0_mac_1_tx_clk,
|
||||
tx_rst=dut.qsfpdd0_mac_1_tx_rst,
|
||||
tx_bus=AxiStreamBus.from_prefix(dut, "qsfpdd0_mac_1_tx_axis"),
|
||||
tx_ptp_time=dut.qsfpdd0_mac_1_tx_ptp_time,
|
||||
tx_ptp_ts=dut.qsfpdd0_mac_1_tx_ptp_ts,
|
||||
tx_ptp_ts_tag=dut.qsfpdd0_mac_1_tx_ptp_ts_tag,
|
||||
tx_ptp_ts_valid=dut.qsfpdd0_mac_1_tx_ptp_ts_valid,
|
||||
rx_clk=dut.qsfpdd0_mac_1_rx_clk,
|
||||
rx_rst=dut.qsfpdd0_mac_1_rx_rst,
|
||||
rx_bus=AxiStreamBus.from_prefix(dut, "qsfpdd0_mac_1_rx_axis"),
|
||||
rx_ptp_time=dut.qsfpdd0_mac_1_rx_ptp_time,
|
||||
ifg=12, speed=25e9
|
||||
)
|
||||
for x in range(2):
|
||||
macs = []
|
||||
for y in range(1, 9):
|
||||
cocotb.start_soon(Clock(getattr(dut, f"qsfpdd{x}_mac_{y}_rx_clk"), 2.482, units="ns").start())
|
||||
cocotb.start_soon(Clock(getattr(dut, f"qsfpdd{x}_mac_{y}_tx_clk"), 2.482, units="ns").start())
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfpdd0_mac_2_rx_clk, 2.482, units="ns").start())
|
||||
cocotb.start_soon(Clock(dut.qsfpdd0_mac_2_tx_clk, 2.482, units="ns").start())
|
||||
mac = EthMac(
|
||||
tx_clk=getattr(dut, f"qsfpdd{x}_mac_{y}_tx_clk"),
|
||||
tx_rst=getattr(dut, f"qsfpdd{x}_mac_{y}_tx_rst"),
|
||||
tx_bus=AxiStreamBus.from_prefix(dut, f"qsfpdd{x}_mac_{y}_tx_axis"),
|
||||
tx_ptp_time=getattr(dut, f"qsfpdd{x}_mac_{y}_tx_ptp_time"),
|
||||
tx_ptp_ts=getattr(dut, f"qsfpdd{x}_mac_{y}_tx_ptp_ts"),
|
||||
tx_ptp_ts_tag=getattr(dut, f"qsfpdd{x}_mac_{y}_tx_ptp_ts_tag"),
|
||||
tx_ptp_ts_valid=getattr(dut, f"qsfpdd{x}_mac_{y}_tx_ptp_ts_valid"),
|
||||
rx_clk=getattr(dut, f"qsfpdd{x}_mac_{y}_rx_clk"),
|
||||
rx_rst=getattr(dut, f"qsfpdd{x}_mac_{y}_rx_rst"),
|
||||
rx_bus=AxiStreamBus.from_prefix(dut, f"qsfpdd{x}_mac_{y}_rx_axis"),
|
||||
rx_ptp_time=getattr(dut, f"qsfpdd{x}_mac_{y}_rx_ptp_time"),
|
||||
ifg=12, speed=25e9
|
||||
)
|
||||
|
||||
self.qsfpdd0_mac_2 = EthMac(
|
||||
tx_clk=dut.qsfpdd0_mac_2_tx_clk,
|
||||
tx_rst=dut.qsfpdd0_mac_2_tx_rst,
|
||||
tx_bus=AxiStreamBus.from_prefix(dut, "qsfpdd0_mac_2_tx_axis"),
|
||||
tx_ptp_time=dut.qsfpdd0_mac_2_tx_ptp_time,
|
||||
tx_ptp_ts=dut.qsfpdd0_mac_2_tx_ptp_ts,
|
||||
tx_ptp_ts_tag=dut.qsfpdd0_mac_2_tx_ptp_ts_tag,
|
||||
tx_ptp_ts_valid=dut.qsfpdd0_mac_2_tx_ptp_ts_valid,
|
||||
rx_clk=dut.qsfpdd0_mac_2_rx_clk,
|
||||
rx_rst=dut.qsfpdd0_mac_2_rx_rst,
|
||||
rx_bus=AxiStreamBus.from_prefix(dut, "qsfpdd0_mac_2_rx_axis"),
|
||||
rx_ptp_time=dut.qsfpdd0_mac_2_rx_ptp_time,
|
||||
ifg=12, speed=25e9
|
||||
)
|
||||
macs.append(mac)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfpdd0_mac_3_rx_clk, 2.482, units="ns").start())
|
||||
cocotb.start_soon(Clock(dut.qsfpdd0_mac_3_tx_clk, 2.482, units="ns").start())
|
||||
getattr(dut, f"qsfpdd{x}_mac_{y}_rx_status").setimmediatevalue(1)
|
||||
|
||||
self.qsfpdd0_mac_3 = EthMac(
|
||||
tx_clk=dut.qsfpdd0_mac_3_tx_clk,
|
||||
tx_rst=dut.qsfpdd0_mac_3_tx_rst,
|
||||
tx_bus=AxiStreamBus.from_prefix(dut, "qsfpdd0_mac_3_tx_axis"),
|
||||
tx_ptp_time=dut.qsfpdd0_mac_3_tx_ptp_time,
|
||||
tx_ptp_ts=dut.qsfpdd0_mac_3_tx_ptp_ts,
|
||||
tx_ptp_ts_tag=dut.qsfpdd0_mac_3_tx_ptp_ts_tag,
|
||||
tx_ptp_ts_valid=dut.qsfpdd0_mac_3_tx_ptp_ts_valid,
|
||||
rx_clk=dut.qsfpdd0_mac_3_rx_clk,
|
||||
rx_rst=dut.qsfpdd0_mac_3_rx_rst,
|
||||
rx_bus=AxiStreamBus.from_prefix(dut, "qsfpdd0_mac_3_rx_axis"),
|
||||
rx_ptp_time=dut.qsfpdd0_mac_3_rx_ptp_time,
|
||||
ifg=12, speed=25e9
|
||||
)
|
||||
self.qsfpdd_mac.append(macs)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfpdd0_mac_4_rx_clk, 2.482, units="ns").start())
|
||||
cocotb.start_soon(Clock(dut.qsfpdd0_mac_4_tx_clk, 2.482, units="ns").start())
|
||||
|
||||
self.qsfpdd0_mac_4 = EthMac(
|
||||
tx_clk=dut.qsfpdd0_mac_4_tx_clk,
|
||||
tx_rst=dut.qsfpdd0_mac_4_tx_rst,
|
||||
tx_bus=AxiStreamBus.from_prefix(dut, "qsfpdd0_mac_4_tx_axis"),
|
||||
tx_ptp_time=dut.qsfpdd0_mac_4_tx_ptp_time,
|
||||
tx_ptp_ts=dut.qsfpdd0_mac_4_tx_ptp_ts,
|
||||
tx_ptp_ts_tag=dut.qsfpdd0_mac_4_tx_ptp_ts_tag,
|
||||
tx_ptp_ts_valid=dut.qsfpdd0_mac_4_tx_ptp_ts_valid,
|
||||
rx_clk=dut.qsfpdd0_mac_4_rx_clk,
|
||||
rx_rst=dut.qsfpdd0_mac_4_rx_rst,
|
||||
rx_bus=AxiStreamBus.from_prefix(dut, "qsfpdd0_mac_4_rx_axis"),
|
||||
rx_ptp_time=dut.qsfpdd0_mac_4_rx_ptp_time,
|
||||
ifg=12, speed=25e9
|
||||
)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfpdd0_mac_5_rx_clk, 2.482, units="ns").start())
|
||||
cocotb.start_soon(Clock(dut.qsfpdd0_mac_5_tx_clk, 2.482, units="ns").start())
|
||||
|
||||
self.qsfpdd0_mac_5 = EthMac(
|
||||
tx_clk=dut.qsfpdd0_mac_5_tx_clk,
|
||||
tx_rst=dut.qsfpdd0_mac_5_tx_rst,
|
||||
tx_bus=AxiStreamBus.from_prefix(dut, "qsfpdd0_mac_5_tx_axis"),
|
||||
tx_ptp_time=dut.qsfpdd0_mac_5_tx_ptp_time,
|
||||
tx_ptp_ts=dut.qsfpdd0_mac_5_tx_ptp_ts,
|
||||
tx_ptp_ts_tag=dut.qsfpdd0_mac_5_tx_ptp_ts_tag,
|
||||
tx_ptp_ts_valid=dut.qsfpdd0_mac_5_tx_ptp_ts_valid,
|
||||
rx_clk=dut.qsfpdd0_mac_5_rx_clk,
|
||||
rx_rst=dut.qsfpdd0_mac_5_rx_rst,
|
||||
rx_bus=AxiStreamBus.from_prefix(dut, "qsfpdd0_mac_5_rx_axis"),
|
||||
rx_ptp_time=dut.qsfpdd0_mac_5_rx_ptp_time,
|
||||
ifg=12, speed=25e9
|
||||
)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfpdd0_mac_6_rx_clk, 2.482, units="ns").start())
|
||||
cocotb.start_soon(Clock(dut.qsfpdd0_mac_6_tx_clk, 2.482, units="ns").start())
|
||||
|
||||
self.qsfpdd0_mac_6 = EthMac(
|
||||
tx_clk=dut.qsfpdd0_mac_6_tx_clk,
|
||||
tx_rst=dut.qsfpdd0_mac_6_tx_rst,
|
||||
tx_bus=AxiStreamBus.from_prefix(dut, "qsfpdd0_mac_6_tx_axis"),
|
||||
tx_ptp_time=dut.qsfpdd0_mac_6_tx_ptp_time,
|
||||
tx_ptp_ts=dut.qsfpdd0_mac_6_tx_ptp_ts,
|
||||
tx_ptp_ts_tag=dut.qsfpdd0_mac_6_tx_ptp_ts_tag,
|
||||
tx_ptp_ts_valid=dut.qsfpdd0_mac_6_tx_ptp_ts_valid,
|
||||
rx_clk=dut.qsfpdd0_mac_6_rx_clk,
|
||||
rx_rst=dut.qsfpdd0_mac_6_rx_rst,
|
||||
rx_bus=AxiStreamBus.from_prefix(dut, "qsfpdd0_mac_6_rx_axis"),
|
||||
rx_ptp_time=dut.qsfpdd0_mac_6_rx_ptp_time,
|
||||
ifg=12, speed=25e9
|
||||
)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfpdd0_mac_7_rx_clk, 2.482, units="ns").start())
|
||||
cocotb.start_soon(Clock(dut.qsfpdd0_mac_7_tx_clk, 2.482, units="ns").start())
|
||||
|
||||
self.qsfpdd0_mac_7 = EthMac(
|
||||
tx_clk=dut.qsfpdd0_mac_7_tx_clk,
|
||||
tx_rst=dut.qsfpdd0_mac_7_tx_rst,
|
||||
tx_bus=AxiStreamBus.from_prefix(dut, "qsfpdd0_mac_7_tx_axis"),
|
||||
tx_ptp_time=dut.qsfpdd0_mac_7_tx_ptp_time,
|
||||
tx_ptp_ts=dut.qsfpdd0_mac_7_tx_ptp_ts,
|
||||
tx_ptp_ts_tag=dut.qsfpdd0_mac_7_tx_ptp_ts_tag,
|
||||
tx_ptp_ts_valid=dut.qsfpdd0_mac_7_tx_ptp_ts_valid,
|
||||
rx_clk=dut.qsfpdd0_mac_7_rx_clk,
|
||||
rx_rst=dut.qsfpdd0_mac_7_rx_rst,
|
||||
rx_bus=AxiStreamBus.from_prefix(dut, "qsfpdd0_mac_7_rx_axis"),
|
||||
rx_ptp_time=dut.qsfpdd0_mac_7_rx_ptp_time,
|
||||
ifg=12, speed=25e9
|
||||
)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfpdd0_mac_8_rx_clk, 2.482, units="ns").start())
|
||||
cocotb.start_soon(Clock(dut.qsfpdd0_mac_8_tx_clk, 2.482, units="ns").start())
|
||||
|
||||
self.qsfpdd0_mac_8 = EthMac(
|
||||
tx_clk=dut.qsfpdd0_mac_8_tx_clk,
|
||||
tx_rst=dut.qsfpdd0_mac_8_tx_rst,
|
||||
tx_bus=AxiStreamBus.from_prefix(dut, "qsfpdd0_mac_8_tx_axis"),
|
||||
tx_ptp_time=dut.qsfpdd0_mac_8_tx_ptp_time,
|
||||
tx_ptp_ts=dut.qsfpdd0_mac_8_tx_ptp_ts,
|
||||
tx_ptp_ts_tag=dut.qsfpdd0_mac_8_tx_ptp_ts_tag,
|
||||
tx_ptp_ts_valid=dut.qsfpdd0_mac_8_tx_ptp_ts_valid,
|
||||
rx_clk=dut.qsfpdd0_mac_8_rx_clk,
|
||||
rx_rst=dut.qsfpdd0_mac_8_rx_rst,
|
||||
rx_bus=AxiStreamBus.from_prefix(dut, "qsfpdd0_mac_8_rx_axis"),
|
||||
rx_ptp_time=dut.qsfpdd0_mac_8_rx_ptp_time,
|
||||
ifg=12, speed=25e9
|
||||
)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfpdd1_mac_1_rx_clk, 2.482, units="ns").start())
|
||||
cocotb.start_soon(Clock(dut.qsfpdd1_mac_1_tx_clk, 2.482, units="ns").start())
|
||||
|
||||
self.qsfpdd1_mac_1 = EthMac(
|
||||
tx_clk=dut.qsfpdd1_mac_1_tx_clk,
|
||||
tx_rst=dut.qsfpdd1_mac_1_tx_rst,
|
||||
tx_bus=AxiStreamBus.from_prefix(dut, "qsfpdd1_mac_1_tx_axis"),
|
||||
tx_ptp_time=dut.qsfpdd1_mac_1_tx_ptp_time,
|
||||
tx_ptp_ts=dut.qsfpdd1_mac_1_tx_ptp_ts,
|
||||
tx_ptp_ts_tag=dut.qsfpdd1_mac_1_tx_ptp_ts_tag,
|
||||
tx_ptp_ts_valid=dut.qsfpdd1_mac_1_tx_ptp_ts_valid,
|
||||
rx_clk=dut.qsfpdd1_mac_1_rx_clk,
|
||||
rx_rst=dut.qsfpdd1_mac_1_rx_rst,
|
||||
rx_bus=AxiStreamBus.from_prefix(dut, "qsfpdd1_mac_1_rx_axis"),
|
||||
rx_ptp_time=dut.qsfpdd1_mac_1_rx_ptp_time,
|
||||
ifg=12, speed=25e9
|
||||
)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfpdd1_mac_2_rx_clk, 2.482, units="ns").start())
|
||||
cocotb.start_soon(Clock(dut.qsfpdd1_mac_2_tx_clk, 2.482, units="ns").start())
|
||||
|
||||
self.qsfpdd1_mac_2 = EthMac(
|
||||
tx_clk=dut.qsfpdd1_mac_2_tx_clk,
|
||||
tx_rst=dut.qsfpdd1_mac_2_tx_rst,
|
||||
tx_bus=AxiStreamBus.from_prefix(dut, "qsfpdd1_mac_2_tx_axis"),
|
||||
tx_ptp_time=dut.qsfpdd1_mac_2_tx_ptp_time,
|
||||
tx_ptp_ts=dut.qsfpdd1_mac_2_tx_ptp_ts,
|
||||
tx_ptp_ts_tag=dut.qsfpdd1_mac_2_tx_ptp_ts_tag,
|
||||
tx_ptp_ts_valid=dut.qsfpdd1_mac_2_tx_ptp_ts_valid,
|
||||
rx_clk=dut.qsfpdd1_mac_2_rx_clk,
|
||||
rx_rst=dut.qsfpdd1_mac_2_rx_rst,
|
||||
rx_bus=AxiStreamBus.from_prefix(dut, "qsfpdd1_mac_2_rx_axis"),
|
||||
rx_ptp_time=dut.qsfpdd1_mac_2_rx_ptp_time,
|
||||
ifg=12, speed=25e9
|
||||
)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfpdd1_mac_3_rx_clk, 2.482, units="ns").start())
|
||||
cocotb.start_soon(Clock(dut.qsfpdd1_mac_3_tx_clk, 2.482, units="ns").start())
|
||||
|
||||
self.qsfpdd1_mac_3 = EthMac(
|
||||
tx_clk=dut.qsfpdd1_mac_3_tx_clk,
|
||||
tx_rst=dut.qsfpdd1_mac_3_tx_rst,
|
||||
tx_bus=AxiStreamBus.from_prefix(dut, "qsfpdd1_mac_3_tx_axis"),
|
||||
tx_ptp_time=dut.qsfpdd1_mac_3_tx_ptp_time,
|
||||
tx_ptp_ts=dut.qsfpdd1_mac_3_tx_ptp_ts,
|
||||
tx_ptp_ts_tag=dut.qsfpdd1_mac_3_tx_ptp_ts_tag,
|
||||
tx_ptp_ts_valid=dut.qsfpdd1_mac_3_tx_ptp_ts_valid,
|
||||
rx_clk=dut.qsfpdd1_mac_3_rx_clk,
|
||||
rx_rst=dut.qsfpdd1_mac_3_rx_rst,
|
||||
rx_bus=AxiStreamBus.from_prefix(dut, "qsfpdd1_mac_3_rx_axis"),
|
||||
rx_ptp_time=dut.qsfpdd1_mac_3_rx_ptp_time,
|
||||
ifg=12, speed=25e9
|
||||
)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfpdd1_mac_4_rx_clk, 2.482, units="ns").start())
|
||||
cocotb.start_soon(Clock(dut.qsfpdd1_mac_4_tx_clk, 2.482, units="ns").start())
|
||||
|
||||
self.qsfpdd1_mac_4 = EthMac(
|
||||
tx_clk=dut.qsfpdd1_mac_4_tx_clk,
|
||||
tx_rst=dut.qsfpdd1_mac_4_tx_rst,
|
||||
tx_bus=AxiStreamBus.from_prefix(dut, "qsfpdd1_mac_4_tx_axis"),
|
||||
tx_ptp_time=dut.qsfpdd1_mac_4_tx_ptp_time,
|
||||
tx_ptp_ts=dut.qsfpdd1_mac_4_tx_ptp_ts,
|
||||
tx_ptp_ts_tag=dut.qsfpdd1_mac_4_tx_ptp_ts_tag,
|
||||
tx_ptp_ts_valid=dut.qsfpdd1_mac_4_tx_ptp_ts_valid,
|
||||
rx_clk=dut.qsfpdd1_mac_4_rx_clk,
|
||||
rx_rst=dut.qsfpdd1_mac_4_rx_rst,
|
||||
rx_bus=AxiStreamBus.from_prefix(dut, "qsfpdd1_mac_4_rx_axis"),
|
||||
rx_ptp_time=dut.qsfpdd1_mac_4_rx_ptp_time,
|
||||
ifg=12, speed=25e9
|
||||
)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfpdd1_mac_5_rx_clk, 2.482, units="ns").start())
|
||||
cocotb.start_soon(Clock(dut.qsfpdd1_mac_5_tx_clk, 2.482, units="ns").start())
|
||||
|
||||
self.qsfpdd1_mac_5 = EthMac(
|
||||
tx_clk=dut.qsfpdd1_mac_5_tx_clk,
|
||||
tx_rst=dut.qsfpdd1_mac_5_tx_rst,
|
||||
tx_bus=AxiStreamBus.from_prefix(dut, "qsfpdd1_mac_5_tx_axis"),
|
||||
tx_ptp_time=dut.qsfpdd1_mac_5_tx_ptp_time,
|
||||
tx_ptp_ts=dut.qsfpdd1_mac_5_tx_ptp_ts,
|
||||
tx_ptp_ts_tag=dut.qsfpdd1_mac_5_tx_ptp_ts_tag,
|
||||
tx_ptp_ts_valid=dut.qsfpdd1_mac_5_tx_ptp_ts_valid,
|
||||
rx_clk=dut.qsfpdd1_mac_5_rx_clk,
|
||||
rx_rst=dut.qsfpdd1_mac_5_rx_rst,
|
||||
rx_bus=AxiStreamBus.from_prefix(dut, "qsfpdd1_mac_5_rx_axis"),
|
||||
rx_ptp_time=dut.qsfpdd1_mac_5_rx_ptp_time,
|
||||
ifg=12, speed=25e9
|
||||
)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfpdd1_mac_6_rx_clk, 2.482, units="ns").start())
|
||||
cocotb.start_soon(Clock(dut.qsfpdd1_mac_6_tx_clk, 2.482, units="ns").start())
|
||||
|
||||
self.qsfpdd1_mac_6 = EthMac(
|
||||
tx_clk=dut.qsfpdd1_mac_6_tx_clk,
|
||||
tx_rst=dut.qsfpdd1_mac_6_tx_rst,
|
||||
tx_bus=AxiStreamBus.from_prefix(dut, "qsfpdd1_mac_6_tx_axis"),
|
||||
tx_ptp_time=dut.qsfpdd1_mac_6_tx_ptp_time,
|
||||
tx_ptp_ts=dut.qsfpdd1_mac_6_tx_ptp_ts,
|
||||
tx_ptp_ts_tag=dut.qsfpdd1_mac_6_tx_ptp_ts_tag,
|
||||
tx_ptp_ts_valid=dut.qsfpdd1_mac_6_tx_ptp_ts_valid,
|
||||
rx_clk=dut.qsfpdd1_mac_6_rx_clk,
|
||||
rx_rst=dut.qsfpdd1_mac_6_rx_rst,
|
||||
rx_bus=AxiStreamBus.from_prefix(dut, "qsfpdd1_mac_6_rx_axis"),
|
||||
rx_ptp_time=dut.qsfpdd1_mac_6_rx_ptp_time,
|
||||
ifg=12, speed=25e9
|
||||
)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfpdd1_mac_7_rx_clk, 2.482, units="ns").start())
|
||||
cocotb.start_soon(Clock(dut.qsfpdd1_mac_7_tx_clk, 2.482, units="ns").start())
|
||||
|
||||
self.qsfpdd1_mac_7 = EthMac(
|
||||
tx_clk=dut.qsfpdd1_mac_7_tx_clk,
|
||||
tx_rst=dut.qsfpdd1_mac_7_tx_rst,
|
||||
tx_bus=AxiStreamBus.from_prefix(dut, "qsfpdd1_mac_7_tx_axis"),
|
||||
tx_ptp_time=dut.qsfpdd1_mac_7_tx_ptp_time,
|
||||
tx_ptp_ts=dut.qsfpdd1_mac_7_tx_ptp_ts,
|
||||
tx_ptp_ts_tag=dut.qsfpdd1_mac_7_tx_ptp_ts_tag,
|
||||
tx_ptp_ts_valid=dut.qsfpdd1_mac_7_tx_ptp_ts_valid,
|
||||
rx_clk=dut.qsfpdd1_mac_7_rx_clk,
|
||||
rx_rst=dut.qsfpdd1_mac_7_rx_rst,
|
||||
rx_bus=AxiStreamBus.from_prefix(dut, "qsfpdd1_mac_7_rx_axis"),
|
||||
rx_ptp_time=dut.qsfpdd1_mac_7_rx_ptp_time,
|
||||
ifg=12, speed=25e9
|
||||
)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfpdd1_mac_8_rx_clk, 2.482, units="ns").start())
|
||||
cocotb.start_soon(Clock(dut.qsfpdd1_mac_8_tx_clk, 2.482, units="ns").start())
|
||||
|
||||
self.qsfpdd1_mac_8 = EthMac(
|
||||
tx_clk=dut.qsfpdd1_mac_8_tx_clk,
|
||||
tx_rst=dut.qsfpdd1_mac_8_tx_rst,
|
||||
tx_bus=AxiStreamBus.from_prefix(dut, "qsfpdd1_mac_8_tx_axis"),
|
||||
tx_ptp_time=dut.qsfpdd1_mac_8_tx_ptp_time,
|
||||
tx_ptp_ts=dut.qsfpdd1_mac_8_tx_ptp_ts,
|
||||
tx_ptp_ts_tag=dut.qsfpdd1_mac_8_tx_ptp_ts_tag,
|
||||
tx_ptp_ts_valid=dut.qsfpdd1_mac_8_tx_ptp_ts_valid,
|
||||
rx_clk=dut.qsfpdd1_mac_8_rx_clk,
|
||||
rx_rst=dut.qsfpdd1_mac_8_rx_rst,
|
||||
rx_bus=AxiStreamBus.from_prefix(dut, "qsfpdd1_mac_8_rx_axis"),
|
||||
rx_ptp_time=dut.qsfpdd1_mac_8_rx_ptp_time,
|
||||
ifg=12, speed=25e9
|
||||
)
|
||||
|
||||
dut.qsfpdd0_mac_1_rx_status.setimmediatevalue(1)
|
||||
dut.qsfpdd0_mac_2_rx_status.setimmediatevalue(1)
|
||||
dut.qsfpdd0_mac_3_rx_status.setimmediatevalue(1)
|
||||
dut.qsfpdd0_mac_4_rx_status.setimmediatevalue(1)
|
||||
dut.qsfpdd0_mac_5_rx_status.setimmediatevalue(1)
|
||||
dut.qsfpdd0_mac_6_rx_status.setimmediatevalue(1)
|
||||
dut.qsfpdd0_mac_7_rx_status.setimmediatevalue(1)
|
||||
dut.qsfpdd0_mac_8_rx_status.setimmediatevalue(1)
|
||||
|
||||
dut.qsfpdd1_mac_1_rx_status.setimmediatevalue(1)
|
||||
dut.qsfpdd1_mac_2_rx_status.setimmediatevalue(1)
|
||||
dut.qsfpdd1_mac_3_rx_status.setimmediatevalue(1)
|
||||
dut.qsfpdd1_mac_4_rx_status.setimmediatevalue(1)
|
||||
dut.qsfpdd1_mac_5_rx_status.setimmediatevalue(1)
|
||||
dut.qsfpdd1_mac_6_rx_status.setimmediatevalue(1)
|
||||
dut.qsfpdd1_mac_7_rx_status.setimmediatevalue(1)
|
||||
dut.qsfpdd1_mac_8_rx_status.setimmediatevalue(1)
|
||||
getattr(dut, f"qsfpdd{x}_modprs_l").setimmediatevalue(0)
|
||||
getattr(dut, f"qsfpdd{x}_int_l").setimmediatevalue(1)
|
||||
|
||||
dut.fpga_i2c_scl_i.setimmediatevalue(1)
|
||||
dut.fpga_i2c_sda_i.setimmediatevalue(1)
|
||||
|
||||
dut.qsfpdd0_modprs_l.setimmediatevalue(0)
|
||||
dut.qsfpdd0_int_l.setimmediatevalue(1)
|
||||
|
||||
dut.qsfpdd1_modprs_l.setimmediatevalue(0)
|
||||
dut.qsfpdd1_int_l.setimmediatevalue(1)
|
||||
|
||||
dut.qsfpdd_i2c_scl_i.setimmediatevalue(1)
|
||||
dut.qsfpdd_i2c_sda_i.setimmediatevalue(1)
|
||||
|
||||
@ -578,75 +298,19 @@ class TB(object):
|
||||
async def init(self):
|
||||
|
||||
self.dut.ptp_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpdd0_mac_1_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpdd0_mac_1_tx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpdd0_mac_2_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpdd0_mac_2_tx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpdd0_mac_3_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpdd0_mac_3_tx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpdd0_mac_4_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpdd0_mac_4_tx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpdd0_mac_5_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpdd0_mac_5_tx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpdd0_mac_6_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpdd0_mac_6_tx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpdd0_mac_7_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpdd0_mac_7_tx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpdd0_mac_8_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpdd0_mac_8_tx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpdd1_mac_1_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpdd1_mac_1_tx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpdd1_mac_2_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpdd1_mac_2_tx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpdd1_mac_3_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpdd1_mac_3_tx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpdd1_mac_4_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpdd1_mac_4_tx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpdd1_mac_5_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpdd1_mac_5_tx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpdd1_mac_6_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpdd1_mac_6_tx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpdd1_mac_7_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpdd1_mac_7_tx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpdd1_mac_8_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpdd1_mac_8_tx_rst.setimmediatevalue(0)
|
||||
for x in range(2):
|
||||
for y in range(1, 9):
|
||||
getattr(self.dut, f"qsfpdd{x}_mac_{y}_rx_rst").setimmediatevalue(0)
|
||||
getattr(self.dut, f"qsfpdd{x}_mac_{y}_tx_rst").setimmediatevalue(0)
|
||||
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
|
||||
self.dut.ptp_rst.setimmediatevalue(1)
|
||||
self.dut.qsfpdd0_mac_1_rx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfpdd0_mac_1_tx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfpdd0_mac_2_rx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfpdd0_mac_2_tx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfpdd0_mac_3_rx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfpdd0_mac_3_tx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfpdd0_mac_4_rx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfpdd0_mac_4_tx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfpdd0_mac_5_rx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfpdd0_mac_5_tx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfpdd0_mac_6_rx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfpdd0_mac_6_tx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfpdd0_mac_7_rx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfpdd0_mac_7_tx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfpdd0_mac_8_rx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfpdd0_mac_8_tx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfpdd1_mac_1_rx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfpdd1_mac_1_tx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfpdd1_mac_2_rx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfpdd1_mac_2_tx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfpdd1_mac_3_rx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfpdd1_mac_3_tx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfpdd1_mac_4_rx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfpdd1_mac_4_tx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfpdd1_mac_5_rx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfpdd1_mac_5_tx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfpdd1_mac_6_rx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfpdd1_mac_6_tx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfpdd1_mac_7_rx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfpdd1_mac_7_tx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfpdd1_mac_8_rx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfpdd1_mac_8_tx_rst.setimmediatevalue(1)
|
||||
for x in range(2):
|
||||
for y in range(1, 9):
|
||||
getattr(self.dut, f"qsfpdd{x}_mac_{y}_rx_rst").setimmediatevalue(1)
|
||||
getattr(self.dut, f"qsfpdd{x}_mac_{y}_tx_rst").setimmediatevalue(1)
|
||||
|
||||
await FallingEdge(self.dut.rst_250mhz)
|
||||
await Timer(100, 'ns')
|
||||
@ -655,38 +319,10 @@ class TB(object):
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
|
||||
self.dut.ptp_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpdd0_mac_1_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpdd0_mac_1_tx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpdd0_mac_2_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpdd0_mac_2_tx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpdd0_mac_3_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpdd0_mac_3_tx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpdd0_mac_4_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpdd0_mac_4_tx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpdd0_mac_5_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpdd0_mac_5_tx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpdd0_mac_6_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpdd0_mac_6_tx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpdd0_mac_7_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpdd0_mac_7_tx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpdd0_mac_8_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpdd0_mac_8_tx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpdd1_mac_1_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpdd1_mac_1_tx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpdd1_mac_2_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpdd1_mac_2_tx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpdd1_mac_3_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpdd1_mac_3_tx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpdd1_mac_4_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpdd1_mac_4_tx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpdd1_mac_5_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpdd1_mac_5_tx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpdd1_mac_6_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpdd1_mac_6_tx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpdd1_mac_7_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpdd1_mac_7_tx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpdd1_mac_8_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfpdd1_mac_8_tx_rst.setimmediatevalue(0)
|
||||
for x in range(2):
|
||||
for y in range(1, 9):
|
||||
getattr(self.dut, f"qsfpdd{x}_mac_{y}_rx_rst").setimmediatevalue(0)
|
||||
getattr(self.dut, f"qsfpdd{x}_mac_{y}_tx_rst").setimmediatevalue(0)
|
||||
|
||||
await self.rc.enumerate()
|
||||
|
||||
@ -695,38 +331,10 @@ class TB(object):
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
|
||||
if self.loopback_enable:
|
||||
if not self.qsfpdd0_mac_1.tx.empty():
|
||||
await self.qsfpdd0_mac_1.rx.send(await self.qsfpdd0_mac_1.tx.recv())
|
||||
if not self.qsfpdd0_mac_2.tx.empty():
|
||||
await self.qsfpdd0_mac_2.rx.send(await self.qsfpdd0_mac_2.tx.recv())
|
||||
if not self.qsfpdd0_mac_3.tx.empty():
|
||||
await self.qsfpdd0_mac_3.rx.send(await self.qsfpdd0_mac_3.tx.recv())
|
||||
if not self.qsfpdd0_mac_4.tx.empty():
|
||||
await self.qsfpdd0_mac_4.rx.send(await self.qsfpdd0_mac_4.tx.recv())
|
||||
if not self.qsfpdd0_mac_5.tx.empty():
|
||||
await self.qsfpdd0_mac_5.rx.send(await self.qsfpdd0_mac_5.tx.recv())
|
||||
if not self.qsfpdd0_mac_6.tx.empty():
|
||||
await self.qsfpdd0_mac_6.rx.send(await self.qsfpdd0_mac_6.tx.recv())
|
||||
if not self.qsfpdd0_mac_7.tx.empty():
|
||||
await self.qsfpdd0_mac_7.rx.send(await self.qsfpdd0_mac_7.tx.recv())
|
||||
if not self.qsfpdd0_mac_8.tx.empty():
|
||||
await self.qsfpdd0_mac_8.rx.send(await self.qsfpdd0_mac_8.tx.recv())
|
||||
if not self.qsfpdd1_mac_1.tx.empty():
|
||||
await self.qsfpdd1_mac_1.rx.send(await self.qsfpdd1_mac_1.tx.recv())
|
||||
if not self.qsfpdd1_mac_2.tx.empty():
|
||||
await self.qsfpdd1_mac_2.rx.send(await self.qsfpdd1_mac_2.tx.recv())
|
||||
if not self.qsfpdd1_mac_3.tx.empty():
|
||||
await self.qsfpdd1_mac_3.rx.send(await self.qsfpdd1_mac_3.tx.recv())
|
||||
if not self.qsfpdd1_mac_4.tx.empty():
|
||||
await self.qsfpdd1_mac_4.rx.send(await self.qsfpdd1_mac_4.tx.recv())
|
||||
if not self.qsfpdd1_mac_5.tx.empty():
|
||||
await self.qsfpdd1_mac_5.rx.send(await self.qsfpdd1_mac_5.tx.recv())
|
||||
if not self.qsfpdd1_mac_6.tx.empty():
|
||||
await self.qsfpdd1_mac_6.rx.send(await self.qsfpdd1_mac_6.tx.recv())
|
||||
if not self.qsfpdd1_mac_7.tx.empty():
|
||||
await self.qsfpdd1_mac_7.rx.send(await self.qsfpdd1_mac_7.tx.recv())
|
||||
if not self.qsfpdd1_mac_8.tx.empty():
|
||||
await self.qsfpdd1_mac_8.rx.send(await self.qsfpdd1_mac_8.tx.recv())
|
||||
for macs in self.qsfpdd_mac:
|
||||
for mac in macs:
|
||||
if not mac.tx.empty():
|
||||
await mac.rx.send(await mac.tx.recv())
|
||||
|
||||
|
||||
@cocotb.test()
|
||||
@ -757,10 +365,10 @@ async def run_test_nic(dut):
|
||||
|
||||
await tb.driver.interfaces[0].start_xmit(data, 0)
|
||||
|
||||
pkt = await tb.qsfpdd0_mac_1.tx.recv()
|
||||
pkt = await tb.qsfpdd_mac[0][0].tx.recv()
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
|
||||
await tb.qsfpdd0_mac_1.rx.send(pkt)
|
||||
await tb.qsfpdd_mac[0][0].rx.send(pkt)
|
||||
|
||||
pkt = await tb.driver.interfaces[0].recv()
|
||||
|
||||
@ -769,10 +377,10 @@ async def run_test_nic(dut):
|
||||
|
||||
# await tb.driver.interfaces[1].start_xmit(data, 0)
|
||||
|
||||
# pkt = await tb.qsfpdd1_mac_1.tx.recv()
|
||||
# pkt = await tb.qsfpdd_mac[1][0].tx.recv()
|
||||
# tb.log.info("Packet: %s", pkt)
|
||||
|
||||
# await tb.qsfpdd1_mac_1.rx.send(pkt)
|
||||
# await tb.qsfpdd_mac[1][0].rx.send(pkt)
|
||||
|
||||
# pkt = await tb.driver.interfaces[1].recv()
|
||||
|
||||
@ -792,10 +400,10 @@ async def run_test_nic(dut):
|
||||
|
||||
await tb.driver.interfaces[0].start_xmit(test_pkt2.build(), 0, 34, 6)
|
||||
|
||||
pkt = await tb.qsfpdd0_mac_1.tx.recv()
|
||||
pkt = await tb.qsfpdd_mac[0][0].tx.recv()
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
|
||||
await tb.qsfpdd0_mac_1.rx.send(pkt)
|
||||
await tb.qsfpdd_mac[0][0].rx.send(pkt)
|
||||
|
||||
pkt = await tb.driver.interfaces[0].recv()
|
||||
|
||||
|
@ -250,87 +250,33 @@ class TB(object):
|
||||
cocotb.start_soon(Clock(dut.ptp_sample_clk, 8, units="ns").start())
|
||||
|
||||
# Ethernet
|
||||
cocotb.start_soon(Clock(dut.qsfp0_rx_clk_1, 6.4, units="ns").start())
|
||||
self.qsfp0_1_source = XgmiiSource(dut.qsfp0_rxd_1, dut.qsfp0_rxc_1, dut.qsfp0_rx_clk_1, dut.qsfp0_rx_rst_1)
|
||||
cocotb.start_soon(Clock(dut.qsfp0_tx_clk_1, 6.4, units="ns").start())
|
||||
self.qsfp0_1_sink = XgmiiSink(dut.qsfp0_txd_1, dut.qsfp0_txc_1, dut.qsfp0_tx_clk_1, dut.qsfp0_tx_rst_1)
|
||||
self.qsfp_source = []
|
||||
self.qsfp_sink = []
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp0_rx_clk_2, 6.4, units="ns").start())
|
||||
self.qsfp0_2_source = XgmiiSource(dut.qsfp0_rxd_2, dut.qsfp0_rxc_2, dut.qsfp0_rx_clk_2, dut.qsfp0_rx_rst_2)
|
||||
cocotb.start_soon(Clock(dut.qsfp0_tx_clk_2, 6.4, units="ns").start())
|
||||
self.qsfp0_2_sink = XgmiiSink(dut.qsfp0_txd_2, dut.qsfp0_txc_2, dut.qsfp0_tx_clk_2, dut.qsfp0_tx_rst_2)
|
||||
for x in range(2):
|
||||
sources = []
|
||||
sinks = []
|
||||
for y in range(1, 5):
|
||||
cocotb.start_soon(Clock(getattr(dut, f"qsfp{x}_rx_clk_{y}"), 6.4, units="ns").start())
|
||||
source = XgmiiSource(getattr(dut, f"qsfp{x}_rxd_{y}"), getattr(dut, f"qsfp{x}_rxc_{y}"), getattr(dut, f"qsfp{x}_rx_clk_{y}"), getattr(dut, f"qsfp{x}_rx_rst_{y}"))
|
||||
sources.append(source)
|
||||
cocotb.start_soon(Clock(getattr(dut, f"qsfp{x}_tx_clk_{y}"), 6.4, units="ns").start())
|
||||
sink = XgmiiSink(getattr(dut, f"qsfp{x}_txd_{y}"), getattr(dut, f"qsfp{x}_txc_{y}"), getattr(dut, f"qsfp{x}_tx_clk_{y}"), getattr(dut, f"qsfp{x}_tx_rst_{y}"))
|
||||
sinks.append(sink)
|
||||
getattr(dut, f"qsfp{x}_rx_status_{y}").setimmediatevalue(1)
|
||||
getattr(dut, f"qsfp{x}_rx_error_count_{y}").setimmediatevalue(0)
|
||||
self.qsfp_source.append(sources)
|
||||
self.qsfp_sink.append(sinks)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp0_rx_clk_3, 6.4, units="ns").start())
|
||||
self.qsfp0_3_source = XgmiiSource(dut.qsfp0_rxd_3, dut.qsfp0_rxc_3, dut.qsfp0_rx_clk_3, dut.qsfp0_rx_rst_3)
|
||||
cocotb.start_soon(Clock(dut.qsfp0_tx_clk_3, 6.4, units="ns").start())
|
||||
self.qsfp0_3_sink = XgmiiSink(dut.qsfp0_txd_3, dut.qsfp0_txc_3, dut.qsfp0_tx_clk_3, dut.qsfp0_tx_rst_3)
|
||||
cocotb.start_soon(Clock(getattr(dut, f"qsfp{x}_drp_clk"), 8, units="ns").start())
|
||||
getattr(dut, f"qsfp{x}_drp_rst").setimmediatevalue(0)
|
||||
getattr(dut, f"qsfp{x}_drp_do").setimmediatevalue(0)
|
||||
getattr(dut, f"qsfp{x}_drp_rdy").setimmediatevalue(0)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp0_rx_clk_4, 6.4, units="ns").start())
|
||||
self.qsfp0_4_source = XgmiiSource(dut.qsfp0_rxd_4, dut.qsfp0_rxc_4, dut.qsfp0_rx_clk_4, dut.qsfp0_rx_rst_4)
|
||||
cocotb.start_soon(Clock(dut.qsfp0_tx_clk_4, 6.4, units="ns").start())
|
||||
self.qsfp0_4_sink = XgmiiSink(dut.qsfp0_txd_4, dut.qsfp0_txc_4, dut.qsfp0_tx_clk_4, dut.qsfp0_tx_rst_4)
|
||||
|
||||
dut.qsfp0_rx_status_1.setimmediatevalue(1)
|
||||
dut.qsfp0_rx_status_2.setimmediatevalue(1)
|
||||
dut.qsfp0_rx_status_3.setimmediatevalue(1)
|
||||
dut.qsfp0_rx_status_4.setimmediatevalue(1)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp0_drp_clk, 8, units="ns").start())
|
||||
dut.qsfp0_drp_rst.setimmediatevalue(0)
|
||||
dut.qsfp0_drp_do.setimmediatevalue(0)
|
||||
dut.qsfp0_drp_rdy.setimmediatevalue(0)
|
||||
|
||||
dut.qsfp0_rx_error_count_1.setimmediatevalue(0)
|
||||
dut.qsfp0_rx_error_count_2.setimmediatevalue(0)
|
||||
dut.qsfp0_rx_error_count_3.setimmediatevalue(0)
|
||||
dut.qsfp0_rx_error_count_4.setimmediatevalue(0)
|
||||
|
||||
dut.qsfp0_modprsl.setimmediatevalue(0)
|
||||
dut.qsfp0_intl.setimmediatevalue(0)
|
||||
|
||||
dut.qsfp0_i2c_scl_i.setimmediatevalue(1)
|
||||
dut.qsfp0_i2c_sda_i.setimmediatevalue(1)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp1_rx_clk_1, 6.4, units="ns").start())
|
||||
self.qsfp1_1_source = XgmiiSource(dut.qsfp1_rxd_1, dut.qsfp1_rxc_1, dut.qsfp1_rx_clk_1, dut.qsfp1_rx_rst_1)
|
||||
cocotb.start_soon(Clock(dut.qsfp1_tx_clk_1, 6.4, units="ns").start())
|
||||
self.qsfp1_1_sink = XgmiiSink(dut.qsfp1_txd_1, dut.qsfp1_txc_1, dut.qsfp1_tx_clk_1, dut.qsfp1_tx_rst_1)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp1_rx_clk_2, 6.4, units="ns").start())
|
||||
self.qsfp1_2_source = XgmiiSource(dut.qsfp1_rxd_2, dut.qsfp1_rxc_2, dut.qsfp1_rx_clk_2, dut.qsfp1_rx_rst_2)
|
||||
cocotb.start_soon(Clock(dut.qsfp1_tx_clk_2, 6.4, units="ns").start())
|
||||
self.qsfp1_2_sink = XgmiiSink(dut.qsfp1_txd_2, dut.qsfp1_txc_2, dut.qsfp1_tx_clk_2, dut.qsfp1_tx_rst_2)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp1_rx_clk_3, 6.4, units="ns").start())
|
||||
self.qsfp1_3_source = XgmiiSource(dut.qsfp1_rxd_3, dut.qsfp1_rxc_3, dut.qsfp1_rx_clk_3, dut.qsfp1_rx_rst_3)
|
||||
cocotb.start_soon(Clock(dut.qsfp1_tx_clk_3, 6.4, units="ns").start())
|
||||
self.qsfp1_3_sink = XgmiiSink(dut.qsfp1_txd_3, dut.qsfp1_txc_3, dut.qsfp1_tx_clk_3, dut.qsfp1_tx_rst_3)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp1_rx_clk_4, 6.4, units="ns").start())
|
||||
self.qsfp1_4_source = XgmiiSource(dut.qsfp1_rxd_4, dut.qsfp1_rxc_4, dut.qsfp1_rx_clk_4, dut.qsfp1_rx_rst_4)
|
||||
cocotb.start_soon(Clock(dut.qsfp1_tx_clk_4, 6.4, units="ns").start())
|
||||
self.qsfp1_4_sink = XgmiiSink(dut.qsfp1_txd_4, dut.qsfp1_txc_4, dut.qsfp1_tx_clk_4, dut.qsfp1_tx_rst_4)
|
||||
|
||||
dut.qsfp1_rx_status_1.setimmediatevalue(1)
|
||||
dut.qsfp1_rx_status_2.setimmediatevalue(1)
|
||||
dut.qsfp1_rx_status_3.setimmediatevalue(1)
|
||||
dut.qsfp1_rx_status_4.setimmediatevalue(1)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp1_drp_clk, 8, units="ns").start())
|
||||
dut.qsfp1_drp_rst.setimmediatevalue(0)
|
||||
dut.qsfp1_drp_do.setimmediatevalue(0)
|
||||
dut.qsfp1_drp_rdy.setimmediatevalue(0)
|
||||
|
||||
dut.qsfp1_rx_error_count_1.setimmediatevalue(0)
|
||||
dut.qsfp1_rx_error_count_2.setimmediatevalue(0)
|
||||
dut.qsfp1_rx_error_count_3.setimmediatevalue(0)
|
||||
dut.qsfp1_rx_error_count_4.setimmediatevalue(0)
|
||||
|
||||
dut.qsfp1_modprsl.setimmediatevalue(0)
|
||||
dut.qsfp1_intl.setimmediatevalue(0)
|
||||
|
||||
dut.qsfp1_i2c_scl_i.setimmediatevalue(1)
|
||||
dut.qsfp1_i2c_sda_i.setimmediatevalue(1)
|
||||
getattr(dut, f"qsfp{x}_modprsl").setimmediatevalue(0)
|
||||
getattr(dut, f"qsfp{x}_intl").setimmediatevalue(1)
|
||||
getattr(dut, f"qsfp{x}_i2c_scl_i").setimmediatevalue(1)
|
||||
getattr(dut, f"qsfp{x}_i2c_sda_i").setimmediatevalue(1)
|
||||
|
||||
dut.eeprom_i2c_scl_i.setimmediatevalue(1)
|
||||
dut.eeprom_i2c_sda_i.setimmediatevalue(1)
|
||||
@ -343,43 +289,19 @@ class TB(object):
|
||||
async def init(self):
|
||||
|
||||
self.dut.ptp_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp0_rx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp0_tx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp0_rx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp0_tx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp0_rx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp0_tx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp0_rx_rst_4.setimmediatevalue(0)
|
||||
self.dut.qsfp0_tx_rst_4.setimmediatevalue(0)
|
||||
self.dut.qsfp1_rx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp1_tx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp1_rx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp1_tx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp1_rx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp1_tx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp1_rx_rst_4.setimmediatevalue(0)
|
||||
self.dut.qsfp1_tx_rst_4.setimmediatevalue(0)
|
||||
for x in range(2):
|
||||
for y in range(1, 5):
|
||||
getattr(self.dut, f"qsfp{x}_rx_rst_{y}").setimmediatevalue(0)
|
||||
getattr(self.dut, f"qsfp{x}_tx_rst_{y}").setimmediatevalue(0)
|
||||
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
|
||||
self.dut.ptp_rst.setimmediatevalue(1)
|
||||
self.dut.qsfp0_rx_rst_1.setimmediatevalue(1)
|
||||
self.dut.qsfp0_tx_rst_1.setimmediatevalue(1)
|
||||
self.dut.qsfp0_rx_rst_2.setimmediatevalue(1)
|
||||
self.dut.qsfp0_tx_rst_2.setimmediatevalue(1)
|
||||
self.dut.qsfp0_rx_rst_3.setimmediatevalue(1)
|
||||
self.dut.qsfp0_tx_rst_3.setimmediatevalue(1)
|
||||
self.dut.qsfp0_rx_rst_4.setimmediatevalue(1)
|
||||
self.dut.qsfp0_tx_rst_4.setimmediatevalue(1)
|
||||
self.dut.qsfp1_rx_rst_1.setimmediatevalue(1)
|
||||
self.dut.qsfp1_tx_rst_1.setimmediatevalue(1)
|
||||
self.dut.qsfp1_rx_rst_2.setimmediatevalue(1)
|
||||
self.dut.qsfp1_tx_rst_2.setimmediatevalue(1)
|
||||
self.dut.qsfp1_rx_rst_3.setimmediatevalue(1)
|
||||
self.dut.qsfp1_tx_rst_3.setimmediatevalue(1)
|
||||
self.dut.qsfp1_rx_rst_4.setimmediatevalue(1)
|
||||
self.dut.qsfp1_tx_rst_4.setimmediatevalue(1)
|
||||
for x in range(2):
|
||||
for y in range(1, 5):
|
||||
getattr(self.dut, f"qsfp{x}_rx_rst_{y}").setimmediatevalue(1)
|
||||
getattr(self.dut, f"qsfp{x}_tx_rst_{y}").setimmediatevalue(1)
|
||||
|
||||
await FallingEdge(self.dut.rst_250mhz)
|
||||
await Timer(100, 'ns')
|
||||
@ -388,22 +310,10 @@ class TB(object):
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
|
||||
self.dut.ptp_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp0_rx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp0_tx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp0_rx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp0_tx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp0_rx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp0_tx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp0_rx_rst_4.setimmediatevalue(0)
|
||||
self.dut.qsfp0_tx_rst_4.setimmediatevalue(0)
|
||||
self.dut.qsfp1_rx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp1_tx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp1_rx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp1_tx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp1_rx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp1_tx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp1_rx_rst_4.setimmediatevalue(0)
|
||||
self.dut.qsfp1_tx_rst_4.setimmediatevalue(0)
|
||||
for x in range(2):
|
||||
for y in range(1, 5):
|
||||
getattr(self.dut, f"qsfp{x}_rx_rst_{y}").setimmediatevalue(0)
|
||||
getattr(self.dut, f"qsfp{x}_tx_rst_{y}").setimmediatevalue(0)
|
||||
|
||||
await self.rc.enumerate()
|
||||
|
||||
@ -412,22 +322,10 @@ class TB(object):
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
|
||||
if self.loopback_enable:
|
||||
if not self.qsfp0_1_sink.empty():
|
||||
await self.qsfp0_1_source.send(await self.qsfp0_1_sink.recv())
|
||||
if not self.qsfp0_2_sink.empty():
|
||||
await self.qsfp0_2_source.send(await self.qsfp0_2_sink.recv())
|
||||
if not self.qsfp0_3_sink.empty():
|
||||
await self.qsfp0_3_source.send(await self.qsfp0_3_sink.recv())
|
||||
if not self.qsfp0_4_sink.empty():
|
||||
await self.qsfp0_4_source.send(await self.qsfp0_4_sink.recv())
|
||||
if not self.qsfp1_1_sink.empty():
|
||||
await self.qsfp1_1_source.send(await self.qsfp1_1_sink.recv())
|
||||
if not self.qsfp1_2_sink.empty():
|
||||
await self.qsfp1_2_source.send(await self.qsfp1_2_sink.recv())
|
||||
if not self.qsfp1_3_sink.empty():
|
||||
await self.qsfp1_3_source.send(await self.qsfp1_3_sink.recv())
|
||||
if not self.qsfp1_4_sink.empty():
|
||||
await self.qsfp1_4_source.send(await self.qsfp1_4_sink.recv())
|
||||
for x in range(len(self.qsfp_sink)):
|
||||
for y in range(len(self.qsfp_sink[x])):
|
||||
if not self.qsfp_sink[x][y].empty():
|
||||
await self.qsfp_source[x][y].send(await self.qsfp_sink[x][y].recv())
|
||||
|
||||
|
||||
@cocotb.test()
|
||||
@ -458,10 +356,10 @@ async def run_test_nic(dut):
|
||||
|
||||
await tb.driver.interfaces[0].start_xmit(data, 0)
|
||||
|
||||
pkt = await tb.qsfp0_1_sink.recv()
|
||||
pkt = await tb.qsfp_sink[0][0].recv()
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
|
||||
await tb.qsfp0_1_source.send(pkt)
|
||||
await tb.qsfp_source[0][0].send(pkt)
|
||||
|
||||
pkt = await tb.driver.interfaces[0].recv()
|
||||
|
||||
@ -481,10 +379,10 @@ async def run_test_nic(dut):
|
||||
|
||||
await tb.driver.interfaces[0].start_xmit(test_pkt2.build(), 0, 34, 6)
|
||||
|
||||
pkt = await tb.qsfp0_1_sink.recv()
|
||||
pkt = await tb.qsfp_sink[0][0].recv()
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
|
||||
await tb.qsfp0_1_source.send(pkt)
|
||||
await tb.qsfp_source[0][0].send(pkt)
|
||||
|
||||
pkt = await tb.driver.interfaces[0].recv()
|
||||
|
||||
|
@ -250,30 +250,17 @@ class TB(object):
|
||||
cocotb.start_soon(Clock(dut.ptp_sample_clk, 8, units="ns").start())
|
||||
|
||||
# Ethernet
|
||||
cocotb.start_soon(Clock(dut.sfp_1_rx_clk, 6.4, units="ns").start())
|
||||
self.sfp_1_source = XgmiiSource(dut.sfp_1_rxd, dut.sfp_1_rxc, dut.sfp_1_rx_clk, dut.sfp_1_rx_rst)
|
||||
cocotb.start_soon(Clock(dut.sfp_1_tx_clk, 6.4, units="ns").start())
|
||||
self.sfp_1_sink = XgmiiSink(dut.sfp_1_txd, dut.sfp_1_txc, dut.sfp_1_tx_clk, dut.sfp_1_tx_rst)
|
||||
self.sfp_source = []
|
||||
self.sfp_sink = []
|
||||
|
||||
cocotb.start_soon(Clock(dut.sfp_2_rx_clk, 6.4, units="ns").start())
|
||||
self.sfp_2_source = XgmiiSource(dut.sfp_2_rxd, dut.sfp_2_rxc, dut.sfp_2_rx_clk, dut.sfp_2_rx_rst)
|
||||
cocotb.start_soon(Clock(dut.sfp_2_tx_clk, 6.4, units="ns").start())
|
||||
self.sfp_2_sink = XgmiiSink(dut.sfp_2_txd, dut.sfp_2_txc, dut.sfp_2_tx_clk, dut.sfp_2_tx_rst)
|
||||
|
||||
cocotb.start_soon(Clock(dut.sfp_3_rx_clk, 6.4, units="ns").start())
|
||||
self.sfp_3_source = XgmiiSource(dut.sfp_3_rxd, dut.sfp_3_rxc, dut.sfp_3_rx_clk, dut.sfp_3_rx_rst)
|
||||
cocotb.start_soon(Clock(dut.sfp_3_tx_clk, 6.4, units="ns").start())
|
||||
self.sfp_3_sink = XgmiiSink(dut.sfp_3_txd, dut.sfp_3_txc, dut.sfp_3_tx_clk, dut.sfp_3_tx_rst)
|
||||
|
||||
cocotb.start_soon(Clock(dut.sfp_4_rx_clk, 6.4, units="ns").start())
|
||||
self.sfp_4_source = XgmiiSource(dut.sfp_4_rxd, dut.sfp_4_rxc, dut.sfp_4_rx_clk, dut.sfp_4_rx_rst)
|
||||
cocotb.start_soon(Clock(dut.sfp_4_tx_clk, 6.4, units="ns").start())
|
||||
self.sfp_4_sink = XgmiiSink(dut.sfp_4_txd, dut.sfp_4_txc, dut.sfp_4_tx_clk, dut.sfp_4_tx_rst)
|
||||
|
||||
dut.sfp_1_rx_status.setimmediatevalue(1)
|
||||
dut.sfp_2_rx_status.setimmediatevalue(1)
|
||||
dut.sfp_3_rx_status.setimmediatevalue(1)
|
||||
dut.sfp_4_rx_status.setimmediatevalue(1)
|
||||
for k in range(1, 5):
|
||||
cocotb.start_soon(Clock(getattr(dut, f"sfp_{k}_rx_clk"), 6.4, units="ns").start())
|
||||
source = XgmiiSource(getattr(dut, f"sfp_{k}_rxd"), getattr(dut, f"sfp_{k}_rxc"), getattr(dut, f"sfp_{k}_rx_clk"), getattr(dut, f"sfp_{k}_rx_rst"))
|
||||
self.sfp_source.append(source)
|
||||
cocotb.start_soon(Clock(getattr(dut, f"sfp_{k}_tx_clk"), 6.4, units="ns").start())
|
||||
sink = XgmiiSink(getattr(dut, f"sfp_{k}_txd"), getattr(dut, f"sfp_{k}_txc"), getattr(dut, f"sfp_{k}_tx_clk"), getattr(dut, f"sfp_{k}_tx_rst"))
|
||||
self.sfp_sink.append(sink)
|
||||
getattr(dut, f"sfp_{k}_rx_status").setimmediatevalue(1)
|
||||
|
||||
dut.btn.setimmediatevalue(0)
|
||||
|
||||
@ -286,27 +273,17 @@ class TB(object):
|
||||
async def init(self):
|
||||
|
||||
self.dut.ptp_rst.setimmediatevalue(0)
|
||||
self.dut.sfp_1_rx_rst.setimmediatevalue(0)
|
||||
self.dut.sfp_1_tx_rst.setimmediatevalue(0)
|
||||
self.dut.sfp_2_rx_rst.setimmediatevalue(0)
|
||||
self.dut.sfp_2_tx_rst.setimmediatevalue(0)
|
||||
self.dut.sfp_3_rx_rst.setimmediatevalue(0)
|
||||
self.dut.sfp_3_tx_rst.setimmediatevalue(0)
|
||||
self.dut.sfp_4_rx_rst.setimmediatevalue(0)
|
||||
self.dut.sfp_4_tx_rst.setimmediatevalue(0)
|
||||
for k in range(1, 5):
|
||||
getattr(self.dut, f"sfp_{k}_rx_rst").setimmediatevalue(0)
|
||||
getattr(self.dut, f"sfp_{k}_tx_rst").setimmediatevalue(0)
|
||||
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
|
||||
self.dut.ptp_rst.setimmediatevalue(1)
|
||||
self.dut.sfp_1_rx_rst.setimmediatevalue(1)
|
||||
self.dut.sfp_1_tx_rst.setimmediatevalue(1)
|
||||
self.dut.sfp_2_rx_rst.setimmediatevalue(1)
|
||||
self.dut.sfp_2_tx_rst.setimmediatevalue(1)
|
||||
self.dut.sfp_3_rx_rst.setimmediatevalue(1)
|
||||
self.dut.sfp_3_tx_rst.setimmediatevalue(1)
|
||||
self.dut.sfp_4_rx_rst.setimmediatevalue(1)
|
||||
self.dut.sfp_4_tx_rst.setimmediatevalue(1)
|
||||
for k in range(1, 5):
|
||||
getattr(self.dut, f"sfp_{k}_rx_rst").setimmediatevalue(1)
|
||||
getattr(self.dut, f"sfp_{k}_tx_rst").setimmediatevalue(1)
|
||||
|
||||
await FallingEdge(self.dut.rst_250mhz)
|
||||
await Timer(100, 'ns')
|
||||
@ -315,14 +292,9 @@ class TB(object):
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
|
||||
self.dut.ptp_rst.setimmediatevalue(0)
|
||||
self.dut.sfp_1_rx_rst.setimmediatevalue(0)
|
||||
self.dut.sfp_1_tx_rst.setimmediatevalue(0)
|
||||
self.dut.sfp_2_rx_rst.setimmediatevalue(0)
|
||||
self.dut.sfp_2_tx_rst.setimmediatevalue(0)
|
||||
self.dut.sfp_3_rx_rst.setimmediatevalue(0)
|
||||
self.dut.sfp_3_tx_rst.setimmediatevalue(0)
|
||||
self.dut.sfp_4_rx_rst.setimmediatevalue(0)
|
||||
self.dut.sfp_4_tx_rst.setimmediatevalue(0)
|
||||
for k in range(1, 5):
|
||||
getattr(self.dut, f"sfp_{k}_rx_rst").setimmediatevalue(0)
|
||||
getattr(self.dut, f"sfp_{k}_tx_rst").setimmediatevalue(0)
|
||||
|
||||
await self.rc.enumerate()
|
||||
|
||||
@ -331,14 +303,9 @@ class TB(object):
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
|
||||
if self.loopback_enable:
|
||||
if not self.sfp_1_sink.empty():
|
||||
await self.sfp_1_source.send(await self.sfp_1_sink.recv())
|
||||
if not self.sfp_2_sink.empty():
|
||||
await self.sfp_2_source.send(await self.sfp_2_sink.recv())
|
||||
if not self.sfp_3_sink.empty():
|
||||
await self.sfp_3_source.send(await self.sfp_3_sink.recv())
|
||||
if not self.sfp_4_sink.empty():
|
||||
await self.sfp_4_source.send(await self.sfp_4_sink.recv())
|
||||
for x in range(len(self.sfp_sink)):
|
||||
if not self.sfp_sink[x].empty():
|
||||
await self.sfp_source[x].send(await self.sfp_sink[x].recv())
|
||||
|
||||
|
||||
@cocotb.test()
|
||||
@ -369,10 +336,10 @@ async def run_test_nic(dut):
|
||||
|
||||
await tb.driver.interfaces[0].start_xmit(data, 0)
|
||||
|
||||
pkt = await tb.sfp_1_sink.recv()
|
||||
pkt = await tb.sfp_sink[0].recv()
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
|
||||
await tb.sfp_1_source.send(pkt)
|
||||
await tb.sfp_source[0].send(pkt)
|
||||
|
||||
pkt = await tb.driver.interfaces[0].recv()
|
||||
|
||||
@ -381,10 +348,10 @@ async def run_test_nic(dut):
|
||||
|
||||
# await tb.driver.interfaces[1].start_xmit(data, 0)
|
||||
|
||||
# pkt = await tb.sfp_2_sink.recv()
|
||||
# pkt = await tb.sfp_sink[]1.recv()
|
||||
# tb.log.info("Packet: %s", pkt)
|
||||
|
||||
# await tb.sfp_2_source.send(pkt)
|
||||
# await tb.sfp_source[]1.send(pkt)
|
||||
|
||||
# pkt = await tb.driver.interfaces[1].recv()
|
||||
|
||||
@ -404,10 +371,10 @@ async def run_test_nic(dut):
|
||||
|
||||
await tb.driver.interfaces[0].start_xmit(test_pkt2.build(), 0, 34, 6)
|
||||
|
||||
pkt = await tb.sfp_1_sink.recv()
|
||||
pkt = await tb.sfp_sink[0].recv()
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
|
||||
await tb.sfp_1_source.send(pkt)
|
||||
await tb.sfp_source[0].send(pkt)
|
||||
|
||||
pkt = await tb.driver.interfaces[0].recv()
|
||||
|
||||
|
@ -250,29 +250,25 @@ class TB(object):
|
||||
cocotb.start_soon(Clock(dut.ptp_sample_clk, 8, units="ns").start())
|
||||
|
||||
# Ethernet
|
||||
cocotb.start_soon(Clock(dut.sfp_1_rx_clk, 6.4, units="ns").start())
|
||||
self.sfp_1_source = XgmiiSource(dut.sfp_1_rxd, dut.sfp_1_rxc, dut.sfp_1_rx_clk, dut.sfp_1_rx_rst)
|
||||
cocotb.start_soon(Clock(dut.sfp_1_tx_clk, 6.4, units="ns").start())
|
||||
self.sfp_1_sink = XgmiiSink(dut.sfp_1_txd, dut.sfp_1_txc, dut.sfp_1_tx_clk, dut.sfp_1_tx_rst)
|
||||
self.sfp_source = []
|
||||
self.sfp_sink = []
|
||||
|
||||
cocotb.start_soon(Clock(dut.sfp_2_rx_clk, 6.4, units="ns").start())
|
||||
self.sfp_2_source = XgmiiSource(dut.sfp_2_rxd, dut.sfp_2_rxc, dut.sfp_2_rx_clk, dut.sfp_2_rx_rst)
|
||||
cocotb.start_soon(Clock(dut.sfp_2_tx_clk, 6.4, units="ns").start())
|
||||
self.sfp_2_sink = XgmiiSink(dut.sfp_2_txd, dut.sfp_2_txc, dut.sfp_2_tx_clk, dut.sfp_2_tx_rst)
|
||||
|
||||
dut.sfp_1_rx_status.setimmediatevalue(1)
|
||||
dut.sfp_2_rx_status.setimmediatevalue(1)
|
||||
for k in range(1, 3):
|
||||
cocotb.start_soon(Clock(getattr(dut, f"sfp_{k}_rx_clk"), 6.4, units="ns").start())
|
||||
source = XgmiiSource(getattr(dut, f"sfp_{k}_rxd"), getattr(dut, f"sfp_{k}_rxc"), getattr(dut, f"sfp_{k}_rx_clk"), getattr(dut, f"sfp_{k}_rx_rst"))
|
||||
self.sfp_source.append(source)
|
||||
cocotb.start_soon(Clock(getattr(dut, f"sfp_{k}_tx_clk"), 6.4, units="ns").start())
|
||||
sink = XgmiiSink(getattr(dut, f"sfp_{k}_txd"), getattr(dut, f"sfp_{k}_txc"), getattr(dut, f"sfp_{k}_tx_clk"), getattr(dut, f"sfp_{k}_tx_rst"))
|
||||
self.sfp_sink.append(sink)
|
||||
getattr(dut, f"sfp_{k}_rx_status").setimmediatevalue(1)
|
||||
getattr(dut, f"sfp_{k}_npres").setimmediatevalue(1)
|
||||
getattr(dut, f"sfp_{k}_los").setimmediatevalue(1)
|
||||
|
||||
cocotb.start_soon(Clock(dut.sfp_drp_clk, 8, units="ns").start())
|
||||
dut.sfp_drp_rst.setimmediatevalue(0)
|
||||
dut.sfp_drp_do.setimmediatevalue(0)
|
||||
dut.sfp_drp_rdy.setimmediatevalue(0)
|
||||
|
||||
dut.sfp_1_npres.setimmediatevalue(0)
|
||||
dut.sfp_2_npres.setimmediatevalue(0)
|
||||
dut.sfp_1_los.setimmediatevalue(0)
|
||||
dut.sfp_2_los.setimmediatevalue(0)
|
||||
|
||||
dut.sma_in.setimmediatevalue(0)
|
||||
|
||||
dut.sfp_i2c_scl_i.setimmediatevalue(1)
|
||||
@ -290,19 +286,17 @@ class TB(object):
|
||||
async def init(self):
|
||||
|
||||
self.dut.ptp_rst.setimmediatevalue(0)
|
||||
self.dut.sfp_1_rx_rst.setimmediatevalue(0)
|
||||
self.dut.sfp_1_tx_rst.setimmediatevalue(0)
|
||||
self.dut.sfp_2_rx_rst.setimmediatevalue(0)
|
||||
self.dut.sfp_2_tx_rst.setimmediatevalue(0)
|
||||
for k in range(1, 3):
|
||||
getattr(self.dut, f"sfp_{k}_rx_rst").setimmediatevalue(0)
|
||||
getattr(self.dut, f"sfp_{k}_tx_rst").setimmediatevalue(0)
|
||||
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
|
||||
self.dut.ptp_rst.setimmediatevalue(1)
|
||||
self.dut.sfp_1_rx_rst.setimmediatevalue(1)
|
||||
self.dut.sfp_1_tx_rst.setimmediatevalue(1)
|
||||
self.dut.sfp_2_rx_rst.setimmediatevalue(1)
|
||||
self.dut.sfp_2_tx_rst.setimmediatevalue(1)
|
||||
for k in range(1, 3):
|
||||
getattr(self.dut, f"sfp_{k}_rx_rst").setimmediatevalue(1)
|
||||
getattr(self.dut, f"sfp_{k}_tx_rst").setimmediatevalue(1)
|
||||
|
||||
await FallingEdge(self.dut.rst_250mhz)
|
||||
await Timer(100, 'ns')
|
||||
@ -311,10 +305,9 @@ class TB(object):
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
|
||||
self.dut.ptp_rst.setimmediatevalue(0)
|
||||
self.dut.sfp_1_rx_rst.setimmediatevalue(0)
|
||||
self.dut.sfp_1_tx_rst.setimmediatevalue(0)
|
||||
self.dut.sfp_2_rx_rst.setimmediatevalue(0)
|
||||
self.dut.sfp_2_tx_rst.setimmediatevalue(0)
|
||||
for k in range(1, 3):
|
||||
getattr(self.dut, f"sfp_{k}_rx_rst").setimmediatevalue(0)
|
||||
getattr(self.dut, f"sfp_{k}_tx_rst").setimmediatevalue(0)
|
||||
|
||||
await self.rc.enumerate()
|
||||
|
||||
@ -323,10 +316,9 @@ class TB(object):
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
|
||||
if self.loopback_enable:
|
||||
if not self.sfp_1_sink.empty():
|
||||
await self.sfp_1_source.send(await self.sfp_1_sink.recv())
|
||||
if not self.sfp_2_sink.empty():
|
||||
await self.sfp_2_source.send(await self.sfp_2_sink.recv())
|
||||
for x in range(len(self.sfp_sink)):
|
||||
if not self.sfp_sink[x].empty():
|
||||
await self.sfp_source[x].send(await self.sfp_sink[x].recv())
|
||||
|
||||
|
||||
@cocotb.test()
|
||||
@ -357,10 +349,10 @@ async def run_test_nic(dut):
|
||||
|
||||
await tb.driver.interfaces[0].start_xmit(data, 0)
|
||||
|
||||
pkt = await tb.sfp_1_sink.recv()
|
||||
pkt = await tb.sfp_sink[0].recv()
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
|
||||
await tb.sfp_1_source.send(pkt)
|
||||
await tb.sfp_source[0].send(pkt)
|
||||
|
||||
pkt = await tb.driver.interfaces[0].recv()
|
||||
|
||||
@ -369,10 +361,10 @@ async def run_test_nic(dut):
|
||||
|
||||
# await tb.driver.interfaces[1].start_xmit(data, 0)
|
||||
|
||||
# pkt = await tb.sfp_2_sink.recv()
|
||||
# pkt = await tb.sfp_sink[1].recv()
|
||||
# tb.log.info("Packet: %s", pkt)
|
||||
|
||||
# await tb.sfp_2_source.send(pkt)
|
||||
# await tb.sfp_source[1].send(pkt)
|
||||
|
||||
# pkt = await tb.driver.interfaces[1].recv()
|
||||
|
||||
@ -392,10 +384,10 @@ async def run_test_nic(dut):
|
||||
|
||||
await tb.driver.interfaces[0].start_xmit(test_pkt2.build(), 0, 34, 6)
|
||||
|
||||
pkt = await tb.sfp_1_sink.recv()
|
||||
pkt = await tb.sfp_sink[0].recv()
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
|
||||
await tb.sfp_1_source.send(pkt)
|
||||
await tb.sfp_source[0].send(pkt)
|
||||
|
||||
pkt = await tb.driver.interfaces[0].recv()
|
||||
|
||||
|
@ -276,87 +276,33 @@ class TB(object):
|
||||
cocotb.start_soon(Clock(dut.ptp_sample_clk, 8, units="ns").start())
|
||||
|
||||
# Ethernet
|
||||
cocotb.start_soon(Clock(dut.qsfp_0_rx_clk_0, 2.56, units="ns").start())
|
||||
self.qsfp_0_0_source = XgmiiSource(dut.qsfp_0_rxd_0, dut.qsfp_0_rxc_0, dut.qsfp_0_rx_clk_0, dut.qsfp_0_rx_rst_0)
|
||||
cocotb.start_soon(Clock(dut.qsfp_0_tx_clk_0, 2.56, units="ns").start())
|
||||
self.qsfp_0_0_sink = XgmiiSink(dut.qsfp_0_txd_0, dut.qsfp_0_txc_0, dut.qsfp_0_tx_clk_0, dut.qsfp_0_tx_rst_0)
|
||||
self.qsfp_source = []
|
||||
self.qsfp_sink = []
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp_0_rx_clk_1, 2.56, units="ns").start())
|
||||
self.qsfp_0_1_source = XgmiiSource(dut.qsfp_0_rxd_1, dut.qsfp_0_rxc_1, dut.qsfp_0_rx_clk_1, dut.qsfp_0_rx_rst_1)
|
||||
cocotb.start_soon(Clock(dut.qsfp_0_tx_clk_1, 2.56, units="ns").start())
|
||||
self.qsfp_0_1_sink = XgmiiSink(dut.qsfp_0_txd_1, dut.qsfp_0_txc_1, dut.qsfp_0_tx_clk_1, dut.qsfp_0_tx_rst_1)
|
||||
for x in range(2):
|
||||
sources = []
|
||||
sinks = []
|
||||
for y in range(4):
|
||||
cocotb.start_soon(Clock(getattr(dut, f"qsfp_{x}_rx_clk_{y}"), 2.56, units="ns").start())
|
||||
source = XgmiiSource(getattr(dut, f"qsfp_{x}_rxd_{y}"), getattr(dut, f"qsfp_{x}_rxc_{y}"), getattr(dut, f"qsfp_{x}_rx_clk_{y}"), getattr(dut, f"qsfp_{x}_rx_rst_{y}"))
|
||||
sources.append(source)
|
||||
cocotb.start_soon(Clock(getattr(dut, f"qsfp_{x}_tx_clk_{y}"), 2.56, units="ns").start())
|
||||
sink = XgmiiSink(getattr(dut, f"qsfp_{x}_txd_{y}"), getattr(dut, f"qsfp_{x}_txc_{y}"), getattr(dut, f"qsfp_{x}_tx_clk_{y}"), getattr(dut, f"qsfp_{x}_tx_rst_{y}"))
|
||||
sinks.append(sink)
|
||||
getattr(dut, f"qsfp_{x}_rx_status_{y}").setimmediatevalue(1)
|
||||
getattr(dut, f"qsfp_{x}_rx_error_count_{y}").setimmediatevalue(0)
|
||||
self.qsfp_source.append(sources)
|
||||
self.qsfp_sink.append(sinks)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp_0_rx_clk_2, 2.56, units="ns").start())
|
||||
self.qsfp_0_2_source = XgmiiSource(dut.qsfp_0_rxd_2, dut.qsfp_0_rxc_2, dut.qsfp_0_rx_clk_2, dut.qsfp_0_rx_rst_2)
|
||||
cocotb.start_soon(Clock(dut.qsfp_0_tx_clk_2, 2.56, units="ns").start())
|
||||
self.qsfp_0_2_sink = XgmiiSink(dut.qsfp_0_txd_2, dut.qsfp_0_txc_2, dut.qsfp_0_tx_clk_2, dut.qsfp_0_tx_rst_2)
|
||||
cocotb.start_soon(Clock(getattr(dut, f"qsfp_{x}_drp_clk"), 8, units="ns").start())
|
||||
getattr(dut, f"qsfp_{x}_drp_rst").setimmediatevalue(0)
|
||||
getattr(dut, f"qsfp_{x}_drp_do").setimmediatevalue(0)
|
||||
getattr(dut, f"qsfp_{x}_drp_rdy").setimmediatevalue(0)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp_0_rx_clk_3, 2.56, units="ns").start())
|
||||
self.qsfp_0_3_source = XgmiiSource(dut.qsfp_0_rxd_3, dut.qsfp_0_rxc_3, dut.qsfp_0_rx_clk_3, dut.qsfp_0_rx_rst_3)
|
||||
cocotb.start_soon(Clock(dut.qsfp_0_tx_clk_3, 2.56, units="ns").start())
|
||||
self.qsfp_0_3_sink = XgmiiSink(dut.qsfp_0_txd_3, dut.qsfp_0_txc_3, dut.qsfp_0_tx_clk_3, dut.qsfp_0_tx_rst_3)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp_1_rx_clk_0, 2.56, units="ns").start())
|
||||
self.qsfp_1_0_source = XgmiiSource(dut.qsfp_1_rxd_0, dut.qsfp_1_rxc_0, dut.qsfp_1_rx_clk_0, dut.qsfp_1_rx_rst_0)
|
||||
cocotb.start_soon(Clock(dut.qsfp_1_tx_clk_0, 2.56, units="ns").start())
|
||||
self.qsfp_1_0_sink = XgmiiSink(dut.qsfp_1_txd_0, dut.qsfp_1_txc_0, dut.qsfp_1_tx_clk_0, dut.qsfp_1_tx_rst_0)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp_1_rx_clk_1, 2.56, units="ns").start())
|
||||
self.qsfp_1_1_source = XgmiiSource(dut.qsfp_1_rxd_1, dut.qsfp_1_rxc_1, dut.qsfp_1_rx_clk_1, dut.qsfp_1_rx_rst_1)
|
||||
cocotb.start_soon(Clock(dut.qsfp_1_tx_clk_1, 2.56, units="ns").start())
|
||||
self.qsfp_1_1_sink = XgmiiSink(dut.qsfp_1_txd_1, dut.qsfp_1_txc_1, dut.qsfp_1_tx_clk_1, dut.qsfp_1_tx_rst_1)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp_1_rx_clk_2, 2.56, units="ns").start())
|
||||
self.qsfp_1_2_source = XgmiiSource(dut.qsfp_1_rxd_2, dut.qsfp_1_rxc_2, dut.qsfp_1_rx_clk_2, dut.qsfp_1_rx_rst_2)
|
||||
cocotb.start_soon(Clock(dut.qsfp_1_tx_clk_2, 2.56, units="ns").start())
|
||||
self.qsfp_1_2_sink = XgmiiSink(dut.qsfp_1_txd_2, dut.qsfp_1_txc_2, dut.qsfp_1_tx_clk_2, dut.qsfp_1_tx_rst_2)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp_1_rx_clk_3, 2.56, units="ns").start())
|
||||
self.qsfp_1_3_source = XgmiiSource(dut.qsfp_1_rxd_3, dut.qsfp_1_rxc_3, dut.qsfp_1_rx_clk_3, dut.qsfp_1_rx_rst_3)
|
||||
cocotb.start_soon(Clock(dut.qsfp_1_tx_clk_3, 2.56, units="ns").start())
|
||||
self.qsfp_1_3_sink = XgmiiSink(dut.qsfp_1_txd_3, dut.qsfp_1_txc_3, dut.qsfp_1_tx_clk_3, dut.qsfp_1_tx_rst_3)
|
||||
|
||||
dut.qsfp_0_rx_status_0.setimmediatevalue(1)
|
||||
dut.qsfp_0_rx_status_1.setimmediatevalue(1)
|
||||
dut.qsfp_0_rx_status_2.setimmediatevalue(1)
|
||||
dut.qsfp_0_rx_status_3.setimmediatevalue(1)
|
||||
|
||||
dut.qsfp_1_rx_status_0.setimmediatevalue(1)
|
||||
dut.qsfp_1_rx_status_1.setimmediatevalue(1)
|
||||
dut.qsfp_1_rx_status_2.setimmediatevalue(1)
|
||||
dut.qsfp_1_rx_status_3.setimmediatevalue(1)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp_0_drp_clk, 8, units="ns").start())
|
||||
dut.qsfp_0_drp_rst.setimmediatevalue(0)
|
||||
dut.qsfp_0_drp_do.setimmediatevalue(0)
|
||||
dut.qsfp_0_drp_rdy.setimmediatevalue(0)
|
||||
|
||||
dut.qsfp_0_rx_error_count_0.setimmediatevalue(0)
|
||||
dut.qsfp_0_rx_error_count_1.setimmediatevalue(0)
|
||||
dut.qsfp_0_rx_error_count_2.setimmediatevalue(0)
|
||||
dut.qsfp_0_rx_error_count_3.setimmediatevalue(0)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp_1_drp_clk, 8, units="ns").start())
|
||||
dut.qsfp_1_drp_rst.setimmediatevalue(0)
|
||||
dut.qsfp_1_drp_do.setimmediatevalue(0)
|
||||
dut.qsfp_1_drp_rdy.setimmediatevalue(0)
|
||||
|
||||
dut.qsfp_1_rx_error_count_0.setimmediatevalue(0)
|
||||
dut.qsfp_1_rx_error_count_1.setimmediatevalue(0)
|
||||
dut.qsfp_1_rx_error_count_2.setimmediatevalue(0)
|
||||
dut.qsfp_1_rx_error_count_3.setimmediatevalue(0)
|
||||
|
||||
dut.qsfp_0_modprsl.setimmediatevalue(0)
|
||||
dut.qsfp_0_intl.setimmediatevalue(1)
|
||||
|
||||
dut.qsfp_0_i2c_scl_i.setimmediatevalue(1)
|
||||
dut.qsfp_0_i2c_sda_i.setimmediatevalue(1)
|
||||
|
||||
dut.qsfp_1_modprsl.setimmediatevalue(0)
|
||||
dut.qsfp_1_intl.setimmediatevalue(1)
|
||||
|
||||
dut.qsfp_1_i2c_scl_i.setimmediatevalue(1)
|
||||
dut.qsfp_1_i2c_sda_i.setimmediatevalue(1)
|
||||
getattr(dut, f"qsfp_{x}_modprsl").setimmediatevalue(0)
|
||||
getattr(dut, f"qsfp_{x}_intl").setimmediatevalue(1)
|
||||
getattr(dut, f"qsfp_{x}_i2c_scl_i").setimmediatevalue(1)
|
||||
getattr(dut, f"qsfp_{x}_i2c_sda_i").setimmediatevalue(1)
|
||||
|
||||
dut.sma_in.setimmediatevalue(0)
|
||||
|
||||
@ -371,43 +317,19 @@ class TB(object):
|
||||
async def init(self):
|
||||
|
||||
self.dut.ptp_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp_0_rx_rst_0.setimmediatevalue(0)
|
||||
self.dut.qsfp_0_tx_rst_0.setimmediatevalue(0)
|
||||
self.dut.qsfp_0_rx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp_0_tx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp_0_rx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp_0_tx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp_0_rx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp_0_tx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp_1_rx_rst_0.setimmediatevalue(0)
|
||||
self.dut.qsfp_1_tx_rst_0.setimmediatevalue(0)
|
||||
self.dut.qsfp_1_rx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp_1_tx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp_1_rx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp_1_tx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp_1_rx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp_1_tx_rst_3.setimmediatevalue(0)
|
||||
for x in range(2):
|
||||
for y in range(4):
|
||||
getattr(self.dut, f"qsfp_{x}_rx_rst_{y}").setimmediatevalue(0)
|
||||
getattr(self.dut, f"qsfp_{x}_tx_rst_{y}").setimmediatevalue(0)
|
||||
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
|
||||
self.dut.ptp_rst.setimmediatevalue(1)
|
||||
self.dut.qsfp_0_rx_rst_0.setimmediatevalue(1)
|
||||
self.dut.qsfp_0_tx_rst_0.setimmediatevalue(1)
|
||||
self.dut.qsfp_0_rx_rst_1.setimmediatevalue(1)
|
||||
self.dut.qsfp_0_tx_rst_1.setimmediatevalue(1)
|
||||
self.dut.qsfp_0_rx_rst_2.setimmediatevalue(1)
|
||||
self.dut.qsfp_0_tx_rst_2.setimmediatevalue(1)
|
||||
self.dut.qsfp_0_rx_rst_3.setimmediatevalue(1)
|
||||
self.dut.qsfp_0_tx_rst_3.setimmediatevalue(1)
|
||||
self.dut.qsfp_1_rx_rst_0.setimmediatevalue(1)
|
||||
self.dut.qsfp_1_tx_rst_0.setimmediatevalue(1)
|
||||
self.dut.qsfp_1_rx_rst_1.setimmediatevalue(1)
|
||||
self.dut.qsfp_1_tx_rst_1.setimmediatevalue(1)
|
||||
self.dut.qsfp_1_rx_rst_2.setimmediatevalue(1)
|
||||
self.dut.qsfp_1_tx_rst_2.setimmediatevalue(1)
|
||||
self.dut.qsfp_1_rx_rst_3.setimmediatevalue(1)
|
||||
self.dut.qsfp_1_tx_rst_3.setimmediatevalue(1)
|
||||
for x in range(2):
|
||||
for y in range(4):
|
||||
getattr(self.dut, f"qsfp_{x}_rx_rst_{y}").setimmediatevalue(1)
|
||||
getattr(self.dut, f"qsfp_{x}_tx_rst_{y}").setimmediatevalue(1)
|
||||
|
||||
await FallingEdge(self.dut.rst_250mhz)
|
||||
await Timer(100, 'ns')
|
||||
@ -416,22 +338,10 @@ class TB(object):
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
|
||||
self.dut.ptp_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp_0_rx_rst_0.setimmediatevalue(0)
|
||||
self.dut.qsfp_0_tx_rst_0.setimmediatevalue(0)
|
||||
self.dut.qsfp_0_rx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp_0_tx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp_0_rx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp_0_tx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp_0_rx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp_0_tx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp_1_rx_rst_0.setimmediatevalue(0)
|
||||
self.dut.qsfp_1_tx_rst_0.setimmediatevalue(0)
|
||||
self.dut.qsfp_1_rx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp_1_tx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp_1_rx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp_1_tx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp_1_rx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp_1_tx_rst_3.setimmediatevalue(0)
|
||||
for x in range(2):
|
||||
for y in range(4):
|
||||
getattr(self.dut, f"qsfp_{x}_rx_rst_{y}").setimmediatevalue(0)
|
||||
getattr(self.dut, f"qsfp_{x}_tx_rst_{y}").setimmediatevalue(0)
|
||||
|
||||
await self.rc.enumerate()
|
||||
|
||||
@ -440,22 +350,10 @@ class TB(object):
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
|
||||
if self.loopback_enable:
|
||||
if not self.qsfp_0_0_sink.empty():
|
||||
await self.qsfp_0_0_source.send(await self.qsfp_0_0_sink.recv())
|
||||
if not self.qsfp_0_1_sink.empty():
|
||||
await self.qsfp_0_1_source.send(await self.qsfp_0_1_sink.recv())
|
||||
if not self.qsfp_0_2_sink.empty():
|
||||
await self.qsfp_0_2_source.send(await self.qsfp_0_2_sink.recv())
|
||||
if not self.qsfp_0_3_sink.empty():
|
||||
await self.qsfp_0_3_source.send(await self.qsfp_0_3_sink.recv())
|
||||
if not self.qsfp_1_0_sink.empty():
|
||||
await self.qsfp_1_0_source.send(await self.qsfp_1_0_sink.recv())
|
||||
if not self.qsfp_1_1_sink.empty():
|
||||
await self.qsfp_1_1_source.send(await self.qsfp_1_1_sink.recv())
|
||||
if not self.qsfp_1_2_sink.empty():
|
||||
await self.qsfp_1_2_source.send(await self.qsfp_1_2_sink.recv())
|
||||
if not self.qsfp_1_3_sink.empty():
|
||||
await self.qsfp_1_3_source.send(await self.qsfp_1_3_sink.recv())
|
||||
for x in range(len(self.qsfp_sink)):
|
||||
for y in range(len(self.qsfp_sink[x])):
|
||||
if not self.qsfp_sink[x][y].empty():
|
||||
await self.qsfp_source[x][y].send(await self.qsfp_sink[x][y].recv())
|
||||
|
||||
|
||||
@cocotb.test()
|
||||
@ -486,10 +384,10 @@ async def run_test_nic(dut):
|
||||
|
||||
await tb.driver.interfaces[0].start_xmit(data, 0)
|
||||
|
||||
pkt = await tb.qsfp_0_0_sink.recv()
|
||||
pkt = await tb.qsfp_sink[0][0].recv()
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
|
||||
await tb.qsfp_0_0_source.send(pkt)
|
||||
await tb.qsfp_source[0][0].send(pkt)
|
||||
|
||||
pkt = await tb.driver.interfaces[0].recv()
|
||||
|
||||
@ -498,10 +396,10 @@ async def run_test_nic(dut):
|
||||
|
||||
# await tb.driver.interfaces[1].start_xmit(data, 0)
|
||||
|
||||
# pkt = await tb.qsfp_1_0_sink.recv()
|
||||
# pkt = await tb.qsfp_sink[1][0].recv()
|
||||
# tb.log.info("Packet: %s", pkt)
|
||||
|
||||
# await tb.qsfp_1_0_source.send(pkt)
|
||||
# await tb.qsfp_source[1][0].send(pkt)
|
||||
|
||||
# pkt = await tb.driver.interfaces[1].recv()
|
||||
|
||||
@ -521,10 +419,10 @@ async def run_test_nic(dut):
|
||||
|
||||
await tb.driver.interfaces[0].start_xmit(test_pkt2.build(), 0, 34, 6)
|
||||
|
||||
pkt = await tb.qsfp_0_0_sink.recv()
|
||||
pkt = await tb.qsfp_sink[0][0].recv()
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
|
||||
await tb.qsfp_0_0_source.send(pkt)
|
||||
await tb.qsfp_source[0][0].send(pkt)
|
||||
|
||||
pkt = await tb.driver.interfaces[0].recv()
|
||||
|
||||
|
@ -276,32 +276,26 @@ class TB(object):
|
||||
cocotb.start_soon(Clock(dut.ptp_sample_clk, 8, units="ns").start())
|
||||
|
||||
# Ethernet
|
||||
cocotb.start_soon(Clock(dut.sfp_1_rx_clk, 2.56, units="ns").start())
|
||||
self.sfp_1_source = XgmiiSource(dut.sfp_1_rxd, dut.sfp_1_rxc, dut.sfp_1_rx_clk, dut.sfp_1_rx_rst)
|
||||
cocotb.start_soon(Clock(dut.sfp_1_tx_clk, 2.56, units="ns").start())
|
||||
self.sfp_1_sink = XgmiiSink(dut.sfp_1_txd, dut.sfp_1_txc, dut.sfp_1_tx_clk, dut.sfp_1_tx_rst)
|
||||
self.sfp_source = []
|
||||
self.sfp_sink = []
|
||||
|
||||
cocotb.start_soon(Clock(dut.sfp_2_rx_clk, 2.56, units="ns").start())
|
||||
self.sfp_2_source = XgmiiSource(dut.sfp_2_rxd, dut.sfp_2_rxc, dut.sfp_2_rx_clk, dut.sfp_2_rx_rst)
|
||||
cocotb.start_soon(Clock(dut.sfp_2_tx_clk, 2.56, units="ns").start())
|
||||
self.sfp_2_sink = XgmiiSink(dut.sfp_2_txd, dut.sfp_2_txc, dut.sfp_2_tx_clk, dut.sfp_2_tx_rst)
|
||||
|
||||
dut.sfp_1_rx_status.setimmediatevalue(1)
|
||||
dut.sfp_2_rx_status.setimmediatevalue(1)
|
||||
for k in range(1, 3):
|
||||
cocotb.start_soon(Clock(getattr(dut, f"sfp_{k}_rx_clk"), 2.56, units="ns").start())
|
||||
source = XgmiiSource(getattr(dut, f"sfp_{k}_rxd"), getattr(dut, f"sfp_{k}_rxc"), getattr(dut, f"sfp_{k}_rx_clk"), getattr(dut, f"sfp_{k}_rx_rst"))
|
||||
self.sfp_source.append(source)
|
||||
cocotb.start_soon(Clock(getattr(dut, f"sfp_{k}_tx_clk"), 2.56, units="ns").start())
|
||||
sink = XgmiiSink(getattr(dut, f"sfp_{k}_txd"), getattr(dut, f"sfp_{k}_txc"), getattr(dut, f"sfp_{k}_tx_clk"), getattr(dut, f"sfp_{k}_tx_rst"))
|
||||
self.sfp_sink.append(sink)
|
||||
getattr(dut, f"sfp_{k}_rx_status").setimmediatevalue(1)
|
||||
getattr(dut, f"sfp_{k}_rx_error_count").setimmediatevalue(0)
|
||||
getattr(dut, f"sfp_{k}_npres").setimmediatevalue(0)
|
||||
getattr(dut, f"sfp_{k}_los").setimmediatevalue(0)
|
||||
|
||||
cocotb.start_soon(Clock(dut.sfp_drp_clk, 8, units="ns").start())
|
||||
dut.sfp_drp_rst.setimmediatevalue(0)
|
||||
dut.sfp_drp_do.setimmediatevalue(0)
|
||||
dut.sfp_drp_rdy.setimmediatevalue(0)
|
||||
|
||||
dut.sfp_1_rx_error_count.setimmediatevalue(0)
|
||||
dut.sfp_2_rx_error_count.setimmediatevalue(0)
|
||||
|
||||
dut.sfp_1_npres.setimmediatevalue(0)
|
||||
dut.sfp_2_npres.setimmediatevalue(0)
|
||||
dut.sfp_1_los.setimmediatevalue(0)
|
||||
dut.sfp_2_los.setimmediatevalue(0)
|
||||
|
||||
dut.sma_in.setimmediatevalue(0)
|
||||
|
||||
dut.sfp_i2c_scl_i.setimmediatevalue(1)
|
||||
@ -319,19 +313,17 @@ class TB(object):
|
||||
async def init(self):
|
||||
|
||||
self.dut.ptp_rst.setimmediatevalue(0)
|
||||
self.dut.sfp_1_rx_rst.setimmediatevalue(0)
|
||||
self.dut.sfp_1_tx_rst.setimmediatevalue(0)
|
||||
self.dut.sfp_2_rx_rst.setimmediatevalue(0)
|
||||
self.dut.sfp_2_tx_rst.setimmediatevalue(0)
|
||||
for k in range(1, 3):
|
||||
getattr(self.dut, f"sfp_{k}_rx_rst").setimmediatevalue(0)
|
||||
getattr(self.dut, f"sfp_{k}_tx_rst").setimmediatevalue(0)
|
||||
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
|
||||
self.dut.ptp_rst.setimmediatevalue(1)
|
||||
self.dut.sfp_1_rx_rst.setimmediatevalue(1)
|
||||
self.dut.sfp_1_tx_rst.setimmediatevalue(1)
|
||||
self.dut.sfp_2_rx_rst.setimmediatevalue(1)
|
||||
self.dut.sfp_2_tx_rst.setimmediatevalue(1)
|
||||
for k in range(1, 3):
|
||||
getattr(self.dut, f"sfp_{k}_rx_rst").setimmediatevalue(1)
|
||||
getattr(self.dut, f"sfp_{k}_tx_rst").setimmediatevalue(1)
|
||||
|
||||
await FallingEdge(self.dut.rst_250mhz)
|
||||
await Timer(100, 'ns')
|
||||
@ -340,10 +332,9 @@ class TB(object):
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
|
||||
self.dut.ptp_rst.setimmediatevalue(0)
|
||||
self.dut.sfp_1_rx_rst.setimmediatevalue(0)
|
||||
self.dut.sfp_1_tx_rst.setimmediatevalue(0)
|
||||
self.dut.sfp_2_rx_rst.setimmediatevalue(0)
|
||||
self.dut.sfp_2_tx_rst.setimmediatevalue(0)
|
||||
for k in range(1, 3):
|
||||
getattr(self.dut, f"sfp_{k}_rx_rst").setimmediatevalue(0)
|
||||
getattr(self.dut, f"sfp_{k}_tx_rst").setimmediatevalue(0)
|
||||
|
||||
await self.rc.enumerate()
|
||||
|
||||
@ -352,10 +343,9 @@ class TB(object):
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
|
||||
if self.loopback_enable:
|
||||
if not self.sfp_1_sink.empty():
|
||||
await self.sfp_1_source.send(await self.sfp_1_sink.recv())
|
||||
if not self.sfp_2_sink.empty():
|
||||
await self.sfp_2_source.send(await self.sfp_2_sink.recv())
|
||||
for x in range(len(self.sfp_sink)):
|
||||
if not self.sfp_sink[x].empty():
|
||||
await self.sfp_source[x].send(await self.sfp_sink[x].recv())
|
||||
|
||||
|
||||
@cocotb.test()
|
||||
@ -386,10 +376,10 @@ async def run_test_nic(dut):
|
||||
|
||||
await tb.driver.interfaces[0].start_xmit(data, 0)
|
||||
|
||||
pkt = await tb.sfp_1_sink.recv()
|
||||
pkt = await tb.sfp_sink[0].recv()
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
|
||||
await tb.sfp_1_source.send(pkt)
|
||||
await tb.sfp_source[0].send(pkt)
|
||||
|
||||
pkt = await tb.driver.interfaces[0].recv()
|
||||
|
||||
@ -398,10 +388,10 @@ async def run_test_nic(dut):
|
||||
|
||||
# await tb.driver.interfaces[1].start_xmit(data, 0)
|
||||
|
||||
# pkt = await tb.sfp_2_sink.recv()
|
||||
# pkt = await tb.sfp_sink[1].recv()
|
||||
# tb.log.info("Packet: %s", pkt)
|
||||
|
||||
# await tb.sfp_2_source.send(pkt)
|
||||
# await tb.sfp_source[1].send(pkt)
|
||||
|
||||
# pkt = await tb.driver.interfaces[1].recv()
|
||||
|
||||
@ -421,10 +411,10 @@ async def run_test_nic(dut):
|
||||
|
||||
await tb.driver.interfaces[0].start_xmit(test_pkt2.build(), 0, 34, 6)
|
||||
|
||||
pkt = await tb.sfp_1_sink.recv()
|
||||
pkt = await tb.sfp_sink[0].recv()
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
|
||||
await tb.sfp_1_source.send(pkt)
|
||||
await tb.sfp_source[0].send(pkt)
|
||||
|
||||
pkt = await tb.driver.interfaces[0].recv()
|
||||
|
||||
|
@ -250,30 +250,18 @@ class TB(object):
|
||||
cocotb.start_soon(Clock(dut.ptp_sample_clk, 8, units="ns").start())
|
||||
|
||||
# Ethernet
|
||||
cocotb.start_soon(Clock(dut.qsfp_rx_clk_1, 2.56, units="ns").start())
|
||||
self.qsfp_1_source = XgmiiSource(dut.qsfp_rxd_1, dut.qsfp_rxc_1, dut.qsfp_rx_clk_1, dut.qsfp_rx_rst_1)
|
||||
cocotb.start_soon(Clock(dut.qsfp_tx_clk_1, 2.56, units="ns").start())
|
||||
self.qsfp_1_sink = XgmiiSink(dut.qsfp_txd_1, dut.qsfp_txc_1, dut.qsfp_tx_clk_1, dut.qsfp_tx_rst_1)
|
||||
self.qsfp_source = []
|
||||
self.qsfp_sink = []
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp_rx_clk_2, 2.56, units="ns").start())
|
||||
self.qsfp_2_source = XgmiiSource(dut.qsfp_rxd_2, dut.qsfp_rxc_2, dut.qsfp_rx_clk_2, dut.qsfp_rx_rst_2)
|
||||
cocotb.start_soon(Clock(dut.qsfp_tx_clk_2, 2.56, units="ns").start())
|
||||
self.qsfp_2_sink = XgmiiSink(dut.qsfp_txd_2, dut.qsfp_txc_2, dut.qsfp_tx_clk_2, dut.qsfp_tx_rst_2)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp_rx_clk_3, 2.56, units="ns").start())
|
||||
self.qsfp_3_source = XgmiiSource(dut.qsfp_rxd_3, dut.qsfp_rxc_3, dut.qsfp_rx_clk_3, dut.qsfp_rx_rst_3)
|
||||
cocotb.start_soon(Clock(dut.qsfp_tx_clk_3, 2.56, units="ns").start())
|
||||
self.qsfp_3_sink = XgmiiSink(dut.qsfp_txd_3, dut.qsfp_txc_3, dut.qsfp_tx_clk_3, dut.qsfp_tx_rst_3)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp_rx_clk_4, 2.56, units="ns").start())
|
||||
self.qsfp_4_source = XgmiiSource(dut.qsfp_rxd_4, dut.qsfp_rxc_4, dut.qsfp_rx_clk_4, dut.qsfp_rx_rst_4)
|
||||
cocotb.start_soon(Clock(dut.qsfp_tx_clk_4, 2.56, units="ns").start())
|
||||
self.qsfp_4_sink = XgmiiSink(dut.qsfp_txd_4, dut.qsfp_txc_4, dut.qsfp_tx_clk_4, dut.qsfp_tx_rst_4)
|
||||
|
||||
dut.qsfp_rx_status_1.setimmediatevalue(1)
|
||||
dut.qsfp_rx_status_2.setimmediatevalue(1)
|
||||
dut.qsfp_rx_status_3.setimmediatevalue(1)
|
||||
dut.qsfp_rx_status_4.setimmediatevalue(1)
|
||||
for y in range(1, 5):
|
||||
cocotb.start_soon(Clock(getattr(dut, f"qsfp_rx_clk_{y}"), 2.56, units="ns").start())
|
||||
source = XgmiiSource(getattr(dut, f"qsfp_rxd_{y}"), getattr(dut, f"qsfp_rxc_{y}"), getattr(dut, f"qsfp_rx_clk_{y}"), getattr(dut, f"qsfp_rx_rst_{y}"))
|
||||
self.qsfp_source.append(source)
|
||||
cocotb.start_soon(Clock(getattr(dut, f"qsfp_tx_clk_{y}"), 2.56, units="ns").start())
|
||||
sink = XgmiiSink(getattr(dut, f"qsfp_txd_{y}"), getattr(dut, f"qsfp_txc_{y}"), getattr(dut, f"qsfp_tx_clk_{y}"), getattr(dut, f"qsfp_tx_rst_{y}"))
|
||||
self.qsfp_sink.append(sink)
|
||||
getattr(dut, f"qsfp_rx_status_{y}").setimmediatevalue(1)
|
||||
getattr(dut, f"qsfp_rx_error_count_{y}").setimmediatevalue(0)
|
||||
|
||||
dut.btnu.setimmediatevalue(0)
|
||||
dut.btnl.setimmediatevalue(0)
|
||||
@ -287,11 +275,6 @@ class TB(object):
|
||||
dut.qsfp_drp_do.setimmediatevalue(0)
|
||||
dut.qsfp_drp_rdy.setimmediatevalue(0)
|
||||
|
||||
dut.qsfp_rx_error_count_1.setimmediatevalue(0)
|
||||
dut.qsfp_rx_error_count_2.setimmediatevalue(0)
|
||||
dut.qsfp_rx_error_count_3.setimmediatevalue(0)
|
||||
dut.qsfp_rx_error_count_4.setimmediatevalue(0)
|
||||
|
||||
dut.qsfp_modprsl.setimmediatevalue(0)
|
||||
dut.qsfp_intl.setimmediatevalue(0)
|
||||
|
||||
@ -308,27 +291,17 @@ class TB(object):
|
||||
async def init(self):
|
||||
|
||||
self.dut.ptp_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp_rx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp_tx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp_rx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp_tx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp_rx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp_tx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp_rx_rst_4.setimmediatevalue(0)
|
||||
self.dut.qsfp_tx_rst_4.setimmediatevalue(0)
|
||||
for y in range(1, 5):
|
||||
getattr(self.dut, f"qsfp_rx_rst_{y}").setimmediatevalue(0)
|
||||
getattr(self.dut, f"qsfp_tx_rst_{y}").setimmediatevalue(0)
|
||||
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
|
||||
self.dut.ptp_rst.setimmediatevalue(1)
|
||||
self.dut.qsfp_rx_rst_1.setimmediatevalue(1)
|
||||
self.dut.qsfp_tx_rst_1.setimmediatevalue(1)
|
||||
self.dut.qsfp_rx_rst_2.setimmediatevalue(1)
|
||||
self.dut.qsfp_tx_rst_2.setimmediatevalue(1)
|
||||
self.dut.qsfp_rx_rst_3.setimmediatevalue(1)
|
||||
self.dut.qsfp_tx_rst_3.setimmediatevalue(1)
|
||||
self.dut.qsfp_rx_rst_4.setimmediatevalue(1)
|
||||
self.dut.qsfp_tx_rst_4.setimmediatevalue(1)
|
||||
for y in range(1, 5):
|
||||
getattr(self.dut, f"qsfp_rx_rst_{y}").setimmediatevalue(1)
|
||||
getattr(self.dut, f"qsfp_tx_rst_{y}").setimmediatevalue(1)
|
||||
|
||||
await FallingEdge(self.dut.rst_250mhz)
|
||||
await Timer(100, 'ns')
|
||||
@ -337,14 +310,9 @@ class TB(object):
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
|
||||
self.dut.ptp_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp_rx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp_tx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp_rx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp_tx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp_rx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp_tx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp_rx_rst_4.setimmediatevalue(0)
|
||||
self.dut.qsfp_tx_rst_4.setimmediatevalue(0)
|
||||
for y in range(1, 5):
|
||||
getattr(self.dut, f"qsfp_rx_rst_{y}").setimmediatevalue(0)
|
||||
getattr(self.dut, f"qsfp_tx_rst_{y}").setimmediatevalue(0)
|
||||
|
||||
await self.rc.enumerate()
|
||||
|
||||
@ -353,14 +321,9 @@ class TB(object):
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
|
||||
if self.loopback_enable:
|
||||
if not self.qsfp_1_sink.empty():
|
||||
await self.qsfp_1_source.send(await self.qsfp_1_sink.recv())
|
||||
if not self.qsfp_2_sink.empty():
|
||||
await self.qsfp_2_source.send(await self.qsfp_2_sink.recv())
|
||||
if not self.qsfp_3_sink.empty():
|
||||
await self.qsfp_3_source.send(await self.qsfp_3_sink.recv())
|
||||
if not self.qsfp_4_sink.empty():
|
||||
await self.qsfp_4_source.send(await self.qsfp_4_sink.recv())
|
||||
for x in range(len(self.qsfp_sink)):
|
||||
if not self.qsfp_sink[x].empty():
|
||||
await self.qsfp_source[x].send(await self.qsfp_sink[x].recv())
|
||||
|
||||
|
||||
@cocotb.test()
|
||||
@ -390,10 +353,10 @@ async def run_test_nic(dut):
|
||||
|
||||
await tb.driver.interfaces[0].start_xmit(data, 0)
|
||||
|
||||
pkt = await tb.qsfp_1_sink.recv()
|
||||
pkt = await tb.qsfp_sink[0].recv()
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
|
||||
await tb.qsfp_1_source.send(pkt)
|
||||
await tb.qsfp_source[0].send(pkt)
|
||||
|
||||
pkt = await tb.driver.interfaces[0].recv()
|
||||
|
||||
@ -413,10 +376,10 @@ async def run_test_nic(dut):
|
||||
|
||||
await tb.driver.interfaces[0].start_xmit(test_pkt2.build(), 0, 34, 6)
|
||||
|
||||
pkt = await tb.qsfp_1_sink.recv()
|
||||
pkt = await tb.qsfp_sink[0].recv()
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
|
||||
await tb.qsfp_1_source.send(pkt)
|
||||
await tb.qsfp_source[0].send(pkt)
|
||||
|
||||
pkt = await tb.driver.interfaces[0].recv()
|
||||
|
||||
|
@ -276,55 +276,38 @@ class TB(object):
|
||||
cocotb.start_soon(Clock(dut.ptp_sample_clk, 8, units="ns").start())
|
||||
|
||||
# Ethernet
|
||||
cocotb.start_soon(Clock(dut.qsfp1_rx_clk, 3.102, units="ns").start())
|
||||
cocotb.start_soon(Clock(dut.qsfp1_tx_clk, 3.102, units="ns").start())
|
||||
self.qsfp_mac = []
|
||||
|
||||
self.qsfp1_mac = EthMac(
|
||||
tx_clk=dut.qsfp1_tx_clk,
|
||||
tx_rst=dut.qsfp1_tx_rst,
|
||||
tx_bus=AxiStreamBus.from_prefix(dut, "qsfp1_tx_axis"),
|
||||
tx_ptp_time=dut.qsfp1_tx_ptp_time,
|
||||
tx_ptp_ts=dut.qsfp1_tx_ptp_ts,
|
||||
tx_ptp_ts_tag=dut.qsfp1_tx_ptp_ts_tag,
|
||||
tx_ptp_ts_valid=dut.qsfp1_tx_ptp_ts_valid,
|
||||
rx_clk=dut.qsfp1_rx_clk,
|
||||
rx_rst=dut.qsfp1_rx_rst,
|
||||
rx_bus=AxiStreamBus.from_prefix(dut, "qsfp1_rx_axis"),
|
||||
rx_ptp_time=dut.qsfp1_rx_ptp_time,
|
||||
ifg=12, speed=100e9
|
||||
)
|
||||
for k in range(1, 3):
|
||||
cocotb.start_soon(Clock(getattr(dut, f"qsfp{k}_rx_clk"), 3.102, units="ns").start())
|
||||
cocotb.start_soon(Clock(getattr(dut, f"qsfp{k}_tx_clk"), 3.102, units="ns").start())
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp2_rx_clk, 3.102, units="ns").start())
|
||||
cocotb.start_soon(Clock(dut.qsfp2_tx_clk, 3.102, units="ns").start())
|
||||
mac = EthMac(
|
||||
tx_clk=getattr(dut, f"qsfp{k}_tx_clk"),
|
||||
tx_rst=getattr(dut, f"qsfp{k}_tx_rst"),
|
||||
tx_bus=AxiStreamBus.from_prefix(dut, f"qsfp{k}_tx_axis"),
|
||||
tx_ptp_time=getattr(dut, f"qsfp{k}_tx_ptp_time"),
|
||||
tx_ptp_ts=getattr(dut, f"qsfp{k}_tx_ptp_ts"),
|
||||
tx_ptp_ts_tag=getattr(dut, f"qsfp{k}_tx_ptp_ts_tag"),
|
||||
tx_ptp_ts_valid=getattr(dut, f"qsfp{k}_tx_ptp_ts_valid"),
|
||||
rx_clk=getattr(dut, f"qsfp{k}_rx_clk"),
|
||||
rx_rst=getattr(dut, f"qsfp{k}_rx_rst"),
|
||||
rx_bus=AxiStreamBus.from_prefix(dut, f"qsfp{k}_rx_axis"),
|
||||
rx_ptp_time=getattr(dut, f"qsfp{k}_rx_ptp_time"),
|
||||
ifg=12, speed=100e9
|
||||
)
|
||||
|
||||
self.qsfp2_mac = EthMac(
|
||||
tx_clk=dut.qsfp2_tx_clk,
|
||||
tx_rst=dut.qsfp2_tx_rst,
|
||||
tx_bus=AxiStreamBus.from_prefix(dut, "qsfp2_tx_axis"),
|
||||
tx_ptp_time=dut.qsfp2_tx_ptp_time,
|
||||
tx_ptp_ts=dut.qsfp2_tx_ptp_ts,
|
||||
tx_ptp_ts_tag=dut.qsfp2_tx_ptp_ts_tag,
|
||||
tx_ptp_ts_valid=dut.qsfp2_tx_ptp_ts_valid,
|
||||
rx_clk=dut.qsfp2_rx_clk,
|
||||
rx_rst=dut.qsfp2_rx_rst,
|
||||
rx_bus=AxiStreamBus.from_prefix(dut, "qsfp2_rx_axis"),
|
||||
rx_ptp_time=dut.qsfp2_rx_ptp_time,
|
||||
ifg=12, speed=100e9
|
||||
)
|
||||
self.qsfp_mac.append(mac)
|
||||
|
||||
dut.qsfp1_rx_status.setimmediatevalue(1)
|
||||
getattr(dut, f"qsfp{k}_rx_status").setimmediatevalue(1)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp1_drp_clk, 8, units="ns").start())
|
||||
dut.qsfp1_drp_rst.setimmediatevalue(0)
|
||||
dut.qsfp1_drp_do.setimmediatevalue(0)
|
||||
dut.qsfp1_drp_rdy.setimmediatevalue(0)
|
||||
cocotb.start_soon(Clock(getattr(dut, f"qsfp{k}_drp_clk"), 8, units="ns").start())
|
||||
getattr(dut, f"qsfp{k}_drp_rst").setimmediatevalue(0)
|
||||
getattr(dut, f"qsfp{k}_drp_do").setimmediatevalue(0)
|
||||
getattr(dut, f"qsfp{k}_drp_rdy").setimmediatevalue(0)
|
||||
|
||||
dut.qsfp2_rx_status.setimmediatevalue(1)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp2_drp_clk, 8, units="ns").start())
|
||||
dut.qsfp2_drp_rst.setimmediatevalue(0)
|
||||
dut.qsfp2_drp_do.setimmediatevalue(0)
|
||||
dut.qsfp2_drp_rdy.setimmediatevalue(0)
|
||||
getattr(dut, f"qsfp{k}_modprsl").setimmediatevalue(0)
|
||||
getattr(dut, f"qsfp{k}_intl").setimmediatevalue(0)
|
||||
|
||||
dut.btnu.setimmediatevalue(0)
|
||||
dut.btnl.setimmediatevalue(0)
|
||||
@ -336,12 +319,6 @@ class TB(object):
|
||||
dut.i2c_scl_i.setimmediatevalue(1)
|
||||
dut.i2c_sda_i.setimmediatevalue(1)
|
||||
|
||||
dut.qsfp1_modprsl.setimmediatevalue(0)
|
||||
dut.qsfp1_intl.setimmediatevalue(1)
|
||||
|
||||
dut.qsfp2_modprsl.setimmediatevalue(0)
|
||||
dut.qsfp2_intl.setimmediatevalue(1)
|
||||
|
||||
dut.qspi_0_dq_i.setimmediatevalue(0)
|
||||
dut.qspi_1_dq_i.setimmediatevalue(0)
|
||||
|
||||
@ -351,19 +328,17 @@ class TB(object):
|
||||
async def init(self):
|
||||
|
||||
self.dut.ptp_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp1_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp1_tx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp2_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp2_tx_rst.setimmediatevalue(0)
|
||||
for k in range(1, 3):
|
||||
getattr(self.dut, f"qsfp{k}_rx_rst").setimmediatevalue(0)
|
||||
getattr(self.dut, f"qsfp{k}_tx_rst").setimmediatevalue(0)
|
||||
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
|
||||
self.dut.ptp_rst.setimmediatevalue(1)
|
||||
self.dut.qsfp1_rx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfp1_tx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfp2_rx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfp2_tx_rst.setimmediatevalue(1)
|
||||
for k in range(1, 3):
|
||||
getattr(self.dut, f"qsfp{k}_rx_rst").setimmediatevalue(1)
|
||||
getattr(self.dut, f"qsfp{k}_tx_rst").setimmediatevalue(1)
|
||||
|
||||
await FallingEdge(self.dut.rst_250mhz)
|
||||
await Timer(100, 'ns')
|
||||
@ -372,10 +347,9 @@ class TB(object):
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
|
||||
self.dut.ptp_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp1_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp1_tx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp2_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp2_tx_rst.setimmediatevalue(0)
|
||||
for k in range(1, 3):
|
||||
getattr(self.dut, f"qsfp{k}_rx_rst").setimmediatevalue(0)
|
||||
getattr(self.dut, f"qsfp{k}_tx_rst").setimmediatevalue(0)
|
||||
|
||||
await self.rc.enumerate()
|
||||
|
||||
@ -384,10 +358,9 @@ class TB(object):
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
|
||||
if self.loopback_enable:
|
||||
if not self.qsfp1_mac.tx.empty():
|
||||
await self.qsfp1_mac.rx.send(await self.qsfp1_mac.tx.recv())
|
||||
if not self.qsfp2_mac.tx.empty():
|
||||
await self.qsfp2_mac.rx.send(await self.qsfp2_mac.tx.recv())
|
||||
for mac in self.qsfp_mac:
|
||||
if not mac.tx.empty():
|
||||
await mac.rx.send(await mac.tx.recv())
|
||||
|
||||
|
||||
@cocotb.test()
|
||||
@ -418,10 +391,10 @@ async def run_test_nic(dut):
|
||||
|
||||
await tb.driver.interfaces[0].start_xmit(data, 0)
|
||||
|
||||
pkt = await tb.qsfp1_mac.tx.recv()
|
||||
pkt = await tb.qsfp_mac[0].tx.recv()
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
|
||||
await tb.qsfp1_mac.rx.send(pkt)
|
||||
await tb.qsfp_mac[0].rx.send(pkt)
|
||||
|
||||
pkt = await tb.driver.interfaces[0].recv()
|
||||
|
||||
@ -430,10 +403,10 @@ async def run_test_nic(dut):
|
||||
|
||||
# await tb.driver.interfaces[1].start_xmit(data, 0)
|
||||
|
||||
# pkt = await tb.qsfp2_mac.tx.recv()
|
||||
# pkt = await tb.qsfp_mac[1].tx.recv()
|
||||
# tb.log.info("Packet: %s", pkt)
|
||||
|
||||
# await tb.qsfp2_mac.rx.send(pkt)
|
||||
# await tb.qsfp_mac[1].rx.send(pkt)
|
||||
|
||||
# pkt = await tb.driver.interfaces[1].recv()
|
||||
|
||||
@ -453,10 +426,10 @@ async def run_test_nic(dut):
|
||||
|
||||
await tb.driver.interfaces[0].start_xmit(test_pkt2.build(), 0, 34, 6)
|
||||
|
||||
pkt = await tb.qsfp1_mac.tx.recv()
|
||||
pkt = await tb.qsfp_mac[0].tx.recv()
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
|
||||
await tb.qsfp1_mac.rx.send(pkt)
|
||||
await tb.qsfp_mac[0].rx.send(pkt)
|
||||
|
||||
pkt = await tb.driver.interfaces[0].recv()
|
||||
|
||||
|
@ -276,55 +276,31 @@ class TB(object):
|
||||
cocotb.start_soon(Clock(dut.ptp_sample_clk, 8, units="ns").start())
|
||||
|
||||
# Ethernet
|
||||
cocotb.start_soon(Clock(dut.qsfp1_rx_clk_1, 2.56, units="ns").start())
|
||||
self.qsfp1_1_source = XgmiiSource(dut.qsfp1_rxd_1, dut.qsfp1_rxc_1, dut.qsfp1_rx_clk_1, dut.qsfp1_rx_rst_1)
|
||||
cocotb.start_soon(Clock(dut.qsfp1_tx_clk_1, 2.56, units="ns").start())
|
||||
self.qsfp1_1_sink = XgmiiSink(dut.qsfp1_txd_1, dut.qsfp1_txc_1, dut.qsfp1_tx_clk_1, dut.qsfp1_tx_rst_1)
|
||||
self.qsfp_source = []
|
||||
self.qsfp_sink = []
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp1_rx_clk_2, 2.56, units="ns").start())
|
||||
self.qsfp1_2_source = XgmiiSource(dut.qsfp1_rxd_2, dut.qsfp1_rxc_2, dut.qsfp1_rx_clk_2, dut.qsfp1_rx_rst_2)
|
||||
cocotb.start_soon(Clock(dut.qsfp1_tx_clk_2, 2.56, units="ns").start())
|
||||
self.qsfp1_2_sink = XgmiiSink(dut.qsfp1_txd_2, dut.qsfp1_txc_2, dut.qsfp1_tx_clk_2, dut.qsfp1_tx_rst_2)
|
||||
for x in range(1, 3):
|
||||
sources = []
|
||||
sinks = []
|
||||
for y in range(1, 5):
|
||||
cocotb.start_soon(Clock(getattr(dut, f"qsfp{x}_rx_clk_{y}"), 2.56, units="ns").start())
|
||||
source = XgmiiSource(getattr(dut, f"qsfp{x}_rxd_{y}"), getattr(dut, f"qsfp{x}_rxc_{y}"), getattr(dut, f"qsfp{x}_rx_clk_{y}"), getattr(dut, f"qsfp{x}_rx_rst_{y}"))
|
||||
sources.append(source)
|
||||
cocotb.start_soon(Clock(getattr(dut, f"qsfp{x}_tx_clk_{y}"), 2.56, units="ns").start())
|
||||
sink = XgmiiSink(getattr(dut, f"qsfp{x}_txd_{y}"), getattr(dut, f"qsfp{x}_txc_{y}"), getattr(dut, f"qsfp{x}_tx_clk_{y}"), getattr(dut, f"qsfp{x}_tx_rst_{y}"))
|
||||
sinks.append(sink)
|
||||
getattr(dut, f"qsfp{x}_rx_status_{y}").setimmediatevalue(1)
|
||||
getattr(dut, f"qsfp{x}_rx_error_count_{y}").setimmediatevalue(0)
|
||||
self.qsfp_source.append(sources)
|
||||
self.qsfp_sink.append(sinks)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp1_rx_clk_3, 2.56, units="ns").start())
|
||||
self.qsfp1_3_source = XgmiiSource(dut.qsfp1_rxd_3, dut.qsfp1_rxc_3, dut.qsfp1_rx_clk_3, dut.qsfp1_rx_rst_3)
|
||||
cocotb.start_soon(Clock(dut.qsfp1_tx_clk_3, 2.56, units="ns").start())
|
||||
self.qsfp1_3_sink = XgmiiSink(dut.qsfp1_txd_3, dut.qsfp1_txc_3, dut.qsfp1_tx_clk_3, dut.qsfp1_tx_rst_3)
|
||||
cocotb.start_soon(Clock(getattr(dut, f"qsfp{x}_drp_clk"), 8, units="ns").start())
|
||||
getattr(dut, f"qsfp{x}_drp_rst").setimmediatevalue(0)
|
||||
getattr(dut, f"qsfp{x}_drp_do").setimmediatevalue(0)
|
||||
getattr(dut, f"qsfp{x}_drp_rdy").setimmediatevalue(0)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp1_rx_clk_4, 2.56, units="ns").start())
|
||||
self.qsfp1_4_source = XgmiiSource(dut.qsfp1_rxd_4, dut.qsfp1_rxc_4, dut.qsfp1_rx_clk_4, dut.qsfp1_rx_rst_4)
|
||||
cocotb.start_soon(Clock(dut.qsfp1_tx_clk_4, 2.56, units="ns").start())
|
||||
self.qsfp1_4_sink = XgmiiSink(dut.qsfp1_txd_4, dut.qsfp1_txc_4, dut.qsfp1_tx_clk_4, dut.qsfp1_tx_rst_4)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp2_rx_clk_1, 2.56, units="ns").start())
|
||||
self.qsfp2_1_source = XgmiiSource(dut.qsfp2_rxd_1, dut.qsfp2_rxc_1, dut.qsfp2_rx_clk_1, dut.qsfp2_rx_rst_1)
|
||||
cocotb.start_soon(Clock(dut.qsfp2_tx_clk_1, 2.56, units="ns").start())
|
||||
self.qsfp2_1_sink = XgmiiSink(dut.qsfp2_txd_1, dut.qsfp2_txc_1, dut.qsfp2_tx_clk_1, dut.qsfp2_tx_rst_1)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp2_rx_clk_2, 2.56, units="ns").start())
|
||||
self.qsfp2_2_source = XgmiiSource(dut.qsfp2_rxd_2, dut.qsfp2_rxc_2, dut.qsfp2_rx_clk_2, dut.qsfp2_rx_rst_2)
|
||||
cocotb.start_soon(Clock(dut.qsfp2_tx_clk_2, 2.56, units="ns").start())
|
||||
self.qsfp2_2_sink = XgmiiSink(dut.qsfp2_txd_2, dut.qsfp2_txc_2, dut.qsfp2_tx_clk_2, dut.qsfp2_tx_rst_2)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp2_rx_clk_3, 2.56, units="ns").start())
|
||||
self.qsfp2_3_source = XgmiiSource(dut.qsfp2_rxd_3, dut.qsfp2_rxc_3, dut.qsfp2_rx_clk_3, dut.qsfp2_rx_rst_3)
|
||||
cocotb.start_soon(Clock(dut.qsfp2_tx_clk_3, 2.56, units="ns").start())
|
||||
self.qsfp2_3_sink = XgmiiSink(dut.qsfp2_txd_3, dut.qsfp2_txc_3, dut.qsfp2_tx_clk_3, dut.qsfp2_tx_rst_3)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp2_rx_clk_4, 2.56, units="ns").start())
|
||||
self.qsfp2_4_source = XgmiiSource(dut.qsfp2_rxd_4, dut.qsfp2_rxc_4, dut.qsfp2_rx_clk_4, dut.qsfp2_rx_rst_4)
|
||||
cocotb.start_soon(Clock(dut.qsfp2_tx_clk_4, 2.56, units="ns").start())
|
||||
self.qsfp2_4_sink = XgmiiSink(dut.qsfp2_txd_4, dut.qsfp2_txc_4, dut.qsfp2_tx_clk_4, dut.qsfp2_tx_rst_4)
|
||||
|
||||
dut.qsfp1_rx_status_1.setimmediatevalue(1)
|
||||
dut.qsfp1_rx_status_2.setimmediatevalue(1)
|
||||
dut.qsfp1_rx_status_3.setimmediatevalue(1)
|
||||
dut.qsfp1_rx_status_4.setimmediatevalue(1)
|
||||
|
||||
dut.qsfp2_rx_status_1.setimmediatevalue(1)
|
||||
dut.qsfp2_rx_status_2.setimmediatevalue(1)
|
||||
dut.qsfp2_rx_status_3.setimmediatevalue(1)
|
||||
dut.qsfp2_rx_status_4.setimmediatevalue(1)
|
||||
getattr(dut, f"qsfp{x}_modprsl").setimmediatevalue(0)
|
||||
getattr(dut, f"qsfp{x}_intl").setimmediatevalue(1)
|
||||
|
||||
dut.btnu.setimmediatevalue(0)
|
||||
dut.btnl.setimmediatevalue(0)
|
||||
@ -336,32 +312,6 @@ class TB(object):
|
||||
dut.i2c_scl_i.setimmediatevalue(1)
|
||||
dut.i2c_sda_i.setimmediatevalue(1)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp1_drp_clk, 8, units="ns").start())
|
||||
dut.qsfp1_drp_rst.setimmediatevalue(0)
|
||||
dut.qsfp1_drp_do.setimmediatevalue(0)
|
||||
dut.qsfp1_drp_rdy.setimmediatevalue(0)
|
||||
|
||||
dut.qsfp1_rx_error_count_1.setimmediatevalue(0)
|
||||
dut.qsfp1_rx_error_count_2.setimmediatevalue(0)
|
||||
dut.qsfp1_rx_error_count_3.setimmediatevalue(0)
|
||||
dut.qsfp1_rx_error_count_4.setimmediatevalue(0)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp2_drp_clk, 8, units="ns").start())
|
||||
dut.qsfp2_drp_rst.setimmediatevalue(0)
|
||||
dut.qsfp2_drp_do.setimmediatevalue(0)
|
||||
dut.qsfp2_drp_rdy.setimmediatevalue(0)
|
||||
|
||||
dut.qsfp2_rx_error_count_1.setimmediatevalue(0)
|
||||
dut.qsfp2_rx_error_count_2.setimmediatevalue(0)
|
||||
dut.qsfp2_rx_error_count_3.setimmediatevalue(0)
|
||||
dut.qsfp2_rx_error_count_4.setimmediatevalue(0)
|
||||
|
||||
dut.qsfp1_modprsl.setimmediatevalue(0)
|
||||
dut.qsfp1_intl.setimmediatevalue(1)
|
||||
|
||||
dut.qsfp2_modprsl.setimmediatevalue(0)
|
||||
dut.qsfp2_intl.setimmediatevalue(1)
|
||||
|
||||
dut.qspi_0_dq_i.setimmediatevalue(0)
|
||||
dut.qspi_1_dq_i.setimmediatevalue(0)
|
||||
|
||||
@ -371,43 +321,19 @@ class TB(object):
|
||||
async def init(self):
|
||||
|
||||
self.dut.ptp_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp1_rx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp1_tx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp1_rx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp1_tx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp1_rx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp1_tx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp1_rx_rst_4.setimmediatevalue(0)
|
||||
self.dut.qsfp1_tx_rst_4.setimmediatevalue(0)
|
||||
self.dut.qsfp2_rx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp2_tx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp2_rx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp2_tx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp2_rx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp2_tx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp2_rx_rst_4.setimmediatevalue(0)
|
||||
self.dut.qsfp2_tx_rst_4.setimmediatevalue(0)
|
||||
for x in range(1, 3):
|
||||
for y in range(1, 5):
|
||||
getattr(self.dut, f"qsfp{x}_rx_rst_{y}").setimmediatevalue(0)
|
||||
getattr(self.dut, f"qsfp{x}_tx_rst_{y}").setimmediatevalue(0)
|
||||
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
|
||||
self.dut.ptp_rst.setimmediatevalue(1)
|
||||
self.dut.qsfp1_rx_rst_1.setimmediatevalue(1)
|
||||
self.dut.qsfp1_tx_rst_1.setimmediatevalue(1)
|
||||
self.dut.qsfp1_rx_rst_2.setimmediatevalue(1)
|
||||
self.dut.qsfp1_tx_rst_2.setimmediatevalue(1)
|
||||
self.dut.qsfp1_rx_rst_3.setimmediatevalue(1)
|
||||
self.dut.qsfp1_tx_rst_3.setimmediatevalue(1)
|
||||
self.dut.qsfp1_rx_rst_4.setimmediatevalue(1)
|
||||
self.dut.qsfp1_tx_rst_4.setimmediatevalue(1)
|
||||
self.dut.qsfp2_rx_rst_1.setimmediatevalue(1)
|
||||
self.dut.qsfp2_tx_rst_1.setimmediatevalue(1)
|
||||
self.dut.qsfp2_rx_rst_2.setimmediatevalue(1)
|
||||
self.dut.qsfp2_tx_rst_2.setimmediatevalue(1)
|
||||
self.dut.qsfp2_rx_rst_3.setimmediatevalue(1)
|
||||
self.dut.qsfp2_tx_rst_3.setimmediatevalue(1)
|
||||
self.dut.qsfp2_rx_rst_4.setimmediatevalue(1)
|
||||
self.dut.qsfp2_tx_rst_4.setimmediatevalue(1)
|
||||
for x in range(1, 3):
|
||||
for y in range(1, 5):
|
||||
getattr(self.dut, f"qsfp{x}_rx_rst_{y}").setimmediatevalue(1)
|
||||
getattr(self.dut, f"qsfp{x}_tx_rst_{y}").setimmediatevalue(1)
|
||||
|
||||
await FallingEdge(self.dut.rst_250mhz)
|
||||
await Timer(100, 'ns')
|
||||
@ -416,22 +342,10 @@ class TB(object):
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
|
||||
self.dut.ptp_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp1_rx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp1_tx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp1_rx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp1_tx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp1_rx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp1_tx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp1_rx_rst_4.setimmediatevalue(0)
|
||||
self.dut.qsfp1_tx_rst_4.setimmediatevalue(0)
|
||||
self.dut.qsfp2_rx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp2_tx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp2_rx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp2_tx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp2_rx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp2_tx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp2_rx_rst_4.setimmediatevalue(0)
|
||||
self.dut.qsfp2_tx_rst_4.setimmediatevalue(0)
|
||||
for x in range(1, 3):
|
||||
for y in range(1, 5):
|
||||
getattr(self.dut, f"qsfp{x}_rx_rst_{y}").setimmediatevalue(0)
|
||||
getattr(self.dut, f"qsfp{x}_tx_rst_{y}").setimmediatevalue(0)
|
||||
|
||||
await self.rc.enumerate()
|
||||
|
||||
@ -440,22 +354,10 @@ class TB(object):
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
|
||||
if self.loopback_enable:
|
||||
if not self.qsfp1_1_sink.empty():
|
||||
await self.qsfp1_1_source.send(await self.qsfp1_1_sink.recv())
|
||||
if not self.qsfp1_2_sink.empty():
|
||||
await self.qsfp1_2_source.send(await self.qsfp1_2_sink.recv())
|
||||
if not self.qsfp1_3_sink.empty():
|
||||
await self.qsfp1_3_source.send(await self.qsfp1_3_sink.recv())
|
||||
if not self.qsfp1_4_sink.empty():
|
||||
await self.qsfp1_4_source.send(await self.qsfp1_4_sink.recv())
|
||||
if not self.qsfp2_1_sink.empty():
|
||||
await self.qsfp2_1_source.send(await self.qsfp2_1_sink.recv())
|
||||
if not self.qsfp2_2_sink.empty():
|
||||
await self.qsfp2_2_source.send(await self.qsfp2_2_sink.recv())
|
||||
if not self.qsfp2_3_sink.empty():
|
||||
await self.qsfp2_3_source.send(await self.qsfp2_3_sink.recv())
|
||||
if not self.qsfp2_4_sink.empty():
|
||||
await self.qsfp2_4_source.send(await self.qsfp2_4_sink.recv())
|
||||
for x in range(len(self.qsfp_sink)):
|
||||
for y in range(len(self.qsfp_sink[x])):
|
||||
if not self.qsfp_sink[x][y].empty():
|
||||
await self.qsfp_source[x][y].send(await self.qsfp_sink[x][y].recv())
|
||||
|
||||
|
||||
@cocotb.test()
|
||||
@ -486,10 +388,10 @@ async def run_test_nic(dut):
|
||||
|
||||
await tb.driver.interfaces[0].start_xmit(data, 0)
|
||||
|
||||
pkt = await tb.qsfp1_1_sink.recv()
|
||||
pkt = await tb.qsfp_sink[0][0].recv()
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
|
||||
await tb.qsfp1_1_source.send(pkt)
|
||||
await tb.qsfp_source[0][0].send(pkt)
|
||||
|
||||
pkt = await tb.driver.interfaces[0].recv()
|
||||
|
||||
@ -498,10 +400,10 @@ async def run_test_nic(dut):
|
||||
|
||||
# await tb.driver.interfaces[1].start_xmit(data, 0)
|
||||
|
||||
# pkt = await tb.qsfp2_1_sink.recv()
|
||||
# pkt = await tb.qsfp_sink[1][0].recv()
|
||||
# tb.log.info("Packet: %s", pkt)
|
||||
|
||||
# await tb.qsfp2_1_source.send(pkt)
|
||||
# await tb.qsfp_source[1][0].send(pkt)
|
||||
|
||||
# pkt = await tb.driver.interfaces[1].recv()
|
||||
|
||||
@ -521,10 +423,10 @@ async def run_test_nic(dut):
|
||||
|
||||
await tb.driver.interfaces[0].start_xmit(test_pkt2.build(), 0, 34, 6)
|
||||
|
||||
pkt = await tb.qsfp1_1_sink.recv()
|
||||
pkt = await tb.qsfp_sink[0][0].recv()
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
|
||||
await tb.qsfp1_1_source.send(pkt)
|
||||
await tb.qsfp_source[0][0].send(pkt)
|
||||
|
||||
pkt = await tb.driver.interfaces[0].recv()
|
||||
|
||||
|
@ -276,67 +276,44 @@ class TB(object):
|
||||
cocotb.start_soon(Clock(dut.ptp_sample_clk, 8, units="ns").start())
|
||||
|
||||
# Ethernet
|
||||
cocotb.start_soon(Clock(dut.qsfp0_rx_clk, 3.102, units="ns").start())
|
||||
cocotb.start_soon(Clock(dut.qsfp0_tx_clk, 3.102, units="ns").start())
|
||||
self.qsfp_mac = []
|
||||
|
||||
self.qsfp0_mac = EthMac(
|
||||
tx_clk=dut.qsfp0_tx_clk,
|
||||
tx_rst=dut.qsfp0_tx_rst,
|
||||
tx_bus=AxiStreamBus.from_prefix(dut, "qsfp0_tx_axis"),
|
||||
tx_ptp_time=dut.qsfp0_tx_ptp_time,
|
||||
tx_ptp_ts=dut.qsfp0_tx_ptp_ts,
|
||||
tx_ptp_ts_tag=dut.qsfp0_tx_ptp_ts_tag,
|
||||
tx_ptp_ts_valid=dut.qsfp0_tx_ptp_ts_valid,
|
||||
rx_clk=dut.qsfp0_rx_clk,
|
||||
rx_rst=dut.qsfp0_rx_rst,
|
||||
rx_bus=AxiStreamBus.from_prefix(dut, "qsfp0_rx_axis"),
|
||||
rx_ptp_time=dut.qsfp0_rx_ptp_time,
|
||||
ifg=12, speed=100e9
|
||||
)
|
||||
for k in range(2):
|
||||
cocotb.start_soon(Clock(getattr(dut, f"qsfp{k}_rx_clk"), 3.102, units="ns").start())
|
||||
cocotb.start_soon(Clock(getattr(dut, f"qsfp{k}_tx_clk"), 3.102, units="ns").start())
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp1_rx_clk, 3.102, units="ns").start())
|
||||
cocotb.start_soon(Clock(dut.qsfp1_tx_clk, 3.102, units="ns").start())
|
||||
mac = EthMac(
|
||||
tx_clk=getattr(dut, f"qsfp{k}_tx_clk"),
|
||||
tx_rst=getattr(dut, f"qsfp{k}_tx_rst"),
|
||||
tx_bus=AxiStreamBus.from_prefix(dut, f"qsfp{k}_tx_axis"),
|
||||
tx_ptp_time=getattr(dut, f"qsfp{k}_tx_ptp_time"),
|
||||
tx_ptp_ts=getattr(dut, f"qsfp{k}_tx_ptp_ts"),
|
||||
tx_ptp_ts_tag=getattr(dut, f"qsfp{k}_tx_ptp_ts_tag"),
|
||||
tx_ptp_ts_valid=getattr(dut, f"qsfp{k}_tx_ptp_ts_valid"),
|
||||
rx_clk=getattr(dut, f"qsfp{k}_rx_clk"),
|
||||
rx_rst=getattr(dut, f"qsfp{k}_rx_rst"),
|
||||
rx_bus=AxiStreamBus.from_prefix(dut, f"qsfp{k}_rx_axis"),
|
||||
rx_ptp_time=getattr(dut, f"qsfp{k}_rx_ptp_time"),
|
||||
ifg=12, speed=100e9
|
||||
)
|
||||
|
||||
self.qsfp1_mac = EthMac(
|
||||
tx_clk=dut.qsfp1_tx_clk,
|
||||
tx_rst=dut.qsfp1_tx_rst,
|
||||
tx_bus=AxiStreamBus.from_prefix(dut, "qsfp1_tx_axis"),
|
||||
tx_ptp_time=dut.qsfp1_tx_ptp_time,
|
||||
tx_ptp_ts=dut.qsfp1_tx_ptp_ts,
|
||||
tx_ptp_ts_tag=dut.qsfp1_tx_ptp_ts_tag,
|
||||
tx_ptp_ts_valid=dut.qsfp1_tx_ptp_ts_valid,
|
||||
rx_clk=dut.qsfp1_rx_clk,
|
||||
rx_rst=dut.qsfp1_rx_rst,
|
||||
rx_bus=AxiStreamBus.from_prefix(dut, "qsfp1_rx_axis"),
|
||||
rx_ptp_time=dut.qsfp1_rx_ptp_time,
|
||||
ifg=12, speed=100e9
|
||||
)
|
||||
self.qsfp_mac.append(mac)
|
||||
|
||||
dut.qsfp0_rx_status.setimmediatevalue(1)
|
||||
getattr(dut, f"qsfp{k}_rx_status").setimmediatevalue(1)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp0_drp_clk, 8, units="ns").start())
|
||||
dut.qsfp0_drp_rst.setimmediatevalue(0)
|
||||
dut.qsfp0_drp_do.setimmediatevalue(0)
|
||||
dut.qsfp0_drp_rdy.setimmediatevalue(0)
|
||||
cocotb.start_soon(Clock(getattr(dut, f"qsfp{k}_drp_clk"), 8, units="ns").start())
|
||||
getattr(dut, f"qsfp{k}_drp_rst").setimmediatevalue(0)
|
||||
getattr(dut, f"qsfp{k}_drp_do").setimmediatevalue(0)
|
||||
getattr(dut, f"qsfp{k}_drp_rdy").setimmediatevalue(0)
|
||||
|
||||
dut.qsfp1_rx_status.setimmediatevalue(1)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp1_drp_clk, 8, units="ns").start())
|
||||
dut.qsfp1_drp_rst.setimmediatevalue(0)
|
||||
dut.qsfp1_drp_do.setimmediatevalue(0)
|
||||
dut.qsfp1_drp_rdy.setimmediatevalue(0)
|
||||
getattr(dut, f"qsfp{k}_modprsl").setimmediatevalue(0)
|
||||
getattr(dut, f"qsfp{k}_intl").setimmediatevalue(0)
|
||||
|
||||
dut.sw.setimmediatevalue(0)
|
||||
|
||||
dut.i2c_scl_i.setimmediatevalue(1)
|
||||
dut.i2c_sda_i.setimmediatevalue(1)
|
||||
|
||||
dut.qsfp0_modprsl.setimmediatevalue(0)
|
||||
dut.qsfp0_intl.setimmediatevalue(1)
|
||||
|
||||
dut.qsfp1_modprsl.setimmediatevalue(0)
|
||||
dut.qsfp1_intl.setimmediatevalue(1)
|
||||
|
||||
dut.qspi_dq_i.setimmediatevalue(0)
|
||||
|
||||
self.loopback_enable = False
|
||||
@ -345,19 +322,17 @@ class TB(object):
|
||||
async def init(self):
|
||||
|
||||
self.dut.ptp_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp0_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp0_tx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp1_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp1_tx_rst.setimmediatevalue(0)
|
||||
for k in range(2):
|
||||
getattr(self.dut, f"qsfp{k}_rx_rst").setimmediatevalue(0)
|
||||
getattr(self.dut, f"qsfp{k}_tx_rst").setimmediatevalue(0)
|
||||
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
|
||||
self.dut.ptp_rst.setimmediatevalue(1)
|
||||
self.dut.qsfp0_rx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfp0_tx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfp1_rx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfp1_tx_rst.setimmediatevalue(1)
|
||||
for k in range(2):
|
||||
getattr(self.dut, f"qsfp{k}_rx_rst").setimmediatevalue(1)
|
||||
getattr(self.dut, f"qsfp{k}_tx_rst").setimmediatevalue(1)
|
||||
|
||||
await FallingEdge(self.dut.rst_250mhz)
|
||||
await Timer(100, 'ns')
|
||||
@ -366,10 +341,9 @@ class TB(object):
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
|
||||
self.dut.ptp_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp0_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp0_tx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp1_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp1_tx_rst.setimmediatevalue(0)
|
||||
for k in range(2):
|
||||
getattr(self.dut, f"qsfp{k}_rx_rst").setimmediatevalue(0)
|
||||
getattr(self.dut, f"qsfp{k}_tx_rst").setimmediatevalue(0)
|
||||
|
||||
await self.rc.enumerate()
|
||||
|
||||
@ -378,10 +352,9 @@ class TB(object):
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
|
||||
if self.loopback_enable:
|
||||
if not self.qsfp0_mac.tx.empty():
|
||||
await self.qsfp0_mac.rx.send(await self.qsfp0_mac.tx.recv())
|
||||
if not self.qsfp1_mac.tx.empty():
|
||||
await self.qsfp1_mac.rx.send(await self.qsfp1_mac.tx.recv())
|
||||
for mac in self.qsfp_mac:
|
||||
if not mac.tx.empty():
|
||||
await mac.rx.send(await mac.tx.recv())
|
||||
|
||||
|
||||
@cocotb.test()
|
||||
@ -412,10 +385,10 @@ async def run_test_nic(dut):
|
||||
|
||||
await tb.driver.interfaces[0].start_xmit(data, 0)
|
||||
|
||||
pkt = await tb.qsfp0_mac.tx.recv()
|
||||
pkt = await tb.qsfp_mac[0].tx.recv()
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
|
||||
await tb.qsfp0_mac.rx.send(pkt)
|
||||
await tb.qsfp_mac[0].rx.send(pkt)
|
||||
|
||||
pkt = await tb.driver.interfaces[0].recv()
|
||||
|
||||
@ -424,10 +397,10 @@ async def run_test_nic(dut):
|
||||
|
||||
# await tb.driver.interfaces[1].start_xmit(data, 0)
|
||||
|
||||
# pkt = await tb.qsfp1_mac.tx.recv()
|
||||
# pkt = await tb.qsfp_mac[1].tx.recv()
|
||||
# tb.log.info("Packet: %s", pkt)
|
||||
|
||||
# await tb.qsfp1_mac.rx.send(pkt)
|
||||
# await tb.qsfp_mac[1].rx.send(pkt)
|
||||
|
||||
# pkt = await tb.driver.interfaces[1].recv()
|
||||
|
||||
@ -447,10 +420,10 @@ async def run_test_nic(dut):
|
||||
|
||||
await tb.driver.interfaces[0].start_xmit(test_pkt2.build(), 0, 34, 6)
|
||||
|
||||
pkt = await tb.qsfp0_mac.tx.recv()
|
||||
pkt = await tb.qsfp_mac[0].tx.recv()
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
|
||||
await tb.qsfp0_mac.rx.send(pkt)
|
||||
await tb.qsfp_mac[0].rx.send(pkt)
|
||||
|
||||
pkt = await tb.driver.interfaces[0].recv()
|
||||
|
||||
|
@ -276,87 +276,37 @@ class TB(object):
|
||||
cocotb.start_soon(Clock(dut.ptp_sample_clk, 8, units="ns").start())
|
||||
|
||||
# Ethernet
|
||||
cocotb.start_soon(Clock(dut.qsfp0_rx_clk_1, 2.56, units="ns").start())
|
||||
self.qsfp0_1_source = XgmiiSource(dut.qsfp0_rxd_1, dut.qsfp0_rxc_1, dut.qsfp0_rx_clk_1, dut.qsfp0_rx_rst_1)
|
||||
cocotb.start_soon(Clock(dut.qsfp0_tx_clk_1, 2.56, units="ns").start())
|
||||
self.qsfp0_1_sink = XgmiiSink(dut.qsfp0_txd_1, dut.qsfp0_txc_1, dut.qsfp0_tx_clk_1, dut.qsfp0_tx_rst_1)
|
||||
self.qsfp_source = []
|
||||
self.qsfp_sink = []
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp0_rx_clk_2, 2.56, units="ns").start())
|
||||
self.qsfp0_2_source = XgmiiSource(dut.qsfp0_rxd_2, dut.qsfp0_rxc_2, dut.qsfp0_rx_clk_2, dut.qsfp0_rx_rst_2)
|
||||
cocotb.start_soon(Clock(dut.qsfp0_tx_clk_2, 2.56, units="ns").start())
|
||||
self.qsfp0_2_sink = XgmiiSink(dut.qsfp0_txd_2, dut.qsfp0_txc_2, dut.qsfp0_tx_clk_2, dut.qsfp0_tx_rst_2)
|
||||
for x in range(2):
|
||||
sources = []
|
||||
sinks = []
|
||||
for y in range(1, 5):
|
||||
cocotb.start_soon(Clock(getattr(dut, f"qsfp{x}_rx_clk_{y}"), 2.56, units="ns").start())
|
||||
source = XgmiiSource(getattr(dut, f"qsfp{x}_rxd_{y}"), getattr(dut, f"qsfp{x}_rxc_{y}"), getattr(dut, f"qsfp{x}_rx_clk_{y}"), getattr(dut, f"qsfp{x}_rx_rst_{y}"))
|
||||
sources.append(source)
|
||||
cocotb.start_soon(Clock(getattr(dut, f"qsfp{x}_tx_clk_{y}"), 2.56, units="ns").start())
|
||||
sink = XgmiiSink(getattr(dut, f"qsfp{x}_txd_{y}"), getattr(dut, f"qsfp{x}_txc_{y}"), getattr(dut, f"qsfp{x}_tx_clk_{y}"), getattr(dut, f"qsfp{x}_tx_rst_{y}"))
|
||||
sinks.append(sink)
|
||||
getattr(dut, f"qsfp{x}_rx_status_{y}").setimmediatevalue(1)
|
||||
getattr(dut, f"qsfp{x}_rx_error_count_{y}").setimmediatevalue(0)
|
||||
self.qsfp_source.append(sources)
|
||||
self.qsfp_sink.append(sinks)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp0_rx_clk_3, 2.56, units="ns").start())
|
||||
self.qsfp0_3_source = XgmiiSource(dut.qsfp0_rxd_3, dut.qsfp0_rxc_3, dut.qsfp0_rx_clk_3, dut.qsfp0_rx_rst_3)
|
||||
cocotb.start_soon(Clock(dut.qsfp0_tx_clk_3, 2.56, units="ns").start())
|
||||
self.qsfp0_3_sink = XgmiiSink(dut.qsfp0_txd_3, dut.qsfp0_txc_3, dut.qsfp0_tx_clk_3, dut.qsfp0_tx_rst_3)
|
||||
cocotb.start_soon(Clock(getattr(dut, f"qsfp{x}_drp_clk"), 8, units="ns").start())
|
||||
getattr(dut, f"qsfp{x}_drp_rst").setimmediatevalue(0)
|
||||
getattr(dut, f"qsfp{x}_drp_do").setimmediatevalue(0)
|
||||
getattr(dut, f"qsfp{x}_drp_rdy").setimmediatevalue(0)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp0_rx_clk_4, 2.56, units="ns").start())
|
||||
self.qsfp0_4_source = XgmiiSource(dut.qsfp0_rxd_4, dut.qsfp0_rxc_4, dut.qsfp0_rx_clk_4, dut.qsfp0_rx_rst_4)
|
||||
cocotb.start_soon(Clock(dut.qsfp0_tx_clk_4, 2.56, units="ns").start())
|
||||
self.qsfp0_4_sink = XgmiiSink(dut.qsfp0_txd_4, dut.qsfp0_txc_4, dut.qsfp0_tx_clk_4, dut.qsfp0_tx_rst_4)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp1_rx_clk_1, 2.56, units="ns").start())
|
||||
self.qsfp1_1_source = XgmiiSource(dut.qsfp1_rxd_1, dut.qsfp1_rxc_1, dut.qsfp1_rx_clk_1, dut.qsfp1_rx_rst_1)
|
||||
cocotb.start_soon(Clock(dut.qsfp1_tx_clk_1, 2.56, units="ns").start())
|
||||
self.qsfp1_1_sink = XgmiiSink(dut.qsfp1_txd_1, dut.qsfp1_txc_1, dut.qsfp1_tx_clk_1, dut.qsfp1_tx_rst_1)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp1_rx_clk_2, 2.56, units="ns").start())
|
||||
self.qsfp1_2_source = XgmiiSource(dut.qsfp1_rxd_2, dut.qsfp1_rxc_2, dut.qsfp1_rx_clk_2, dut.qsfp1_rx_rst_2)
|
||||
cocotb.start_soon(Clock(dut.qsfp1_tx_clk_2, 2.56, units="ns").start())
|
||||
self.qsfp1_2_sink = XgmiiSink(dut.qsfp1_txd_2, dut.qsfp1_txc_2, dut.qsfp1_tx_clk_2, dut.qsfp1_tx_rst_2)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp1_rx_clk_3, 2.56, units="ns").start())
|
||||
self.qsfp1_3_source = XgmiiSource(dut.qsfp1_rxd_3, dut.qsfp1_rxc_3, dut.qsfp1_rx_clk_3, dut.qsfp1_rx_rst_3)
|
||||
cocotb.start_soon(Clock(dut.qsfp1_tx_clk_3, 2.56, units="ns").start())
|
||||
self.qsfp1_3_sink = XgmiiSink(dut.qsfp1_txd_3, dut.qsfp1_txc_3, dut.qsfp1_tx_clk_3, dut.qsfp1_tx_rst_3)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp1_rx_clk_4, 2.56, units="ns").start())
|
||||
self.qsfp1_4_source = XgmiiSource(dut.qsfp1_rxd_4, dut.qsfp1_rxc_4, dut.qsfp1_rx_clk_4, dut.qsfp1_rx_rst_4)
|
||||
cocotb.start_soon(Clock(dut.qsfp1_tx_clk_4, 2.56, units="ns").start())
|
||||
self.qsfp1_4_sink = XgmiiSink(dut.qsfp1_txd_4, dut.qsfp1_txc_4, dut.qsfp1_tx_clk_4, dut.qsfp1_tx_rst_4)
|
||||
|
||||
dut.qsfp0_rx_status_1.setimmediatevalue(1)
|
||||
dut.qsfp0_rx_status_2.setimmediatevalue(1)
|
||||
dut.qsfp0_rx_status_3.setimmediatevalue(1)
|
||||
dut.qsfp0_rx_status_4.setimmediatevalue(1)
|
||||
|
||||
dut.qsfp1_rx_status_1.setimmediatevalue(1)
|
||||
dut.qsfp1_rx_status_2.setimmediatevalue(1)
|
||||
dut.qsfp1_rx_status_3.setimmediatevalue(1)
|
||||
dut.qsfp1_rx_status_4.setimmediatevalue(1)
|
||||
getattr(dut, f"qsfp{x}_modprsl").setimmediatevalue(0)
|
||||
getattr(dut, f"qsfp{x}_intl").setimmediatevalue(1)
|
||||
|
||||
dut.sw.setimmediatevalue(0)
|
||||
|
||||
dut.i2c_scl_i.setimmediatevalue(1)
|
||||
dut.i2c_sda_i.setimmediatevalue(1)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp0_drp_clk, 8, units="ns").start())
|
||||
dut.qsfp0_drp_rst.setimmediatevalue(0)
|
||||
dut.qsfp0_drp_do.setimmediatevalue(0)
|
||||
dut.qsfp0_drp_rdy.setimmediatevalue(0)
|
||||
|
||||
dut.qsfp0_rx_error_count_1.setimmediatevalue(0)
|
||||
dut.qsfp0_rx_error_count_2.setimmediatevalue(0)
|
||||
dut.qsfp0_rx_error_count_3.setimmediatevalue(0)
|
||||
dut.qsfp0_rx_error_count_4.setimmediatevalue(0)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp1_drp_clk, 8, units="ns").start())
|
||||
dut.qsfp1_drp_rst.setimmediatevalue(0)
|
||||
dut.qsfp1_drp_do.setimmediatevalue(0)
|
||||
dut.qsfp1_drp_rdy.setimmediatevalue(0)
|
||||
|
||||
dut.qsfp1_rx_error_count_1.setimmediatevalue(0)
|
||||
dut.qsfp1_rx_error_count_2.setimmediatevalue(0)
|
||||
dut.qsfp1_rx_error_count_3.setimmediatevalue(0)
|
||||
dut.qsfp1_rx_error_count_4.setimmediatevalue(0)
|
||||
|
||||
dut.qsfp0_modprsl.setimmediatevalue(0)
|
||||
dut.qsfp0_intl.setimmediatevalue(1)
|
||||
|
||||
dut.qsfp1_modprsl.setimmediatevalue(0)
|
||||
dut.qsfp1_intl.setimmediatevalue(1)
|
||||
|
||||
dut.qspi_dq_i.setimmediatevalue(0)
|
||||
|
||||
self.loopback_enable = False
|
||||
@ -365,43 +315,19 @@ class TB(object):
|
||||
async def init(self):
|
||||
|
||||
self.dut.ptp_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp0_rx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp0_tx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp0_rx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp0_tx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp0_rx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp0_tx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp0_rx_rst_4.setimmediatevalue(0)
|
||||
self.dut.qsfp0_tx_rst_4.setimmediatevalue(0)
|
||||
self.dut.qsfp1_rx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp1_tx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp1_rx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp1_tx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp1_rx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp1_tx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp1_rx_rst_4.setimmediatevalue(0)
|
||||
self.dut.qsfp1_tx_rst_4.setimmediatevalue(0)
|
||||
for x in range(2):
|
||||
for y in range(1, 5):
|
||||
getattr(self.dut, f"qsfp{x}_rx_rst_{y}").setimmediatevalue(0)
|
||||
getattr(self.dut, f"qsfp{x}_tx_rst_{y}").setimmediatevalue(0)
|
||||
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
|
||||
self.dut.ptp_rst.setimmediatevalue(1)
|
||||
self.dut.qsfp0_rx_rst_1.setimmediatevalue(1)
|
||||
self.dut.qsfp0_tx_rst_1.setimmediatevalue(1)
|
||||
self.dut.qsfp0_rx_rst_2.setimmediatevalue(1)
|
||||
self.dut.qsfp0_tx_rst_2.setimmediatevalue(1)
|
||||
self.dut.qsfp0_rx_rst_3.setimmediatevalue(1)
|
||||
self.dut.qsfp0_tx_rst_3.setimmediatevalue(1)
|
||||
self.dut.qsfp0_rx_rst_4.setimmediatevalue(1)
|
||||
self.dut.qsfp0_tx_rst_4.setimmediatevalue(1)
|
||||
self.dut.qsfp1_rx_rst_1.setimmediatevalue(1)
|
||||
self.dut.qsfp1_tx_rst_1.setimmediatevalue(1)
|
||||
self.dut.qsfp1_rx_rst_2.setimmediatevalue(1)
|
||||
self.dut.qsfp1_tx_rst_2.setimmediatevalue(1)
|
||||
self.dut.qsfp1_rx_rst_3.setimmediatevalue(1)
|
||||
self.dut.qsfp1_tx_rst_3.setimmediatevalue(1)
|
||||
self.dut.qsfp1_rx_rst_4.setimmediatevalue(1)
|
||||
self.dut.qsfp1_tx_rst_4.setimmediatevalue(1)
|
||||
for x in range(2):
|
||||
for y in range(1, 5):
|
||||
getattr(self.dut, f"qsfp{x}_rx_rst_{y}").setimmediatevalue(1)
|
||||
getattr(self.dut, f"qsfp{x}_tx_rst_{y}").setimmediatevalue(1)
|
||||
|
||||
await FallingEdge(self.dut.rst_250mhz)
|
||||
await Timer(100, 'ns')
|
||||
@ -410,22 +336,10 @@ class TB(object):
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
|
||||
self.dut.ptp_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp0_rx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp0_tx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp0_rx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp0_tx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp0_rx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp0_tx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp0_rx_rst_4.setimmediatevalue(0)
|
||||
self.dut.qsfp0_tx_rst_4.setimmediatevalue(0)
|
||||
self.dut.qsfp1_rx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp1_tx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp1_rx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp1_tx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp1_rx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp1_tx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp1_rx_rst_4.setimmediatevalue(0)
|
||||
self.dut.qsfp1_tx_rst_4.setimmediatevalue(0)
|
||||
for x in range(2):
|
||||
for y in range(1, 5):
|
||||
getattr(self.dut, f"qsfp{x}_rx_rst_{y}").setimmediatevalue(0)
|
||||
getattr(self.dut, f"qsfp{x}_tx_rst_{y}").setimmediatevalue(0)
|
||||
|
||||
await self.rc.enumerate()
|
||||
|
||||
@ -434,22 +348,10 @@ class TB(object):
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
|
||||
if self.loopback_enable:
|
||||
if not self.qsfp0_1_sink.empty():
|
||||
await self.qsfp0_1_source.send(await self.qsfp0_1_sink.recv())
|
||||
if not self.qsfp0_2_sink.empty():
|
||||
await self.qsfp0_2_source.send(await self.qsfp0_2_sink.recv())
|
||||
if not self.qsfp0_3_sink.empty():
|
||||
await self.qsfp0_3_source.send(await self.qsfp0_3_sink.recv())
|
||||
if not self.qsfp0_4_sink.empty():
|
||||
await self.qsfp0_4_source.send(await self.qsfp0_4_sink.recv())
|
||||
if not self.qsfp1_1_sink.empty():
|
||||
await self.qsfp1_1_source.send(await self.qsfp1_1_sink.recv())
|
||||
if not self.qsfp1_2_sink.empty():
|
||||
await self.qsfp1_2_source.send(await self.qsfp1_2_sink.recv())
|
||||
if not self.qsfp1_3_sink.empty():
|
||||
await self.qsfp1_3_source.send(await self.qsfp1_3_sink.recv())
|
||||
if not self.qsfp1_4_sink.empty():
|
||||
await self.qsfp1_4_source.send(await self.qsfp1_4_sink.recv())
|
||||
for x in range(len(self.qsfp_sink)):
|
||||
for y in range(len(self.qsfp_sink[x])):
|
||||
if not self.qsfp_sink[x][y].empty():
|
||||
await self.qsfp_source[x][y].send(await self.qsfp_sink[x][y].recv())
|
||||
|
||||
|
||||
@cocotb.test()
|
||||
@ -480,10 +382,10 @@ async def run_test_nic(dut):
|
||||
|
||||
await tb.driver.interfaces[0].start_xmit(data, 0)
|
||||
|
||||
pkt = await tb.qsfp0_1_sink.recv()
|
||||
pkt = await tb.qsfp_sink[0][0].recv()
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
|
||||
await tb.qsfp0_1_source.send(pkt)
|
||||
await tb.qsfp_source[0][0].send(pkt)
|
||||
|
||||
pkt = await tb.driver.interfaces[0].recv()
|
||||
|
||||
@ -492,10 +394,10 @@ async def run_test_nic(dut):
|
||||
|
||||
# await tb.driver.interfaces[1].start_xmit(data, 0)
|
||||
|
||||
# pkt = await tb.qsfp1_1_sink.recv()
|
||||
# pkt = await tb.qsfp_sink[1][0].recv()
|
||||
# tb.log.info("Packet: %s", pkt)
|
||||
|
||||
# await tb.qsfp1_1_source.send(pkt)
|
||||
# await tb.qsfp_source[1][0].send(pkt)
|
||||
|
||||
# pkt = await tb.driver.interfaces[1].recv()
|
||||
|
||||
@ -515,10 +417,10 @@ async def run_test_nic(dut):
|
||||
|
||||
await tb.driver.interfaces[0].start_xmit(test_pkt2.build(), 0, 34, 6)
|
||||
|
||||
pkt = await tb.qsfp0_1_sink.recv()
|
||||
pkt = await tb.qsfp_sink[0][0].recv()
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
|
||||
await tb.qsfp0_1_source.send(pkt)
|
||||
await tb.qsfp_source[0][0].send(pkt)
|
||||
|
||||
pkt = await tb.driver.interfaces[0].recv()
|
||||
|
||||
|
@ -276,133 +276,45 @@ class TB(object):
|
||||
cocotb.start_soon(Clock(dut.ptp_sample_clk, 8, units="ns").start())
|
||||
|
||||
# Ethernet
|
||||
cocotb.start_soon(Clock(dut.qsfp0_rx_clk, 3.102, units="ns").start())
|
||||
cocotb.start_soon(Clock(dut.qsfp0_tx_clk, 3.102, units="ns").start())
|
||||
self.qsfp_mac = []
|
||||
|
||||
self.qsfp0_mac = EthMac(
|
||||
tx_clk=dut.qsfp0_tx_clk,
|
||||
tx_rst=dut.qsfp0_tx_rst,
|
||||
tx_bus=AxiStreamBus.from_prefix(dut, "qsfp0_tx_axis"),
|
||||
tx_ptp_time=dut.qsfp0_tx_ptp_time,
|
||||
tx_ptp_ts=dut.qsfp0_tx_ptp_ts,
|
||||
tx_ptp_ts_tag=dut.qsfp0_tx_ptp_ts_tag,
|
||||
tx_ptp_ts_valid=dut.qsfp0_tx_ptp_ts_valid,
|
||||
rx_clk=dut.qsfp0_rx_clk,
|
||||
rx_rst=dut.qsfp0_rx_rst,
|
||||
rx_bus=AxiStreamBus.from_prefix(dut, "qsfp0_rx_axis"),
|
||||
rx_ptp_time=dut.qsfp0_rx_ptp_time,
|
||||
ifg=12, speed=100e9
|
||||
)
|
||||
for k in range(4):
|
||||
cocotb.start_soon(Clock(getattr(dut, f"qsfp{k}_rx_clk"), 3.102, units="ns").start())
|
||||
cocotb.start_soon(Clock(getattr(dut, f"qsfp{k}_tx_clk"), 3.102, units="ns").start())
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp1_rx_clk, 3.102, units="ns").start())
|
||||
cocotb.start_soon(Clock(dut.qsfp1_tx_clk, 3.102, units="ns").start())
|
||||
mac = EthMac(
|
||||
tx_clk=getattr(dut, f"qsfp{k}_tx_clk"),
|
||||
tx_rst=getattr(dut, f"qsfp{k}_tx_rst"),
|
||||
tx_bus=AxiStreamBus.from_prefix(dut, f"qsfp{k}_tx_axis"),
|
||||
tx_ptp_time=getattr(dut, f"qsfp{k}_tx_ptp_time"),
|
||||
tx_ptp_ts=getattr(dut, f"qsfp{k}_tx_ptp_ts"),
|
||||
tx_ptp_ts_tag=getattr(dut, f"qsfp{k}_tx_ptp_ts_tag"),
|
||||
tx_ptp_ts_valid=getattr(dut, f"qsfp{k}_tx_ptp_ts_valid"),
|
||||
rx_clk=getattr(dut, f"qsfp{k}_rx_clk"),
|
||||
rx_rst=getattr(dut, f"qsfp{k}_rx_rst"),
|
||||
rx_bus=AxiStreamBus.from_prefix(dut, f"qsfp{k}_rx_axis"),
|
||||
rx_ptp_time=getattr(dut, f"qsfp{k}_rx_ptp_time"),
|
||||
ifg=12, speed=100e9
|
||||
)
|
||||
|
||||
self.qsfp1_mac = EthMac(
|
||||
tx_clk=dut.qsfp1_tx_clk,
|
||||
tx_rst=dut.qsfp1_tx_rst,
|
||||
tx_bus=AxiStreamBus.from_prefix(dut, "qsfp1_tx_axis"),
|
||||
tx_ptp_time=dut.qsfp1_tx_ptp_time,
|
||||
tx_ptp_ts=dut.qsfp1_tx_ptp_ts,
|
||||
tx_ptp_ts_tag=dut.qsfp1_tx_ptp_ts_tag,
|
||||
tx_ptp_ts_valid=dut.qsfp1_tx_ptp_ts_valid,
|
||||
rx_clk=dut.qsfp1_rx_clk,
|
||||
rx_rst=dut.qsfp1_rx_rst,
|
||||
rx_bus=AxiStreamBus.from_prefix(dut, "qsfp1_rx_axis"),
|
||||
rx_ptp_time=dut.qsfp1_rx_ptp_time,
|
||||
ifg=12, speed=100e9
|
||||
)
|
||||
self.qsfp_mac.append(mac)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp2_rx_clk, 3.102, units="ns").start())
|
||||
cocotb.start_soon(Clock(dut.qsfp2_tx_clk, 3.102, units="ns").start())
|
||||
getattr(dut, f"qsfp{k}_rx_status").setimmediatevalue(1)
|
||||
|
||||
self.qsfp2_mac = EthMac(
|
||||
tx_clk=dut.qsfp2_tx_clk,
|
||||
tx_rst=dut.qsfp2_tx_rst,
|
||||
tx_bus=AxiStreamBus.from_prefix(dut, "qsfp2_tx_axis"),
|
||||
tx_ptp_time=dut.qsfp2_tx_ptp_time,
|
||||
tx_ptp_ts=dut.qsfp2_tx_ptp_ts,
|
||||
tx_ptp_ts_tag=dut.qsfp2_tx_ptp_ts_tag,
|
||||
tx_ptp_ts_valid=dut.qsfp2_tx_ptp_ts_valid,
|
||||
rx_clk=dut.qsfp2_rx_clk,
|
||||
rx_rst=dut.qsfp2_rx_rst,
|
||||
rx_bus=AxiStreamBus.from_prefix(dut, "qsfp2_rx_axis"),
|
||||
rx_ptp_time=dut.qsfp2_rx_ptp_time,
|
||||
ifg=12, speed=100e9
|
||||
)
|
||||
cocotb.start_soon(Clock(getattr(dut, f"qsfp{k}_drp_clk"), 8, units="ns").start())
|
||||
getattr(dut, f"qsfp{k}_drp_rst").setimmediatevalue(0)
|
||||
getattr(dut, f"qsfp{k}_drp_do").setimmediatevalue(0)
|
||||
getattr(dut, f"qsfp{k}_drp_rdy").setimmediatevalue(0)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp3_rx_clk, 3.102, units="ns").start())
|
||||
cocotb.start_soon(Clock(dut.qsfp3_tx_clk, 3.102, units="ns").start())
|
||||
getattr(dut, f"qsfp{k}_modprsl").setimmediatevalue(0)
|
||||
getattr(dut, f"qsfp{k}_intl").setimmediatevalue(0)
|
||||
|
||||
self.qsfp3_mac = EthMac(
|
||||
tx_clk=dut.qsfp3_tx_clk,
|
||||
tx_rst=dut.qsfp3_tx_rst,
|
||||
tx_bus=AxiStreamBus.from_prefix(dut, "qsfp3_tx_axis"),
|
||||
tx_ptp_time=dut.qsfp3_tx_ptp_time,
|
||||
tx_ptp_ts=dut.qsfp3_tx_ptp_ts,
|
||||
tx_ptp_ts_tag=dut.qsfp3_tx_ptp_ts_tag,
|
||||
tx_ptp_ts_valid=dut.qsfp3_tx_ptp_ts_valid,
|
||||
rx_clk=dut.qsfp3_rx_clk,
|
||||
rx_rst=dut.qsfp3_rx_rst,
|
||||
rx_bus=AxiStreamBus.from_prefix(dut, "qsfp3_rx_axis"),
|
||||
rx_ptp_time=dut.qsfp3_rx_ptp_time,
|
||||
ifg=12, speed=100e9
|
||||
)
|
||||
|
||||
dut.qsfp0_rx_status.setimmediatevalue(1)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp0_drp_clk, 8, units="ns").start())
|
||||
dut.qsfp0_drp_rst.setimmediatevalue(0)
|
||||
dut.qsfp0_drp_do.setimmediatevalue(0)
|
||||
dut.qsfp0_drp_rdy.setimmediatevalue(0)
|
||||
|
||||
dut.qsfp1_rx_status.setimmediatevalue(1)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp1_drp_clk, 8, units="ns").start())
|
||||
dut.qsfp1_drp_rst.setimmediatevalue(0)
|
||||
dut.qsfp1_drp_do.setimmediatevalue(0)
|
||||
dut.qsfp1_drp_rdy.setimmediatevalue(0)
|
||||
|
||||
dut.qsfp2_rx_status.setimmediatevalue(1)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp2_drp_clk, 8, units="ns").start())
|
||||
dut.qsfp2_drp_rst.setimmediatevalue(0)
|
||||
dut.qsfp2_drp_do.setimmediatevalue(0)
|
||||
dut.qsfp2_drp_rdy.setimmediatevalue(0)
|
||||
|
||||
dut.qsfp3_rx_status.setimmediatevalue(1)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp3_drp_clk, 8, units="ns").start())
|
||||
dut.qsfp3_drp_rst.setimmediatevalue(0)
|
||||
dut.qsfp3_drp_do.setimmediatevalue(0)
|
||||
dut.qsfp3_drp_rdy.setimmediatevalue(0)
|
||||
getattr(dut, f"qsfp{k}_i2c_scl_i").setimmediatevalue(1)
|
||||
getattr(dut, f"qsfp{k}_i2c_sda_i").setimmediatevalue(1)
|
||||
|
||||
dut.eeprom_i2c_scl_i.setimmediatevalue(1)
|
||||
dut.eeprom_i2c_sda_i.setimmediatevalue(1)
|
||||
|
||||
dut.qsfp0_modprsl.setimmediatevalue(0)
|
||||
dut.qsfp0_intl.setimmediatevalue(1)
|
||||
|
||||
dut.qsfp0_i2c_scl_i.setimmediatevalue(1)
|
||||
dut.qsfp0_i2c_sda_i.setimmediatevalue(1)
|
||||
|
||||
dut.qsfp1_modprsl.setimmediatevalue(0)
|
||||
dut.qsfp1_intl.setimmediatevalue(1)
|
||||
|
||||
dut.qsfp1_i2c_scl_i.setimmediatevalue(1)
|
||||
dut.qsfp1_i2c_sda_i.setimmediatevalue(1)
|
||||
|
||||
dut.qsfp2_modprsl.setimmediatevalue(0)
|
||||
dut.qsfp2_intl.setimmediatevalue(1)
|
||||
|
||||
dut.qsfp2_i2c_scl_i.setimmediatevalue(1)
|
||||
dut.qsfp2_i2c_sda_i.setimmediatevalue(1)
|
||||
|
||||
dut.qsfp3_modprsl.setimmediatevalue(0)
|
||||
dut.qsfp3_intl.setimmediatevalue(1)
|
||||
|
||||
dut.qsfp3_i2c_scl_i.setimmediatevalue(1)
|
||||
dut.qsfp3_i2c_sda_i.setimmediatevalue(1)
|
||||
|
||||
dut.qspi_dq_i.setimmediatevalue(0)
|
||||
|
||||
self.loopback_enable = False
|
||||
@ -411,27 +323,17 @@ class TB(object):
|
||||
async def init(self):
|
||||
|
||||
self.dut.ptp_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp0_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp0_tx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp1_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp1_tx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp2_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp2_tx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp3_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp3_tx_rst.setimmediatevalue(0)
|
||||
for k in range(4):
|
||||
getattr(self.dut, f"qsfp{k}_rx_rst").setimmediatevalue(0)
|
||||
getattr(self.dut, f"qsfp{k}_tx_rst").setimmediatevalue(0)
|
||||
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
|
||||
self.dut.ptp_rst.setimmediatevalue(1)
|
||||
self.dut.qsfp0_rx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfp0_tx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfp1_rx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfp1_tx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfp2_rx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfp2_tx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfp3_rx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfp3_tx_rst.setimmediatevalue(1)
|
||||
for k in range(4):
|
||||
getattr(self.dut, f"qsfp{k}_rx_rst").setimmediatevalue(1)
|
||||
getattr(self.dut, f"qsfp{k}_tx_rst").setimmediatevalue(1)
|
||||
|
||||
await FallingEdge(self.dut.rst_250mhz)
|
||||
await Timer(100, 'ns')
|
||||
@ -440,14 +342,9 @@ class TB(object):
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
|
||||
self.dut.ptp_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp0_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp0_tx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp1_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp1_tx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp2_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp2_tx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp3_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp3_tx_rst.setimmediatevalue(0)
|
||||
for k in range(4):
|
||||
getattr(self.dut, f"qsfp{k}_rx_rst").setimmediatevalue(0)
|
||||
getattr(self.dut, f"qsfp{k}_tx_rst").setimmediatevalue(0)
|
||||
|
||||
await self.rc.enumerate()
|
||||
|
||||
@ -456,14 +353,9 @@ class TB(object):
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
|
||||
if self.loopback_enable:
|
||||
if not self.qsfp0_mac.tx.empty():
|
||||
await self.qsfp0_mac.rx.send(await self.qsfp0_mac.tx.recv())
|
||||
if not self.qsfp1_mac.tx.empty():
|
||||
await self.qsfp1_mac.rx.send(await self.qsfp1_mac.tx.recv())
|
||||
if not self.qsfp2_mac.tx.empty():
|
||||
await self.qsfp2_mac.rx.send(await self.qsfp2_mac.tx.recv())
|
||||
if not self.qsfp3_mac.tx.empty():
|
||||
await self.qsfp3_mac.rx.send(await self.qsfp3_mac.tx.recv())
|
||||
for mac in self.qsfp_mac:
|
||||
if not mac.tx.empty():
|
||||
await mac.rx.send(await mac.tx.recv())
|
||||
|
||||
|
||||
@cocotb.test()
|
||||
@ -494,10 +386,10 @@ async def run_test_nic(dut):
|
||||
|
||||
await tb.driver.interfaces[0].start_xmit(data, 0)
|
||||
|
||||
pkt = await tb.qsfp0_mac.tx.recv()
|
||||
pkt = await tb.qsfp_mac[0].tx.recv()
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
|
||||
await tb.qsfp0_mac.rx.send(pkt)
|
||||
await tb.qsfp_mac[0].rx.send(pkt)
|
||||
|
||||
pkt = await tb.driver.interfaces[0].recv()
|
||||
|
||||
@ -506,10 +398,10 @@ async def run_test_nic(dut):
|
||||
|
||||
# await tb.driver.interfaces[1].start_xmit(data, 0)
|
||||
|
||||
# pkt = await tb.qsfp1_mac.tx.recv()
|
||||
# pkt = await tb.qsfp_mac[1].tx.recv()
|
||||
# tb.log.info("Packet: %s", pkt)
|
||||
|
||||
# await tb.qsfp1_mac.rx.send(pkt)
|
||||
# await tb.qsfp_mac[1].rx.send(pkt)
|
||||
|
||||
# pkt = await tb.driver.interfaces[1].recv()
|
||||
|
||||
@ -529,10 +421,10 @@ async def run_test_nic(dut):
|
||||
|
||||
await tb.driver.interfaces[0].start_xmit(test_pkt2.build(), 0, 34, 6)
|
||||
|
||||
pkt = await tb.qsfp0_mac.tx.recv()
|
||||
pkt = await tb.qsfp_mac[0].tx.recv()
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
|
||||
await tb.qsfp0_mac.rx.send(pkt)
|
||||
await tb.qsfp_mac[0].rx.send(pkt)
|
||||
|
||||
pkt = await tb.driver.interfaces[0].recv()
|
||||
|
||||
|
@ -276,173 +276,37 @@ class TB(object):
|
||||
cocotb.start_soon(Clock(dut.ptp_sample_clk, 8, units="ns").start())
|
||||
|
||||
# Ethernet
|
||||
cocotb.start_soon(Clock(dut.qsfp0_rx_clk_1, 2.56, units="ns").start())
|
||||
self.qsfp0_1_source = XgmiiSource(dut.qsfp0_rxd_1, dut.qsfp0_rxc_1, dut.qsfp0_rx_clk_1, dut.qsfp0_rx_rst_1)
|
||||
cocotb.start_soon(Clock(dut.qsfp0_tx_clk_1, 2.56, units="ns").start())
|
||||
self.qsfp0_1_sink = XgmiiSink(dut.qsfp0_txd_1, dut.qsfp0_txc_1, dut.qsfp0_tx_clk_1, dut.qsfp0_tx_rst_1)
|
||||
self.qsfp_source = []
|
||||
self.qsfp_sink = []
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp0_rx_clk_2, 2.56, units="ns").start())
|
||||
self.qsfp0_2_source = XgmiiSource(dut.qsfp0_rxd_2, dut.qsfp0_rxc_2, dut.qsfp0_rx_clk_2, dut.qsfp0_rx_rst_2)
|
||||
cocotb.start_soon(Clock(dut.qsfp0_tx_clk_2, 2.56, units="ns").start())
|
||||
self.qsfp0_2_sink = XgmiiSink(dut.qsfp0_txd_2, dut.qsfp0_txc_2, dut.qsfp0_tx_clk_2, dut.qsfp0_tx_rst_2)
|
||||
for x in range(4):
|
||||
sources = []
|
||||
sinks = []
|
||||
for y in range(1, 5):
|
||||
cocotb.start_soon(Clock(getattr(dut, f"qsfp{x}_rx_clk_{y}"), 2.56, units="ns").start())
|
||||
source = XgmiiSource(getattr(dut, f"qsfp{x}_rxd_{y}"), getattr(dut, f"qsfp{x}_rxc_{y}"), getattr(dut, f"qsfp{x}_rx_clk_{y}"), getattr(dut, f"qsfp{x}_rx_rst_{y}"))
|
||||
sources.append(source)
|
||||
cocotb.start_soon(Clock(getattr(dut, f"qsfp{x}_tx_clk_{y}"), 2.56, units="ns").start())
|
||||
sink = XgmiiSink(getattr(dut, f"qsfp{x}_txd_{y}"), getattr(dut, f"qsfp{x}_txc_{y}"), getattr(dut, f"qsfp{x}_tx_clk_{y}"), getattr(dut, f"qsfp{x}_tx_rst_{y}"))
|
||||
sinks.append(sink)
|
||||
getattr(dut, f"qsfp{x}_rx_status_{y}").setimmediatevalue(1)
|
||||
getattr(dut, f"qsfp{x}_rx_error_count_{y}").setimmediatevalue(0)
|
||||
self.qsfp_source.append(sources)
|
||||
self.qsfp_sink.append(sinks)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp0_rx_clk_3, 2.56, units="ns").start())
|
||||
self.qsfp0_3_source = XgmiiSource(dut.qsfp0_rxd_3, dut.qsfp0_rxc_3, dut.qsfp0_rx_clk_3, dut.qsfp0_rx_rst_3)
|
||||
cocotb.start_soon(Clock(dut.qsfp0_tx_clk_3, 2.56, units="ns").start())
|
||||
self.qsfp0_3_sink = XgmiiSink(dut.qsfp0_txd_3, dut.qsfp0_txc_3, dut.qsfp0_tx_clk_3, dut.qsfp0_tx_rst_3)
|
||||
cocotb.start_soon(Clock(getattr(dut, f"qsfp{x}_drp_clk"), 8, units="ns").start())
|
||||
getattr(dut, f"qsfp{x}_drp_rst").setimmediatevalue(0)
|
||||
getattr(dut, f"qsfp{x}_drp_do").setimmediatevalue(0)
|
||||
getattr(dut, f"qsfp{x}_drp_rdy").setimmediatevalue(0)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp0_rx_clk_4, 2.56, units="ns").start())
|
||||
self.qsfp0_4_source = XgmiiSource(dut.qsfp0_rxd_4, dut.qsfp0_rxc_4, dut.qsfp0_rx_clk_4, dut.qsfp0_rx_rst_4)
|
||||
cocotb.start_soon(Clock(dut.qsfp0_tx_clk_4, 2.56, units="ns").start())
|
||||
self.qsfp0_4_sink = XgmiiSink(dut.qsfp0_txd_4, dut.qsfp0_txc_4, dut.qsfp0_tx_clk_4, dut.qsfp0_tx_rst_4)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp1_rx_clk_1, 2.56, units="ns").start())
|
||||
self.qsfp1_1_source = XgmiiSource(dut.qsfp1_rxd_1, dut.qsfp1_rxc_1, dut.qsfp1_rx_clk_1, dut.qsfp1_rx_rst_1)
|
||||
cocotb.start_soon(Clock(dut.qsfp1_tx_clk_1, 2.56, units="ns").start())
|
||||
self.qsfp1_1_sink = XgmiiSink(dut.qsfp1_txd_1, dut.qsfp1_txc_1, dut.qsfp1_tx_clk_1, dut.qsfp1_tx_rst_1)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp1_rx_clk_2, 2.56, units="ns").start())
|
||||
self.qsfp1_2_source = XgmiiSource(dut.qsfp1_rxd_2, dut.qsfp1_rxc_2, dut.qsfp1_rx_clk_2, dut.qsfp1_rx_rst_2)
|
||||
cocotb.start_soon(Clock(dut.qsfp1_tx_clk_2, 2.56, units="ns").start())
|
||||
self.qsfp1_2_sink = XgmiiSink(dut.qsfp1_txd_2, dut.qsfp1_txc_2, dut.qsfp1_tx_clk_2, dut.qsfp1_tx_rst_2)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp1_rx_clk_3, 2.56, units="ns").start())
|
||||
self.qsfp1_3_source = XgmiiSource(dut.qsfp1_rxd_3, dut.qsfp1_rxc_3, dut.qsfp1_rx_clk_3, dut.qsfp1_rx_rst_3)
|
||||
cocotb.start_soon(Clock(dut.qsfp1_tx_clk_3, 2.56, units="ns").start())
|
||||
self.qsfp1_3_sink = XgmiiSink(dut.qsfp1_txd_3, dut.qsfp1_txc_3, dut.qsfp1_tx_clk_3, dut.qsfp1_tx_rst_3)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp1_rx_clk_4, 2.56, units="ns").start())
|
||||
self.qsfp1_4_source = XgmiiSource(dut.qsfp1_rxd_4, dut.qsfp1_rxc_4, dut.qsfp1_rx_clk_4, dut.qsfp1_rx_rst_4)
|
||||
cocotb.start_soon(Clock(dut.qsfp1_tx_clk_4, 2.56, units="ns").start())
|
||||
self.qsfp1_4_sink = XgmiiSink(dut.qsfp1_txd_4, dut.qsfp1_txc_4, dut.qsfp1_tx_clk_4, dut.qsfp1_tx_rst_4)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp2_rx_clk_1, 2.56, units="ns").start())
|
||||
self.qsfp2_1_source = XgmiiSource(dut.qsfp2_rxd_1, dut.qsfp2_rxc_1, dut.qsfp2_rx_clk_1, dut.qsfp2_rx_rst_1)
|
||||
cocotb.start_soon(Clock(dut.qsfp2_tx_clk_1, 2.56, units="ns").start())
|
||||
self.qsfp2_1_sink = XgmiiSink(dut.qsfp2_txd_1, dut.qsfp2_txc_1, dut.qsfp2_tx_clk_1, dut.qsfp2_tx_rst_1)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp2_rx_clk_2, 2.56, units="ns").start())
|
||||
self.qsfp2_2_source = XgmiiSource(dut.qsfp2_rxd_2, dut.qsfp2_rxc_2, dut.qsfp2_rx_clk_2, dut.qsfp2_rx_rst_2)
|
||||
cocotb.start_soon(Clock(dut.qsfp2_tx_clk_2, 2.56, units="ns").start())
|
||||
self.qsfp2_2_sink = XgmiiSink(dut.qsfp2_txd_2, dut.qsfp2_txc_2, dut.qsfp2_tx_clk_2, dut.qsfp2_tx_rst_2)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp2_rx_clk_3, 2.56, units="ns").start())
|
||||
self.qsfp2_3_source = XgmiiSource(dut.qsfp2_rxd_3, dut.qsfp2_rxc_3, dut.qsfp2_rx_clk_3, dut.qsfp2_rx_rst_3)
|
||||
cocotb.start_soon(Clock(dut.qsfp2_tx_clk_3, 2.56, units="ns").start())
|
||||
self.qsfp2_3_sink = XgmiiSink(dut.qsfp2_txd_3, dut.qsfp2_txc_3, dut.qsfp2_tx_clk_3, dut.qsfp2_tx_rst_3)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp2_rx_clk_4, 2.56, units="ns").start())
|
||||
self.qsfp2_4_source = XgmiiSource(dut.qsfp2_rxd_4, dut.qsfp2_rxc_4, dut.qsfp2_rx_clk_4, dut.qsfp2_rx_rst_4)
|
||||
cocotb.start_soon(Clock(dut.qsfp2_tx_clk_4, 2.56, units="ns").start())
|
||||
self.qsfp2_4_sink = XgmiiSink(dut.qsfp2_txd_4, dut.qsfp2_txc_4, dut.qsfp2_tx_clk_4, dut.qsfp2_tx_rst_4)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp3_rx_clk_1, 2.56, units="ns").start())
|
||||
self.qsfp3_1_source = XgmiiSource(dut.qsfp3_rxd_1, dut.qsfp3_rxc_1, dut.qsfp3_rx_clk_1, dut.qsfp3_rx_rst_1)
|
||||
cocotb.start_soon(Clock(dut.qsfp3_tx_clk_1, 2.56, units="ns").start())
|
||||
self.qsfp3_1_sink = XgmiiSink(dut.qsfp3_txd_1, dut.qsfp3_txc_1, dut.qsfp3_tx_clk_1, dut.qsfp3_tx_rst_1)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp3_rx_clk_2, 2.56, units="ns").start())
|
||||
self.qsfp3_2_source = XgmiiSource(dut.qsfp3_rxd_2, dut.qsfp3_rxc_2, dut.qsfp3_rx_clk_2, dut.qsfp3_rx_rst_2)
|
||||
cocotb.start_soon(Clock(dut.qsfp3_tx_clk_2, 2.56, units="ns").start())
|
||||
self.qsfp3_2_sink = XgmiiSink(dut.qsfp3_txd_2, dut.qsfp3_txc_2, dut.qsfp3_tx_clk_2, dut.qsfp3_tx_rst_2)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp3_rx_clk_3, 2.56, units="ns").start())
|
||||
self.qsfp3_3_source = XgmiiSource(dut.qsfp3_rxd_3, dut.qsfp3_rxc_3, dut.qsfp3_rx_clk_3, dut.qsfp3_rx_rst_3)
|
||||
cocotb.start_soon(Clock(dut.qsfp3_tx_clk_3, 2.56, units="ns").start())
|
||||
self.qsfp3_3_sink = XgmiiSink(dut.qsfp3_txd_3, dut.qsfp3_txc_3, dut.qsfp3_tx_clk_3, dut.qsfp3_tx_rst_3)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp3_rx_clk_4, 2.56, units="ns").start())
|
||||
self.qsfp3_4_source = XgmiiSource(dut.qsfp3_rxd_4, dut.qsfp3_rxc_4, dut.qsfp3_rx_clk_4, dut.qsfp3_rx_rst_4)
|
||||
cocotb.start_soon(Clock(dut.qsfp3_tx_clk_4, 2.56, units="ns").start())
|
||||
self.qsfp3_4_sink = XgmiiSink(dut.qsfp3_txd_4, dut.qsfp3_txc_4, dut.qsfp3_tx_clk_4, dut.qsfp3_tx_rst_4)
|
||||
|
||||
dut.qsfp0_rx_status_1.setimmediatevalue(1)
|
||||
dut.qsfp0_rx_status_2.setimmediatevalue(1)
|
||||
dut.qsfp0_rx_status_3.setimmediatevalue(1)
|
||||
dut.qsfp0_rx_status_4.setimmediatevalue(1)
|
||||
|
||||
dut.qsfp1_rx_status_1.setimmediatevalue(1)
|
||||
dut.qsfp1_rx_status_2.setimmediatevalue(1)
|
||||
dut.qsfp1_rx_status_3.setimmediatevalue(1)
|
||||
dut.qsfp1_rx_status_4.setimmediatevalue(1)
|
||||
|
||||
dut.qsfp2_rx_status_1.setimmediatevalue(1)
|
||||
dut.qsfp2_rx_status_2.setimmediatevalue(1)
|
||||
dut.qsfp2_rx_status_3.setimmediatevalue(1)
|
||||
dut.qsfp2_rx_status_4.setimmediatevalue(1)
|
||||
|
||||
dut.qsfp3_rx_status_1.setimmediatevalue(1)
|
||||
dut.qsfp3_rx_status_2.setimmediatevalue(1)
|
||||
dut.qsfp3_rx_status_3.setimmediatevalue(1)
|
||||
dut.qsfp3_rx_status_4.setimmediatevalue(1)
|
||||
getattr(dut, f"qsfp{x}_modprsl").setimmediatevalue(0)
|
||||
getattr(dut, f"qsfp{x}_intl").setimmediatevalue(1)
|
||||
getattr(dut, f"qsfp{x}_i2c_scl_i").setimmediatevalue(1)
|
||||
getattr(dut, f"qsfp{x}_i2c_sda_i").setimmediatevalue(1)
|
||||
|
||||
dut.eeprom_i2c_scl_i.setimmediatevalue(1)
|
||||
dut.eeprom_i2c_sda_i.setimmediatevalue(1)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp0_drp_clk, 8, units="ns").start())
|
||||
dut.qsfp0_drp_rst.setimmediatevalue(0)
|
||||
dut.qsfp0_drp_do.setimmediatevalue(0)
|
||||
dut.qsfp0_drp_rdy.setimmediatevalue(0)
|
||||
|
||||
dut.qsfp0_rx_error_count_1.setimmediatevalue(0)
|
||||
dut.qsfp0_rx_error_count_2.setimmediatevalue(0)
|
||||
dut.qsfp0_rx_error_count_3.setimmediatevalue(0)
|
||||
dut.qsfp0_rx_error_count_4.setimmediatevalue(0)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp1_drp_clk, 8, units="ns").start())
|
||||
dut.qsfp1_drp_rst.setimmediatevalue(0)
|
||||
dut.qsfp1_drp_do.setimmediatevalue(0)
|
||||
dut.qsfp1_drp_rdy.setimmediatevalue(0)
|
||||
|
||||
dut.qsfp1_rx_error_count_1.setimmediatevalue(0)
|
||||
dut.qsfp1_rx_error_count_2.setimmediatevalue(0)
|
||||
dut.qsfp1_rx_error_count_3.setimmediatevalue(0)
|
||||
dut.qsfp1_rx_error_count_4.setimmediatevalue(0)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp2_drp_clk, 8, units="ns").start())
|
||||
dut.qsfp2_drp_rst.setimmediatevalue(0)
|
||||
dut.qsfp2_drp_do.setimmediatevalue(0)
|
||||
dut.qsfp2_drp_rdy.setimmediatevalue(0)
|
||||
|
||||
dut.qsfp2_rx_error_count_1.setimmediatevalue(0)
|
||||
dut.qsfp2_rx_error_count_2.setimmediatevalue(0)
|
||||
dut.qsfp2_rx_error_count_3.setimmediatevalue(0)
|
||||
dut.qsfp2_rx_error_count_4.setimmediatevalue(0)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp3_drp_clk, 8, units="ns").start())
|
||||
dut.qsfp3_drp_rst.setimmediatevalue(0)
|
||||
dut.qsfp3_drp_do.setimmediatevalue(0)
|
||||
dut.qsfp3_drp_rdy.setimmediatevalue(0)
|
||||
|
||||
dut.qsfp3_rx_error_count_1.setimmediatevalue(0)
|
||||
dut.qsfp3_rx_error_count_2.setimmediatevalue(0)
|
||||
dut.qsfp3_rx_error_count_3.setimmediatevalue(0)
|
||||
dut.qsfp3_rx_error_count_4.setimmediatevalue(0)
|
||||
|
||||
dut.qsfp0_modprsl.setimmediatevalue(0)
|
||||
dut.qsfp0_intl.setimmediatevalue(1)
|
||||
|
||||
dut.qsfp0_i2c_scl_i.setimmediatevalue(1)
|
||||
dut.qsfp0_i2c_sda_i.setimmediatevalue(1)
|
||||
|
||||
dut.qsfp1_modprsl.setimmediatevalue(0)
|
||||
dut.qsfp1_intl.setimmediatevalue(1)
|
||||
|
||||
dut.qsfp1_i2c_scl_i.setimmediatevalue(1)
|
||||
dut.qsfp1_i2c_sda_i.setimmediatevalue(1)
|
||||
|
||||
dut.qsfp2_modprsl.setimmediatevalue(0)
|
||||
dut.qsfp2_intl.setimmediatevalue(1)
|
||||
|
||||
dut.qsfp2_i2c_scl_i.setimmediatevalue(1)
|
||||
dut.qsfp2_i2c_sda_i.setimmediatevalue(1)
|
||||
|
||||
dut.qsfp3_modprsl.setimmediatevalue(0)
|
||||
dut.qsfp3_intl.setimmediatevalue(1)
|
||||
|
||||
dut.qsfp3_i2c_scl_i.setimmediatevalue(1)
|
||||
dut.qsfp3_i2c_sda_i.setimmediatevalue(1)
|
||||
|
||||
dut.qspi_dq_i.setimmediatevalue(0)
|
||||
|
||||
self.loopback_enable = False
|
||||
@ -451,75 +315,19 @@ class TB(object):
|
||||
async def init(self):
|
||||
|
||||
self.dut.ptp_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp0_rx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp0_tx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp0_rx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp0_tx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp0_rx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp0_tx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp0_rx_rst_4.setimmediatevalue(0)
|
||||
self.dut.qsfp0_tx_rst_4.setimmediatevalue(0)
|
||||
self.dut.qsfp1_rx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp1_tx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp1_rx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp1_tx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp1_rx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp1_tx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp1_rx_rst_4.setimmediatevalue(0)
|
||||
self.dut.qsfp1_tx_rst_4.setimmediatevalue(0)
|
||||
self.dut.qsfp2_rx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp2_tx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp2_rx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp2_tx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp2_rx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp2_tx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp2_rx_rst_4.setimmediatevalue(0)
|
||||
self.dut.qsfp2_tx_rst_4.setimmediatevalue(0)
|
||||
self.dut.qsfp3_rx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp3_tx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp3_rx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp3_tx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp3_rx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp3_tx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp3_rx_rst_4.setimmediatevalue(0)
|
||||
self.dut.qsfp3_tx_rst_4.setimmediatevalue(0)
|
||||
for x in range(4):
|
||||
for y in range(1, 5):
|
||||
getattr(self.dut, f"qsfp{x}_rx_rst_{y}").setimmediatevalue(0)
|
||||
getattr(self.dut, f"qsfp{x}_tx_rst_{y}").setimmediatevalue(0)
|
||||
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
|
||||
self.dut.ptp_rst.setimmediatevalue(1)
|
||||
self.dut.qsfp0_rx_rst_1.setimmediatevalue(1)
|
||||
self.dut.qsfp0_tx_rst_1.setimmediatevalue(1)
|
||||
self.dut.qsfp0_rx_rst_2.setimmediatevalue(1)
|
||||
self.dut.qsfp0_tx_rst_2.setimmediatevalue(1)
|
||||
self.dut.qsfp0_rx_rst_3.setimmediatevalue(1)
|
||||
self.dut.qsfp0_tx_rst_3.setimmediatevalue(1)
|
||||
self.dut.qsfp0_rx_rst_4.setimmediatevalue(1)
|
||||
self.dut.qsfp0_tx_rst_4.setimmediatevalue(1)
|
||||
self.dut.qsfp1_rx_rst_1.setimmediatevalue(1)
|
||||
self.dut.qsfp1_tx_rst_1.setimmediatevalue(1)
|
||||
self.dut.qsfp1_rx_rst_2.setimmediatevalue(1)
|
||||
self.dut.qsfp1_tx_rst_2.setimmediatevalue(1)
|
||||
self.dut.qsfp1_rx_rst_3.setimmediatevalue(1)
|
||||
self.dut.qsfp1_tx_rst_3.setimmediatevalue(1)
|
||||
self.dut.qsfp1_rx_rst_4.setimmediatevalue(1)
|
||||
self.dut.qsfp1_tx_rst_4.setimmediatevalue(1)
|
||||
self.dut.qsfp2_rx_rst_1.setimmediatevalue(1)
|
||||
self.dut.qsfp2_tx_rst_1.setimmediatevalue(1)
|
||||
self.dut.qsfp2_rx_rst_2.setimmediatevalue(1)
|
||||
self.dut.qsfp2_tx_rst_2.setimmediatevalue(1)
|
||||
self.dut.qsfp2_rx_rst_3.setimmediatevalue(1)
|
||||
self.dut.qsfp2_tx_rst_3.setimmediatevalue(1)
|
||||
self.dut.qsfp2_rx_rst_4.setimmediatevalue(1)
|
||||
self.dut.qsfp2_tx_rst_4.setimmediatevalue(1)
|
||||
self.dut.qsfp3_rx_rst_1.setimmediatevalue(1)
|
||||
self.dut.qsfp3_tx_rst_1.setimmediatevalue(1)
|
||||
self.dut.qsfp3_rx_rst_2.setimmediatevalue(1)
|
||||
self.dut.qsfp3_tx_rst_2.setimmediatevalue(1)
|
||||
self.dut.qsfp3_rx_rst_3.setimmediatevalue(1)
|
||||
self.dut.qsfp3_tx_rst_3.setimmediatevalue(1)
|
||||
self.dut.qsfp3_rx_rst_4.setimmediatevalue(1)
|
||||
self.dut.qsfp3_tx_rst_4.setimmediatevalue(1)
|
||||
for x in range(4):
|
||||
for y in range(1, 5):
|
||||
getattr(self.dut, f"qsfp{x}_rx_rst_{y}").setimmediatevalue(1)
|
||||
getattr(self.dut, f"qsfp{x}_tx_rst_{y}").setimmediatevalue(1)
|
||||
|
||||
await FallingEdge(self.dut.rst_250mhz)
|
||||
await Timer(100, 'ns')
|
||||
@ -528,38 +336,10 @@ class TB(object):
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
|
||||
self.dut.ptp_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp0_rx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp0_tx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp0_rx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp0_tx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp0_rx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp0_tx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp0_rx_rst_4.setimmediatevalue(0)
|
||||
self.dut.qsfp0_tx_rst_4.setimmediatevalue(0)
|
||||
self.dut.qsfp1_rx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp1_tx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp1_rx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp1_tx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp1_rx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp1_tx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp1_rx_rst_4.setimmediatevalue(0)
|
||||
self.dut.qsfp1_tx_rst_4.setimmediatevalue(0)
|
||||
self.dut.qsfp2_rx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp2_tx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp2_rx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp2_tx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp2_rx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp2_tx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp2_rx_rst_4.setimmediatevalue(0)
|
||||
self.dut.qsfp2_tx_rst_4.setimmediatevalue(0)
|
||||
self.dut.qsfp3_rx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp3_tx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp3_rx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp3_tx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp3_rx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp3_tx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp3_rx_rst_4.setimmediatevalue(0)
|
||||
self.dut.qsfp3_tx_rst_4.setimmediatevalue(0)
|
||||
for x in range(4):
|
||||
for y in range(1, 5):
|
||||
getattr(self.dut, f"qsfp{x}_rx_rst_{y}").setimmediatevalue(0)
|
||||
getattr(self.dut, f"qsfp{x}_tx_rst_{y}").setimmediatevalue(0)
|
||||
|
||||
await self.rc.enumerate()
|
||||
|
||||
@ -568,38 +348,10 @@ class TB(object):
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
|
||||
if self.loopback_enable:
|
||||
if not self.qsfp0_1_sink.empty():
|
||||
await self.qsfp0_1_source.send(await self.qsfp0_1_sink.recv())
|
||||
if not self.qsfp0_2_sink.empty():
|
||||
await self.qsfp0_2_source.send(await self.qsfp0_2_sink.recv())
|
||||
if not self.qsfp0_3_sink.empty():
|
||||
await self.qsfp0_3_source.send(await self.qsfp0_3_sink.recv())
|
||||
if not self.qsfp0_4_sink.empty():
|
||||
await self.qsfp0_4_source.send(await self.qsfp0_4_sink.recv())
|
||||
if not self.qsfp1_1_sink.empty():
|
||||
await self.qsfp1_1_source.send(await self.qsfp1_1_sink.recv())
|
||||
if not self.qsfp1_2_sink.empty():
|
||||
await self.qsfp1_2_source.send(await self.qsfp1_2_sink.recv())
|
||||
if not self.qsfp1_3_sink.empty():
|
||||
await self.qsfp1_3_source.send(await self.qsfp1_3_sink.recv())
|
||||
if not self.qsfp1_4_sink.empty():
|
||||
await self.qsfp1_4_source.send(await self.qsfp1_4_sink.recv())
|
||||
if not self.qsfp2_1_sink.empty():
|
||||
await self.qsfp2_1_source.send(await self.qsfp2_1_sink.recv())
|
||||
if not self.qsfp2_2_sink.empty():
|
||||
await self.qsfp2_2_source.send(await self.qsfp2_2_sink.recv())
|
||||
if not self.qsfp2_3_sink.empty():
|
||||
await self.qsfp2_3_source.send(await self.qsfp2_3_sink.recv())
|
||||
if not self.qsfp2_4_sink.empty():
|
||||
await self.qsfp2_4_source.send(await self.qsfp2_4_sink.recv())
|
||||
if not self.qsfp3_1_sink.empty():
|
||||
await self.qsfp3_1_source.send(await self.qsfp3_1_sink.recv())
|
||||
if not self.qsfp3_2_sink.empty():
|
||||
await self.qsfp3_2_source.send(await self.qsfp3_2_sink.recv())
|
||||
if not self.qsfp3_3_sink.empty():
|
||||
await self.qsfp3_3_source.send(await self.qsfp3_3_sink.recv())
|
||||
if not self.qsfp3_4_sink.empty():
|
||||
await self.qsfp3_4_source.send(await self.qsfp3_4_sink.recv())
|
||||
for x in range(len(self.qsfp_sink)):
|
||||
for y in range(len(self.qsfp_sink[x])):
|
||||
if not self.qsfp_sink[x][y].empty():
|
||||
await self.qsfp_source[x][y].send(await self.qsfp_sink[x][y].recv())
|
||||
|
||||
|
||||
@cocotb.test()
|
||||
@ -630,10 +382,10 @@ async def run_test_nic(dut):
|
||||
|
||||
await tb.driver.interfaces[0].start_xmit(data, 0)
|
||||
|
||||
pkt = await tb.qsfp0_1_sink.recv()
|
||||
pkt = await tb.qsfp_sink[0][0].recv()
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
|
||||
await tb.qsfp0_1_source.send(pkt)
|
||||
await tb.qsfp_source[0][0].send(pkt)
|
||||
|
||||
pkt = await tb.driver.interfaces[0].recv()
|
||||
|
||||
@ -642,10 +394,10 @@ async def run_test_nic(dut):
|
||||
|
||||
# await tb.driver.interfaces[1].start_xmit(data, 0)
|
||||
|
||||
# pkt = await tb.qsfp1_1_sink.recv()
|
||||
# pkt = await tb.qsfp_sink[1][0].recv()
|
||||
# tb.log.info("Packet: %s", pkt)
|
||||
|
||||
# await tb.qsfp1_1_source.send(pkt)
|
||||
# await tb.qsfp_source[1][0].send(pkt)
|
||||
|
||||
# pkt = await tb.driver.interfaces[1].recv()
|
||||
|
||||
@ -665,10 +417,10 @@ async def run_test_nic(dut):
|
||||
|
||||
await tb.driver.interfaces[0].start_xmit(test_pkt2.build(), 0, 34, 6)
|
||||
|
||||
pkt = await tb.qsfp0_1_sink.recv()
|
||||
pkt = await tb.qsfp_sink[0][0].recv()
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
|
||||
await tb.qsfp0_1_source.send(pkt)
|
||||
await tb.qsfp_source[0][0].send(pkt)
|
||||
|
||||
pkt = await tb.driver.interfaces[0].recv()
|
||||
|
||||
|
@ -58,41 +58,24 @@ class TB(object):
|
||||
cocotb.start_soon(Clock(dut.ptp_sample_clk, 8, units="ns").start())
|
||||
|
||||
# Ethernet
|
||||
cocotb.start_soon(Clock(dut.sfp0_rx_clk, 6.4, units="ns").start())
|
||||
self.sfp0_source = XgmiiSource(dut.sfp0_rxd, dut.sfp0_rxc, dut.sfp0_rx_clk, dut.sfp0_rx_rst)
|
||||
cocotb.start_soon(Clock(dut.sfp0_tx_clk, 6.4, units="ns").start())
|
||||
self.sfp0_sink = XgmiiSink(dut.sfp0_txd, dut.sfp0_txc, dut.sfp0_tx_clk, dut.sfp0_tx_rst)
|
||||
self.sfp_source = []
|
||||
self.sfp_sink = []
|
||||
|
||||
cocotb.start_soon(Clock(dut.sfp1_rx_clk, 6.4, units="ns").start())
|
||||
self.sfp1_source = XgmiiSource(dut.sfp1_rxd, dut.sfp1_rxc, dut.sfp1_rx_clk, dut.sfp1_rx_rst)
|
||||
cocotb.start_soon(Clock(dut.sfp1_tx_clk, 6.4, units="ns").start())
|
||||
self.sfp1_sink = XgmiiSink(dut.sfp1_txd, dut.sfp1_txc, dut.sfp1_tx_clk, dut.sfp1_tx_rst)
|
||||
|
||||
cocotb.start_soon(Clock(dut.sfp2_rx_clk, 6.4, units="ns").start())
|
||||
self.sfp2_source = XgmiiSource(dut.sfp2_rxd, dut.sfp2_rxc, dut.sfp2_rx_clk, dut.sfp2_rx_rst)
|
||||
cocotb.start_soon(Clock(dut.sfp2_tx_clk, 6.4, units="ns").start())
|
||||
self.sfp2_sink = XgmiiSink(dut.sfp2_txd, dut.sfp2_txc, dut.sfp2_tx_clk, dut.sfp2_tx_rst)
|
||||
|
||||
cocotb.start_soon(Clock(dut.sfp3_rx_clk, 6.4, units="ns").start())
|
||||
self.sfp3_source = XgmiiSource(dut.sfp3_rxd, dut.sfp3_rxc, dut.sfp3_rx_clk, dut.sfp3_rx_rst)
|
||||
cocotb.start_soon(Clock(dut.sfp3_tx_clk, 6.4, units="ns").start())
|
||||
self.sfp3_sink = XgmiiSink(dut.sfp3_txd, dut.sfp3_txc, dut.sfp3_tx_clk, dut.sfp3_tx_rst)
|
||||
|
||||
dut.sfp0_rx_status.setimmediatevalue(1)
|
||||
dut.sfp1_rx_status.setimmediatevalue(1)
|
||||
dut.sfp2_rx_status.setimmediatevalue(1)
|
||||
dut.sfp3_rx_status.setimmediatevalue(1)
|
||||
for k in range(4):
|
||||
cocotb.start_soon(Clock(getattr(dut, f"sfp{k}_rx_clk"), 6.4, units="ns").start())
|
||||
source = XgmiiSource(getattr(dut, f"sfp{k}_rxd"), getattr(dut, f"sfp{k}_rxc"), getattr(dut, f"sfp{k}_rx_clk"), getattr(dut, f"sfp{k}_rx_rst"))
|
||||
self.sfp_source.append(source)
|
||||
cocotb.start_soon(Clock(getattr(dut, f"sfp{k}_tx_clk"), 6.4, units="ns").start())
|
||||
sink = XgmiiSink(getattr(dut, f"sfp{k}_txd"), getattr(dut, f"sfp{k}_txc"), getattr(dut, f"sfp{k}_tx_clk"), getattr(dut, f"sfp{k}_tx_rst"))
|
||||
self.sfp_sink.append(sink)
|
||||
getattr(dut, f"sfp{k}_rx_status").setimmediatevalue(1)
|
||||
getattr(dut, f"sfp{k}_rx_error_count").setimmediatevalue(0)
|
||||
|
||||
cocotb.start_soon(Clock(dut.sfp_drp_clk, 8, units="ns").start())
|
||||
dut.sfp_drp_rst.setimmediatevalue(0)
|
||||
dut.sfp_drp_do.setimmediatevalue(0)
|
||||
dut.sfp_drp_rdy.setimmediatevalue(0)
|
||||
|
||||
dut.sfp0_rx_error_count.setimmediatevalue(0)
|
||||
dut.sfp1_rx_error_count.setimmediatevalue(0)
|
||||
dut.sfp2_rx_error_count.setimmediatevalue(0)
|
||||
dut.sfp3_rx_error_count.setimmediatevalue(0)
|
||||
|
||||
dut.btnu.setimmediatevalue(0)
|
||||
dut.btnl.setimmediatevalue(0)
|
||||
dut.btnd.setimmediatevalue(0)
|
||||
@ -107,56 +90,36 @@ class TB(object):
|
||||
|
||||
self.dut.rst_300mhz.setimmediatevalue(0)
|
||||
self.dut.ptp_rst.setimmediatevalue(0)
|
||||
self.dut.sfp0_rx_rst.setimmediatevalue(0)
|
||||
self.dut.sfp0_tx_rst.setimmediatevalue(0)
|
||||
self.dut.sfp1_rx_rst.setimmediatevalue(0)
|
||||
self.dut.sfp1_tx_rst.setimmediatevalue(0)
|
||||
self.dut.sfp2_rx_rst.setimmediatevalue(0)
|
||||
self.dut.sfp2_tx_rst.setimmediatevalue(0)
|
||||
self.dut.sfp3_rx_rst.setimmediatevalue(0)
|
||||
self.dut.sfp3_tx_rst.setimmediatevalue(0)
|
||||
for k in range(4):
|
||||
getattr(self.dut, f"sfp{k}_rx_rst").setimmediatevalue(0)
|
||||
getattr(self.dut, f"sfp{k}_tx_rst").setimmediatevalue(0)
|
||||
|
||||
await RisingEdge(self.dut.clk_300mhz)
|
||||
await RisingEdge(self.dut.clk_300mhz)
|
||||
|
||||
self.dut.rst_300mhz.value = 1
|
||||
self.dut.ptp_rst.setimmediatevalue(1)
|
||||
self.dut.sfp0_rx_rst.setimmediatevalue(1)
|
||||
self.dut.sfp0_tx_rst.setimmediatevalue(1)
|
||||
self.dut.sfp1_rx_rst.setimmediatevalue(1)
|
||||
self.dut.sfp1_tx_rst.setimmediatevalue(1)
|
||||
self.dut.sfp2_rx_rst.setimmediatevalue(1)
|
||||
self.dut.sfp2_tx_rst.setimmediatevalue(1)
|
||||
self.dut.sfp3_rx_rst.setimmediatevalue(1)
|
||||
self.dut.sfp3_tx_rst.setimmediatevalue(1)
|
||||
for k in range(4):
|
||||
getattr(self.dut, f"sfp{k}_rx_rst").setimmediatevalue(1)
|
||||
getattr(self.dut, f"sfp{k}_tx_rst").setimmediatevalue(1)
|
||||
|
||||
await RisingEdge(self.dut.clk_300mhz)
|
||||
await RisingEdge(self.dut.clk_300mhz)
|
||||
|
||||
self.dut.rst_300mhz.value = 0
|
||||
self.dut.ptp_rst.setimmediatevalue(0)
|
||||
self.dut.sfp0_rx_rst.setimmediatevalue(0)
|
||||
self.dut.sfp0_tx_rst.setimmediatevalue(0)
|
||||
self.dut.sfp1_rx_rst.setimmediatevalue(0)
|
||||
self.dut.sfp1_tx_rst.setimmediatevalue(0)
|
||||
self.dut.sfp2_rx_rst.setimmediatevalue(0)
|
||||
self.dut.sfp2_tx_rst.setimmediatevalue(0)
|
||||
self.dut.sfp3_rx_rst.setimmediatevalue(0)
|
||||
self.dut.sfp3_tx_rst.setimmediatevalue(0)
|
||||
for k in range(4):
|
||||
getattr(self.dut, f"sfp{k}_rx_rst").setimmediatevalue(0)
|
||||
getattr(self.dut, f"sfp{k}_tx_rst").setimmediatevalue(0)
|
||||
|
||||
async def _run_loopback(self):
|
||||
while True:
|
||||
await RisingEdge(self.dut.clk_300mhz)
|
||||
|
||||
if self.loopback_enable:
|
||||
if not self.sfp0_sink.empty():
|
||||
await self.sfp0_source.send(await self.sfp0_sink.recv())
|
||||
if not self.sfp1_sink.empty():
|
||||
await self.sfp1_source.send(await self.sfp1_sink.recv())
|
||||
if not self.sfp2_sink.empty():
|
||||
await self.sfp2_source.send(await self.sfp2_sink.recv())
|
||||
if not self.sfp3_sink.empty():
|
||||
await self.sfp3_source.send(await self.sfp3_sink.recv())
|
||||
for x in range(len(self.sfp_sink)):
|
||||
if not self.sfp_sink[x].empty():
|
||||
await self.sfp_source[x].send(await self.sfp_sink[x].recv())
|
||||
|
||||
|
||||
@cocotb.test()
|
||||
@ -187,10 +150,10 @@ async def run_test_nic(dut):
|
||||
|
||||
await tb.driver.interfaces[0].start_xmit(data, 0)
|
||||
|
||||
pkt = await tb.sfp0_sink.recv()
|
||||
pkt = await tb.sfp_sink[0].recv()
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
|
||||
await tb.sfp0_source.send(pkt)
|
||||
await tb.sfp_source[0].send(pkt)
|
||||
|
||||
pkt = await tb.driver.interfaces[0].recv()
|
||||
|
||||
@ -199,10 +162,10 @@ async def run_test_nic(dut):
|
||||
|
||||
# await tb.driver.interfaces[1].start_xmit(data, 0)
|
||||
|
||||
# pkt = await tb.sfp1_sink.recv()
|
||||
# pkt = await tb.sfp_sink[1].recv()
|
||||
# tb.log.info("Packet: %s", pkt)
|
||||
|
||||
# await tb.sfp1_source.send(pkt)
|
||||
# await tb.sfp_source[1].send(pkt)
|
||||
|
||||
# pkt = await tb.driver.interfaces[1].recv()
|
||||
|
||||
@ -222,10 +185,10 @@ async def run_test_nic(dut):
|
||||
|
||||
await tb.driver.interfaces[0].start_xmit(test_pkt2.build(), 0, 34, 6)
|
||||
|
||||
pkt = await tb.sfp0_sink.recv()
|
||||
pkt = await tb.sfp_sink[0].recv()
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
|
||||
await tb.sfp0_source.send(pkt)
|
||||
await tb.sfp_source[0].send(pkt)
|
||||
|
||||
pkt = await tb.driver.interfaces[0].recv()
|
||||
|
||||
|
@ -276,27 +276,24 @@ class TB(object):
|
||||
cocotb.start_soon(Clock(dut.ptp_sample_clk, 8, units="ns").start())
|
||||
|
||||
# Ethernet
|
||||
cocotb.start_soon(Clock(dut.sfp0_rx_clk, 6.4, units="ns").start())
|
||||
self.sfp0_source = XgmiiSource(dut.sfp0_rxd, dut.sfp0_rxc, dut.sfp0_rx_clk, dut.sfp0_rx_rst)
|
||||
cocotb.start_soon(Clock(dut.sfp0_tx_clk, 6.4, units="ns").start())
|
||||
self.sfp0_sink = XgmiiSink(dut.sfp0_txd, dut.sfp0_txc, dut.sfp0_tx_clk, dut.sfp0_tx_rst)
|
||||
self.sfp_source = []
|
||||
self.sfp_sink = []
|
||||
|
||||
cocotb.start_soon(Clock(dut.sfp1_rx_clk, 6.4, units="ns").start())
|
||||
self.sfp1_source = XgmiiSource(dut.sfp1_rxd, dut.sfp1_rxc, dut.sfp1_rx_clk, dut.sfp1_rx_rst)
|
||||
cocotb.start_soon(Clock(dut.sfp1_tx_clk, 6.4, units="ns").start())
|
||||
self.sfp1_sink = XgmiiSink(dut.sfp1_txd, dut.sfp1_txc, dut.sfp1_tx_clk, dut.sfp1_tx_rst)
|
||||
|
||||
dut.sfp0_rx_status.setimmediatevalue(1)
|
||||
dut.sfp1_rx_status.setimmediatevalue(1)
|
||||
for k in range(2):
|
||||
cocotb.start_soon(Clock(getattr(dut, f"sfp{k}_rx_clk"), 6.4, units="ns").start())
|
||||
source = XgmiiSource(getattr(dut, f"sfp{k}_rxd"), getattr(dut, f"sfp{k}_rxc"), getattr(dut, f"sfp{k}_rx_clk"), getattr(dut, f"sfp{k}_rx_rst"))
|
||||
self.sfp_source.append(source)
|
||||
cocotb.start_soon(Clock(getattr(dut, f"sfp{k}_tx_clk"), 6.4, units="ns").start())
|
||||
sink = XgmiiSink(getattr(dut, f"sfp{k}_txd"), getattr(dut, f"sfp{k}_txc"), getattr(dut, f"sfp{k}_tx_clk"), getattr(dut, f"sfp{k}_tx_rst"))
|
||||
self.sfp_sink.append(sink)
|
||||
getattr(dut, f"sfp{k}_rx_status").setimmediatevalue(1)
|
||||
getattr(dut, f"sfp{k}_rx_error_count").setimmediatevalue(0)
|
||||
|
||||
cocotb.start_soon(Clock(dut.sfp_drp_clk, 8, units="ns").start())
|
||||
dut.sfp_drp_rst.setimmediatevalue(0)
|
||||
dut.sfp_drp_do.setimmediatevalue(0)
|
||||
dut.sfp_drp_rdy.setimmediatevalue(0)
|
||||
|
||||
dut.sfp0_rx_error_count.setimmediatevalue(0)
|
||||
dut.sfp1_rx_error_count.setimmediatevalue(0)
|
||||
|
||||
dut.btnu.setimmediatevalue(0)
|
||||
dut.btnl.setimmediatevalue(0)
|
||||
dut.btnd.setimmediatevalue(0)
|
||||
@ -313,19 +310,17 @@ class TB(object):
|
||||
async def init(self):
|
||||
|
||||
self.dut.ptp_rst.setimmediatevalue(0)
|
||||
self.dut.sfp0_rx_rst.setimmediatevalue(0)
|
||||
self.dut.sfp0_tx_rst.setimmediatevalue(0)
|
||||
self.dut.sfp1_rx_rst.setimmediatevalue(0)
|
||||
self.dut.sfp1_tx_rst.setimmediatevalue(0)
|
||||
for k in range(2):
|
||||
getattr(self.dut, f"sfp{k}_rx_rst").setimmediatevalue(0)
|
||||
getattr(self.dut, f"sfp{k}_tx_rst").setimmediatevalue(0)
|
||||
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
|
||||
self.dut.ptp_rst.setimmediatevalue(1)
|
||||
self.dut.sfp0_rx_rst.setimmediatevalue(1)
|
||||
self.dut.sfp0_tx_rst.setimmediatevalue(1)
|
||||
self.dut.sfp1_rx_rst.setimmediatevalue(1)
|
||||
self.dut.sfp1_tx_rst.setimmediatevalue(1)
|
||||
for k in range(2):
|
||||
getattr(self.dut, f"sfp{k}_rx_rst").setimmediatevalue(1)
|
||||
getattr(self.dut, f"sfp{k}_tx_rst").setimmediatevalue(1)
|
||||
|
||||
await FallingEdge(self.dut.rst_250mhz)
|
||||
await Timer(100, 'ns')
|
||||
@ -334,10 +329,9 @@ class TB(object):
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
|
||||
self.dut.ptp_rst.setimmediatevalue(0)
|
||||
self.dut.sfp0_rx_rst.setimmediatevalue(0)
|
||||
self.dut.sfp0_tx_rst.setimmediatevalue(0)
|
||||
self.dut.sfp1_rx_rst.setimmediatevalue(0)
|
||||
self.dut.sfp1_tx_rst.setimmediatevalue(0)
|
||||
for k in range(2):
|
||||
getattr(self.dut, f"sfp{k}_rx_rst").setimmediatevalue(0)
|
||||
getattr(self.dut, f"sfp{k}_tx_rst").setimmediatevalue(0)
|
||||
|
||||
await self.rc.enumerate()
|
||||
|
||||
@ -346,10 +340,9 @@ class TB(object):
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
|
||||
if self.loopback_enable:
|
||||
if not self.sfp0_sink.empty():
|
||||
await self.sfp0_source.send(await self.sfp0_sink.recv())
|
||||
if not self.sfp1_sink.empty():
|
||||
await self.sfp1_source.send(await self.sfp1_sink.recv())
|
||||
for x in range(len(self.sfp_sink)):
|
||||
if not self.sfp_sink[x].empty():
|
||||
await self.sfp_source[x].send(await self.sfp_sink[x].recv())
|
||||
|
||||
|
||||
@cocotb.test()
|
||||
@ -380,10 +373,10 @@ async def run_test_nic(dut):
|
||||
|
||||
await tb.driver.interfaces[0].start_xmit(data, 0)
|
||||
|
||||
pkt = await tb.sfp0_sink.recv()
|
||||
pkt = await tb.sfp_sink[0].recv()
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
|
||||
await tb.sfp0_source.send(pkt)
|
||||
await tb.sfp_source[0].send(pkt)
|
||||
|
||||
pkt = await tb.driver.interfaces[0].recv()
|
||||
|
||||
@ -392,10 +385,10 @@ async def run_test_nic(dut):
|
||||
|
||||
# await tb.driver.interfaces[1].start_xmit(data, 0)
|
||||
|
||||
# pkt = await tb.sfp1_sink.recv()
|
||||
# pkt = await tb.sfp_sink[1].recv()
|
||||
# tb.log.info("Packet: %s", pkt)
|
||||
|
||||
# await tb.sfp1_source.send(pkt)
|
||||
# await tb.sfp_source[1].send(pkt)
|
||||
|
||||
# pkt = await tb.driver.interfaces[1].recv()
|
||||
|
||||
@ -415,10 +408,10 @@ async def run_test_nic(dut):
|
||||
|
||||
await tb.driver.interfaces[0].start_xmit(test_pkt2.build(), 0, 34, 6)
|
||||
|
||||
pkt = await tb.sfp0_sink.recv()
|
||||
pkt = await tb.sfp_sink[0].recv()
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
|
||||
await tb.sfp0_source.send(pkt)
|
||||
await tb.sfp_source[0].send(pkt)
|
||||
|
||||
pkt = await tb.driver.interfaces[0].recv()
|
||||
|
||||
|
@ -58,27 +58,24 @@ class TB(object):
|
||||
cocotb.start_soon(Clock(dut.ptp_sample_clk, 8, units="ns").start())
|
||||
|
||||
# Ethernet
|
||||
cocotb.start_soon(Clock(dut.sfp0_rx_clk, 6.4, units="ns").start())
|
||||
self.sfp0_source = XgmiiSource(dut.sfp0_rxd, dut.sfp0_rxc, dut.sfp0_rx_clk, dut.sfp0_rx_rst)
|
||||
cocotb.start_soon(Clock(dut.sfp0_tx_clk, 6.4, units="ns").start())
|
||||
self.sfp0_sink = XgmiiSink(dut.sfp0_txd, dut.sfp0_txc, dut.sfp0_tx_clk, dut.sfp0_tx_rst)
|
||||
self.sfp_source = []
|
||||
self.sfp_sink = []
|
||||
|
||||
cocotb.start_soon(Clock(dut.sfp1_rx_clk, 6.4, units="ns").start())
|
||||
self.sfp1_source = XgmiiSource(dut.sfp1_rxd, dut.sfp1_rxc, dut.sfp1_rx_clk, dut.sfp1_rx_rst)
|
||||
cocotb.start_soon(Clock(dut.sfp1_tx_clk, 6.4, units="ns").start())
|
||||
self.sfp1_sink = XgmiiSink(dut.sfp1_txd, dut.sfp1_txc, dut.sfp1_tx_clk, dut.sfp1_tx_rst)
|
||||
|
||||
dut.sfp0_rx_status.setimmediatevalue(1)
|
||||
dut.sfp1_rx_status.setimmediatevalue(1)
|
||||
for k in range(2):
|
||||
cocotb.start_soon(Clock(getattr(dut, f"sfp{k}_rx_clk"), 6.4, units="ns").start())
|
||||
source = XgmiiSource(getattr(dut, f"sfp{k}_rxd"), getattr(dut, f"sfp{k}_rxc"), getattr(dut, f"sfp{k}_rx_clk"), getattr(dut, f"sfp{k}_rx_rst"))
|
||||
self.sfp_source.append(source)
|
||||
cocotb.start_soon(Clock(getattr(dut, f"sfp{k}_tx_clk"), 6.4, units="ns").start())
|
||||
sink = XgmiiSink(getattr(dut, f"sfp{k}_txd"), getattr(dut, f"sfp{k}_txc"), getattr(dut, f"sfp{k}_tx_clk"), getattr(dut, f"sfp{k}_tx_rst"))
|
||||
self.sfp_sink.append(sink)
|
||||
getattr(dut, f"sfp{k}_rx_status").setimmediatevalue(1)
|
||||
getattr(dut, f"sfp{k}_rx_error_count").setimmediatevalue(0)
|
||||
|
||||
cocotb.start_soon(Clock(dut.sfp_drp_clk, 8, units="ns").start())
|
||||
dut.sfp_drp_rst.setimmediatevalue(0)
|
||||
dut.sfp_drp_do.setimmediatevalue(0)
|
||||
dut.sfp_drp_rdy.setimmediatevalue(0)
|
||||
|
||||
dut.sfp0_rx_error_count.setimmediatevalue(0)
|
||||
dut.sfp1_rx_error_count.setimmediatevalue(0)
|
||||
|
||||
dut.btnu.setimmediatevalue(0)
|
||||
dut.btnl.setimmediatevalue(0)
|
||||
dut.btnd.setimmediatevalue(0)
|
||||
@ -93,40 +90,36 @@ class TB(object):
|
||||
|
||||
self.dut.rst_300mhz.setimmediatevalue(0)
|
||||
self.dut.ptp_rst.setimmediatevalue(0)
|
||||
self.dut.sfp0_rx_rst.setimmediatevalue(0)
|
||||
self.dut.sfp0_tx_rst.setimmediatevalue(0)
|
||||
self.dut.sfp1_rx_rst.setimmediatevalue(0)
|
||||
self.dut.sfp1_tx_rst.setimmediatevalue(0)
|
||||
for k in range(2):
|
||||
getattr(self.dut, f"sfp{k}_rx_rst").setimmediatevalue(0)
|
||||
getattr(self.dut, f"sfp{k}_tx_rst").setimmediatevalue(0)
|
||||
|
||||
await RisingEdge(self.dut.clk_300mhz)
|
||||
await RisingEdge(self.dut.clk_300mhz)
|
||||
|
||||
self.dut.rst_300mhz.value = 1
|
||||
self.dut.ptp_rst.setimmediatevalue(1)
|
||||
self.dut.sfp0_rx_rst.setimmediatevalue(1)
|
||||
self.dut.sfp0_tx_rst.setimmediatevalue(1)
|
||||
self.dut.sfp1_rx_rst.setimmediatevalue(1)
|
||||
self.dut.sfp1_tx_rst.setimmediatevalue(1)
|
||||
for k in range(2):
|
||||
getattr(self.dut, f"sfp{k}_rx_rst").setimmediatevalue(1)
|
||||
getattr(self.dut, f"sfp{k}_tx_rst").setimmediatevalue(1)
|
||||
|
||||
await RisingEdge(self.dut.clk_300mhz)
|
||||
await RisingEdge(self.dut.clk_300mhz)
|
||||
|
||||
self.dut.rst_300mhz.value = 0
|
||||
self.dut.ptp_rst.setimmediatevalue(0)
|
||||
self.dut.sfp0_rx_rst.setimmediatevalue(0)
|
||||
self.dut.sfp0_tx_rst.setimmediatevalue(0)
|
||||
self.dut.sfp1_rx_rst.setimmediatevalue(0)
|
||||
self.dut.sfp1_tx_rst.setimmediatevalue(0)
|
||||
for k in range(2):
|
||||
getattr(self.dut, f"sfp{k}_rx_rst").setimmediatevalue(0)
|
||||
getattr(self.dut, f"sfp{k}_tx_rst").setimmediatevalue(0)
|
||||
|
||||
async def _run_loopback(self):
|
||||
while True:
|
||||
await RisingEdge(self.dut.clk_300mhz)
|
||||
|
||||
if self.loopback_enable:
|
||||
if not self.sfp0_sink.empty():
|
||||
await self.sfp0_source.send(await self.sfp0_sink.recv())
|
||||
if not self.sfp1_sink.empty():
|
||||
await self.sfp1_source.send(await self.sfp1_sink.recv())
|
||||
for x in range(len(self.sfp_sink)):
|
||||
if not self.sfp_sink[x].empty():
|
||||
await self.sfp_source[x].send(await self.sfp_sink[x].recv())
|
||||
|
||||
|
||||
@cocotb.test()
|
||||
@ -157,10 +150,10 @@ async def run_test_nic(dut):
|
||||
|
||||
await tb.driver.interfaces[0].start_xmit(data, 0)
|
||||
|
||||
pkt = await tb.sfp0_sink.recv()
|
||||
pkt = await tb.sfp_sink[0].recv()
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
|
||||
await tb.sfp0_source.send(pkt)
|
||||
await tb.sfp_source[0].send(pkt)
|
||||
|
||||
pkt = await tb.driver.interfaces[0].recv()
|
||||
|
||||
@ -169,10 +162,10 @@ async def run_test_nic(dut):
|
||||
|
||||
# await tb.driver.interfaces[1].start_xmit(data, 0)
|
||||
|
||||
# pkt = await tb.sfp1_sink.recv()
|
||||
# pkt = await tb.sfp_sink[1].recv()
|
||||
# tb.log.info("Packet: %s", pkt)
|
||||
|
||||
# await tb.sfp1_source.send(pkt)
|
||||
# await tb.sfp_source[1].send(pkt)
|
||||
|
||||
# pkt = await tb.driver.interfaces[1].recv()
|
||||
|
||||
@ -192,10 +185,10 @@ async def run_test_nic(dut):
|
||||
|
||||
await tb.driver.interfaces[0].start_xmit(test_pkt2.build(), 0, 34, 6)
|
||||
|
||||
pkt = await tb.sfp0_sink.recv()
|
||||
pkt = await tb.sfp_sink[0].recv()
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
|
||||
await tb.sfp0_source.send(pkt)
|
||||
await tb.sfp_source[0].send(pkt)
|
||||
|
||||
pkt = await tb.driver.interfaces[0].recv()
|
||||
|
||||
|
@ -276,64 +276,40 @@ class TB(object):
|
||||
cocotb.start_soon(Clock(dut.ptp_sample_clk, 8, units="ns").start())
|
||||
|
||||
# Ethernet
|
||||
cocotb.start_soon(Clock(dut.qsfp_0_rx_clk, 3.102, units="ns").start())
|
||||
cocotb.start_soon(Clock(dut.qsfp_0_tx_clk, 3.102, units="ns").start())
|
||||
self.qsfp_mac = []
|
||||
|
||||
self.qsfp_0_mac = EthMac(
|
||||
tx_clk=dut.qsfp_0_tx_clk,
|
||||
tx_rst=dut.qsfp_0_tx_rst,
|
||||
tx_bus=AxiStreamBus.from_prefix(dut, "qsfp_0_tx_axis"),
|
||||
tx_ptp_time=dut.qsfp_0_tx_ptp_time,
|
||||
tx_ptp_ts=dut.qsfp_0_tx_ptp_ts,
|
||||
tx_ptp_ts_tag=dut.qsfp_0_tx_ptp_ts_tag,
|
||||
tx_ptp_ts_valid=dut.qsfp_0_tx_ptp_ts_valid,
|
||||
rx_clk=dut.qsfp_0_rx_clk,
|
||||
rx_rst=dut.qsfp_0_rx_rst,
|
||||
rx_bus=AxiStreamBus.from_prefix(dut, "qsfp_0_rx_axis"),
|
||||
rx_ptp_time=dut.qsfp_0_rx_ptp_time,
|
||||
ifg=12, speed=100e9
|
||||
)
|
||||
for k in range(2):
|
||||
cocotb.start_soon(Clock(getattr(dut, f"qsfp_{k}_rx_clk"), 3.102, units="ns").start())
|
||||
cocotb.start_soon(Clock(getattr(dut, f"qsfp_{k}_tx_clk"), 3.102, units="ns").start())
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp_1_rx_clk, 3.102, units="ns").start())
|
||||
cocotb.start_soon(Clock(dut.qsfp_1_tx_clk, 3.102, units="ns").start())
|
||||
mac = EthMac(
|
||||
tx_clk=getattr(dut, f"qsfp_{k}_tx_clk"),
|
||||
tx_rst=getattr(dut, f"qsfp_{k}_tx_rst"),
|
||||
tx_bus=AxiStreamBus.from_prefix(dut, f"qsfp_{k}_tx_axis"),
|
||||
tx_ptp_time=getattr(dut, f"qsfp_{k}_tx_ptp_time"),
|
||||
tx_ptp_ts=getattr(dut, f"qsfp_{k}_tx_ptp_ts"),
|
||||
tx_ptp_ts_tag=getattr(dut, f"qsfp_{k}_tx_ptp_ts_tag"),
|
||||
tx_ptp_ts_valid=getattr(dut, f"qsfp_{k}_tx_ptp_ts_valid"),
|
||||
rx_clk=getattr(dut, f"qsfp_{k}_rx_clk"),
|
||||
rx_rst=getattr(dut, f"qsfp_{k}_rx_rst"),
|
||||
rx_bus=AxiStreamBus.from_prefix(dut, f"qsfp_{k}_rx_axis"),
|
||||
rx_ptp_time=getattr(dut, f"qsfp_{k}_rx_ptp_time"),
|
||||
ifg=12, speed=100e9
|
||||
)
|
||||
|
||||
self.qsfp_1_mac = EthMac(
|
||||
tx_clk=dut.qsfp_1_tx_clk,
|
||||
tx_rst=dut.qsfp_1_tx_rst,
|
||||
tx_bus=AxiStreamBus.from_prefix(dut, "qsfp_1_tx_axis"),
|
||||
tx_ptp_time=dut.qsfp_1_tx_ptp_time,
|
||||
tx_ptp_ts=dut.qsfp_1_tx_ptp_ts,
|
||||
tx_ptp_ts_tag=dut.qsfp_1_tx_ptp_ts_tag,
|
||||
tx_ptp_ts_valid=dut.qsfp_1_tx_ptp_ts_valid,
|
||||
rx_clk=dut.qsfp_1_rx_clk,
|
||||
rx_rst=dut.qsfp_1_rx_rst,
|
||||
rx_bus=AxiStreamBus.from_prefix(dut, "qsfp_1_rx_axis"),
|
||||
rx_ptp_time=dut.qsfp_1_rx_ptp_time,
|
||||
ifg=12, speed=100e9
|
||||
)
|
||||
self.qsfp_mac.append(mac)
|
||||
|
||||
dut.qsfp_0_rx_status.setimmediatevalue(1)
|
||||
dut.qsfp_1_rx_status.setimmediatevalue(1)
|
||||
getattr(dut, f"qsfp_{k}_rx_status").setimmediatevalue(1)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp_0_drp_clk, 8, units="ns").start())
|
||||
dut.qsfp_0_drp_rst.setimmediatevalue(0)
|
||||
dut.qsfp_0_drp_do.setimmediatevalue(0)
|
||||
dut.qsfp_0_drp_rdy.setimmediatevalue(0)
|
||||
cocotb.start_soon(Clock(getattr(dut, f"qsfp_{k}_drp_clk"), 8, units="ns").start())
|
||||
getattr(dut, f"qsfp_{k}_drp_rst").setimmediatevalue(0)
|
||||
getattr(dut, f"qsfp_{k}_drp_do").setimmediatevalue(0)
|
||||
getattr(dut, f"qsfp_{k}_drp_rdy").setimmediatevalue(0)
|
||||
|
||||
dut.qsfp_0_i2c_scl_i.setimmediatevalue(1)
|
||||
dut.qsfp_0_i2c_sda_i.setimmediatevalue(1)
|
||||
dut.qsfp_0_intr_n.setimmediatevalue(1)
|
||||
dut.qsfp_0_mod_prsnt_n.setimmediatevalue(0)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp_1_drp_clk, 8, units="ns").start())
|
||||
dut.qsfp_1_drp_rst.setimmediatevalue(0)
|
||||
dut.qsfp_1_drp_do.setimmediatevalue(0)
|
||||
dut.qsfp_1_drp_rdy.setimmediatevalue(0)
|
||||
|
||||
dut.qsfp_1_i2c_scl_i.setimmediatevalue(1)
|
||||
dut.qsfp_1_i2c_sda_i.setimmediatevalue(1)
|
||||
dut.qsfp_1_intr_n.setimmediatevalue(1)
|
||||
dut.qsfp_1_mod_prsnt_n.setimmediatevalue(0)
|
||||
getattr(dut, f"qsfp_{k}_i2c_scl_i").setimmediatevalue(1)
|
||||
getattr(dut, f"qsfp_{k}_i2c_sda_i").setimmediatevalue(1)
|
||||
getattr(dut, f"qsfp_{k}_intr_n").setimmediatevalue(1)
|
||||
getattr(dut, f"qsfp_{k}_mod_prsnt_n").setimmediatevalue(0)
|
||||
|
||||
dut.qspi_dq_i.setimmediatevalue(0)
|
||||
|
||||
@ -348,19 +324,17 @@ class TB(object):
|
||||
async def init(self):
|
||||
|
||||
self.dut.ptp_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp_0_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp_0_tx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp_1_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp_1_tx_rst.setimmediatevalue(0)
|
||||
for k in range(2):
|
||||
getattr(self.dut, f"qsfp_{k}_rx_rst").setimmediatevalue(0)
|
||||
getattr(self.dut, f"qsfp_{k}_tx_rst").setimmediatevalue(0)
|
||||
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
|
||||
self.dut.ptp_rst.setimmediatevalue(1)
|
||||
self.dut.qsfp_0_rx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfp_0_tx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfp_1_rx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfp_1_tx_rst.setimmediatevalue(1)
|
||||
for k in range(2):
|
||||
getattr(self.dut, f"qsfp_{k}_rx_rst").setimmediatevalue(1)
|
||||
getattr(self.dut, f"qsfp_{k}_tx_rst").setimmediatevalue(1)
|
||||
|
||||
await FallingEdge(self.dut.rst_250mhz)
|
||||
await Timer(100, 'ns')
|
||||
@ -369,10 +343,9 @@ class TB(object):
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
|
||||
self.dut.ptp_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp_0_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp_0_tx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp_1_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp_1_tx_rst.setimmediatevalue(0)
|
||||
for k in range(2):
|
||||
getattr(self.dut, f"qsfp_{k}_rx_rst").setimmediatevalue(0)
|
||||
getattr(self.dut, f"qsfp_{k}_tx_rst").setimmediatevalue(0)
|
||||
|
||||
await self.rc.enumerate()
|
||||
|
||||
@ -381,10 +354,9 @@ class TB(object):
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
|
||||
if self.loopback_enable:
|
||||
if not self.qsfp_0_mac.tx.empty():
|
||||
await self.qsfp_0_mac.rx.send(await self.qsfp_0_mac.tx.recv())
|
||||
if not self.qsfp_1_mac.tx.empty():
|
||||
await self.qsfp_1_mac.rx.send(await self.qsfp_1_mac.tx.recv())
|
||||
for mac in self.qsfp_mac:
|
||||
if not mac.tx.empty():
|
||||
await mac.rx.send(await mac.tx.recv())
|
||||
|
||||
|
||||
@cocotb.test()
|
||||
@ -415,10 +387,10 @@ async def run_test_nic(dut):
|
||||
|
||||
await tb.driver.interfaces[0].start_xmit(data, 0)
|
||||
|
||||
pkt = await tb.qsfp_0_mac.tx.recv()
|
||||
pkt = await tb.qsfp_mac[0].tx.recv()
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
|
||||
await tb.qsfp_0_mac.rx.send(pkt)
|
||||
await tb.qsfp_mac[0].rx.send(pkt)
|
||||
|
||||
pkt = await tb.driver.interfaces[0].recv()
|
||||
|
||||
@ -427,10 +399,10 @@ async def run_test_nic(dut):
|
||||
|
||||
# await tb.driver.interfaces[1].start_xmit(data, 0)
|
||||
|
||||
# pkt = await tb.qsfp_1_mac.tx.recv()
|
||||
# pkt = await tb.qsfp_mac[1].tx.recv()
|
||||
# tb.log.info("Packet: %s", pkt)
|
||||
|
||||
# await tb.qsfp_1_mac.rx.send(pkt)
|
||||
# await tb.qsfp_mac[1].rx.send(pkt)
|
||||
|
||||
# pkt = await tb.driver.interfaces[1].recv()
|
||||
|
||||
@ -450,10 +422,10 @@ async def run_test_nic(dut):
|
||||
|
||||
await tb.driver.interfaces[0].start_xmit(test_pkt2.build(), 0, 34, 6)
|
||||
|
||||
pkt = await tb.qsfp_0_mac.tx.recv()
|
||||
pkt = await tb.qsfp_mac[0].tx.recv()
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
|
||||
await tb.qsfp_0_mac.rx.send(pkt)
|
||||
await tb.qsfp_mac[0].rx.send(pkt)
|
||||
|
||||
pkt = await tb.driver.interfaces[0].recv()
|
||||
|
||||
|
@ -276,85 +276,33 @@ class TB(object):
|
||||
cocotb.start_soon(Clock(dut.ptp_sample_clk, 8, units="ns").start())
|
||||
|
||||
# Ethernet
|
||||
cocotb.start_soon(Clock(dut.qsfp_0_rx_clk_0, 2.56, units="ns").start())
|
||||
self.qsfp_0_0_source = XgmiiSource(dut.qsfp_0_rxd_0, dut.qsfp_0_rxc_0, dut.qsfp_0_rx_clk_0, dut.qsfp_0_rx_rst_0)
|
||||
cocotb.start_soon(Clock(dut.qsfp_0_tx_clk_0, 2.56, units="ns").start())
|
||||
self.qsfp_0_0_sink = XgmiiSink(dut.qsfp_0_txd_0, dut.qsfp_0_txc_0, dut.qsfp_0_tx_clk_0, dut.qsfp_0_tx_rst_0)
|
||||
self.qsfp_source = []
|
||||
self.qsfp_sink = []
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp_0_rx_clk_1, 2.56, units="ns").start())
|
||||
self.qsfp_0_1_source = XgmiiSource(dut.qsfp_0_rxd_1, dut.qsfp_0_rxc_1, dut.qsfp_0_rx_clk_1, dut.qsfp_0_rx_rst_1)
|
||||
cocotb.start_soon(Clock(dut.qsfp_0_tx_clk_1, 2.56, units="ns").start())
|
||||
self.qsfp_0_1_sink = XgmiiSink(dut.qsfp_0_txd_1, dut.qsfp_0_txc_1, dut.qsfp_0_tx_clk_1, dut.qsfp_0_tx_rst_1)
|
||||
for x in range(2):
|
||||
sources = []
|
||||
sinks = []
|
||||
for y in range(4):
|
||||
cocotb.start_soon(Clock(getattr(dut, f"qsfp_{x}_rx_clk_{y}"), 2.56, units="ns").start())
|
||||
source = XgmiiSource(getattr(dut, f"qsfp_{x}_rxd_{y}"), getattr(dut, f"qsfp_{x}_rxc_{y}"), getattr(dut, f"qsfp_{x}_rx_clk_{y}"), getattr(dut, f"qsfp_{x}_rx_rst_{y}"))
|
||||
sources.append(source)
|
||||
cocotb.start_soon(Clock(getattr(dut, f"qsfp_{x}_tx_clk_{y}"), 2.56, units="ns").start())
|
||||
sink = XgmiiSink(getattr(dut, f"qsfp_{x}_txd_{y}"), getattr(dut, f"qsfp_{x}_txc_{y}"), getattr(dut, f"qsfp_{x}_tx_clk_{y}"), getattr(dut, f"qsfp_{x}_tx_rst_{y}"))
|
||||
sinks.append(sink)
|
||||
getattr(dut, f"qsfp_{x}_rx_status_{y}").setimmediatevalue(1)
|
||||
getattr(dut, f"qsfp_{x}_rx_error_count_{y}").setimmediatevalue(0)
|
||||
self.qsfp_source.append(sources)
|
||||
self.qsfp_sink.append(sinks)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp_0_rx_clk_2, 2.56, units="ns").start())
|
||||
self.qsfp_0_2_source = XgmiiSource(dut.qsfp_0_rxd_2, dut.qsfp_0_rxc_2, dut.qsfp_0_rx_clk_2, dut.qsfp_0_rx_rst_2)
|
||||
cocotb.start_soon(Clock(dut.qsfp_0_tx_clk_2, 2.56, units="ns").start())
|
||||
self.qsfp_0_2_sink = XgmiiSink(dut.qsfp_0_txd_2, dut.qsfp_0_txc_2, dut.qsfp_0_tx_clk_2, dut.qsfp_0_tx_rst_2)
|
||||
cocotb.start_soon(Clock(getattr(dut, f"qsfp_{x}_drp_clk"), 8, units="ns").start())
|
||||
getattr(dut, f"qsfp_{x}_drp_rst").setimmediatevalue(0)
|
||||
getattr(dut, f"qsfp_{x}_drp_do").setimmediatevalue(0)
|
||||
getattr(dut, f"qsfp_{x}_drp_rdy").setimmediatevalue(0)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp_0_rx_clk_3, 2.56, units="ns").start())
|
||||
self.qsfp_0_3_source = XgmiiSource(dut.qsfp_0_rxd_3, dut.qsfp_0_rxc_3, dut.qsfp_0_rx_clk_3, dut.qsfp_0_rx_rst_3)
|
||||
cocotb.start_soon(Clock(dut.qsfp_0_tx_clk_3, 2.56, units="ns").start())
|
||||
self.qsfp_0_3_sink = XgmiiSink(dut.qsfp_0_txd_3, dut.qsfp_0_txc_3, dut.qsfp_0_tx_clk_3, dut.qsfp_0_tx_rst_3)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp_1_rx_clk_0, 2.56, units="ns").start())
|
||||
self.qsfp_1_0_source = XgmiiSource(dut.qsfp_1_rxd_0, dut.qsfp_1_rxc_0, dut.qsfp_1_rx_clk_0, dut.qsfp_1_rx_rst_0)
|
||||
cocotb.start_soon(Clock(dut.qsfp_1_tx_clk_0, 2.56, units="ns").start())
|
||||
self.qsfp_1_0_sink = XgmiiSink(dut.qsfp_1_txd_0, dut.qsfp_1_txc_0, dut.qsfp_1_tx_clk_0, dut.qsfp_1_tx_rst_0)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp_1_rx_clk_1, 2.56, units="ns").start())
|
||||
self.qsfp_1_1_source = XgmiiSource(dut.qsfp_1_rxd_1, dut.qsfp_1_rxc_1, dut.qsfp_1_rx_clk_1, dut.qsfp_1_rx_rst_1)
|
||||
cocotb.start_soon(Clock(dut.qsfp_1_tx_clk_1, 2.56, units="ns").start())
|
||||
self.qsfp_1_1_sink = XgmiiSink(dut.qsfp_1_txd_1, dut.qsfp_1_txc_1, dut.qsfp_1_tx_clk_1, dut.qsfp_1_tx_rst_1)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp_1_rx_clk_2, 2.56, units="ns").start())
|
||||
self.qsfp_1_2_source = XgmiiSource(dut.qsfp_1_rxd_2, dut.qsfp_1_rxc_2, dut.qsfp_1_rx_clk_2, dut.qsfp_1_rx_rst_2)
|
||||
cocotb.start_soon(Clock(dut.qsfp_1_tx_clk_2, 2.56, units="ns").start())
|
||||
self.qsfp_1_2_sink = XgmiiSink(dut.qsfp_1_txd_2, dut.qsfp_1_txc_2, dut.qsfp_1_tx_clk_2, dut.qsfp_1_tx_rst_2)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp_1_rx_clk_3, 2.56, units="ns").start())
|
||||
self.qsfp_1_3_source = XgmiiSource(dut.qsfp_1_rxd_3, dut.qsfp_1_rxc_3, dut.qsfp_1_rx_clk_3, dut.qsfp_1_rx_rst_3)
|
||||
cocotb.start_soon(Clock(dut.qsfp_1_tx_clk_3, 2.56, units="ns").start())
|
||||
self.qsfp_1_3_sink = XgmiiSink(dut.qsfp_1_txd_3, dut.qsfp_1_txc_3, dut.qsfp_1_tx_clk_3, dut.qsfp_1_tx_rst_3)
|
||||
|
||||
dut.qsfp_0_rx_status_0.setimmediatevalue(1)
|
||||
dut.qsfp_0_rx_status_1.setimmediatevalue(1)
|
||||
dut.qsfp_0_rx_status_2.setimmediatevalue(1)
|
||||
dut.qsfp_0_rx_status_3.setimmediatevalue(1)
|
||||
|
||||
dut.qsfp_1_rx_status_0.setimmediatevalue(1)
|
||||
dut.qsfp_1_rx_status_1.setimmediatevalue(1)
|
||||
dut.qsfp_1_rx_status_2.setimmediatevalue(1)
|
||||
dut.qsfp_1_rx_status_3.setimmediatevalue(1)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp_0_drp_clk, 8, units="ns").start())
|
||||
dut.qsfp_0_drp_rst.setimmediatevalue(0)
|
||||
dut.qsfp_0_drp_do.setimmediatevalue(0)
|
||||
dut.qsfp_0_drp_rdy.setimmediatevalue(0)
|
||||
|
||||
dut.qsfp_0_i2c_scl_i.setimmediatevalue(1)
|
||||
dut.qsfp_0_i2c_sda_i.setimmediatevalue(1)
|
||||
dut.qsfp_0_intr_n.setimmediatevalue(1)
|
||||
dut.qsfp_0_mod_prsnt_n.setimmediatevalue(0)
|
||||
|
||||
dut.qsfp_0_rx_error_count_0.setimmediatevalue(0)
|
||||
dut.qsfp_0_rx_error_count_1.setimmediatevalue(0)
|
||||
dut.qsfp_0_rx_error_count_2.setimmediatevalue(0)
|
||||
dut.qsfp_0_rx_error_count_3.setimmediatevalue(0)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp_1_drp_clk, 8, units="ns").start())
|
||||
dut.qsfp_1_drp_rst.setimmediatevalue(0)
|
||||
dut.qsfp_1_drp_do.setimmediatevalue(0)
|
||||
dut.qsfp_1_drp_rdy.setimmediatevalue(0)
|
||||
|
||||
dut.qsfp_1_i2c_scl_i.setimmediatevalue(1)
|
||||
dut.qsfp_1_i2c_sda_i.setimmediatevalue(1)
|
||||
dut.qsfp_1_intr_n.setimmediatevalue(1)
|
||||
dut.qsfp_1_mod_prsnt_n.setimmediatevalue(0)
|
||||
|
||||
dut.qsfp_1_rx_error_count_0.setimmediatevalue(0)
|
||||
dut.qsfp_1_rx_error_count_1.setimmediatevalue(0)
|
||||
dut.qsfp_1_rx_error_count_2.setimmediatevalue(0)
|
||||
dut.qsfp_1_rx_error_count_3.setimmediatevalue(0)
|
||||
getattr(dut, f"qsfp_{x}_i2c_scl_i").setimmediatevalue(1)
|
||||
getattr(dut, f"qsfp_{x}_i2c_sda_i").setimmediatevalue(1)
|
||||
getattr(dut, f"qsfp_{x}_intr_n").setimmediatevalue(1)
|
||||
getattr(dut, f"qsfp_{x}_mod_prsnt_n").setimmediatevalue(0)
|
||||
|
||||
dut.qspi_dq_i.setimmediatevalue(0)
|
||||
|
||||
@ -369,43 +317,19 @@ class TB(object):
|
||||
async def init(self):
|
||||
|
||||
self.dut.ptp_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp_0_rx_rst_0.setimmediatevalue(0)
|
||||
self.dut.qsfp_0_tx_rst_0.setimmediatevalue(0)
|
||||
self.dut.qsfp_0_rx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp_0_tx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp_0_rx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp_0_tx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp_0_rx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp_0_tx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp_1_rx_rst_0.setimmediatevalue(0)
|
||||
self.dut.qsfp_1_tx_rst_0.setimmediatevalue(0)
|
||||
self.dut.qsfp_1_rx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp_1_tx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp_1_rx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp_1_tx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp_1_rx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp_1_tx_rst_3.setimmediatevalue(0)
|
||||
for x in range(2):
|
||||
for y in range(4):
|
||||
getattr(self.dut, f"qsfp_{x}_rx_rst_{y}").setimmediatevalue(0)
|
||||
getattr(self.dut, f"qsfp_{x}_tx_rst_{y}").setimmediatevalue(0)
|
||||
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
|
||||
self.dut.ptp_rst.setimmediatevalue(1)
|
||||
self.dut.qsfp_0_rx_rst_0.setimmediatevalue(1)
|
||||
self.dut.qsfp_0_tx_rst_0.setimmediatevalue(1)
|
||||
self.dut.qsfp_0_rx_rst_1.setimmediatevalue(1)
|
||||
self.dut.qsfp_0_tx_rst_1.setimmediatevalue(1)
|
||||
self.dut.qsfp_0_rx_rst_2.setimmediatevalue(1)
|
||||
self.dut.qsfp_0_tx_rst_2.setimmediatevalue(1)
|
||||
self.dut.qsfp_0_rx_rst_3.setimmediatevalue(1)
|
||||
self.dut.qsfp_0_tx_rst_3.setimmediatevalue(1)
|
||||
self.dut.qsfp_1_rx_rst_0.setimmediatevalue(1)
|
||||
self.dut.qsfp_1_tx_rst_0.setimmediatevalue(1)
|
||||
self.dut.qsfp_1_rx_rst_1.setimmediatevalue(1)
|
||||
self.dut.qsfp_1_tx_rst_1.setimmediatevalue(1)
|
||||
self.dut.qsfp_1_rx_rst_2.setimmediatevalue(1)
|
||||
self.dut.qsfp_1_tx_rst_2.setimmediatevalue(1)
|
||||
self.dut.qsfp_1_rx_rst_3.setimmediatevalue(1)
|
||||
self.dut.qsfp_1_tx_rst_3.setimmediatevalue(1)
|
||||
for x in range(2):
|
||||
for y in range(4):
|
||||
getattr(self.dut, f"qsfp_{x}_rx_rst_{y}").setimmediatevalue(1)
|
||||
getattr(self.dut, f"qsfp_{x}_tx_rst_{y}").setimmediatevalue(1)
|
||||
|
||||
await FallingEdge(self.dut.rst_250mhz)
|
||||
await Timer(100, 'ns')
|
||||
@ -414,22 +338,10 @@ class TB(object):
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
|
||||
self.dut.ptp_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp_0_rx_rst_0.setimmediatevalue(0)
|
||||
self.dut.qsfp_0_tx_rst_0.setimmediatevalue(0)
|
||||
self.dut.qsfp_0_rx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp_0_tx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp_0_rx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp_0_tx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp_0_rx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp_0_tx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp_1_rx_rst_0.setimmediatevalue(0)
|
||||
self.dut.qsfp_1_tx_rst_0.setimmediatevalue(0)
|
||||
self.dut.qsfp_1_rx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp_1_tx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp_1_rx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp_1_tx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp_1_rx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp_1_tx_rst_3.setimmediatevalue(0)
|
||||
for x in range(2):
|
||||
for y in range(4):
|
||||
getattr(self.dut, f"qsfp_{x}_rx_rst_{y}").setimmediatevalue(0)
|
||||
getattr(self.dut, f"qsfp_{x}_tx_rst_{y}").setimmediatevalue(0)
|
||||
|
||||
await self.rc.enumerate()
|
||||
|
||||
@ -438,22 +350,10 @@ class TB(object):
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
|
||||
if self.loopback_enable:
|
||||
if not self.qsfp_0_0_sink.empty():
|
||||
await self.qsfp_0_0_source.send(await self.qsfp_0_0_sink.recv())
|
||||
if not self.qsfp_0_1_sink.empty():
|
||||
await self.qsfp_0_1_source.send(await self.qsfp_0_1_sink.recv())
|
||||
if not self.qsfp_0_2_sink.empty():
|
||||
await self.qsfp_0_2_source.send(await self.qsfp_0_2_sink.recv())
|
||||
if not self.qsfp_0_3_sink.empty():
|
||||
await self.qsfp_0_3_source.send(await self.qsfp_0_3_sink.recv())
|
||||
if not self.qsfp_1_0_sink.empty():
|
||||
await self.qsfp_1_0_source.send(await self.qsfp_1_0_sink.recv())
|
||||
if not self.qsfp_1_1_sink.empty():
|
||||
await self.qsfp_1_1_source.send(await self.qsfp_1_1_sink.recv())
|
||||
if not self.qsfp_1_2_sink.empty():
|
||||
await self.qsfp_1_2_source.send(await self.qsfp_1_2_sink.recv())
|
||||
if not self.qsfp_1_3_sink.empty():
|
||||
await self.qsfp_1_3_source.send(await self.qsfp_1_3_sink.recv())
|
||||
for x in range(len(self.qsfp_sink)):
|
||||
for y in range(len(self.qsfp_sink[x])):
|
||||
if not self.qsfp_sink[x][y].empty():
|
||||
await self.qsfp_source[x][y].send(await self.qsfp_sink[x][y].recv())
|
||||
|
||||
|
||||
@cocotb.test()
|
||||
@ -484,10 +384,10 @@ async def run_test_nic(dut):
|
||||
|
||||
await tb.driver.interfaces[0].start_xmit(data, 0)
|
||||
|
||||
pkt = await tb.qsfp_0_0_sink.recv()
|
||||
pkt = await tb.qsfp_sink[0][0].recv()
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
|
||||
await tb.qsfp_0_0_source.send(pkt)
|
||||
await tb.qsfp_source[0][0].send(pkt)
|
||||
|
||||
pkt = await tb.driver.interfaces[0].recv()
|
||||
|
||||
@ -496,10 +396,10 @@ async def run_test_nic(dut):
|
||||
|
||||
# await tb.driver.interfaces[1].start_xmit(data, 0)
|
||||
|
||||
# pkt = await tb.qsfp_1_0_sink.recv()
|
||||
# pkt = await tb.qsfp_sink[1][0].recv()
|
||||
# tb.log.info("Packet: %s", pkt)
|
||||
|
||||
# await tb.qsfp_1_0_source.send(pkt)
|
||||
# await tb.qsfp_source[1][0].send(pkt)
|
||||
|
||||
# pkt = await tb.driver.interfaces[1].recv()
|
||||
|
||||
@ -519,10 +419,10 @@ async def run_test_nic(dut):
|
||||
|
||||
await tb.driver.interfaces[0].start_xmit(test_pkt2.build(), 0, 34, 6)
|
||||
|
||||
pkt = await tb.qsfp_0_0_sink.recv()
|
||||
pkt = await tb.qsfp_sink[0][0].recv()
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
|
||||
await tb.qsfp_0_0_source.send(pkt)
|
||||
await tb.qsfp_source[0][0].send(pkt)
|
||||
|
||||
pkt = await tb.driver.interfaces[0].recv()
|
||||
|
||||
|
@ -276,122 +276,40 @@ class TB(object):
|
||||
cocotb.start_soon(Clock(dut.ptp_sample_clk, 8, units="ns").start())
|
||||
|
||||
# Ethernet
|
||||
cocotb.start_soon(Clock(dut.qsfp_0_rx_clk, 3.102, units="ns").start())
|
||||
cocotb.start_soon(Clock(dut.qsfp_0_tx_clk, 3.102, units="ns").start())
|
||||
self.qsfp_mac = []
|
||||
|
||||
self.qsfp_0_mac = EthMac(
|
||||
tx_clk=dut.qsfp_0_tx_clk,
|
||||
tx_rst=dut.qsfp_0_tx_rst,
|
||||
tx_bus=AxiStreamBus.from_prefix(dut, "qsfp_0_tx_axis"),
|
||||
tx_ptp_time=dut.qsfp_0_tx_ptp_time,
|
||||
tx_ptp_ts=dut.qsfp_0_tx_ptp_ts,
|
||||
tx_ptp_ts_tag=dut.qsfp_0_tx_ptp_ts_tag,
|
||||
tx_ptp_ts_valid=dut.qsfp_0_tx_ptp_ts_valid,
|
||||
rx_clk=dut.qsfp_0_rx_clk,
|
||||
rx_rst=dut.qsfp_0_rx_rst,
|
||||
rx_bus=AxiStreamBus.from_prefix(dut, "qsfp_0_rx_axis"),
|
||||
rx_ptp_time=dut.qsfp_0_rx_ptp_time,
|
||||
ifg=12, speed=100e9
|
||||
)
|
||||
for k in range(4):
|
||||
cocotb.start_soon(Clock(getattr(dut, f"qsfp_{k}_rx_clk"), 3.102, units="ns").start())
|
||||
cocotb.start_soon(Clock(getattr(dut, f"qsfp_{k}_tx_clk"), 3.102, units="ns").start())
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp_1_rx_clk, 3.102, units="ns").start())
|
||||
cocotb.start_soon(Clock(dut.qsfp_1_tx_clk, 3.102, units="ns").start())
|
||||
mac = EthMac(
|
||||
tx_clk=getattr(dut, f"qsfp_{k}_tx_clk"),
|
||||
tx_rst=getattr(dut, f"qsfp_{k}_tx_rst"),
|
||||
tx_bus=AxiStreamBus.from_prefix(dut, f"qsfp_{k}_tx_axis"),
|
||||
tx_ptp_time=getattr(dut, f"qsfp_{k}_tx_ptp_time"),
|
||||
tx_ptp_ts=getattr(dut, f"qsfp_{k}_tx_ptp_ts"),
|
||||
tx_ptp_ts_tag=getattr(dut, f"qsfp_{k}_tx_ptp_ts_tag"),
|
||||
tx_ptp_ts_valid=getattr(dut, f"qsfp_{k}_tx_ptp_ts_valid"),
|
||||
rx_clk=getattr(dut, f"qsfp_{k}_rx_clk"),
|
||||
rx_rst=getattr(dut, f"qsfp_{k}_rx_rst"),
|
||||
rx_bus=AxiStreamBus.from_prefix(dut, f"qsfp_{k}_rx_axis"),
|
||||
rx_ptp_time=getattr(dut, f"qsfp_{k}_rx_ptp_time"),
|
||||
ifg=12, speed=100e9
|
||||
)
|
||||
|
||||
self.qsfp_1_mac = EthMac(
|
||||
tx_clk=dut.qsfp_1_tx_clk,
|
||||
tx_rst=dut.qsfp_1_tx_rst,
|
||||
tx_bus=AxiStreamBus.from_prefix(dut, "qsfp_1_tx_axis"),
|
||||
tx_ptp_time=dut.qsfp_1_tx_ptp_time,
|
||||
tx_ptp_ts=dut.qsfp_1_tx_ptp_ts,
|
||||
tx_ptp_ts_tag=dut.qsfp_1_tx_ptp_ts_tag,
|
||||
tx_ptp_ts_valid=dut.qsfp_1_tx_ptp_ts_valid,
|
||||
rx_clk=dut.qsfp_1_rx_clk,
|
||||
rx_rst=dut.qsfp_1_rx_rst,
|
||||
rx_bus=AxiStreamBus.from_prefix(dut, "qsfp_1_rx_axis"),
|
||||
rx_ptp_time=dut.qsfp_1_rx_ptp_time,
|
||||
ifg=12, speed=100e9
|
||||
)
|
||||
self.qsfp_mac.append(mac)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp_2_rx_clk, 3.102, units="ns").start())
|
||||
cocotb.start_soon(Clock(dut.qsfp_2_tx_clk, 3.102, units="ns").start())
|
||||
getattr(dut, f"qsfp_{k}_rx_status").setimmediatevalue(1)
|
||||
|
||||
self.qsfp_2_mac = EthMac(
|
||||
tx_clk=dut.qsfp_2_tx_clk,
|
||||
tx_rst=dut.qsfp_2_tx_rst,
|
||||
tx_bus=AxiStreamBus.from_prefix(dut, "qsfp_2_tx_axis"),
|
||||
tx_ptp_time=dut.qsfp_2_tx_ptp_time,
|
||||
tx_ptp_ts=dut.qsfp_2_tx_ptp_ts,
|
||||
tx_ptp_ts_tag=dut.qsfp_2_tx_ptp_ts_tag,
|
||||
tx_ptp_ts_valid=dut.qsfp_2_tx_ptp_ts_valid,
|
||||
rx_clk=dut.qsfp_2_rx_clk,
|
||||
rx_rst=dut.qsfp_2_rx_rst,
|
||||
rx_bus=AxiStreamBus.from_prefix(dut, "qsfp_2_rx_axis"),
|
||||
rx_ptp_time=dut.qsfp_2_rx_ptp_time,
|
||||
ifg=12, speed=100e9
|
||||
)
|
||||
cocotb.start_soon(Clock(getattr(dut, f"qsfp_{k}_drp_clk"), 8, units="ns").start())
|
||||
getattr(dut, f"qsfp_{k}_drp_rst").setimmediatevalue(0)
|
||||
getattr(dut, f"qsfp_{k}_drp_do").setimmediatevalue(0)
|
||||
getattr(dut, f"qsfp_{k}_drp_rdy").setimmediatevalue(0)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp_3_rx_clk, 3.102, units="ns").start())
|
||||
cocotb.start_soon(Clock(dut.qsfp_3_tx_clk, 3.102, units="ns").start())
|
||||
|
||||
self.qsfp_3_mac = EthMac(
|
||||
tx_clk=dut.qsfp_3_tx_clk,
|
||||
tx_rst=dut.qsfp_3_tx_rst,
|
||||
tx_bus=AxiStreamBus.from_prefix(dut, "qsfp_3_tx_axis"),
|
||||
tx_ptp_time=dut.qsfp_3_tx_ptp_time,
|
||||
tx_ptp_ts=dut.qsfp_3_tx_ptp_ts,
|
||||
tx_ptp_ts_tag=dut.qsfp_3_tx_ptp_ts_tag,
|
||||
tx_ptp_ts_valid=dut.qsfp_3_tx_ptp_ts_valid,
|
||||
rx_clk=dut.qsfp_3_rx_clk,
|
||||
rx_rst=dut.qsfp_3_rx_rst,
|
||||
rx_bus=AxiStreamBus.from_prefix(dut, "qsfp_3_rx_axis"),
|
||||
rx_ptp_time=dut.qsfp_3_rx_ptp_time,
|
||||
ifg=12, speed=100e9
|
||||
)
|
||||
|
||||
dut.qsfp_0_rx_status.setimmediatevalue(1)
|
||||
dut.qsfp_1_rx_status.setimmediatevalue(1)
|
||||
dut.qsfp_2_rx_status.setimmediatevalue(1)
|
||||
dut.qsfp_3_rx_status.setimmediatevalue(1)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp_0_drp_clk, 8, units="ns").start())
|
||||
dut.qsfp_0_drp_rst.setimmediatevalue(0)
|
||||
dut.qsfp_0_drp_do.setimmediatevalue(0)
|
||||
dut.qsfp_0_drp_rdy.setimmediatevalue(0)
|
||||
|
||||
dut.qsfp_0_i2c_scl_i.setimmediatevalue(1)
|
||||
dut.qsfp_0_i2c_sda_i.setimmediatevalue(1)
|
||||
dut.qsfp_0_intr_n.setimmediatevalue(1)
|
||||
dut.qsfp_0_mod_prsnt_n.setimmediatevalue(0)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp_1_drp_clk, 8, units="ns").start())
|
||||
dut.qsfp_1_drp_rst.setimmediatevalue(0)
|
||||
dut.qsfp_1_drp_do.setimmediatevalue(0)
|
||||
dut.qsfp_1_drp_rdy.setimmediatevalue(0)
|
||||
|
||||
dut.qsfp_1_i2c_scl_i.setimmediatevalue(1)
|
||||
dut.qsfp_1_i2c_sda_i.setimmediatevalue(1)
|
||||
dut.qsfp_1_intr_n.setimmediatevalue(1)
|
||||
dut.qsfp_1_mod_prsnt_n.setimmediatevalue(0)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp_2_drp_clk, 8, units="ns").start())
|
||||
dut.qsfp_2_drp_rst.setimmediatevalue(0)
|
||||
dut.qsfp_2_drp_do.setimmediatevalue(0)
|
||||
dut.qsfp_2_drp_rdy.setimmediatevalue(0)
|
||||
|
||||
dut.qsfp_2_i2c_scl_i.setimmediatevalue(1)
|
||||
dut.qsfp_2_i2c_sda_i.setimmediatevalue(1)
|
||||
dut.qsfp_2_intr_n.setimmediatevalue(1)
|
||||
dut.qsfp_2_mod_prsnt_n.setimmediatevalue(0)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp_3_drp_clk, 8, units="ns").start())
|
||||
dut.qsfp_3_drp_rst.setimmediatevalue(0)
|
||||
dut.qsfp_3_drp_do.setimmediatevalue(0)
|
||||
dut.qsfp_3_drp_rdy.setimmediatevalue(0)
|
||||
|
||||
dut.qsfp_3_i2c_scl_i.setimmediatevalue(1)
|
||||
dut.qsfp_3_i2c_sda_i.setimmediatevalue(1)
|
||||
dut.qsfp_3_intr_n.setimmediatevalue(1)
|
||||
dut.qsfp_3_mod_prsnt_n.setimmediatevalue(0)
|
||||
getattr(dut, f"qsfp_{k}_i2c_scl_i").setimmediatevalue(1)
|
||||
getattr(dut, f"qsfp_{k}_i2c_sda_i").setimmediatevalue(1)
|
||||
getattr(dut, f"qsfp_{k}_intr_n").setimmediatevalue(1)
|
||||
getattr(dut, f"qsfp_{k}_mod_prsnt_n").setimmediatevalue(0)
|
||||
|
||||
dut.pps_in.setimmediatevalue(0)
|
||||
|
||||
@ -401,27 +319,17 @@ class TB(object):
|
||||
async def init(self):
|
||||
|
||||
self.dut.ptp_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp_0_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp_0_tx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp_1_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp_1_tx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp_2_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp_2_tx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp_3_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp_3_tx_rst.setimmediatevalue(0)
|
||||
for k in range(4):
|
||||
getattr(self.dut, f"qsfp_{k}_rx_rst").setimmediatevalue(0)
|
||||
getattr(self.dut, f"qsfp_{k}_tx_rst").setimmediatevalue(0)
|
||||
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
|
||||
self.dut.ptp_rst.setimmediatevalue(1)
|
||||
self.dut.qsfp_0_rx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfp_0_tx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfp_1_rx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfp_1_tx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfp_2_rx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfp_2_tx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfp_3_rx_rst.setimmediatevalue(1)
|
||||
self.dut.qsfp_3_tx_rst.setimmediatevalue(1)
|
||||
for k in range(4):
|
||||
getattr(self.dut, f"qsfp_{k}_rx_rst").setimmediatevalue(1)
|
||||
getattr(self.dut, f"qsfp_{k}_tx_rst").setimmediatevalue(1)
|
||||
|
||||
await FallingEdge(self.dut.rst_250mhz)
|
||||
await Timer(100, 'ns')
|
||||
@ -430,14 +338,9 @@ class TB(object):
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
|
||||
self.dut.ptp_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp_0_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp_0_tx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp_1_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp_1_tx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp_2_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp_2_tx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp_3_rx_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp_3_tx_rst.setimmediatevalue(0)
|
||||
for k in range(4):
|
||||
getattr(self.dut, f"qsfp_{k}_rx_rst").setimmediatevalue(0)
|
||||
getattr(self.dut, f"qsfp_{k}_tx_rst").setimmediatevalue(0)
|
||||
|
||||
await self.rc.enumerate()
|
||||
|
||||
@ -446,14 +349,9 @@ class TB(object):
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
|
||||
if self.loopback_enable:
|
||||
if not self.qsfp_0_mac.tx.empty():
|
||||
await self.qsfp_0_mac.rx.send(await self.qsfp_0_mac.tx.recv())
|
||||
if not self.qsfp_1_mac.tx.empty():
|
||||
await self.qsfp_1_mac.rx.send(await self.qsfp_1_mac.tx.recv())
|
||||
if not self.qsfp_2_mac.tx.empty():
|
||||
await self.qsfp_2_mac.rx.send(await self.qsfp_2_mac.tx.recv())
|
||||
if not self.qsfp_3_mac.tx.empty():
|
||||
await self.qsfp_3_mac.rx.send(await self.qsfp_3_mac.tx.recv())
|
||||
for mac in self.qsfp_mac:
|
||||
if not mac.tx.empty():
|
||||
await mac.rx.send(await mac.tx.recv())
|
||||
|
||||
|
||||
@cocotb.test()
|
||||
@ -484,10 +382,10 @@ async def run_test_nic(dut):
|
||||
|
||||
await tb.driver.interfaces[0].start_xmit(data, 0)
|
||||
|
||||
pkt = await tb.qsfp_0_mac.tx.recv()
|
||||
pkt = await tb.qsfp_mac[0].tx.recv()
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
|
||||
await tb.qsfp_0_mac.rx.send(pkt)
|
||||
await tb.qsfp_mac[0].rx.send(pkt)
|
||||
|
||||
pkt = await tb.driver.interfaces[0].recv()
|
||||
|
||||
@ -496,10 +394,10 @@ async def run_test_nic(dut):
|
||||
|
||||
# await tb.driver.interfaces[1].start_xmit(data, 0)
|
||||
|
||||
# pkt = await tb.qsfp_1_mac.tx.recv()
|
||||
# pkt = await tb.qsfp_mac[1].tx.recv()
|
||||
# tb.log.info("Packet: %s", pkt)
|
||||
|
||||
# await tb.qsfp_1_mac.rx.send(pkt)
|
||||
# await tb.qsfp_mac[1].rx.send(pkt)
|
||||
|
||||
# pkt = await tb.driver.interfaces[1].recv()
|
||||
|
||||
@ -519,10 +417,10 @@ async def run_test_nic(dut):
|
||||
|
||||
await tb.driver.interfaces[0].start_xmit(test_pkt2.build(), 0, 34, 6)
|
||||
|
||||
pkt = await tb.qsfp_0_mac.tx.recv()
|
||||
pkt = await tb.qsfp_mac[0].tx.recv()
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
|
||||
await tb.qsfp_0_mac.rx.send(pkt)
|
||||
await tb.qsfp_mac[0].rx.send(pkt)
|
||||
|
||||
pkt = await tb.driver.interfaces[0].recv()
|
||||
|
||||
|
@ -276,165 +276,33 @@ class TB(object):
|
||||
cocotb.start_soon(Clock(dut.ptp_sample_clk, 8, units="ns").start())
|
||||
|
||||
# Ethernet
|
||||
cocotb.start_soon(Clock(dut.qsfp_0_rx_clk_0, 2.56, units="ns").start())
|
||||
self.qsfp_0_0_source = XgmiiSource(dut.qsfp_0_rxd_0, dut.qsfp_0_rxc_0, dut.qsfp_0_rx_clk_0, dut.qsfp_0_rx_rst_0)
|
||||
cocotb.start_soon(Clock(dut.qsfp_0_tx_clk_0, 2.56, units="ns").start())
|
||||
self.qsfp_0_0_sink = XgmiiSink(dut.qsfp_0_txd_0, dut.qsfp_0_txc_0, dut.qsfp_0_tx_clk_0, dut.qsfp_0_tx_rst_0)
|
||||
self.qsfp_source = []
|
||||
self.qsfp_sink = []
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp_0_rx_clk_1, 2.56, units="ns").start())
|
||||
self.qsfp_0_1_source = XgmiiSource(dut.qsfp_0_rxd_1, dut.qsfp_0_rxc_1, dut.qsfp_0_rx_clk_1, dut.qsfp_0_rx_rst_1)
|
||||
cocotb.start_soon(Clock(dut.qsfp_0_tx_clk_1, 2.56, units="ns").start())
|
||||
self.qsfp_0_1_sink = XgmiiSink(dut.qsfp_0_txd_1, dut.qsfp_0_txc_1, dut.qsfp_0_tx_clk_1, dut.qsfp_0_tx_rst_1)
|
||||
for x in range(4):
|
||||
sources = []
|
||||
sinks = []
|
||||
for y in range(4):
|
||||
cocotb.start_soon(Clock(getattr(dut, f"qsfp_{x}_rx_clk_{y}"), 2.56, units="ns").start())
|
||||
source = XgmiiSource(getattr(dut, f"qsfp_{x}_rxd_{y}"), getattr(dut, f"qsfp_{x}_rxc_{y}"), getattr(dut, f"qsfp_{x}_rx_clk_{y}"), getattr(dut, f"qsfp_{x}_rx_rst_{y}"))
|
||||
sources.append(source)
|
||||
cocotb.start_soon(Clock(getattr(dut, f"qsfp_{x}_tx_clk_{y}"), 2.56, units="ns").start())
|
||||
sink = XgmiiSink(getattr(dut, f"qsfp_{x}_txd_{y}"), getattr(dut, f"qsfp_{x}_txc_{y}"), getattr(dut, f"qsfp_{x}_tx_clk_{y}"), getattr(dut, f"qsfp_{x}_tx_rst_{y}"))
|
||||
sinks.append(sink)
|
||||
getattr(dut, f"qsfp_{x}_rx_status_{y}").setimmediatevalue(1)
|
||||
getattr(dut, f"qsfp_{x}_rx_error_count_{y}").setimmediatevalue(0)
|
||||
self.qsfp_source.append(sources)
|
||||
self.qsfp_sink.append(sinks)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp_0_rx_clk_2, 2.56, units="ns").start())
|
||||
self.qsfp_0_2_source = XgmiiSource(dut.qsfp_0_rxd_2, dut.qsfp_0_rxc_2, dut.qsfp_0_rx_clk_2, dut.qsfp_0_rx_rst_2)
|
||||
cocotb.start_soon(Clock(dut.qsfp_0_tx_clk_2, 2.56, units="ns").start())
|
||||
self.qsfp_0_2_sink = XgmiiSink(dut.qsfp_0_txd_2, dut.qsfp_0_txc_2, dut.qsfp_0_tx_clk_2, dut.qsfp_0_tx_rst_2)
|
||||
cocotb.start_soon(Clock(getattr(dut, f"qsfp_{x}_drp_clk"), 8, units="ns").start())
|
||||
getattr(dut, f"qsfp_{x}_drp_rst").setimmediatevalue(0)
|
||||
getattr(dut, f"qsfp_{x}_drp_do").setimmediatevalue(0)
|
||||
getattr(dut, f"qsfp_{x}_drp_rdy").setimmediatevalue(0)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp_0_rx_clk_3, 2.56, units="ns").start())
|
||||
self.qsfp_0_3_source = XgmiiSource(dut.qsfp_0_rxd_3, dut.qsfp_0_rxc_3, dut.qsfp_0_rx_clk_3, dut.qsfp_0_rx_rst_3)
|
||||
cocotb.start_soon(Clock(dut.qsfp_0_tx_clk_3, 2.56, units="ns").start())
|
||||
self.qsfp_0_3_sink = XgmiiSink(dut.qsfp_0_txd_3, dut.qsfp_0_txc_3, dut.qsfp_0_tx_clk_3, dut.qsfp_0_tx_rst_3)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp_1_rx_clk_0, 2.56, units="ns").start())
|
||||
self.qsfp_1_0_source = XgmiiSource(dut.qsfp_1_rxd_0, dut.qsfp_1_rxc_0, dut.qsfp_1_rx_clk_0, dut.qsfp_1_rx_rst_0)
|
||||
cocotb.start_soon(Clock(dut.qsfp_1_tx_clk_0, 2.56, units="ns").start())
|
||||
self.qsfp_1_0_sink = XgmiiSink(dut.qsfp_1_txd_0, dut.qsfp_1_txc_0, dut.qsfp_1_tx_clk_0, dut.qsfp_1_tx_rst_0)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp_1_rx_clk_1, 2.56, units="ns").start())
|
||||
self.qsfp_1_1_source = XgmiiSource(dut.qsfp_1_rxd_1, dut.qsfp_1_rxc_1, dut.qsfp_1_rx_clk_1, dut.qsfp_1_rx_rst_1)
|
||||
cocotb.start_soon(Clock(dut.qsfp_1_tx_clk_1, 2.56, units="ns").start())
|
||||
self.qsfp_1_1_sink = XgmiiSink(dut.qsfp_1_txd_1, dut.qsfp_1_txc_1, dut.qsfp_1_tx_clk_1, dut.qsfp_1_tx_rst_1)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp_1_rx_clk_2, 2.56, units="ns").start())
|
||||
self.qsfp_1_2_source = XgmiiSource(dut.qsfp_1_rxd_2, dut.qsfp_1_rxc_2, dut.qsfp_1_rx_clk_2, dut.qsfp_1_rx_rst_2)
|
||||
cocotb.start_soon(Clock(dut.qsfp_1_tx_clk_2, 2.56, units="ns").start())
|
||||
self.qsfp_1_2_sink = XgmiiSink(dut.qsfp_1_txd_2, dut.qsfp_1_txc_2, dut.qsfp_1_tx_clk_2, dut.qsfp_1_tx_rst_2)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp_1_rx_clk_3, 2.56, units="ns").start())
|
||||
self.qsfp_1_3_source = XgmiiSource(dut.qsfp_1_rxd_3, dut.qsfp_1_rxc_3, dut.qsfp_1_rx_clk_3, dut.qsfp_1_rx_rst_3)
|
||||
cocotb.start_soon(Clock(dut.qsfp_1_tx_clk_3, 2.56, units="ns").start())
|
||||
self.qsfp_1_3_sink = XgmiiSink(dut.qsfp_1_txd_3, dut.qsfp_1_txc_3, dut.qsfp_1_tx_clk_3, dut.qsfp_1_tx_rst_3)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp_2_rx_clk_0, 2.56, units="ns").start())
|
||||
self.qsfp_2_0_source = XgmiiSource(dut.qsfp_2_rxd_0, dut.qsfp_2_rxc_0, dut.qsfp_2_rx_clk_0, dut.qsfp_2_rx_rst_0)
|
||||
cocotb.start_soon(Clock(dut.qsfp_2_tx_clk_0, 2.56, units="ns").start())
|
||||
self.qsfp_2_0_sink = XgmiiSink(dut.qsfp_2_txd_0, dut.qsfp_2_txc_0, dut.qsfp_2_tx_clk_0, dut.qsfp_2_tx_rst_0)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp_2_rx_clk_1, 2.56, units="ns").start())
|
||||
self.qsfp_2_1_source = XgmiiSource(dut.qsfp_2_rxd_1, dut.qsfp_2_rxc_1, dut.qsfp_2_rx_clk_1, dut.qsfp_2_rx_rst_1)
|
||||
cocotb.start_soon(Clock(dut.qsfp_2_tx_clk_1, 2.56, units="ns").start())
|
||||
self.qsfp_2_1_sink = XgmiiSink(dut.qsfp_2_txd_1, dut.qsfp_2_txc_1, dut.qsfp_2_tx_clk_1, dut.qsfp_2_tx_rst_1)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp_2_rx_clk_2, 2.56, units="ns").start())
|
||||
self.qsfp_2_2_source = XgmiiSource(dut.qsfp_2_rxd_2, dut.qsfp_2_rxc_2, dut.qsfp_2_rx_clk_2, dut.qsfp_2_rx_rst_2)
|
||||
cocotb.start_soon(Clock(dut.qsfp_2_tx_clk_2, 2.56, units="ns").start())
|
||||
self.qsfp_2_2_sink = XgmiiSink(dut.qsfp_2_txd_2, dut.qsfp_2_txc_2, dut.qsfp_2_tx_clk_2, dut.qsfp_2_tx_rst_2)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp_2_rx_clk_3, 2.56, units="ns").start())
|
||||
self.qsfp_2_3_source = XgmiiSource(dut.qsfp_2_rxd_3, dut.qsfp_2_rxc_3, dut.qsfp_2_rx_clk_3, dut.qsfp_2_rx_rst_3)
|
||||
cocotb.start_soon(Clock(dut.qsfp_2_tx_clk_3, 2.56, units="ns").start())
|
||||
self.qsfp_2_3_sink = XgmiiSink(dut.qsfp_2_txd_3, dut.qsfp_2_txc_3, dut.qsfp_2_tx_clk_3, dut.qsfp_2_tx_rst_3)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp_3_rx_clk_0, 2.56, units="ns").start())
|
||||
self.qsfp_3_0_source = XgmiiSource(dut.qsfp_3_rxd_0, dut.qsfp_3_rxc_0, dut.qsfp_3_rx_clk_0, dut.qsfp_3_rx_rst_0)
|
||||
cocotb.start_soon(Clock(dut.qsfp_3_tx_clk_0, 2.56, units="ns").start())
|
||||
self.qsfp_3_0_sink = XgmiiSink(dut.qsfp_3_txd_0, dut.qsfp_3_txc_0, dut.qsfp_3_tx_clk_0, dut.qsfp_3_tx_rst_0)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp_3_rx_clk_1, 2.56, units="ns").start())
|
||||
self.qsfp_3_1_source = XgmiiSource(dut.qsfp_3_rxd_1, dut.qsfp_3_rxc_1, dut.qsfp_3_rx_clk_1, dut.qsfp_3_rx_rst_1)
|
||||
cocotb.start_soon(Clock(dut.qsfp_3_tx_clk_1, 2.56, units="ns").start())
|
||||
self.qsfp_3_1_sink = XgmiiSink(dut.qsfp_3_txd_1, dut.qsfp_3_txc_1, dut.qsfp_3_tx_clk_1, dut.qsfp_3_tx_rst_1)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp_3_rx_clk_2, 2.56, units="ns").start())
|
||||
self.qsfp_3_2_source = XgmiiSource(dut.qsfp_3_rxd_2, dut.qsfp_3_rxc_2, dut.qsfp_3_rx_clk_2, dut.qsfp_3_rx_rst_2)
|
||||
cocotb.start_soon(Clock(dut.qsfp_3_tx_clk_2, 2.56, units="ns").start())
|
||||
self.qsfp_3_2_sink = XgmiiSink(dut.qsfp_3_txd_2, dut.qsfp_3_txc_2, dut.qsfp_3_tx_clk_2, dut.qsfp_3_tx_rst_2)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp_3_rx_clk_3, 2.56, units="ns").start())
|
||||
self.qsfp_3_3_source = XgmiiSource(dut.qsfp_3_rxd_3, dut.qsfp_3_rxc_3, dut.qsfp_3_rx_clk_3, dut.qsfp_3_rx_rst_3)
|
||||
cocotb.start_soon(Clock(dut.qsfp_3_tx_clk_3, 2.56, units="ns").start())
|
||||
self.qsfp_3_3_sink = XgmiiSink(dut.qsfp_3_txd_3, dut.qsfp_3_txc_3, dut.qsfp_3_tx_clk_3, dut.qsfp_3_tx_rst_3)
|
||||
|
||||
dut.qsfp_0_rx_status_0.setimmediatevalue(1)
|
||||
dut.qsfp_0_rx_status_1.setimmediatevalue(1)
|
||||
dut.qsfp_0_rx_status_2.setimmediatevalue(1)
|
||||
dut.qsfp_0_rx_status_3.setimmediatevalue(1)
|
||||
|
||||
dut.qsfp_1_rx_status_0.setimmediatevalue(1)
|
||||
dut.qsfp_1_rx_status_1.setimmediatevalue(1)
|
||||
dut.qsfp_1_rx_status_2.setimmediatevalue(1)
|
||||
dut.qsfp_1_rx_status_3.setimmediatevalue(1)
|
||||
|
||||
dut.qsfp_2_rx_status_0.setimmediatevalue(1)
|
||||
dut.qsfp_2_rx_status_1.setimmediatevalue(1)
|
||||
dut.qsfp_2_rx_status_2.setimmediatevalue(1)
|
||||
dut.qsfp_2_rx_status_3.setimmediatevalue(1)
|
||||
|
||||
dut.qsfp_3_rx_status_0.setimmediatevalue(1)
|
||||
dut.qsfp_3_rx_status_1.setimmediatevalue(1)
|
||||
dut.qsfp_3_rx_status_2.setimmediatevalue(1)
|
||||
dut.qsfp_3_rx_status_3.setimmediatevalue(1)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp_0_drp_clk, 8, units="ns").start())
|
||||
dut.qsfp_0_drp_rst.setimmediatevalue(0)
|
||||
dut.qsfp_0_drp_do.setimmediatevalue(0)
|
||||
dut.qsfp_0_drp_rdy.setimmediatevalue(0)
|
||||
|
||||
dut.qsfp_0_i2c_scl_i.setimmediatevalue(1)
|
||||
dut.qsfp_0_i2c_sda_i.setimmediatevalue(1)
|
||||
dut.qsfp_0_intr_n.setimmediatevalue(1)
|
||||
dut.qsfp_0_mod_prsnt_n.setimmediatevalue(0)
|
||||
|
||||
dut.qsfp_0_rx_error_count_0.setimmediatevalue(0)
|
||||
dut.qsfp_0_rx_error_count_1.setimmediatevalue(0)
|
||||
dut.qsfp_0_rx_error_count_2.setimmediatevalue(0)
|
||||
dut.qsfp_0_rx_error_count_3.setimmediatevalue(0)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp_1_drp_clk, 8, units="ns").start())
|
||||
dut.qsfp_1_drp_rst.setimmediatevalue(0)
|
||||
dut.qsfp_1_drp_do.setimmediatevalue(0)
|
||||
dut.qsfp_1_drp_rdy.setimmediatevalue(0)
|
||||
|
||||
dut.qsfp_1_i2c_scl_i.setimmediatevalue(1)
|
||||
dut.qsfp_1_i2c_sda_i.setimmediatevalue(1)
|
||||
dut.qsfp_1_intr_n.setimmediatevalue(1)
|
||||
dut.qsfp_1_mod_prsnt_n.setimmediatevalue(0)
|
||||
|
||||
dut.qsfp_1_rx_error_count_0.setimmediatevalue(0)
|
||||
dut.qsfp_1_rx_error_count_1.setimmediatevalue(0)
|
||||
dut.qsfp_1_rx_error_count_2.setimmediatevalue(0)
|
||||
dut.qsfp_1_rx_error_count_3.setimmediatevalue(0)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp_2_drp_clk, 8, units="ns").start())
|
||||
dut.qsfp_2_drp_rst.setimmediatevalue(0)
|
||||
dut.qsfp_2_drp_do.setimmediatevalue(0)
|
||||
dut.qsfp_2_drp_rdy.setimmediatevalue(0)
|
||||
|
||||
dut.qsfp_2_i2c_scl_i.setimmediatevalue(1)
|
||||
dut.qsfp_2_i2c_sda_i.setimmediatevalue(1)
|
||||
dut.qsfp_2_intr_n.setimmediatevalue(1)
|
||||
dut.qsfp_2_mod_prsnt_n.setimmediatevalue(0)
|
||||
|
||||
dut.qsfp_2_rx_error_count_0.setimmediatevalue(0)
|
||||
dut.qsfp_2_rx_error_count_1.setimmediatevalue(0)
|
||||
dut.qsfp_2_rx_error_count_2.setimmediatevalue(0)
|
||||
dut.qsfp_2_rx_error_count_3.setimmediatevalue(0)
|
||||
|
||||
cocotb.start_soon(Clock(dut.qsfp_3_drp_clk, 8, units="ns").start())
|
||||
dut.qsfp_3_drp_rst.setimmediatevalue(0)
|
||||
dut.qsfp_3_drp_do.setimmediatevalue(0)
|
||||
dut.qsfp_3_drp_rdy.setimmediatevalue(0)
|
||||
|
||||
dut.qsfp_3_i2c_scl_i.setimmediatevalue(1)
|
||||
dut.qsfp_3_i2c_sda_i.setimmediatevalue(1)
|
||||
dut.qsfp_3_intr_n.setimmediatevalue(1)
|
||||
dut.qsfp_3_mod_prsnt_n.setimmediatevalue(0)
|
||||
|
||||
dut.qsfp_3_rx_error_count_0.setimmediatevalue(0)
|
||||
dut.qsfp_3_rx_error_count_1.setimmediatevalue(0)
|
||||
dut.qsfp_3_rx_error_count_2.setimmediatevalue(0)
|
||||
dut.qsfp_3_rx_error_count_3.setimmediatevalue(0)
|
||||
getattr(dut, f"qsfp_{x}_i2c_scl_i").setimmediatevalue(1)
|
||||
getattr(dut, f"qsfp_{x}_i2c_sda_i").setimmediatevalue(1)
|
||||
getattr(dut, f"qsfp_{x}_intr_n").setimmediatevalue(1)
|
||||
getattr(dut, f"qsfp_{x}_mod_prsnt_n").setimmediatevalue(0)
|
||||
|
||||
dut.pps_in.setimmediatevalue(0)
|
||||
|
||||
@ -444,75 +312,19 @@ class TB(object):
|
||||
async def init(self):
|
||||
|
||||
self.dut.ptp_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp_0_rx_rst_0.setimmediatevalue(0)
|
||||
self.dut.qsfp_0_tx_rst_0.setimmediatevalue(0)
|
||||
self.dut.qsfp_0_rx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp_0_tx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp_0_rx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp_0_tx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp_0_rx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp_0_tx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp_1_rx_rst_0.setimmediatevalue(0)
|
||||
self.dut.qsfp_1_tx_rst_0.setimmediatevalue(0)
|
||||
self.dut.qsfp_1_rx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp_1_tx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp_1_rx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp_1_tx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp_1_rx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp_1_tx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp_2_rx_rst_0.setimmediatevalue(0)
|
||||
self.dut.qsfp_2_tx_rst_0.setimmediatevalue(0)
|
||||
self.dut.qsfp_2_rx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp_2_tx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp_2_rx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp_2_tx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp_2_rx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp_2_tx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp_3_rx_rst_0.setimmediatevalue(0)
|
||||
self.dut.qsfp_3_tx_rst_0.setimmediatevalue(0)
|
||||
self.dut.qsfp_3_rx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp_3_tx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp_3_rx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp_3_tx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp_3_rx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp_3_tx_rst_3.setimmediatevalue(0)
|
||||
for x in range(4):
|
||||
for y in range(4):
|
||||
getattr(self.dut, f"qsfp_{x}_rx_rst_{y}").setimmediatevalue(0)
|
||||
getattr(self.dut, f"qsfp_{x}_tx_rst_{y}").setimmediatevalue(0)
|
||||
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
|
||||
self.dut.ptp_rst.setimmediatevalue(1)
|
||||
self.dut.qsfp_0_rx_rst_0.setimmediatevalue(1)
|
||||
self.dut.qsfp_0_tx_rst_0.setimmediatevalue(1)
|
||||
self.dut.qsfp_0_rx_rst_1.setimmediatevalue(1)
|
||||
self.dut.qsfp_0_tx_rst_1.setimmediatevalue(1)
|
||||
self.dut.qsfp_0_rx_rst_2.setimmediatevalue(1)
|
||||
self.dut.qsfp_0_tx_rst_2.setimmediatevalue(1)
|
||||
self.dut.qsfp_0_rx_rst_3.setimmediatevalue(1)
|
||||
self.dut.qsfp_0_tx_rst_3.setimmediatevalue(1)
|
||||
self.dut.qsfp_1_rx_rst_0.setimmediatevalue(1)
|
||||
self.dut.qsfp_1_tx_rst_0.setimmediatevalue(1)
|
||||
self.dut.qsfp_1_rx_rst_1.setimmediatevalue(1)
|
||||
self.dut.qsfp_1_tx_rst_1.setimmediatevalue(1)
|
||||
self.dut.qsfp_1_rx_rst_2.setimmediatevalue(1)
|
||||
self.dut.qsfp_1_tx_rst_2.setimmediatevalue(1)
|
||||
self.dut.qsfp_1_rx_rst_3.setimmediatevalue(1)
|
||||
self.dut.qsfp_1_tx_rst_3.setimmediatevalue(1)
|
||||
self.dut.qsfp_2_rx_rst_0.setimmediatevalue(1)
|
||||
self.dut.qsfp_2_tx_rst_0.setimmediatevalue(1)
|
||||
self.dut.qsfp_2_rx_rst_1.setimmediatevalue(1)
|
||||
self.dut.qsfp_2_tx_rst_1.setimmediatevalue(1)
|
||||
self.dut.qsfp_2_rx_rst_2.setimmediatevalue(1)
|
||||
self.dut.qsfp_2_tx_rst_2.setimmediatevalue(1)
|
||||
self.dut.qsfp_2_rx_rst_3.setimmediatevalue(1)
|
||||
self.dut.qsfp_2_tx_rst_3.setimmediatevalue(1)
|
||||
self.dut.qsfp_3_rx_rst_0.setimmediatevalue(1)
|
||||
self.dut.qsfp_3_tx_rst_0.setimmediatevalue(1)
|
||||
self.dut.qsfp_3_rx_rst_1.setimmediatevalue(1)
|
||||
self.dut.qsfp_3_tx_rst_1.setimmediatevalue(1)
|
||||
self.dut.qsfp_3_rx_rst_2.setimmediatevalue(1)
|
||||
self.dut.qsfp_3_tx_rst_2.setimmediatevalue(1)
|
||||
self.dut.qsfp_3_rx_rst_3.setimmediatevalue(1)
|
||||
self.dut.qsfp_3_tx_rst_3.setimmediatevalue(1)
|
||||
for x in range(4):
|
||||
for y in range(4):
|
||||
getattr(self.dut, f"qsfp_{x}_rx_rst_{y}").setimmediatevalue(1)
|
||||
getattr(self.dut, f"qsfp_{x}_tx_rst_{y}").setimmediatevalue(1)
|
||||
|
||||
await FallingEdge(self.dut.rst_250mhz)
|
||||
await Timer(100, 'ns')
|
||||
@ -521,38 +333,10 @@ class TB(object):
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
|
||||
self.dut.ptp_rst.setimmediatevalue(0)
|
||||
self.dut.qsfp_0_rx_rst_0.setimmediatevalue(0)
|
||||
self.dut.qsfp_0_tx_rst_0.setimmediatevalue(0)
|
||||
self.dut.qsfp_0_rx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp_0_tx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp_0_rx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp_0_tx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp_0_rx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp_0_tx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp_1_rx_rst_0.setimmediatevalue(0)
|
||||
self.dut.qsfp_1_tx_rst_0.setimmediatevalue(0)
|
||||
self.dut.qsfp_1_rx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp_1_tx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp_1_rx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp_1_tx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp_1_rx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp_1_tx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp_2_rx_rst_0.setimmediatevalue(0)
|
||||
self.dut.qsfp_2_tx_rst_0.setimmediatevalue(0)
|
||||
self.dut.qsfp_2_rx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp_2_tx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp_2_rx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp_2_tx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp_2_rx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp_2_tx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp_3_rx_rst_0.setimmediatevalue(0)
|
||||
self.dut.qsfp_3_tx_rst_0.setimmediatevalue(0)
|
||||
self.dut.qsfp_3_rx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp_3_tx_rst_1.setimmediatevalue(0)
|
||||
self.dut.qsfp_3_rx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp_3_tx_rst_2.setimmediatevalue(0)
|
||||
self.dut.qsfp_3_rx_rst_3.setimmediatevalue(0)
|
||||
self.dut.qsfp_3_tx_rst_3.setimmediatevalue(0)
|
||||
for x in range(4):
|
||||
for y in range(4):
|
||||
getattr(self.dut, f"qsfp_{x}_rx_rst_{y}").setimmediatevalue(0)
|
||||
getattr(self.dut, f"qsfp_{x}_tx_rst_{y}").setimmediatevalue(0)
|
||||
|
||||
await self.rc.enumerate()
|
||||
|
||||
@ -561,38 +345,10 @@ class TB(object):
|
||||
await RisingEdge(self.dut.clk_250mhz)
|
||||
|
||||
if self.loopback_enable:
|
||||
if not self.qsfp_0_0_sink.empty():
|
||||
await self.qsfp_0_0_source.send(await self.qsfp_0_0_sink.recv())
|
||||
if not self.qsfp_0_1_sink.empty():
|
||||
await self.qsfp_0_1_source.send(await self.qsfp_0_1_sink.recv())
|
||||
if not self.qsfp_0_2_sink.empty():
|
||||
await self.qsfp_0_2_source.send(await self.qsfp_0_2_sink.recv())
|
||||
if not self.qsfp_0_3_sink.empty():
|
||||
await self.qsfp_0_3_source.send(await self.qsfp_0_3_sink.recv())
|
||||
if not self.qsfp_1_0_sink.empty():
|
||||
await self.qsfp_1_0_source.send(await self.qsfp_1_0_sink.recv())
|
||||
if not self.qsfp_1_1_sink.empty():
|
||||
await self.qsfp_1_1_source.send(await self.qsfp_1_1_sink.recv())
|
||||
if not self.qsfp_1_2_sink.empty():
|
||||
await self.qsfp_1_2_source.send(await self.qsfp_1_2_sink.recv())
|
||||
if not self.qsfp_1_3_sink.empty():
|
||||
await self.qsfp_1_3_source.send(await self.qsfp_1_3_sink.recv())
|
||||
if not self.qsfp_2_0_sink.empty():
|
||||
await self.qsfp_2_0_source.send(await self.qsfp_2_0_sink.recv())
|
||||
if not self.qsfp_2_1_sink.empty():
|
||||
await self.qsfp_2_1_source.send(await self.qsfp_2_1_sink.recv())
|
||||
if not self.qsfp_2_2_sink.empty():
|
||||
await self.qsfp_2_2_source.send(await self.qsfp_2_2_sink.recv())
|
||||
if not self.qsfp_2_3_sink.empty():
|
||||
await self.qsfp_2_3_source.send(await self.qsfp_2_3_sink.recv())
|
||||
if not self.qsfp_3_0_sink.empty():
|
||||
await self.qsfp_3_0_source.send(await self.qsfp_3_0_sink.recv())
|
||||
if not self.qsfp_3_1_sink.empty():
|
||||
await self.qsfp_3_1_source.send(await self.qsfp_3_1_sink.recv())
|
||||
if not self.qsfp_3_2_sink.empty():
|
||||
await self.qsfp_3_2_source.send(await self.qsfp_3_2_sink.recv())
|
||||
if not self.qsfp_3_3_sink.empty():
|
||||
await self.qsfp_3_3_source.send(await self.qsfp_3_3_sink.recv())
|
||||
for x in range(len(self.qsfp_sink)):
|
||||
for y in range(len(self.qsfp_sink[x])):
|
||||
if not self.qsfp_sink[x][y].empty():
|
||||
await self.qsfp_source[x][y].send(await self.qsfp_sink[x][y].recv())
|
||||
|
||||
|
||||
@cocotb.test()
|
||||
@ -623,10 +379,10 @@ async def run_test_nic(dut):
|
||||
|
||||
await tb.driver.interfaces[0].start_xmit(data, 0)
|
||||
|
||||
pkt = await tb.qsfp_0_0_sink.recv()
|
||||
pkt = await tb.qsfp_sink[0][0].recv()
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
|
||||
await tb.qsfp_0_0_source.send(pkt)
|
||||
await tb.qsfp_source[0][0].send(pkt)
|
||||
|
||||
pkt = await tb.driver.interfaces[0].recv()
|
||||
|
||||
@ -635,10 +391,10 @@ async def run_test_nic(dut):
|
||||
|
||||
# await tb.driver.interfaces[1].start_xmit(data, 0)
|
||||
|
||||
# pkt = await tb.qsfp_1_0_sink.recv()
|
||||
# pkt = await tb.qsfp_sink[1][0].recv()
|
||||
# tb.log.info("Packet: %s", pkt)
|
||||
|
||||
# await tb.qsfp_1_0_source.send(pkt)
|
||||
# await tb.qsfp_source[1][0].send(pkt)
|
||||
|
||||
# pkt = await tb.driver.interfaces[1].recv()
|
||||
|
||||
@ -658,10 +414,10 @@ async def run_test_nic(dut):
|
||||
|
||||
await tb.driver.interfaces[0].start_xmit(test_pkt2.build(), 0, 34, 6)
|
||||
|
||||
pkt = await tb.qsfp_0_0_sink.recv()
|
||||
pkt = await tb.qsfp_sink[0][0].recv()
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
|
||||
await tb.qsfp_0_0_source.send(pkt)
|
||||
await tb.qsfp_source[0][0].send(pkt)
|
||||
|
||||
pkt = await tb.driver.interfaces[0].recv()
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user