From 870cebb798fce9be3261c73a69c0a9858aac0d47 Mon Sep 17 00:00:00 2001 From: Alex Forencich Date: Sun, 11 Feb 2024 13:00:37 -0800 Subject: [PATCH] Clean up PTP parameters on MACs Signed-off-by: Alex Forencich --- rtl/axis_baser_rx_64.v | 11 ++--- rtl/axis_baser_tx_64.v | 15 ++++--- rtl/axis_xgmii_rx_64.v | 11 ++--- rtl/axis_xgmii_tx_64.v | 15 ++++--- rtl/eth_mac_10g.v | 45 ++++++++++--------- rtl/eth_mac_10g_fifo.v | 23 +++++----- rtl/eth_mac_1g.v | 33 +++++++------- rtl/eth_mac_phy_10g.v | 29 ++++++------ rtl/eth_mac_phy_10g_fifo.v | 23 +++++----- rtl/eth_mac_phy_10g_rx.v | 4 +- rtl/eth_mac_phy_10g_tx.v | 4 +- tb/axis_baser_rx_64/Makefile | 3 +- tb/axis_baser_rx_64/test_axis_baser_rx_64.py | 3 +- tb/axis_baser_tx_64/Makefile | 3 +- tb/axis_baser_tx_64/test_axis_baser_tx_64.py | 3 +- tb/axis_xgmii_rx_64/Makefile | 3 +- tb/axis_xgmii_rx_64/test_axis_xgmii_rx_64.py | 3 +- tb/axis_xgmii_tx_64/Makefile | 3 +- tb/axis_xgmii_tx_64/test_axis_xgmii_tx_64.py | 3 +- tb/eth_mac_10g/Makefile | 13 +++--- tb/eth_mac_10g/test_eth_mac_10g.py | 15 +++---- tb/eth_mac_10g_fifo/Makefile | 14 +++--- tb/eth_mac_10g_fifo/test_eth_mac_10g_fifo.py | 14 +++--- tb/eth_mac_1g/Makefile | 15 +++---- tb/eth_mac_1g/test_eth_mac_1g.py | 15 +++---- tb/eth_mac_phy_10g/Makefile | 15 +++---- tb/eth_mac_phy_10g/test_eth_mac_phy_10g.py | 15 +++---- tb/eth_mac_phy_10g_fifo/Makefile | 14 +++--- .../test_eth_mac_phy_10g_fifo.py | 14 +++--- 29 files changed, 195 insertions(+), 186 deletions(-) diff --git a/rtl/axis_baser_rx_64.v b/rtl/axis_baser_rx_64.v index 714c9194a..a20d26980 100644 --- a/rtl/axis_baser_rx_64.v +++ b/rtl/axis_baser_rx_64.v @@ -39,7 +39,8 @@ module axis_baser_rx_64 # parameter PTP_PERIOD_NS = 4'h6, parameter PTP_PERIOD_FNS = 16'h6666, parameter PTP_TS_ENABLE = 0, - parameter PTP_TS_WIDTH = 96, + parameter PTP_TS_FMT_TOD = 1, + parameter PTP_TS_WIDTH = PTP_TS_FMT_TOD ? 96 : 64, parameter USER_WIDTH = (PTP_TS_ENABLE ? PTP_TS_WIDTH : 0) + 1 ) ( @@ -287,7 +288,7 @@ always @* begin reset_crc = 1'b1; if (PTP_TS_ENABLE) begin - m_axis_tuser_next[1 +: PTP_TS_WIDTH] = (PTP_TS_WIDTH != 96 || ptp_ts_borrow_reg) ? ptp_ts_reg : ptp_ts_adj_reg; + m_axis_tuser_next[1 +: PTP_TS_WIDTH] = (!PTP_TS_FMT_TOD || ptp_ts_borrow_reg) ? ptp_ts_reg : ptp_ts_adj_reg; end if (input_type_d1 == INPUT_TYPE_START_0 && cfg_rx_enable) begin @@ -399,7 +400,7 @@ always @(posedge clk) begin swap_data <= encoded_rx_data_masked[63:32]; - if (PTP_TS_ENABLE && PTP_TS_WIDTH == 96) begin + if (PTP_TS_ENABLE && PTP_TS_FMT_TOD) begin // ns field rollover ptp_ts_adj_reg[15:0] <= ptp_ts_reg[15:0]; {ptp_ts_borrow_reg, ptp_ts_adj_reg[45:16]} <= $signed({1'b0, ptp_ts_reg[45:16]}) - $signed(31'd1000000000); @@ -413,7 +414,7 @@ always @(posedge clk) begin input_type_d0 <= INPUT_TYPE_START_0; input_data_d0 <= encoded_rx_data_masked; - if (PTP_TS_WIDTH == 96) begin + if (PTP_TS_FMT_TOD) begin ptp_ts_reg[45:0] <= ptp_ts[45:0] + (PTP_PERIOD_NS * 2**16 + PTP_PERIOD_FNS); ptp_ts_reg[95:48] <= ptp_ts[95:48]; end else begin @@ -431,7 +432,7 @@ always @(posedge clk) begin end input_data_d0 <= {encoded_rx_data_masked[31:0], swap_data}; - if (PTP_TS_WIDTH == 96) begin + if (PTP_TS_FMT_TOD) begin ptp_ts_reg[45:0] <= ptp_ts[45:0] + (((PTP_PERIOD_NS * 2**16 + PTP_PERIOD_FNS) * 3) >> 1); ptp_ts_reg[95:48] <= ptp_ts[95:48]; end else begin diff --git a/rtl/axis_baser_tx_64.v b/rtl/axis_baser_tx_64.v index 1dcae6006..abc52ed52 100644 --- a/rtl/axis_baser_tx_64.v +++ b/rtl/axis_baser_tx_64.v @@ -42,7 +42,8 @@ module axis_baser_tx_64 # parameter PTP_PERIOD_NS = 4'h6, parameter PTP_PERIOD_FNS = 16'h6666, parameter PTP_TS_ENABLE = 0, - parameter PTP_TS_WIDTH = 96, + parameter PTP_TS_FMT_TOD = 1, + parameter PTP_TS_WIDTH = PTP_TS_FMT_TOD ? 96 : 64, parameter PTP_TS_CTRL_IN_TUSER = 0, parameter PTP_TAG_ENABLE = PTP_TS_ENABLE, parameter PTP_TAG_WIDTH = 16, @@ -231,7 +232,7 @@ assign s_axis_tready = s_axis_tready_reg; assign encoded_tx_data = encoded_tx_data_reg; assign encoded_tx_hdr = encoded_tx_hdr_reg; -assign m_axis_ptp_ts = PTP_TS_ENABLE ? ((PTP_TS_WIDTH != 96 || m_axis_ptp_ts_borrow_reg) ? m_axis_ptp_ts_reg : m_axis_ptp_ts_adj_reg) : 0; +assign m_axis_ptp_ts = PTP_TS_ENABLE ? ((!PTP_TS_FMT_TOD || m_axis_ptp_ts_borrow_reg) ? m_axis_ptp_ts_reg : m_axis_ptp_ts_adj_reg) : 0; assign m_axis_ptp_ts_tag = PTP_TAG_ENABLE ? m_axis_ptp_ts_tag_reg : 0; assign m_axis_ptp_ts_valid = PTP_TS_ENABLE || PTP_TAG_ENABLE ? m_axis_ptp_ts_valid_reg : 1'b0; @@ -384,7 +385,7 @@ always @* begin frame_next = !s_axis_tlast; end - if (PTP_TS_ENABLE && PTP_TS_WIDTH == 96) begin + if (PTP_TS_ENABLE && PTP_TS_FMT_TOD) begin m_axis_ptp_ts_valid_next = m_axis_ptp_ts_valid_int_reg; m_axis_ptp_ts_adj_next[15:0] = m_axis_ptp_ts_reg[15:0]; {m_axis_ptp_ts_borrow_next, m_axis_ptp_ts_adj_next[45:16]} = $signed({1'b0, m_axis_ptp_ts_reg[45:16]}) - $signed(31'd1000000000); @@ -411,7 +412,7 @@ always @* begin if (swap_lanes_reg) begin // lanes swapped if (PTP_TS_ENABLE) begin - if (PTP_TS_WIDTH == 96) begin + if (PTP_TS_FMT_TOD) begin m_axis_ptp_ts_next[45:0] = ptp_ts[45:0] + (((PTP_PERIOD_NS * 2**16 + PTP_PERIOD_FNS) * 3) >> 1); m_axis_ptp_ts_next[95:48] = ptp_ts[95:48]; end else begin @@ -422,7 +423,7 @@ always @* begin end else begin // lanes not swapped if (PTP_TS_ENABLE) begin - if (PTP_TS_WIDTH == 96) begin + if (PTP_TS_FMT_TOD) begin m_axis_ptp_ts_next[45:0] = ptp_ts[45:0] + (PTP_PERIOD_NS * 2**16 + PTP_PERIOD_FNS); m_axis_ptp_ts_next[95:48] = ptp_ts[95:48]; end else begin @@ -434,14 +435,14 @@ always @* begin if (PTP_TS_ENABLE) begin if (PTP_TS_CTRL_IN_TUSER) begin m_axis_ptp_ts_tag_next = s_axis_tuser >> 2; - if (PTP_TS_WIDTH == 96) begin + if (PTP_TS_FMT_TOD) begin m_axis_ptp_ts_valid_int_next = s_axis_tuser[1]; end else begin m_axis_ptp_ts_valid_next = s_axis_tuser[1]; end end else begin m_axis_ptp_ts_tag_next = s_axis_tuser >> 1; - if (PTP_TS_WIDTH == 96) begin + if (PTP_TS_FMT_TOD) begin m_axis_ptp_ts_valid_int_next = 1'b1; end else begin m_axis_ptp_ts_valid_next = 1'b1; diff --git a/rtl/axis_xgmii_rx_64.v b/rtl/axis_xgmii_rx_64.v index 471f0f6a5..586de38cf 100644 --- a/rtl/axis_xgmii_rx_64.v +++ b/rtl/axis_xgmii_rx_64.v @@ -39,7 +39,8 @@ module axis_xgmii_rx_64 # parameter PTP_PERIOD_NS = 4'h6, parameter PTP_PERIOD_FNS = 16'h6666, parameter PTP_TS_ENABLE = 0, - parameter PTP_TS_WIDTH = 96, + parameter PTP_TS_FMT_TOD = 1, + parameter PTP_TS_WIDTH = PTP_TS_FMT_TOD ? 96 : 64, parameter USER_WIDTH = (PTP_TS_ENABLE ? PTP_TS_WIDTH : 0) + 1 ) ( @@ -236,7 +237,7 @@ always @* begin m_axis_tuser_next[0] = 1'b0; if (PTP_TS_ENABLE) begin - m_axis_tuser_next[1 +: PTP_TS_WIDTH] = (PTP_TS_WIDTH != 96 || ptp_ts_borrow_reg) ? ptp_ts_reg : ptp_ts_adj_reg; + m_axis_tuser_next[1 +: PTP_TS_WIDTH] = (!PTP_TS_FMT_TOD || ptp_ts_borrow_reg) ? ptp_ts_reg : ptp_ts_adj_reg; end if (framing_error_reg || framing_error_d0_reg) begin @@ -326,7 +327,7 @@ always @(posedge clk) begin xgmii_start_swap <= 1'b0; xgmii_start_d0 <= xgmii_start_swap; - if (PTP_TS_ENABLE && PTP_TS_WIDTH == 96) begin + if (PTP_TS_ENABLE && PTP_TS_FMT_TOD) begin // ns field rollover ptp_ts_adj_reg[15:0] <= ptp_ts_reg[15:0]; {ptp_ts_borrow_reg, ptp_ts_adj_reg[45:16]} <= $signed({1'b0, ptp_ts_reg[45:16]}) - $signed(31'd1000000000); @@ -378,7 +379,7 @@ always @(posedge clk) begin term_present_reg <= 1'b0; framing_error_reg <= xgmii_rxc[7:1] != 0; - if (PTP_TS_WIDTH == 96) begin + if (PTP_TS_FMT_TOD) begin ptp_ts_reg[45:0] <= ptp_ts[45:0] + (PTP_PERIOD_NS * 2**16 + PTP_PERIOD_FNS); ptp_ts_reg[95:48] <= ptp_ts[95:48]; end else begin @@ -394,7 +395,7 @@ always @(posedge clk) begin term_present_reg <= 1'b0; framing_error_reg <= xgmii_rxc[7:5] != 0; - if (PTP_TS_WIDTH == 96) begin + if (PTP_TS_FMT_TOD) begin ptp_ts_reg[45:0] <= ptp_ts[45:0] + (((PTP_PERIOD_NS * 2**16 + PTP_PERIOD_FNS) * 3) >> 1); ptp_ts_reg[95:48] <= ptp_ts[95:48]; end else begin diff --git a/rtl/axis_xgmii_tx_64.v b/rtl/axis_xgmii_tx_64.v index 4b45d64c1..cb4235a2f 100644 --- a/rtl/axis_xgmii_tx_64.v +++ b/rtl/axis_xgmii_tx_64.v @@ -42,7 +42,8 @@ module axis_xgmii_tx_64 # parameter PTP_PERIOD_NS = 4'h6, parameter PTP_PERIOD_FNS = 16'h6666, parameter PTP_TS_ENABLE = 0, - parameter PTP_TS_WIDTH = 96, + parameter PTP_TS_FMT_TOD = 1, + parameter PTP_TS_WIDTH = PTP_TS_FMT_TOD ? 96 : 64, parameter PTP_TS_CTRL_IN_TUSER = 0, parameter PTP_TAG_ENABLE = PTP_TS_ENABLE, parameter PTP_TAG_WIDTH = 16, @@ -176,7 +177,7 @@ assign s_axis_tready = s_axis_tready_reg; assign xgmii_txd = xgmii_txd_reg; assign xgmii_txc = xgmii_txc_reg; -assign m_axis_ptp_ts = PTP_TS_ENABLE ? ((PTP_TS_WIDTH != 96 || m_axis_ptp_ts_borrow_reg) ? m_axis_ptp_ts_reg : m_axis_ptp_ts_adj_reg) : 0; +assign m_axis_ptp_ts = PTP_TS_ENABLE ? ((!PTP_TS_FMT_TOD || m_axis_ptp_ts_borrow_reg) ? m_axis_ptp_ts_reg : m_axis_ptp_ts_adj_reg) : 0; assign m_axis_ptp_ts_tag = PTP_TAG_ENABLE ? m_axis_ptp_ts_tag_reg : 0; assign m_axis_ptp_ts_valid = PTP_TS_ENABLE || PTP_TAG_ENABLE ? m_axis_ptp_ts_valid_reg : 1'b0; @@ -330,7 +331,7 @@ always @* begin frame_next = !s_axis_tlast; end - if (PTP_TS_ENABLE && PTP_TS_WIDTH == 96) begin + if (PTP_TS_ENABLE && PTP_TS_FMT_TOD) begin m_axis_ptp_ts_valid_next = m_axis_ptp_ts_valid_int_reg; m_axis_ptp_ts_adj_next[15:0] = m_axis_ptp_ts_reg[15:0]; {m_axis_ptp_ts_borrow_next, m_axis_ptp_ts_adj_next[45:16]} = $signed({1'b0, m_axis_ptp_ts_reg[45:16]}) - $signed(31'd1000000000); @@ -358,7 +359,7 @@ always @* begin if (swap_lanes_reg) begin // lanes swapped if (PTP_TS_ENABLE) begin - if (PTP_TS_WIDTH == 96) begin + if (PTP_TS_FMT_TOD) begin m_axis_ptp_ts_next[45:0] = ptp_ts[45:0] + (((PTP_PERIOD_NS * 2**16 + PTP_PERIOD_FNS) * 3) >> 1); m_axis_ptp_ts_next[95:48] = ptp_ts[95:48]; end else begin @@ -369,7 +370,7 @@ always @* begin end else begin // lanes not swapped if (PTP_TS_ENABLE) begin - if (PTP_TS_WIDTH == 96) begin + if (PTP_TS_FMT_TOD) begin m_axis_ptp_ts_next[45:0] = ptp_ts[45:0] + (PTP_PERIOD_NS * 2**16 + PTP_PERIOD_FNS); m_axis_ptp_ts_next[95:48] = ptp_ts[95:48]; end else begin @@ -381,14 +382,14 @@ always @* begin if (PTP_TS_ENABLE) begin if (PTP_TS_CTRL_IN_TUSER) begin m_axis_ptp_ts_tag_next = s_axis_tuser >> 2; - if (PTP_TS_WIDTH == 96) begin + if (PTP_TS_FMT_TOD) begin m_axis_ptp_ts_valid_int_next = s_axis_tuser[1]; end else begin m_axis_ptp_ts_valid_next = s_axis_tuser[1]; end end else begin m_axis_ptp_ts_tag_next = s_axis_tuser >> 1; - if (PTP_TS_WIDTH == 96) begin + if (PTP_TS_FMT_TOD) begin m_axis_ptp_ts_valid_int_next = 1'b1; end else begin m_axis_ptp_ts_valid_next = 1'b1; diff --git a/rtl/eth_mac_10g.v b/rtl/eth_mac_10g.v index c64f5aae2..dfea28895 100644 --- a/rtl/eth_mac_10g.v +++ b/rtl/eth_mac_10g.v @@ -41,15 +41,14 @@ module eth_mac_10g # parameter MIN_FRAME_LENGTH = 64, parameter PTP_PERIOD_NS = 4'h6, parameter PTP_PERIOD_FNS = 16'h6666, - parameter TX_PTP_TS_ENABLE = 0, - parameter TX_PTP_TS_WIDTH = 96, + parameter PTP_TS_ENABLE = 0, + parameter PTP_TS_FMT_TOD = 1, + parameter PTP_TS_WIDTH = PTP_TS_FMT_TOD ? 96 : 64, parameter TX_PTP_TS_CTRL_IN_TUSER = 0, - parameter TX_PTP_TAG_ENABLE = TX_PTP_TS_ENABLE, + parameter TX_PTP_TAG_ENABLE = PTP_TS_ENABLE, parameter TX_PTP_TAG_WIDTH = 16, - parameter RX_PTP_TS_ENABLE = TX_PTP_TS_ENABLE, - parameter RX_PTP_TS_WIDTH = 96, - parameter TX_USER_WIDTH = (TX_PTP_TS_ENABLE ? (TX_PTP_TAG_ENABLE ? TX_PTP_TAG_WIDTH : 0) + (TX_PTP_TS_CTRL_IN_TUSER ? 1 : 0) : 0) + 1, - parameter RX_USER_WIDTH = (RX_PTP_TS_ENABLE ? RX_PTP_TS_WIDTH : 0) + 1, + parameter TX_USER_WIDTH = (PTP_TS_ENABLE ? (TX_PTP_TAG_ENABLE ? TX_PTP_TAG_WIDTH : 0) + (TX_PTP_TS_CTRL_IN_TUSER ? 1 : 0) : 0) + 1, + parameter RX_USER_WIDTH = (PTP_TS_ENABLE ? PTP_TS_WIDTH : 0) + 1, parameter PFC_ENABLE = 0, parameter PAUSE_ENABLE = PFC_ENABLE ) @@ -89,9 +88,9 @@ module eth_mac_10g # /* * PTP */ - input wire [TX_PTP_TS_WIDTH-1:0] tx_ptp_ts, - input wire [RX_PTP_TS_WIDTH-1:0] rx_ptp_ts, - output wire [TX_PTP_TS_WIDTH-1:0] tx_axis_ptp_ts, + input wire [PTP_TS_WIDTH-1:0] tx_ptp_ts, + input wire [PTP_TS_WIDTH-1:0] rx_ptp_ts, + output wire [PTP_TS_WIDTH-1:0] tx_axis_ptp_ts, output wire [TX_PTP_TAG_WIDTH-1:0] tx_axis_ptp_ts_tag, output wire tx_axis_ptp_ts_valid, @@ -187,7 +186,7 @@ module eth_mac_10g # ); parameter MAC_CTRL_ENABLE = PAUSE_ENABLE || PFC_ENABLE; -parameter TX_USER_WIDTH_INT = MAC_CTRL_ENABLE ? (TX_PTP_TS_ENABLE ? (TX_PTP_TAG_ENABLE ? TX_PTP_TAG_WIDTH : 0) + 1 : 0) + 1 : TX_USER_WIDTH; +parameter TX_USER_WIDTH_INT = MAC_CTRL_ENABLE ? (PTP_TS_ENABLE ? (TX_PTP_TAG_ENABLE ? TX_PTP_TAG_WIDTH : 0) + 1 : 0) + 1 : TX_USER_WIDTH; // bus width assertions initial begin @@ -225,8 +224,9 @@ axis_xgmii_rx_64 #( .CTRL_WIDTH(CTRL_WIDTH), .PTP_PERIOD_NS(PTP_PERIOD_NS), .PTP_PERIOD_FNS(PTP_PERIOD_FNS), - .PTP_TS_ENABLE(RX_PTP_TS_ENABLE), - .PTP_TS_WIDTH(RX_PTP_TS_WIDTH), + .PTP_TS_ENABLE(PTP_TS_ENABLE), + .PTP_TS_FMT_TOD(PTP_TS_FMT_TOD), + .PTP_TS_WIDTH(PTP_TS_WIDTH), .USER_WIDTH(RX_USER_WIDTH) ) axis_xgmii_rx_inst ( @@ -255,9 +255,10 @@ axis_xgmii_tx_64 #( .MIN_FRAME_LENGTH(MIN_FRAME_LENGTH), .PTP_PERIOD_NS(PTP_PERIOD_NS), .PTP_PERIOD_FNS(PTP_PERIOD_FNS), - .PTP_TS_ENABLE(TX_PTP_TS_ENABLE), - .PTP_TS_WIDTH(TX_PTP_TS_WIDTH), - .PTP_TS_CTRL_IN_TUSER(MAC_CTRL_ENABLE ? TX_PTP_TS_ENABLE : TX_PTP_TS_CTRL_IN_TUSER), + .PTP_TS_ENABLE(PTP_TS_ENABLE), + .PTP_TS_FMT_TOD(PTP_TS_FMT_TOD), + .PTP_TS_WIDTH(PTP_TS_WIDTH), + .PTP_TS_CTRL_IN_TUSER(MAC_CTRL_ENABLE ? PTP_TS_ENABLE : TX_PTP_TS_CTRL_IN_TUSER), .PTP_TAG_ENABLE(TX_PTP_TAG_ENABLE), .PTP_TAG_WIDTH(TX_PTP_TAG_WIDTH), .USER_WIDTH(TX_USER_WIDTH_INT) @@ -289,8 +290,8 @@ axis_xgmii_rx_32 #( .DATA_WIDTH(DATA_WIDTH), .KEEP_WIDTH(KEEP_WIDTH), .CTRL_WIDTH(CTRL_WIDTH), - .PTP_TS_ENABLE(RX_PTP_TS_ENABLE), - .PTP_TS_WIDTH(RX_PTP_TS_WIDTH), + .PTP_TS_ENABLE(PTP_TS_ENABLE), + .PTP_TS_WIDTH(PTP_TS_WIDTH), .USER_WIDTH(RX_USER_WIDTH) ) axis_xgmii_rx_inst ( @@ -319,9 +320,9 @@ axis_xgmii_tx_32 #( .ENABLE_PADDING(ENABLE_PADDING), .ENABLE_DIC(ENABLE_DIC), .MIN_FRAME_LENGTH(MIN_FRAME_LENGTH), - .PTP_TS_ENABLE(TX_PTP_TS_ENABLE), - .PTP_TS_WIDTH(TX_PTP_TS_WIDTH), - .PTP_TS_CTRL_IN_TUSER(MAC_CTRL_ENABLE ? TX_PTP_TS_ENABLE : TX_PTP_TS_CTRL_IN_TUSER), + .PTP_TS_ENABLE(PTP_TS_ENABLE), + .PTP_TS_WIDTH(PTP_TS_WIDTH), + .PTP_TS_CTRL_IN_TUSER(MAC_CTRL_ENABLE ? PTP_TS_ENABLE : TX_PTP_TS_CTRL_IN_TUSER), .PTP_TAG_ENABLE(TX_PTP_TAG_ENABLE), .PTP_TAG_WIDTH(TX_PTP_TAG_WIDTH), .USER_WIDTH(TX_USER_WIDTH_INT) @@ -425,7 +426,7 @@ if (MAC_CTRL_ENABLE) begin : mac_ctrl // handle PTP TS enable bit in tuser wire [TX_USER_WIDTH_INT-1:0] tx_axis_tuser_in; - if (TX_PTP_TS_ENABLE && !TX_PTP_TS_CTRL_IN_TUSER) begin + if (PTP_TS_ENABLE && !TX_PTP_TS_CTRL_IN_TUSER) begin assign tx_axis_tuser_in = {tx_axis_tuser[TX_USER_WIDTH-1:1], 1'b1, tx_axis_tuser[0]}; end else begin assign tx_axis_tuser_in = tx_axis_tuser; diff --git a/rtl/eth_mac_10g_fifo.v b/rtl/eth_mac_10g_fifo.v index 32272cebb..07751769d 100644 --- a/rtl/eth_mac_10g_fifo.v +++ b/rtl/eth_mac_10g_fifo.v @@ -55,15 +55,15 @@ module eth_mac_10g_fifo # parameter RX_DROP_WHEN_FULL = RX_DROP_OVERSIZE_FRAME, parameter PTP_PERIOD_NS = 4'h6, parameter PTP_PERIOD_FNS = 16'h6666, - parameter TX_PTP_TS_ENABLE = 0, - parameter RX_PTP_TS_ENABLE = TX_PTP_TS_ENABLE, + parameter PTP_TS_ENABLE = 0, + parameter PTP_TS_FMT_TOD = 1, + parameter PTP_TS_WIDTH = PTP_TS_FMT_TOD ? 96 : 64, parameter TX_PTP_TS_CTRL_IN_TUSER = 0, parameter TX_PTP_TS_FIFO_DEPTH = 64, - parameter PTP_TS_WIDTH = 96, - parameter TX_PTP_TAG_ENABLE = TX_PTP_TS_ENABLE, + parameter TX_PTP_TAG_ENABLE = PTP_TS_ENABLE, parameter PTP_TAG_WIDTH = 16, - parameter TX_USER_WIDTH = (TX_PTP_TS_ENABLE ? (TX_PTP_TAG_ENABLE ? PTP_TAG_WIDTH : 0) + (TX_PTP_TS_CTRL_IN_TUSER ? 1 : 0) : 0) + 1, - parameter RX_USER_WIDTH = (RX_PTP_TS_ENABLE ? PTP_TS_WIDTH : 0) + 1 + parameter TX_USER_WIDTH = (PTP_TS_ENABLE ? (TX_PTP_TAG_ENABLE ? PTP_TAG_WIDTH : 0) + (TX_PTP_TS_CTRL_IN_TUSER ? 1 : 0) : 0) + 1, + parameter RX_USER_WIDTH = (PTP_TS_ENABLE ? PTP_TS_WIDTH : 0) + 1 ) ( input wire rx_clk, @@ -223,7 +223,7 @@ end // PTP timestamping generate -if (TX_PTP_TS_ENABLE) begin : tx_ptp +if (PTP_TS_ENABLE) begin : tx_ptp ptp_clock_cdc #( .TS_WIDTH(PTP_TS_WIDTH), @@ -298,7 +298,7 @@ end else begin end -if (RX_PTP_TS_ENABLE) begin : rx_ptp +if (PTP_TS_ENABLE) begin : rx_ptp ptp_clock_cdc #( .TS_WIDTH(PTP_TS_WIDTH), @@ -335,13 +335,12 @@ eth_mac_10g #( .MIN_FRAME_LENGTH(MIN_FRAME_LENGTH), .PTP_PERIOD_NS(PTP_PERIOD_NS), .PTP_PERIOD_FNS(PTP_PERIOD_FNS), - .TX_PTP_TS_ENABLE(TX_PTP_TS_ENABLE), - .TX_PTP_TS_WIDTH(PTP_TS_WIDTH), + .PTP_TS_ENABLE(PTP_TS_ENABLE), + .PTP_TS_FMT_TOD(PTP_TS_FMT_TOD), + .PTP_TS_WIDTH(PTP_TS_WIDTH), .TX_PTP_TS_CTRL_IN_TUSER(TX_PTP_TS_CTRL_IN_TUSER), .TX_PTP_TAG_ENABLE(TX_PTP_TAG_ENABLE), .TX_PTP_TAG_WIDTH(PTP_TAG_WIDTH), - .RX_PTP_TS_ENABLE(RX_PTP_TS_ENABLE), - .RX_PTP_TS_WIDTH(PTP_TS_WIDTH), .TX_USER_WIDTH(TX_USER_WIDTH), .RX_USER_WIDTH(RX_USER_WIDTH) ) diff --git a/rtl/eth_mac_1g.v b/rtl/eth_mac_1g.v index 84eae7e16..0e1b9a12f 100644 --- a/rtl/eth_mac_1g.v +++ b/rtl/eth_mac_1g.v @@ -36,15 +36,14 @@ module eth_mac_1g # parameter DATA_WIDTH = 8, parameter ENABLE_PADDING = 1, parameter MIN_FRAME_LENGTH = 64, - parameter TX_PTP_TS_ENABLE = 0, - parameter TX_PTP_TS_WIDTH = 96, + parameter PTP_TS_ENABLE = 0, + parameter PTP_TS_FMT_TOD = 1, + parameter PTP_TS_WIDTH = PTP_TS_FMT_TOD ? 96 : 64, parameter TX_PTP_TS_CTRL_IN_TUSER = 0, - parameter TX_PTP_TAG_ENABLE = TX_PTP_TS_ENABLE, + parameter TX_PTP_TAG_ENABLE = PTP_TS_ENABLE, parameter TX_PTP_TAG_WIDTH = 16, - parameter RX_PTP_TS_ENABLE = TX_PTP_TS_ENABLE, - parameter RX_PTP_TS_WIDTH = 96, - parameter TX_USER_WIDTH = (TX_PTP_TS_ENABLE ? (TX_PTP_TAG_ENABLE ? TX_PTP_TAG_WIDTH : 0) + (TX_PTP_TS_CTRL_IN_TUSER ? 1 : 0) : 0) + 1, - parameter RX_USER_WIDTH = (RX_PTP_TS_ENABLE ? RX_PTP_TS_WIDTH : 0) + 1, + parameter TX_USER_WIDTH = (PTP_TS_ENABLE ? (TX_PTP_TAG_ENABLE ? TX_PTP_TAG_WIDTH : 0) + (TX_PTP_TS_CTRL_IN_TUSER ? 1 : 0) : 0) + 1, + parameter RX_USER_WIDTH = (PTP_TS_ENABLE ? PTP_TS_WIDTH : 0) + 1, parameter PFC_ENABLE = 0, parameter PAUSE_ENABLE = PFC_ENABLE ) @@ -84,9 +83,9 @@ module eth_mac_1g # /* * PTP */ - input wire [TX_PTP_TS_WIDTH-1:0] tx_ptp_ts, - input wire [RX_PTP_TS_WIDTH-1:0] rx_ptp_ts, - output wire [TX_PTP_TS_WIDTH-1:0] tx_axis_ptp_ts, + input wire [PTP_TS_WIDTH-1:0] tx_ptp_ts, + input wire [PTP_TS_WIDTH-1:0] rx_ptp_ts, + output wire [PTP_TS_WIDTH-1:0] tx_axis_ptp_ts, output wire [TX_PTP_TAG_WIDTH-1:0] tx_axis_ptp_ts_tag, output wire tx_axis_ptp_ts_valid, @@ -190,7 +189,7 @@ module eth_mac_1g # ); parameter MAC_CTRL_ENABLE = PAUSE_ENABLE || PFC_ENABLE; -parameter TX_USER_WIDTH_INT = MAC_CTRL_ENABLE ? (TX_PTP_TS_ENABLE ? (TX_PTP_TAG_ENABLE ? TX_PTP_TAG_WIDTH : 0) + 1 : 0) + 1 : TX_USER_WIDTH; +parameter TX_USER_WIDTH_INT = MAC_CTRL_ENABLE ? (PTP_TS_ENABLE ? (TX_PTP_TAG_ENABLE ? TX_PTP_TAG_WIDTH : 0) + 1 : 0) + 1 : TX_USER_WIDTH; wire [DATA_WIDTH-1:0] tx_axis_tdata_int; wire tx_axis_tvalid_int; @@ -205,8 +204,8 @@ wire [RX_USER_WIDTH-1:0] rx_axis_tuser_int; axis_gmii_rx #( .DATA_WIDTH(DATA_WIDTH), - .PTP_TS_ENABLE(RX_PTP_TS_ENABLE), - .PTP_TS_WIDTH(RX_PTP_TS_WIDTH), + .PTP_TS_ENABLE(PTP_TS_ENABLE), + .PTP_TS_WIDTH(PTP_TS_WIDTH), .USER_WIDTH(RX_USER_WIDTH) ) axis_gmii_rx_inst ( @@ -232,9 +231,9 @@ axis_gmii_tx #( .DATA_WIDTH(DATA_WIDTH), .ENABLE_PADDING(ENABLE_PADDING), .MIN_FRAME_LENGTH(MIN_FRAME_LENGTH), - .PTP_TS_ENABLE(TX_PTP_TS_ENABLE), - .PTP_TS_WIDTH(TX_PTP_TS_WIDTH), - .PTP_TS_CTRL_IN_TUSER(MAC_CTRL_ENABLE ? TX_PTP_TS_ENABLE : TX_PTP_TS_CTRL_IN_TUSER), + .PTP_TS_ENABLE(PTP_TS_ENABLE), + .PTP_TS_WIDTH(PTP_TS_WIDTH), + .PTP_TS_CTRL_IN_TUSER(MAC_CTRL_ENABLE ? PTP_TS_ENABLE : TX_PTP_TS_CTRL_IN_TUSER), .PTP_TAG_ENABLE(TX_PTP_TAG_ENABLE), .PTP_TAG_WIDTH(TX_PTP_TAG_WIDTH), .USER_WIDTH(TX_USER_WIDTH_INT) @@ -338,7 +337,7 @@ if (MAC_CTRL_ENABLE) begin : mac_ctrl // handle PTP TS enable bit in tuser wire [TX_USER_WIDTH_INT-1:0] tx_axis_tuser_in; - if (TX_PTP_TS_ENABLE && !TX_PTP_TS_CTRL_IN_TUSER) begin + if (PTP_TS_ENABLE && !TX_PTP_TS_CTRL_IN_TUSER) begin assign tx_axis_tuser_in = {tx_axis_tuser[TX_USER_WIDTH-1:1], 1'b1, tx_axis_tuser[0]}; end else begin assign tx_axis_tuser_in = tx_axis_tuser; diff --git a/rtl/eth_mac_phy_10g.v b/rtl/eth_mac_phy_10g.v index be2a4408c..dc35c283b 100644 --- a/rtl/eth_mac_phy_10g.v +++ b/rtl/eth_mac_phy_10g.v @@ -41,15 +41,14 @@ module eth_mac_phy_10g # parameter MIN_FRAME_LENGTH = 64, parameter PTP_PERIOD_NS = 4'h6, parameter PTP_PERIOD_FNS = 16'h6666, - parameter TX_PTP_TS_ENABLE = 0, - parameter TX_PTP_TS_WIDTH = 96, + parameter PTP_TS_ENABLE = 0, + parameter PTP_TS_FMT_TOD = 1, + parameter PTP_TS_WIDTH = PTP_TS_FMT_TOD ? 96 : 64, parameter TX_PTP_TS_CTRL_IN_TUSER = 0, - parameter TX_PTP_TAG_ENABLE = TX_PTP_TS_ENABLE, + parameter TX_PTP_TAG_ENABLE = PTP_TS_ENABLE, parameter TX_PTP_TAG_WIDTH = 16, - parameter RX_PTP_TS_ENABLE = TX_PTP_TS_ENABLE, - parameter RX_PTP_TS_WIDTH = 96, - parameter TX_USER_WIDTH = (TX_PTP_TS_ENABLE ? (TX_PTP_TAG_ENABLE ? TX_PTP_TAG_WIDTH : 0) + (TX_PTP_TS_CTRL_IN_TUSER ? 1 : 0) : 0) + 1, - parameter RX_USER_WIDTH = (RX_PTP_TS_ENABLE ? RX_PTP_TS_WIDTH : 0) + 1, + parameter TX_USER_WIDTH = (PTP_TS_ENABLE ? (TX_PTP_TAG_ENABLE ? TX_PTP_TAG_WIDTH : 0) + (TX_PTP_TS_CTRL_IN_TUSER ? 1 : 0) : 0) + 1, + parameter RX_USER_WIDTH = (PTP_TS_ENABLE ? PTP_TS_WIDTH : 0) + 1, parameter BIT_REVERSE = 0, parameter SCRAMBLER_DISABLE = 0, parameter PRBS31_ENABLE = 0, @@ -97,9 +96,9 @@ module eth_mac_phy_10g # /* * PTP */ - input wire [TX_PTP_TS_WIDTH-1:0] tx_ptp_ts, - input wire [RX_PTP_TS_WIDTH-1:0] rx_ptp_ts, - output wire [TX_PTP_TS_WIDTH-1:0] tx_axis_ptp_ts, + input wire [PTP_TS_WIDTH-1:0] tx_ptp_ts, + input wire [PTP_TS_WIDTH-1:0] rx_ptp_ts, + output wire [PTP_TS_WIDTH-1:0] tx_axis_ptp_ts, output wire [TX_PTP_TAG_WIDTH-1:0] tx_axis_ptp_ts_tag, output wire tx_axis_ptp_ts_valid, @@ -133,8 +132,9 @@ eth_mac_phy_10g_rx #( .HDR_WIDTH(HDR_WIDTH), .PTP_PERIOD_NS(PTP_PERIOD_NS), .PTP_PERIOD_FNS(PTP_PERIOD_FNS), - .PTP_TS_ENABLE(RX_PTP_TS_ENABLE), - .PTP_TS_WIDTH(RX_PTP_TS_WIDTH), + .PTP_TS_ENABLE(PTP_TS_ENABLE), + .PTP_TS_FMT_TOD(PTP_TS_FMT_TOD), + .PTP_TS_WIDTH(PTP_TS_WIDTH), .USER_WIDTH(RX_USER_WIDTH), .BIT_REVERSE(BIT_REVERSE), .SCRAMBLER_DISABLE(SCRAMBLER_DISABLE), @@ -178,8 +178,9 @@ eth_mac_phy_10g_tx #( .MIN_FRAME_LENGTH(MIN_FRAME_LENGTH), .PTP_PERIOD_NS(PTP_PERIOD_NS), .PTP_PERIOD_FNS(PTP_PERIOD_FNS), - .PTP_TS_ENABLE(TX_PTP_TS_ENABLE), - .PTP_TS_WIDTH(TX_PTP_TS_WIDTH), + .PTP_TS_ENABLE(PTP_TS_ENABLE), + .PTP_TS_FMT_TOD(PTP_TS_FMT_TOD), + .PTP_TS_WIDTH(PTP_TS_WIDTH), .PTP_TS_CTRL_IN_TUSER(TX_PTP_TS_CTRL_IN_TUSER), .PTP_TAG_ENABLE(TX_PTP_TAG_ENABLE), .PTP_TAG_WIDTH(TX_PTP_TAG_WIDTH), diff --git a/rtl/eth_mac_phy_10g_fifo.v b/rtl/eth_mac_phy_10g_fifo.v index be84e7ac4..cbb555a24 100644 --- a/rtl/eth_mac_phy_10g_fifo.v +++ b/rtl/eth_mac_phy_10g_fifo.v @@ -63,15 +63,15 @@ module eth_mac_phy_10g_fifo # parameter RX_DROP_WHEN_FULL = RX_DROP_OVERSIZE_FRAME, parameter PTP_PERIOD_NS = 4'h6, parameter PTP_PERIOD_FNS = 16'h6666, - parameter TX_PTP_TS_ENABLE = 0, - parameter RX_PTP_TS_ENABLE = TX_PTP_TS_ENABLE, + parameter PTP_TS_ENABLE = 0, + parameter PTP_TS_FMT_TOD = 1, + parameter PTP_TS_WIDTH = PTP_TS_FMT_TOD ? 96 : 64, parameter TX_PTP_TS_CTRL_IN_TUSER = 0, parameter TX_PTP_TS_FIFO_DEPTH = 64, - parameter PTP_TS_WIDTH = 96, - parameter TX_PTP_TAG_ENABLE = TX_PTP_TS_ENABLE, + parameter TX_PTP_TAG_ENABLE = PTP_TS_ENABLE, parameter PTP_TAG_WIDTH = 16, - parameter TX_USER_WIDTH = (TX_PTP_TS_ENABLE ? (TX_PTP_TAG_ENABLE ? PTP_TAG_WIDTH : 0) + (TX_PTP_TS_CTRL_IN_TUSER ? 1 : 0) : 0) + 1, - parameter RX_USER_WIDTH = (RX_PTP_TS_ENABLE ? PTP_TS_WIDTH : 0) + 1 + parameter TX_USER_WIDTH = (PTP_TS_ENABLE ? (TX_PTP_TAG_ENABLE ? PTP_TAG_WIDTH : 0) + (TX_PTP_TS_CTRL_IN_TUSER ? 1 : 0) : 0) + 1, + parameter RX_USER_WIDTH = (PTP_TS_ENABLE ? PTP_TS_WIDTH : 0) + 1 ) ( input wire rx_clk, @@ -252,7 +252,7 @@ end // PTP timestamping generate -if (TX_PTP_TS_ENABLE) begin : tx_ptp +if (PTP_TS_ENABLE) begin : tx_ptp ptp_clock_cdc #( .TS_WIDTH(PTP_TS_WIDTH), @@ -327,7 +327,7 @@ end else begin end -if (RX_PTP_TS_ENABLE) begin : rx_ptp +if (PTP_TS_ENABLE) begin : rx_ptp ptp_clock_cdc #( .TS_WIDTH(PTP_TS_WIDTH), @@ -364,13 +364,12 @@ eth_mac_phy_10g #( .MIN_FRAME_LENGTH(MIN_FRAME_LENGTH), .PTP_PERIOD_NS(PTP_PERIOD_NS), .PTP_PERIOD_FNS(PTP_PERIOD_FNS), - .TX_PTP_TS_ENABLE(TX_PTP_TS_ENABLE), - .TX_PTP_TS_WIDTH(PTP_TS_WIDTH), + .PTP_TS_ENABLE(PTP_TS_ENABLE), + .PTP_TS_FMT_TOD(PTP_TS_FMT_TOD), + .PTP_TS_WIDTH(PTP_TS_WIDTH), .TX_PTP_TS_CTRL_IN_TUSER(TX_PTP_TS_CTRL_IN_TUSER), .TX_PTP_TAG_ENABLE(TX_PTP_TAG_ENABLE), .TX_PTP_TAG_WIDTH(PTP_TAG_WIDTH), - .RX_PTP_TS_ENABLE(RX_PTP_TS_ENABLE), - .RX_PTP_TS_WIDTH(PTP_TS_WIDTH), .TX_USER_WIDTH(TX_USER_WIDTH), .RX_USER_WIDTH(RX_USER_WIDTH), .BIT_REVERSE(BIT_REVERSE), diff --git a/rtl/eth_mac_phy_10g_rx.v b/rtl/eth_mac_phy_10g_rx.v index 28bf99408..fe733da93 100644 --- a/rtl/eth_mac_phy_10g_rx.v +++ b/rtl/eth_mac_phy_10g_rx.v @@ -39,7 +39,8 @@ module eth_mac_phy_10g_rx # parameter PTP_PERIOD_NS = 4'h6, parameter PTP_PERIOD_FNS = 16'h6666, parameter PTP_TS_ENABLE = 0, - parameter PTP_TS_WIDTH = 96, + parameter PTP_TS_FMT_TOD = 1, + parameter PTP_TS_WIDTH = PTP_TS_FMT_TOD ? 96 : 64, parameter USER_WIDTH = (PTP_TS_ENABLE ? PTP_TS_WIDTH : 0) + 1, parameter BIT_REVERSE = 0, parameter SCRAMBLER_DISABLE = 0, @@ -149,6 +150,7 @@ axis_baser_rx_64 #( .PTP_PERIOD_NS(PTP_PERIOD_NS), .PTP_PERIOD_FNS(PTP_PERIOD_FNS), .PTP_TS_ENABLE(PTP_TS_ENABLE), + .PTP_TS_FMT_TOD(PTP_TS_FMT_TOD), .PTP_TS_WIDTH(PTP_TS_WIDTH), .USER_WIDTH(USER_WIDTH) ) diff --git a/rtl/eth_mac_phy_10g_tx.v b/rtl/eth_mac_phy_10g_tx.v index e84ee649a..2d36be4c6 100644 --- a/rtl/eth_mac_phy_10g_tx.v +++ b/rtl/eth_mac_phy_10g_tx.v @@ -42,7 +42,8 @@ module eth_mac_phy_10g_tx # parameter PTP_PERIOD_NS = 4'h6, parameter PTP_PERIOD_FNS = 16'h6666, parameter PTP_TS_ENABLE = 0, - parameter PTP_TS_WIDTH = 96, + parameter PTP_TS_FMT_TOD = 1, + parameter PTP_TS_WIDTH = PTP_TS_FMT_TOD ? 96 : 64, parameter PTP_TS_CTRL_IN_TUSER = 0, parameter PTP_TAG_ENABLE = PTP_TS_ENABLE, parameter PTP_TAG_WIDTH = 16, @@ -125,6 +126,7 @@ axis_baser_tx_64 #( .PTP_PERIOD_NS(PTP_PERIOD_NS), .PTP_PERIOD_FNS(PTP_PERIOD_FNS), .PTP_TS_ENABLE(PTP_TS_ENABLE), + .PTP_TS_FMT_TOD(PTP_TS_FMT_TOD), .PTP_TS_WIDTH(PTP_TS_WIDTH), .PTP_TS_CTRL_IN_TUSER(PTP_TS_CTRL_IN_TUSER), .PTP_TAG_ENABLE(PTP_TAG_ENABLE), diff --git a/tb/axis_baser_rx_64/Makefile b/tb/axis_baser_rx_64/Makefile index 67ece95a1..37044d11b 100644 --- a/tb/axis_baser_rx_64/Makefile +++ b/tb/axis_baser_rx_64/Makefile @@ -37,7 +37,8 @@ export PARAM_DATA_WIDTH := 64 export PARAM_KEEP_WIDTH := $(shell expr $(PARAM_DATA_WIDTH) / 8 ) export PARAM_HDR_WIDTH := 2 export PARAM_PTP_TS_ENABLE := 1 -export PARAM_PTP_TS_WIDTH := 96 +export PARAM_PTP_TS_FMT_TOD := 1 +export PARAM_PTP_TS_WIDTH := $(if $(filter-out 1,$(PARAM_PTP_TS_FMT_TOD)),64,96) export PARAM_USER_WIDTH := $(if $(filter-out 1,$(PARAM_PTP_TS_ENABLE)),1,$(shell expr $(PARAM_PTP_TS_WIDTH) + 1 )) ifeq ($(SIM), icarus) diff --git a/tb/axis_baser_rx_64/test_axis_baser_rx_64.py b/tb/axis_baser_rx_64/test_axis_baser_rx_64.py index 94e3537e3..a06faf8ba 100644 --- a/tb/axis_baser_rx_64/test_axis_baser_rx_64.py +++ b/tb/axis_baser_rx_64/test_axis_baser_rx_64.py @@ -167,7 +167,8 @@ def test_axis_baser_rx_64(request): parameters['KEEP_WIDTH'] = parameters['DATA_WIDTH'] // 8 parameters['HDR_WIDTH'] = 2 parameters['PTP_TS_ENABLE'] = 1 - parameters['PTP_TS_WIDTH'] = 96 + parameters['PTP_TS_FMT_TOD'] = 1 + parameters['PTP_TS_WIDTH'] = 96 if parameters['PTP_TS_FMT_TOD'] else 64 parameters['USER_WIDTH'] = (parameters['PTP_TS_WIDTH'] if parameters['PTP_TS_ENABLE'] else 0) + 1 extra_env = {f'PARAM_{k}': str(v) for k, v in parameters.items()} diff --git a/tb/axis_baser_tx_64/Makefile b/tb/axis_baser_tx_64/Makefile index a5d23facd..93feb53f6 100644 --- a/tb/axis_baser_tx_64/Makefile +++ b/tb/axis_baser_tx_64/Makefile @@ -40,7 +40,8 @@ export PARAM_ENABLE_PADDING := 1 export PARAM_ENABLE_DIC := 1 export PARAM_MIN_FRAME_LENGTH := 64 export PARAM_PTP_TS_ENABLE := 1 -export PARAM_PTP_TS_WIDTH := 96 +export PARAM_PTP_TS_FMT_TOD := 1 +export PARAM_PTP_TS_WIDTH := $(if $(filter-out 1,$(PARAM_PTP_TS_FMT_TOD)),64,96) export PARAM_PTP_TS_CTRL_IN_TUSER := $(PARAM_PTP_TS_ENABLE) export PARAM_PTP_TAG_ENABLE := $(PARAM_PTP_TS_ENABLE) export PARAM_PTP_TAG_WIDTH := 16 diff --git a/tb/axis_baser_tx_64/test_axis_baser_tx_64.py b/tb/axis_baser_tx_64/test_axis_baser_tx_64.py index cf8468d8c..6f2f9db2e 100644 --- a/tb/axis_baser_tx_64/test_axis_baser_tx_64.py +++ b/tb/axis_baser_tx_64/test_axis_baser_tx_64.py @@ -352,7 +352,8 @@ def test_axis_baser_tx_64(request, enable_dic): parameters['ENABLE_DIC'] = enable_dic parameters['MIN_FRAME_LENGTH'] = 64 parameters['PTP_TS_ENABLE'] = 1 - parameters['PTP_TS_WIDTH'] = 96 + parameters['PTP_TS_FMT_TOD'] = 1 + parameters['PTP_TS_WIDTH'] = 96 if parameters['PTP_TS_FMT_TOD'] else 64 parameters['PTP_TS_CTRL_IN_TUSER'] = parameters['PTP_TS_ENABLE'] parameters['PTP_TAG_ENABLE'] = parameters['PTP_TS_ENABLE'] parameters['PTP_TAG_WIDTH'] = 16 diff --git a/tb/axis_xgmii_rx_64/Makefile b/tb/axis_xgmii_rx_64/Makefile index 923a45d7c..3a68d8c30 100644 --- a/tb/axis_xgmii_rx_64/Makefile +++ b/tb/axis_xgmii_rx_64/Makefile @@ -37,7 +37,8 @@ export PARAM_DATA_WIDTH := 64 export PARAM_KEEP_WIDTH := $(shell expr $(PARAM_DATA_WIDTH) / 8 ) export PARAM_CTRL_WIDTH := $(shell expr $(PARAM_DATA_WIDTH) / 8 ) export PARAM_PTP_TS_ENABLE := 1 -export PARAM_PTP_TS_WIDTH := 96 +export PARAM_PTP_TS_FMT_TOD := 1 +export PARAM_PTP_TS_WIDTH := $(if $(filter-out 1,$(PARAM_PTP_TS_FMT_TOD)),64,96) export PARAM_USER_WIDTH := $(if $(filter-out 1,$(PARAM_PTP_TS_ENABLE)),1,$(shell expr $(PARAM_PTP_TS_WIDTH) + 1 )) ifeq ($(SIM), icarus) diff --git a/tb/axis_xgmii_rx_64/test_axis_xgmii_rx_64.py b/tb/axis_xgmii_rx_64/test_axis_xgmii_rx_64.py index 2d3dcb9dc..05800b0f8 100644 --- a/tb/axis_xgmii_rx_64/test_axis_xgmii_rx_64.py +++ b/tb/axis_xgmii_rx_64/test_axis_xgmii_rx_64.py @@ -156,7 +156,8 @@ def test_axis_xgmii_rx_64(request): parameters['KEEP_WIDTH'] = parameters['DATA_WIDTH'] // 8 parameters['CTRL_WIDTH'] = parameters['DATA_WIDTH'] // 8 parameters['PTP_TS_ENABLE'] = 1 - parameters['PTP_TS_WIDTH'] = 96 + parameters['PTP_TS_FMT_TOD'] = 1 + parameters['PTP_TS_WIDTH'] = 96 if parameters['PTP_TS_FMT_TOD'] else 64 parameters['USER_WIDTH'] = (parameters['PTP_TS_WIDTH'] if parameters['PTP_TS_ENABLE'] else 0) + 1 extra_env = {f'PARAM_{k}': str(v) for k, v in parameters.items()} diff --git a/tb/axis_xgmii_tx_64/Makefile b/tb/axis_xgmii_tx_64/Makefile index 0ade45058..b511f12c4 100644 --- a/tb/axis_xgmii_tx_64/Makefile +++ b/tb/axis_xgmii_tx_64/Makefile @@ -40,7 +40,8 @@ export PARAM_ENABLE_PADDING := 1 export PARAM_ENABLE_DIC := 1 export PARAM_MIN_FRAME_LENGTH := 64 export PARAM_PTP_TS_ENABLE := 1 -export PARAM_PTP_TS_WIDTH := 96 +export PARAM_PTP_TS_FMT_TOD := 1 +export PARAM_PTP_TS_WIDTH := $(if $(filter-out 1,$(PARAM_PTP_TS_FMT_TOD)),64,96) export PARAM_PTP_TS_CTRL_IN_TUSER := $(PARAM_PTP_TS_ENABLE) export PARAM_PTP_TAG_ENABLE := $(PARAM_PTP_TS_ENABLE) export PARAM_PTP_TAG_WIDTH := 16 diff --git a/tb/axis_xgmii_tx_64/test_axis_xgmii_tx_64.py b/tb/axis_xgmii_tx_64/test_axis_xgmii_tx_64.py index e45fa2840..fd57cfc7f 100644 --- a/tb/axis_xgmii_tx_64/test_axis_xgmii_tx_64.py +++ b/tb/axis_xgmii_tx_64/test_axis_xgmii_tx_64.py @@ -341,7 +341,8 @@ def test_axis_xgmii_tx_64(request, enable_dic): parameters['ENABLE_DIC'] = enable_dic parameters['MIN_FRAME_LENGTH'] = 64 parameters['PTP_TS_ENABLE'] = 1 - parameters['PTP_TS_WIDTH'] = 96 + parameters['PTP_TS_FMT_TOD'] = 1 + parameters['PTP_TS_WIDTH'] = 96 if parameters['PTP_TS_FMT_TOD'] else 64 parameters['PTP_TS_CTRL_IN_TUSER'] = parameters['PTP_TS_ENABLE'] parameters['PTP_TAG_ENABLE'] = parameters['PTP_TS_ENABLE'] parameters['PTP_TAG_WIDTH'] = 16 diff --git a/tb/eth_mac_10g/Makefile b/tb/eth_mac_10g/Makefile index b7144265d..d31579ae6 100644 --- a/tb/eth_mac_10g/Makefile +++ b/tb/eth_mac_10g/Makefile @@ -49,14 +49,13 @@ export PARAM_ENABLE_DIC := 1 export PARAM_MIN_FRAME_LENGTH := 64 export PARAM_PTP_PERIOD_NS := 6 export PARAM_PTP_PERIOD_FNS := 26214 -export PARAM_TX_PTP_TS_ENABLE := 1 -export PARAM_TX_PTP_TS_WIDTH := 96 -export PARAM_TX_PTP_TAG_ENABLE := $(PARAM_TX_PTP_TS_ENABLE) +export PARAM_PTP_TS_ENABLE := 1 +export PARAM_PTP_TS_FMT_TOD := 1 +export PARAM_PTP_TS_WIDTH := $(if $(filter-out 1,$(PARAM_PTP_TS_FMT_TOD)),64,96) +export PARAM_TX_PTP_TAG_ENABLE := $(PARAM_PTP_TS_ENABLE) export PARAM_TX_PTP_TAG_WIDTH := 16 -export PARAM_RX_PTP_TS_ENABLE := $(PARAM_TX_PTP_TS_ENABLE) -export PARAM_RX_PTP_TS_WIDTH := 96 -export PARAM_TX_USER_WIDTH := $(if $(filter-out 1,$(PARAM_TX_PTP_TS_ENABLE)),1,$(shell expr $(if $(filter-out 1,$(PARAM_TX_PTP_TAG_ENABLE)),0,$(PARAM_TX_PTP_TAG_WIDTH)) + $(if $(filter-out 1,$(TX_PTP_TS_CTRL_IN_TUSER)),0,1) + 1 )) -export PARAM_RX_USER_WIDTH := $(if $(filter-out 1,$(PARAM_RX_PTP_TS_ENABLE)),1,$(shell expr $(PARAM_RX_PTP_TS_WIDTH) + 1 )) +export PARAM_TX_USER_WIDTH := $(if $(filter-out 1,$(PARAM_PTP_TS_ENABLE)),1,$(shell expr $(if $(filter-out 1,$(PARAM_TX_PTP_TAG_ENABLE)),0,$(PARAM_TX_PTP_TAG_WIDTH)) + $(if $(filter-out 1,$(TX_PTP_TS_CTRL_IN_TUSER)),0,1) + 1 )) +export PARAM_RX_USER_WIDTH := $(if $(filter-out 1,$(PARAM_PTP_TS_ENABLE)),1,$(shell expr $(PARAM_PTP_TS_WIDTH) + 1 )) export PARAM_PFC_ENABLE := 1 export PARAM_PAUSE_ENABLE := $(PARAM_PFC_ENABLE) diff --git a/tb/eth_mac_10g/test_eth_mac_10g.py b/tb/eth_mac_10g/test_eth_mac_10g.py index 761b90e9a..87abf9d1c 100644 --- a/tb/eth_mac_10g/test_eth_mac_10g.py +++ b/tb/eth_mac_10g/test_eth_mac_10g.py @@ -747,15 +747,14 @@ def test_eth_mac_10g(request, data_width, enable_dic, pfc_en): parameters['MIN_FRAME_LENGTH'] = 64 parameters['PTP_PERIOD_NS'] = 0x6 if parameters['DATA_WIDTH'] == 64 else 0x3 parameters['PTP_PERIOD_FNS'] = 0x6666 if parameters['DATA_WIDTH'] == 64 else 0x3333 - parameters['TX_PTP_TS_ENABLE'] = 1 - parameters['TX_PTP_TS_WIDTH'] = 96 - parameters['TX_PTP_TS_CTRL_IN_TUSER'] = parameters['TX_PTP_TS_ENABLE'] - parameters['TX_PTP_TAG_ENABLE'] = parameters['TX_PTP_TS_ENABLE'] + parameters['PTP_TS_ENABLE'] = 1 + parameters['PTP_TS_FMT_TOD'] = 1 + parameters['PTP_TS_WIDTH'] = 96 if parameters['PTP_TS_FMT_TOD'] else 64 + parameters['TX_PTP_TS_CTRL_IN_TUSER'] = parameters['PTP_TS_ENABLE'] + parameters['TX_PTP_TAG_ENABLE'] = parameters['PTP_TS_ENABLE'] parameters['TX_PTP_TAG_WIDTH'] = 16 - parameters['RX_PTP_TS_ENABLE'] = parameters['TX_PTP_TS_ENABLE'] - parameters['RX_PTP_TS_WIDTH'] = 96 - parameters['TX_USER_WIDTH'] = ((parameters['TX_PTP_TAG_WIDTH'] if parameters['TX_PTP_TAG_ENABLE'] else 0) + (1 if parameters['TX_PTP_TS_CTRL_IN_TUSER'] else 0) if parameters['TX_PTP_TS_ENABLE'] else 0) + 1 - parameters['RX_USER_WIDTH'] = (parameters['RX_PTP_TS_WIDTH'] if parameters['RX_PTP_TS_ENABLE'] else 0) + 1 + parameters['TX_USER_WIDTH'] = ((parameters['TX_PTP_TAG_WIDTH'] if parameters['TX_PTP_TAG_ENABLE'] else 0) + (1 if parameters['TX_PTP_TS_CTRL_IN_TUSER'] else 0) if parameters['PTP_TS_ENABLE'] else 0) + 1 + parameters['RX_USER_WIDTH'] = (parameters['PTP_TS_WIDTH'] if parameters['PTP_TS_ENABLE'] else 0) + 1 parameters['PFC_ENABLE'] = pfc_en parameters['PAUSE_ENABLE'] = parameters['PFC_ENABLE'] diff --git a/tb/eth_mac_10g_fifo/Makefile b/tb/eth_mac_10g_fifo/Makefile index 2a85805e9..663b4f017 100644 --- a/tb/eth_mac_10g_fifo/Makefile +++ b/tb/eth_mac_10g_fifo/Makefile @@ -64,15 +64,15 @@ export PARAM_RX_DROP_BAD_FRAME := $(PARAM_RX_DROP_OVERSIZE_FRAME) export PARAM_RX_DROP_WHEN_FULL := $(PARAM_RX_DROP_OVERSIZE_FRAME) export PARAM_PTP_PERIOD_NS := 6 export PARAM_PTP_PERIOD_FNS := 26214 -export PARAM_TX_PTP_TS_ENABLE := 1 -export PARAM_RX_PTP_TS_ENABLE := $(PARAM_TX_PTP_TS_ENABLE) -export PARAM_TX_PTP_TS_CTRL_IN_TUSER := $(PARAM_TX_PTP_TS_ENABLE) +export PARAM_PTP_TS_ENABLE := 1 +export PARAM_PTP_TS_FMT_TOD := 1 +export PARAM_PTP_TS_WIDTH := $(if $(filter-out 1,$(PARAM_PTP_TS_FMT_TOD)),64,96) +export PARAM_TX_PTP_TS_CTRL_IN_TUSER := $(PARAM_PTP_TS_ENABLE) export PARAM_TX_PTP_TS_FIFO_DEPTH := 64 -export PARAM_PTP_TS_WIDTH := 96 -export PARAM_TX_PTP_TAG_ENABLE := $(PARAM_TX_PTP_TS_ENABLE) +export PARAM_TX_PTP_TAG_ENABLE := $(PARAM_PTP_TS_ENABLE) export PARAM_PTP_TAG_WIDTH := 16 -export PARAM_TX_USER_WIDTH := $(if $(filter-out 1,$(PARAM_TX_PTP_TS_ENABLE)),1,$(shell expr $(if $(filter-out 1,$(PARAM_TX_PTP_TAG_ENABLE)),0,$(PARAM_PTP_TAG_WIDTH)) + $(if $(filter-out 1,$(TX_PTP_TS_CTRL_IN_TUSER)),0,1) + 1 )) -export PARAM_RX_USER_WIDTH := $(if $(filter-out 1,$(PARAM_RX_PTP_TS_ENABLE)),1,$(shell expr $(PARAM_PTP_TS_WIDTH) + 1 )) +export PARAM_TX_USER_WIDTH := $(if $(filter-out 1,$(PARAM_PTP_TS_ENABLE)),1,$(shell expr $(if $(filter-out 1,$(PARAM_TX_PTP_TAG_ENABLE)),0,$(PARAM_PTP_TAG_WIDTH)) + $(if $(filter-out 1,$(TX_PTP_TS_CTRL_IN_TUSER)),0,1) + 1 )) +export PARAM_RX_USER_WIDTH := $(if $(filter-out 1,$(PARAM_PTP_TS_ENABLE)),1,$(shell expr $(PARAM_PTP_TS_WIDTH) + 1 )) ifeq ($(SIM), icarus) PLUSARGS += -fst diff --git a/tb/eth_mac_10g_fifo/test_eth_mac_10g_fifo.py b/tb/eth_mac_10g_fifo/test_eth_mac_10g_fifo.py index cf98b4fdb..6298e1616 100644 --- a/tb/eth_mac_10g_fifo/test_eth_mac_10g_fifo.py +++ b/tb/eth_mac_10g_fifo/test_eth_mac_10g_fifo.py @@ -371,15 +371,15 @@ def test_eth_mac_10g_fifo(request, data_width, enable_dic): parameters['RX_DROP_WHEN_FULL'] = parameters['RX_DROP_OVERSIZE_FRAME'] parameters['PTP_PERIOD_NS'] = 0x6 if parameters['DATA_WIDTH'] == 64 else 0x3 parameters['PTP_PERIOD_FNS'] = 0x6666 if parameters['DATA_WIDTH'] == 64 else 0x3333 - parameters['TX_PTP_TS_ENABLE'] = 1 - parameters['RX_PTP_TS_ENABLE'] = parameters['TX_PTP_TS_ENABLE'] - parameters['TX_PTP_TS_CTRL_IN_TUSER'] = parameters['TX_PTP_TS_ENABLE'] + parameters['PTP_TS_ENABLE'] = 1 + parameters['PTP_TS_FMT_TOD'] = 1 + parameters['PTP_TS_WIDTH'] = 96 if parameters['PTP_TS_FMT_TOD'] else 64 + parameters['TX_PTP_TS_CTRL_IN_TUSER'] = parameters['PTP_TS_ENABLE'] parameters['TX_PTP_TS_FIFO_DEPTH'] = 64 - parameters['PTP_TS_WIDTH'] = 96 - parameters['TX_PTP_TAG_ENABLE'] = parameters['TX_PTP_TS_ENABLE'] + parameters['TX_PTP_TAG_ENABLE'] = parameters['PTP_TS_ENABLE'] parameters['PTP_TAG_WIDTH'] = 16 - parameters['TX_USER_WIDTH'] = ((parameters['PTP_TAG_WIDTH'] if parameters['TX_PTP_TAG_ENABLE'] else 0) + (1 if parameters['TX_PTP_TS_CTRL_IN_TUSER'] else 0) if parameters['TX_PTP_TS_ENABLE'] else 0) + 1 - parameters['RX_USER_WIDTH'] = (parameters['PTP_TS_WIDTH'] if parameters['RX_PTP_TS_ENABLE'] else 0) + 1 + parameters['TX_USER_WIDTH'] = ((parameters['PTP_TAG_WIDTH'] if parameters['TX_PTP_TAG_ENABLE'] else 0) + (1 if parameters['TX_PTP_TS_CTRL_IN_TUSER'] else 0) if parameters['PTP_TS_ENABLE'] else 0) + 1 + parameters['RX_USER_WIDTH'] = (parameters['PTP_TS_WIDTH'] if parameters['PTP_TS_ENABLE'] else 0) + 1 extra_env = {f'PARAM_{k}': str(v) for k, v in parameters.items()} diff --git a/tb/eth_mac_1g/Makefile b/tb/eth_mac_1g/Makefile index b3475f7cd..f5827780a 100644 --- a/tb/eth_mac_1g/Makefile +++ b/tb/eth_mac_1g/Makefile @@ -42,15 +42,14 @@ VERILOG_SOURCES += ../../rtl/lfsr.v export PARAM_DATA_WIDTH := 8 export PARAM_ENABLE_PADDING := 1 export PARAM_MIN_FRAME_LENGTH := 64 -export PARAM_TX_PTP_TS_ENABLE := 1 -export PARAM_TX_PTP_TS_WIDTH := 96 -export PARAM_TX_PTP_TS_CTRL_IN_TUSER := $(PARAM_TX_PTP_TS_ENABLE) -export PARAM_TX_PTP_TAG_ENABLE := $(PARAM_TX_PTP_TS_ENABLE) +export PARAM_PTP_TS_ENABLE := 1 +export PARAM_PTP_TS_FMT_TOD := 1 +export PARAM_PTP_TS_WIDTH := $(if $(filter-out 1,$(PARAM_PTP_TS_FMT_TOD)),64,96) +export PARAM_TX_PTP_TS_CTRL_IN_TUSER := $(PARAM_PTP_TS_ENABLE) +export PARAM_TX_PTP_TAG_ENABLE := $(PARAM_PTP_TS_ENABLE) export PARAM_TX_PTP_TAG_WIDTH := 16 -export PARAM_RX_PTP_TS_ENABLE := $(PARAM_TX_PTP_TS_ENABLE) -export PARAM_RX_PTP_TS_WIDTH := 96 -export PARAM_TX_USER_WIDTH := $(if $(filter-out 1,$(PARAM_TX_PTP_TS_ENABLE)),1,$(shell expr $(if $(filter-out 1,$(PARAM_TX_PTP_TAG_ENABLE)),0,$(PARAM_TX_PTP_TAG_WIDTH)) + $(if $(filter-out 1,$(TX_PTP_TS_CTRL_IN_TUSER)),0,1) + 1 )) -export PARAM_RX_USER_WIDTH := $(if $(filter-out 1,$(PARAM_RX_PTP_TS_ENABLE)),1,$(shell expr $(PARAM_TX_PTP_TS_WIDTH) + 1 )) +export PARAM_TX_USER_WIDTH := $(if $(filter-out 1,$(PARAM_PTP_TS_ENABLE)),1,$(shell expr $(if $(filter-out 1,$(PARAM_TX_PTP_TAG_ENABLE)),0,$(PARAM_TX_PTP_TAG_WIDTH)) + $(if $(filter-out 1,$(TX_PTP_TS_CTRL_IN_TUSER)),0,1) + 1 )) +export PARAM_RX_USER_WIDTH := $(if $(filter-out 1,$(PARAM_PTP_TS_ENABLE)),1,$(shell expr $(PARAM_PTP_TS_WIDTH) + 1 )) export PARAM_PFC_ENABLE := 1 export PARAM_PAUSE_ENABLE := $(PARAM_PFC_ENABLE) diff --git a/tb/eth_mac_1g/test_eth_mac_1g.py b/tb/eth_mac_1g/test_eth_mac_1g.py index 7bf1b4384..5c5a9e893 100644 --- a/tb/eth_mac_1g/test_eth_mac_1g.py +++ b/tb/eth_mac_1g/test_eth_mac_1g.py @@ -727,15 +727,14 @@ def test_eth_mac_1g(request, pfc_en): parameters['DATA_WIDTH'] = 8 parameters['ENABLE_PADDING'] = 1 parameters['MIN_FRAME_LENGTH'] = 64 - parameters['TX_PTP_TS_ENABLE'] = 1 - parameters['TX_PTP_TS_WIDTH'] = 96 - parameters['TX_PTP_TS_CTRL_IN_TUSER'] = parameters['TX_PTP_TS_ENABLE'] - parameters['TX_PTP_TAG_ENABLE'] = parameters['TX_PTP_TS_ENABLE'] + parameters['PTP_TS_ENABLE'] = 1 + parameters['PTP_TS_FMT_TOD'] = 1 + parameters['PTP_TS_WIDTH'] = 96 if parameters['PTP_TS_FMT_TOD'] else 64 + parameters['TX_PTP_TS_CTRL_IN_TUSER'] = parameters['PTP_TS_ENABLE'] + parameters['TX_PTP_TAG_ENABLE'] = parameters['PTP_TS_ENABLE'] parameters['TX_PTP_TAG_WIDTH'] = 16 - parameters['RX_PTP_TS_ENABLE'] = parameters['TX_PTP_TS_ENABLE'] - parameters['RX_PTP_TS_WIDTH'] = 96 - parameters['TX_USER_WIDTH'] = ((parameters['TX_PTP_TAG_WIDTH'] if parameters['TX_PTP_TAG_ENABLE'] else 0) + (1 if parameters['TX_PTP_TS_CTRL_IN_TUSER'] else 0) if parameters['TX_PTP_TS_ENABLE'] else 0) + 1 - parameters['RX_USER_WIDTH'] = (parameters['RX_PTP_TS_WIDTH'] if parameters['RX_PTP_TS_ENABLE'] else 0) + 1 + parameters['TX_USER_WIDTH'] = ((parameters['TX_PTP_TAG_WIDTH'] if parameters['TX_PTP_TAG_ENABLE'] else 0) + (1 if parameters['TX_PTP_TS_CTRL_IN_TUSER'] else 0) if parameters['PTP_TS_ENABLE'] else 0) + 1 + parameters['RX_USER_WIDTH'] = (parameters['PTP_TS_WIDTH'] if parameters['PTP_TS_ENABLE'] else 0) + 1 parameters['PFC_ENABLE'] = pfc_en parameters['PAUSE_ENABLE'] = parameters['PFC_ENABLE'] diff --git a/tb/eth_mac_phy_10g/Makefile b/tb/eth_mac_phy_10g/Makefile index e5dec6fd2..d0e2a4ae8 100644 --- a/tb/eth_mac_phy_10g/Makefile +++ b/tb/eth_mac_phy_10g/Makefile @@ -50,15 +50,14 @@ export PARAM_ENABLE_DIC := 1 export PARAM_MIN_FRAME_LENGTH := 64 export PARAM_PTP_PERIOD_NS := 6 export PARAM_PTP_PERIOD_FNS := 26214 -export PARAM_TX_PTP_TS_ENABLE := 1 -export PARAM_TX_PTP_TS_WIDTH := 96 -export PARAM_TX_PTP_TS_CTRL_IN_TUSER := $(PARAM_TX_PTP_TS_ENABLE) -export PARAM_TX_PTP_TAG_ENABLE := $(PARAM_TX_PTP_TS_ENABLE) +export PARAM_PTP_TS_ENABLE := 1 +export PARAM_PTP_TS_FMT_TOD := 1 +export PARAM_PTP_TS_WIDTH := $(if $(filter-out 1,$(PARAM_PTP_TS_FMT_TOD)),64,96) +export PARAM_TX_PTP_TS_CTRL_IN_TUSER := $(PARAM_PTP_TS_ENABLE) +export PARAM_TX_PTP_TAG_ENABLE := $(PARAM_PTP_TS_ENABLE) export PARAM_TX_PTP_TAG_WIDTH := 16 -export PARAM_RX_PTP_TS_ENABLE := $(PARAM_TX_PTP_TS_ENABLE) -export PARAM_RX_PTP_TS_WIDTH := 96 -export PARAM_TX_USER_WIDTH := $(if $(filter-out 1,$(PARAM_TX_PTP_TS_ENABLE)),1,$(shell expr $(if $(filter-out 1,$(PARAM_TX_PTP_TAG_ENABLE)),0,$(PARAM_TX_PTP_TAG_WIDTH)) + $(if $(filter-out 1,$(TX_PTP_TS_CTRL_IN_TUSER)),0,1) + 1 )) -export PARAM_RX_USER_WIDTH := $(if $(filter-out 1,$(PARAM_RX_PTP_TS_ENABLE)),1,$(shell expr $(PARAM_RX_PTP_TS_WIDTH) + 1 )) +export PARAM_TX_USER_WIDTH := $(if $(filter-out 1,$(PARAM_PTP_TS_ENABLE)),1,$(shell expr $(if $(filter-out 1,$(PARAM_TX_PTP_TAG_ENABLE)),0,$(PARAM_TX_PTP_TAG_WIDTH)) + $(if $(filter-out 1,$(TX_PTP_TS_CTRL_IN_TUSER)),0,1) + 1 )) +export PARAM_RX_USER_WIDTH := $(if $(filter-out 1,$(PARAM_PTP_TS_ENABLE)),1,$(shell expr $(PARAM_PTP_TS_WIDTH) + 1 )) export PARAM_BIT_REVERSE := 0 export PARAM_SCRAMBLER_DISABLE := 0 export PARAM_PRBS31_ENABLE := 1 diff --git a/tb/eth_mac_phy_10g/test_eth_mac_phy_10g.py b/tb/eth_mac_phy_10g/test_eth_mac_phy_10g.py index 59330ef8b..0bb0d167a 100644 --- a/tb/eth_mac_phy_10g/test_eth_mac_phy_10g.py +++ b/tb/eth_mac_phy_10g/test_eth_mac_phy_10g.py @@ -480,15 +480,14 @@ def test_eth_mac_phy_10g(request, data_width, enable_dic): parameters['MIN_FRAME_LENGTH'] = 64 parameters['PTP_PERIOD_NS'] = 0x6 if parameters['DATA_WIDTH'] == 64 else 0x3 parameters['PTP_PERIOD_FNS'] = 0x6666 if parameters['DATA_WIDTH'] == 64 else 0x3333 - parameters['TX_PTP_TS_ENABLE'] = 1 - parameters['TX_PTP_TS_WIDTH'] = 96 - parameters['TX_PTP_TS_CTRL_IN_TUSER'] = parameters['TX_PTP_TS_ENABLE'] - parameters['TX_PTP_TAG_ENABLE'] = parameters['TX_PTP_TS_ENABLE'] + parameters['PTP_TS_ENABLE'] = 1 + parameters['PTP_TS_FMT_TOD'] = 1 + parameters['PTP_TS_WIDTH'] = 96 if parameters['PTP_TS_FMT_TOD'] else 64 + parameters['TX_PTP_TS_CTRL_IN_TUSER'] = parameters['PTP_TS_ENABLE'] + parameters['TX_PTP_TAG_ENABLE'] = parameters['PTP_TS_ENABLE'] parameters['TX_PTP_TAG_WIDTH'] = 16 - parameters['RX_PTP_TS_ENABLE'] = parameters['TX_PTP_TS_ENABLE'] - parameters['RX_PTP_TS_WIDTH'] = 96 - parameters['TX_USER_WIDTH'] = ((parameters['TX_PTP_TAG_WIDTH'] if parameters['TX_PTP_TAG_ENABLE'] else 0) + (1 if parameters['TX_PTP_TS_CTRL_IN_TUSER'] else 0) if parameters['TX_PTP_TS_ENABLE'] else 0) + 1 - parameters['RX_USER_WIDTH'] = (parameters['RX_PTP_TS_WIDTH'] if parameters['RX_PTP_TS_ENABLE'] else 0) + 1 + parameters['TX_USER_WIDTH'] = ((parameters['TX_PTP_TAG_WIDTH'] if parameters['TX_PTP_TAG_ENABLE'] else 0) + (1 if parameters['TX_PTP_TS_CTRL_IN_TUSER'] else 0) if parameters['PTP_TS_ENABLE'] else 0) + 1 + parameters['RX_USER_WIDTH'] = (parameters['PTP_TS_WIDTH'] if parameters['PTP_TS_ENABLE'] else 0) + 1 parameters['BIT_REVERSE'] = 0 parameters['SCRAMBLER_DISABLE'] = 0 parameters['PRBS31_ENABLE'] = 1 diff --git a/tb/eth_mac_phy_10g_fifo/Makefile b/tb/eth_mac_phy_10g_fifo/Makefile index 9d94621aa..b7cc3d01d 100644 --- a/tb/eth_mac_phy_10g_fifo/Makefile +++ b/tb/eth_mac_phy_10g_fifo/Makefile @@ -69,15 +69,15 @@ export PARAM_RX_DROP_BAD_FRAME := $(PARAM_RX_DROP_OVERSIZE_FRAME) export PARAM_RX_DROP_WHEN_FULL := $(PARAM_RX_DROP_OVERSIZE_FRAME) export PARAM_PTP_PERIOD_NS := 6 export PARAM_PTP_PERIOD_FNS := 26214 -export PARAM_TX_PTP_TS_ENABLE := 1 -export PARAM_RX_PTP_TS_ENABLE := $(PARAM_TX_PTP_TS_ENABLE) -export PARAM_TX_PTP_TS_CTRL_IN_TUSER := $(PARAM_TX_PTP_TS_ENABLE) +export PARAM_PTP_TS_ENABLE := 1 +export PARAM_PTP_TS_FMT_TOD := 1 +export PARAM_PTP_TS_WIDTH := $(if $(filter-out 1,$(PARAM_PTP_TS_FMT_TOD)),64,96) +export PARAM_TX_PTP_TS_CTRL_IN_TUSER := $(PARAM_PTP_TS_ENABLE) export PARAM_TX_PTP_TS_FIFO_DEPTH := 64 -export PARAM_PTP_TS_WIDTH := 96 -export PARAM_TX_PTP_TAG_ENABLE := $(PARAM_TX_PTP_TS_ENABLE) +export PARAM_TX_PTP_TAG_ENABLE := $(PARAM_PTP_TS_ENABLE) export PARAM_PTP_TAG_WIDTH := 16 -export PARAM_TX_USER_WIDTH := $(if $(filter-out 1,$(PARAM_TX_PTP_TS_ENABLE)),1,$(shell expr $(if $(filter-out 1,$(PARAM_TX_PTP_TAG_ENABLE)),0,$(PARAM_PTP_TAG_WIDTH)) + $(if $(filter-out 1,$(TX_PTP_TS_CTRL_IN_TUSER)),0,1) + 1 )) -export PARAM_RX_USER_WIDTH := $(if $(filter-out 1,$(PARAM_RX_PTP_TS_ENABLE)),1,$(shell expr $(PARAM_PTP_TS_WIDTH) + 1 )) +export PARAM_TX_USER_WIDTH := $(if $(filter-out 1,$(PARAM_PTP_TS_ENABLE)),1,$(shell expr $(if $(filter-out 1,$(PARAM_TX_PTP_TAG_ENABLE)),0,$(PARAM_PTP_TAG_WIDTH)) + $(if $(filter-out 1,$(TX_PTP_TS_CTRL_IN_TUSER)),0,1) + 1 )) +export PARAM_RX_USER_WIDTH := $(if $(filter-out 1,$(PARAM_PTP_TS_ENABLE)),1,$(shell expr $(PARAM_PTP_TS_WIDTH) + 1 )) export PARAM_BIT_REVERSE := 0 export PARAM_SCRAMBLER_DISABLE := 0 export PARAM_PRBS31_ENABLE := 1 diff --git a/tb/eth_mac_phy_10g_fifo/test_eth_mac_phy_10g_fifo.py b/tb/eth_mac_phy_10g_fifo/test_eth_mac_phy_10g_fifo.py index 1afeb148c..91c8118eb 100644 --- a/tb/eth_mac_phy_10g_fifo/test_eth_mac_phy_10g_fifo.py +++ b/tb/eth_mac_phy_10g_fifo/test_eth_mac_phy_10g_fifo.py @@ -437,15 +437,15 @@ def test_eth_mac_phy_10g_fifo(request, data_width, enable_dic): parameters['RX_DROP_WHEN_FULL'] = parameters['RX_DROP_OVERSIZE_FRAME'] parameters['PTP_PERIOD_NS'] = 0x6 if parameters['DATA_WIDTH'] == 64 else 0x3 parameters['PTP_PERIOD_FNS'] = 0x6666 if parameters['DATA_WIDTH'] == 64 else 0x3333 - parameters['TX_PTP_TS_ENABLE'] = 1 - parameters['RX_PTP_TS_ENABLE'] = parameters['TX_PTP_TS_ENABLE'] - parameters['TX_PTP_TS_CTRL_IN_TUSER'] = parameters['TX_PTP_TS_ENABLE'] + parameters['PTP_TS_ENABLE'] = 1 + parameters['PTP_TS_FMT_TOD'] = 1 + parameters['PTP_TS_WIDTH'] = 96 if parameters['PTP_TS_FMT_TOD'] else 64 + parameters['TX_PTP_TS_CTRL_IN_TUSER'] = parameters['PTP_TS_ENABLE'] parameters['TX_PTP_TS_FIFO_DEPTH'] = 64 - parameters['PTP_TS_WIDTH'] = 96 - parameters['TX_PTP_TAG_ENABLE'] = parameters['TX_PTP_TS_ENABLE'] + parameters['TX_PTP_TAG_ENABLE'] = parameters['PTP_TS_ENABLE'] parameters['PTP_TAG_WIDTH'] = 16 - parameters['TX_USER_WIDTH'] = ((parameters['PTP_TAG_WIDTH'] if parameters['TX_PTP_TAG_ENABLE'] else 0) + (1 if parameters['TX_PTP_TS_CTRL_IN_TUSER'] else 0) if parameters['TX_PTP_TS_ENABLE'] else 0) + 1 - parameters['RX_USER_WIDTH'] = (parameters['PTP_TS_WIDTH'] if parameters['RX_PTP_TS_ENABLE'] else 0) + 1 + parameters['TX_USER_WIDTH'] = ((parameters['PTP_TAG_WIDTH'] if parameters['TX_PTP_TAG_ENABLE'] else 0) + (1 if parameters['TX_PTP_TS_CTRL_IN_TUSER'] else 0) if parameters['PTP_TS_ENABLE'] else 0) + 1 + parameters['RX_USER_WIDTH'] = (parameters['PTP_TS_WIDTH'] if parameters['PTP_TS_ENABLE'] else 0) + 1 parameters['BIT_REVERSE'] = 0 parameters['SCRAMBLER_DISABLE'] = 0 parameters['PRBS31_ENABLE'] = 1