diff --git a/rtl/axis_baser_rx_64.v b/rtl/axis_baser_rx_64.v index 714c9194..a20d2698 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 1dcae600..abc52ed5 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 471f0f6a..586de38c 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 4b45d64c..cb4235a2 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 c64f5aae..dfea2889 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 32272ceb..07751769 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 84eae7e1..0e1b9a12 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 be2a4408..dc35c283 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 be84e7ac..cbb555a2 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 28bf9940..fe733da9 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 e84ee649..2d36be4c 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 67ece95a..37044d11 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 94e3537e..a06faf8b 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 a5d23fac..93feb53f 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 cf8468d8..6f2f9db2 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 923a45d7..3a68d8c3 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 2d3dcb9d..05800b0f 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 0ade4505..b511f12c 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 e45fa284..fd57cfc7 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 b7144265..d31579ae 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 761b90e9..87abf9d1 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 2a85805e..663b4f01 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 cf98b4fd..6298e161 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 b3475f7c..f5827780 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 7bf1b438..5c5a9e89 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 e5dec6fd..d0e2a4ae 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 59330ef8..0bb0d167 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 9d94621a..b7cc3d01 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 1afeb148..91c8118e 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