Skip to content

Commit

Permalink
Clean up PTP parameters on MACs
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Forencich <[email protected]>
  • Loading branch information
alexforencich committed Feb 11, 2024
1 parent ae17f7d commit 870cebb
Show file tree
Hide file tree
Showing 29 changed files with 195 additions and 186 deletions.
11 changes: 6 additions & 5 deletions rtl/axis_baser_rx_64.v
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
(
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand All @@ -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
Expand All @@ -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
Expand Down
15 changes: 8 additions & 7 deletions rtl/axis_baser_tx_64.v
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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);
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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;
Expand Down
11 changes: 6 additions & 5 deletions rtl/axis_xgmii_rx_64.v
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
(
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
15 changes: 8 additions & 7 deletions rtl/axis_xgmii_tx_64.v
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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;
Expand Down
45 changes: 23 additions & 22 deletions rtl/eth_mac_10g.v
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand Down Expand Up @@ -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,

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 (
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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 (
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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;
Expand Down
23 changes: 11 additions & 12 deletions rtl/eth_mac_10g_fifo.v
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -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)
)
Expand Down
Loading

0 comments on commit 870cebb

Please sign in to comment.