From 1f0b6a625cc4dca5f92808b41b8ca028b564f2ee Mon Sep 17 00:00:00 2001 From: Alex Forencich Date: Thu, 6 Jul 2023 16:46:32 -0700 Subject: [PATCH] PTP parameter clean-up Signed-off-by: Alex Forencich --- rtl/eth_mac_10g.v | 2 +- rtl/eth_mac_10g_fifo.v | 4 ++-- rtl/eth_mac_1g.v | 2 +- rtl/eth_mac_phy_10g.v | 2 +- rtl/eth_mac_phy_10g_fifo.v | 4 ++-- tb/eth_mac_10g/Makefile | 2 +- tb/eth_mac_10g/test_eth_mac_10g.py | 2 +- tb/eth_mac_10g_fifo/Makefile | 2 +- tb/eth_mac_10g_fifo/test_eth_mac_10g_fifo.py | 2 +- tb/eth_mac_1g/Makefile | 8 +++----- tb/eth_mac_1g/test_eth_mac_1g.py | 2 +- tb/eth_mac_phy_10g/Makefile | 2 +- tb/eth_mac_phy_10g/test_eth_mac_phy_10g.py | 2 +- tb/eth_mac_phy_10g_fifo/Makefile | 2 +- tb/eth_mac_phy_10g_fifo/test_eth_mac_phy_10g_fifo.py | 2 +- 15 files changed, 19 insertions(+), 21 deletions(-) diff --git a/rtl/eth_mac_10g.v b/rtl/eth_mac_10g.v index 46a57433d..7346c0248 100644 --- a/rtl/eth_mac_10g.v +++ b/rtl/eth_mac_10g.v @@ -45,7 +45,7 @@ module eth_mac_10g # parameter TX_PTP_TS_WIDTH = 96, parameter TX_PTP_TAG_ENABLE = TX_PTP_TS_ENABLE, parameter TX_PTP_TAG_WIDTH = 16, - parameter RX_PTP_TS_ENABLE = 0, + 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) + 1, parameter RX_USER_WIDTH = (RX_PTP_TS_ENABLE ? RX_PTP_TS_WIDTH : 0) + 1 diff --git a/rtl/eth_mac_10g_fifo.v b/rtl/eth_mac_10g_fifo.v index f98fff1ac..396827964 100644 --- a/rtl/eth_mac_10g_fifo.v +++ b/rtl/eth_mac_10g_fifo.v @@ -57,10 +57,10 @@ module eth_mac_10g_fifo # parameter PTP_PERIOD_FNS = 16'h6666, parameter PTP_USE_SAMPLE_CLOCK = 0, parameter TX_PTP_TS_ENABLE = 0, - parameter RX_PTP_TS_ENABLE = 0, + parameter RX_PTP_TS_ENABLE = TX_PTP_TS_ENABLE, parameter TX_PTP_TS_FIFO_DEPTH = 64, parameter PTP_TS_WIDTH = 96, - parameter TX_PTP_TAG_ENABLE = 0, + parameter TX_PTP_TAG_ENABLE = TX_PTP_TS_ENABLE, parameter PTP_TAG_WIDTH = 16, parameter TX_USER_WIDTH = (TX_PTP_TS_ENABLE && TX_PTP_TAG_ENABLE ? PTP_TAG_WIDTH : 0) + 1, parameter RX_USER_WIDTH = (RX_PTP_TS_ENABLE ? PTP_TS_WIDTH : 0) + 1 diff --git a/rtl/eth_mac_1g.v b/rtl/eth_mac_1g.v index d94f77472..9fed39ee0 100644 --- a/rtl/eth_mac_1g.v +++ b/rtl/eth_mac_1g.v @@ -40,7 +40,7 @@ module eth_mac_1g # parameter TX_PTP_TS_WIDTH = 96, parameter TX_PTP_TAG_ENABLE = TX_PTP_TS_ENABLE, parameter TX_PTP_TAG_WIDTH = 16, - parameter RX_PTP_TS_ENABLE = 0, + parameter RX_PTP_TS_ENABLE = TX_PTP_TS_ENABLE, parameter RX_PTP_TS_WIDTH = 96, parameter TX_USER_WIDTH = (TX_PTP_TAG_ENABLE ? TX_PTP_TAG_WIDTH : 0) + 1, parameter RX_USER_WIDTH = (RX_PTP_TS_ENABLE ? RX_PTP_TS_WIDTH : 0) + 1 diff --git a/rtl/eth_mac_phy_10g.v b/rtl/eth_mac_phy_10g.v index 6145b60e5..7e85b5755 100644 --- a/rtl/eth_mac_phy_10g.v +++ b/rtl/eth_mac_phy_10g.v @@ -45,7 +45,7 @@ module eth_mac_phy_10g # parameter TX_PTP_TS_WIDTH = 96, parameter TX_PTP_TAG_ENABLE = TX_PTP_TS_ENABLE, parameter TX_PTP_TAG_WIDTH = 16, - parameter RX_PTP_TS_ENABLE = 0, + parameter RX_PTP_TS_ENABLE = TX_PTP_TS_ENABLE, parameter RX_PTP_TS_WIDTH = 96, parameter TX_USER_WIDTH = (TX_PTP_TAG_ENABLE ? TX_PTP_TAG_WIDTH : 0) + 1, parameter RX_USER_WIDTH = (RX_PTP_TS_ENABLE ? RX_PTP_TS_WIDTH : 0) + 1, diff --git a/rtl/eth_mac_phy_10g_fifo.v b/rtl/eth_mac_phy_10g_fifo.v index e56c26814..6b1b71e20 100644 --- a/rtl/eth_mac_phy_10g_fifo.v +++ b/rtl/eth_mac_phy_10g_fifo.v @@ -65,10 +65,10 @@ module eth_mac_phy_10g_fifo # parameter PTP_PERIOD_FNS = 16'h6666, parameter PTP_USE_SAMPLE_CLOCK = 0, parameter TX_PTP_TS_ENABLE = 0, - parameter RX_PTP_TS_ENABLE = 0, + parameter RX_PTP_TS_ENABLE = TX_PTP_TS_ENABLE, parameter TX_PTP_TS_FIFO_DEPTH = 64, parameter PTP_TS_WIDTH = 96, - parameter TX_PTP_TAG_ENABLE = 0, + parameter TX_PTP_TAG_ENABLE = TX_PTP_TS_ENABLE, parameter PTP_TAG_WIDTH = 16, parameter TX_USER_WIDTH = (TX_PTP_TS_ENABLE && TX_PTP_TAG_ENABLE ? PTP_TAG_WIDTH : 0) + 1, parameter RX_USER_WIDTH = (RX_PTP_TS_ENABLE ? PTP_TS_WIDTH : 0) + 1 diff --git a/tb/eth_mac_10g/Makefile b/tb/eth_mac_10g/Makefile index d9df95bc9..7b0098fb2 100644 --- a/tb/eth_mac_10g/Makefile +++ b/tb/eth_mac_10g/Makefile @@ -49,7 +49,7 @@ 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_TX_PTP_TAG_WIDTH := 16 -export PARAM_RX_PTP_TS_ENABLE := 1 +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_TAG_ENABLE)),1,$(shell expr $(PARAM_TX_PTP_TAG_WIDTH) + 1 )) export PARAM_RX_USER_WIDTH := $(if $(filter-out 1,$(PARAM_RX_PTP_TS_ENABLE)),1,$(shell expr $(PARAM_RX_PTP_TS_WIDTH) + 1 )) diff --git a/tb/eth_mac_10g/test_eth_mac_10g.py b/tb/eth_mac_10g/test_eth_mac_10g.py index a5fa3a2b3..8261d44c7 100644 --- a/tb/eth_mac_10g/test_eth_mac_10g.py +++ b/tb/eth_mac_10g/test_eth_mac_10g.py @@ -306,7 +306,7 @@ def test_eth_mac_10g(request, data_width, enable_dic): parameters['TX_PTP_TS_WIDTH'] = 96 parameters['TX_PTP_TAG_ENABLE'] = parameters['TX_PTP_TS_ENABLE'] parameters['TX_PTP_TAG_WIDTH'] = 16 - parameters['RX_PTP_TS_ENABLE'] = 1 + 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_TS_ENABLE'] and parameters['TX_PTP_TAG_ENABLE'] else 0) + 1 parameters['RX_USER_WIDTH'] = (parameters['RX_PTP_TS_WIDTH'] if parameters['RX_PTP_TS_ENABLE'] else 0) + 1 diff --git a/tb/eth_mac_10g_fifo/Makefile b/tb/eth_mac_10g_fifo/Makefile index b7c4c1bf1..2086f187d 100644 --- a/tb/eth_mac_10g_fifo/Makefile +++ b/tb/eth_mac_10g_fifo/Makefile @@ -66,7 +66,7 @@ export PARAM_PTP_PERIOD_NS := 6 export PARAM_PTP_PERIOD_FNS := 26214 export PARAM_PTP_USE_SAMPLE_CLOCK := 0 export PARAM_TX_PTP_TS_ENABLE := 1 -export PARAM_RX_PTP_TS_ENABLE := 1 +export PARAM_RX_PTP_TS_ENABLE := $(PARAM_TX_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) 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 36338f5a2..04bfbf46e 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 @@ -337,7 +337,7 @@ def test_eth_mac_10g_fifo(request, data_width, enable_dic): parameters['PTP_PERIOD_FNS'] = 0x6666 if parameters['DATA_WIDTH'] == 64 else 0x3333 parameters['PTP_USE_SAMPLE_CLOCK'] = 0 parameters['TX_PTP_TS_ENABLE'] = 1 - parameters['RX_PTP_TS_ENABLE'] = 1 + parameters['RX_PTP_TS_ENABLE'] = parameters['TX_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'] diff --git a/tb/eth_mac_1g/Makefile b/tb/eth_mac_1g/Makefile index 3c8e9186c..322233e0e 100644 --- a/tb/eth_mac_1g/Makefile +++ b/tb/eth_mac_1g/Makefile @@ -42,12 +42,10 @@ export PARAM_TX_PTP_TS_ENABLE := 0 export PARAM_TX_PTP_TS_WIDTH := 96 export PARAM_TX_PTP_TAG_ENABLE := $(PARAM_TX_PTP_TS_ENABLE) export PARAM_TX_PTP_TAG_WIDTH := 16 -export PARAM_RX_PTP_TS_ENABLE := 0 +export PARAM_RX_PTP_TS_ENABLE := $(PARAM_TX_PTP_TS_ENABLE) export PARAM_RX_PTP_TS_WIDTH := 96 -# export PARAM_TX_USER_WIDTH := (TX_PTP_TAG_WIDTH if TX_PTP_TAG_ENABLE else 0) + 1 -export PARAM_TX_USER_WIDTH := 1 -# export PARAM_RX_USER_WIDTH := (RX_PTP_TS_WIDTH if RX_PTP_TS_ENABLE else 0) + 1 -export PARAM_RX_USER_WIDTH := 1 +export PARAM_TX_USER_WIDTH := $(if $(filter-out 1,$(PARAM_TX_PTP_TAG_ENABLE)),1,$(shell expr $(PARAM_PTP_TAG_WIDTH) + 1 )) +export PARAM_RX_USER_WIDTH := $(if $(filter-out 1,$(PARAM_RX_PTP_TS_ENABLE)),1,$(shell expr $(PARAM_PTP_TS_WIDTH) + 1 )) ifeq ($(SIM), icarus) PLUSARGS += -fst diff --git a/tb/eth_mac_1g/test_eth_mac_1g.py b/tb/eth_mac_1g/test_eth_mac_1g.py index 24b15ed27..d3b9211b1 100644 --- a/tb/eth_mac_1g/test_eth_mac_1g.py +++ b/tb/eth_mac_1g/test_eth_mac_1g.py @@ -240,7 +240,7 @@ def test_eth_mac_1g(request): parameters['TX_PTP_TS_WIDTH'] = 96 parameters['TX_PTP_TAG_ENABLE'] = parameters['TX_PTP_TS_ENABLE'] parameters['TX_PTP_TAG_WIDTH'] = 16 - parameters['RX_PTP_TS_ENABLE'] = 0 + 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 parameters['RX_USER_WIDTH'] = (parameters['RX_PTP_TS_WIDTH'] if parameters['RX_PTP_TS_ENABLE'] else 0) + 1 diff --git a/tb/eth_mac_phy_10g/Makefile b/tb/eth_mac_phy_10g/Makefile index a6747924b..b3da313bc 100644 --- a/tb/eth_mac_phy_10g/Makefile +++ b/tb/eth_mac_phy_10g/Makefile @@ -54,7 +54,7 @@ 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_TX_PTP_TAG_WIDTH := 16 -export PARAM_RX_PTP_TS_ENABLE := 1 +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_TAG_ENABLE)),1,$(shell expr $(PARAM_TX_PTP_TAG_WIDTH) + 1 )) export PARAM_RX_USER_WIDTH := $(if $(filter-out 1,$(PARAM_RX_PTP_TS_ENABLE)),1,$(shell expr $(PARAM_RX_PTP_TS_WIDTH) + 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 f5a65d80d..32b6512e3 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 @@ -375,7 +375,7 @@ def test_eth_mac_phy_10g(request, data_width, enable_dic): parameters['TX_PTP_TS_WIDTH'] = 96 parameters['TX_PTP_TAG_ENABLE'] = parameters['TX_PTP_TS_ENABLE'] parameters['TX_PTP_TAG_WIDTH'] = 16 - parameters['RX_PTP_TS_ENABLE'] = 1 + 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_TS_ENABLE'] and parameters['TX_PTP_TAG_ENABLE'] else 0) + 1 parameters['RX_USER_WIDTH'] = (parameters['RX_PTP_TS_WIDTH'] if parameters['RX_PTP_TS_ENABLE'] else 0) + 1 diff --git a/tb/eth_mac_phy_10g_fifo/Makefile b/tb/eth_mac_phy_10g_fifo/Makefile index c74477c68..d2d3486eb 100644 --- a/tb/eth_mac_phy_10g_fifo/Makefile +++ b/tb/eth_mac_phy_10g_fifo/Makefile @@ -71,7 +71,7 @@ export PARAM_PTP_PERIOD_NS := 6 export PARAM_PTP_PERIOD_FNS := 26214 export PARAM_PTP_USE_SAMPLE_CLOCK := 0 export PARAM_TX_PTP_TS_ENABLE := 1 -export PARAM_RX_PTP_TS_ENABLE := 1 +export PARAM_RX_PTP_TS_ENABLE := $(PARAM_TX_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) 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 1c553227f..a22886665 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 @@ -404,7 +404,7 @@ def test_eth_mac_phy_10g_fifo(request, data_width, enable_dic): parameters['PTP_PERIOD_FNS'] = 0x6666 if parameters['DATA_WIDTH'] == 64 else 0x3333 parameters['PTP_USE_SAMPLE_CLOCK'] = 0 parameters['TX_PTP_TS_ENABLE'] = 1 - parameters['RX_PTP_TS_ENABLE'] = 1 + parameters['RX_PTP_TS_ENABLE'] = parameters['TX_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']