Skip to content

Commit 664ab9f

Browse files
committed
Add support for file list files
Signed-off-by: Alex Forencich <[email protected]>
1 parent c1c3dc0 commit 664ab9f

24 files changed

+207
-48
lines changed

rtl/axis_arb_mux.f

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
axis_arb_mux.v
2+
arbiter.v
3+
priority_encoder.v

rtl/axis_async_fifo_adapter.f

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
axis_async_fifo_adapter.v
2+
axis_async_fifo.v
3+
axis_adapter.v

rtl/axis_cobs_encode.f

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
axis_cobs_encode.v
2+
axis_fifo.v

rtl/axis_fifo_adapter.f

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
axis_fifo_adapter.v
2+
axis_fifo.v
3+
axis_adapter.v

rtl/axis_frame_length_adjust_fifo.f

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
axis_frame_length_adjust_fifo.v
2+
axis_frame_length_adjust.v
3+
axis_fifo.v

rtl/axis_pipeline_register.f

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
axis_pipeline_register.v
2+
axis_register.v

rtl/axis_ram_switch.f

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
axis_ram_switch.v
2+
axis_adapter.v
3+
arbiter.v
4+
priority_encoder.v

rtl/axis_switch.f

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
axis_switch.v
2+
axis_register.v
3+
arbiter.v
4+
priority_encoder.v

tb/axis_arb_mux/Makefile

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,13 @@ WRAPPER = $(DUT)_wrap_$(PORTS)
3333
TOPLEVEL = $(WRAPPER)
3434
MODULE = test_$(DUT)
3535
VERILOG_SOURCES += $(WRAPPER).v
36-
VERILOG_SOURCES += ../../rtl/$(DUT).v
37-
VERILOG_SOURCES += ../../rtl/arbiter.v
38-
VERILOG_SOURCES += ../../rtl/priority_encoder.v
36+
VERILOG_SOURCES += ../../rtl/$(DUT).f
37+
38+
# handle file list files
39+
process_f_file = $(call process_f_files,$(addprefix $(dir $1),$(shell cat $1)))
40+
process_f_files = $(foreach f,$1,$(if $(filter %.f,$f),$(call process_f_file,$f),$f))
41+
uniq_base = $(if $1,$(call uniq_base,$(foreach f,$1,$(if $(filter-out $(notdir $(lastword $1)),$(notdir $f)),$f,))) $(lastword $1))
42+
VERILOG_SOURCES := $(call uniq_base,$(call process_f_files,$(VERILOG_SOURCES)))
3943

4044
# module parameters
4145
export PARAM_DATA_WIDTH := 8

tb/axis_arb_mux/test_axis_arb_mux.py

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,19 @@ def incrementing_payload(length):
316316
rtl_dir = os.path.abspath(os.path.join(tests_dir, '..', '..', 'rtl'))
317317

318318

319+
def process_f_files(files):
320+
lst = {}
321+
for f in files:
322+
if f[-2:].lower() == '.f':
323+
with open(f, 'r') as fp:
324+
l = fp.read().split()
325+
for f in process_f_files([os.path.join(os.path.dirname(f), x) for x in l]):
326+
lst[os.path.basename(f)] = f
327+
else:
328+
lst[os.path.basename(f)] = f
329+
return list(lst.values())
330+
331+
319332
@pytest.mark.parametrize("round_robin", [0, 1])
320333
@pytest.mark.parametrize("data_width", [8, 16, 32])
321334
@pytest.mark.parametrize("ports", [1, 4])
@@ -335,11 +348,11 @@ def test_axis_arb_mux(request, ports, data_width, round_robin):
335348

336349
verilog_sources = [
337350
wrapper_file,
338-
os.path.join(rtl_dir, f"{dut}.v"),
339-
os.path.join(rtl_dir, "arbiter.v"),
340-
os.path.join(rtl_dir, "priority_encoder.v"),
351+
os.path.join(rtl_dir, f"{dut}.f"),
341352
]
342353

354+
verilog_sources = process_f_files(verilog_sources)
355+
343356
parameters = {}
344357

345358
parameters['DATA_WIDTH'] = data_width

0 commit comments

Comments
 (0)