From bd6ffeab99d137332c0c97062e1dddc786b3a856 Mon Sep 17 00:00:00 2001 From: Alex Forencich Date: Tue, 7 Nov 2023 22:01:03 -0800 Subject: [PATCH] fpga/mqnic: Merge Cisco Nexus K35-S and K3P-S designs Signed-off-by: Alex Forencich --- fpga/mqnic/Nexus_K35_S/fpga/Makefile | 25 - fpga/mqnic/Nexus_K35_S/fpga/README.md | 22 - fpga/mqnic/Nexus_K35_S/fpga/app | 1 - fpga/mqnic/Nexus_K35_S/fpga/boot.xdc | 4 - fpga/mqnic/Nexus_K35_S/fpga/common/vivado.mk | 137 -- fpga/mqnic/Nexus_K35_S/fpga/lib | 1 - fpga/mqnic/Nexus_K35_S/fpga/rtl/common | 1 - fpga/mqnic/Nexus_K35_S/fpga/rtl/fpga_core.v | 1473 ----------------- fpga/mqnic/Nexus_K35_S/fpga/rtl/sync_signal.v | 62 - .../Nexus_K35_S/fpga/tb/fpga_core/Makefile | 261 --- .../Nexus_K35_S/fpga/tb/fpga_core/mqnic.py | 1 - .../fpga/tb/fpga_core/test_fpga_core.py | 777 --------- fpga/mqnic/Nexus_K3P_S/fpga_25g/Makefile | 25 - fpga/mqnic/Nexus_K3P_S/fpga_25g/README.md | 8 +- .../fpga_25g/fpga_K35}/Makefile | 4 +- .../fpga_25g/fpga_K35}/config.tcl | 3 + .../fpga_25g/fpga_K35_app_dma_bench}/Makefile | 4 +- .../fpga_K35_app_dma_bench}/config.tcl | 3 + .../fpga_25g/{fpga_10g => fpga_K3P}/Makefile | 4 +- .../fpga_25g/{fpga => fpga_K3P}/config.tcl | 0 .../fpga_25g/{fpga => fpga_K3P_10g}/Makefile | 4 +- .../{fpga_10g => fpga_K3P_10g}/config.tcl | 0 .../Makefile | 4 +- .../config.tcl | 0 .../fpga_25g/fpga_k35.xdc} | 0 .../fpga_25g/{fpga.xdc => fpga_k3p.xdc} | 0 .../fpga_25g}/ip/eth_xcvr_gth.tcl | 0 .../fpga_25g}/ip/pcie3_ultrascale_0.tcl | 0 .../Nexus_K3P_S/fpga_25g/rtl/fpga_core.v | 3 +- .../fpga_25g/rtl/fpga_k35.v} | 44 +- .../fpga_25g/rtl/{fpga.v => fpga_k3p.v} | 1 + 31 files changed, 59 insertions(+), 2813 deletions(-) delete mode 100644 fpga/mqnic/Nexus_K35_S/fpga/Makefile delete mode 100644 fpga/mqnic/Nexus_K35_S/fpga/README.md delete mode 120000 fpga/mqnic/Nexus_K35_S/fpga/app delete mode 100644 fpga/mqnic/Nexus_K35_S/fpga/boot.xdc delete mode 100644 fpga/mqnic/Nexus_K35_S/fpga/common/vivado.mk delete mode 120000 fpga/mqnic/Nexus_K35_S/fpga/lib delete mode 120000 fpga/mqnic/Nexus_K35_S/fpga/rtl/common delete mode 100644 fpga/mqnic/Nexus_K35_S/fpga/rtl/fpga_core.v delete mode 100644 fpga/mqnic/Nexus_K35_S/fpga/rtl/sync_signal.v delete mode 100644 fpga/mqnic/Nexus_K35_S/fpga/tb/fpga_core/Makefile delete mode 120000 fpga/mqnic/Nexus_K35_S/fpga/tb/fpga_core/mqnic.py delete mode 100644 fpga/mqnic/Nexus_K35_S/fpga/tb/fpga_core/test_fpga_core.py delete mode 100644 fpga/mqnic/Nexus_K3P_S/fpga_25g/Makefile rename fpga/mqnic/{Nexus_K35_S/fpga/fpga => Nexus_K3P_S/fpga_25g/fpga_K35}/Makefile (99%) rename fpga/mqnic/{Nexus_K35_S/fpga/fpga => Nexus_K3P_S/fpga_25g/fpga_K35}/config.tcl (99%) rename fpga/mqnic/{Nexus_K35_S/fpga/fpga_app_dma_bench => Nexus_K3P_S/fpga_25g/fpga_K35_app_dma_bench}/Makefile (99%) rename fpga/mqnic/{Nexus_K35_S/fpga/fpga_app_dma_bench => Nexus_K3P_S/fpga_25g/fpga_K35_app_dma_bench}/config.tcl (99%) rename fpga/mqnic/Nexus_K3P_S/fpga_25g/{fpga_10g => fpga_K3P}/Makefile (99%) rename fpga/mqnic/Nexus_K3P_S/fpga_25g/{fpga => fpga_K3P}/config.tcl (100%) rename fpga/mqnic/Nexus_K3P_S/fpga_25g/{fpga => fpga_K3P_10g}/Makefile (99%) rename fpga/mqnic/Nexus_K3P_S/fpga_25g/{fpga_10g => fpga_K3P_10g}/config.tcl (100%) rename fpga/mqnic/Nexus_K3P_S/fpga_25g/{fpga_app_dma_bench => fpga_K3P_app_dma_bench}/Makefile (99%) rename fpga/mqnic/Nexus_K3P_S/fpga_25g/{fpga_app_dma_bench => fpga_K3P_app_dma_bench}/config.tcl (100%) rename fpga/mqnic/{Nexus_K35_S/fpga/fpga.xdc => Nexus_K3P_S/fpga_25g/fpga_k35.xdc} (100%) rename fpga/mqnic/Nexus_K3P_S/fpga_25g/{fpga.xdc => fpga_k3p.xdc} (100%) rename fpga/mqnic/{Nexus_K35_S/fpga => Nexus_K3P_S/fpga_25g}/ip/eth_xcvr_gth.tcl (100%) rename fpga/mqnic/{Nexus_K35_S/fpga => Nexus_K3P_S/fpga_25g}/ip/pcie3_ultrascale_0.tcl (100%) rename fpga/mqnic/{Nexus_K35_S/fpga/rtl/fpga.v => Nexus_K3P_S/fpga_25g/rtl/fpga_k35.v} (95%) rename fpga/mqnic/Nexus_K3P_S/fpga_25g/rtl/{fpga.v => fpga_k3p.v} (99%) diff --git a/fpga/mqnic/Nexus_K35_S/fpga/Makefile b/fpga/mqnic/Nexus_K35_S/fpga/Makefile deleted file mode 100644 index f504bd06f..000000000 --- a/fpga/mqnic/Nexus_K35_S/fpga/Makefile +++ /dev/null @@ -1,25 +0,0 @@ -# Targets -TARGETS:= - -# Subdirectories -SUBDIRS = fpga -SUBDIRS_CLEAN = $(patsubst %,%.clean,$(SUBDIRS)) - -# Rules -.PHONY: all -all: $(SUBDIRS) $(TARGETS) - -.PHONY: $(SUBDIRS) -$(SUBDIRS): - cd $@ && $(MAKE) - -.PHONY: $(SUBDIRS_CLEAN) -$(SUBDIRS_CLEAN): - cd $(@:.clean=) && $(MAKE) clean - -.PHONY: clean -clean: $(SUBDIRS_CLEAN) - -rm -rf $(TARGETS) - -program: - #djtgcfg prog -d Atlys --index 0 --file fpga/fpga.bit diff --git a/fpga/mqnic/Nexus_K35_S/fpga/README.md b/fpga/mqnic/Nexus_K35_S/fpga/README.md deleted file mode 100644 index 5de4aef93..000000000 --- a/fpga/mqnic/Nexus_K35_S/fpga/README.md +++ /dev/null @@ -1,22 +0,0 @@ -# Corundum mqnic for Cisco Nexus K35-S - -## Introduction - -This design targets the Cisco Nexus K35-S FPGA board. - -* FPGA: xcku035-fbva676-2-e -* PHY: 10G BASE-R PHY IP core and internal GTH transceiver - -## Quick start - -### Build FPGA bitstream - -Run `make` in the `fpga` subdirectory to build the bitstream. Ensure that the Xilinx Vivado toolchain components are in PATH. - -### Build driver and userspace tools - -On the host system, run `make` in `modules/mqnic` to build the driver. Ensure the headers for the running kernel are installed, otherwise the driver cannot be compiled. Then, run `make` in `utils` to build the userspace tools. - -### Testing - -Run `make program` to program the board with Vivado. Then, reboot the machine to re-enumerate the PCIe bus. Finally, load the driver on the host system with `insmod mqnic.ko`. Check `dmesg` for output from driver initialization, and run `mqnic-dump -d /dev/mqnic0` to dump the internal state. diff --git a/fpga/mqnic/Nexus_K35_S/fpga/app b/fpga/mqnic/Nexus_K35_S/fpga/app deleted file mode 120000 index 4d46690fb..000000000 --- a/fpga/mqnic/Nexus_K35_S/fpga/app +++ /dev/null @@ -1 +0,0 @@ -../../../app/ \ No newline at end of file diff --git a/fpga/mqnic/Nexus_K35_S/fpga/boot.xdc b/fpga/mqnic/Nexus_K35_S/fpga/boot.xdc deleted file mode 100644 index 5fb323e94..000000000 --- a/fpga/mqnic/Nexus_K35_S/fpga/boot.xdc +++ /dev/null @@ -1,4 +0,0 @@ -# Timing constraints for FPGA boot logic - -set_property ASYNC_REG TRUE [get_cells "fpga_boot_sync_reg_0_reg fpga_boot_sync_reg_1_reg"] -set_false_path -to [get_pins "fpga_boot_sync_reg_0_reg/D"] diff --git a/fpga/mqnic/Nexus_K35_S/fpga/common/vivado.mk b/fpga/mqnic/Nexus_K35_S/fpga/common/vivado.mk deleted file mode 100644 index 1402e2382..000000000 --- a/fpga/mqnic/Nexus_K35_S/fpga/common/vivado.mk +++ /dev/null @@ -1,137 +0,0 @@ -################################################################### -# -# Xilinx Vivado FPGA Makefile -# -# Copyright (c) 2016 Alex Forencich -# -################################################################### -# -# Parameters: -# FPGA_TOP - Top module name -# FPGA_FAMILY - FPGA family (e.g. VirtexUltrascale) -# FPGA_DEVICE - FPGA device (e.g. xcvu095-ffva2104-2-e) -# SYN_FILES - space-separated list of source files -# INC_FILES - space-separated list of include files -# XDC_FILES - space-separated list of timing constraint files -# XCI_FILES - space-separated list of IP XCI files -# -# Example: -# -# FPGA_TOP = fpga -# FPGA_FAMILY = VirtexUltrascale -# FPGA_DEVICE = xcvu095-ffva2104-2-e -# SYN_FILES = rtl/fpga.v -# XDC_FILES = fpga.xdc -# XCI_FILES = ip/pcspma.xci -# include ../common/vivado.mk -# -################################################################### - -# phony targets -.PHONY: fpga vivado tmpclean clean distclean - -# prevent make from deleting intermediate files and reports -.PRECIOUS: %.xpr %.bit %.mcs %.prm -.SECONDARY: - -CONFIG ?= config.mk --include ../$(CONFIG) - -FPGA_TOP ?= fpga -PROJECT ?= $(FPGA_TOP) - -SYN_FILES_REL = $(foreach p,$(SYN_FILES),$(if $(filter /% ./%,$p),$p,../$p)) -INC_FILES_REL = $(foreach p,$(INC_FILES),$(if $(filter /% ./%,$p),$p,../$p)) -XCI_FILES_REL = $(foreach p,$(XCI_FILES),$(if $(filter /% ./%,$p),$p,../$p)) -IP_TCL_FILES_REL = $(foreach p,$(IP_TCL_FILES),$(if $(filter /% ./%,$p),$p,../$p)) -CONFIG_TCL_FILES_REL = $(foreach p,$(CONFIG_TCL_FILES),$(if $(filter /% ./%,$p),$p,../$p)) - -ifdef XDC_FILES - XDC_FILES_REL = $(foreach p,$(XDC_FILES),$(if $(filter /% ./%,$p),$p,../$p)) -else - XDC_FILES_REL = $(PROJECT).xdc -endif - -################################################################### -# Main Targets -# -# all: build everything -# clean: remove output files and project files -################################################################### - -all: fpga - -fpga: $(PROJECT).bit - -vivado: $(PROJECT).xpr - vivado $(PROJECT).xpr - -tmpclean:: - -rm -rf *.log *.jou *.cache *.gen *.hbs *.hw *.ip_user_files *.runs *.xpr *.html *.xml *.sim *.srcs *.str .Xil defines.v - -rm -rf create_project.tcl update_config.tcl run_synth.tcl run_impl.tcl generate_bit.tcl - -clean:: tmpclean - -rm -rf *.bit *.ltx program.tcl generate_mcs.tcl *.mcs *.prm flash.tcl - -rm -rf *_utilization.rpt *_utilization_hierarchical.rpt - -distclean:: clean - -rm -rf rev - -################################################################### -# Target implementations -################################################################### - -# Vivado project file -create_project.tcl: Makefile $(XCI_FILES_REL) $(IP_TCL_FILES_REL) - rm -rf defines.v - touch defines.v - for x in $(DEFS); do echo '`define' $$x >> defines.v; done - echo "create_project -force -part $(FPGA_PART) $(PROJECT)" > $@ - echo "add_files -fileset sources_1 defines.v $(SYN_FILES_REL)" >> $@ - echo "set_property top $(FPGA_TOP) [current_fileset]" >> $@ - echo "add_files -fileset constrs_1 $(XDC_FILES_REL)" >> $@ - for x in $(XCI_FILES_REL); do echo "import_ip $$x" >> $@; done - for x in $(IP_TCL_FILES_REL); do echo "source $$x" >> $@; done - for x in $(CONFIG_TCL_FILES_REL); do echo "source $$x" >> $@; done - -update_config.tcl: $(CONFIG_TCL_FILES_REL) $(SYN_FILES_REL) $(INC_FILES_REL) $(XDC_FILES_REL) - echo "open_project -quiet $(PROJECT).xpr" > $@ - for x in $(CONFIG_TCL_FILES_REL); do echo "source $$x" >> $@; done - -$(PROJECT).xpr: create_project.tcl update_config.tcl - vivado -nojournal -nolog -mode batch $(foreach x,$?,-source $x) - -# synthesis run -$(PROJECT).runs/synth_1/$(PROJECT).dcp: create_project.tcl update_config.tcl $(SYN_FILES_REL) $(INC_FILES_REL) $(XDC_FILES_REL) | $(PROJECT).xpr - echo "open_project $(PROJECT).xpr" > run_synth.tcl - echo "reset_run synth_1" >> run_synth.tcl - echo "launch_runs -jobs 4 synth_1" >> run_synth.tcl - echo "wait_on_run synth_1" >> run_synth.tcl - vivado -nojournal -nolog -mode batch -source run_synth.tcl - -# implementation run -$(PROJECT).runs/impl_1/$(PROJECT)_routed.dcp: $(PROJECT).runs/synth_1/$(PROJECT).dcp - echo "open_project $(PROJECT).xpr" > run_impl.tcl - echo "reset_run impl_1" >> run_impl.tcl - echo "launch_runs -jobs 4 impl_1" >> run_impl.tcl - echo "wait_on_run impl_1" >> run_impl.tcl - echo "open_run impl_1" >> run_impl.tcl - echo "report_utilization -file $(PROJECT)_utilization.rpt" >> run_impl.tcl - echo "report_utilization -hierarchical -file $(PROJECT)_utilization_hierarchical.rpt" >> run_impl.tcl - vivado -nojournal -nolog -mode batch -source run_impl.tcl - -# bit file -$(PROJECT).bit $(PROJECT).ltx: $(PROJECT).runs/impl_1/$(PROJECT)_routed.dcp - echo "open_project $(PROJECT).xpr" > generate_bit.tcl - echo "open_run impl_1" >> generate_bit.tcl - echo "write_bitstream -force $(PROJECT).runs/impl_1/$(PROJECT).bit" >> generate_bit.tcl - echo "write_debug_probes -force $(PROJECT).runs/impl_1/$(PROJECT).ltx" >> generate_bit.tcl - vivado -nojournal -nolog -mode batch -source generate_bit.tcl - ln -f -s $(PROJECT).runs/impl_1/$(PROJECT).bit . - if [ -e $(PROJECT).runs/impl_1/$(PROJECT).ltx ]; then ln -f -s $(PROJECT).runs/impl_1/$(PROJECT).ltx .; fi - mkdir -p rev - COUNT=100; \ - while [ -e rev/$(PROJECT)_rev$$COUNT.bit ]; \ - do COUNT=$$((COUNT+1)); done; \ - cp -pv $(PROJECT).runs/impl_1/$(PROJECT).bit rev/$(PROJECT)_rev$$COUNT.bit; \ - if [ -e $(PROJECT).runs/impl_1/$(PROJECT).ltx ]; then cp -pv $(PROJECT).runs/impl_1/$(PROJECT).ltx rev/$(PROJECT)_rev$$COUNT.ltx; fi diff --git a/fpga/mqnic/Nexus_K35_S/fpga/lib b/fpga/mqnic/Nexus_K35_S/fpga/lib deleted file mode 120000 index 9512b3d5e..000000000 --- a/fpga/mqnic/Nexus_K35_S/fpga/lib +++ /dev/null @@ -1 +0,0 @@ -../../../lib/ \ No newline at end of file diff --git a/fpga/mqnic/Nexus_K35_S/fpga/rtl/common b/fpga/mqnic/Nexus_K35_S/fpga/rtl/common deleted file mode 120000 index 449c9409c..000000000 --- a/fpga/mqnic/Nexus_K35_S/fpga/rtl/common +++ /dev/null @@ -1 +0,0 @@ -../../../../common/rtl/ \ No newline at end of file diff --git a/fpga/mqnic/Nexus_K35_S/fpga/rtl/fpga_core.v b/fpga/mqnic/Nexus_K35_S/fpga/rtl/fpga_core.v deleted file mode 100644 index dd617e276..000000000 --- a/fpga/mqnic/Nexus_K35_S/fpga/rtl/fpga_core.v +++ /dev/null @@ -1,1473 +0,0 @@ -// SPDX-License-Identifier: BSD-2-Clause-Views -/* - * Copyright (c) 2019-2023 The Regents of the University of California - */ - -// Language: Verilog 2001 - -`resetall -`timescale 1ns / 1ps -`default_nettype none - -/* - * FPGA core logic - */ -module fpga_core # -( - // FW and board IDs - parameter FPGA_ID = 32'h3823093, - parameter FW_ID = 32'h00000000, - parameter FW_VER = 32'h00_00_01_00, - parameter BOARD_ID = 32'h1ce4_0003, - parameter BOARD_VER = 32'h01_00_00_00, - parameter BUILD_DATE = 32'd602976000, - parameter GIT_HASH = 32'hdce357bf, - parameter RELEASE_INFO = 32'h00000000, - - // Structural configuration - parameter IF_COUNT = 2, - parameter PORTS_PER_IF = 1, - parameter SCHED_PER_IF = PORTS_PER_IF, - parameter PORT_MASK = 0, - - // Clock configuration - parameter CLK_PERIOD_NS_NUM = 4, - parameter CLK_PERIOD_NS_DENOM = 1, - - // PTP configuration - parameter PTP_CLK_PERIOD_NS_NUM = 1024, - parameter PTP_CLK_PERIOD_NS_DENOM = 165, - parameter PTP_TS_WIDTH = 96, - parameter PTP_CLOCK_PIPELINE = 0, - parameter PTP_CLOCK_CDC_PIPELINE = 0, - parameter PTP_PORT_CDC_PIPELINE = 0, - parameter PTP_PEROUT_ENABLE = 1, - parameter PTP_PEROUT_COUNT = 1, - parameter IF_PTP_PERIOD_NS = 6'h6, - parameter IF_PTP_PERIOD_FNS = 16'h6666, - - // Queue manager configuration - parameter EVENT_QUEUE_OP_TABLE_SIZE = 32, - parameter TX_QUEUE_OP_TABLE_SIZE = 32, - parameter RX_QUEUE_OP_TABLE_SIZE = 32, - parameter CQ_OP_TABLE_SIZE = 32, - parameter EQN_WIDTH = 5, - parameter TX_QUEUE_INDEX_WIDTH = 11, - parameter RX_QUEUE_INDEX_WIDTH = 8, - parameter CQN_WIDTH = (TX_QUEUE_INDEX_WIDTH > RX_QUEUE_INDEX_WIDTH ? TX_QUEUE_INDEX_WIDTH : RX_QUEUE_INDEX_WIDTH) + 1, - parameter EQ_PIPELINE = 3, - parameter TX_QUEUE_PIPELINE = 3+(TX_QUEUE_INDEX_WIDTH > 12 ? TX_QUEUE_INDEX_WIDTH-12 : 0), - parameter RX_QUEUE_PIPELINE = 3+(RX_QUEUE_INDEX_WIDTH > 12 ? RX_QUEUE_INDEX_WIDTH-12 : 0), - parameter CQ_PIPELINE = 3+(CQN_WIDTH > 12 ? CQN_WIDTH-12 : 0), - - // TX and RX engine configuration - parameter TX_DESC_TABLE_SIZE = 32, - parameter RX_DESC_TABLE_SIZE = 32, - parameter RX_INDIR_TBL_ADDR_WIDTH = RX_QUEUE_INDEX_WIDTH > 8 ? 8 : RX_QUEUE_INDEX_WIDTH, - - // Scheduler configuration - parameter TX_SCHEDULER_OP_TABLE_SIZE = TX_DESC_TABLE_SIZE, - parameter TX_SCHEDULER_PIPELINE = TX_QUEUE_PIPELINE, - parameter TDMA_INDEX_WIDTH = 6, - - // Interface configuration - parameter PTP_TS_ENABLE = 1, - parameter TX_CPL_FIFO_DEPTH = 32, - parameter TX_TAG_WIDTH = 16, - parameter TX_CHECKSUM_ENABLE = 1, - parameter RX_HASH_ENABLE = 1, - parameter RX_CHECKSUM_ENABLE = 1, - parameter PFC_ENABLE = 1, - parameter LFC_ENABLE = PFC_ENABLE, - parameter ENABLE_PADDING = 1, - parameter ENABLE_DIC = 1, - parameter MIN_FRAME_LENGTH = 64, - parameter TX_FIFO_DEPTH = 32768, - parameter RX_FIFO_DEPTH = 32768, - parameter MAX_TX_SIZE = 9214, - parameter MAX_RX_SIZE = 9214, - parameter TX_RAM_SIZE = 32768, - parameter RX_RAM_SIZE = 32768, - - // Application block configuration - parameter APP_ID = 32'h00000000, - parameter APP_ENABLE = 0, - parameter APP_CTRL_ENABLE = 1, - parameter APP_DMA_ENABLE = 1, - parameter APP_AXIS_DIRECT_ENABLE = 1, - parameter APP_AXIS_SYNC_ENABLE = 1, - parameter APP_AXIS_IF_ENABLE = 1, - parameter APP_STAT_ENABLE = 1, - - // DMA interface configuration - parameter DMA_IMM_ENABLE = 0, - parameter DMA_IMM_WIDTH = 32, - parameter DMA_LEN_WIDTH = 16, - parameter DMA_TAG_WIDTH = 16, - parameter RAM_ADDR_WIDTH = $clog2(TX_RAM_SIZE > RX_RAM_SIZE ? TX_RAM_SIZE : RX_RAM_SIZE), - parameter RAM_PIPELINE = 2, - - // PCIe interface configuration - parameter AXIS_PCIE_DATA_WIDTH = 256, - parameter AXIS_PCIE_KEEP_WIDTH = (AXIS_PCIE_DATA_WIDTH/32), - parameter AXIS_PCIE_RC_USER_WIDTH = 75, - parameter AXIS_PCIE_RQ_USER_WIDTH = 60, - parameter AXIS_PCIE_CQ_USER_WIDTH = 85, - parameter AXIS_PCIE_CC_USER_WIDTH = 33, - parameter RC_STRADDLE = AXIS_PCIE_DATA_WIDTH >= 256, - parameter RQ_STRADDLE = AXIS_PCIE_DATA_WIDTH >= 512, - parameter CQ_STRADDLE = AXIS_PCIE_DATA_WIDTH >= 512, - parameter CC_STRADDLE = AXIS_PCIE_DATA_WIDTH >= 512, - parameter RQ_SEQ_NUM_WIDTH = 4, - parameter PF_COUNT = 1, - parameter VF_COUNT = 0, - parameter PCIE_TAG_COUNT = 64, - - // Interrupt configuration - parameter IRQ_INDEX_WIDTH = EQN_WIDTH, - - // AXI lite interface configuration (control) - parameter AXIL_CTRL_DATA_WIDTH = 32, - parameter AXIL_CTRL_ADDR_WIDTH = 24, - - // AXI lite interface configuration (application control) - parameter AXIL_APP_CTRL_DATA_WIDTH = AXIL_CTRL_DATA_WIDTH, - parameter AXIL_APP_CTRL_ADDR_WIDTH = 24, - - // Ethernet interface configuration - parameter XGMII_DATA_WIDTH = 64, - parameter XGMII_CTRL_WIDTH = XGMII_DATA_WIDTH/8, - parameter AXIS_ETH_DATA_WIDTH = XGMII_DATA_WIDTH, - parameter AXIS_ETH_KEEP_WIDTH = AXIS_ETH_DATA_WIDTH/8, - parameter AXIS_ETH_SYNC_DATA_WIDTH = AXIS_ETH_DATA_WIDTH, - parameter AXIS_ETH_TX_USER_WIDTH = TX_TAG_WIDTH + 1, - parameter AXIS_ETH_RX_USER_WIDTH = (PTP_TS_ENABLE ? PTP_TS_WIDTH : 0) + 1, - parameter AXIS_ETH_TX_PIPELINE = 0, - parameter AXIS_ETH_TX_FIFO_PIPELINE = 2, - parameter AXIS_ETH_TX_TS_PIPELINE = 0, - parameter AXIS_ETH_RX_PIPELINE = 0, - parameter AXIS_ETH_RX_FIFO_PIPELINE = 2, - - // Statistics counter subsystem - parameter STAT_ENABLE = 1, - parameter STAT_DMA_ENABLE = 1, - parameter STAT_PCIE_ENABLE = 1, - parameter STAT_INC_WIDTH = 24, - parameter STAT_ID_WIDTH = 12 -) -( - /* - * Clock: 250 MHz - * Synchronous reset - */ - input wire clk_250mhz, - input wire rst_250mhz, - - /* - * PTP clock - */ - input wire ptp_clk, - input wire ptp_rst, - input wire ptp_sample_clk, - - /* - * GPIO - */ - output wire [1:0] sfp_1_led, - output wire [1:0] sfp_2_led, - output wire [1:0] sma_led, - - input wire sma_in, - output wire sma_out, - output wire sma_out_en, - output wire sma_term_en, - - /* - * PCIe - */ - output wire [AXIS_PCIE_DATA_WIDTH-1:0] m_axis_rq_tdata, - output wire [AXIS_PCIE_KEEP_WIDTH-1:0] m_axis_rq_tkeep, - output wire m_axis_rq_tlast, - input wire m_axis_rq_tready, - output wire [AXIS_PCIE_RQ_USER_WIDTH-1:0] m_axis_rq_tuser, - output wire m_axis_rq_tvalid, - - input wire [AXIS_PCIE_DATA_WIDTH-1:0] s_axis_rc_tdata, - input wire [AXIS_PCIE_KEEP_WIDTH-1:0] s_axis_rc_tkeep, - input wire s_axis_rc_tlast, - output wire s_axis_rc_tready, - input wire [AXIS_PCIE_RC_USER_WIDTH-1:0] s_axis_rc_tuser, - input wire s_axis_rc_tvalid, - - input wire [AXIS_PCIE_DATA_WIDTH-1:0] s_axis_cq_tdata, - input wire [AXIS_PCIE_KEEP_WIDTH-1:0] s_axis_cq_tkeep, - input wire s_axis_cq_tlast, - output wire s_axis_cq_tready, - input wire [AXIS_PCIE_CQ_USER_WIDTH-1:0] s_axis_cq_tuser, - input wire s_axis_cq_tvalid, - - output wire [AXIS_PCIE_DATA_WIDTH-1:0] m_axis_cc_tdata, - output wire [AXIS_PCIE_KEEP_WIDTH-1:0] m_axis_cc_tkeep, - output wire m_axis_cc_tlast, - input wire m_axis_cc_tready, - output wire [AXIS_PCIE_CC_USER_WIDTH-1:0] m_axis_cc_tuser, - output wire m_axis_cc_tvalid, - - input wire [RQ_SEQ_NUM_WIDTH-1:0] s_axis_rq_seq_num, - input wire s_axis_rq_seq_num_valid, - - input wire [1:0] pcie_tfc_nph_av, - input wire [1:0] pcie_tfc_npd_av, - - input wire [2:0] cfg_max_payload, - input wire [2:0] cfg_max_read_req, - input wire [3:0] cfg_rcb_status, - - output wire [18:0] cfg_mgmt_addr, - output wire cfg_mgmt_write, - output wire [31:0] cfg_mgmt_write_data, - output wire [3:0] cfg_mgmt_byte_enable, - output wire cfg_mgmt_read, - input wire [31:0] cfg_mgmt_read_data, - input wire cfg_mgmt_read_write_done, - - input wire [7:0] cfg_fc_ph, - input wire [11:0] cfg_fc_pd, - input wire [7:0] cfg_fc_nph, - input wire [11:0] cfg_fc_npd, - input wire [7:0] cfg_fc_cplh, - input wire [11:0] cfg_fc_cpld, - output wire [2:0] cfg_fc_sel, - - input wire [1:0] cfg_interrupt_msix_enable, - input wire [1:0] cfg_interrupt_msix_mask, - input wire [7:0] cfg_interrupt_msix_vf_enable, - input wire [7:0] cfg_interrupt_msix_vf_mask, - output wire [63:0] cfg_interrupt_msix_address, - output wire [31:0] cfg_interrupt_msix_data, - output wire cfg_interrupt_msix_int, - input wire cfg_interrupt_msix_sent, - input wire cfg_interrupt_msix_fail, - output wire [3:0] cfg_interrupt_msi_function_number, - - output wire status_error_cor, - output wire status_error_uncor, - - /* - * Ethernet: SFP+ - */ - input wire sfp_1_tx_clk, - input wire sfp_1_tx_rst, - output wire [XGMII_DATA_WIDTH-1:0] sfp_1_txd, - output wire [XGMII_CTRL_WIDTH-1:0] sfp_1_txc, - input wire sfp_1_rx_clk, - input wire sfp_1_rx_rst, - input wire [XGMII_DATA_WIDTH-1:0] sfp_1_rxd, - input wire [XGMII_CTRL_WIDTH-1:0] sfp_1_rxc, - input wire sfp_1_rx_status, - - input wire sfp_2_tx_clk, - input wire sfp_2_tx_rst, - output wire [XGMII_DATA_WIDTH-1:0] sfp_2_txd, - output wire [XGMII_CTRL_WIDTH-1:0] sfp_2_txc, - input wire sfp_2_rx_clk, - input wire sfp_2_rx_rst, - input wire [XGMII_DATA_WIDTH-1:0] sfp_2_rxd, - input wire [XGMII_CTRL_WIDTH-1:0] sfp_2_rxc, - input wire sfp_2_rx_status, - - input wire sfp_drp_clk, - input wire sfp_drp_rst, - output wire [23:0] sfp_drp_addr, - output wire [15:0] sfp_drp_di, - output wire sfp_drp_en, - output wire sfp_drp_we, - input wire [15:0] sfp_drp_do, - input wire sfp_drp_rdy, - - output wire sfp_1_tx_disable, - output wire sfp_2_tx_disable, - input wire sfp_1_npres, - input wire sfp_2_npres, - input wire sfp_1_los, - input wire sfp_2_los, - output wire sfp_1_rs, - output wire sfp_2_rs, - - input wire sfp_i2c_scl_i, - output wire sfp_i2c_scl_o, - output wire sfp_i2c_scl_t, - input wire sfp_1_i2c_sda_i, - output wire sfp_1_i2c_sda_o, - output wire sfp_1_i2c_sda_t, - input wire sfp_2_i2c_sda_i, - output wire sfp_2_i2c_sda_o, - output wire sfp_2_i2c_sda_t, - - input wire eeprom_i2c_scl_i, - output wire eeprom_i2c_scl_o, - output wire eeprom_i2c_scl_t, - input wire eeprom_i2c_sda_i, - output wire eeprom_i2c_sda_o, - output wire eeprom_i2c_sda_t, - - /* - * BPI Flash - */ - output wire fpga_boot, - input wire [15:0] flash_dq_i, - output wire [15:0] flash_dq_o, - output wire flash_dq_oe, - output wire [22:0] flash_addr, - output wire flash_region, - output wire flash_region_oe, - output wire flash_ce_n, - output wire flash_oe_n, - output wire flash_we_n, - output wire flash_adv_n -); - -parameter PORT_COUNT = IF_COUNT*PORTS_PER_IF; - -parameter F_COUNT = PF_COUNT+VF_COUNT; - -parameter AXIL_CTRL_STRB_WIDTH = (AXIL_CTRL_DATA_WIDTH/8); -parameter AXIL_IF_CTRL_ADDR_WIDTH = AXIL_CTRL_ADDR_WIDTH-$clog2(IF_COUNT); -parameter AXIL_CSR_ADDR_WIDTH = AXIL_IF_CTRL_ADDR_WIDTH-5-$clog2((PORTS_PER_IF+3)/8); - -localparam RB_BASE_ADDR = 16'h1000; -localparam RBB = RB_BASE_ADDR & {AXIL_CTRL_ADDR_WIDTH{1'b1}}; - -localparam RB_DRP_SFP_BASE = RB_BASE_ADDR + 16'h50; - -initial begin - if (PORT_COUNT > 2) begin - $error("Error: Max port count exceeded (instance %m)"); - $finish; - end -end - -// PTP -wire ptp_td_sd; -wire ptp_pps; -wire ptp_pps_str; -wire ptp_sync_locked; -wire [63:0] ptp_sync_ts_rel; -wire ptp_sync_ts_rel_step; -wire [95:0] ptp_sync_ts_tod; -wire ptp_sync_ts_tod_step; -wire ptp_sync_pps; -wire ptp_sync_pps_str; - -wire [PTP_PEROUT_COUNT-1:0] ptp_perout_locked; -wire [PTP_PEROUT_COUNT-1:0] ptp_perout_error; -wire [PTP_PEROUT_COUNT-1:0] ptp_perout_pulse; - -// control registers -wire [AXIL_CSR_ADDR_WIDTH-1:0] ctrl_reg_wr_addr; -wire [AXIL_CTRL_DATA_WIDTH-1:0] ctrl_reg_wr_data; -wire [AXIL_CTRL_STRB_WIDTH-1:0] ctrl_reg_wr_strb; -wire ctrl_reg_wr_en; -wire ctrl_reg_wr_wait; -wire ctrl_reg_wr_ack; -wire [AXIL_CSR_ADDR_WIDTH-1:0] ctrl_reg_rd_addr; -wire ctrl_reg_rd_en; -wire [AXIL_CTRL_DATA_WIDTH-1:0] ctrl_reg_rd_data; -wire ctrl_reg_rd_wait; -wire ctrl_reg_rd_ack; - -wire sfp_drp_reg_wr_wait; -wire sfp_drp_reg_wr_ack; -wire [AXIL_CTRL_DATA_WIDTH-1:0] sfp_drp_reg_rd_data; -wire sfp_drp_reg_rd_wait; -wire sfp_drp_reg_rd_ack; - -reg ctrl_reg_wr_ack_reg = 1'b0; -reg [AXIL_CTRL_DATA_WIDTH-1:0] ctrl_reg_rd_data_reg = {AXIL_CTRL_DATA_WIDTH{1'b0}}; -reg ctrl_reg_rd_ack_reg = 1'b0; - -wire sfp_i2c_select_scl_o; -wire sfp_i2c_select_sda_o; -wire [7:0] sfp_i2c_select; - -wire sfp_i2c_scl_i_int = sfp_i2c_scl_i & sfp_i2c_scl_o; -wire sfp_i2c_sda_i_int = (sfp_1_i2c_sda_i || !sfp_i2c_select[0]) && (sfp_2_i2c_sda_i || !sfp_i2c_select[1]) & sfp_i2c_sda_o_reg & sfp_i2c_select_sda_o; - -reg sfp_1_tx_disable_reg = 1'b0; -reg sfp_1_rs_reg = 1'b0; -reg sfp_2_tx_disable_reg = 1'b0; -reg sfp_2_rs_reg = 1'b0; - -reg sfp_i2c_scl_o_reg = 1'b1; -reg sfp_i2c_sda_o_reg = 1'b1; - -reg eeprom_i2c_scl_o_reg = 1'b1; -reg eeprom_i2c_sda_o_reg = 1'b1; - -reg fpga_boot_reg = 1'b0; - -reg [15:0] flash_dq_o_reg = 16'd0; -reg flash_dq_oe_reg = 1'b0; -reg [22:0] flash_addr_reg = 23'd0; -reg flash_region_reg = 1'b0; -reg flash_region_oe_reg = 1'b0; -reg flash_ce_n_reg = 1'b1; -reg flash_oe_n_reg = 1'b1; -reg flash_we_n_reg = 1'b1; -reg flash_adv_n_reg = 1'b1; - -assign ctrl_reg_wr_wait = sfp_drp_reg_wr_wait; -assign ctrl_reg_wr_ack = ctrl_reg_wr_ack_reg | sfp_drp_reg_wr_ack; -assign ctrl_reg_rd_data = ctrl_reg_rd_data_reg | sfp_drp_reg_rd_data; -assign ctrl_reg_rd_wait = sfp_drp_reg_rd_wait; -assign ctrl_reg_rd_ack = ctrl_reg_rd_ack_reg | sfp_drp_reg_rd_ack; - -assign sfp_1_tx_disable = !sfp_1_tx_disable_reg; -assign sfp_2_tx_disable = !sfp_2_tx_disable_reg; - -assign sfp_1_rs = sfp_1_rs_reg; -assign sfp_2_rs = sfp_2_rs_reg; - -assign sfp_i2c_scl_o = sfp_i2c_scl_o_reg & sfp_i2c_select_scl_o; -assign sfp_i2c_scl_t = sfp_i2c_scl_o; -assign sfp_1_i2c_sda_o = sfp_i2c_select[0] ? sfp_i2c_sda_o_reg & sfp_i2c_select_sda_o : 1'b1; -assign sfp_1_i2c_sda_t = sfp_1_i2c_sda_o; -assign sfp_2_i2c_sda_o = sfp_i2c_select[1] ? sfp_i2c_sda_o_reg & sfp_i2c_select_sda_o : 1'b1; -assign sfp_2_i2c_sda_t = sfp_2_i2c_sda_o; - -assign eeprom_i2c_scl_o = eeprom_i2c_scl_o_reg; -assign eeprom_i2c_scl_t = eeprom_i2c_scl_o; -assign eeprom_i2c_sda_o = eeprom_i2c_sda_o_reg; -assign eeprom_i2c_sda_t = eeprom_i2c_sda_o; - -assign fpga_boot = fpga_boot_reg; - -assign flash_dq_o = flash_dq_o_reg; -assign flash_dq_oe = flash_dq_oe_reg; -assign flash_addr = flash_addr_reg; -assign flash_region = flash_region_reg; -assign flash_region_oe = flash_region_oe_reg; -assign flash_ce_n = flash_ce_n_reg; -assign flash_oe_n = flash_oe_n_reg; -assign flash_we_n = flash_we_n_reg; -assign flash_adv_n = flash_adv_n_reg; - -i2c_single_reg #( - .FILTER_LEN(4), - .DEV_ADDR(7'h74) -) -qsfp_i2c_select_inst ( - .clk(clk_250mhz), - .rst(rst_250mhz), - - /* - * I2C interface - */ - .scl_i(sfp_i2c_scl_i_int), - .scl_o(sfp_i2c_select_scl_o), - .scl_t(), - .sda_i(sfp_i2c_sda_i_int), - .sda_o(sfp_i2c_select_sda_o), - .sda_t(), - - /* - * Data register - */ - .data_in(8'd0), - .data_latch(1'b0), - .data_out(sfp_i2c_select) -); - -always @(posedge clk_250mhz) begin - ctrl_reg_wr_ack_reg <= 1'b0; - ctrl_reg_rd_data_reg <= {AXIL_CTRL_DATA_WIDTH{1'b0}}; - ctrl_reg_rd_ack_reg <= 1'b0; - - if (ctrl_reg_wr_en && !ctrl_reg_wr_ack_reg) begin - // write operation - ctrl_reg_wr_ack_reg <= 1'b0; - case ({ctrl_reg_wr_addr >> 2, 2'b00}) - // FW ID - 8'h0C: begin - // FW ID: FPGA JTAG ID - fpga_boot_reg <= ctrl_reg_wr_data == 32'hFEE1DEAD; - end - // I2C 0 - RBB+8'h0C: begin - // I2C ctrl: control - if (ctrl_reg_wr_strb[0]) begin - sfp_i2c_scl_o_reg <= ctrl_reg_wr_data[1]; - end - if (ctrl_reg_wr_strb[1]) begin - sfp_i2c_sda_o_reg <= ctrl_reg_wr_data[9]; - end - end - // I2C 1 - RBB+8'h1C: begin - // I2C ctrl: control - if (ctrl_reg_wr_strb[0]) begin - eeprom_i2c_scl_o_reg <= ctrl_reg_wr_data[1]; - end - if (ctrl_reg_wr_strb[1]) begin - eeprom_i2c_sda_o_reg <= ctrl_reg_wr_data[9]; - end - end - // XCVR GPIO - RBB+8'h2C: begin - // XCVR GPIO: control 0123 - if (ctrl_reg_wr_strb[0]) begin - sfp_1_tx_disable_reg <= ctrl_reg_wr_data[5]; - sfp_1_rs_reg <= ctrl_reg_wr_data[6]; - end - if (ctrl_reg_wr_strb[1]) begin - sfp_2_tx_disable_reg <= ctrl_reg_wr_data[13]; - sfp_2_rs_reg <= ctrl_reg_wr_data[14]; - end - end - // BPI flash - RBB+8'h3C: begin - // BPI flash ctrl: format - fpga_boot_reg <= ctrl_reg_wr_data == 32'hFEE1DEAD; - end - RBB+8'h40: begin - // BPI flash ctrl: address - flash_addr_reg <= ctrl_reg_wr_data[22:0]; - flash_region_reg <= ctrl_reg_wr_data[23]; - end - RBB+8'h44: flash_dq_o_reg <= ctrl_reg_wr_data; // BPI flash ctrl: data - RBB+8'h48: begin - // BPI flash ctrl: control - if (ctrl_reg_wr_strb[0]) begin - flash_ce_n_reg <= ctrl_reg_wr_data[0]; - flash_oe_n_reg <= ctrl_reg_wr_data[1]; - flash_we_n_reg <= ctrl_reg_wr_data[2]; - flash_adv_n_reg <= ctrl_reg_wr_data[3]; - end - if (ctrl_reg_wr_strb[1]) begin - flash_dq_oe_reg <= ctrl_reg_wr_data[8]; - end - if (ctrl_reg_wr_strb[2]) begin - flash_region_oe_reg <= ctrl_reg_wr_data[16]; - end - end - default: ctrl_reg_wr_ack_reg <= 1'b0; - endcase - end - - if (ctrl_reg_rd_en && !ctrl_reg_rd_ack_reg) begin - // read operation - ctrl_reg_rd_ack_reg <= 1'b1; - case ({ctrl_reg_rd_addr >> 2, 2'b00}) - // I2C 0 - RBB+8'h00: ctrl_reg_rd_data_reg <= 32'h0000C110; // I2C ctrl: Type - RBB+8'h04: ctrl_reg_rd_data_reg <= 32'h00000100; // I2C ctrl: Version - RBB+8'h08: ctrl_reg_rd_data_reg <= RB_BASE_ADDR+8'h10; // I2C ctrl: Next header - RBB+8'h0C: begin - // I2C ctrl: control - ctrl_reg_rd_data_reg[0] <= sfp_i2c_scl_i_int; - ctrl_reg_rd_data_reg[1] <= sfp_i2c_scl_o_reg; - ctrl_reg_rd_data_reg[8] <= sfp_i2c_sda_i_int; - ctrl_reg_rd_data_reg[9] <= sfp_i2c_sda_o_reg; - end - // I2C 1 - RBB+8'h10: ctrl_reg_rd_data_reg <= 32'h0000C110; // I2C ctrl: Type - RBB+8'h14: ctrl_reg_rd_data_reg <= 32'h00000100; // I2C ctrl: Version - RBB+8'h18: ctrl_reg_rd_data_reg <= RB_BASE_ADDR+8'h20; // I2C ctrl: Next header - RBB+8'h1C: begin - // I2C ctrl: control - ctrl_reg_rd_data_reg[0] <= eeprom_i2c_scl_i; - ctrl_reg_rd_data_reg[1] <= eeprom_i2c_scl_o_reg; - ctrl_reg_rd_data_reg[8] <= eeprom_i2c_sda_i; - ctrl_reg_rd_data_reg[9] <= eeprom_i2c_sda_o_reg; - end - // XCVR GPIO - RBB+8'h20: ctrl_reg_rd_data_reg <= 32'h0000C101; // XCVR GPIO: Type - RBB+8'h24: ctrl_reg_rd_data_reg <= 32'h00000100; // XCVR GPIO: Version - RBB+8'h28: ctrl_reg_rd_data_reg <= RB_BASE_ADDR+8'h30; // XCVR GPIO: Next header - RBB+8'h2C: begin - // XCVR GPIO: control 0123 - ctrl_reg_rd_data_reg[0] <= !sfp_1_npres; - ctrl_reg_rd_data_reg[2] <= sfp_1_los; - ctrl_reg_rd_data_reg[5] <= sfp_1_tx_disable_reg; - ctrl_reg_rd_data_reg[6] <= sfp_1_rs_reg; - ctrl_reg_rd_data_reg[8] <= !sfp_2_npres; - ctrl_reg_rd_data_reg[10] <= sfp_2_los; - ctrl_reg_rd_data_reg[13] <= sfp_2_tx_disable_reg; - ctrl_reg_rd_data_reg[14] <= sfp_2_rs_reg; - end - // BPI flash - RBB+8'h30: ctrl_reg_rd_data_reg <= 32'h0000C121; // SPI flash ctrl: Type - RBB+8'h34: ctrl_reg_rd_data_reg <= 32'h00000200; // SPI flash ctrl: Version - RBB+8'h38: ctrl_reg_rd_data_reg <= RB_DRP_SFP_BASE; // SPI flash ctrl: Next header - RBB+8'h3C: begin - // BPI flash ctrl: format - ctrl_reg_rd_data_reg[3:0] <= 2; // configuration (two segments) - ctrl_reg_rd_data_reg[7:4] <= 1; // default segment - ctrl_reg_rd_data_reg[11:8] <= 0; // fallback segment - ctrl_reg_rd_data_reg[31:12] <= 32'h00000000 >> 12; // first segment size (even split) - end - RBB+8'h40: begin - // BPI flash ctrl: address - ctrl_reg_rd_data_reg[22:0] <= flash_addr_reg; - ctrl_reg_rd_data_reg[23] <= flash_region_reg; - end - RBB+8'h44: ctrl_reg_rd_data_reg <= flash_dq_i; // BPI flash ctrl: data - RBB+8'h48: begin - // BPI flash ctrl: control - ctrl_reg_rd_data_reg[0] <= flash_ce_n_reg; // chip enable (inverted) - ctrl_reg_rd_data_reg[1] <= flash_oe_n_reg; // output enable (inverted) - ctrl_reg_rd_data_reg[2] <= flash_we_n_reg; // write enable (inverted) - ctrl_reg_rd_data_reg[3] <= flash_adv_n_reg; // address valid (inverted) - ctrl_reg_rd_data_reg[8] <= flash_dq_oe_reg; // data output enable - ctrl_reg_rd_data_reg[16] <= flash_region_oe_reg; // region output enable (addr bit 23) - end - default: ctrl_reg_rd_ack_reg <= 1'b0; - endcase - end - - if (rst_250mhz) begin - ctrl_reg_wr_ack_reg <= 1'b0; - ctrl_reg_rd_ack_reg <= 1'b0; - - sfp_1_tx_disable_reg <= 1'b0; - sfp_1_rs_reg <= 1'b0; - sfp_2_tx_disable_reg <= 1'b0; - sfp_2_rs_reg <= 1'b0; - - sfp_i2c_scl_o_reg <= 1'b1; - sfp_i2c_sda_o_reg <= 1'b1; - - eeprom_i2c_scl_o_reg <= 1'b1; - eeprom_i2c_sda_o_reg <= 1'b1; - - fpga_boot_reg <= 1'b0; - - flash_dq_o_reg <= 16'd0; - flash_dq_oe_reg <= 1'b0; - flash_addr_reg <= 23'd0; - flash_region_reg <= 1'b0; - flash_region_oe_reg <= 1'b0; - flash_ce_n_reg <= 1'b1; - flash_oe_n_reg <= 1'b1; - flash_we_n_reg <= 1'b1; - flash_adv_n_reg <= 1'b1; - end -end - -rb_drp #( - .DRP_ADDR_WIDTH(24), - .DRP_DATA_WIDTH(16), - .DRP_INFO({8'h08, 8'h02, 8'd0, 8'd2}), - .REG_ADDR_WIDTH(AXIL_CSR_ADDR_WIDTH), - .REG_DATA_WIDTH(AXIL_CTRL_DATA_WIDTH), - .REG_STRB_WIDTH(AXIL_CTRL_STRB_WIDTH), - .RB_BASE_ADDR(RB_DRP_SFP_BASE), - .RB_NEXT_PTR(0) -) -sfp_rb_drp_inst ( - .clk(clk_250mhz), - .rst(rst_250mhz), - - /* - * Register interface - */ - .reg_wr_addr(ctrl_reg_wr_addr), - .reg_wr_data(ctrl_reg_wr_data), - .reg_wr_strb(ctrl_reg_wr_strb), - .reg_wr_en(ctrl_reg_wr_en), - .reg_wr_wait(sfp_drp_reg_wr_wait), - .reg_wr_ack(sfp_drp_reg_wr_ack), - .reg_rd_addr(ctrl_reg_rd_addr), - .reg_rd_en(ctrl_reg_rd_en), - .reg_rd_data(sfp_drp_reg_rd_data), - .reg_rd_wait(sfp_drp_reg_rd_wait), - .reg_rd_ack(sfp_drp_reg_rd_ack), - - /* - * DRP - */ - .drp_clk(sfp_drp_clk), - .drp_rst(sfp_drp_rst), - .drp_addr(sfp_drp_addr), - .drp_di(sfp_drp_di), - .drp_en(sfp_drp_en), - .drp_we(sfp_drp_we), - .drp_do(sfp_drp_do), - .drp_rdy(sfp_drp_rdy) -); - -assign sma_out = ptp_perout_pulse; -assign sma_out_en = 1'b0; -assign sma_term_en = 1'b0; - -assign sfp_1_led = 2'b00; -assign sfp_2_led = 2'b00; -assign sma_led[0] = ptp_pps_str; -assign sma_led[1] = 1'b0; - -wire [PORT_COUNT-1:0] eth_tx_clk; -wire [PORT_COUNT-1:0] eth_tx_rst; - -wire [PORT_COUNT*PTP_TS_WIDTH-1:0] eth_tx_ptp_ts_tod; -wire [PORT_COUNT-1:0] eth_tx_ptp_ts_tod_step; - -wire [PORT_COUNT*AXIS_ETH_DATA_WIDTH-1:0] axis_eth_tx_tdata; -wire [PORT_COUNT*AXIS_ETH_KEEP_WIDTH-1:0] axis_eth_tx_tkeep; -wire [PORT_COUNT-1:0] axis_eth_tx_tvalid; -wire [PORT_COUNT-1:0] axis_eth_tx_tready; -wire [PORT_COUNT-1:0] axis_eth_tx_tlast; -wire [PORT_COUNT*AXIS_ETH_TX_USER_WIDTH-1:0] axis_eth_tx_tuser; - -wire [PORT_COUNT*PTP_TS_WIDTH-1:0] axis_eth_tx_ptp_ts; -wire [PORT_COUNT*TX_TAG_WIDTH-1:0] axis_eth_tx_ptp_ts_tag; -wire [PORT_COUNT-1:0] axis_eth_tx_ptp_ts_valid; -wire [PORT_COUNT-1:0] axis_eth_tx_ptp_ts_ready; - -wire [PORT_COUNT-1:0] eth_tx_enable; -wire [PORT_COUNT-1:0] eth_tx_status; -wire [PORT_COUNT-1:0] eth_tx_lfc_en; -wire [PORT_COUNT-1:0] eth_tx_lfc_req; -wire [PORT_COUNT*8-1:0] eth_tx_pfc_en; -wire [PORT_COUNT*8-1:0] eth_tx_pfc_req; - -wire [PORT_COUNT-1:0] eth_rx_clk; -wire [PORT_COUNT-1:0] eth_rx_rst; - -wire [PORT_COUNT*PTP_TS_WIDTH-1:0] eth_rx_ptp_ts_tod; -wire [PORT_COUNT-1:0] eth_rx_ptp_ts_tod_step; - -wire [PORT_COUNT*AXIS_ETH_DATA_WIDTH-1:0] axis_eth_rx_tdata; -wire [PORT_COUNT*AXIS_ETH_KEEP_WIDTH-1:0] axis_eth_rx_tkeep; -wire [PORT_COUNT-1:0] axis_eth_rx_tvalid; -wire [PORT_COUNT-1:0] axis_eth_rx_tready; -wire [PORT_COUNT-1:0] axis_eth_rx_tlast; -wire [PORT_COUNT*AXIS_ETH_RX_USER_WIDTH-1:0] axis_eth_rx_tuser; - -wire [PORT_COUNT-1:0] eth_rx_enable; -wire [PORT_COUNT-1:0] eth_rx_status; -wire [PORT_COUNT-1:0] eth_rx_lfc_en; -wire [PORT_COUNT-1:0] eth_rx_lfc_req; -wire [PORT_COUNT-1:0] eth_rx_lfc_ack; -wire [PORT_COUNT*8-1:0] eth_rx_pfc_en; -wire [PORT_COUNT*8-1:0] eth_rx_pfc_req; -wire [PORT_COUNT*8-1:0] eth_rx_pfc_ack; - -wire [PORT_COUNT-1:0] port_xgmii_tx_clk; -wire [PORT_COUNT-1:0] port_xgmii_tx_rst; -wire [PORT_COUNT*XGMII_DATA_WIDTH-1:0] port_xgmii_txd; -wire [PORT_COUNT*XGMII_CTRL_WIDTH-1:0] port_xgmii_txc; - -wire [PORT_COUNT-1:0] port_xgmii_rx_clk; -wire [PORT_COUNT-1:0] port_xgmii_rx_rst; -wire [PORT_COUNT*XGMII_DATA_WIDTH-1:0] port_xgmii_rxd; -wire [PORT_COUNT*XGMII_CTRL_WIDTH-1:0] port_xgmii_rxc; - -mqnic_port_map_phy_xgmii #( - .PHY_COUNT(2), - .PORT_MASK(PORT_MASK), - .PORT_GROUP_SIZE(1), - - .IF_COUNT(IF_COUNT), - .PORTS_PER_IF(PORTS_PER_IF), - - .PORT_COUNT(PORT_COUNT), - - .XGMII_DATA_WIDTH(XGMII_DATA_WIDTH), - .XGMII_CTRL_WIDTH(XGMII_CTRL_WIDTH) -) -mqnic_port_map_phy_xgmii_inst ( - // towards PHY - .phy_xgmii_tx_clk({sfp_2_tx_clk, sfp_1_tx_clk}), - .phy_xgmii_tx_rst({sfp_2_tx_rst, sfp_1_tx_rst}), - .phy_xgmii_txd({sfp_2_txd, sfp_1_txd}), - .phy_xgmii_txc({sfp_2_txc, sfp_1_txc}), - .phy_tx_status(2'b11), - - .phy_xgmii_rx_clk({sfp_2_rx_clk, sfp_1_rx_clk}), - .phy_xgmii_rx_rst({sfp_2_rx_rst, sfp_1_rx_rst}), - .phy_xgmii_rxd({sfp_2_rxd, sfp_1_rxd}), - .phy_xgmii_rxc({sfp_2_rxc, sfp_1_rxc}), - .phy_rx_status({sfp_2_rx_status, sfp_1_rx_status}), - - // towards MAC - .port_xgmii_tx_clk(port_xgmii_tx_clk), - .port_xgmii_tx_rst(port_xgmii_tx_rst), - .port_xgmii_txd(port_xgmii_txd), - .port_xgmii_txc(port_xgmii_txc), - .port_tx_status(eth_tx_status), - - .port_xgmii_rx_clk(port_xgmii_rx_clk), - .port_xgmii_rx_rst(port_xgmii_rx_rst), - .port_xgmii_rxd(port_xgmii_rxd), - .port_xgmii_rxc(port_xgmii_rxc), - .port_rx_status(eth_rx_status) -); - -generate - genvar n; - - for (n = 0; n < PORT_COUNT; n = n + 1) begin : mac - - assign eth_tx_clk[n] = port_xgmii_tx_clk[n]; - assign eth_tx_rst[n] = port_xgmii_tx_rst[n]; - assign eth_rx_clk[n] = port_xgmii_rx_clk[n]; - assign eth_rx_rst[n] = port_xgmii_rx_rst[n]; - - eth_mac_10g #( - .DATA_WIDTH(AXIS_ETH_DATA_WIDTH), - .KEEP_WIDTH(AXIS_ETH_KEEP_WIDTH), - .ENABLE_PADDING(ENABLE_PADDING), - .ENABLE_DIC(ENABLE_DIC), - .MIN_FRAME_LENGTH(MIN_FRAME_LENGTH), - .PTP_PERIOD_NS(IF_PTP_PERIOD_NS), - .PTP_PERIOD_FNS(IF_PTP_PERIOD_FNS), - .TX_PTP_TS_ENABLE(PTP_TS_ENABLE), - .TX_PTP_TS_WIDTH(PTP_TS_WIDTH), - .TX_PTP_TS_CTRL_IN_TUSER(0), - .TX_PTP_TAG_ENABLE(PTP_TS_ENABLE), - .TX_PTP_TAG_WIDTH(TX_TAG_WIDTH), - .RX_PTP_TS_ENABLE(PTP_TS_ENABLE), - .RX_PTP_TS_WIDTH(PTP_TS_WIDTH), - .TX_USER_WIDTH(AXIS_ETH_TX_USER_WIDTH), - .RX_USER_WIDTH(AXIS_ETH_RX_USER_WIDTH), - .PFC_ENABLE(PFC_ENABLE), - .PAUSE_ENABLE(LFC_ENABLE) - ) - eth_mac_inst ( - .tx_clk(port_xgmii_tx_clk[n]), - .tx_rst(port_xgmii_tx_rst[n]), - .rx_clk(port_xgmii_rx_clk[n]), - .rx_rst(port_xgmii_rx_rst[n]), - - /* - * AXI input - */ - .tx_axis_tdata(axis_eth_tx_tdata[n*AXIS_ETH_DATA_WIDTH +: AXIS_ETH_DATA_WIDTH]), - .tx_axis_tkeep(axis_eth_tx_tkeep[n*AXIS_ETH_KEEP_WIDTH +: AXIS_ETH_KEEP_WIDTH]), - .tx_axis_tvalid(axis_eth_tx_tvalid[n +: 1]), - .tx_axis_tready(axis_eth_tx_tready[n +: 1]), - .tx_axis_tlast(axis_eth_tx_tlast[n +: 1]), - .tx_axis_tuser(axis_eth_tx_tuser[n*AXIS_ETH_TX_USER_WIDTH +: AXIS_ETH_TX_USER_WIDTH]), - - /* - * AXI output - */ - .rx_axis_tdata(axis_eth_rx_tdata[n*AXIS_ETH_DATA_WIDTH +: AXIS_ETH_DATA_WIDTH]), - .rx_axis_tkeep(axis_eth_rx_tkeep[n*AXIS_ETH_KEEP_WIDTH +: AXIS_ETH_KEEP_WIDTH]), - .rx_axis_tvalid(axis_eth_rx_tvalid[n +: 1]), - .rx_axis_tlast(axis_eth_rx_tlast[n +: 1]), - .rx_axis_tuser(axis_eth_rx_tuser[n*AXIS_ETH_RX_USER_WIDTH +: AXIS_ETH_RX_USER_WIDTH]), - - /* - * XGMII interface - */ - .xgmii_rxd(port_xgmii_rxd[n*XGMII_DATA_WIDTH +: XGMII_DATA_WIDTH]), - .xgmii_rxc(port_xgmii_rxc[n*XGMII_CTRL_WIDTH +: XGMII_CTRL_WIDTH]), - .xgmii_txd(port_xgmii_txd[n*XGMII_DATA_WIDTH +: XGMII_DATA_WIDTH]), - .xgmii_txc(port_xgmii_txc[n*XGMII_CTRL_WIDTH +: XGMII_CTRL_WIDTH]), - - /* - * PTP - */ - .tx_ptp_ts(eth_tx_ptp_ts_tod[n*PTP_TS_WIDTH +: PTP_TS_WIDTH]), - .rx_ptp_ts(eth_rx_ptp_ts_tod[n*PTP_TS_WIDTH +: PTP_TS_WIDTH]), - .tx_axis_ptp_ts(axis_eth_tx_ptp_ts[n*PTP_TS_WIDTH +: PTP_TS_WIDTH]), - .tx_axis_ptp_ts_tag(axis_eth_tx_ptp_ts_tag[n*TX_TAG_WIDTH +: TX_TAG_WIDTH]), - .tx_axis_ptp_ts_valid(axis_eth_tx_ptp_ts_valid[n +: 1]), - - /* - * Link-level Flow Control (LFC) (IEEE 802.3 annex 31B PAUSE) - */ - .tx_lfc_req(eth_tx_lfc_req[n +: 1]), - .tx_lfc_resend(1'b0), - .rx_lfc_en(eth_rx_lfc_en[n +: 1]), - .rx_lfc_req(eth_rx_lfc_req[n +: 1]), - .rx_lfc_ack(eth_rx_lfc_ack[n +: 1]), - - /* - * Priority Flow Control (PFC) (IEEE 802.3 annex 31D PFC) - */ - .tx_pfc_req(eth_tx_pfc_req[n*8 +: 8]), - .tx_pfc_resend(1'b0), - .rx_pfc_en(eth_rx_pfc_en[n*8 +: 8]), - .rx_pfc_req(eth_rx_pfc_req[n*8 +: 8]), - .rx_pfc_ack(eth_rx_pfc_ack[n*8 +: 8]), - - /* - * Pause interface - */ - .tx_lfc_pause_en(1'b1), - .tx_pause_req(1'b0), - .tx_pause_ack(), - - /* - * Status - */ - .tx_start_packet(), - .tx_error_underflow(), - .rx_start_packet(), - .rx_error_bad_frame(), - .rx_error_bad_fcs(), - .stat_tx_mcf(), - .stat_rx_mcf(), - .stat_tx_lfc_pkt(), - .stat_tx_lfc_xon(), - .stat_tx_lfc_xoff(), - .stat_tx_lfc_paused(), - .stat_tx_pfc_pkt(), - .stat_tx_pfc_xon(), - .stat_tx_pfc_xoff(), - .stat_tx_pfc_paused(), - .stat_rx_lfc_pkt(), - .stat_rx_lfc_xon(), - .stat_rx_lfc_xoff(), - .stat_rx_lfc_paused(), - .stat_rx_pfc_pkt(), - .stat_rx_pfc_xon(), - .stat_rx_pfc_xoff(), - .stat_rx_pfc_paused(), - - /* - * Configuration - */ - .cfg_ifg(8'd12), - .cfg_tx_enable(eth_tx_enable[n +: 1]), - .cfg_rx_enable(eth_rx_enable[n +: 1]), - .cfg_mcf_rx_eth_dst_mcast(48'h01_80_C2_00_00_01), - .cfg_mcf_rx_check_eth_dst_mcast(1'b1), - .cfg_mcf_rx_eth_dst_ucast(48'd0), - .cfg_mcf_rx_check_eth_dst_ucast(1'b0), - .cfg_mcf_rx_eth_src(48'd0), - .cfg_mcf_rx_check_eth_src(1'b0), - .cfg_mcf_rx_eth_type(16'h8808), - .cfg_mcf_rx_opcode_lfc(16'h0001), - .cfg_mcf_rx_check_opcode_lfc(eth_rx_lfc_en[n +: 1]), - .cfg_mcf_rx_opcode_pfc(16'h0101), - .cfg_mcf_rx_check_opcode_pfc(eth_rx_pfc_en[n*8 +: 8] != 0), - .cfg_mcf_rx_forward(1'b0), - .cfg_mcf_rx_enable(eth_rx_lfc_en[n +: 1] || eth_rx_pfc_en[n*8 +: 8]), - .cfg_tx_lfc_eth_dst(48'h01_80_C2_00_00_01), - .cfg_tx_lfc_eth_src(48'h80_23_31_43_54_4C), - .cfg_tx_lfc_eth_type(16'h8808), - .cfg_tx_lfc_opcode(16'h0001), - .cfg_tx_lfc_en(eth_tx_lfc_en[n +: 1]), - .cfg_tx_lfc_quanta(16'hffff), - .cfg_tx_lfc_refresh(16'h7fff), - .cfg_tx_pfc_eth_dst(48'h01_80_C2_00_00_01), - .cfg_tx_pfc_eth_src(48'h80_23_31_43_54_4C), - .cfg_tx_pfc_eth_type(16'h8808), - .cfg_tx_pfc_opcode(16'h0101), - .cfg_tx_pfc_en(eth_tx_pfc_en[n*8 +: 8] != 0), - .cfg_tx_pfc_quanta({8{16'hffff}}), - .cfg_tx_pfc_refresh({8{16'h7fff}}), - .cfg_rx_lfc_opcode(16'h0001), - .cfg_rx_lfc_en(eth_rx_lfc_en[n +: 1]), - .cfg_rx_pfc_opcode(16'h0101), - .cfg_rx_pfc_en(eth_rx_pfc_en[n*8 +: 8] != 0) - ); - - end - -endgenerate - -mqnic_core_pcie_us #( - // FW and board IDs - .FPGA_ID(FPGA_ID), - .FW_ID(FW_ID), - .FW_VER(FW_VER), - .BOARD_ID(BOARD_ID), - .BOARD_VER(BOARD_VER), - .BUILD_DATE(BUILD_DATE), - .GIT_HASH(GIT_HASH), - .RELEASE_INFO(RELEASE_INFO), - - // Structural configuration - .IF_COUNT(IF_COUNT), - .PORTS_PER_IF(PORTS_PER_IF), - .SCHED_PER_IF(SCHED_PER_IF), - - .PORT_COUNT(PORT_COUNT), - - // Clock configuration - .CLK_PERIOD_NS_NUM(CLK_PERIOD_NS_NUM), - .CLK_PERIOD_NS_DENOM(CLK_PERIOD_NS_DENOM), - - // PTP configuration - .PTP_CLK_PERIOD_NS_NUM(PTP_CLK_PERIOD_NS_NUM), - .PTP_CLK_PERIOD_NS_DENOM(PTP_CLK_PERIOD_NS_DENOM), - .PTP_TS_WIDTH(PTP_TS_WIDTH), - .PTP_CLOCK_PIPELINE(PTP_CLOCK_PIPELINE), - .PTP_CLOCK_CDC_PIPELINE(PTP_CLOCK_CDC_PIPELINE), - .PTP_SEPARATE_TX_CLOCK(0), - .PTP_SEPARATE_RX_CLOCK(0), - .PTP_PORT_CDC_PIPELINE(PTP_PORT_CDC_PIPELINE), - .PTP_PEROUT_ENABLE(PTP_PEROUT_ENABLE), - .PTP_PEROUT_COUNT(PTP_PEROUT_COUNT), - - // Queue manager configuration - .EVENT_QUEUE_OP_TABLE_SIZE(EVENT_QUEUE_OP_TABLE_SIZE), - .TX_QUEUE_OP_TABLE_SIZE(TX_QUEUE_OP_TABLE_SIZE), - .RX_QUEUE_OP_TABLE_SIZE(RX_QUEUE_OP_TABLE_SIZE), - .CQ_OP_TABLE_SIZE(CQ_OP_TABLE_SIZE), - .EQN_WIDTH(EQN_WIDTH), - .TX_QUEUE_INDEX_WIDTH(TX_QUEUE_INDEX_WIDTH), - .RX_QUEUE_INDEX_WIDTH(RX_QUEUE_INDEX_WIDTH), - .CQN_WIDTH(CQN_WIDTH), - .EQ_PIPELINE(EQ_PIPELINE), - .TX_QUEUE_PIPELINE(TX_QUEUE_PIPELINE), - .RX_QUEUE_PIPELINE(RX_QUEUE_PIPELINE), - .CQ_PIPELINE(CQ_PIPELINE), - - // TX and RX engine configuration - .TX_DESC_TABLE_SIZE(TX_DESC_TABLE_SIZE), - .RX_DESC_TABLE_SIZE(RX_DESC_TABLE_SIZE), - .RX_INDIR_TBL_ADDR_WIDTH(RX_INDIR_TBL_ADDR_WIDTH), - - // Scheduler configuration - .TX_SCHEDULER_OP_TABLE_SIZE(TX_SCHEDULER_OP_TABLE_SIZE), - .TX_SCHEDULER_PIPELINE(TX_SCHEDULER_PIPELINE), - .TDMA_INDEX_WIDTH(TDMA_INDEX_WIDTH), - - // Interface configuration - .PTP_TS_ENABLE(PTP_TS_ENABLE), - .TX_CPL_ENABLE(PTP_TS_ENABLE), - .TX_CPL_FIFO_DEPTH(TX_CPL_FIFO_DEPTH), - .TX_TAG_WIDTH(TX_TAG_WIDTH), - .TX_CHECKSUM_ENABLE(TX_CHECKSUM_ENABLE), - .RX_HASH_ENABLE(RX_HASH_ENABLE), - .RX_CHECKSUM_ENABLE(RX_CHECKSUM_ENABLE), - .PFC_ENABLE(PFC_ENABLE), - .LFC_ENABLE(LFC_ENABLE), - .MAC_CTRL_ENABLE(0), - .TX_FIFO_DEPTH(TX_FIFO_DEPTH), - .RX_FIFO_DEPTH(RX_FIFO_DEPTH), - .MAX_TX_SIZE(MAX_TX_SIZE), - .MAX_RX_SIZE(MAX_RX_SIZE), - .TX_RAM_SIZE(TX_RAM_SIZE), - .RX_RAM_SIZE(RX_RAM_SIZE), - - // RAM configuration - .DDR_ENABLE(0), - .HBM_ENABLE(0), - - // Application block configuration - .APP_ID(APP_ID), - .APP_ENABLE(APP_ENABLE), - .APP_CTRL_ENABLE(APP_CTRL_ENABLE), - .APP_DMA_ENABLE(APP_DMA_ENABLE), - .APP_AXIS_DIRECT_ENABLE(APP_AXIS_DIRECT_ENABLE), - .APP_AXIS_SYNC_ENABLE(APP_AXIS_SYNC_ENABLE), - .APP_AXIS_IF_ENABLE(APP_AXIS_IF_ENABLE), - .APP_STAT_ENABLE(APP_STAT_ENABLE), - .APP_GPIO_IN_WIDTH(32), - .APP_GPIO_OUT_WIDTH(32), - - // DMA interface configuration - .DMA_IMM_ENABLE(DMA_IMM_ENABLE), - .DMA_IMM_WIDTH(DMA_IMM_WIDTH), - .DMA_LEN_WIDTH(DMA_LEN_WIDTH), - .DMA_TAG_WIDTH(DMA_TAG_WIDTH), - .RAM_ADDR_WIDTH(RAM_ADDR_WIDTH), - .RAM_PIPELINE(RAM_PIPELINE), - - // PCIe interface configuration - .AXIS_PCIE_DATA_WIDTH(AXIS_PCIE_DATA_WIDTH), - .AXIS_PCIE_KEEP_WIDTH(AXIS_PCIE_KEEP_WIDTH), - .AXIS_PCIE_RC_USER_WIDTH(AXIS_PCIE_RC_USER_WIDTH), - .AXIS_PCIE_RQ_USER_WIDTH(AXIS_PCIE_RQ_USER_WIDTH), - .AXIS_PCIE_CQ_USER_WIDTH(AXIS_PCIE_CQ_USER_WIDTH), - .AXIS_PCIE_CC_USER_WIDTH(AXIS_PCIE_CC_USER_WIDTH), - .RC_STRADDLE(RC_STRADDLE), - .RQ_STRADDLE(RQ_STRADDLE), - .CQ_STRADDLE(CQ_STRADDLE), - .CC_STRADDLE(CC_STRADDLE), - .RQ_SEQ_NUM_WIDTH(RQ_SEQ_NUM_WIDTH), - .PF_COUNT(PF_COUNT), - .VF_COUNT(VF_COUNT), - .F_COUNT(F_COUNT), - .PCIE_TAG_COUNT(PCIE_TAG_COUNT), - - // Interrupt configuration - .IRQ_INDEX_WIDTH(IRQ_INDEX_WIDTH), - - // AXI lite interface configuration (control) - .AXIL_CTRL_DATA_WIDTH(AXIL_CTRL_DATA_WIDTH), - .AXIL_CTRL_ADDR_WIDTH(AXIL_CTRL_ADDR_WIDTH), - .AXIL_CTRL_STRB_WIDTH(AXIL_CTRL_STRB_WIDTH), - .AXIL_IF_CTRL_ADDR_WIDTH(AXIL_IF_CTRL_ADDR_WIDTH), - .AXIL_CSR_ADDR_WIDTH(AXIL_CSR_ADDR_WIDTH), - .AXIL_CSR_PASSTHROUGH_ENABLE(0), - .RB_NEXT_PTR(RB_BASE_ADDR), - - // AXI lite interface configuration (application control) - .AXIL_APP_CTRL_DATA_WIDTH(AXIL_APP_CTRL_DATA_WIDTH), - .AXIL_APP_CTRL_ADDR_WIDTH(AXIL_APP_CTRL_ADDR_WIDTH), - - // Ethernet interface configuration - .AXIS_ETH_DATA_WIDTH(AXIS_ETH_DATA_WIDTH), - .AXIS_ETH_KEEP_WIDTH(AXIS_ETH_KEEP_WIDTH), - .AXIS_ETH_SYNC_DATA_WIDTH(AXIS_ETH_SYNC_DATA_WIDTH), - .AXIS_ETH_TX_USER_WIDTH(AXIS_ETH_TX_USER_WIDTH), - .AXIS_ETH_RX_USER_WIDTH(AXIS_ETH_RX_USER_WIDTH), - .AXIS_ETH_RX_USE_READY(0), - .AXIS_ETH_TX_PIPELINE(AXIS_ETH_TX_PIPELINE), - .AXIS_ETH_TX_FIFO_PIPELINE(AXIS_ETH_TX_FIFO_PIPELINE), - .AXIS_ETH_TX_TS_PIPELINE(AXIS_ETH_TX_TS_PIPELINE), - .AXIS_ETH_RX_PIPELINE(AXIS_ETH_RX_PIPELINE), - .AXIS_ETH_RX_FIFO_PIPELINE(AXIS_ETH_RX_FIFO_PIPELINE), - - // Statistics counter subsystem - .STAT_ENABLE(STAT_ENABLE), - .STAT_DMA_ENABLE(STAT_DMA_ENABLE), - .STAT_PCIE_ENABLE(STAT_PCIE_ENABLE), - .STAT_INC_WIDTH(STAT_INC_WIDTH), - .STAT_ID_WIDTH(STAT_ID_WIDTH) -) -core_inst ( - .clk(clk_250mhz), - .rst(rst_250mhz), - - /* - * AXI input (RC) - */ - .s_axis_rc_tdata(s_axis_rc_tdata), - .s_axis_rc_tkeep(s_axis_rc_tkeep), - .s_axis_rc_tvalid(s_axis_rc_tvalid), - .s_axis_rc_tready(s_axis_rc_tready), - .s_axis_rc_tlast(s_axis_rc_tlast), - .s_axis_rc_tuser(s_axis_rc_tuser), - - /* - * AXI output (RQ) - */ - .m_axis_rq_tdata(m_axis_rq_tdata), - .m_axis_rq_tkeep(m_axis_rq_tkeep), - .m_axis_rq_tvalid(m_axis_rq_tvalid), - .m_axis_rq_tready(m_axis_rq_tready), - .m_axis_rq_tlast(m_axis_rq_tlast), - .m_axis_rq_tuser(m_axis_rq_tuser), - - /* - * AXI input (CQ) - */ - .s_axis_cq_tdata(s_axis_cq_tdata), - .s_axis_cq_tkeep(s_axis_cq_tkeep), - .s_axis_cq_tvalid(s_axis_cq_tvalid), - .s_axis_cq_tready(s_axis_cq_tready), - .s_axis_cq_tlast(s_axis_cq_tlast), - .s_axis_cq_tuser(s_axis_cq_tuser), - - /* - * AXI output (CC) - */ - .m_axis_cc_tdata(m_axis_cc_tdata), - .m_axis_cc_tkeep(m_axis_cc_tkeep), - .m_axis_cc_tvalid(m_axis_cc_tvalid), - .m_axis_cc_tready(m_axis_cc_tready), - .m_axis_cc_tlast(m_axis_cc_tlast), - .m_axis_cc_tuser(m_axis_cc_tuser), - - /* - * Transmit sequence number input - */ - .s_axis_rq_seq_num_0(s_axis_rq_seq_num), - .s_axis_rq_seq_num_valid_0(s_axis_rq_seq_num_valid), - .s_axis_rq_seq_num_1(4'd0), - .s_axis_rq_seq_num_valid_1(1'b0), - - /* - * Flow control - */ - .cfg_fc_ph(cfg_fc_ph), - .cfg_fc_pd(cfg_fc_pd), - .cfg_fc_nph(cfg_fc_nph), - .cfg_fc_npd(cfg_fc_npd), - .cfg_fc_cplh(cfg_fc_cplh), - .cfg_fc_cpld(cfg_fc_cpld), - .cfg_fc_sel(cfg_fc_sel), - - /* - * Configuration inputs - */ - .cfg_max_read_req(cfg_max_read_req), - .cfg_max_payload(cfg_max_payload), - .cfg_rcb_status(cfg_rcb_status), - - /* - * Configuration interface - */ - .cfg_mgmt_addr(cfg_mgmt_addr[9:0]), - .cfg_mgmt_function_number(cfg_mgmt_addr[17:10]), - .cfg_mgmt_write(cfg_mgmt_write), - .cfg_mgmt_write_data(cfg_mgmt_write_data), - .cfg_mgmt_byte_enable(cfg_mgmt_byte_enable), - .cfg_mgmt_read(cfg_mgmt_read), - .cfg_mgmt_read_data(cfg_mgmt_read_data), - .cfg_mgmt_read_write_done(cfg_mgmt_read_write_done), - - /* - * Interrupt interface - */ - .cfg_interrupt_msix_enable(cfg_interrupt_msix_enable), - .cfg_interrupt_msix_mask(cfg_interrupt_msix_mask), - .cfg_interrupt_msix_vf_enable(cfg_interrupt_msix_vf_enable), - .cfg_interrupt_msix_vf_mask(cfg_interrupt_msix_vf_mask), - .cfg_interrupt_msix_address(cfg_interrupt_msix_address), - .cfg_interrupt_msix_data(cfg_interrupt_msix_data), - .cfg_interrupt_msix_int(cfg_interrupt_msix_int), - .cfg_interrupt_msix_vec_pending(), - .cfg_interrupt_msix_vec_pending_status(1'b0), - .cfg_interrupt_msix_sent(cfg_interrupt_msix_sent), - .cfg_interrupt_msix_fail(cfg_interrupt_msix_fail), - .cfg_interrupt_msi_function_number(cfg_interrupt_msi_function_number), - - /* - * PCIe error outputs - */ - .status_error_cor(status_error_cor), - .status_error_uncor(status_error_uncor), - - /* - * AXI-Lite master interface (passthrough for NIC control and status) - */ - .m_axil_csr_awaddr(), - .m_axil_csr_awprot(), - .m_axil_csr_awvalid(), - .m_axil_csr_awready(1), - .m_axil_csr_wdata(), - .m_axil_csr_wstrb(), - .m_axil_csr_wvalid(), - .m_axil_csr_wready(1), - .m_axil_csr_bresp(0), - .m_axil_csr_bvalid(0), - .m_axil_csr_bready(), - .m_axil_csr_araddr(), - .m_axil_csr_arprot(), - .m_axil_csr_arvalid(), - .m_axil_csr_arready(1), - .m_axil_csr_rdata(0), - .m_axil_csr_rresp(0), - .m_axil_csr_rvalid(0), - .m_axil_csr_rready(), - - /* - * Control register interface - */ - .ctrl_reg_wr_addr(ctrl_reg_wr_addr), - .ctrl_reg_wr_data(ctrl_reg_wr_data), - .ctrl_reg_wr_strb(ctrl_reg_wr_strb), - .ctrl_reg_wr_en(ctrl_reg_wr_en), - .ctrl_reg_wr_wait(ctrl_reg_wr_wait), - .ctrl_reg_wr_ack(ctrl_reg_wr_ack), - .ctrl_reg_rd_addr(ctrl_reg_rd_addr), - .ctrl_reg_rd_en(ctrl_reg_rd_en), - .ctrl_reg_rd_data(ctrl_reg_rd_data), - .ctrl_reg_rd_wait(ctrl_reg_rd_wait), - .ctrl_reg_rd_ack(ctrl_reg_rd_ack), - - /* - * PTP clock - */ - .ptp_clk(ptp_clk), - .ptp_rst(ptp_rst), - .ptp_sample_clk(ptp_sample_clk), - .ptp_td_sd(ptp_td_sd), - .ptp_pps(ptp_pps), - .ptp_pps_str(ptp_pps_str), - .ptp_sync_locked(ptp_sync_locked), - .ptp_sync_ts_rel(ptp_sync_ts_rel), - .ptp_sync_ts_rel_step(ptp_sync_ts_rel_step), - .ptp_sync_ts_tod(ptp_sync_ts_tod), - .ptp_sync_ts_tod_step(ptp_sync_ts_tod_step), - .ptp_sync_pps(ptp_sync_pps), - .ptp_sync_pps_str(ptp_sync_pps_str), - .ptp_perout_locked(ptp_perout_locked), - .ptp_perout_error(ptp_perout_error), - .ptp_perout_pulse(ptp_perout_pulse), - - /* - * Ethernet - */ - .eth_tx_clk(eth_tx_clk), - .eth_tx_rst(eth_tx_rst), - - .eth_tx_ptp_clk(0), - .eth_tx_ptp_rst(0), - .eth_tx_ptp_ts_tod(eth_tx_ptp_ts_tod), - .eth_tx_ptp_ts_tod_step(eth_tx_ptp_ts_tod_step), - - .m_axis_eth_tx_tdata(axis_eth_tx_tdata), - .m_axis_eth_tx_tkeep(axis_eth_tx_tkeep), - .m_axis_eth_tx_tvalid(axis_eth_tx_tvalid), - .m_axis_eth_tx_tready(axis_eth_tx_tready), - .m_axis_eth_tx_tlast(axis_eth_tx_tlast), - .m_axis_eth_tx_tuser(axis_eth_tx_tuser), - - .s_axis_eth_tx_cpl_ts(axis_eth_tx_ptp_ts), - .s_axis_eth_tx_cpl_tag(axis_eth_tx_ptp_ts_tag), - .s_axis_eth_tx_cpl_valid(axis_eth_tx_ptp_ts_valid), - .s_axis_eth_tx_cpl_ready(axis_eth_tx_ptp_ts_ready), - - .eth_tx_enable(eth_tx_enable), - .eth_tx_status(eth_tx_status), - .eth_tx_lfc_en(eth_tx_lfc_en), - .eth_tx_lfc_req(eth_tx_lfc_req), - .eth_tx_pfc_en(eth_tx_pfc_en), - .eth_tx_pfc_req(eth_tx_pfc_req), - .eth_tx_fc_quanta_clk_en(0), - - .eth_rx_clk(eth_rx_clk), - .eth_rx_rst(eth_rx_rst), - - .eth_rx_ptp_clk(0), - .eth_rx_ptp_rst(0), - .eth_rx_ptp_ts_tod(eth_rx_ptp_ts_tod), - .eth_rx_ptp_ts_tod_step(eth_rx_ptp_ts_tod_step), - - .s_axis_eth_rx_tdata(axis_eth_rx_tdata), - .s_axis_eth_rx_tkeep(axis_eth_rx_tkeep), - .s_axis_eth_rx_tvalid(axis_eth_rx_tvalid), - .s_axis_eth_rx_tready(axis_eth_rx_tready), - .s_axis_eth_rx_tlast(axis_eth_rx_tlast), - .s_axis_eth_rx_tuser(axis_eth_rx_tuser), - - .eth_rx_enable(eth_rx_enable), - .eth_rx_status(eth_rx_status), - .eth_rx_lfc_en(eth_rx_lfc_en), - .eth_rx_lfc_req(eth_rx_lfc_req), - .eth_rx_lfc_ack(eth_rx_lfc_ack), - .eth_rx_pfc_en(eth_rx_pfc_en), - .eth_rx_pfc_req(eth_rx_pfc_req), - .eth_rx_pfc_ack(eth_rx_pfc_ack), - .eth_rx_fc_quanta_clk_en(0), - - /* - * DDR - */ - .ddr_clk(0), - .ddr_rst(0), - - .m_axi_ddr_awid(), - .m_axi_ddr_awaddr(), - .m_axi_ddr_awlen(), - .m_axi_ddr_awsize(), - .m_axi_ddr_awburst(), - .m_axi_ddr_awlock(), - .m_axi_ddr_awcache(), - .m_axi_ddr_awprot(), - .m_axi_ddr_awqos(), - .m_axi_ddr_awuser(), - .m_axi_ddr_awvalid(), - .m_axi_ddr_awready(0), - .m_axi_ddr_wdata(), - .m_axi_ddr_wstrb(), - .m_axi_ddr_wlast(), - .m_axi_ddr_wuser(), - .m_axi_ddr_wvalid(), - .m_axi_ddr_wready(0), - .m_axi_ddr_bid(0), - .m_axi_ddr_bresp(0), - .m_axi_ddr_buser(0), - .m_axi_ddr_bvalid(0), - .m_axi_ddr_bready(), - .m_axi_ddr_arid(), - .m_axi_ddr_araddr(), - .m_axi_ddr_arlen(), - .m_axi_ddr_arsize(), - .m_axi_ddr_arburst(), - .m_axi_ddr_arlock(), - .m_axi_ddr_arcache(), - .m_axi_ddr_arprot(), - .m_axi_ddr_arqos(), - .m_axi_ddr_aruser(), - .m_axi_ddr_arvalid(), - .m_axi_ddr_arready(0), - .m_axi_ddr_rid(0), - .m_axi_ddr_rdata(0), - .m_axi_ddr_rresp(0), - .m_axi_ddr_rlast(0), - .m_axi_ddr_ruser(0), - .m_axi_ddr_rvalid(0), - .m_axi_ddr_rready(), - - .ddr_status(0), - - /* - * HBM - */ - .hbm_clk(0), - .hbm_rst(0), - - .m_axi_hbm_awid(), - .m_axi_hbm_awaddr(), - .m_axi_hbm_awlen(), - .m_axi_hbm_awsize(), - .m_axi_hbm_awburst(), - .m_axi_hbm_awlock(), - .m_axi_hbm_awcache(), - .m_axi_hbm_awprot(), - .m_axi_hbm_awqos(), - .m_axi_hbm_awuser(), - .m_axi_hbm_awvalid(), - .m_axi_hbm_awready(0), - .m_axi_hbm_wdata(), - .m_axi_hbm_wstrb(), - .m_axi_hbm_wlast(), - .m_axi_hbm_wuser(), - .m_axi_hbm_wvalid(), - .m_axi_hbm_wready(0), - .m_axi_hbm_bid(0), - .m_axi_hbm_bresp(0), - .m_axi_hbm_buser(0), - .m_axi_hbm_bvalid(0), - .m_axi_hbm_bready(), - .m_axi_hbm_arid(), - .m_axi_hbm_araddr(), - .m_axi_hbm_arlen(), - .m_axi_hbm_arsize(), - .m_axi_hbm_arburst(), - .m_axi_hbm_arlock(), - .m_axi_hbm_arcache(), - .m_axi_hbm_arprot(), - .m_axi_hbm_arqos(), - .m_axi_hbm_aruser(), - .m_axi_hbm_arvalid(), - .m_axi_hbm_arready(0), - .m_axi_hbm_rid(0), - .m_axi_hbm_rdata(0), - .m_axi_hbm_rresp(0), - .m_axi_hbm_rlast(0), - .m_axi_hbm_ruser(0), - .m_axi_hbm_rvalid(0), - .m_axi_hbm_rready(), - - .hbm_status(0), - - /* - * Statistics input - */ - .s_axis_stat_tdata(0), - .s_axis_stat_tid(0), - .s_axis_stat_tvalid(1'b0), - .s_axis_stat_tready(), - - /* - * GPIO - */ - .app_gpio_in(0), - .app_gpio_out(), - - /* - * JTAG - */ - .app_jtag_tdi(1'b0), - .app_jtag_tdo(), - .app_jtag_tms(1'b0), - .app_jtag_tck(1'b0) -); - -assign cfg_mgmt_addr[18] = 1'b0; - -endmodule - -`resetall diff --git a/fpga/mqnic/Nexus_K35_S/fpga/rtl/sync_signal.v b/fpga/mqnic/Nexus_K35_S/fpga/rtl/sync_signal.v deleted file mode 100644 index 74b855fa1..000000000 --- a/fpga/mqnic/Nexus_K35_S/fpga/rtl/sync_signal.v +++ /dev/null @@ -1,62 +0,0 @@ -/* - -Copyright (c) 2014-2018 Alex Forencich - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. - -*/ - -// Language: Verilog-2001 - -`resetall -`timescale 1 ns / 1 ps -`default_nettype none - -/* - * Synchronizes an asyncronous signal to a given clock by using a pipeline of - * two registers. - */ -module sync_signal #( - parameter WIDTH=1, // width of the input and output signals - parameter N=2 // depth of synchronizer -)( - input wire clk, - input wire [WIDTH-1:0] in, - output wire [WIDTH-1:0] out -); - -reg [WIDTH-1:0] sync_reg[N-1:0]; - -/* - * The synchronized output is the last register in the pipeline. - */ -assign out = sync_reg[N-1]; - -integer k; - -always @(posedge clk) begin - sync_reg[0] <= in; - for (k = 1; k < N; k = k + 1) begin - sync_reg[k] <= sync_reg[k-1]; - end -end - -endmodule - -`resetall diff --git a/fpga/mqnic/Nexus_K35_S/fpga/tb/fpga_core/Makefile b/fpga/mqnic/Nexus_K35_S/fpga/tb/fpga_core/Makefile deleted file mode 100644 index 259148750..000000000 --- a/fpga/mqnic/Nexus_K35_S/fpga/tb/fpga_core/Makefile +++ /dev/null @@ -1,261 +0,0 @@ -# SPDX-License-Identifier: BSD-2-Clause-Views -# Copyright (c) 2020-2023 The Regents of the University of California - -TOPLEVEL_LANG = verilog - -SIM ?= icarus -WAVES ?= 0 - -COCOTB_HDL_TIMEUNIT = 1ns -COCOTB_HDL_TIMEPRECISION = 1ps - -DUT = fpga_core -TOPLEVEL = $(DUT) -MODULE = test_$(DUT) -VERILOG_SOURCES += ../../rtl/$(DUT).v -VERILOG_SOURCES += ../../rtl/common/mqnic_core_pcie_us.v -VERILOG_SOURCES += ../../rtl/common/mqnic_core_pcie.v -VERILOG_SOURCES += ../../rtl/common/mqnic_core.v -VERILOG_SOURCES += ../../rtl/common/mqnic_interface.v -VERILOG_SOURCES += ../../rtl/common/mqnic_interface_tx.v -VERILOG_SOURCES += ../../rtl/common/mqnic_interface_rx.v -VERILOG_SOURCES += ../../rtl/common/mqnic_port.v -VERILOG_SOURCES += ../../rtl/common/mqnic_port_tx.v -VERILOG_SOURCES += ../../rtl/common/mqnic_port_rx.v -VERILOG_SOURCES += ../../rtl/common/mqnic_egress.v -VERILOG_SOURCES += ../../rtl/common/mqnic_ingress.v -VERILOG_SOURCES += ../../rtl/common/mqnic_l2_egress.v -VERILOG_SOURCES += ../../rtl/common/mqnic_l2_ingress.v -VERILOG_SOURCES += ../../rtl/common/mqnic_rx_queue_map.v -VERILOG_SOURCES += ../../rtl/common/mqnic_ptp.v -VERILOG_SOURCES += ../../rtl/common/mqnic_ptp_clock.v -VERILOG_SOURCES += ../../rtl/common/mqnic_ptp_perout.v -VERILOG_SOURCES += ../../rtl/common/mqnic_rb_clk_info.v -VERILOG_SOURCES += ../../rtl/common/mqnic_port_map_phy_xgmii.v -VERILOG_SOURCES += ../../rtl/common/cpl_write.v -VERILOG_SOURCES += ../../rtl/common/cpl_op_mux.v -VERILOG_SOURCES += ../../rtl/common/desc_fetch.v -VERILOG_SOURCES += ../../rtl/common/desc_op_mux.v -VERILOG_SOURCES += ../../rtl/common/queue_manager.v -VERILOG_SOURCES += ../../rtl/common/cpl_queue_manager.v -VERILOG_SOURCES += ../../rtl/common/tx_fifo.v -VERILOG_SOURCES += ../../rtl/common/rx_fifo.v -VERILOG_SOURCES += ../../rtl/common/tx_req_mux.v -VERILOG_SOURCES += ../../rtl/common/tx_engine.v -VERILOG_SOURCES += ../../rtl/common/rx_engine.v -VERILOG_SOURCES += ../../rtl/common/tx_checksum.v -VERILOG_SOURCES += ../../rtl/common/rx_hash.v -VERILOG_SOURCES += ../../rtl/common/rx_checksum.v -VERILOG_SOURCES += ../../rtl/common/rb_drp.v -VERILOG_SOURCES += ../../rtl/common/stats_counter.v -VERILOG_SOURCES += ../../rtl/common/stats_collect.v -VERILOG_SOURCES += ../../rtl/common/stats_pcie_if.v -VERILOG_SOURCES += ../../rtl/common/stats_pcie_tlp.v -VERILOG_SOURCES += ../../rtl/common/stats_dma_if_pcie.v -VERILOG_SOURCES += ../../rtl/common/stats_dma_latency.v -VERILOG_SOURCES += ../../rtl/common/mqnic_tx_scheduler_block_rr.v -VERILOG_SOURCES += ../../rtl/common/tx_scheduler_rr.v -VERILOG_SOURCES += ../../rtl/common/tdma_scheduler.v -VERILOG_SOURCES += ../../rtl/common/tdma_ber.v -VERILOG_SOURCES += ../../rtl/common/tdma_ber_ch.v -VERILOG_SOURCES += ../../rtl/common/i2c_single_reg.v -VERILOG_SOURCES += ../../lib/eth/rtl/eth_mac_10g.v -VERILOG_SOURCES += ../../lib/eth/rtl/axis_xgmii_rx_64.v -VERILOG_SOURCES += ../../lib/eth/rtl/axis_xgmii_tx_64.v -VERILOG_SOURCES += ../../lib/eth/rtl/mac_ctrl_rx.v -VERILOG_SOURCES += ../../lib/eth/rtl/mac_ctrl_tx.v -VERILOG_SOURCES += ../../lib/eth/rtl/mac_pause_ctrl_rx.v -VERILOG_SOURCES += ../../lib/eth/rtl/mac_pause_ctrl_tx.v -VERILOG_SOURCES += ../../lib/eth/rtl/lfsr.v -VERILOG_SOURCES += ../../lib/eth/rtl/ptp_td_phc.v -VERILOG_SOURCES += ../../lib/eth/rtl/ptp_td_leaf.v -VERILOG_SOURCES += ../../lib/eth/rtl/ptp_perout.v -VERILOG_SOURCES += ../../lib/axi/rtl/axil_interconnect.v -VERILOG_SOURCES += ../../lib/axi/rtl/axil_crossbar.v -VERILOG_SOURCES += ../../lib/axi/rtl/axil_crossbar_addr.v -VERILOG_SOURCES += ../../lib/axi/rtl/axil_crossbar_rd.v -VERILOG_SOURCES += ../../lib/axi/rtl/axil_crossbar_wr.v -VERILOG_SOURCES += ../../lib/axi/rtl/axil_reg_if.v -VERILOG_SOURCES += ../../lib/axi/rtl/axil_reg_if_rd.v -VERILOG_SOURCES += ../../lib/axi/rtl/axil_reg_if_wr.v -VERILOG_SOURCES += ../../lib/axi/rtl/axil_register_rd.v -VERILOG_SOURCES += ../../lib/axi/rtl/axil_register_wr.v -VERILOG_SOURCES += ../../lib/axi/rtl/arbiter.v -VERILOG_SOURCES += ../../lib/axi/rtl/priority_encoder.v -VERILOG_SOURCES += ../../lib/axis/rtl/axis_adapter.v -VERILOG_SOURCES += ../../lib/axis/rtl/axis_arb_mux.v -VERILOG_SOURCES += ../../lib/axis/rtl/axis_async_fifo.v -VERILOG_SOURCES += ../../lib/axis/rtl/axis_async_fifo_adapter.v -VERILOG_SOURCES += ../../lib/axis/rtl/axis_demux.v -VERILOG_SOURCES += ../../lib/axis/rtl/axis_fifo.v -VERILOG_SOURCES += ../../lib/axis/rtl/axis_fifo_adapter.v -VERILOG_SOURCES += ../../lib/axis/rtl/axis_pipeline_fifo.v -VERILOG_SOURCES += ../../lib/axis/rtl/axis_register.v -VERILOG_SOURCES += ../../lib/pcie/rtl/pcie_axil_master.v -VERILOG_SOURCES += ../../lib/pcie/rtl/pcie_tlp_demux.v -VERILOG_SOURCES += ../../lib/pcie/rtl/pcie_tlp_demux_bar.v -VERILOG_SOURCES += ../../lib/pcie/rtl/pcie_tlp_mux.v -VERILOG_SOURCES += ../../lib/pcie/rtl/pcie_tlp_fifo.v -VERILOG_SOURCES += ../../lib/pcie/rtl/pcie_tlp_fifo_raw.v -VERILOG_SOURCES += ../../lib/pcie/rtl/pcie_msix.v -VERILOG_SOURCES += ../../lib/pcie/rtl/irq_rate_limit.v -VERILOG_SOURCES += ../../lib/pcie/rtl/dma_if_pcie.v -VERILOG_SOURCES += ../../lib/pcie/rtl/dma_if_pcie_rd.v -VERILOG_SOURCES += ../../lib/pcie/rtl/dma_if_pcie_wr.v -VERILOG_SOURCES += ../../lib/pcie/rtl/dma_if_mux.v -VERILOG_SOURCES += ../../lib/pcie/rtl/dma_if_mux_rd.v -VERILOG_SOURCES += ../../lib/pcie/rtl/dma_if_mux_wr.v -VERILOG_SOURCES += ../../lib/pcie/rtl/dma_if_desc_mux.v -VERILOG_SOURCES += ../../lib/pcie/rtl/dma_ram_demux_rd.v -VERILOG_SOURCES += ../../lib/pcie/rtl/dma_ram_demux_wr.v -VERILOG_SOURCES += ../../lib/pcie/rtl/dma_psdpram.v -VERILOG_SOURCES += ../../lib/pcie/rtl/dma_client_axis_sink.v -VERILOG_SOURCES += ../../lib/pcie/rtl/dma_client_axis_source.v -VERILOG_SOURCES += ../../lib/pcie/rtl/pcie_us_if.v -VERILOG_SOURCES += ../../lib/pcie/rtl/pcie_us_if_rc.v -VERILOG_SOURCES += ../../lib/pcie/rtl/pcie_us_if_rq.v -VERILOG_SOURCES += ../../lib/pcie/rtl/pcie_us_if_cc.v -VERILOG_SOURCES += ../../lib/pcie/rtl/pcie_us_if_cq.v -VERILOG_SOURCES += ../../lib/pcie/rtl/pcie_us_cfg.v -VERILOG_SOURCES += ../../lib/pcie/rtl/pulse_merge.v - -# module parameters - -# Structural configuration -export PARAM_IF_COUNT := 2 -export PARAM_PORTS_PER_IF := 1 -export PARAM_SCHED_PER_IF := $(PARAM_PORTS_PER_IF) -export PARAM_PORT_MASK := 0 - -# Clock configuration -export PARAM_CLK_PERIOD_NS_NUM := 4 -export PARAM_CLK_PERIOD_NS_DENOM := 1 - -# PTP configuration -export PARAM_PTP_CLK_PERIOD_NS_NUM := 1024 -export PARAM_PTP_CLK_PERIOD_NS_DENOM := 165 -export PARAM_PTP_CLOCK_PIPELINE := 0 -export PARAM_PTP_CLOCK_CDC_PIPELINE := 0 -export PARAM_PTP_PORT_CDC_PIPELINE := 0 -export PARAM_PTP_PEROUT_ENABLE := 1 -export PARAM_PTP_PEROUT_COUNT := 1 - -# Queue manager configuration -export PARAM_EVENT_QUEUE_OP_TABLE_SIZE := 32 -export PARAM_TX_QUEUE_OP_TABLE_SIZE := 32 -export PARAM_RX_QUEUE_OP_TABLE_SIZE := 32 -export PARAM_CQ_OP_TABLE_SIZE := 32 -export PARAM_EQN_WIDTH := 5 -export PARAM_TX_QUEUE_INDEX_WIDTH := 11 -export PARAM_RX_QUEUE_INDEX_WIDTH := 8 -export PARAM_CQN_WIDTH := $(shell python -c "print(max($(PARAM_TX_QUEUE_INDEX_WIDTH), $(PARAM_RX_QUEUE_INDEX_WIDTH)) + 1)") -export PARAM_EQ_PIPELINE := 3 -export PARAM_TX_QUEUE_PIPELINE := $(shell python -c "print(3 + max($(PARAM_TX_QUEUE_INDEX_WIDTH)-12, 0))") -export PARAM_RX_QUEUE_PIPELINE := $(shell python -c "print(3 + max($(PARAM_RX_QUEUE_INDEX_WIDTH)-12, 0))") -export PARAM_CQ_PIPELINE := $(shell python -c "print(3 + max($(PARAM_CQN_WIDTH)-12, 0))") - -# TX and RX engine configuration -export PARAM_TX_DESC_TABLE_SIZE := 32 -export PARAM_RX_DESC_TABLE_SIZE := 32 -export PARAM_RX_INDIR_TBL_ADDR_WIDTH := $(shell python -c "print(min($(PARAM_RX_QUEUE_INDEX_WIDTH), 8))") - -# Scheduler configuration -export PARAM_TX_SCHEDULER_OP_TABLE_SIZE := $(PARAM_TX_DESC_TABLE_SIZE) -export PARAM_TX_SCHEDULER_PIPELINE := $(PARAM_TX_QUEUE_PIPELINE) -export PARAM_TDMA_INDEX_WIDTH := 6 - -# Interface configuration -export PARAM_PTP_TS_ENABLE := 1 -export PARAM_TX_CPL_FIFO_DEPTH := 32 -export PARAM_TX_CHECKSUM_ENABLE := 1 -export PARAM_RX_HASH_ENABLE := 1 -export PARAM_RX_CHECKSUM_ENABLE := 1 -export PARAM_LFC_ENABLE := 1 -export PARAM_PFC_ENABLE := $(PARAM_LFC_ENABLE) -export PARAM_TX_FIFO_DEPTH := 32768 -export PARAM_RX_FIFO_DEPTH := 32768 -export PARAM_MAX_TX_SIZE := 9214 -export PARAM_MAX_RX_SIZE := 9214 -export PARAM_TX_RAM_SIZE := 32768 -export PARAM_RX_RAM_SIZE := 32768 - -# Application block configuration -export PARAM_APP_ID := $(shell echo $$((0x00000000)) ) -export PARAM_APP_ENABLE := 0 -export PARAM_APP_CTRL_ENABLE := 1 -export PARAM_APP_DMA_ENABLE := 1 -export PARAM_APP_AXIS_DIRECT_ENABLE := 1 -export PARAM_APP_AXIS_SYNC_ENABLE := 1 -export PARAM_APP_AXIS_IF_ENABLE := 1 -export PARAM_APP_STAT_ENABLE := 1 - -# DMA interface configuration -export PARAM_DMA_IMM_ENABLE := 0 -export PARAM_DMA_IMM_WIDTH := 32 -export PARAM_DMA_LEN_WIDTH := 16 -export PARAM_DMA_TAG_WIDTH := 16 -export PARAM_RAM_ADDR_WIDTH := $(shell python -c "print((max($(PARAM_TX_RAM_SIZE), $(PARAM_RX_RAM_SIZE))-1).bit_length())") -export PARAM_RAM_PIPELINE := 2 - -# PCIe interface configuration -export PARAM_AXIS_PCIE_DATA_WIDTH := 256 -export PARAM_PF_COUNT := 1 -export PARAM_VF_COUNT := 0 - -# Interrupt configuration -export PARAM_IRQ_INDEX_WIDTH := $(PARAM_EQN_WIDTH) - -# AXI lite interface configuration (control) -export PARAM_AXIL_CTRL_DATA_WIDTH := 32 -export PARAM_AXIL_CTRL_ADDR_WIDTH := 24 - -# AXI lite interface configuration (application control) -export PARAM_AXIL_APP_CTRL_DATA_WIDTH := $(PARAM_AXIL_CTRL_DATA_WIDTH) -export PARAM_AXIL_APP_CTRL_ADDR_WIDTH := 24 - -# Ethernet interface configuration -export PARAM_AXIS_ETH_TX_PIPELINE := 0 -export PARAM_AXIS_ETH_TX_FIFO_PIPELINE := 2 -export PARAM_AXIS_ETH_TX_TS_PIPELINE := 0 -export PARAM_AXIS_ETH_RX_PIPELINE := 0 -export PARAM_AXIS_ETH_RX_FIFO_PIPELINE := 2 - -# Statistics counter subsystem -export PARAM_STAT_ENABLE := 0 -export PARAM_STAT_DMA_ENABLE := 1 -export PARAM_STAT_PCIE_ENABLE := 1 -export PARAM_STAT_INC_WIDTH := 24 -export PARAM_STAT_ID_WIDTH := 10 - -ifeq ($(SIM), icarus) - PLUSARGS += -fst - - COMPILE_ARGS += $(foreach v,$(filter PARAM_%,$(.VARIABLES)),-P $(TOPLEVEL).$(subst PARAM_,,$(v))=$($(v))) - - ifeq ($(WAVES), 1) - VERILOG_SOURCES += iverilog_dump.v - COMPILE_ARGS += -s iverilog_dump - endif -else ifeq ($(SIM), verilator) - COMPILE_ARGS += -Wno-SELRANGE -Wno-WIDTH - - COMPILE_ARGS += $(foreach v,$(filter PARAM_%,$(.VARIABLES)),-G$(subst PARAM_,,$(v))=$($(v))) - - ifeq ($(WAVES), 1) - COMPILE_ARGS += --trace-fst - endif -endif - -include $(shell cocotb-config --makefiles)/Makefile.sim - -iverilog_dump.v: - echo 'module iverilog_dump();' > $@ - echo 'initial begin' >> $@ - echo ' $$dumpfile("$(TOPLEVEL).fst");' >> $@ - echo ' $$dumpvars(0, $(TOPLEVEL));' >> $@ - echo 'end' >> $@ - echo 'endmodule' >> $@ - -clean:: - @rm -rf iverilog_dump.v - @rm -rf dump.fst $(TOPLEVEL).fst diff --git a/fpga/mqnic/Nexus_K35_S/fpga/tb/fpga_core/mqnic.py b/fpga/mqnic/Nexus_K35_S/fpga/tb/fpga_core/mqnic.py deleted file mode 120000 index dfa8522e7..000000000 --- a/fpga/mqnic/Nexus_K35_S/fpga/tb/fpga_core/mqnic.py +++ /dev/null @@ -1 +0,0 @@ -../../../../../common/tb/mqnic.py \ No newline at end of file diff --git a/fpga/mqnic/Nexus_K35_S/fpga/tb/fpga_core/test_fpga_core.py b/fpga/mqnic/Nexus_K35_S/fpga/tb/fpga_core/test_fpga_core.py deleted file mode 100644 index 6dc8d25d2..000000000 --- a/fpga/mqnic/Nexus_K35_S/fpga/tb/fpga_core/test_fpga_core.py +++ /dev/null @@ -1,777 +0,0 @@ -# SPDX-License-Identifier: BSD-2-Clause-Views -# Copyright (c) 2020-2023 The Regents of the University of California - -import logging -import os -import struct -import sys - -import scapy.utils -from scapy.layers.l2 import Ether -from scapy.layers.inet import IP, UDP - -import cocotb_test.simulator - -import cocotb -from cocotb.log import SimLog -from cocotb.clock import Clock -from cocotb.triggers import RisingEdge, FallingEdge, Timer - -from cocotbext.axi import AxiStreamBus -from cocotbext.eth import XgmiiSource, XgmiiSink, XgmiiFrame -from cocotbext.pcie.core import RootComplex -from cocotbext.pcie.xilinx.us import UltraScalePcieDevice - -try: - import mqnic -except ImportError: - # attempt import from current directory - sys.path.insert(0, os.path.join(os.path.dirname(__file__))) - try: - import mqnic - finally: - del sys.path[0] - - -class TB(object): - def __init__(self, dut, msix_count=32): - self.dut = dut - - self.log = SimLog("cocotb.tb") - self.log.setLevel(logging.DEBUG) - - # PCIe - self.rc = RootComplex() - - self.rc.max_payload_size = 0x1 # 256 bytes - self.rc.max_read_request_size = 0x2 # 512 bytes - - self.dev = UltraScalePcieDevice( - # configuration options - pcie_generation=3, - pcie_link_width=8, - user_clk_frequency=250e6, - alignment="dword", - rc_straddle=len(dut.core_inst.pcie_if_inst.pcie_us_if_rc_inst.rx_cpl_tlp_valid_reg) > 1, - pf_count=1, - max_payload_size=1024, - enable_client_tag=True, - enable_extended_tag=True, - enable_parity=False, - enable_rx_msg_interface=False, - enable_sriov=False, - enable_extended_configuration=False, - - pf0_msi_enable=False, - pf0_msi_count=32, - pf1_msi_enable=False, - pf1_msi_count=1, - pf0_msix_enable=True, - pf0_msix_table_size=msix_count-1, - pf0_msix_table_bir=0, - pf0_msix_table_offset=0x00010000, - pf0_msix_pba_bir=0, - pf0_msix_pba_offset=0x00018000, - pf1_msix_enable=False, - pf1_msix_table_size=0, - pf1_msix_table_bir=0, - pf1_msix_table_offset=0x00000000, - pf1_msix_pba_bir=0, - pf1_msix_pba_offset=0x00000000, - - # signals - # Clock and Reset Interface - user_clk=dut.clk_250mhz, - user_reset=dut.rst_250mhz, - # user_lnk_up - # sys_clk - # sys_clk_gt - # sys_reset - # phy_rdy_out - - # Requester reQuest Interface - rq_bus=AxiStreamBus.from_prefix(dut, "m_axis_rq"), - pcie_rq_seq_num=dut.s_axis_rq_seq_num, - pcie_rq_seq_num_vld=dut.s_axis_rq_seq_num_valid, - # pcie_rq_tag - # pcie_rq_tag_av - # pcie_rq_tag_vld - - # Requester Completion Interface - rc_bus=AxiStreamBus.from_prefix(dut, "s_axis_rc"), - - # Completer reQuest Interface - cq_bus=AxiStreamBus.from_prefix(dut, "s_axis_cq"), - # pcie_cq_np_req - # pcie_cq_np_req_count - - # Completer Completion Interface - cc_bus=AxiStreamBus.from_prefix(dut, "m_axis_cc"), - - # Transmit Flow Control Interface - # pcie_tfc_nph_av=dut.pcie_tfc_nph_av, - # pcie_tfc_npd_av=dut.pcie_tfc_npd_av, - - # Configuration Management Interface - cfg_mgmt_addr=dut.cfg_mgmt_addr, - cfg_mgmt_write=dut.cfg_mgmt_write, - cfg_mgmt_write_data=dut.cfg_mgmt_write_data, - cfg_mgmt_byte_enable=dut.cfg_mgmt_byte_enable, - cfg_mgmt_read=dut.cfg_mgmt_read, - cfg_mgmt_read_data=dut.cfg_mgmt_read_data, - cfg_mgmt_read_write_done=dut.cfg_mgmt_read_write_done, - # cfg_mgmt_debug_access - - # Configuration Status Interface - # cfg_phy_link_down - # cfg_phy_link_status - # cfg_negotiated_width - # cfg_current_speed - cfg_max_payload=dut.cfg_max_payload, - cfg_max_read_req=dut.cfg_max_read_req, - # cfg_function_status - # cfg_vf_status - # cfg_function_power_state - # cfg_vf_power_state - # cfg_link_power_state - # cfg_err_cor_out - # cfg_err_nonfatal_out - # cfg_err_fatal_out - # cfg_local_error_out - # cfg_local_error_valid - # cfg_rx_pm_state - # cfg_tx_pm_state - # cfg_ltssm_state - cfg_rcb_status=dut.cfg_rcb_status, - # cfg_obff_enable - # cfg_pl_status_change - # cfg_tph_requester_enable - # cfg_tph_st_mode - # cfg_vf_tph_requester_enable - # cfg_vf_tph_st_mode - - # Configuration Received Message Interface - # cfg_msg_received - # cfg_msg_received_data - # cfg_msg_received_type - - # Configuration Transmit Message Interface - # cfg_msg_transmit - # cfg_msg_transmit_type - # cfg_msg_transmit_data - # cfg_msg_transmit_done - - # Configuration Flow Control Interface - cfg_fc_ph=dut.cfg_fc_ph, - cfg_fc_pd=dut.cfg_fc_pd, - cfg_fc_nph=dut.cfg_fc_nph, - cfg_fc_npd=dut.cfg_fc_npd, - cfg_fc_cplh=dut.cfg_fc_cplh, - cfg_fc_cpld=dut.cfg_fc_cpld, - cfg_fc_sel=dut.cfg_fc_sel, - - # Configuration Control Interface - # cfg_hot_reset_in - # cfg_hot_reset_out - # cfg_config_space_enable - # cfg_dsn - # cfg_bus_number - # cfg_ds_port_number - # cfg_ds_bus_number - # cfg_ds_device_number - # cfg_ds_function_number - # cfg_power_state_change_ack - # cfg_power_state_change_interrupt - cfg_err_cor_in=dut.status_error_cor, - cfg_err_uncor_in=dut.status_error_uncor, - # cfg_flr_in_process - # cfg_flr_done - # cfg_vf_flr_in_process - # cfg_vf_flr_func_num - # cfg_vf_flr_done - # cfg_pm_aspm_l1_entry_reject - # cfg_pm_aspm_tx_l0s_entry_disable - # cfg_req_pm_transition_l23_ready - # cfg_link_training_enable - - # Configuration Interrupt Controller Interface - # cfg_interrupt_int - # cfg_interrupt_sent - # cfg_interrupt_pending - # cfg_interrupt_msi_enable - # cfg_interrupt_msi_vf_enable - # cfg_interrupt_msi_mmenable - # cfg_interrupt_msi_mask_update - # cfg_interrupt_msi_data - # cfg_interrupt_msi_select - # cfg_interrupt_msi_int - # cfg_interrupt_msi_pending_status - # cfg_interrupt_msi_pending_status_data_enable - # cfg_interrupt_msi_pending_status_function_num - # cfg_interrupt_msi_sent - # cfg_interrupt_msi_fail - cfg_interrupt_msix_enable=dut.cfg_interrupt_msix_enable, - cfg_interrupt_msix_mask=dut.cfg_interrupt_msix_mask, - cfg_interrupt_msix_vf_enable=dut.cfg_interrupt_msix_vf_enable, - cfg_interrupt_msix_vf_mask=dut.cfg_interrupt_msix_vf_mask, - cfg_interrupt_msix_address=dut.cfg_interrupt_msix_address, - cfg_interrupt_msix_data=dut.cfg_interrupt_msix_data, - cfg_interrupt_msix_int=dut.cfg_interrupt_msix_int, - cfg_interrupt_msix_sent=dut.cfg_interrupt_msix_sent, - cfg_interrupt_msix_fail=dut.cfg_interrupt_msix_fail, - # cfg_interrupt_msi_attr - # cfg_interrupt_msi_tph_present - # cfg_interrupt_msi_tph_type - # cfg_interrupt_msi_tph_st_tag - cfg_interrupt_msi_function_number=dut.cfg_interrupt_msi_function_number, - - # Configuration Extend Interface - # cfg_ext_read_received - # cfg_ext_write_received - # cfg_ext_register_number - # cfg_ext_function_number - # cfg_ext_write_data - # cfg_ext_write_byte_enable - # cfg_ext_read_data - # cfg_ext_read_data_valid - ) - - # self.dev.log.setLevel(logging.DEBUG) - - self.rc.make_port().connect(self.dev) - - self.driver = mqnic.Driver() - - self.dev.functions[0].configure_bar(0, 2**len(dut.core_inst.core_pcie_inst.axil_ctrl_araddr), ext=True, prefetch=True) - if hasattr(dut.core_inst.core_pcie_inst, 'pcie_app_ctrl'): - self.dev.functions[0].configure_bar(2, 2**len(dut.core_inst.core_pcie_inst.axil_app_ctrl_araddr), ext=True, prefetch=True) - - cocotb.start_soon(Clock(dut.ptp_clk, 6.206, units="ns").start()) - dut.ptp_rst.setimmediatevalue(0) - cocotb.start_soon(Clock(dut.ptp_sample_clk, 8, units="ns").start()) - - # Ethernet - self.sfp_source = [] - self.sfp_sink = [] - - 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(0) - 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.sma_in.setimmediatevalue(0) - - dut.sfp_i2c_scl_i.setimmediatevalue(1) - dut.sfp_1_i2c_sda_i.setimmediatevalue(1) - dut.sfp_2_i2c_sda_i.setimmediatevalue(1) - - dut.eeprom_i2c_scl_i.setimmediatevalue(1) - dut.eeprom_i2c_sda_i.setimmediatevalue(1) - - dut.flash_dq_i.setimmediatevalue(0) - - self.loopback_enable = False - cocotb.start_soon(self._run_loopback()) - - async def init(self): - - self.dut.ptp_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) - 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') - - await RisingEdge(self.dut.clk_250mhz) - await RisingEdge(self.dut.clk_250mhz) - - self.dut.ptp_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() - - async def _run_loopback(self): - while True: - await RisingEdge(self.dut.clk_250mhz) - - if self.loopback_enable: - 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() -async def run_test_nic(dut): - - tb = TB(dut, msix_count=2**len(dut.core_inst.core_pcie_inst.irq_index)) - - await tb.init() - - tb.log.info("Init driver") - await tb.driver.init_pcie_dev(tb.rc.find_device(tb.dev.functions[0].pcie_id)) - await tb.driver.interfaces[0].open() - # await tb.driver.interfaces[1].open() - - # enable queues - tb.log.info("Enable queues") - await tb.driver.interfaces[0].sched_blocks[0].schedulers[0].rb.write_dword(mqnic.MQNIC_RB_SCHED_RR_REG_CTRL, 0x00000001) - for k in range(len(tb.driver.interfaces[0].txq)): - await tb.driver.interfaces[0].sched_blocks[0].schedulers[0].hw_regs.write_dword(4*k, 0x00000003) - - # wait for all writes to complete - await tb.driver.hw_regs.read_dword(0) - tb.log.info("Init complete") - - tb.log.info("Send and receive single packet") - - data = bytearray([x % 256 for x in range(1024)]) - - await tb.driver.interfaces[0].start_xmit(data, 0) - - pkt = await tb.sfp_sink[0].recv() - tb.log.info("Packet: %s", pkt) - - await tb.sfp_source[0].send(pkt) - - pkt = await tb.driver.interfaces[0].recv() - - tb.log.info("Packet: %s", pkt) - assert pkt.rx_checksum == ~scapy.utils.checksum(bytes(pkt.data[14:])) & 0xffff - - # await tb.driver.interfaces[1].start_xmit(data, 0) - - # pkt = await tb.sfp_sink[1].recv() - # tb.log.info("Packet: %s", pkt) - - # await tb.sfp_source[1].send(pkt) - - # pkt = await tb.driver.interfaces[1].recv() - - # tb.log.info("Packet: %s", pkt) - # assert pkt.rx_checksum == ~scapy.utils.checksum(bytes(pkt.data[14:])) & 0xffff - - tb.log.info("RX and TX checksum tests") - - payload = bytes([x % 256 for x in range(256)]) - eth = Ether(src='5A:51:52:53:54:55', dst='DA:D1:D2:D3:D4:D5') - ip = IP(src='192.168.1.100', dst='192.168.1.101') - udp = UDP(sport=1, dport=2) - test_pkt = eth / ip / udp / payload - - test_pkt2 = test_pkt.copy() - test_pkt2[UDP].chksum = scapy.utils.checksum(bytes(test_pkt2[UDP])) - - await tb.driver.interfaces[0].start_xmit(test_pkt2.build(), 0, 34, 6) - - pkt = await tb.sfp_sink[0].recv() - tb.log.info("Packet: %s", pkt) - - await tb.sfp_source[0].send(pkt) - - pkt = await tb.driver.interfaces[0].recv() - - tb.log.info("Packet: %s", pkt) - assert pkt.rx_checksum == ~scapy.utils.checksum(bytes(pkt.data[14:])) & 0xffff - assert Ether(pkt.data).build() == test_pkt.build() - - tb.log.info("Queue mapping offset test") - - data = bytearray([x % 256 for x in range(1024)]) - - tb.loopback_enable = True - - for k in range(4): - await tb.driver.interfaces[0].set_rx_queue_map_indir_table(0, 0, k) - - await tb.driver.interfaces[0].start_xmit(data, 0) - - pkt = await tb.driver.interfaces[0].recv() - - tb.log.info("Packet: %s", pkt) - assert pkt.rx_checksum == ~scapy.utils.checksum(bytes(pkt.data[14:])) & 0xffff - assert pkt.queue == k - - tb.loopback_enable = False - - await tb.driver.interfaces[0].set_rx_queue_map_indir_table(0, 0, 0) - - tb.log.info("Queue mapping RSS mask test") - - await tb.driver.interfaces[0].set_rx_queue_map_rss_mask(0, 0x00000003) - - for k in range(4): - await tb.driver.interfaces[0].set_rx_queue_map_indir_table(0, k, k) - - tb.loopback_enable = True - - queues = set() - - for k in range(64): - payload = bytes([x % 256 for x in range(256)]) - eth = Ether(src='5A:51:52:53:54:55', dst='DA:D1:D2:D3:D4:D5') - ip = IP(src='192.168.1.100', dst='192.168.1.101') - udp = UDP(sport=1, dport=k+0) - test_pkt = eth / ip / udp / payload - - test_pkt2 = test_pkt.copy() - test_pkt2[UDP].chksum = scapy.utils.checksum(bytes(test_pkt2[UDP])) - - await tb.driver.interfaces[0].start_xmit(test_pkt2.build(), 0, 34, 6) - - for k in range(64): - pkt = await tb.driver.interfaces[0].recv() - - tb.log.info("Packet: %s", pkt) - assert pkt.rx_checksum == ~scapy.utils.checksum(bytes(pkt.data[14:])) & 0xffff - - queues.add(pkt.queue) - - assert len(queues) == 4 - - tb.loopback_enable = False - - await tb.driver.interfaces[0].set_rx_queue_map_rss_mask(0, 0) - - tb.log.info("Multiple small packets") - - count = 64 - - pkts = [bytearray([(x+k) % 256 for x in range(60)]) for k in range(count)] - - tb.loopback_enable = True - - for p in pkts: - await tb.driver.interfaces[0].start_xmit(p, 0) - - for k in range(count): - pkt = await tb.driver.interfaces[0].recv() - - tb.log.info("Packet: %s", pkt) - assert pkt.data == pkts[k] - assert pkt.rx_checksum == ~scapy.utils.checksum(bytes(pkt.data[14:])) & 0xffff - - tb.loopback_enable = False - - tb.log.info("Multiple large packets") - - count = 64 - - pkts = [bytearray([(x+k) % 256 for x in range(1514)]) for k in range(count)] - - tb.loopback_enable = True - - for p in pkts: - await tb.driver.interfaces[0].start_xmit(p, 0) - - for k in range(count): - pkt = await tb.driver.interfaces[0].recv() - - tb.log.info("Packet: %s", pkt) - assert pkt.data == pkts[k] - assert pkt.rx_checksum == ~scapy.utils.checksum(bytes(pkt.data[14:])) & 0xffff - - tb.loopback_enable = False - - if tb.driver.interfaces[0].if_feature_lfc: - tb.log.info("Test LFC pause frame RX") - - await tb.driver.interfaces[0].ports[0].set_lfc_ctrl(mqnic.MQNIC_PORT_LFC_CTRL_TX_LFC_EN | mqnic.MQNIC_PORT_LFC_CTRL_RX_LFC_EN) - await tb.driver.hw_regs.read_dword(0) - - lfc_xoff = Ether(src='DA:D1:D2:D3:D4:D5', dst='01:80:C2:00:00:01', type=0x8808) / struct.pack('!HH', 0x0001, 2000) - - await tb.sfp_source[0].send(XgmiiFrame.from_payload(bytes(lfc_xoff))) - - count = 16 - - pkts = [bytearray([(x+k) % 256 for x in range(1514)]) for k in range(count)] - - tb.loopback_enable = True - - for p in pkts: - await tb.driver.interfaces[0].start_xmit(p, 0) - - for k in range(count): - pkt = await tb.driver.interfaces[0].recv() - - tb.log.info("Packet: %s", pkt) - assert pkt.data == pkts[k] - if tb.driver.interfaces[0].if_feature_rx_csum: - assert pkt.rx_checksum == ~scapy.utils.checksum(bytes(pkt.data[14:])) & 0xffff - - tb.loopback_enable = False - - await RisingEdge(dut.clk_250mhz) - await RisingEdge(dut.clk_250mhz) - - -# cocotb-test - -tests_dir = os.path.dirname(__file__) -rtl_dir = os.path.abspath(os.path.join(tests_dir, '..', '..', 'rtl')) -lib_dir = os.path.abspath(os.path.join(rtl_dir, '..', 'lib')) -app_dir = os.path.abspath(os.path.join(rtl_dir, '..', 'app')) -axi_rtl_dir = os.path.abspath(os.path.join(lib_dir, 'axi', 'rtl')) -axis_rtl_dir = os.path.abspath(os.path.join(lib_dir, 'axis', 'rtl')) -eth_rtl_dir = os.path.abspath(os.path.join(lib_dir, 'eth', 'rtl')) -pcie_rtl_dir = os.path.abspath(os.path.join(lib_dir, 'pcie', 'rtl')) - - -def test_fpga_core(request): - dut = "fpga_core" - module = os.path.splitext(os.path.basename(__file__))[0] - toplevel = dut - - verilog_sources = [ - os.path.join(rtl_dir, f"{dut}.v"), - os.path.join(rtl_dir, "common", "mqnic_core_pcie_us.v"), - os.path.join(rtl_dir, "common", "mqnic_core_pcie.v"), - os.path.join(rtl_dir, "common", "mqnic_core.v"), - os.path.join(rtl_dir, "common", "mqnic_interface.v"), - os.path.join(rtl_dir, "common", "mqnic_interface_tx.v"), - os.path.join(rtl_dir, "common", "mqnic_interface_rx.v"), - os.path.join(rtl_dir, "common", "mqnic_port.v"), - os.path.join(rtl_dir, "common", "mqnic_port_tx.v"), - os.path.join(rtl_dir, "common", "mqnic_port_rx.v"), - os.path.join(rtl_dir, "common", "mqnic_egress.v"), - os.path.join(rtl_dir, "common", "mqnic_ingress.v"), - os.path.join(rtl_dir, "common", "mqnic_l2_egress.v"), - os.path.join(rtl_dir, "common", "mqnic_l2_ingress.v"), - os.path.join(rtl_dir, "common", "mqnic_rx_queue_map.v"), - os.path.join(rtl_dir, "common", "mqnic_ptp.v"), - os.path.join(rtl_dir, "common", "mqnic_ptp_clock.v"), - os.path.join(rtl_dir, "common", "mqnic_ptp_perout.v"), - os.path.join(rtl_dir, "common", "mqnic_rb_clk_info.v"), - os.path.join(rtl_dir, "common", "mqnic_port_map_phy_xgmii.v"), - os.path.join(rtl_dir, "common", "cpl_write.v"), - os.path.join(rtl_dir, "common", "cpl_op_mux.v"), - os.path.join(rtl_dir, "common", "desc_fetch.v"), - os.path.join(rtl_dir, "common", "desc_op_mux.v"), - os.path.join(rtl_dir, "common", "queue_manager.v"), - os.path.join(rtl_dir, "common", "cpl_queue_manager.v"), - os.path.join(rtl_dir, "common", "tx_fifo.v"), - os.path.join(rtl_dir, "common", "rx_fifo.v"), - os.path.join(rtl_dir, "common", "tx_req_mux.v"), - os.path.join(rtl_dir, "common", "tx_engine.v"), - os.path.join(rtl_dir, "common", "rx_engine.v"), - os.path.join(rtl_dir, "common", "tx_checksum.v"), - os.path.join(rtl_dir, "common", "rx_hash.v"), - os.path.join(rtl_dir, "common", "rx_checksum.v"), - os.path.join(rtl_dir, "common", "rb_drp.v"), - os.path.join(rtl_dir, "common", "stats_counter.v"), - os.path.join(rtl_dir, "common", "stats_collect.v"), - os.path.join(rtl_dir, "common", "stats_pcie_if.v"), - os.path.join(rtl_dir, "common", "stats_pcie_tlp.v"), - os.path.join(rtl_dir, "common", "stats_dma_if_pcie.v"), - os.path.join(rtl_dir, "common", "stats_dma_latency.v"), - os.path.join(rtl_dir, "common", "mqnic_tx_scheduler_block_rr.v"), - os.path.join(rtl_dir, "common", "tx_scheduler_rr.v"), - os.path.join(rtl_dir, "common", "tdma_scheduler.v"), - os.path.join(rtl_dir, "common", "tdma_ber.v"), - os.path.join(rtl_dir, "common", "tdma_ber_ch.v"), - os.path.join(rtl_dir, "common", "i2c_single_reg.v"), - os.path.join(eth_rtl_dir, "eth_mac_10g.v"), - os.path.join(eth_rtl_dir, "axis_xgmii_rx_64.v"), - os.path.join(eth_rtl_dir, "axis_xgmii_tx_64.v"), - os.path.join(eth_rtl_dir, "mac_ctrl_rx.v"), - os.path.join(eth_rtl_dir, "mac_ctrl_tx.v"), - os.path.join(eth_rtl_dir, "mac_pause_ctrl_rx.v"), - os.path.join(eth_rtl_dir, "mac_pause_ctrl_tx.v"), - os.path.join(eth_rtl_dir, "lfsr.v"), - os.path.join(eth_rtl_dir, "ptp_td_phc.v"), - os.path.join(eth_rtl_dir, "ptp_td_leaf.v"), - os.path.join(eth_rtl_dir, "ptp_perout.v"), - os.path.join(axi_rtl_dir, "axil_interconnect.v"), - os.path.join(axi_rtl_dir, "axil_crossbar.v"), - os.path.join(axi_rtl_dir, "axil_crossbar_addr.v"), - os.path.join(axi_rtl_dir, "axil_crossbar_rd.v"), - os.path.join(axi_rtl_dir, "axil_crossbar_wr.v"), - os.path.join(axi_rtl_dir, "axil_reg_if.v"), - os.path.join(axi_rtl_dir, "axil_reg_if_rd.v"), - os.path.join(axi_rtl_dir, "axil_reg_if_wr.v"), - os.path.join(axi_rtl_dir, "axil_register_rd.v"), - os.path.join(axi_rtl_dir, "axil_register_wr.v"), - os.path.join(axi_rtl_dir, "arbiter.v"), - os.path.join(axi_rtl_dir, "priority_encoder.v"), - os.path.join(axis_rtl_dir, "axis_adapter.v"), - os.path.join(axis_rtl_dir, "axis_arb_mux.v"), - os.path.join(axis_rtl_dir, "axis_async_fifo.v"), - os.path.join(axis_rtl_dir, "axis_async_fifo_adapter.v"), - os.path.join(axis_rtl_dir, "axis_demux.v"), - os.path.join(axis_rtl_dir, "axis_fifo.v"), - os.path.join(axis_rtl_dir, "axis_fifo_adapter.v"), - os.path.join(axis_rtl_dir, "axis_pipeline_fifo.v"), - os.path.join(axis_rtl_dir, "axis_register.v"), - os.path.join(pcie_rtl_dir, "pcie_axil_master.v"), - os.path.join(pcie_rtl_dir, "pcie_tlp_demux.v"), - os.path.join(pcie_rtl_dir, "pcie_tlp_demux_bar.v"), - os.path.join(pcie_rtl_dir, "pcie_tlp_mux.v"), - os.path.join(pcie_rtl_dir, "pcie_tlp_fifo.v"), - os.path.join(pcie_rtl_dir, "pcie_tlp_fifo_raw.v"), - os.path.join(pcie_rtl_dir, "pcie_msix.v"), - os.path.join(pcie_rtl_dir, "irq_rate_limit.v"), - os.path.join(pcie_rtl_dir, "dma_if_pcie.v"), - os.path.join(pcie_rtl_dir, "dma_if_pcie_rd.v"), - os.path.join(pcie_rtl_dir, "dma_if_pcie_wr.v"), - os.path.join(pcie_rtl_dir, "dma_if_mux.v"), - os.path.join(pcie_rtl_dir, "dma_if_mux_rd.v"), - os.path.join(pcie_rtl_dir, "dma_if_mux_wr.v"), - os.path.join(pcie_rtl_dir, "dma_if_desc_mux.v"), - os.path.join(pcie_rtl_dir, "dma_ram_demux_rd.v"), - os.path.join(pcie_rtl_dir, "dma_ram_demux_wr.v"), - os.path.join(pcie_rtl_dir, "dma_psdpram.v"), - os.path.join(pcie_rtl_dir, "dma_client_axis_sink.v"), - os.path.join(pcie_rtl_dir, "dma_client_axis_source.v"), - os.path.join(pcie_rtl_dir, "pcie_us_if.v"), - os.path.join(pcie_rtl_dir, "pcie_us_if_rc.v"), - os.path.join(pcie_rtl_dir, "pcie_us_if_rq.v"), - os.path.join(pcie_rtl_dir, "pcie_us_if_cc.v"), - os.path.join(pcie_rtl_dir, "pcie_us_if_cq.v"), - os.path.join(pcie_rtl_dir, "pcie_us_cfg.v"), - os.path.join(pcie_rtl_dir, "pulse_merge.v"), - ] - - parameters = {} - - # Structural configuration - parameters['IF_COUNT'] = 2 - parameters['PORTS_PER_IF'] = 1 - parameters['SCHED_PER_IF'] = parameters['PORTS_PER_IF'] - parameters['PORT_MASK'] = 0 - - # Clock configuration - parameters['CLK_PERIOD_NS_NUM'] = 4 - parameters['CLK_PERIOD_NS_DENOM'] = 1 - - # PTP configuration - parameters['PTP_CLK_PERIOD_NS_NUM'] = 1024 - parameters['PTP_CLK_PERIOD_NS_DENOM'] = 165 - parameters['PTP_CLOCK_PIPELINE'] = 0 - parameters['PTP_CLOCK_CDC_PIPELINE'] = 0 - parameters['PTP_PORT_CDC_PIPELINE'] = 0 - parameters['PTP_PEROUT_ENABLE'] = 1 - parameters['PTP_PEROUT_COUNT'] = 1 - - # Queue manager configuration - parameters['EVENT_QUEUE_OP_TABLE_SIZE'] = 32 - parameters['TX_QUEUE_OP_TABLE_SIZE'] = 32 - parameters['RX_QUEUE_OP_TABLE_SIZE'] = 32 - parameters['CQ_OP_TABLE_SIZE'] = 32 - parameters['EQN_WIDTH'] = 5 - parameters['TX_QUEUE_INDEX_WIDTH'] = 11 - parameters['RX_QUEUE_INDEX_WIDTH'] = 8 - parameters['CQN_WIDTH'] = max(parameters['TX_QUEUE_INDEX_WIDTH'], parameters['RX_QUEUE_INDEX_WIDTH']) + 1 - parameters['EQ_PIPELINE'] = 3 - parameters['TX_QUEUE_PIPELINE'] = 3 + max(parameters['TX_QUEUE_INDEX_WIDTH']-12, 0) - parameters['RX_QUEUE_PIPELINE'] = 3 + max(parameters['RX_QUEUE_INDEX_WIDTH']-12, 0) - parameters['CQ_PIPELINE'] = 3 + max(parameters['CQN_WIDTH']-12, 0) - - # TX and RX engine configuration - parameters['TX_DESC_TABLE_SIZE'] = 32 - parameters['RX_DESC_TABLE_SIZE'] = 32 - parameters['RX_INDIR_TBL_ADDR_WIDTH'] = min(parameters['RX_QUEUE_INDEX_WIDTH'], 8) - - # Scheduler configuration - parameters['TX_SCHEDULER_OP_TABLE_SIZE'] = parameters['TX_DESC_TABLE_SIZE'] - parameters['TX_SCHEDULER_PIPELINE'] = parameters['TX_QUEUE_PIPELINE'] - parameters['TDMA_INDEX_WIDTH'] = 6 - - # Interface configuration - parameters['PTP_TS_ENABLE'] = 1 - parameters['TX_CPL_FIFO_DEPTH'] = 32 - parameters['TX_CHECKSUM_ENABLE'] = 1 - parameters['RX_HASH_ENABLE'] = 1 - parameters['RX_CHECKSUM_ENABLE'] = 1 - parameters['LFC_ENABLE'] = 1 - parameters['PFC_ENABLE'] = parameters['LFC_ENABLE'] - parameters['TX_FIFO_DEPTH'] = 32768 - parameters['RX_FIFO_DEPTH'] = 32768 - parameters['MAX_TX_SIZE'] = 9214 - parameters['MAX_RX_SIZE'] = 9214 - parameters['TX_RAM_SIZE'] = 32768 - parameters['RX_RAM_SIZE'] = 32768 - - # Application block configuration - parameters['APP_ID'] = 0x00000000 - parameters['APP_ENABLE'] = 0 - parameters['APP_CTRL_ENABLE'] = 1 - parameters['APP_DMA_ENABLE'] = 1 - parameters['APP_AXIS_DIRECT_ENABLE'] = 1 - parameters['APP_AXIS_SYNC_ENABLE'] = 1 - parameters['APP_AXIS_IF_ENABLE'] = 1 - parameters['APP_STAT_ENABLE'] = 1 - - # DMA interface configuration - parameters['DMA_IMM_ENABLE'] = 0 - parameters['DMA_IMM_WIDTH'] = 32 - parameters['DMA_LEN_WIDTH'] = 16 - parameters['DMA_TAG_WIDTH'] = 16 - parameters['RAM_ADDR_WIDTH'] = (max(parameters['TX_RAM_SIZE'], parameters['RX_RAM_SIZE'])-1).bit_length() - parameters['RAM_PIPELINE'] = 2 - - # PCIe interface configuration - parameters['AXIS_PCIE_DATA_WIDTH'] = 256 - parameters['PF_COUNT'] = 1 - parameters['VF_COUNT'] = 0 - - # Interrupt configuration - parameters['IRQ_INDEX_WIDTH'] = parameters['EQN_WIDTH'] - - # AXI lite interface configuration (control) - parameters['AXIL_CTRL_DATA_WIDTH'] = 32 - parameters['AXIL_CTRL_ADDR_WIDTH'] = 24 - - # AXI lite interface configuration (application control) - parameters['AXIL_APP_CTRL_DATA_WIDTH'] = parameters['AXIL_CTRL_DATA_WIDTH'] - parameters['AXIL_APP_CTRL_ADDR_WIDTH'] = 24 - - # Ethernet interface configuration - parameters['AXIS_ETH_TX_PIPELINE'] = 0 - parameters['AXIS_ETH_TX_FIFO_PIPELINE'] = 2 - parameters['AXIS_ETH_TX_TS_PIPELINE'] = 0 - parameters['AXIS_ETH_RX_PIPELINE'] = 0 - parameters['AXIS_ETH_RX_FIFO_PIPELINE'] = 2 - - # Statistics counter subsystem - parameters['STAT_ENABLE'] = 0 - parameters['STAT_DMA_ENABLE'] = 1 - parameters['STAT_PCIE_ENABLE'] = 1 - parameters['STAT_INC_WIDTH'] = 24 - parameters['STAT_ID_WIDTH'] = 10 - - extra_env = {f'PARAM_{k}': str(v) for k, v in parameters.items()} - - sim_build = os.path.join(tests_dir, "sim_build", - request.node.name.replace('[', '-').replace(']', '')) - - cocotb_test.simulator.run( - python_search=[tests_dir], - verilog_sources=verilog_sources, - toplevel=toplevel, - module=module, - parameters=parameters, - sim_build=sim_build, - extra_env=extra_env, - ) diff --git a/fpga/mqnic/Nexus_K3P_S/fpga_25g/Makefile b/fpga/mqnic/Nexus_K3P_S/fpga_25g/Makefile deleted file mode 100644 index f504bd06f..000000000 --- a/fpga/mqnic/Nexus_K3P_S/fpga_25g/Makefile +++ /dev/null @@ -1,25 +0,0 @@ -# Targets -TARGETS:= - -# Subdirectories -SUBDIRS = fpga -SUBDIRS_CLEAN = $(patsubst %,%.clean,$(SUBDIRS)) - -# Rules -.PHONY: all -all: $(SUBDIRS) $(TARGETS) - -.PHONY: $(SUBDIRS) -$(SUBDIRS): - cd $@ && $(MAKE) - -.PHONY: $(SUBDIRS_CLEAN) -$(SUBDIRS_CLEAN): - cd $(@:.clean=) && $(MAKE) clean - -.PHONY: clean -clean: $(SUBDIRS_CLEAN) - -rm -rf $(TARGETS) - -program: - #djtgcfg prog -d Atlys --index 0 --file fpga/fpga.bit diff --git a/fpga/mqnic/Nexus_K3P_S/fpga_25g/README.md b/fpga/mqnic/Nexus_K3P_S/fpga_25g/README.md index b8e1b1c2d..98eb37e47 100644 --- a/fpga/mqnic/Nexus_K3P_S/fpga_25g/README.md +++ b/fpga/mqnic/Nexus_K3P_S/fpga_25g/README.md @@ -1,10 +1,12 @@ -# Corundum mqnic for Cisco Nexus K3P-S +# Corundum mqnic for Cisco Nexus K3P-S/K35-S ## Introduction -This design targets the Cisco Nexus K3P-S FPGA board. +This design targets the Cisco Nexus K3P-S/K35-S FPGA board. -* FPGA: xcku3p-ffvb676-2-e +* FPGA + * K3P-S: xcku3p-ffvb676-2-e + * K35-S: xcku035-fbva676-2-e * PHY: 25G BASE-R PHY IP core and internal GTY transceiver ## Quick start diff --git a/fpga/mqnic/Nexus_K35_S/fpga/fpga/Makefile b/fpga/mqnic/Nexus_K3P_S/fpga_25g/fpga_K35/Makefile similarity index 99% rename from fpga/mqnic/Nexus_K35_S/fpga/fpga/Makefile rename to fpga/mqnic/Nexus_K3P_S/fpga_25g/fpga_K35/Makefile index 1a25421f7..ea9a351d1 100644 --- a/fpga/mqnic/Nexus_K35_S/fpga/fpga/Makefile +++ b/fpga/mqnic/Nexus_K3P_S/fpga_25g/fpga_K35/Makefile @@ -7,7 +7,7 @@ FPGA_TOP = fpga FPGA_ARCH = kintexu # Files for synthesis -SYN_FILES = rtl/fpga.v +SYN_FILES = rtl/fpga_k35.v SYN_FILES += rtl/fpga_core.v SYN_FILES += rtl/sync_signal.v SYN_FILES += rtl/common/mqnic_core_pcie_us.v @@ -130,7 +130,7 @@ SYN_FILES += lib/pcie/rtl/pcie_us_cfg.v SYN_FILES += lib/pcie/rtl/pulse_merge.v # XDC files -XDC_FILES = fpga.xdc +XDC_FILES = fpga_k35.xdc XDC_FILES += boot.xdc XDC_FILES += lib/axis/syn/vivado/axis_async_fifo.tcl XDC_FILES += lib/axis/syn/vivado/sync_reset.tcl diff --git a/fpga/mqnic/Nexus_K35_S/fpga/fpga/config.tcl b/fpga/mqnic/Nexus_K3P_S/fpga_25g/fpga_K35/config.tcl similarity index 99% rename from fpga/mqnic/Nexus_K35_S/fpga/fpga/config.tcl rename to fpga/mqnic/Nexus_K3P_S/fpga_25g/fpga_K35/config.tcl index 9dfcf3cb4..3bcd796fb 100644 --- a/fpga/mqnic/Nexus_K35_S/fpga/fpga/config.tcl +++ b/fpga/mqnic/Nexus_K3P_S/fpga_25g/fpga_K35/config.tcl @@ -54,6 +54,9 @@ dict set params BUILD_DATE "32'd${build_date}" dict set params GIT_HASH "32'h${git_hash}" dict set params RELEASE_INFO [format "32'h%08x" $release_info] +# Board configuration +dict set params TDMA_BER_ENABLE "0" + # Structural configuration dict set params IF_COUNT "2" dict set params PORTS_PER_IF "1" diff --git a/fpga/mqnic/Nexus_K35_S/fpga/fpga_app_dma_bench/Makefile b/fpga/mqnic/Nexus_K3P_S/fpga_25g/fpga_K35_app_dma_bench/Makefile similarity index 99% rename from fpga/mqnic/Nexus_K35_S/fpga/fpga_app_dma_bench/Makefile rename to fpga/mqnic/Nexus_K3P_S/fpga_25g/fpga_K35_app_dma_bench/Makefile index 21796aa08..40c3b17d8 100644 --- a/fpga/mqnic/Nexus_K35_S/fpga/fpga_app_dma_bench/Makefile +++ b/fpga/mqnic/Nexus_K3P_S/fpga_25g/fpga_K35_app_dma_bench/Makefile @@ -7,7 +7,7 @@ FPGA_TOP = fpga FPGA_ARCH = kintexu # Files for synthesis -SYN_FILES = rtl/fpga.v +SYN_FILES = rtl/fpga_k35.v SYN_FILES += rtl/fpga_core.v SYN_FILES += rtl/sync_signal.v SYN_FILES += rtl/common/mqnic_core_pcie_us.v @@ -132,7 +132,7 @@ SYN_FILES += lib/pcie/rtl/pcie_us_cfg.v SYN_FILES += lib/pcie/rtl/pulse_merge.v # XDC files -XDC_FILES = fpga.xdc +XDC_FILES = fpga_k35.xdc XDC_FILES += boot.xdc XDC_FILES += lib/axis/syn/vivado/axis_async_fifo.tcl XDC_FILES += lib/axis/syn/vivado/sync_reset.tcl diff --git a/fpga/mqnic/Nexus_K35_S/fpga/fpga_app_dma_bench/config.tcl b/fpga/mqnic/Nexus_K3P_S/fpga_25g/fpga_K35_app_dma_bench/config.tcl similarity index 99% rename from fpga/mqnic/Nexus_K35_S/fpga/fpga_app_dma_bench/config.tcl rename to fpga/mqnic/Nexus_K3P_S/fpga_25g/fpga_K35_app_dma_bench/config.tcl index 1d1adbdba..ce1e1d51c 100644 --- a/fpga/mqnic/Nexus_K35_S/fpga/fpga_app_dma_bench/config.tcl +++ b/fpga/mqnic/Nexus_K3P_S/fpga_25g/fpga_K35_app_dma_bench/config.tcl @@ -54,6 +54,9 @@ dict set params BUILD_DATE "32'd${build_date}" dict set params GIT_HASH "32'h${git_hash}" dict set params RELEASE_INFO [format "32'h%08x" $release_info] +# Board configuration +dict set params TDMA_BER_ENABLE "0" + # Structural configuration dict set params IF_COUNT "2" dict set params PORTS_PER_IF "1" diff --git a/fpga/mqnic/Nexus_K3P_S/fpga_25g/fpga_10g/Makefile b/fpga/mqnic/Nexus_K3P_S/fpga_25g/fpga_K3P/Makefile similarity index 99% rename from fpga/mqnic/Nexus_K3P_S/fpga_25g/fpga_10g/Makefile rename to fpga/mqnic/Nexus_K3P_S/fpga_25g/fpga_K3P/Makefile index 7922138d4..e0ab6d820 100644 --- a/fpga/mqnic/Nexus_K3P_S/fpga_25g/fpga_10g/Makefile +++ b/fpga/mqnic/Nexus_K3P_S/fpga_25g/fpga_K3P/Makefile @@ -7,7 +7,7 @@ FPGA_TOP = fpga FPGA_ARCH = kintexuplus # Files for synthesis -SYN_FILES = rtl/fpga.v +SYN_FILES = rtl/fpga_k3p.v SYN_FILES += rtl/fpga_core.v SYN_FILES += rtl/sync_signal.v SYN_FILES += rtl/common/mqnic_core_pcie_us.v @@ -131,7 +131,7 @@ SYN_FILES += lib/pcie/rtl/pcie_us_cfg.v SYN_FILES += lib/pcie/rtl/pulse_merge.v # XDC files -XDC_FILES = fpga.xdc +XDC_FILES = fpga_k3p.xdc XDC_FILES += boot.xdc XDC_FILES += lib/axis/syn/vivado/axis_async_fifo.tcl XDC_FILES += lib/axis/syn/vivado/sync_reset.tcl diff --git a/fpga/mqnic/Nexus_K3P_S/fpga_25g/fpga/config.tcl b/fpga/mqnic/Nexus_K3P_S/fpga_25g/fpga_K3P/config.tcl similarity index 100% rename from fpga/mqnic/Nexus_K3P_S/fpga_25g/fpga/config.tcl rename to fpga/mqnic/Nexus_K3P_S/fpga_25g/fpga_K3P/config.tcl diff --git a/fpga/mqnic/Nexus_K3P_S/fpga_25g/fpga/Makefile b/fpga/mqnic/Nexus_K3P_S/fpga_25g/fpga_K3P_10g/Makefile similarity index 99% rename from fpga/mqnic/Nexus_K3P_S/fpga_25g/fpga/Makefile rename to fpga/mqnic/Nexus_K3P_S/fpga_25g/fpga_K3P_10g/Makefile index 7922138d4..e0ab6d820 100644 --- a/fpga/mqnic/Nexus_K3P_S/fpga_25g/fpga/Makefile +++ b/fpga/mqnic/Nexus_K3P_S/fpga_25g/fpga_K3P_10g/Makefile @@ -7,7 +7,7 @@ FPGA_TOP = fpga FPGA_ARCH = kintexuplus # Files for synthesis -SYN_FILES = rtl/fpga.v +SYN_FILES = rtl/fpga_k3p.v SYN_FILES += rtl/fpga_core.v SYN_FILES += rtl/sync_signal.v SYN_FILES += rtl/common/mqnic_core_pcie_us.v @@ -131,7 +131,7 @@ SYN_FILES += lib/pcie/rtl/pcie_us_cfg.v SYN_FILES += lib/pcie/rtl/pulse_merge.v # XDC files -XDC_FILES = fpga.xdc +XDC_FILES = fpga_k3p.xdc XDC_FILES += boot.xdc XDC_FILES += lib/axis/syn/vivado/axis_async_fifo.tcl XDC_FILES += lib/axis/syn/vivado/sync_reset.tcl diff --git a/fpga/mqnic/Nexus_K3P_S/fpga_25g/fpga_10g/config.tcl b/fpga/mqnic/Nexus_K3P_S/fpga_25g/fpga_K3P_10g/config.tcl similarity index 100% rename from fpga/mqnic/Nexus_K3P_S/fpga_25g/fpga_10g/config.tcl rename to fpga/mqnic/Nexus_K3P_S/fpga_25g/fpga_K3P_10g/config.tcl diff --git a/fpga/mqnic/Nexus_K3P_S/fpga_25g/fpga_app_dma_bench/Makefile b/fpga/mqnic/Nexus_K3P_S/fpga_25g/fpga_K3P_app_dma_bench/Makefile similarity index 99% rename from fpga/mqnic/Nexus_K3P_S/fpga_25g/fpga_app_dma_bench/Makefile rename to fpga/mqnic/Nexus_K3P_S/fpga_25g/fpga_K3P_app_dma_bench/Makefile index 3960a210a..c08734533 100644 --- a/fpga/mqnic/Nexus_K3P_S/fpga_25g/fpga_app_dma_bench/Makefile +++ b/fpga/mqnic/Nexus_K3P_S/fpga_25g/fpga_K3P_app_dma_bench/Makefile @@ -7,7 +7,7 @@ FPGA_TOP = fpga FPGA_ARCH = kintexuplus # Files for synthesis -SYN_FILES = rtl/fpga.v +SYN_FILES = rtl/fpga_k3p.v SYN_FILES += rtl/fpga_core.v SYN_FILES += rtl/sync_signal.v SYN_FILES += rtl/common/mqnic_core_pcie_us.v @@ -133,7 +133,7 @@ SYN_FILES += lib/pcie/rtl/pcie_us_cfg.v SYN_FILES += lib/pcie/rtl/pulse_merge.v # XDC files -XDC_FILES = fpga.xdc +XDC_FILES = fpga_k3p.xdc XDC_FILES += boot.xdc XDC_FILES += lib/axis/syn/vivado/axis_async_fifo.tcl XDC_FILES += lib/axis/syn/vivado/sync_reset.tcl diff --git a/fpga/mqnic/Nexus_K3P_S/fpga_25g/fpga_app_dma_bench/config.tcl b/fpga/mqnic/Nexus_K3P_S/fpga_25g/fpga_K3P_app_dma_bench/config.tcl similarity index 100% rename from fpga/mqnic/Nexus_K3P_S/fpga_25g/fpga_app_dma_bench/config.tcl rename to fpga/mqnic/Nexus_K3P_S/fpga_25g/fpga_K3P_app_dma_bench/config.tcl diff --git a/fpga/mqnic/Nexus_K35_S/fpga/fpga.xdc b/fpga/mqnic/Nexus_K3P_S/fpga_25g/fpga_k35.xdc similarity index 100% rename from fpga/mqnic/Nexus_K35_S/fpga/fpga.xdc rename to fpga/mqnic/Nexus_K3P_S/fpga_25g/fpga_k35.xdc diff --git a/fpga/mqnic/Nexus_K3P_S/fpga_25g/fpga.xdc b/fpga/mqnic/Nexus_K3P_S/fpga_25g/fpga_k3p.xdc similarity index 100% rename from fpga/mqnic/Nexus_K3P_S/fpga_25g/fpga.xdc rename to fpga/mqnic/Nexus_K3P_S/fpga_25g/fpga_k3p.xdc diff --git a/fpga/mqnic/Nexus_K35_S/fpga/ip/eth_xcvr_gth.tcl b/fpga/mqnic/Nexus_K3P_S/fpga_25g/ip/eth_xcvr_gth.tcl similarity index 100% rename from fpga/mqnic/Nexus_K35_S/fpga/ip/eth_xcvr_gth.tcl rename to fpga/mqnic/Nexus_K3P_S/fpga_25g/ip/eth_xcvr_gth.tcl diff --git a/fpga/mqnic/Nexus_K35_S/fpga/ip/pcie3_ultrascale_0.tcl b/fpga/mqnic/Nexus_K3P_S/fpga_25g/ip/pcie3_ultrascale_0.tcl similarity index 100% rename from fpga/mqnic/Nexus_K35_S/fpga/ip/pcie3_ultrascale_0.tcl rename to fpga/mqnic/Nexus_K3P_S/fpga_25g/ip/pcie3_ultrascale_0.tcl diff --git a/fpga/mqnic/Nexus_K3P_S/fpga_25g/rtl/fpga_core.v b/fpga/mqnic/Nexus_K3P_S/fpga_25g/rtl/fpga_core.v index 1e0033179..1d4d48404 100644 --- a/fpga/mqnic/Nexus_K3P_S/fpga_25g/rtl/fpga_core.v +++ b/fpga/mqnic/Nexus_K3P_S/fpga_25g/rtl/fpga_core.v @@ -26,6 +26,7 @@ module fpga_core # // Board configuration parameter TDMA_BER_ENABLE = 0, + parameter XCVR_DRP_INFO = {8'h09, 8'h03, 8'd0, 8'd2}, // Structural configuration parameter IF_COUNT = 2, @@ -692,7 +693,7 @@ end rb_drp #( .DRP_ADDR_WIDTH(24), .DRP_DATA_WIDTH(16), - .DRP_INFO({8'h09, 8'h03, 8'd0, 8'd2}), + .DRP_INFO(XCVR_DRP_INFO), .REG_ADDR_WIDTH(AXIL_CSR_ADDR_WIDTH), .REG_DATA_WIDTH(AXIL_CTRL_DATA_WIDTH), .REG_STRB_WIDTH(AXIL_CTRL_STRB_WIDTH), diff --git a/fpga/mqnic/Nexus_K35_S/fpga/rtl/fpga.v b/fpga/mqnic/Nexus_K3P_S/fpga_25g/rtl/fpga_k35.v similarity index 95% rename from fpga/mqnic/Nexus_K35_S/fpga/rtl/fpga.v rename to fpga/mqnic/Nexus_K3P_S/fpga_25g/rtl/fpga_k35.v index 88e2a2745..bc16d2647 100644 --- a/fpga/mqnic/Nexus_K35_S/fpga/rtl/fpga.v +++ b/fpga/mqnic/Nexus_K3P_S/fpga_25g/rtl/fpga_k35.v @@ -24,6 +24,9 @@ module fpga # parameter GIT_HASH = 32'hdce357bf, parameter RELEASE_INFO = 32'h00000000, + // Board configuration + parameter TDMA_BER_ENABLE = 0, + // Structural configuration parameter IF_COUNT = 2, parameter PORTS_PER_IF = 1, @@ -833,19 +836,25 @@ wire sfp_1_tx_clk_int; wire sfp_1_tx_rst_int; wire [XGMII_DATA_WIDTH-1:0] sfp_1_txd_int; wire [XGMII_CTRL_WIDTH-1:0] sfp_1_txc_int; +wire sfp_1_cfg_tx_prbs31_enable_int; wire sfp_1_rx_clk_int; wire sfp_1_rx_rst_int; wire [XGMII_DATA_WIDTH-1:0] sfp_1_rxd_int; wire [XGMII_CTRL_WIDTH-1:0] sfp_1_rxc_int; +wire sfp_1_cfg_rx_prbs31_enable_int; +wire [6:0] sfp_1_rx_error_count_int; wire sfp_2_tx_clk_int; wire sfp_2_tx_rst_int; wire [XGMII_DATA_WIDTH-1:0] sfp_2_txd_int; wire [XGMII_CTRL_WIDTH-1:0] sfp_2_txc_int; +wire sfp_2_cfg_tx_prbs31_enable_int; wire sfp_2_rx_clk_int; wire sfp_2_rx_rst_int; wire [XGMII_DATA_WIDTH-1:0] sfp_2_rxd_int; wire [XGMII_CTRL_WIDTH-1:0] sfp_2_rxc_int; +wire sfp_2_cfg_rx_prbs31_enable_int; +wire [6:0] sfp_2_rx_error_count_int; wire sfp_drp_clk = clk_125mhz_int; wire sfp_drp_rst = rst_125mhz_int; @@ -944,14 +953,14 @@ sfp_phy_quad_inst ( .phy_1_xgmii_rxd(sfp_1_rxd_int), .phy_1_xgmii_rxc(sfp_1_rxc_int), .phy_1_tx_bad_block(), - .phy_1_rx_error_count(), + .phy_1_rx_error_count(sfp_1_rx_error_count_int), .phy_1_rx_bad_block(), .phy_1_rx_sequence_error(), .phy_1_rx_block_lock(sfp_1_rx_block_lock), .phy_1_rx_high_ber(), .phy_1_rx_status(sfp_1_rx_status), - .phy_1_cfg_tx_prbs31_enable(1'b0), - .phy_1_cfg_rx_prbs31_enable(1'b0), + .phy_1_cfg_tx_prbs31_enable(sfp_1_cfg_tx_prbs31_enable_int), + .phy_1_cfg_rx_prbs31_enable(sfp_1_cfg_rx_prbs31_enable_int), .phy_2_tx_clk(sfp_2_tx_clk_int), .phy_2_tx_rst(sfp_2_tx_rst_int), @@ -962,14 +971,14 @@ sfp_phy_quad_inst ( .phy_2_xgmii_rxd(sfp_2_rxd_int), .phy_2_xgmii_rxc(sfp_2_rxc_int), .phy_2_tx_bad_block(), - .phy_2_rx_error_count(), + .phy_2_rx_error_count(sfp_2_rx_error_count_int), .phy_2_rx_bad_block(), .phy_2_rx_sequence_error(), .phy_2_rx_block_lock(sfp_2_rx_block_lock), .phy_2_rx_high_ber(), .phy_2_rx_status(sfp_2_rx_status), - .phy_2_cfg_tx_prbs31_enable(1'b0), - .phy_2_cfg_rx_prbs31_enable(1'b0) + .phy_2_cfg_tx_prbs31_enable(sfp_2_cfg_tx_prbs31_enable_int), + .phy_2_cfg_rx_prbs31_enable(sfp_2_cfg_rx_prbs31_enable_int) ); wire ptp_clk; @@ -996,6 +1005,10 @@ fpga_core #( .GIT_HASH(GIT_HASH), .RELEASE_INFO(RELEASE_INFO), + // Board configuration + .TDMA_BER_ENABLE(TDMA_BER_ENABLE), + .XCVR_DRP_INFO({8'h08, 8'h02, 8'd0, 8'd2}), + // Structural configuration .IF_COUNT(IF_COUNT), .PORTS_PER_IF(PORTS_PER_IF), @@ -1183,8 +1196,10 @@ core_inst ( .m_axis_cc_tuser(axis_cc_tuser), .m_axis_cc_tvalid(axis_cc_tvalid), - .s_axis_rq_seq_num(pcie_rq_seq_num), - .s_axis_rq_seq_num_valid(pcie_rq_seq_num_vld), + .s_axis_rq_seq_num_0(pcie_rq_seq_num), + .s_axis_rq_seq_num_valid_0(pcie_rq_seq_num_vld), + .s_axis_rq_seq_num_1(4'd0), + .s_axis_rq_seq_num_valid_1(1'b0), .pcie_tfc_nph_av(pcie_tfc_nph_av), .pcie_tfc_npd_av(pcie_tfc_npd_av), @@ -1193,7 +1208,8 @@ core_inst ( .cfg_max_read_req(cfg_max_read_req), .cfg_rcb_status(cfg_rcb_status), - .cfg_mgmt_addr(cfg_mgmt_addr), + .cfg_mgmt_addr(cfg_mgmt_addr[9:0]), + .cfg_mgmt_function_number(cfg_mgmt_addr[17:10]), .cfg_mgmt_write(cfg_mgmt_write), .cfg_mgmt_write_data(cfg_mgmt_write_data), .cfg_mgmt_byte_enable(cfg_mgmt_byte_enable), @@ -1216,6 +1232,8 @@ core_inst ( .cfg_interrupt_msix_address(cfg_interrupt_msix_address), .cfg_interrupt_msix_data(cfg_interrupt_msix_data), .cfg_interrupt_msix_int(cfg_interrupt_msix_int), + .cfg_interrupt_msix_vec_pending(), + .cfg_interrupt_msix_vec_pending_status(1'b0), .cfg_interrupt_msix_sent(cfg_interrupt_msix_sent), .cfg_interrupt_msix_fail(cfg_interrupt_msix_fail), .cfg_interrupt_msi_function_number(cfg_interrupt_msi_function_number), @@ -1230,10 +1248,13 @@ core_inst ( .sfp_1_tx_rst(sfp_1_tx_rst_int), .sfp_1_txd(sfp_1_txd_int), .sfp_1_txc(sfp_1_txc_int), + .sfp_1_cfg_tx_prbs31_enable(sfp_1_cfg_tx_prbs31_enable_int), .sfp_1_rx_clk(sfp_1_rx_clk_int), .sfp_1_rx_rst(sfp_1_rx_rst_int), .sfp_1_rxd(sfp_1_rxd_int), .sfp_1_rxc(sfp_1_rxc_int), + .sfp_1_cfg_rx_prbs31_enable(sfp_1_cfg_rx_prbs31_enable_int), + .sfp_1_rx_error_count(sfp_1_rx_error_count_int), .sfp_1_rx_status(sfp_1_rx_status), @@ -1241,10 +1262,13 @@ core_inst ( .sfp_2_tx_rst(sfp_2_tx_rst_int), .sfp_2_txd(sfp_2_txd_int), .sfp_2_txc(sfp_2_txc_int), + .sfp_2_cfg_tx_prbs31_enable(sfp_2_cfg_tx_prbs31_enable_int), .sfp_2_rx_clk(sfp_2_rx_clk_int), .sfp_2_rx_rst(sfp_2_rx_rst_int), .sfp_2_rxd(sfp_2_rxd_int), .sfp_2_rxc(sfp_2_rxc_int), + .sfp_2_cfg_rx_prbs31_enable(sfp_2_cfg_rx_prbs31_enable_int), + .sfp_2_rx_error_count(sfp_2_rx_error_count_int), .sfp_2_rx_status(sfp_2_rx_status), @@ -1299,6 +1323,8 @@ core_inst ( .flash_adv_n(flash_adv_n_int) ); +assign cfg_mgmt_addr[18] = 1'b0; + endmodule `resetall diff --git a/fpga/mqnic/Nexus_K3P_S/fpga_25g/rtl/fpga.v b/fpga/mqnic/Nexus_K3P_S/fpga_25g/rtl/fpga_k3p.v similarity index 99% rename from fpga/mqnic/Nexus_K3P_S/fpga_25g/rtl/fpga.v rename to fpga/mqnic/Nexus_K3P_S/fpga_25g/rtl/fpga_k3p.v index 4ab4b18da..e7671a5f0 100644 --- a/fpga/mqnic/Nexus_K3P_S/fpga_25g/rtl/fpga.v +++ b/fpga/mqnic/Nexus_K3P_S/fpga_25g/rtl/fpga_k3p.v @@ -1123,6 +1123,7 @@ fpga_core #( // Board configuration .TDMA_BER_ENABLE(TDMA_BER_ENABLE), + .XCVR_DRP_INFO({8'h09, 8'h03, 8'd0, 8'd2}), // Structural configuration .IF_COUNT(IF_COUNT),