From 3a665f0ded9bc89090c0521c5997e51a0d6c2a5b Mon Sep 17 00:00:00 2001 From: Alex Forencich Date: Mon, 14 Aug 2023 16:58:35 -0700 Subject: [PATCH] Compute DEPTH based on FIFO data width Signed-off-by: Alex Forencich --- tb/axis_async_fifo/Makefile | 6 +++--- tb/axis_async_fifo/test_axis_async_fifo.py | 2 +- tb/axis_async_fifo_adapter/Makefile | 10 +++++----- .../test_axis_async_fifo_adapter.py | 2 +- tb/axis_fifo/Makefile | 6 +++--- tb/axis_fifo/test_axis_fifo.py | 2 +- tb/axis_fifo_adapter/Makefile | 10 +++++----- tb/axis_fifo_adapter/test_axis_fifo_adapter.py | 2 +- 8 files changed, 20 insertions(+), 20 deletions(-) diff --git a/tb/axis_async_fifo/Makefile b/tb/axis_async_fifo/Makefile index a6c9149cb..ef0aaef36 100644 --- a/tb/axis_async_fifo/Makefile +++ b/tb/axis_async_fifo/Makefile @@ -32,10 +32,10 @@ MODULE = test_$(DUT) VERILOG_SOURCES += ../../rtl/$(DUT).v # module parameters -export PARAM_DEPTH := 1024 export PARAM_DATA_WIDTH := 8 -export PARAM_KEEP_ENABLE := $(shell expr $(PARAM_DATA_WIDTH) \> 8 ) -export PARAM_KEEP_WIDTH := $(shell expr \( $(PARAM_DATA_WIDTH) + 7 \) / 8 ) +export PARAM_KEEP_ENABLE := $(shell echo $$(( $(PARAM_DATA_WIDTH) > 8 ))) +export PARAM_KEEP_WIDTH := $(shell echo $$(( ( $(PARAM_DATA_WIDTH) + 7 ) / 8 ))) +export PARAM_DEPTH := $(shell echo $$(( 1024 * $(PARAM_KEEP_WIDTH) ))) export PARAM_LAST_ENABLE := 1 export PARAM_ID_ENABLE := 1 export PARAM_ID_WIDTH := 8 diff --git a/tb/axis_async_fifo/test_axis_async_fifo.py b/tb/axis_async_fifo/test_axis_async_fifo.py index 4d847e0ce..cf5448e64 100644 --- a/tb/axis_async_fifo/test_axis_async_fifo.py +++ b/tb/axis_async_fifo/test_axis_async_fifo.py @@ -595,10 +595,10 @@ def test_axis_async_fifo(request, data_width, ram_pipeline, output_fifo, parameters = {} - parameters['DEPTH'] = 1024 parameters['DATA_WIDTH'] = data_width parameters['KEEP_ENABLE'] = int(parameters['DATA_WIDTH'] > 8) parameters['KEEP_WIDTH'] = (parameters['DATA_WIDTH'] + 7) // 8 + parameters['DEPTH'] = 1024 * parameters['KEEP_WIDTH'] parameters['LAST_ENABLE'] = 1 parameters['ID_ENABLE'] = 1 parameters['ID_WIDTH'] = 8 diff --git a/tb/axis_async_fifo_adapter/Makefile b/tb/axis_async_fifo_adapter/Makefile index f3006e350..fb757817a 100644 --- a/tb/axis_async_fifo_adapter/Makefile +++ b/tb/axis_async_fifo_adapter/Makefile @@ -34,13 +34,13 @@ VERILOG_SOURCES += ../../rtl/axis_async_fifo.v VERILOG_SOURCES += ../../rtl/axis_adapter.v # module parameters -export PARAM_DEPTH := 1024 export PARAM_S_DATA_WIDTH := 8 -export PARAM_S_KEEP_ENABLE := $(shell expr $(PARAM_S_DATA_WIDTH) \> 8 ) -export PARAM_S_KEEP_WIDTH := $(shell expr \( $(PARAM_S_DATA_WIDTH) + 7 \) / 8 ) +export PARAM_S_KEEP_ENABLE := $(shell echo $$(( $(PARAM_S_DATA_WIDTH) > 8 ))) +export PARAM_S_KEEP_WIDTH := $(shell echo $$(( ( $(PARAM_S_DATA_WIDTH) + 7 ) / 8 ))) export PARAM_M_DATA_WIDTH := 8 -export PARAM_M_KEEP_ENABLE := $(shell expr $(PARAM_M_DATA_WIDTH) \> 8 ) -export PARAM_M_KEEP_WIDTH := $(shell expr \( $(PARAM_M_DATA_WIDTH) + 7 \) / 8 ) +export PARAM_M_KEEP_ENABLE := $(shell echo $$(( $(PARAM_M_DATA_WIDTH) > 8 ))) +export PARAM_M_KEEP_WIDTH := $(shell echo $$(( ( $(PARAM_M_DATA_WIDTH) + 7 ) / 8 ))) +export PARAM_DEPTH := $(shell echo $$(( 1024 * ($(PARAM_S_KEEP_WIDTH) > $(PARAM_M_KEEP_WIDTH) ? $(PARAM_S_KEEP_WIDTH) : $(PARAM_M_KEEP_WIDTH)) ))) export PARAM_ID_ENABLE := 1 export PARAM_ID_WIDTH := 8 export PARAM_DEST_ENABLE := 1 diff --git a/tb/axis_async_fifo_adapter/test_axis_async_fifo_adapter.py b/tb/axis_async_fifo_adapter/test_axis_async_fifo_adapter.py index a93f4bb91..1a17e2808 100644 --- a/tb/axis_async_fifo_adapter/test_axis_async_fifo_adapter.py +++ b/tb/axis_async_fifo_adapter/test_axis_async_fifo_adapter.py @@ -590,13 +590,13 @@ def test_axis_async_fifo_adapter(request, s_data_width, m_data_width, frame_fifo parameters = {} - parameters['DEPTH'] = 1024 parameters['S_DATA_WIDTH'] = s_data_width parameters['S_KEEP_ENABLE'] = int(parameters['S_DATA_WIDTH'] > 8) parameters['S_KEEP_WIDTH'] = (parameters['S_DATA_WIDTH'] + 7) // 8 parameters['M_DATA_WIDTH'] = m_data_width parameters['M_KEEP_ENABLE'] = int(parameters['M_DATA_WIDTH'] > 8) parameters['M_KEEP_WIDTH'] = (parameters['M_DATA_WIDTH'] + 7) // 8 + parameters['DEPTH'] = 1024 * max(parameters['S_KEEP_WIDTH'], parameters['M_KEEP_WIDTH']) parameters['ID_ENABLE'] = 1 parameters['ID_WIDTH'] = 8 parameters['DEST_ENABLE'] = 1 diff --git a/tb/axis_fifo/Makefile b/tb/axis_fifo/Makefile index ecbaf9601..41641c7be 100644 --- a/tb/axis_fifo/Makefile +++ b/tb/axis_fifo/Makefile @@ -32,10 +32,10 @@ MODULE = test_$(DUT) VERILOG_SOURCES += ../../rtl/$(DUT).v # module parameters -export PARAM_DEPTH := 1024 export PARAM_DATA_WIDTH := 8 -export PARAM_KEEP_ENABLE := $(shell expr $(PARAM_DATA_WIDTH) \> 8 ) -export PARAM_KEEP_WIDTH := $(shell expr \( $(PARAM_DATA_WIDTH) + 7 \) / 8 ) +export PARAM_KEEP_ENABLE := $(shell echo $$(( $(PARAM_DATA_WIDTH) > 8 ))) +export PARAM_KEEP_WIDTH := $(shell echo $$(( ( $(PARAM_DATA_WIDTH) + 7 ) / 8 ))) +export PARAM_DEPTH := $(shell echo $$(( 1024 * $(PARAM_KEEP_WIDTH) ))) export PARAM_LAST_ENABLE := 1 export PARAM_ID_ENABLE := 1 export PARAM_ID_WIDTH := 8 diff --git a/tb/axis_fifo/test_axis_fifo.py b/tb/axis_fifo/test_axis_fifo.py index 95d76be8b..026b34f00 100644 --- a/tb/axis_fifo/test_axis_fifo.py +++ b/tb/axis_fifo/test_axis_fifo.py @@ -374,10 +374,10 @@ def test_axis_fifo(request, data_width, ram_pipeline, output_fifo, parameters = {} - parameters['DEPTH'] = 1024 parameters['DATA_WIDTH'] = data_width parameters['KEEP_ENABLE'] = int(parameters['DATA_WIDTH'] > 8) parameters['KEEP_WIDTH'] = (parameters['DATA_WIDTH'] + 7) // 8 + parameters['DEPTH'] = 1024 * parameters['KEEP_WIDTH'] parameters['LAST_ENABLE'] = 1 parameters['ID_ENABLE'] = 1 parameters['ID_WIDTH'] = 8 diff --git a/tb/axis_fifo_adapter/Makefile b/tb/axis_fifo_adapter/Makefile index 3493ed10e..0a995cde7 100644 --- a/tb/axis_fifo_adapter/Makefile +++ b/tb/axis_fifo_adapter/Makefile @@ -34,13 +34,13 @@ VERILOG_SOURCES += ../../rtl/axis_fifo.v VERILOG_SOURCES += ../../rtl/axis_adapter.v # module parameters -export PARAM_DEPTH := 1024 export PARAM_S_DATA_WIDTH := 8 -export PARAM_S_KEEP_ENABLE := $(shell expr $(PARAM_S_DATA_WIDTH) \> 8 ) -export PARAM_S_KEEP_WIDTH := $(shell expr \( $(PARAM_S_DATA_WIDTH) + 7 \) / 8 ) +export PARAM_S_KEEP_ENABLE := $(shell echo $$(( $(PARAM_S_DATA_WIDTH) > 8 ))) +export PARAM_S_KEEP_WIDTH := $(shell echo $$(( ( $(PARAM_S_DATA_WIDTH) + 7 ) / 8 ))) export PARAM_M_DATA_WIDTH := 8 -export PARAM_M_KEEP_ENABLE := $(shell expr $(PARAM_M_DATA_WIDTH) \> 8 ) -export PARAM_M_KEEP_WIDTH := $(shell expr \( $(PARAM_M_DATA_WIDTH) + 7 \) / 8 ) +export PARAM_M_KEEP_ENABLE := $(shell echo $$(( $(PARAM_M_DATA_WIDTH) > 8 ))) +export PARAM_M_KEEP_WIDTH := $(shell echo $$(( ( $(PARAM_M_DATA_WIDTH) + 7 ) / 8 ))) +export PARAM_DEPTH := $(shell echo $$(( 1024 * ($(PARAM_S_KEEP_WIDTH) > $(PARAM_M_KEEP_WIDTH) ? $(PARAM_S_KEEP_WIDTH) : $(PARAM_M_KEEP_WIDTH)) ))) export PARAM_ID_ENABLE := 1 export PARAM_ID_WIDTH := 8 export PARAM_DEST_ENABLE := 1 diff --git a/tb/axis_fifo_adapter/test_axis_fifo_adapter.py b/tb/axis_fifo_adapter/test_axis_fifo_adapter.py index aaec4f30a..f82b61951 100644 --- a/tb/axis_fifo_adapter/test_axis_fifo_adapter.py +++ b/tb/axis_fifo_adapter/test_axis_fifo_adapter.py @@ -373,13 +373,13 @@ def test_axis_fifo_adapter(request, s_data_width, m_data_width, frame_fifo, drop parameters = {} - parameters['DEPTH'] = 1024 parameters['S_DATA_WIDTH'] = s_data_width parameters['S_KEEP_ENABLE'] = int(parameters['S_DATA_WIDTH'] > 8) parameters['S_KEEP_WIDTH'] = (parameters['S_DATA_WIDTH'] + 7) // 8 parameters['M_DATA_WIDTH'] = m_data_width parameters['M_KEEP_ENABLE'] = int(parameters['M_DATA_WIDTH'] > 8) parameters['M_KEEP_WIDTH'] = (parameters['M_DATA_WIDTH'] + 7) // 8 + parameters['DEPTH'] = 1024 * max(parameters['S_KEEP_WIDTH'], parameters['M_KEEP_WIDTH']) parameters['ID_ENABLE'] = 1 parameters['ID_WIDTH'] = 8 parameters['DEST_ENABLE'] = 1