2006-08-26 13:35:28 +02:00
|
|
|
#*****************************************************************************
|
|
|
|
|
#
|
|
|
|
|
# DESCRIPTION: Verilator Example: Makefile for inside source directory
|
|
|
|
|
#
|
|
|
|
|
# This calls the object directory makefile. That allows the objects to
|
|
|
|
|
# be placed in the "current directory" which simplifies the Makefile.
|
|
|
|
|
#
|
2025-01-01 14:30:25 +01:00
|
|
|
# Copyright 2003-2025 by Wilson Snyder. This program is free software; you
|
2020-03-21 16:24:24 +01:00
|
|
|
# can redistribute it and/or modify it under the terms of either the GNU
|
2009-05-04 23:07:57 +02:00
|
|
|
# Lesser General Public License Version 3 or the Perl Artistic License
|
|
|
|
|
# Version 2.0.
|
2020-03-21 16:24:24 +01:00
|
|
|
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
|
2006-08-26 13:35:28 +02:00
|
|
|
#
|
|
|
|
|
#****************************************************************************/
|
|
|
|
|
|
2006-12-18 21:33:10 +01:00
|
|
|
default: test
|
|
|
|
|
|
2006-08-26 13:35:28 +02:00
|
|
|
# This must point to the root of the VERILATOR kit
|
2024-03-01 01:08:28 +01:00
|
|
|
VERILATOR_ROOT ?= $(shell pwd)/..
|
2006-08-26 13:35:28 +02:00
|
|
|
export VERILATOR_ROOT
|
|
|
|
|
|
2006-12-18 21:33:10 +01:00
|
|
|
# Pick up PERL and other variable settings
|
|
|
|
|
include $(VERILATOR_ROOT)/include/verilated.mk
|
2006-08-26 13:35:28 +02:00
|
|
|
|
2006-12-18 21:33:10 +01:00
|
|
|
######################################################################
|
2006-08-26 13:35:28 +02:00
|
|
|
|
|
|
|
|
ifneq ($(VCS_HOME),)
|
2020-01-25 02:10:44 +01:00
|
|
|
#Default to off, even with vcs; not all tests are ensured to be working
|
2009-09-16 15:28:09 +02:00
|
|
|
#PRODUCTS += --vcs
|
2006-08-26 13:35:28 +02:00
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
ifneq ($(NC_ROOT),)
|
2020-01-25 02:10:44 +01:00
|
|
|
#Default to off, even with vcs; not all tests are ensured to be working
|
2009-09-16 15:28:09 +02:00
|
|
|
#PRODUCTS += --nc
|
2006-08-26 13:35:28 +02:00
|
|
|
endif
|
|
|
|
|
|
2025-03-21 22:43:07 +01:00
|
|
|
# Run tests in parallel.
|
2011-10-07 12:48:40 +02:00
|
|
|
ifeq ($(CFG_WITH_LONGTESTS),yes)
|
2025-06-24 23:58:55 +02:00
|
|
|
DRIVER_FLAGS ?= -j 0 --quiet --rerun
|
2006-08-26 13:35:28 +02:00
|
|
|
endif
|
|
|
|
|
|
2015-11-28 23:33:01 +01:00
|
|
|
.SUFFIXES:
|
|
|
|
|
|
2006-08-26 13:35:28 +02:00
|
|
|
######################################################################
|
|
|
|
|
|
2019-06-29 13:22:04 +02:00
|
|
|
SCENARIOS ?= --vlt --vltmt --dist
|
2020-03-08 03:38:44 +01:00
|
|
|
DRIVER_HASHSET ?=
|
2019-06-27 17:26:25 +02:00
|
|
|
|
2008-03-19 01:44:54 +01:00
|
|
|
.PHONY: test
|
2006-08-26 13:35:28 +02:00
|
|
|
test:
|
2024-09-08 19:00:03 +02:00
|
|
|
$(PYTHON3) driver.py $(DRIVER_FLAGS) $(SCENARIOS) $(DRIVER_HASHSET)
|
2006-08-26 13:35:28 +02:00
|
|
|
|
|
|
|
|
######################################################################
|
|
|
|
|
|
|
|
|
|
vcs:
|
2024-09-08 19:00:03 +02:00
|
|
|
$(PYTHON3) driver.py $(DRIVER_FLAGS) --vcs --stop
|
2006-08-26 13:35:28 +02:00
|
|
|
|
|
|
|
|
######################################################################
|
|
|
|
|
|
|
|
|
|
nc:
|
2024-09-08 19:00:03 +02:00
|
|
|
$(PYTHON3) driver.py $(DRIVER_FLAGS) --nc --stop
|
2006-08-26 13:35:28 +02:00
|
|
|
|
|
|
|
|
######################################################################
|
|
|
|
|
|
2010-01-06 14:54:56 +01:00
|
|
|
vlt:
|
2024-09-08 19:00:03 +02:00
|
|
|
$(PYTHON3) driver.py $(DRIVER_FLAGS) --vlt --stop
|
2006-08-26 13:35:28 +02:00
|
|
|
|
2018-07-23 02:54:28 +02:00
|
|
|
vltmt:
|
2024-09-08 19:00:03 +02:00
|
|
|
$(PYTHON3) driver.py $(DRIVER_FLAGS) --vltmt --stop
|
2018-07-23 02:54:28 +02:00
|
|
|
|
2006-08-26 13:35:28 +02:00
|
|
|
######################################################################
|
|
|
|
|
|
|
|
|
|
random:
|
2024-09-08 19:00:03 +02:00
|
|
|
$(PYTHON3) driver.py $(DRIVER_FLAGS) --optimize : --stop
|
2006-08-26 13:35:28 +02:00
|
|
|
|
|
|
|
|
random_forever:
|
|
|
|
|
while ( VERILATOR_NO_DEBUG=1 CPPFLAGS_ADD=-Wno-error $(MAKE) random ) ; do \
|
2025-06-24 23:58:55 +02:00
|
|
|
echo ; \
|
2006-08-26 13:35:28 +02:00
|
|
|
done
|
|
|
|
|
|
2017-10-27 01:14:05 +02:00
|
|
|
#######################################################################
|
|
|
|
|
# Informational - used by some tests
|
|
|
|
|
|
|
|
|
|
print-cxx-version:
|
|
|
|
|
$(CXX) --version
|
|
|
|
|
|
2006-08-26 13:35:28 +02:00
|
|
|
######################################################################
|
|
|
|
|
maintainer-copy::
|
|
|
|
|
clean mostlyclean distclean maintainer-clean::
|
2018-05-08 02:42:28 +02:00
|
|
|
-rm -rf obj_* simv* simx* csrc cov_work INCA_libs *.log *.key logs vc_hdrs.h
|
2025-03-30 17:02:05 +02:00
|
|
|
-rm -rf t/obj_* t/__pycache__
|
2023-10-28 16:58:29 +02:00
|
|
|
|
|
|
|
|
distclean::
|
|
|
|
|
-rm -rf snapshot
|
|
|
|
|
|
|
|
|
|
######################################################################
|
|
|
|
|
# Generated code snapshot and diff for tests
|
|
|
|
|
|
|
|
|
|
# Can be overridden for multiple snapshots
|
|
|
|
|
TEST_SNAP_DIR ?= snapshot
|
|
|
|
|
|
|
|
|
|
# Command to diff directories
|
|
|
|
|
TEST_DIFF_TOOL ?= $(if $(shell which icdiff), icdiff -N -r, diff -r)
|
|
|
|
|
|
2025-06-24 23:58:55 +02:00
|
|
|
TEST_SNAP_IGNORE := \
|
2025-10-09 11:01:17 +02:00
|
|
|
*.status *.log *.dat *.d *.o *.a *.so *stats*.txt *.html *.includecache \
|
|
|
|
|
*.out *.fst *.fst.vcd *.tree *.tree*.json *.dot *.csv *.xml *.hash \
|
|
|
|
|
*.cmake gmon.out.* CMakeFiles profile_exec.vcd *line-coverage*.txt \
|
|
|
|
|
profile.vlt *linkdot.txt *linkcells.txt *.log.sort *.vpp *.sarif \
|
2025-10-26 10:55:24 +01:00
|
|
|
t_flag_debugi9 t_flag_decorations_node t_flag_runtime_debug t_mod_empty \
|
|
|
|
|
t_pgo_threads t_pgo_threads_hier t_trace_ub_misaligned_address \
|
2023-10-28 16:58:29 +02:00
|
|
|
|
|
|
|
|
define TEST_SNAP_template
|
|
|
|
|
mkdir -p $(TEST_SNAP_DIR)
|
|
|
|
|
rm -rf $(TEST_SNAP_DIR)/obj_$(1)
|
|
|
|
|
cp -r obj_$(1) $(TEST_SNAP_DIR)/
|
|
|
|
|
find $(TEST_SNAP_DIR)/obj_$(1) \( $(TEST_SNAP_IGNORE:%=-name "%" -o) \
|
|
|
|
|
-type f -executable \) -prune | xargs rm -r
|
|
|
|
|
endef
|
|
|
|
|
|
|
|
|
|
.PHONY: test-snap
|
|
|
|
|
test-snap:
|
|
|
|
|
$(call TEST_SNAP_template,vlt)
|
|
|
|
|
$(call TEST_SNAP_template,vltmt)
|
|
|
|
|
$(call TEST_SNAP_template,dist)
|
|
|
|
|
|
|
|
|
|
.PHONY: impl-test-diff
|
|
|
|
|
impl-test-diff:
|
2025-08-05 09:02:18 +02:00
|
|
|
$(TEST_DIFF_TOOL) $(TEST_SNAP_DIR)/obj_vlt obj_vlt || true
|
|
|
|
|
$(TEST_DIFF_TOOL) $(TEST_SNAP_DIR)/obj_vltmt obj_vltmt || true
|
|
|
|
|
$(TEST_DIFF_TOOL) $(TEST_SNAP_DIR)/obj_dist obj_dist || true
|
2023-10-28 16:58:29 +02:00
|
|
|
|
|
|
|
|
.PHONY: test-diff
|
|
|
|
|
test-diff:
|
2025-06-26 03:10:46 +02:00
|
|
|
$(MAKE) impl-test-diff | grep -v "Only in obj_" \
|
|
|
|
|
| $$(git config --default less --global --get core.pager)
|