fpga: lib: Add width agnostic version of Ethernet Interface
The rnfoc/xport section is refactored in System Verilog to allow the
following improvements
(1) CPU_W - Sets the size of the c2e and e2c pipes. This can be run
at a different clock rate than the main ethernet pipe
(2) CHDR_W - Sets the size of the v2e and e2v pipes. This can be run
at a different clock rate than the main ethernet pipe
(3) ENET_W - Sets the size of the eth_tx and eth_rx pipes.
eth_interface_tb runs traffic from e2c,e2v,v2e,c2e simultaneously
against the original xport_sv implementation, and against the new
implementation with widths of 64/128/512. A chdr_management node
info request queries the port info of the node0 in the eth_interface.
eth_ifc_synth_test.sv can be compiled with the make xsim target to test
out the size of various configurations.
Original-commit: eed4988cc266a63370a4332351d02fadedde3a3b
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
wave.do
|
||||
*.dcp
|
||||
*.rpt
|
||||
@@ -0,0 +1,81 @@
|
||||
#
|
||||
# Copyright 2020 Ettus Research, a National Instruments Brand
|
||||
#
|
||||
# SPDX-License-Identifier: LGPL-3.0-or-later
|
||||
#
|
||||
|
||||
#-------------------------------------------------
|
||||
# Top-of-Makefile
|
||||
#-------------------------------------------------
|
||||
# Define BASE_DIR to point to the "top" dir
|
||||
BASE_DIR = $(abspath ../../../../top)
|
||||
# Include viv_sim_preamble after defining BASE_DIR
|
||||
include $(BASE_DIR)/../tools/make/viv_sim_preamble.mak
|
||||
|
||||
#-------------------------------------------------
|
||||
# Design Specific
|
||||
#-------------------------------------------------
|
||||
SYNTH_DUT = eth_ifc_synth_test
|
||||
|
||||
# Include makefiles and sources for the DUT and its dependencies
|
||||
include $(BASE_DIR)/../lib/control/Makefile.srcs
|
||||
include $(BASE_DIR)/../lib/axi/Makefile.srcs
|
||||
include $(BASE_DIR)/../lib/axi4s_sv/Makefile.srcs
|
||||
include $(BASE_DIR)/../lib/packet_proc/Makefile.srcs
|
||||
include $(BASE_DIR)/../lib/xge_interface/Makefile.srcs
|
||||
include $(BASE_DIR)/../lib/fifo/Makefile.srcs
|
||||
include $(BASE_DIR)/../lib/rfnoc/utils/Makefile.srcs
|
||||
include $(BASE_DIR)/../lib/rfnoc/xport/Makefile.srcs
|
||||
include $(BASE_DIR)/../lib/rfnoc/xport_sv/Makefile.srcs
|
||||
include $(BASE_DIR)/../lib/rfnoc/crossbar/Makefile.srcs
|
||||
include $(BASE_DIR)/../lib/rfnoc/core/Makefile.srcs
|
||||
|
||||
BUILD_IP_DIR = $(abspath $(BASE_DIR)/x300/build-ip/xc7k410tffg900-2)
|
||||
|
||||
IP_SRC = \
|
||||
$(abspath $(BUILD_IP_DIR)/fifo_short_2clk/fifo_short_2clk_sim_netlist.v)
|
||||
# Xilinx IP wants lots of libraries
|
||||
MODELSIM_LIBS += secureip unimacro_ver unisims_ver xilinx_vip xpm
|
||||
MODELSIM_ARGS += glbl -t 1fs
|
||||
|
||||
DESIGN_SRCS = $(abspath \
|
||||
eth_ifc_synth_test.sv \
|
||||
$(FIFO_SRCS) \
|
||||
$(CONTROL_LIB_SRCS) \
|
||||
$(AXI_SRCS) \
|
||||
$(AXI4S_SV_SRCS) \
|
||||
$(XGE_INTERFACE_SRCS) \
|
||||
$(PACKET_PROC_SRCS) \
|
||||
$(RFNOC_UTIL_SRCS) \
|
||||
$(RFNOC_XPORT_SRCS) \
|
||||
$(RFNOC_XPORT_SV_SRCS) \
|
||||
$(RFNOC_XBAR_SRCS) \
|
||||
$(RFNOC_CORE_SRCS) \
|
||||
$(IP_SRC) \
|
||||
)
|
||||
|
||||
#-------------------------------------------------
|
||||
# Testbench Specific
|
||||
#-------------------------------------------------
|
||||
# Define only one toplevel module
|
||||
TB_TOP_MODULE ?= eth_ifc_all_tb
|
||||
#TB_TOP_MODULE ?= eth_ifc_synth_test
|
||||
SIM_TOP = $(TB_TOP_MODULE)
|
||||
|
||||
SIM_SRCS = \
|
||||
$(abspath eth_ifc_tb.sv) \
|
||||
$(abspath $(TB_TOP_MODULE).sv)
|
||||
|
||||
# supressing the following worthless reminder.
|
||||
#* Warning: M:/usrp4-hw/oss-repo/fpga/usrp3/lib/axi4s_sv/axi4s_remove_bytes.sv(228): (vlog-2583) [SVCHK] -
|
||||
# Extra checking for conflicts with always_comb and always_latch variables is done at vopt time
|
||||
SVLOG_ARGS = -suppress 2583 -keep_delta
|
||||
VLOG_ARGS = -keep_delta
|
||||
|
||||
#-------------------------------------------------
|
||||
# Bottom-of-Makefile
|
||||
#-------------------------------------------------
|
||||
# Include all simulator specific makefiles here
|
||||
# Each should define a unique target to simulate
|
||||
# e.g. xsim, vsim, etc and a common "clean" target
|
||||
include $(BASE_DIR)/../tools/make/viv_simulator.mak
|
||||
@@ -0,0 +1,24 @@
|
||||
//
|
||||
// Copyright 2020 Ettus Research, a National Instruments Brand
|
||||
//
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||
//
|
||||
// Module: eth_ifc_all_tb
|
||||
//
|
||||
// Description: Testbench for eth_ifc
|
||||
//
|
||||
|
||||
module eth_ifc_all_tb #(
|
||||
/* no PARAM */
|
||||
)(
|
||||
/* no IO */
|
||||
);
|
||||
|
||||
eth_ifc_tb #(.TEST_NAME("ORIGINAL"),.ENET_W(64),.CPU_W(64),.CHDR_W(64),.SV_ETH_IFC(0)) ORIGINAL ();
|
||||
|
||||
eth_ifc_tb #(.TEST_NAME("64B"),.ENET_W(64),.CPU_W(64),.CHDR_W(64)) ETH64 ();
|
||||
eth_ifc_tb #(.TEST_NAME("512_64B"),.ENET_W(512),.CPU_W(64),.CHDR_W(64)) ETH512_CHDR64 ();
|
||||
eth_ifc_tb #(.TEST_NAME("512_128B"),.ENET_W(512),.CPU_W(64),.CHDR_W(128)) ETH512_CHDR128 ();
|
||||
eth_ifc_tb #(.TEST_NAME("512B"),.ENET_W(512),.CPU_W(64),.CHDR_W(512)) ETH512_CHDR512 ();
|
||||
|
||||
endmodule
|
||||
@@ -0,0 +1,161 @@
|
||||
//
|
||||
// Copyright 2020 Ettus Research, a National Instruments Brand
|
||||
//
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||
//
|
||||
//
|
||||
// Module: eth_ifc_synth_test
|
||||
//
|
||||
// Description: Wrapper to test size of 64 bit version
|
||||
//
|
||||
// Parameters: -- get descriptions from eth_ipv4_interface
|
||||
// PROTOVER -
|
||||
// MTU - Max Packet Size
|
||||
// NODE_INST -
|
||||
// RT_TBL_SIZE -
|
||||
// REG_AWIDTH -
|
||||
// BASE -
|
||||
// EWIDTH - Ethernet Width
|
||||
// CWIDTH - CPU Width
|
||||
// VWIDTH - CHDR Width
|
||||
|
||||
module eth_ifc_synth_test #(
|
||||
parameter [15:0] PROTOVER = {8'd1, 8'd0},
|
||||
parameter MTU = 10,
|
||||
parameter NODE_INST = 0,
|
||||
parameter RT_TBL_SIZE = 6,
|
||||
parameter REG_AWIDTH = 14,
|
||||
parameter BASE = 0,
|
||||
parameter EWIDTH = 512,
|
||||
parameter CWIDTH = 64,
|
||||
parameter VWIDTH = 128
|
||||
) (
|
||||
input logic bus_clk,
|
||||
input logic bus_rst,
|
||||
input logic [15:0] device_id,
|
||||
|
||||
// Register port: Write port (domain: clk)
|
||||
input logic reg_wr_req,
|
||||
input logic [REG_AWIDTH-1:0] reg_wr_addr,
|
||||
input logic [31:0] reg_wr_data,
|
||||
|
||||
// Register port: Read port (domain: clk)
|
||||
input logic reg_rd_req,
|
||||
input logic [REG_AWIDTH-1:0] reg_rd_addr,
|
||||
output logic reg_rd_resp,
|
||||
output logic [31:0] reg_rd_data,
|
||||
|
||||
// Status ports (domain: clk)
|
||||
output logic [47:0] my_mac,
|
||||
output logic [31:0] my_ip,
|
||||
output logic [15:0] my_udp_chdr_port,
|
||||
|
||||
// Ethernet ports
|
||||
output logic [EWIDTH-1:0] eth_tx_tdata,
|
||||
output logic [$clog2(EWIDTH/8):0] eth_tx_tuser,
|
||||
output logic eth_tx_tlast,
|
||||
output logic eth_tx_tvalid,
|
||||
input logic eth_tx_tready,
|
||||
input logic [EWIDTH-1:0] eth_rx_tdata,
|
||||
input logic [$clog2(EWIDTH/8):0] eth_rx_tuser,
|
||||
input logic eth_rx_tlast,
|
||||
input logic eth_rx_tvalid,
|
||||
output logic eth_rx_tready,
|
||||
|
||||
// CHDR router interface
|
||||
output logic [VWIDTH-1:0] e2v_tdata,
|
||||
output logic e2v_tlast,
|
||||
output logic e2v_tvalid,
|
||||
input logic e2v_tready,
|
||||
input logic [VWIDTH-1:0] v2e_tdata,
|
||||
input logic v2e_tlast,
|
||||
input logic v2e_tvalid,
|
||||
output logic v2e_tready,
|
||||
|
||||
// CPU
|
||||
output logic [CWIDTH-1:0] e2c_tdata,
|
||||
output logic [$clog2(CWIDTH/8):0] e2c_tuser,
|
||||
output logic e2c_tlast,
|
||||
output logic e2c_tvalid,
|
||||
input logic e2c_tready,
|
||||
input logic [CWIDTH-1:0] c2e_tdata,
|
||||
input logic [$clog2(CWIDTH/8):0] c2e_tuser,
|
||||
input logic c2e_tlast,
|
||||
input logic c2e_tvalid,
|
||||
output logic c2e_tready
|
||||
|
||||
);
|
||||
|
||||
localparam MAX_PACKET_BYTES = 2**16;
|
||||
localparam ENET_W=EWIDTH;
|
||||
localparam ENET_USER_W=$clog2(EWIDTH/8)+1;
|
||||
localparam CHDR_W=VWIDTH;
|
||||
localparam CHDR_USER_W=$clog2(VWIDTH/8)+1;
|
||||
localparam CPU_W=CWIDTH;
|
||||
localparam CPU_USER_W=$clog2(CWIDTH/8)+1;
|
||||
|
||||
AxiStreamIf #(.DATA_WIDTH(ENET_W),.USER_WIDTH(ENET_USER_W),.TKEEP(0),
|
||||
.MAX_PACKET_BYTES(MAX_PACKET_BYTES))
|
||||
eth_tx (bus_clk, bus_reset);
|
||||
AxiStreamIf #(.DATA_WIDTH(ENET_W),.USER_WIDTH(ENET_USER_W),.TKEEP(0),
|
||||
.MAX_PACKET_BYTES(MAX_PACKET_BYTES))
|
||||
eth_rx (bus_clk, bus_reset);
|
||||
|
||||
AxiStreamIf #(.DATA_WIDTH(CHDR_W),.USER_WIDTH(CHDR_USER_W),.TKEEP(0),.TUSER(0))
|
||||
v2e (bus_clk, bus_reset);
|
||||
AxiStreamIf #(.DATA_WIDTH(CHDR_W),.USER_WIDTH(CHDR_USER_W),.TKEEP(0),.TUSER(0))
|
||||
e2v (bus_clk, bus_reset);
|
||||
|
||||
AxiStreamIf #(.DATA_WIDTH(CPU_W),.USER_WIDTH(CPU_USER_W),.TKEEP(0))
|
||||
c2e (bus_clk, bus_reset);
|
||||
AxiStreamIf #(.DATA_WIDTH(CPU_W),.USER_WIDTH(CPU_USER_W),.TKEEP(0))
|
||||
e2c (bus_clk, bus_reset);
|
||||
|
||||
assign eth_tx_tdata = eth_tx.tdata;
|
||||
assign eth_tx_tuser = eth_tx.tuser;
|
||||
assign eth_tx_tlast = eth_tx.tlast;
|
||||
assign eth_tx_tvalid = eth_tx.tvalid;
|
||||
assign eth_tx.tready = eth_tx_tready;
|
||||
|
||||
assign eth_rx.tdata = eth_rx_tdata;
|
||||
assign eth_rx.tuser = eth_rx_tuser;
|
||||
assign eth_rx.tlast = eth_rx_tlast;
|
||||
assign eth_rx.tvalid = eth_rx_tvalid;
|
||||
assign eth_rx_tready = eth_rx.tready;
|
||||
|
||||
assign e2v_tdata = e2v.tdata;
|
||||
assign e2v_tlast = e2v.tlast;
|
||||
assign e2v_tvalid = e2v.tvalid;
|
||||
assign e2v.tready = e2v_tready;
|
||||
|
||||
assign v2e.tdata = v2e_tdata;
|
||||
assign v2e.tlast = v2e_tlast;
|
||||
assign v2e.tvalid = v2e_tvalid;
|
||||
assign v2e_tready = v2e.tready;
|
||||
|
||||
assign e2c_tdata = e2c.tdata;
|
||||
assign e2c_tuser = e2c.tuser;
|
||||
assign e2c_tlast = e2c.tlast;
|
||||
assign e2c_tvalid = e2c.tvalid;
|
||||
assign e2c.tready = e2c_tready;
|
||||
|
||||
assign c2e.tdata = c2e_tdata;
|
||||
assign c2e.tuser = c2e_tuser;
|
||||
assign c2e.tlast = c2e_tlast;
|
||||
assign c2e.tvalid = c2e_tvalid;
|
||||
assign c2e_tready = c2e.tready;
|
||||
|
||||
eth_ipv4_interface #(
|
||||
.PROTOVER(PROTOVER), .MTU(MTU), .NODE_INST(NODE_INST),
|
||||
.REG_AWIDTH(REG_AWIDTH), .RT_TBL_SIZE(RT_TBL_SIZE),
|
||||
.BASE(BASE),
|
||||
.DROP_UNKNOWN_MAC(0),
|
||||
.DROP_MIN_PACKET(0),
|
||||
.PREAMBLE_BYTES(0),
|
||||
.ADD_SOF(0),
|
||||
.SYNC(0),
|
||||
.ENET_W(EWIDTH),.CPU_W(CWIDTH),.CHDR_W(VWIDTH)
|
||||
) eth_interface (
|
||||
.* );
|
||||
|
||||
endmodule
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user