mirror of
https://github.com/corundum/corundum.git
synced 2025-01-30 08:32:52 +08:00
Add mqnic core logic for Stratix 10 GX/SX/TX/MX
This commit is contained in:
parent
dfdf880c3a
commit
bd8a0513ed
884
fpga/common/rtl/mqnic_core_pcie_s10.v
Normal file
884
fpga/common/rtl/mqnic_core_pcie_s10.v
Normal file
@ -0,0 +1,884 @@
|
||||
/*
|
||||
|
||||
Copyright 2021, The Regents of the University of California.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE REGENTS OF THE UNIVERSITY OF CALIFORNIA ''AS
|
||||
IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE REGENTS OF THE UNIVERSITY OF CALIFORNIA OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
OF SUCH DAMAGE.
|
||||
|
||||
The views and conclusions contained in the software and documentation are those
|
||||
of the authors and should not be interpreted as representing official policies,
|
||||
either expressed or implied, of The Regents of the University of California.
|
||||
|
||||
*/
|
||||
|
||||
// Language: Verilog 2001
|
||||
|
||||
`resetall
|
||||
`timescale 1ns / 1ps
|
||||
`default_nettype none
|
||||
|
||||
/*
|
||||
* mqnic core logic - Intel Stratix 10 H-Tile/L-Tile wrapper
|
||||
*/
|
||||
module mqnic_core_pcie_s10 #
|
||||
(
|
||||
// FW and board IDs
|
||||
parameter FW_ID = 32'd0,
|
||||
parameter FW_VER = {16'd0, 16'd1},
|
||||
parameter BOARD_ID = {16'h1234, 16'h0000},
|
||||
parameter BOARD_VER = {16'd0, 16'd1},
|
||||
|
||||
// Structural configuration
|
||||
parameter IF_COUNT = 1,
|
||||
parameter PORTS_PER_IF = 1,
|
||||
|
||||
parameter PORT_COUNT = IF_COUNT*PORTS_PER_IF,
|
||||
|
||||
// PTP configuration
|
||||
parameter PTP_TS_WIDTH = 96,
|
||||
parameter PTP_TAG_WIDTH = 16,
|
||||
parameter PTP_PERIOD_NS_WIDTH = 4,
|
||||
parameter PTP_OFFSET_NS_WIDTH = 32,
|
||||
parameter PTP_FNS_WIDTH = 32,
|
||||
parameter PTP_PERIOD_NS = 4'd4,
|
||||
parameter PTP_PERIOD_FNS = 32'd0,
|
||||
parameter PTP_USE_SAMPLE_CLOCK = 0,
|
||||
parameter PTP_PEROUT_ENABLE = 0,
|
||||
parameter PTP_PEROUT_COUNT = 1,
|
||||
|
||||
// Queue manager configuration (interface)
|
||||
parameter EVENT_QUEUE_OP_TABLE_SIZE = 32,
|
||||
parameter TX_QUEUE_OP_TABLE_SIZE = 32,
|
||||
parameter RX_QUEUE_OP_TABLE_SIZE = 32,
|
||||
parameter TX_CPL_QUEUE_OP_TABLE_SIZE = TX_QUEUE_OP_TABLE_SIZE,
|
||||
parameter RX_CPL_QUEUE_OP_TABLE_SIZE = RX_QUEUE_OP_TABLE_SIZE,
|
||||
parameter TX_QUEUE_INDEX_WIDTH = 13,
|
||||
parameter RX_QUEUE_INDEX_WIDTH = 8,
|
||||
parameter TX_CPL_QUEUE_INDEX_WIDTH = TX_QUEUE_INDEX_WIDTH,
|
||||
parameter RX_CPL_QUEUE_INDEX_WIDTH = RX_QUEUE_INDEX_WIDTH,
|
||||
parameter EVENT_QUEUE_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 TX_CPL_QUEUE_PIPELINE = TX_QUEUE_PIPELINE,
|
||||
parameter RX_CPL_QUEUE_PIPELINE = RX_QUEUE_PIPELINE,
|
||||
|
||||
// TX and RX engine configuration (port)
|
||||
parameter TX_DESC_TABLE_SIZE = 32,
|
||||
parameter RX_DESC_TABLE_SIZE = 32,
|
||||
|
||||
// Scheduler configuration (port)
|
||||
parameter TX_SCHEDULER_OP_TABLE_SIZE = TX_DESC_TABLE_SIZE,
|
||||
parameter TX_SCHEDULER_PIPELINE = TX_QUEUE_PIPELINE,
|
||||
parameter TDMA_INDEX_WIDTH = 6,
|
||||
|
||||
// Timestamping configuration (port)
|
||||
parameter PTP_TS_ENABLE = 1,
|
||||
parameter TX_PTP_TS_FIFO_DEPTH = 32,
|
||||
parameter RX_PTP_TS_FIFO_DEPTH = 32,
|
||||
|
||||
// Interface configuration (port)
|
||||
parameter TX_CHECKSUM_ENABLE = 1,
|
||||
parameter RX_RSS_ENABLE = 1,
|
||||
parameter RX_HASH_ENABLE = 1,
|
||||
parameter RX_CHECKSUM_ENABLE = 1,
|
||||
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_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_LEN_WIDTH = 16,
|
||||
parameter DMA_TAG_WIDTH = 16,
|
||||
parameter RAM_PIPELINE = 2,
|
||||
|
||||
// PCIe interface configuration
|
||||
parameter SEG_COUNT = 1,
|
||||
parameter SEG_DATA_WIDTH = 256,
|
||||
parameter SEG_EMPTY_WIDTH = $clog2(SEG_DATA_WIDTH/32),
|
||||
parameter TX_SEQ_NUM_WIDTH = 6,
|
||||
parameter TX_SEQ_NUM_ENABLE = 1,
|
||||
parameter L_TILE = 0,
|
||||
parameter PF_COUNT = 1,
|
||||
parameter VF_COUNT = 0,
|
||||
parameter F_COUNT = PF_COUNT+VF_COUNT,
|
||||
parameter PCIE_TAG_COUNT = 256,
|
||||
parameter PCIE_DMA_READ_OP_TABLE_SIZE = PCIE_TAG_COUNT,
|
||||
parameter PCIE_DMA_READ_TX_LIMIT = 2**TX_SEQ_NUM_WIDTH,
|
||||
parameter PCIE_DMA_READ_TX_FC_ENABLE = 1,
|
||||
parameter PCIE_DMA_WRITE_OP_TABLE_SIZE = 2**TX_SEQ_NUM_WIDTH,
|
||||
parameter PCIE_DMA_WRITE_TX_LIMIT = 2**TX_SEQ_NUM_WIDTH,
|
||||
parameter PCIE_DMA_WRITE_TX_FC_ENABLE = 1,
|
||||
parameter MSI_COUNT = 32,
|
||||
|
||||
// AXI lite interface configuration (control)
|
||||
parameter AXIL_CTRL_DATA_WIDTH = 32,
|
||||
parameter AXIL_CTRL_ADDR_WIDTH = 24,
|
||||
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),
|
||||
parameter AXIL_CSR_PASSTHROUGH_ENABLE = 0,
|
||||
|
||||
// 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 AXIS_ETH_DATA_WIDTH = 512,
|
||||
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 = (PTP_TS_ENABLE ? PTP_TAG_WIDTH : 0) + 1,
|
||||
parameter AXIS_ETH_RX_USER_WIDTH = (PTP_TS_ENABLE ? PTP_TS_WIDTH : 0) + 1,
|
||||
parameter AXIS_ETH_RX_USE_READY = 0,
|
||||
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
|
||||
)
|
||||
(
|
||||
input wire clk,
|
||||
input wire rst,
|
||||
|
||||
/*
|
||||
* H-Tile/L-Tile RX AVST interface
|
||||
*/
|
||||
input wire [SEG_COUNT*SEG_DATA_WIDTH-1:0] rx_st_data,
|
||||
input wire [SEG_COUNT*SEG_EMPTY_WIDTH-1:0] rx_st_empty,
|
||||
input wire [SEG_COUNT-1:0] rx_st_sop,
|
||||
input wire [SEG_COUNT-1:0] rx_st_eop,
|
||||
input wire [SEG_COUNT-1:0] rx_st_valid,
|
||||
output wire rx_st_ready,
|
||||
input wire [SEG_COUNT-1:0] rx_st_vf_active,
|
||||
input wire [SEG_COUNT*2-1:0] rx_st_func_num,
|
||||
input wire [SEG_COUNT*11-1:0] rx_st_vf_num,
|
||||
input wire [SEG_COUNT*3-1:0] rx_st_bar_range,
|
||||
|
||||
/*
|
||||
* H-Tile/L-Tile TX AVST interface
|
||||
*/
|
||||
output wire [SEG_COUNT*SEG_DATA_WIDTH-1:0] tx_st_data,
|
||||
output wire [SEG_COUNT-1:0] tx_st_sop,
|
||||
output wire [SEG_COUNT-1:0] tx_st_eop,
|
||||
output wire [SEG_COUNT-1:0] tx_st_valid,
|
||||
input wire tx_st_ready,
|
||||
output wire [SEG_COUNT-1:0] tx_st_err,
|
||||
|
||||
/*
|
||||
* H-Tile/L-Tile TX flow control
|
||||
*/
|
||||
input wire [7:0] tx_ph_cdts,
|
||||
input wire [11:0] tx_pd_cdts,
|
||||
input wire [7:0] tx_nph_cdts,
|
||||
input wire [11:0] tx_npd_cdts,
|
||||
input wire [7:0] tx_cplh_cdts,
|
||||
input wire [11:0] tx_cpld_cdts,
|
||||
input wire [SEG_COUNT-1:0] tx_hdr_cdts_consumed,
|
||||
input wire [SEG_COUNT-1:0] tx_data_cdts_consumed,
|
||||
input wire [SEG_COUNT*2-1:0] tx_cdts_type,
|
||||
input wire [SEG_COUNT*1-1:0] tx_cdts_data_value,
|
||||
|
||||
/*
|
||||
* H-Tile/L-Tile MSI interrupt interface
|
||||
*/
|
||||
output wire app_msi_req,
|
||||
input wire app_msi_ack,
|
||||
output wire [2:0] app_msi_tc,
|
||||
output wire [4:0] app_msi_num,
|
||||
output wire [1:0] app_msi_func_num,
|
||||
|
||||
/*
|
||||
* H-Tile/L-Tile configuration interface
|
||||
*/
|
||||
input wire [31:0] tl_cfg_ctl,
|
||||
input wire [4:0] tl_cfg_add,
|
||||
input wire [1:0] tl_cfg_func,
|
||||
|
||||
/*
|
||||
* AXI-Lite master interface (passthrough for NIC control and status)
|
||||
*/
|
||||
output wire [AXIL_CSR_ADDR_WIDTH-1:0] m_axil_csr_awaddr,
|
||||
output wire [2:0] m_axil_csr_awprot,
|
||||
output wire m_axil_csr_awvalid,
|
||||
input wire m_axil_csr_awready,
|
||||
output wire [AXIL_CTRL_DATA_WIDTH-1:0] m_axil_csr_wdata,
|
||||
output wire [AXIL_CTRL_STRB_WIDTH-1:0] m_axil_csr_wstrb,
|
||||
output wire m_axil_csr_wvalid,
|
||||
input wire m_axil_csr_wready,
|
||||
input wire [1:0] m_axil_csr_bresp,
|
||||
input wire m_axil_csr_bvalid,
|
||||
output wire m_axil_csr_bready,
|
||||
output wire [AXIL_CSR_ADDR_WIDTH-1:0] m_axil_csr_araddr,
|
||||
output wire [2:0] m_axil_csr_arprot,
|
||||
output wire m_axil_csr_arvalid,
|
||||
input wire m_axil_csr_arready,
|
||||
input wire [AXIL_CTRL_DATA_WIDTH-1:0] m_axil_csr_rdata,
|
||||
input wire [1:0] m_axil_csr_rresp,
|
||||
input wire m_axil_csr_rvalid,
|
||||
output wire m_axil_csr_rready,
|
||||
|
||||
/*
|
||||
* Control register interface
|
||||
*/
|
||||
output wire [AXIL_CSR_ADDR_WIDTH-1:0] ctrl_reg_wr_addr,
|
||||
output wire [AXIL_CTRL_DATA_WIDTH-1:0] ctrl_reg_wr_data,
|
||||
output wire [AXIL_CTRL_STRB_WIDTH-1:0] ctrl_reg_wr_strb,
|
||||
output wire ctrl_reg_wr_en,
|
||||
input wire ctrl_reg_wr_wait,
|
||||
input wire ctrl_reg_wr_ack,
|
||||
output wire [AXIL_CSR_ADDR_WIDTH-1:0] ctrl_reg_rd_addr,
|
||||
output wire ctrl_reg_rd_en,
|
||||
input wire [AXIL_CTRL_DATA_WIDTH-1:0] ctrl_reg_rd_data,
|
||||
input wire ctrl_reg_rd_wait,
|
||||
input wire ctrl_reg_rd_ack,
|
||||
|
||||
/*
|
||||
* PTP clock
|
||||
*/
|
||||
input wire ptp_sample_clk,
|
||||
output wire ptp_pps,
|
||||
output wire [PTP_TS_WIDTH-1:0] ptp_ts_96,
|
||||
output wire ptp_ts_step,
|
||||
output wire [PTP_PEROUT_COUNT-1:0] ptp_perout_locked,
|
||||
output wire [PTP_PEROUT_COUNT-1:0] ptp_perout_error,
|
||||
output wire [PTP_PEROUT_COUNT-1:0] ptp_perout_pulse,
|
||||
|
||||
/*
|
||||
* Ethernet
|
||||
*/
|
||||
input wire [PORT_COUNT-1:0] eth_tx_clk,
|
||||
input wire [PORT_COUNT-1:0] eth_tx_rst,
|
||||
|
||||
output wire [PORT_COUNT*PTP_TS_WIDTH-1:0] eth_tx_ptp_ts_96,
|
||||
output wire [PORT_COUNT-1:0] eth_tx_ptp_ts_step,
|
||||
|
||||
output wire [PORT_COUNT*AXIS_ETH_DATA_WIDTH-1:0] m_axis_eth_tx_tdata,
|
||||
output wire [PORT_COUNT*AXIS_ETH_KEEP_WIDTH-1:0] m_axis_eth_tx_tkeep,
|
||||
output wire [PORT_COUNT-1:0] m_axis_eth_tx_tvalid,
|
||||
input wire [PORT_COUNT-1:0] m_axis_eth_tx_tready,
|
||||
output wire [PORT_COUNT-1:0] m_axis_eth_tx_tlast,
|
||||
output wire [PORT_COUNT*AXIS_ETH_TX_USER_WIDTH-1:0] m_axis_eth_tx_tuser,
|
||||
|
||||
input wire [PORT_COUNT*PTP_TS_WIDTH-1:0] s_axis_eth_tx_ptp_ts,
|
||||
input wire [PORT_COUNT*PTP_TAG_WIDTH-1:0] s_axis_eth_tx_ptp_ts_tag,
|
||||
input wire [PORT_COUNT-1:0] s_axis_eth_tx_ptp_ts_valid,
|
||||
output wire [PORT_COUNT-1:0] s_axis_eth_tx_ptp_ts_ready,
|
||||
|
||||
input wire [PORT_COUNT-1:0] eth_rx_clk,
|
||||
input wire [PORT_COUNT-1:0] eth_rx_rst,
|
||||
|
||||
output wire [PORT_COUNT*PTP_TS_WIDTH-1:0] eth_rx_ptp_ts_96,
|
||||
output wire [PORT_COUNT-1:0] eth_rx_ptp_ts_step,
|
||||
|
||||
input wire [PORT_COUNT*AXIS_ETH_DATA_WIDTH-1:0] s_axis_eth_rx_tdata,
|
||||
input wire [PORT_COUNT*AXIS_ETH_KEEP_WIDTH-1:0] s_axis_eth_rx_tkeep,
|
||||
input wire [PORT_COUNT-1:0] s_axis_eth_rx_tvalid,
|
||||
output wire [PORT_COUNT-1:0] s_axis_eth_rx_tready,
|
||||
input wire [PORT_COUNT-1:0] s_axis_eth_rx_tlast,
|
||||
input wire [PORT_COUNT*AXIS_ETH_RX_USER_WIDTH-1:0] s_axis_eth_rx_tuser,
|
||||
|
||||
/*
|
||||
* Statistics increment input
|
||||
*/
|
||||
input wire [STAT_INC_WIDTH-1:0] s_axis_stat_tdata,
|
||||
input wire [STAT_ID_WIDTH-1:0] s_axis_stat_tid,
|
||||
input wire s_axis_stat_tvalid,
|
||||
output wire s_axis_stat_tready
|
||||
);
|
||||
|
||||
parameter TLP_SEG_COUNT = 1;
|
||||
parameter TLP_SEG_DATA_WIDTH = (SEG_COUNT*SEG_DATA_WIDTH)/TLP_SEG_COUNT;
|
||||
parameter TLP_SEG_STRB_WIDTH = TLP_SEG_DATA_WIDTH/32;
|
||||
parameter TLP_SEG_HDR_WIDTH = 128;
|
||||
parameter TX_SEQ_NUM_COUNT = SEG_COUNT;
|
||||
|
||||
wire [TLP_SEG_COUNT*TLP_SEG_DATA_WIDTH-1:0] pcie_rx_req_tlp_data;
|
||||
wire [TLP_SEG_COUNT*TLP_SEG_HDR_WIDTH-1:0] pcie_rx_req_tlp_hdr;
|
||||
wire [TLP_SEG_COUNT*3-1:0] pcie_rx_req_tlp_bar_id;
|
||||
wire [TLP_SEG_COUNT*8-1:0] pcie_rx_req_tlp_func_num;
|
||||
wire [TLP_SEG_COUNT-1:0] pcie_rx_req_tlp_valid;
|
||||
wire [TLP_SEG_COUNT-1:0] pcie_rx_req_tlp_sop;
|
||||
wire [TLP_SEG_COUNT-1:0] pcie_rx_req_tlp_eop;
|
||||
wire pcie_rx_req_tlp_ready;
|
||||
|
||||
wire [TLP_SEG_COUNT*TLP_SEG_DATA_WIDTH-1:0] pcie_rx_cpl_tlp_data;
|
||||
wire [TLP_SEG_COUNT*TLP_SEG_HDR_WIDTH-1:0] pcie_rx_cpl_tlp_hdr;
|
||||
wire [TLP_SEG_COUNT*4-1:0] pcie_rx_cpl_tlp_error;
|
||||
wire [TLP_SEG_COUNT-1:0] pcie_rx_cpl_tlp_valid;
|
||||
wire [TLP_SEG_COUNT-1:0] pcie_rx_cpl_tlp_sop;
|
||||
wire [TLP_SEG_COUNT-1:0] pcie_rx_cpl_tlp_eop;
|
||||
wire pcie_rx_cpl_tlp_ready;
|
||||
|
||||
wire [TLP_SEG_COUNT*TLP_SEG_HDR_WIDTH-1:0] pcie_tx_rd_req_tlp_hdr;
|
||||
wire [TLP_SEG_COUNT*TX_SEQ_NUM_WIDTH-1:0] pcie_tx_rd_req_tlp_seq;
|
||||
wire [TLP_SEG_COUNT-1:0] pcie_tx_rd_req_tlp_valid;
|
||||
wire [TLP_SEG_COUNT-1:0] pcie_tx_rd_req_tlp_sop;
|
||||
wire [TLP_SEG_COUNT-1:0] pcie_tx_rd_req_tlp_eop;
|
||||
wire pcie_tx_rd_req_tlp_ready;
|
||||
|
||||
wire [TX_SEQ_NUM_COUNT*TX_SEQ_NUM_WIDTH-1:0] pcie_rd_req_tx_seq_num;
|
||||
wire [TX_SEQ_NUM_COUNT-1:0] pcie_rd_req_tx_seq_num_valid;
|
||||
|
||||
wire [TLP_SEG_COUNT*TLP_SEG_DATA_WIDTH-1:0] pcie_tx_wr_req_tlp_data;
|
||||
wire [TLP_SEG_COUNT*TLP_SEG_STRB_WIDTH-1:0] pcie_tx_wr_req_tlp_strb;
|
||||
wire [TLP_SEG_COUNT*TLP_SEG_HDR_WIDTH-1:0] pcie_tx_wr_req_tlp_hdr;
|
||||
wire [TLP_SEG_COUNT*TX_SEQ_NUM_WIDTH-1:0] pcie_tx_wr_req_tlp_seq;
|
||||
wire [TLP_SEG_COUNT-1:0] pcie_tx_wr_req_tlp_valid;
|
||||
wire [TLP_SEG_COUNT-1:0] pcie_tx_wr_req_tlp_sop;
|
||||
wire [TLP_SEG_COUNT-1:0] pcie_tx_wr_req_tlp_eop;
|
||||
wire pcie_tx_wr_req_tlp_ready;
|
||||
|
||||
wire [TX_SEQ_NUM_COUNT*TX_SEQ_NUM_WIDTH-1:0] pcie_wr_req_tx_seq_num;
|
||||
wire [TX_SEQ_NUM_COUNT-1:0] pcie_wr_req_tx_seq_num_valid;
|
||||
|
||||
wire [TLP_SEG_COUNT*TLP_SEG_DATA_WIDTH-1:0] pcie_tx_cpl_tlp_data;
|
||||
wire [TLP_SEG_COUNT*TLP_SEG_STRB_WIDTH-1:0] pcie_tx_cpl_tlp_strb;
|
||||
wire [TLP_SEG_COUNT*TLP_SEG_HDR_WIDTH-1:0] pcie_tx_cpl_tlp_hdr;
|
||||
wire [TLP_SEG_COUNT-1:0] pcie_tx_cpl_tlp_valid;
|
||||
wire [TLP_SEG_COUNT-1:0] pcie_tx_cpl_tlp_sop;
|
||||
wire [TLP_SEG_COUNT-1:0] pcie_tx_cpl_tlp_eop;
|
||||
wire pcie_tx_cpl_tlp_ready;
|
||||
|
||||
wire [7:0] pcie_tx_fc_ph_av;
|
||||
wire [11:0] pcie_tx_fc_pd_av;
|
||||
wire [7:0] pcie_tx_fc_nph_av;
|
||||
|
||||
wire [F_COUNT-1:0] ext_tag_enable;
|
||||
wire [7:0] bus_num;
|
||||
wire [F_COUNT*3-1:0] max_read_request_size;
|
||||
wire [F_COUNT*3-1:0] max_payload_size;
|
||||
|
||||
wire [MSI_COUNT-1:0] msi_irq;
|
||||
|
||||
pcie_s10_if #(
|
||||
.SEG_COUNT(SEG_COUNT),
|
||||
.SEG_DATA_WIDTH(SEG_DATA_WIDTH),
|
||||
.SEG_EMPTY_WIDTH(SEG_EMPTY_WIDTH),
|
||||
.TLP_SEG_COUNT(TLP_SEG_COUNT),
|
||||
.TLP_SEG_DATA_WIDTH(TLP_SEG_DATA_WIDTH),
|
||||
.TLP_SEG_STRB_WIDTH(TLP_SEG_STRB_WIDTH),
|
||||
.TLP_SEG_HDR_WIDTH(TLP_SEG_HDR_WIDTH),
|
||||
.TX_SEQ_NUM_WIDTH(TX_SEQ_NUM_WIDTH),
|
||||
.L_TILE(L_TILE),
|
||||
.PF_COUNT(1),
|
||||
.VF_COUNT(0),
|
||||
.F_COUNT(PF_COUNT+VF_COUNT),
|
||||
.IO_BAR_INDEX(5),
|
||||
.MSI_ENABLE(1),
|
||||
.MSI_COUNT(MSI_COUNT)
|
||||
)
|
||||
pcie_s10_if_inst (
|
||||
.clk(clk),
|
||||
.rst(rst),
|
||||
|
||||
/*
|
||||
* H-Tile/L-Tile RX AVST interface
|
||||
*/
|
||||
.rx_st_data(rx_st_data),
|
||||
.rx_st_empty(rx_st_empty),
|
||||
.rx_st_sop(rx_st_sop),
|
||||
.rx_st_eop(rx_st_eop),
|
||||
.rx_st_valid(rx_st_valid),
|
||||
.rx_st_ready(rx_st_ready),
|
||||
.rx_st_vf_active(rx_st_vf_active),
|
||||
.rx_st_func_num(rx_st_func_num),
|
||||
.rx_st_vf_num(rx_st_vf_num),
|
||||
.rx_st_bar_range(rx_st_bar_range),
|
||||
|
||||
/*
|
||||
* H-Tile/L-Tile TX AVST interface
|
||||
*/
|
||||
.tx_st_data(tx_st_data),
|
||||
.tx_st_sop(tx_st_sop),
|
||||
.tx_st_eop(tx_st_eop),
|
||||
.tx_st_valid(tx_st_valid),
|
||||
.tx_st_ready(tx_st_ready),
|
||||
.tx_st_err(tx_st_err),
|
||||
|
||||
/*
|
||||
* H-Tile/L-Tile TX flow control
|
||||
*/
|
||||
.tx_ph_cdts(tx_ph_cdts),
|
||||
.tx_pd_cdts(tx_pd_cdts),
|
||||
.tx_nph_cdts(tx_nph_cdts),
|
||||
.tx_npd_cdts(tx_npd_cdts),
|
||||
.tx_cplh_cdts(tx_cplh_cdts),
|
||||
.tx_cpld_cdts(tx_cpld_cdts),
|
||||
.tx_hdr_cdts_consumed(tx_hdr_cdts_consumed),
|
||||
.tx_data_cdts_consumed(tx_data_cdts_consumed),
|
||||
.tx_cdts_type(tx_cdts_type),
|
||||
.tx_cdts_data_value(tx_cdts_data_value),
|
||||
|
||||
/*
|
||||
* H-Tile/L-Tile MSI interrupt interface
|
||||
*/
|
||||
.app_msi_req(app_msi_req),
|
||||
.app_msi_ack(app_msi_ack),
|
||||
.app_msi_tc(app_msi_tc),
|
||||
.app_msi_num(app_msi_num),
|
||||
.app_msi_func_num(app_msi_func_num),
|
||||
|
||||
/*
|
||||
* H-Tile/L-Tile configuration interface
|
||||
*/
|
||||
.tl_cfg_ctl(tl_cfg_ctl),
|
||||
.tl_cfg_add(tl_cfg_add),
|
||||
.tl_cfg_func(tl_cfg_func),
|
||||
|
||||
/*
|
||||
* TLP output (request to BAR)
|
||||
*/
|
||||
.rx_req_tlp_data(pcie_rx_req_tlp_data),
|
||||
.rx_req_tlp_hdr(pcie_rx_req_tlp_hdr),
|
||||
.rx_req_tlp_bar_id(pcie_rx_req_tlp_bar_id),
|
||||
.rx_req_tlp_func_num(pcie_rx_req_tlp_func_num),
|
||||
.rx_req_tlp_valid(pcie_rx_req_tlp_valid),
|
||||
.rx_req_tlp_sop(pcie_rx_req_tlp_sop),
|
||||
.rx_req_tlp_eop(pcie_rx_req_tlp_eop),
|
||||
.rx_req_tlp_ready(pcie_rx_req_tlp_ready),
|
||||
|
||||
/*
|
||||
* TLP output (completion to DMA)
|
||||
*/
|
||||
.rx_cpl_tlp_data(pcie_rx_cpl_tlp_data),
|
||||
.rx_cpl_tlp_hdr(pcie_rx_cpl_tlp_hdr),
|
||||
.rx_cpl_tlp_error(pcie_rx_cpl_tlp_error),
|
||||
.rx_cpl_tlp_valid(pcie_rx_cpl_tlp_valid),
|
||||
.rx_cpl_tlp_sop(pcie_rx_cpl_tlp_sop),
|
||||
.rx_cpl_tlp_eop(pcie_rx_cpl_tlp_eop),
|
||||
.rx_cpl_tlp_ready(pcie_rx_cpl_tlp_ready),
|
||||
|
||||
/*
|
||||
* TLP input (read request from DMA)
|
||||
*/
|
||||
.tx_rd_req_tlp_hdr(pcie_tx_rd_req_tlp_hdr),
|
||||
.tx_rd_req_tlp_seq(pcie_tx_rd_req_tlp_seq),
|
||||
.tx_rd_req_tlp_valid(pcie_tx_rd_req_tlp_valid),
|
||||
.tx_rd_req_tlp_sop(pcie_tx_rd_req_tlp_sop),
|
||||
.tx_rd_req_tlp_eop(pcie_tx_rd_req_tlp_eop),
|
||||
.tx_rd_req_tlp_ready(pcie_tx_rd_req_tlp_ready),
|
||||
|
||||
/*
|
||||
* Transmit sequence number output (DMA read request)
|
||||
*/
|
||||
.m_axis_rd_req_tx_seq_num(pcie_rd_req_tx_seq_num),
|
||||
.m_axis_rd_req_tx_seq_num_valid(pcie_rd_req_tx_seq_num_valid),
|
||||
|
||||
/*
|
||||
* TLP input (write request from DMA)
|
||||
*/
|
||||
.tx_wr_req_tlp_data(pcie_tx_wr_req_tlp_data),
|
||||
.tx_wr_req_tlp_strb(pcie_tx_wr_req_tlp_strb),
|
||||
.tx_wr_req_tlp_hdr(pcie_tx_wr_req_tlp_hdr),
|
||||
.tx_wr_req_tlp_seq(pcie_tx_wr_req_tlp_seq),
|
||||
.tx_wr_req_tlp_valid(pcie_tx_wr_req_tlp_valid),
|
||||
.tx_wr_req_tlp_sop(pcie_tx_wr_req_tlp_sop),
|
||||
.tx_wr_req_tlp_eop(pcie_tx_wr_req_tlp_eop),
|
||||
.tx_wr_req_tlp_ready(pcie_tx_wr_req_tlp_ready),
|
||||
|
||||
/*
|
||||
* Transmit sequence number output (DMA write request)
|
||||
*/
|
||||
.m_axis_wr_req_tx_seq_num(pcie_wr_req_tx_seq_num),
|
||||
.m_axis_wr_req_tx_seq_num_valid(pcie_wr_req_tx_seq_num_valid),
|
||||
|
||||
/*
|
||||
* TLP input (completion from BAR)
|
||||
*/
|
||||
.tx_cpl_tlp_data(pcie_tx_cpl_tlp_data),
|
||||
.tx_cpl_tlp_strb(pcie_tx_cpl_tlp_strb),
|
||||
.tx_cpl_tlp_hdr(pcie_tx_cpl_tlp_hdr),
|
||||
.tx_cpl_tlp_valid(pcie_tx_cpl_tlp_valid),
|
||||
.tx_cpl_tlp_sop(pcie_tx_cpl_tlp_sop),
|
||||
.tx_cpl_tlp_eop(pcie_tx_cpl_tlp_eop),
|
||||
.tx_cpl_tlp_ready(pcie_tx_cpl_tlp_ready),
|
||||
|
||||
/*
|
||||
* Flow control
|
||||
*/
|
||||
.tx_fc_ph_av(pcie_tx_fc_ph_av),
|
||||
.tx_fc_pd_av(pcie_tx_fc_pd_av),
|
||||
.tx_fc_nph_av(pcie_tx_fc_nph_av),
|
||||
.tx_fc_npd_av(),
|
||||
.tx_fc_cplh_av(),
|
||||
.tx_fc_cpld_av(),
|
||||
|
||||
/*
|
||||
* Configuration outputs
|
||||
*/
|
||||
.ext_tag_enable(ext_tag_enable),
|
||||
.bus_num(bus_num),
|
||||
.max_read_request_size(max_read_request_size),
|
||||
.max_payload_size(max_payload_size),
|
||||
|
||||
/*
|
||||
* MSI request inputs
|
||||
*/
|
||||
.msi_irq(msi_irq)
|
||||
);
|
||||
|
||||
mqnic_core_pcie #(
|
||||
// FW and board IDs
|
||||
.FW_ID(FW_ID),
|
||||
.FW_VER(FW_VER),
|
||||
.BOARD_ID(BOARD_ID),
|
||||
.BOARD_VER(BOARD_VER),
|
||||
|
||||
// Structural configuration
|
||||
.IF_COUNT(IF_COUNT),
|
||||
.PORTS_PER_IF(PORTS_PER_IF),
|
||||
|
||||
.PORT_COUNT(PORT_COUNT),
|
||||
|
||||
// PTP configuration
|
||||
.PTP_TS_WIDTH(PTP_TS_WIDTH),
|
||||
.PTP_TAG_WIDTH(PTP_TAG_WIDTH),
|
||||
.PTP_PERIOD_NS_WIDTH(PTP_PERIOD_NS_WIDTH),
|
||||
.PTP_OFFSET_NS_WIDTH(PTP_OFFSET_NS_WIDTH),
|
||||
.PTP_FNS_WIDTH(PTP_FNS_WIDTH),
|
||||
.PTP_PERIOD_NS(PTP_PERIOD_NS),
|
||||
.PTP_PERIOD_FNS(PTP_PERIOD_FNS),
|
||||
.PTP_USE_SAMPLE_CLOCK(PTP_USE_SAMPLE_CLOCK),
|
||||
.PTP_PEROUT_ENABLE(PTP_PEROUT_ENABLE),
|
||||
.PTP_PEROUT_COUNT(PTP_PEROUT_COUNT),
|
||||
|
||||
// Queue manager configuration (interface)
|
||||
.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),
|
||||
.TX_CPL_QUEUE_OP_TABLE_SIZE(TX_CPL_QUEUE_OP_TABLE_SIZE),
|
||||
.RX_CPL_QUEUE_OP_TABLE_SIZE(RX_CPL_QUEUE_OP_TABLE_SIZE),
|
||||
.TX_QUEUE_INDEX_WIDTH(TX_QUEUE_INDEX_WIDTH),
|
||||
.RX_QUEUE_INDEX_WIDTH(RX_QUEUE_INDEX_WIDTH),
|
||||
.TX_CPL_QUEUE_INDEX_WIDTH(TX_CPL_QUEUE_INDEX_WIDTH),
|
||||
.RX_CPL_QUEUE_INDEX_WIDTH(RX_CPL_QUEUE_INDEX_WIDTH),
|
||||
.EVENT_QUEUE_PIPELINE(EVENT_QUEUE_PIPELINE),
|
||||
.TX_QUEUE_PIPELINE(TX_QUEUE_PIPELINE),
|
||||
.RX_QUEUE_PIPELINE(RX_QUEUE_PIPELINE),
|
||||
.TX_CPL_QUEUE_PIPELINE(TX_CPL_QUEUE_PIPELINE),
|
||||
.RX_CPL_QUEUE_PIPELINE(RX_CPL_QUEUE_PIPELINE),
|
||||
|
||||
// TX and RX engine configuration (port)
|
||||
.TX_DESC_TABLE_SIZE(TX_DESC_TABLE_SIZE),
|
||||
.RX_DESC_TABLE_SIZE(RX_DESC_TABLE_SIZE),
|
||||
|
||||
// Scheduler configuration (port)
|
||||
.TX_SCHEDULER_OP_TABLE_SIZE(TX_SCHEDULER_OP_TABLE_SIZE),
|
||||
.TX_SCHEDULER_PIPELINE(TX_SCHEDULER_PIPELINE),
|
||||
.TDMA_INDEX_WIDTH(TDMA_INDEX_WIDTH),
|
||||
|
||||
// Timestamping configuration (port)
|
||||
.PTP_TS_ENABLE(PTP_TS_ENABLE),
|
||||
.TX_PTP_TS_FIFO_DEPTH(TX_PTP_TS_FIFO_DEPTH),
|
||||
.RX_PTP_TS_FIFO_DEPTH(RX_PTP_TS_FIFO_DEPTH),
|
||||
|
||||
// Interface configuration (port)
|
||||
.TX_CHECKSUM_ENABLE(TX_CHECKSUM_ENABLE),
|
||||
.RX_RSS_ENABLE(RX_RSS_ENABLE),
|
||||
.RX_HASH_ENABLE(RX_HASH_ENABLE),
|
||||
.RX_CHECKSUM_ENABLE(RX_CHECKSUM_ENABLE),
|
||||
.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),
|
||||
|
||||
// Application block configuration
|
||||
.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),
|
||||
|
||||
// DMA interface configuration
|
||||
.DMA_LEN_WIDTH(DMA_LEN_WIDTH),
|
||||
.DMA_TAG_WIDTH(DMA_TAG_WIDTH),
|
||||
.RAM_PIPELINE(RAM_PIPELINE),
|
||||
|
||||
// PCIe interface configuration
|
||||
.TLP_SEG_COUNT(TLP_SEG_COUNT),
|
||||
.TLP_SEG_DATA_WIDTH(TLP_SEG_DATA_WIDTH),
|
||||
.TLP_SEG_STRB_WIDTH(TLP_SEG_STRB_WIDTH),
|
||||
.TLP_SEG_HDR_WIDTH(TLP_SEG_HDR_WIDTH),
|
||||
.TX_SEQ_NUM_COUNT(TX_SEQ_NUM_COUNT),
|
||||
.TX_SEQ_NUM_WIDTH(TX_SEQ_NUM_WIDTH),
|
||||
.TX_SEQ_NUM_ENABLE(1),
|
||||
.PF_COUNT(PF_COUNT),
|
||||
.VF_COUNT(VF_COUNT),
|
||||
.F_COUNT(F_COUNT),
|
||||
.PCIE_TAG_COUNT(PCIE_TAG_COUNT),
|
||||
.PCIE_DMA_READ_OP_TABLE_SIZE(PCIE_DMA_READ_OP_TABLE_SIZE),
|
||||
.PCIE_DMA_READ_TX_LIMIT(PCIE_DMA_READ_TX_LIMIT),
|
||||
.PCIE_DMA_READ_TX_FC_ENABLE(PCIE_DMA_READ_TX_FC_ENABLE),
|
||||
.PCIE_DMA_WRITE_OP_TABLE_SIZE(PCIE_DMA_WRITE_OP_TABLE_SIZE),
|
||||
.PCIE_DMA_WRITE_TX_LIMIT(PCIE_DMA_WRITE_TX_LIMIT),
|
||||
.PCIE_DMA_WRITE_TX_FC_ENABLE(PCIE_DMA_WRITE_TX_FC_ENABLE),
|
||||
.TLP_FORCE_64_BIT_ADDR(0),
|
||||
.CHECK_BUS_NUMBER(1),
|
||||
.MSI_COUNT(MSI_COUNT),
|
||||
|
||||
// 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(AXIL_CSR_PASSTHROUGH_ENABLE),
|
||||
|
||||
// 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_DATA_WIDTH(AXIS_ETH_DATA_WIDTH),
|
||||
.AXIS_KEEP_WIDTH(AXIS_ETH_KEEP_WIDTH),
|
||||
.AXIS_SYNC_DATA_WIDTH(AXIS_ETH_SYNC_DATA_WIDTH),
|
||||
.AXIS_TX_USER_WIDTH(AXIS_ETH_TX_USER_WIDTH),
|
||||
.AXIS_RX_USER_WIDTH(AXIS_ETH_RX_USER_WIDTH),
|
||||
.AXIS_RX_USE_READY(AXIS_ETH_RX_USE_READY),
|
||||
.AXIS_TX_PIPELINE(AXIS_ETH_TX_PIPELINE),
|
||||
.AXIS_TX_FIFO_PIPELINE(AXIS_ETH_TX_FIFO_PIPELINE),
|
||||
.AXIS_TX_TS_PIPELINE(AXIS_ETH_TX_TS_PIPELINE),
|
||||
.AXIS_RX_PIPELINE(AXIS_ETH_RX_PIPELINE),
|
||||
.AXIS_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_pcie_inst (
|
||||
.clk(clk),
|
||||
.rst(rst),
|
||||
|
||||
/*
|
||||
* TLP input (request to BAR)
|
||||
*/
|
||||
.pcie_rx_req_tlp_data(pcie_rx_req_tlp_data),
|
||||
.pcie_rx_req_tlp_hdr(pcie_rx_req_tlp_hdr),
|
||||
.pcie_rx_req_tlp_bar_id(pcie_rx_req_tlp_bar_id),
|
||||
.pcie_rx_req_tlp_func_num(pcie_rx_req_tlp_func_num),
|
||||
.pcie_rx_req_tlp_valid(pcie_rx_req_tlp_valid),
|
||||
.pcie_rx_req_tlp_sop(pcie_rx_req_tlp_sop),
|
||||
.pcie_rx_req_tlp_eop(pcie_rx_req_tlp_eop),
|
||||
.pcie_rx_req_tlp_ready(pcie_rx_req_tlp_ready),
|
||||
|
||||
/*
|
||||
* TLP input (completion to DMA)
|
||||
*/
|
||||
.pcie_rx_cpl_tlp_data(pcie_rx_cpl_tlp_data),
|
||||
.pcie_rx_cpl_tlp_hdr(pcie_rx_cpl_tlp_hdr),
|
||||
.pcie_rx_cpl_tlp_error(pcie_rx_cpl_tlp_error),
|
||||
.pcie_rx_cpl_tlp_valid(pcie_rx_cpl_tlp_valid),
|
||||
.pcie_rx_cpl_tlp_sop(pcie_rx_cpl_tlp_sop),
|
||||
.pcie_rx_cpl_tlp_eop(pcie_rx_cpl_tlp_eop),
|
||||
.pcie_rx_cpl_tlp_ready(pcie_rx_cpl_tlp_ready),
|
||||
|
||||
/*
|
||||
* TLP output (read request from DMA)
|
||||
*/
|
||||
.pcie_tx_rd_req_tlp_hdr(pcie_tx_rd_req_tlp_hdr),
|
||||
.pcie_tx_rd_req_tlp_seq(pcie_tx_rd_req_tlp_seq),
|
||||
.pcie_tx_rd_req_tlp_valid(pcie_tx_rd_req_tlp_valid),
|
||||
.pcie_tx_rd_req_tlp_sop(pcie_tx_rd_req_tlp_sop),
|
||||
.pcie_tx_rd_req_tlp_eop(pcie_tx_rd_req_tlp_eop),
|
||||
.pcie_tx_rd_req_tlp_ready(pcie_tx_rd_req_tlp_ready),
|
||||
|
||||
/*
|
||||
* Transmit sequence number input (DMA read request)
|
||||
*/
|
||||
.s_axis_pcie_rd_req_tx_seq_num(pcie_rd_req_tx_seq_num),
|
||||
.s_axis_pcie_rd_req_tx_seq_num_valid(pcie_rd_req_tx_seq_num_valid),
|
||||
|
||||
/*
|
||||
* TLP output (write request from DMA)
|
||||
*/
|
||||
.pcie_tx_wr_req_tlp_data(pcie_tx_wr_req_tlp_data),
|
||||
.pcie_tx_wr_req_tlp_strb(pcie_tx_wr_req_tlp_strb),
|
||||
.pcie_tx_wr_req_tlp_hdr(pcie_tx_wr_req_tlp_hdr),
|
||||
.pcie_tx_wr_req_tlp_seq(pcie_tx_wr_req_tlp_seq),
|
||||
.pcie_tx_wr_req_tlp_valid(pcie_tx_wr_req_tlp_valid),
|
||||
.pcie_tx_wr_req_tlp_sop(pcie_tx_wr_req_tlp_sop),
|
||||
.pcie_tx_wr_req_tlp_eop(pcie_tx_wr_req_tlp_eop),
|
||||
.pcie_tx_wr_req_tlp_ready(pcie_tx_wr_req_tlp_ready),
|
||||
|
||||
/*
|
||||
* Transmit sequence number input (DMA write request)
|
||||
*/
|
||||
.s_axis_pcie_wr_req_tx_seq_num(pcie_wr_req_tx_seq_num),
|
||||
.s_axis_pcie_wr_req_tx_seq_num_valid(pcie_wr_req_tx_seq_num_valid),
|
||||
|
||||
/*
|
||||
* TLP output (completion from BAR)
|
||||
*/
|
||||
.pcie_tx_cpl_tlp_data(pcie_tx_cpl_tlp_data),
|
||||
.pcie_tx_cpl_tlp_strb(pcie_tx_cpl_tlp_strb),
|
||||
.pcie_tx_cpl_tlp_hdr(pcie_tx_cpl_tlp_hdr),
|
||||
.pcie_tx_cpl_tlp_valid(pcie_tx_cpl_tlp_valid),
|
||||
.pcie_tx_cpl_tlp_sop(pcie_tx_cpl_tlp_sop),
|
||||
.pcie_tx_cpl_tlp_eop(pcie_tx_cpl_tlp_eop),
|
||||
.pcie_tx_cpl_tlp_ready(pcie_tx_cpl_tlp_ready),
|
||||
|
||||
/*
|
||||
* Flow control credits
|
||||
*/
|
||||
.pcie_tx_fc_ph_av(pcie_tx_fc_ph_av),
|
||||
.pcie_tx_fc_pd_av(pcie_tx_fc_pd_av),
|
||||
.pcie_tx_fc_nph_av(pcie_tx_fc_nph_av),
|
||||
|
||||
/*
|
||||
* Configuration inputs
|
||||
*/
|
||||
.bus_num(bus_num),
|
||||
.ext_tag_enable(ext_tag_enable),
|
||||
.max_read_request_size(max_read_request_size),
|
||||
.max_payload_size(max_payload_size),
|
||||
|
||||
/*
|
||||
* PCIe error outputs
|
||||
*/
|
||||
.pcie_error_cor(),
|
||||
.pcie_error_uncor(),
|
||||
|
||||
/*
|
||||
* AXI-Lite master interface (passthrough for NIC control and status)
|
||||
*/
|
||||
.m_axil_csr_awaddr(m_axil_csr_awaddr),
|
||||
.m_axil_csr_awprot(m_axil_csr_awprot),
|
||||
.m_axil_csr_awvalid(m_axil_csr_awvalid),
|
||||
.m_axil_csr_awready(m_axil_csr_awready),
|
||||
.m_axil_csr_wdata(m_axil_csr_wdata),
|
||||
.m_axil_csr_wstrb(m_axil_csr_wstrb),
|
||||
.m_axil_csr_wvalid(m_axil_csr_wvalid),
|
||||
.m_axil_csr_wready(m_axil_csr_wready),
|
||||
.m_axil_csr_bresp(m_axil_csr_bresp),
|
||||
.m_axil_csr_bvalid(m_axil_csr_bvalid),
|
||||
.m_axil_csr_bready(m_axil_csr_bready),
|
||||
.m_axil_csr_araddr(m_axil_csr_araddr),
|
||||
.m_axil_csr_arprot(m_axil_csr_arprot),
|
||||
.m_axil_csr_arvalid(m_axil_csr_arvalid),
|
||||
.m_axil_csr_arready(m_axil_csr_arready),
|
||||
.m_axil_csr_rdata(m_axil_csr_rdata),
|
||||
.m_axil_csr_rresp(m_axil_csr_rresp),
|
||||
.m_axil_csr_rvalid(m_axil_csr_rvalid),
|
||||
.m_axil_csr_rready(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),
|
||||
|
||||
/*
|
||||
* MSI request outputs
|
||||
*/
|
||||
.msi_irq(msi_irq),
|
||||
|
||||
/*
|
||||
* PTP clock
|
||||
*/
|
||||
.ptp_sample_clk(ptp_sample_clk),
|
||||
.ptp_pps(ptp_pps),
|
||||
.ptp_ts_96(ptp_ts_96),
|
||||
.ptp_ts_step(ptp_ts_step),
|
||||
.ptp_perout_locked(ptp_perout_locked),
|
||||
.ptp_perout_error(ptp_perout_error),
|
||||
.ptp_perout_pulse(ptp_perout_pulse),
|
||||
|
||||
/*
|
||||
* Ethernet
|
||||
*/
|
||||
.tx_clk(eth_tx_clk),
|
||||
.tx_rst(eth_tx_rst),
|
||||
|
||||
.tx_ptp_ts_96(eth_tx_ptp_ts_96),
|
||||
.tx_ptp_ts_step(eth_tx_ptp_ts_step),
|
||||
|
||||
.m_axis_tx_tdata(m_axis_eth_tx_tdata),
|
||||
.m_axis_tx_tkeep(m_axis_eth_tx_tkeep),
|
||||
.m_axis_tx_tvalid(m_axis_eth_tx_tvalid),
|
||||
.m_axis_tx_tready(m_axis_eth_tx_tready),
|
||||
.m_axis_tx_tlast(m_axis_eth_tx_tlast),
|
||||
.m_axis_tx_tuser(m_axis_eth_tx_tuser),
|
||||
|
||||
.s_axis_tx_ptp_ts(s_axis_eth_tx_ptp_ts),
|
||||
.s_axis_tx_ptp_ts_tag(s_axis_eth_tx_ptp_ts_tag),
|
||||
.s_axis_tx_ptp_ts_valid(s_axis_eth_tx_ptp_ts_valid),
|
||||
.s_axis_tx_ptp_ts_ready(s_axis_eth_tx_ptp_ts_ready),
|
||||
|
||||
.rx_clk(eth_rx_clk),
|
||||
.rx_rst(eth_rx_rst),
|
||||
|
||||
.rx_ptp_ts_96(eth_rx_ptp_ts_96),
|
||||
.rx_ptp_ts_step(eth_rx_ptp_ts_step),
|
||||
|
||||
.s_axis_rx_tdata(s_axis_eth_rx_tdata),
|
||||
.s_axis_rx_tkeep(s_axis_eth_rx_tkeep),
|
||||
.s_axis_rx_tvalid(s_axis_eth_rx_tvalid),
|
||||
.s_axis_rx_tready(s_axis_eth_rx_tready),
|
||||
.s_axis_rx_tlast(s_axis_eth_rx_tlast),
|
||||
.s_axis_rx_tuser(s_axis_eth_rx_tuser),
|
||||
|
||||
/*
|
||||
* Statistics input
|
||||
*/
|
||||
.s_axis_stat_tdata(s_axis_stat_tdata),
|
||||
.s_axis_stat_tid(s_axis_stat_tid),
|
||||
.s_axis_stat_tvalid(s_axis_stat_tvalid),
|
||||
.s_axis_stat_tready(s_axis_stat_tready)
|
||||
);
|
||||
|
||||
endmodule
|
||||
|
||||
`resetall
|
416
fpga/common/tb/mqnic_core_pcie_s10/Makefile
Normal file
416
fpga/common/tb/mqnic_core_pcie_s10/Makefile
Normal file
@ -0,0 +1,416 @@
|
||||
# Copyright 2021, The Regents of the University of California.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
#
|
||||
# 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
# this list of conditions and the following disclaimer in the documentation
|
||||
# and/or other materials provided with the distribution.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE REGENTS OF THE UNIVERSITY OF CALIFORNIA ''AS
|
||||
# IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
# DISCLAIMED. IN NO EVENT SHALL THE REGENTS OF THE UNIVERSITY OF CALIFORNIA OR
|
||||
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
# OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
# OF SUCH DAMAGE.
|
||||
#
|
||||
# The views and conclusions contained in the software and documentation are those
|
||||
# of the authors and should not be interpreted as representing official policies,
|
||||
# either expressed or implied, of The Regents of the University of California.
|
||||
|
||||
TOPLEVEL_LANG = verilog
|
||||
|
||||
SIM ?= icarus
|
||||
WAVES ?= 0
|
||||
|
||||
COCOTB_HDL_TIMEUNIT = 1ns
|
||||
COCOTB_HDL_TIMEPRECISION = 1ps
|
||||
|
||||
DUT = mqnic_core_pcie_s10
|
||||
TOPLEVEL = $(DUT)
|
||||
MODULE = test_$(DUT)
|
||||
VERILOG_SOURCES += ../../rtl/$(DUT).v
|
||||
VERILOG_SOURCES += ../../rtl/mqnic_core_pcie.v
|
||||
VERILOG_SOURCES += ../../rtl/mqnic_core.v
|
||||
VERILOG_SOURCES += ../../rtl/mqnic_interface.v
|
||||
VERILOG_SOURCES += ../../rtl/mqnic_port.v
|
||||
VERILOG_SOURCES += ../../rtl/mqnic_ptp.v
|
||||
VERILOG_SOURCES += ../../rtl/mqnic_ptp_clock.v
|
||||
VERILOG_SOURCES += ../../rtl/mqnic_ptp_perout.v
|
||||
VERILOG_SOURCES += ../../rtl/cpl_write.v
|
||||
VERILOG_SOURCES += ../../rtl/cpl_op_mux.v
|
||||
VERILOG_SOURCES += ../../rtl/desc_fetch.v
|
||||
VERILOG_SOURCES += ../../rtl/desc_op_mux.v
|
||||
VERILOG_SOURCES += ../../rtl/event_mux.v
|
||||
VERILOG_SOURCES += ../../rtl/queue_manager.v
|
||||
VERILOG_SOURCES += ../../rtl/cpl_queue_manager.v
|
||||
VERILOG_SOURCES += ../../rtl/tx_engine.v
|
||||
VERILOG_SOURCES += ../../rtl/rx_engine.v
|
||||
VERILOG_SOURCES += ../../rtl/tx_checksum.v
|
||||
VERILOG_SOURCES += ../../rtl/rx_hash.v
|
||||
VERILOG_SOURCES += ../../rtl/rx_checksum.v
|
||||
VERILOG_SOURCES += ../../rtl/stats_counter.v
|
||||
VERILOG_SOURCES += ../../rtl/stats_collect.v
|
||||
VERILOG_SOURCES += ../../rtl/stats_pcie_if.v
|
||||
VERILOG_SOURCES += ../../rtl/stats_pcie_tlp.v
|
||||
VERILOG_SOURCES += ../../rtl/stats_dma_if_pcie.v
|
||||
VERILOG_SOURCES += ../../rtl/stats_dma_latency.v
|
||||
VERILOG_SOURCES += ../../rtl/mqnic_tx_scheduler_block_rr.v
|
||||
VERILOG_SOURCES += ../../rtl/tx_scheduler_rr.v
|
||||
VERILOG_SOURCES += ../../lib/eth/rtl/ptp_clock.v
|
||||
VERILOG_SOURCES += ../../lib/eth/rtl/ptp_clock_cdc.v
|
||||
VERILOG_SOURCES += ../../lib/eth/rtl/ptp_perout.v
|
||||
VERILOG_SOURCES += ../../lib/eth/rtl/ptp_ts_extract.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_fifo.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/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_s10_if.v
|
||||
VERILOG_SOURCES += ../../lib/pcie/rtl/pcie_s10_if_rx.v
|
||||
VERILOG_SOURCES += ../../lib/pcie/rtl/pcie_s10_if_tx.v
|
||||
VERILOG_SOURCES += ../../lib/pcie/rtl/pcie_s10_cfg.v
|
||||
VERILOG_SOURCES += ../../lib/pcie/rtl/pcie_s10_msi.v
|
||||
VERILOG_SOURCES += ../../lib/pcie/rtl/pulse_merge.v
|
||||
|
||||
# module parameters
|
||||
|
||||
# Structural configuration
|
||||
export PARAM_IF_COUNT ?= 1
|
||||
export PARAM_PORTS_PER_IF ?= 1
|
||||
|
||||
# PTP configuration
|
||||
export PARAM_PTP_USE_SAMPLE_CLOCK ?= 0
|
||||
export PARAM_PTP_PEROUT_ENABLE ?= 0
|
||||
export PARAM_PTP_PEROUT_COUNT ?= 1
|
||||
|
||||
# Queue manager configuration (interface)
|
||||
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_TX_CPL_QUEUE_OP_TABLE_SIZE ?= $(PARAM_TX_QUEUE_OP_TABLE_SIZE)
|
||||
export PARAM_RX_CPL_QUEUE_OP_TABLE_SIZE ?= $(PARAM_RX_QUEUE_OP_TABLE_SIZE)
|
||||
export PARAM_TX_QUEUE_INDEX_WIDTH ?= 13
|
||||
export PARAM_RX_QUEUE_INDEX_WIDTH ?= 8
|
||||
export PARAM_TX_CPL_QUEUE_INDEX_WIDTH ?= $(PARAM_TX_QUEUE_INDEX_WIDTH)
|
||||
export PARAM_RX_CPL_QUEUE_INDEX_WIDTH ?= $(PARAM_RX_QUEUE_INDEX_WIDTH)
|
||||
export PARAM_EVENT_QUEUE_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_TX_CPL_QUEUE_PIPELINE ?= $(PARAM_TX_QUEUE_PIPELINE)
|
||||
export PARAM_RX_CPL_QUEUE_PIPELINE ?= $(PARAM_RX_QUEUE_PIPELINE)
|
||||
|
||||
# TX and RX engine configuration (port)
|
||||
export PARAM_TX_DESC_TABLE_SIZE ?= 32
|
||||
export PARAM_RX_DESC_TABLE_SIZE ?= 32
|
||||
|
||||
# Scheduler configuration (port)
|
||||
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
|
||||
|
||||
# Timestamping configuration (port)
|
||||
export PARAM_PTP_TS_ENABLE ?= 1
|
||||
export PARAM_TX_PTP_TS_FIFO_DEPTH ?= 32
|
||||
export PARAM_RX_PTP_TS_FIFO_DEPTH ?= 32
|
||||
|
||||
# Interface configuration (port)
|
||||
export PARAM_TX_CHECKSUM_ENABLE ?= 1
|
||||
export PARAM_RX_RSS_ENABLE ?= 1
|
||||
export PARAM_RX_HASH_ENABLE ?= 1
|
||||
export PARAM_RX_CHECKSUM_ENABLE ?= 1
|
||||
export PARAM_TX_FIFO_DEPTH ?= 32768
|
||||
export PARAM_RX_FIFO_DEPTH ?= 131072
|
||||
export PARAM_MAX_TX_SIZE ?= 9214
|
||||
export PARAM_MAX_RX_SIZE ?= 9214
|
||||
export PARAM_TX_RAM_SIZE ?= 131072
|
||||
export PARAM_RX_RAM_SIZE ?= 131072
|
||||
|
||||
# Application block configuration
|
||||
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_LEN_WIDTH ?= 16
|
||||
export PARAM_DMA_TAG_WIDTH ?= 16
|
||||
export PARAM_RAM_PIPELINE ?= 2
|
||||
|
||||
# PCIe interface configuration
|
||||
export PARAM_SEG_COUNT ?= 1
|
||||
export PARAM_SEG_DATA_WIDTH ?= 256
|
||||
export PARAM_SEG_EMPTY_WIDTH ?= $(shell python -c "print((($(PARAM_SEG_DATA_WIDTH)//32)-1).bit_length())" )
|
||||
export PARAM_TX_SEQ_NUM_WIDTH ?= 6
|
||||
export PARAM_TX_SEQ_NUM_ENABLE ?= 1
|
||||
export PARAM_L_TILE ?= 0
|
||||
export PARAM_PF_COUNT ?= 1
|
||||
export PARAM_VF_COUNT ?= 0
|
||||
export PARAM_PCIE_TAG_COUNT ?= 256
|
||||
export PARAM_PCIE_DMA_READ_OP_TABLE_SIZE ?= $(PARAM_PCIE_TAG_COUNT)
|
||||
export PARAM_PCIE_DMA_READ_TX_LIMIT ?= $(shell echo "$$(( 1 << $(PARAM_TX_SEQ_NUM_WIDTH) ))" )
|
||||
export PARAM_PCIE_DMA_READ_TX_FC_ENABLE ?= 1
|
||||
export PARAM_PCIE_DMA_WRITE_OP_TABLE_SIZE ?= $(shell echo "$$(( 1 << $(PARAM_TX_SEQ_NUM_WIDTH) ))" )
|
||||
export PARAM_PCIE_DMA_WRITE_TX_LIMIT ?= $(shell echo "$$(( 1 << $(PARAM_TX_SEQ_NUM_WIDTH) ))" )
|
||||
export PARAM_PCIE_DMA_WRITE_TX_FC_ENABLE ?= 1
|
||||
export PARAM_MSI_COUNT ?= 32
|
||||
|
||||
# AXI lite interface configuration (control)
|
||||
export PARAM_AXIL_CTRL_DATA_WIDTH ?= 32
|
||||
export PARAM_AXIL_CTRL_ADDR_WIDTH ?= 24
|
||||
export PARAM_AXIL_CSR_PASSTHROUGH_ENABLE ?= 0
|
||||
|
||||
# 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_DATA_WIDTH ?= 512
|
||||
export PARAM_AXIS_ETH_SYNC_DATA_WIDTH ?= $(PARAM_AXIS_ETH_DATA_WIDTH)
|
||||
export PARAM_AXIS_ETH_RX_USE_READY ?= 0
|
||||
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 ?= 1
|
||||
export PARAM_STAT_DMA_ENABLE ?= 1
|
||||
export PARAM_STAT_PCIE_ENABLE ?= 1
|
||||
export PARAM_STAT_INC_WIDTH ?= 24
|
||||
export PARAM_STAT_ID_WIDTH ?= 12
|
||||
|
||||
ifeq ($(SIM), icarus)
|
||||
PLUSARGS += -fst
|
||||
|
||||
COMPILE_ARGS += -P $(TOPLEVEL).IF_COUNT=$(PARAM_IF_COUNT)
|
||||
COMPILE_ARGS += -P $(TOPLEVEL).PORTS_PER_IF=$(PARAM_PORTS_PER_IF)
|
||||
COMPILE_ARGS += -P $(TOPLEVEL).PTP_USE_SAMPLE_CLOCK=$(PARAM_PTP_USE_SAMPLE_CLOCK)
|
||||
COMPILE_ARGS += -P $(TOPLEVEL).PTP_PEROUT_ENABLE=$(PARAM_PTP_PEROUT_ENABLE)
|
||||
COMPILE_ARGS += -P $(TOPLEVEL).PTP_PEROUT_COUNT=$(PARAM_PTP_PEROUT_COUNT)
|
||||
COMPILE_ARGS += -P $(TOPLEVEL).EVENT_QUEUE_OP_TABLE_SIZE=$(PARAM_EVENT_QUEUE_OP_TABLE_SIZE)
|
||||
COMPILE_ARGS += -P $(TOPLEVEL).TX_QUEUE_OP_TABLE_SIZE=$(PARAM_TX_QUEUE_OP_TABLE_SIZE)
|
||||
COMPILE_ARGS += -P $(TOPLEVEL).RX_QUEUE_OP_TABLE_SIZE=$(PARAM_RX_QUEUE_OP_TABLE_SIZE)
|
||||
COMPILE_ARGS += -P $(TOPLEVEL).TX_CPL_QUEUE_OP_TABLE_SIZE=$(PARAM_TX_CPL_QUEUE_OP_TABLE_SIZE)
|
||||
COMPILE_ARGS += -P $(TOPLEVEL).RX_CPL_QUEUE_OP_TABLE_SIZE=$(PARAM_RX_CPL_QUEUE_OP_TABLE_SIZE)
|
||||
COMPILE_ARGS += -P $(TOPLEVEL).TX_QUEUE_INDEX_WIDTH=$(PARAM_TX_QUEUE_INDEX_WIDTH)
|
||||
COMPILE_ARGS += -P $(TOPLEVEL).RX_QUEUE_INDEX_WIDTH=$(PARAM_RX_QUEUE_INDEX_WIDTH)
|
||||
COMPILE_ARGS += -P $(TOPLEVEL).TX_CPL_QUEUE_INDEX_WIDTH=$(PARAM_TX_CPL_QUEUE_INDEX_WIDTH)
|
||||
COMPILE_ARGS += -P $(TOPLEVEL).RX_CPL_QUEUE_INDEX_WIDTH=$(PARAM_RX_CPL_QUEUE_INDEX_WIDTH)
|
||||
COMPILE_ARGS += -P $(TOPLEVEL).EVENT_QUEUE_PIPELINE=$(PARAM_EVENT_QUEUE_PIPELINE)
|
||||
COMPILE_ARGS += -P $(TOPLEVEL).TX_QUEUE_PIPELINE=$(PARAM_TX_QUEUE_PIPELINE)
|
||||
COMPILE_ARGS += -P $(TOPLEVEL).RX_QUEUE_PIPELINE=$(PARAM_RX_QUEUE_PIPELINE)
|
||||
COMPILE_ARGS += -P $(TOPLEVEL).TX_CPL_QUEUE_PIPELINE=$(PARAM_TX_CPL_QUEUE_PIPELINE)
|
||||
COMPILE_ARGS += -P $(TOPLEVEL).RX_CPL_QUEUE_PIPELINE=$(PARAM_RX_CPL_QUEUE_PIPELINE)
|
||||
COMPILE_ARGS += -P $(TOPLEVEL).TX_DESC_TABLE_SIZE=$(PARAM_TX_DESC_TABLE_SIZE)
|
||||
COMPILE_ARGS += -P $(TOPLEVEL).RX_DESC_TABLE_SIZE=$(PARAM_RX_DESC_TABLE_SIZE)
|
||||
COMPILE_ARGS += -P $(TOPLEVEL).TX_SCHEDULER_OP_TABLE_SIZE=$(PARAM_TX_SCHEDULER_OP_TABLE_SIZE)
|
||||
COMPILE_ARGS += -P $(TOPLEVEL).TX_SCHEDULER_PIPELINE=$(PARAM_TX_SCHEDULER_PIPELINE)
|
||||
COMPILE_ARGS += -P $(TOPLEVEL).TDMA_INDEX_WIDTH=$(PARAM_TDMA_INDEX_WIDTH)
|
||||
COMPILE_ARGS += -P $(TOPLEVEL).PTP_TS_ENABLE=$(PARAM_PTP_TS_ENABLE)
|
||||
COMPILE_ARGS += -P $(TOPLEVEL).TX_PTP_TS_FIFO_DEPTH=$(PARAM_TX_PTP_TS_FIFO_DEPTH)
|
||||
COMPILE_ARGS += -P $(TOPLEVEL).RX_PTP_TS_FIFO_DEPTH=$(PARAM_RX_PTP_TS_FIFO_DEPTH)
|
||||
COMPILE_ARGS += -P $(TOPLEVEL).TX_CHECKSUM_ENABLE=$(PARAM_TX_CHECKSUM_ENABLE)
|
||||
COMPILE_ARGS += -P $(TOPLEVEL).RX_RSS_ENABLE=$(PARAM_RX_RSS_ENABLE)
|
||||
COMPILE_ARGS += -P $(TOPLEVEL).RX_HASH_ENABLE=$(PARAM_RX_HASH_ENABLE)
|
||||
COMPILE_ARGS += -P $(TOPLEVEL).RX_CHECKSUM_ENABLE=$(PARAM_RX_CHECKSUM_ENABLE)
|
||||
COMPILE_ARGS += -P $(TOPLEVEL).TX_FIFO_DEPTH=$(PARAM_TX_FIFO_DEPTH)
|
||||
COMPILE_ARGS += -P $(TOPLEVEL).RX_FIFO_DEPTH=$(PARAM_RX_FIFO_DEPTH)
|
||||
COMPILE_ARGS += -P $(TOPLEVEL).MAX_TX_SIZE=$(PARAM_MAX_TX_SIZE)
|
||||
COMPILE_ARGS += -P $(TOPLEVEL).MAX_RX_SIZE=$(PARAM_MAX_RX_SIZE)
|
||||
COMPILE_ARGS += -P $(TOPLEVEL).TX_RAM_SIZE=$(PARAM_TX_RAM_SIZE)
|
||||
COMPILE_ARGS += -P $(TOPLEVEL).RX_RAM_SIZE=$(PARAM_RX_RAM_SIZE)
|
||||
COMPILE_ARGS += -P $(TOPLEVEL).APP_ENABLE=$(PARAM_APP_ENABLE)
|
||||
COMPILE_ARGS += -P $(TOPLEVEL).APP_CTRL_ENABLE=$(PARAM_APP_CTRL_ENABLE)
|
||||
COMPILE_ARGS += -P $(TOPLEVEL).APP_DMA_ENABLE=$(PARAM_APP_DMA_ENABLE)
|
||||
COMPILE_ARGS += -P $(TOPLEVEL).APP_AXIS_DIRECT_ENABLE=$(PARAM_APP_AXIS_DIRECT_ENABLE)
|
||||
COMPILE_ARGS += -P $(TOPLEVEL).APP_AXIS_SYNC_ENABLE=$(PARAM_APP_AXIS_SYNC_ENABLE)
|
||||
COMPILE_ARGS += -P $(TOPLEVEL).APP_AXIS_IF_ENABLE=$(PARAM_APP_AXIS_IF_ENABLE)
|
||||
COMPILE_ARGS += -P $(TOPLEVEL).APP_STAT_ENABLE=$(PARAM_APP_STAT_ENABLE)
|
||||
COMPILE_ARGS += -P $(TOPLEVEL).DMA_LEN_WIDTH=$(PARAM_DMA_LEN_WIDTH)
|
||||
COMPILE_ARGS += -P $(TOPLEVEL).DMA_TAG_WIDTH=$(PARAM_DMA_TAG_WIDTH)
|
||||
COMPILE_ARGS += -P $(TOPLEVEL).RAM_PIPELINE=$(PARAM_RAM_PIPELINE)
|
||||
COMPILE_ARGS += -P $(TOPLEVEL).SEG_COUNT=$(PARAM_SEG_COUNT)
|
||||
COMPILE_ARGS += -P $(TOPLEVEL).SEG_DATA_WIDTH=$(PARAM_SEG_DATA_WIDTH)
|
||||
COMPILE_ARGS += -P $(TOPLEVEL).SEG_EMPTY_WIDTH=$(PARAM_SEG_EMPTY_WIDTH)
|
||||
COMPILE_ARGS += -P $(TOPLEVEL).TX_SEQ_NUM_WIDTH=$(PARAM_TX_SEQ_NUM_WIDTH)
|
||||
COMPILE_ARGS += -P $(TOPLEVEL).TX_SEQ_NUM_ENABLE=$(PARAM_TX_SEQ_NUM_ENABLE)
|
||||
COMPILE_ARGS += -P $(TOPLEVEL).L_TILE=$(PARAM_L_TILE)
|
||||
COMPILE_ARGS += -P $(TOPLEVEL).PF_COUNT=$(PARAM_PF_COUNT)
|
||||
COMPILE_ARGS += -P $(TOPLEVEL).VF_COUNT=$(PARAM_VF_COUNT)
|
||||
COMPILE_ARGS += -P $(TOPLEVEL).PCIE_TAG_COUNT=$(PARAM_PCIE_TAG_COUNT)
|
||||
COMPILE_ARGS += -P $(TOPLEVEL).PCIE_DMA_READ_OP_TABLE_SIZE=$(PARAM_PCIE_DMA_READ_OP_TABLE_SIZE)
|
||||
COMPILE_ARGS += -P $(TOPLEVEL).PCIE_DMA_READ_TX_LIMIT=$(PARAM_PCIE_DMA_READ_TX_LIMIT)
|
||||
COMPILE_ARGS += -P $(TOPLEVEL).PCIE_DMA_READ_TX_FC_ENABLE=$(PARAM_PCIE_DMA_READ_TX_FC_ENABLE)
|
||||
COMPILE_ARGS += -P $(TOPLEVEL).PCIE_DMA_WRITE_OP_TABLE_SIZE=$(PARAM_PCIE_DMA_WRITE_OP_TABLE_SIZE)
|
||||
COMPILE_ARGS += -P $(TOPLEVEL).PCIE_DMA_WRITE_TX_LIMIT=$(PARAM_PCIE_DMA_WRITE_TX_LIMIT)
|
||||
COMPILE_ARGS += -P $(TOPLEVEL).PCIE_DMA_WRITE_TX_FC_ENABLE=$(PARAM_PCIE_DMA_WRITE_TX_FC_ENABLE)
|
||||
COMPILE_ARGS += -P $(TOPLEVEL).MSI_COUNT=$(PARAM_MSI_COUNT)
|
||||
COMPILE_ARGS += -P $(TOPLEVEL).AXIL_CTRL_DATA_WIDTH=$(PARAM_AXIL_CTRL_DATA_WIDTH)
|
||||
COMPILE_ARGS += -P $(TOPLEVEL).AXIL_CTRL_ADDR_WIDTH=$(PARAM_AXIL_CTRL_ADDR_WIDTH)
|
||||
COMPILE_ARGS += -P $(TOPLEVEL).AXIL_CSR_PASSTHROUGH_ENABLE=$(PARAM_AXIL_CSR_PASSTHROUGH_ENABLE)
|
||||
COMPILE_ARGS += -P $(TOPLEVEL).AXIL_APP_CTRL_DATA_WIDTH=$(PARAM_AXIL_APP_CTRL_DATA_WIDTH)
|
||||
COMPILE_ARGS += -P $(TOPLEVEL).AXIL_APP_CTRL_ADDR_WIDTH=$(PARAM_AXIL_APP_CTRL_ADDR_WIDTH)
|
||||
COMPILE_ARGS += -P $(TOPLEVEL).AXIS_ETH_DATA_WIDTH=$(PARAM_AXIS_ETH_DATA_WIDTH)
|
||||
COMPILE_ARGS += -P $(TOPLEVEL).AXIS_ETH_SYNC_DATA_WIDTH=$(PARAM_AXIS_ETH_SYNC_DATA_WIDTH)
|
||||
COMPILE_ARGS += -P $(TOPLEVEL).AXIS_ETH_RX_USE_READY=$(PARAM_AXIS_ETH_RX_USE_READY)
|
||||
COMPILE_ARGS += -P $(TOPLEVEL).AXIS_ETH_TX_PIPELINE=$(PARAM_AXIS_ETH_TX_PIPELINE)
|
||||
COMPILE_ARGS += -P $(TOPLEVEL).AXIS_ETH_TX_FIFO_PIPELINE=$(PARAM_AXIS_ETH_TX_FIFO_PIPELINE)
|
||||
COMPILE_ARGS += -P $(TOPLEVEL).AXIS_ETH_TX_TS_PIPELINE=$(PARAM_AXIS_ETH_TX_TS_PIPELINE)
|
||||
COMPILE_ARGS += -P $(TOPLEVEL).AXIS_ETH_RX_PIPELINE=$(PARAM_AXIS_ETH_RX_PIPELINE)
|
||||
COMPILE_ARGS += -P $(TOPLEVEL).AXIS_ETH_RX_FIFO_PIPELINE=$(PARAM_AXIS_ETH_RX_FIFO_PIPELINE)
|
||||
COMPILE_ARGS += -P $(TOPLEVEL).STAT_ENABLE=$(PARAM_STAT_ENABLE)
|
||||
COMPILE_ARGS += -P $(TOPLEVEL).STAT_DMA_ENABLE=$(PARAM_STAT_DMA_ENABLE)
|
||||
COMPILE_ARGS += -P $(TOPLEVEL).STAT_PCIE_ENABLE=$(PARAM_STAT_PCIE_ENABLE)
|
||||
COMPILE_ARGS += -P $(TOPLEVEL).STAT_INC_WIDTH=$(PARAM_STAT_INC_WIDTH)
|
||||
COMPILE_ARGS += -P $(TOPLEVEL).STAT_ID_WIDTH=$(PARAM_STAT_ID_WIDTH)
|
||||
|
||||
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 += -GIF_COUNT=$(PARAM_IF_COUNT)
|
||||
COMPILE_ARGS += -GPORTS_PER_IF=$(PARAM_PORTS_PER_IF)
|
||||
COMPILE_ARGS += -GPTP_USE_SAMPLE_CLOCK=$(PARAM_PTP_USE_SAMPLE_CLOCK)
|
||||
COMPILE_ARGS += -GPTP_PEROUT_ENABLE=$(PARAM_PTP_PEROUT_ENABLE)
|
||||
COMPILE_ARGS += -GPTP_PEROUT_COUNT=$(PARAM_PTP_PEROUT_COUNT)
|
||||
COMPILE_ARGS += -GEVENT_QUEUE_OP_TABLE_SIZE=$(PARAM_EVENT_QUEUE_OP_TABLE_SIZE)
|
||||
COMPILE_ARGS += -GTX_QUEUE_OP_TABLE_SIZE=$(PARAM_TX_QUEUE_OP_TABLE_SIZE)
|
||||
COMPILE_ARGS += -GRX_QUEUE_OP_TABLE_SIZE=$(PARAM_RX_QUEUE_OP_TABLE_SIZE)
|
||||
COMPILE_ARGS += -GTX_CPL_QUEUE_OP_TABLE_SIZE=$(PARAM_TX_CPL_QUEUE_OP_TABLE_SIZE)
|
||||
COMPILE_ARGS += -GRX_CPL_QUEUE_OP_TABLE_SIZE=$(PARAM_RX_CPL_QUEUE_OP_TABLE_SIZE)
|
||||
COMPILE_ARGS += -GTX_QUEUE_INDEX_WIDTH=$(PARAM_TX_QUEUE_INDEX_WIDTH)
|
||||
COMPILE_ARGS += -GRX_QUEUE_INDEX_WIDTH=$(PARAM_RX_QUEUE_INDEX_WIDTH)
|
||||
COMPILE_ARGS += -GTX_CPL_QUEUE_INDEX_WIDTH=$(PARAM_TX_CPL_QUEUE_INDEX_WIDTH)
|
||||
COMPILE_ARGS += -GRX_CPL_QUEUE_INDEX_WIDTH=$(PARAM_RX_CPL_QUEUE_INDEX_WIDTH)
|
||||
COMPILE_ARGS += -GEVENT_QUEUE_PIPELINE=$(PARAM_EVENT_QUEUE_PIPELINE)
|
||||
COMPILE_ARGS += -GTX_QUEUE_PIPELINE=$(PARAM_TX_QUEUE_PIPELINE)
|
||||
COMPILE_ARGS += -GRX_QUEUE_PIPELINE=$(PARAM_RX_QUEUE_PIPELINE)
|
||||
COMPILE_ARGS += -GTX_CPL_QUEUE_PIPELINE=$(PARAM_TX_CPL_QUEUE_PIPELINE)
|
||||
COMPILE_ARGS += -GRX_CPL_QUEUE_PIPELINE=$(PARAM_RX_CPL_QUEUE_PIPELINE)
|
||||
COMPILE_ARGS += -GTX_DESC_TABLE_SIZE=$(PARAM_TX_DESC_TABLE_SIZE)
|
||||
COMPILE_ARGS += -GRX_DESC_TABLE_SIZE=$(PARAM_RX_DESC_TABLE_SIZE)
|
||||
COMPILE_ARGS += -GTX_SCHEDULER_OP_TABLE_SIZE=$(PARAM_TX_SCHEDULER_OP_TABLE_SIZE)
|
||||
COMPILE_ARGS += -GTX_SCHEDULER_PIPELINE=$(PARAM_TX_SCHEDULER_PIPELINE)
|
||||
COMPILE_ARGS += -GTDMA_INDEX_WIDTH=$(PARAM_TDMA_INDEX_WIDTH)
|
||||
COMPILE_ARGS += -GPTP_TS_ENABLE=$(PARAM_PTP_TS_ENABLE)
|
||||
COMPILE_ARGS += -GTX_PTP_TS_FIFO_DEPTH=$(PARAM_TX_PTP_TS_FIFO_DEPTH)
|
||||
COMPILE_ARGS += -GRX_PTP_TS_FIFO_DEPTH=$(PARAM_RX_PTP_TS_FIFO_DEPTH)
|
||||
COMPILE_ARGS += -GTX_CHECKSUM_ENABLE=$(PARAM_TX_CHECKSUM_ENABLE)
|
||||
COMPILE_ARGS += -GRX_RSS_ENABLE=$(PARAM_RX_RSS_ENABLE)
|
||||
COMPILE_ARGS += -GRX_HASH_ENABLE=$(PARAM_RX_HASH_ENABLE)
|
||||
COMPILE_ARGS += -GRX_CHECKSUM_ENABLE=$(PARAM_RX_CHECKSUM_ENABLE)
|
||||
COMPILE_ARGS += -GTX_FIFO_DEPTH=$(PARAM_TX_FIFO_DEPTH)
|
||||
COMPILE_ARGS += -GRX_FIFO_DEPTH=$(PARAM_RX_FIFO_DEPTH)
|
||||
COMPILE_ARGS += -GMAX_TX_SIZE=$(PARAM_MAX_TX_SIZE)
|
||||
COMPILE_ARGS += -GMAX_RX_SIZE=$(PARAM_MAX_RX_SIZE)
|
||||
COMPILE_ARGS += -GTX_RAM_SIZE=$(PARAM_TX_RAM_SIZE)
|
||||
COMPILE_ARGS += -GRX_RAM_SIZE=$(PARAM_RX_RAM_SIZE)
|
||||
COMPILE_ARGS += -GAPP_ENABLE=$(PARAM_APP_ENABLE)
|
||||
COMPILE_ARGS += -GAPP_CTRL_ENABLE=$(PARAM_APP_CTRL_ENABLE)
|
||||
COMPILE_ARGS += -GAPP_DMA_ENABLE=$(PARAM_APP_DMA_ENABLE)
|
||||
COMPILE_ARGS += -GAPP_AXIS_DIRECT_ENABLE=$(PARAM_APP_AXIS_DIRECT_ENABLE)
|
||||
COMPILE_ARGS += -GAPP_AXIS_SYNC_ENABLE=$(PARAM_APP_AXIS_SYNC_ENABLE)
|
||||
COMPILE_ARGS += -GAPP_AXIS_IF_ENABLE=$(PARAM_APP_AXIS_IF_ENABLE)
|
||||
COMPILE_ARGS += -GAPP_STAT_ENABLE=$(PARAM_APP_STAT_ENABLE)
|
||||
COMPILE_ARGS += -GDMA_LEN_WIDTH=$(PARAM_DMA_LEN_WIDTH)
|
||||
COMPILE_ARGS += -GDMA_TAG_WIDTH=$(PARAM_DMA_TAG_WIDTH)
|
||||
COMPILE_ARGS += -GRAM_PIPELINE=$(PARAM_RAM_PIPELINE)
|
||||
COMPILE_ARGS += -GSEG_COUNT=$(PARAM_SEG_COUNT)
|
||||
COMPILE_ARGS += -GSEG_DATA_WIDTH=$(PARAM_SEG_DATA_WIDTH)
|
||||
COMPILE_ARGS += -GSEG_EMPTY_WIDTH=$(PARAM_SEG_EMPTY_WIDTH)
|
||||
COMPILE_ARGS += -GTX_SEQ_NUM_WIDTH=$(PARAM_TX_SEQ_NUM_WIDTH)
|
||||
COMPILE_ARGS += -GTX_SEQ_NUM_ENABLE=$(PARAM_TX_SEQ_NUM_ENABLE)
|
||||
COMPILE_ARGS += -GL_TILE=$(PARAM_L_TILE)
|
||||
COMPILE_ARGS += -GPF_COUNT=$(PARAM_PF_COUNT)
|
||||
COMPILE_ARGS += -GVF_COUNT=$(PARAM_VF_COUNT)
|
||||
COMPILE_ARGS += -GPCIE_TAG_COUNT=$(PARAM_PCIE_TAG_COUNT)
|
||||
COMPILE_ARGS += -GPCIE_DMA_READ_OP_TABLE_SIZE=$(PARAM_PCIE_DMA_READ_OP_TABLE_SIZE)
|
||||
COMPILE_ARGS += -GPCIE_DMA_READ_TX_LIMIT=$(PARAM_PCIE_DMA_READ_TX_LIMIT)
|
||||
COMPILE_ARGS += -GPCIE_DMA_READ_TX_FC_ENABLE=$(PARAM_PCIE_DMA_READ_TX_FC_ENABLE)
|
||||
COMPILE_ARGS += -GPCIE_DMA_WRITE_OP_TABLE_SIZE=$(PARAM_PCIE_DMA_WRITE_OP_TABLE_SIZE)
|
||||
COMPILE_ARGS += -GPCIE_DMA_WRITE_TX_LIMIT=$(PARAM_PCIE_DMA_WRITE_TX_LIMIT)
|
||||
COMPILE_ARGS += -GPCIE_DMA_WRITE_TX_FC_ENABLE=$(PARAM_PCIE_DMA_WRITE_TX_FC_ENABLE)
|
||||
COMPILE_ARGS += -GMSI_COUNT=$(PARAM_MSI_COUNT)
|
||||
COMPILE_ARGS += -GAXIL_CTRL_DATA_WIDTH=$(PARAM_AXIL_CTRL_DATA_WIDTH)
|
||||
COMPILE_ARGS += -GAXIL_CTRL_ADDR_WIDTH=$(PARAM_AXIL_CTRL_ADDR_WIDTH)
|
||||
COMPILE_ARGS += -GAXIL_CSR_PASSTHROUGH_ENABLE=$(PARAM_AXIL_CSR_PASSTHROUGH_ENABLE)
|
||||
COMPILE_ARGS += -GAXIL_APP_CTRL_DATA_WIDTH=$(PARAM_AXIL_APP_CTRL_DATA_WIDTH)
|
||||
COMPILE_ARGS += -GAXIL_APP_CTRL_ADDR_WIDTH=$(PARAM_AXIL_APP_CTRL_ADDR_WIDTH)
|
||||
COMPILE_ARGS += -GAXIS_ETH_DATA_WIDTH=$(PARAM_AXIS_ETH_DATA_WIDTH)
|
||||
COMPILE_ARGS += -GAXIS_ETH_SYNC_DATA_WIDTH=$(PARAM_AXIS_ETH_SYNC_DATA_WIDTH)
|
||||
COMPILE_ARGS += -GAXIS_ETH_RX_USE_READY=$(PARAM_AXIS_ETH_RX_USE_READY)
|
||||
COMPILE_ARGS += -GAXIS_ETH_TX_PIPELINE=$(PARAM_AXIS_ETH_TX_PIPELINE)
|
||||
COMPILE_ARGS += -GAXIS_ETH_TX_FIFO_PIPELINE=$(PARAM_AXIS_ETH_TX_FIFO_PIPELINE)
|
||||
COMPILE_ARGS += -GAXIS_ETH_TX_TS_PIPELINE=$(PARAM_AXIS_ETH_TX_TS_PIPELINE)
|
||||
COMPILE_ARGS += -GAXIS_ETH_RX_PIPELINE=$(PARAM_AXIS_ETH_RX_PIPELINE)
|
||||
COMPILE_ARGS += -GAXIS_ETH_RX_FIFO_PIPELINE=$(PARAM_AXIS_ETH_RX_FIFO_PIPELINE)
|
||||
COMPILE_ARGS += -GSTAT_ENABLE=$(PARAM_STAT_ENABLE)
|
||||
COMPILE_ARGS += -GSTAT_DMA_ENABLE=$(PARAM_STAT_DMA_ENABLE)
|
||||
COMPILE_ARGS += -GSTAT_PCIE_ENABLE=$(PARAM_STAT_PCIE_ENABLE)
|
||||
COMPILE_ARGS += -GSTAT_INC_WIDTH=$(PARAM_STAT_INC_WIDTH)
|
||||
COMPILE_ARGS += -GSTAT_ID_WIDTH=$(PARAM_STAT_ID_WIDTH)
|
||||
|
||||
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
|
1
fpga/common/tb/mqnic_core_pcie_s10/mqnic.py
Symbolic link
1
fpga/common/tb/mqnic_core_pcie_s10/mqnic.py
Symbolic link
@ -0,0 +1 @@
|
||||
../mqnic.py
|
644
fpga/common/tb/mqnic_core_pcie_s10/test_mqnic_core_pcie_s10.py
Normal file
644
fpga/common/tb/mqnic_core_pcie_s10/test_mqnic_core_pcie_s10.py
Normal file
@ -0,0 +1,644 @@
|
||||
"""
|
||||
|
||||
Copyright 2021, The Regents of the University of California.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE REGENTS OF THE UNIVERSITY OF CALIFORNIA ''AS
|
||||
IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE REGENTS OF THE UNIVERSITY OF CALIFORNIA OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
OF SUCH DAMAGE.
|
||||
|
||||
The views and conclusions contained in the software and documentation are those
|
||||
of the authors and should not be interpreted as representing official policies,
|
||||
either expressed or implied, of The Regents of the University of California.
|
||||
|
||||
"""
|
||||
|
||||
import logging
|
||||
import os
|
||||
import sys
|
||||
|
||||
import scapy.utils
|
||||
from scapy.layers.l2 import Ether
|
||||
from scapy.layers.inet import IP, UDP
|
||||
|
||||
import cocotb_test.simulator
|
||||
import pytest
|
||||
|
||||
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 EthMac
|
||||
from cocotbext.pcie.core import RootComplex
|
||||
from cocotbext.pcie.intel.s10 import S10PcieDevice, S10RxBus, S10TxBus
|
||||
|
||||
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):
|
||||
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 = S10PcieDevice(
|
||||
# configuration options
|
||||
pcie_generation=3,
|
||||
# pcie_link_width=2,
|
||||
# pld_clk_frequency=250e6,
|
||||
l_tile=False,
|
||||
|
||||
# signals
|
||||
# Clock and reset
|
||||
# npor=dut.npor,
|
||||
# pin_perst=dut.pin_perst,
|
||||
# ninit_done=dut.ninit_done,
|
||||
# pld_clk_inuse=dut.pld_clk_inuse,
|
||||
# pld_core_ready=dut.pld_core_ready,
|
||||
reset_status=dut.rst,
|
||||
# clr_st=dut.clr_st,
|
||||
# refclk=dut.refclk,
|
||||
coreclkout_hip=dut.clk,
|
||||
|
||||
# RX interface
|
||||
rx_bus=S10RxBus.from_prefix(dut, "rx_st"),
|
||||
|
||||
# TX interface
|
||||
tx_bus=S10TxBus.from_prefix(dut, "tx_st"),
|
||||
|
||||
# TX flow control
|
||||
tx_ph_cdts=dut.tx_ph_cdts,
|
||||
tx_pd_cdts=dut.tx_pd_cdts,
|
||||
tx_nph_cdts=dut.tx_nph_cdts,
|
||||
tx_npd_cdts=dut.tx_npd_cdts,
|
||||
tx_cplh_cdts=dut.tx_cplh_cdts,
|
||||
tx_cpld_cdts=dut.tx_cpld_cdts,
|
||||
tx_hdr_cdts_consumed=dut.tx_hdr_cdts_consumed,
|
||||
tx_data_cdts_consumed=dut.tx_data_cdts_consumed,
|
||||
tx_cdts_type=dut.tx_cdts_type,
|
||||
tx_cdts_data_value=dut.tx_cdts_data_value,
|
||||
|
||||
# Hard IP status
|
||||
# int_status=dut.int_status,
|
||||
# int_status_common=dut.int_status_common,
|
||||
# derr_cor_ext_rpl=dut.derr_cor_ext_rpl,
|
||||
# derr_rpl=dut.derr_rpl,
|
||||
# derr_cor_ext_rcv=dut.derr_cor_ext_rcv,
|
||||
# derr_uncor_ext_rcv=dut.derr_uncor_ext_rcv,
|
||||
# rx_par_err=dut.rx_par_err,
|
||||
# tx_par_err=dut.tx_par_err,
|
||||
# ltssmstate=dut.ltssmstate,
|
||||
# link_up=dut.link_up,
|
||||
# lane_act=dut.lane_act,
|
||||
# currentspeed=dut.currentspeed,
|
||||
|
||||
# Power management
|
||||
# pm_linkst_in_l1=dut.pm_linkst_in_l1,
|
||||
# pm_linkst_in_l0s=dut.pm_linkst_in_l0s,
|
||||
# pm_state=dut.pm_state,
|
||||
# pm_dstate=dut.pm_dstate,
|
||||
# apps_pm_xmt_pme=dut.apps_pm_xmt_pme,
|
||||
# apps_ready_entr_l23=dut.apps_ready_entr_l23,
|
||||
# apps_pm_xmt_turnoff=dut.apps_pm_xmt_turnoff,
|
||||
# app_init_rst=dut.app_init_rst,
|
||||
# app_xfer_pending=dut.app_xfer_pending,
|
||||
|
||||
# Interrupt interface
|
||||
app_msi_req=dut.app_msi_req,
|
||||
app_msi_ack=dut.app_msi_ack,
|
||||
app_msi_tc=dut.app_msi_tc,
|
||||
app_msi_num=dut.app_msi_num,
|
||||
app_msi_func_num=dut.app_msi_func_num,
|
||||
# app_int_sts=dut.app_int_sts,
|
||||
|
||||
# Error interface
|
||||
# serr_out=dut.serr_out,
|
||||
# hip_enter_err_mode=dut.hip_enter_err_mode,
|
||||
# app_err_valid=dut.app_err_valid,
|
||||
# app_err_hdr=dut.app_err_hdr,
|
||||
# app_err_info=dut.app_err_info,
|
||||
# app_err_func_num=dut.app_err_func_num,
|
||||
|
||||
# Configuration output
|
||||
tl_cfg_func=dut.tl_cfg_func,
|
||||
tl_cfg_add=dut.tl_cfg_add,
|
||||
tl_cfg_ctl=dut.tl_cfg_ctl,
|
||||
|
||||
# Configuration extension bus
|
||||
# ceb_req=dut.ceb_req,
|
||||
# ceb_ack=dut.ceb_ack,
|
||||
# ceb_addr=dut.ceb_addr,
|
||||
# ceb_din=dut.ceb_din,
|
||||
# ceb_dout=dut.ceb_dout,
|
||||
# ceb_wr=dut.ceb_wr,
|
||||
# ceb_cdm_convert_data=dut.ceb_cdm_convert_data,
|
||||
# ceb_func_num=dut.ceb_func_num,
|
||||
# ceb_vf_num=dut.ceb_vf_num,
|
||||
# ceb_vf_active=dut.ceb_vf_active,
|
||||
|
||||
# Hard IP reconfiguration interface
|
||||
# hip_reconfig_clk=dut.hip_reconfig_clk,
|
||||
# hip_reconfig_address=dut.hip_reconfig_address,
|
||||
# hip_reconfig_read=dut.hip_reconfig_read,
|
||||
# hip_reconfig_readdata=dut.hip_reconfig_readdata,
|
||||
# hip_reconfig_readdatavalid=dut.hip_reconfig_readdatavalid,
|
||||
# hip_reconfig_write=dut.hip_reconfig_write,
|
||||
# hip_reconfig_writedata=dut.hip_reconfig_writedata,
|
||||
# hip_reconfig_waitrequest=dut.hip_reconfig_waitrequest,
|
||||
)
|
||||
|
||||
# self.dev.log.setLevel(logging.DEBUG)
|
||||
|
||||
self.rc.make_port().connect(self.dev)
|
||||
|
||||
self.driver = mqnic.Driver(self.rc)
|
||||
|
||||
self.dev.functions[0].msi_cap.msi_multiple_message_capable = 5
|
||||
|
||||
self.dev.functions[0].configure_bar(0, 2**len(dut.core_pcie_inst.axil_ctrl_araddr), ext=True, prefetch=True)
|
||||
if hasattr(dut.core_pcie_inst, 'pcie_app_ctrl'):
|
||||
self.dev.functions[0].configure_bar(2, 2**len(dut.core_pcie_inst.axil_app_ctrl_araddr), ext=True, prefetch=True)
|
||||
|
||||
# Ethernet
|
||||
self.port_mac = []
|
||||
|
||||
clock_period = 3.102
|
||||
speed = 10e9
|
||||
|
||||
if len(dut.core_pcie_inst.core_inst.iface[0].port[0].rx_fifo_inst.m_axis_tdata) == 64:
|
||||
# 10G
|
||||
clock_period = 6.4
|
||||
speed = 10e9
|
||||
elif len(dut.core_pcie_inst.core_inst.iface[0].port[0].rx_fifo_inst.m_axis_tdata) == 128:
|
||||
# 25G
|
||||
clock_period = 2.56
|
||||
speed = 25e9
|
||||
elif len(dut.core_pcie_inst.core_inst.iface[0].port[0].rx_fifo_inst.m_axis_tdata) == 512:
|
||||
# 100G
|
||||
clock_period = 3.102
|
||||
speed = 100e9
|
||||
|
||||
for iface in dut.core_pcie_inst.core_inst.iface:
|
||||
for port in iface.port:
|
||||
cocotb.fork(Clock(port.rx_async_fifo_inst.s_clk, clock_period, units="ns").start())
|
||||
cocotb.fork(Clock(port.tx_async_fifo_inst.m_clk, clock_period, units="ns").start())
|
||||
|
||||
port.rx_async_fifo_inst.s_rst.setimmediatevalue(0)
|
||||
port.tx_async_fifo_inst.m_rst.setimmediatevalue(0)
|
||||
|
||||
mac = EthMac(
|
||||
tx_clk=port.tx_async_fifo_inst.m_clk,
|
||||
tx_rst=port.tx_async_fifo_inst.m_rst,
|
||||
tx_bus=AxiStreamBus.from_prefix(port, "axis_tx"),
|
||||
tx_ptp_time=port.ptp.tx_ptp_cdc_inst.output_ts,
|
||||
tx_ptp_ts=port.ptp.axis_tx_ptp_ts,
|
||||
tx_ptp_ts_tag=port.ptp.axis_tx_ptp_ts_tag,
|
||||
tx_ptp_ts_valid=port.ptp.axis_tx_ptp_ts_valid,
|
||||
rx_clk=port.rx_async_fifo_inst.s_clk,
|
||||
rx_rst=port.rx_async_fifo_inst.s_rst,
|
||||
rx_bus=AxiStreamBus.from_prefix(port, "axis_rx"),
|
||||
rx_ptp_time=port.ptp.rx_ptp_cdc_inst.output_ts,
|
||||
ifg=12, speed=speed
|
||||
)
|
||||
|
||||
self.port_mac.append(mac)
|
||||
|
||||
dut.ctrl_reg_wr_wait.setimmediatevalue(0)
|
||||
dut.ctrl_reg_wr_ack.setimmediatevalue(0)
|
||||
dut.ctrl_reg_rd_data.setimmediatevalue(0)
|
||||
dut.ctrl_reg_rd_wait.setimmediatevalue(0)
|
||||
dut.ctrl_reg_rd_ack.setimmediatevalue(0)
|
||||
|
||||
dut.ptp_sample_clk.setimmediatevalue(0)
|
||||
|
||||
dut.s_axis_stat_tdata.setimmediatevalue(0)
|
||||
dut.s_axis_stat_tid.setimmediatevalue(0)
|
||||
dut.s_axis_stat_tvalid.setimmediatevalue(0)
|
||||
|
||||
self.loopback_enable = False
|
||||
cocotb.fork(self._run_loopback())
|
||||
|
||||
async def init(self):
|
||||
|
||||
for mac in self.port_mac:
|
||||
mac.rx.reset.setimmediatevalue(0)
|
||||
mac.tx.reset.setimmediatevalue(0)
|
||||
|
||||
await RisingEdge(self.dut.clk)
|
||||
await RisingEdge(self.dut.clk)
|
||||
|
||||
for mac in self.port_mac:
|
||||
mac.rx.reset.setimmediatevalue(1)
|
||||
mac.tx.reset.setimmediatevalue(1)
|
||||
|
||||
await FallingEdge(self.dut.rst)
|
||||
await Timer(100, 'ns')
|
||||
|
||||
await RisingEdge(self.dut.clk)
|
||||
await RisingEdge(self.dut.clk)
|
||||
|
||||
for mac in self.port_mac:
|
||||
mac.rx.reset.setimmediatevalue(0)
|
||||
mac.tx.reset.setimmediatevalue(0)
|
||||
|
||||
await self.rc.enumerate(enable_bus_mastering=True, configure_msi=True)
|
||||
|
||||
async def _run_loopback(self):
|
||||
while True:
|
||||
await RisingEdge(self.dut.clk)
|
||||
|
||||
if self.loopback_enable:
|
||||
for mac in self.port_mac:
|
||||
if not mac.tx.empty():
|
||||
await mac.rx.send(await mac.tx.recv())
|
||||
|
||||
|
||||
@cocotb.test()
|
||||
async def run_test_nic(dut):
|
||||
|
||||
tb = TB(dut)
|
||||
|
||||
await tb.init()
|
||||
|
||||
tb.log.info("Init driver")
|
||||
await tb.driver.init_dev(tb.dev.functions[0].pcie_id)
|
||||
await tb.driver.interfaces[0].open()
|
||||
|
||||
# enable queues
|
||||
tb.log.info("Enable queues")
|
||||
await tb.rc.mem_write_dword(tb.driver.interfaces[0].ports[0].hw_addr+mqnic.MQNIC_PORT_REG_SCHED_ENABLE, 0x00000001)
|
||||
for k in range(tb.driver.interfaces[0].tx_queue_count):
|
||||
await tb.rc.mem_write_dword(tb.driver.interfaces[0].ports[0].schedulers[0].hw_addr+4*k, 0x00000003)
|
||||
|
||||
# wait for all writes to complete
|
||||
await tb.rc.mem_read(tb.driver.hw_addr, 4)
|
||||
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.port_mac[0].tx.recv()
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
|
||||
await tb.port_mac[0].rx.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
|
||||
|
||||
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.port_mac[0].tx.recv()
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
|
||||
await tb.port_mac[0].rx.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("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
|
||||
|
||||
tb.log.info("Jumbo frames")
|
||||
|
||||
count = 64
|
||||
|
||||
pkts = [bytearray([(x+k) % 256 for x in range(9014)]) 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("Read statistics counters")
|
||||
|
||||
await Timer(2000, 'ns')
|
||||
|
||||
lst = []
|
||||
|
||||
for k in range(64):
|
||||
lst.append(await tb.rc.mem_read_dword(tb.driver.hw_addr+0x010000+k*8))
|
||||
|
||||
print(lst)
|
||||
|
||||
await RisingEdge(dut.clk)
|
||||
await RisingEdge(dut.clk)
|
||||
|
||||
|
||||
# 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'))
|
||||
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'))
|
||||
|
||||
|
||||
@pytest.mark.parametrize(("pcie_data_width", "axis_eth_data_width", "axis_eth_sync_data_width"),
|
||||
[(256, 64, 64), (256, 64, 128)]) #, (512, 64, 64), (512, 64, 128), (512, 512, 512)])
|
||||
def test_mqnic_core_pcie_s10(request, pcie_data_width, axis_eth_data_width, axis_eth_sync_data_width):
|
||||
dut = "mqnic_core_pcie_s10"
|
||||
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, "mqnic_core.v"),
|
||||
os.path.join(rtl_dir, "mqnic_core_pcie.v"),
|
||||
os.path.join(rtl_dir, "mqnic_interface.v"),
|
||||
os.path.join(rtl_dir, "mqnic_port.v"),
|
||||
os.path.join(rtl_dir, "mqnic_ptp.v"),
|
||||
os.path.join(rtl_dir, "mqnic_ptp_clock.v"),
|
||||
os.path.join(rtl_dir, "mqnic_ptp_perout.v"),
|
||||
os.path.join(rtl_dir, "cpl_write.v"),
|
||||
os.path.join(rtl_dir, "cpl_op_mux.v"),
|
||||
os.path.join(rtl_dir, "desc_fetch.v"),
|
||||
os.path.join(rtl_dir, "desc_op_mux.v"),
|
||||
os.path.join(rtl_dir, "event_mux.v"),
|
||||
os.path.join(rtl_dir, "queue_manager.v"),
|
||||
os.path.join(rtl_dir, "cpl_queue_manager.v"),
|
||||
os.path.join(rtl_dir, "tx_engine.v"),
|
||||
os.path.join(rtl_dir, "rx_engine.v"),
|
||||
os.path.join(rtl_dir, "tx_checksum.v"),
|
||||
os.path.join(rtl_dir, "rx_hash.v"),
|
||||
os.path.join(rtl_dir, "rx_checksum.v"),
|
||||
os.path.join(rtl_dir, "stats_counter.v"),
|
||||
os.path.join(rtl_dir, "stats_collect.v"),
|
||||
os.path.join(rtl_dir, "stats_pcie_if.v"),
|
||||
os.path.join(rtl_dir, "stats_pcie_tlp.v"),
|
||||
os.path.join(rtl_dir, "stats_dma_if_pcie.v"),
|
||||
os.path.join(rtl_dir, "stats_dma_latency.v"),
|
||||
os.path.join(rtl_dir, "mqnic_tx_scheduler_block_rr.v"),
|
||||
os.path.join(rtl_dir, "tx_scheduler_rr.v"),
|
||||
os.path.join(eth_rtl_dir, "ptp_clock.v"),
|
||||
os.path.join(eth_rtl_dir, "ptp_clock_cdc.v"),
|
||||
os.path.join(eth_rtl_dir, "ptp_perout.v"),
|
||||
os.path.join(eth_rtl_dir, "ptp_ts_extract.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_fifo.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, "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_s10_if.v"),
|
||||
os.path.join(pcie_rtl_dir, "pcie_s10_if_rx.v"),
|
||||
os.path.join(pcie_rtl_dir, "pcie_s10_if_tx.v"),
|
||||
os.path.join(pcie_rtl_dir, "pcie_s10_cfg.v"),
|
||||
os.path.join(pcie_rtl_dir, "pcie_s10_msi.v"),
|
||||
os.path.join(pcie_rtl_dir, "pulse_merge.v"),
|
||||
]
|
||||
|
||||
parameters = {}
|
||||
|
||||
# Structural configuration
|
||||
parameters['IF_COUNT'] = 1
|
||||
parameters['PORTS_PER_IF'] = 1
|
||||
|
||||
# PTP configuration
|
||||
parameters['PTP_USE_SAMPLE_CLOCK'] = 0
|
||||
parameters['PTP_PEROUT_ENABLE'] = 0
|
||||
parameters['PTP_PEROUT_COUNT'] = 1
|
||||
|
||||
# Queue manager configuration (interface)
|
||||
parameters['EVENT_QUEUE_OP_TABLE_SIZE'] = 32
|
||||
parameters['TX_QUEUE_OP_TABLE_SIZE'] = 32
|
||||
parameters['RX_QUEUE_OP_TABLE_SIZE'] = 32
|
||||
parameters['TX_CPL_QUEUE_OP_TABLE_SIZE'] = parameters['TX_QUEUE_OP_TABLE_SIZE']
|
||||
parameters['RX_CPL_QUEUE_OP_TABLE_SIZE'] = parameters['RX_QUEUE_OP_TABLE_SIZE']
|
||||
parameters['TX_QUEUE_INDEX_WIDTH'] = 13
|
||||
parameters['RX_QUEUE_INDEX_WIDTH'] = 8
|
||||
parameters['TX_CPL_QUEUE_INDEX_WIDTH'] = parameters['TX_QUEUE_INDEX_WIDTH']
|
||||
parameters['RX_CPL_QUEUE_INDEX_WIDTH'] = parameters['RX_QUEUE_INDEX_WIDTH']
|
||||
parameters['EVENT_QUEUE_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['TX_CPL_QUEUE_PIPELINE'] = parameters['TX_QUEUE_PIPELINE']
|
||||
parameters['RX_CPL_QUEUE_PIPELINE'] = parameters['RX_QUEUE_PIPELINE']
|
||||
|
||||
# TX and RX engine configuration (port)
|
||||
parameters['TX_DESC_TABLE_SIZE'] = 32
|
||||
parameters['RX_DESC_TABLE_SIZE'] = 32
|
||||
|
||||
# Scheduler configuration (port)
|
||||
parameters['TX_SCHEDULER_OP_TABLE_SIZE'] = parameters['TX_DESC_TABLE_SIZE']
|
||||
parameters['TX_SCHEDULER_PIPELINE'] = parameters['TX_QUEUE_PIPELINE']
|
||||
parameters['TDMA_INDEX_WIDTH'] = 6
|
||||
|
||||
# Timestamping configuration (port)
|
||||
parameters['PTP_TS_ENABLE'] = 1
|
||||
parameters['TX_PTP_TS_FIFO_DEPTH'] = 32
|
||||
parameters['RX_PTP_TS_FIFO_DEPTH'] = 32
|
||||
|
||||
# Interface configuration (port)
|
||||
parameters['TX_CHECKSUM_ENABLE'] = 1
|
||||
parameters['RX_RSS_ENABLE'] = 1
|
||||
parameters['RX_HASH_ENABLE'] = 1
|
||||
parameters['RX_CHECKSUM_ENABLE'] = 1
|
||||
parameters['TX_FIFO_DEPTH'] = 32768
|
||||
parameters['RX_FIFO_DEPTH'] = 131072
|
||||
parameters['MAX_TX_SIZE'] = 9214
|
||||
parameters['MAX_RX_SIZE'] = 9214
|
||||
parameters['TX_RAM_SIZE'] = 131072
|
||||
parameters['RX_RAM_SIZE'] = 131072
|
||||
|
||||
# Application block configuration
|
||||
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_LEN_WIDTH'] = 16
|
||||
parameters['DMA_TAG_WIDTH'] = 16
|
||||
parameters['RAM_PIPELINE'] = 2
|
||||
|
||||
# PCIe interface configuration
|
||||
parameters['SEG_COUNT'] = 2 if pcie_data_width == 512 else 1
|
||||
parameters['SEG_DATA_WIDTH'] = pcie_data_width // parameters['SEG_COUNT']
|
||||
parameters['SEG_EMPTY_WIDTH'] = ((parameters['SEG_DATA_WIDTH'] // 32) - 1).bit_length()
|
||||
parameters['TX_SEQ_NUM_WIDTH'] = 6
|
||||
parameters['TX_SEQ_NUM_ENABLE'] = 1
|
||||
parameters['L_TILE'] = 0
|
||||
parameters['PF_COUNT'] = 1
|
||||
parameters['VF_COUNT'] = 0
|
||||
parameters['PCIE_TAG_COUNT'] = 256
|
||||
parameters['PCIE_DMA_READ_OP_TABLE_SIZE'] = parameters['PCIE_TAG_COUNT']
|
||||
parameters['PCIE_DMA_READ_TX_LIMIT'] = 2**parameters['TX_SEQ_NUM_WIDTH']
|
||||
parameters['PCIE_DMA_READ_TX_FC_ENABLE'] = 1
|
||||
parameters['PCIE_DMA_WRITE_OP_TABLE_SIZE'] = 2**parameters['TX_SEQ_NUM_WIDTH']
|
||||
parameters['PCIE_DMA_WRITE_TX_LIMIT'] = 2**parameters['TX_SEQ_NUM_WIDTH']
|
||||
parameters['PCIE_DMA_WRITE_TX_FC_ENABLE'] = 1
|
||||
parameters['MSI_COUNT'] = 32
|
||||
|
||||
# AXI lite interface configuration (control)
|
||||
parameters['AXIL_CTRL_DATA_WIDTH'] = 32
|
||||
parameters['AXIL_CTRL_ADDR_WIDTH'] = 24
|
||||
parameters['AXIL_CSR_PASSTHROUGH_ENABLE'] = 0
|
||||
|
||||
# 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_DATA_WIDTH'] = axis_eth_data_width
|
||||
parameters['AXIS_ETH_SYNC_DATA_WIDTH'] = axis_eth_sync_data_width
|
||||
parameters['AXIS_ETH_RX_USE_READY'] = 0
|
||||
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'] = 1
|
||||
parameters['STAT_DMA_ENABLE'] = 1
|
||||
parameters['STAT_PCIE_ENABLE'] = 1
|
||||
parameters['STAT_INC_WIDTH'] = 24
|
||||
parameters['STAT_ID_WIDTH'] = 12
|
||||
|
||||
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,
|
||||
)
|
Loading…
x
Reference in New Issue
Block a user