SIM_ROOT := $(abspath ../../..)
RTL_ROOT := $(abspath $(SIM_ROOT)/../rtl)
include $(SIM_ROOT)/mk/rtl-sources.mk

TOPLEVEL := candidate_fifo
COCOTB_TEST_MODULES := tests.modules.candidate_fifo.test_candidate_fifo
VERILOG_SOURCES := $(RTL_ROOT)/core/candidate_fifo.sv

# Allow override from command line (e.g. make FIFO_DEPTH=10)
FIFO_DEPTH ?= 16
EXTRA_ARGS += +define+FIFO_DEPTH=$(FIFO_DEPTH)

# Parameter-specific build directory so depth variants never collide.
SIM_BUILD := sim_build/fifo_depth_$(FIFO_DEPTH)

include $(SIM_ROOT)/mk/cocotb-common.mk

# ── Depth-specific test targets ──────────────────────────────────────────
# Recompile with a non-default DEPTH and filter to the relevant test(s).
.PHONY: test-depth-10 test-depth-1

test-depth-10:
	$(MAKE) -B -f Makefile results.xml FIFO_DEPTH=10 \
	  COCOTB_TEST_FILTER=non_power_of_two

test-depth-1:
	$(MAKE) -B -f Makefile results.xml FIFO_DEPTH=1 \
	  COCOTB_TEST_FILTER=depth_one

# Also remove variant build directories on clean.
clean::
	rm -rf sim_build/fifo_depth_10 sim_build/fifo_depth_1
