Files
verilator/test_regress/Makefile
T

137 lines
3.9 KiB
Makefile
Raw Normal View History

2006-08-26 11:35:28 +00: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 08:30:25 -05:00
# Copyright 2003-2025 by Wilson Snyder. This program is free software; you
# can redistribute it and/or modify it under the terms of either the GNU
# Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0.
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
2006-08-26 11:35:28 +00:00
#
#****************************************************************************/
default: test
2006-08-26 11:35:28 +00:00
# This must point to the root of the VERILATOR kit
VERILATOR_ROOT ?= $(shell pwd)/..
2006-08-26 11:35:28 +00:00
export VERILATOR_ROOT
# Pick up PERL and other variable settings
include $(VERILATOR_ROOT)/include/verilated.mk
2006-08-26 11:35:28 +00:00
######################################################################
2006-08-26 11:35:28 +00:00
ifneq ($(VCS_HOME),)
2020-01-24 20:10:44 -05:00
#Default to off, even with vcs; not all tests are ensured to be working
#PRODUCTS += --vcs
2006-08-26 11:35:28 +00:00
endif
ifneq ($(NC_ROOT),)
2020-01-24 20:10:44 -05:00
#Default to off, even with vcs; not all tests are ensured to be working
#PRODUCTS += --nc
2006-08-26 11:35:28 +00:00
endif
2025-03-21 17:43:07 -04:00
# Run tests in parallel.
ifeq ($(CFG_WITH_LONGTESTS),yes)
DRIVER_FLAGS ?= -j 0 --quiet --rerun
2006-08-26 11:35:28 +00:00
endif
2015-11-28 17:33:01 -05:00
.SUFFIXES:
2006-08-26 11:35:28 +00:00
######################################################################
SCENARIOS ?= --vlt --vltmt --dist
2020-03-07 21:38:44 -05:00
DRIVER_HASHSET ?=
2019-06-27 11:26:25 -04:00
.PHONY: test
2006-08-26 11:35:28 +00:00
test:
2024-09-08 13:00:03 -04:00
$(PYTHON3) driver.py $(DRIVER_FLAGS) $(SCENARIOS) $(DRIVER_HASHSET)
2006-08-26 11:35:28 +00:00
######################################################################
vcs:
2024-09-08 13:00:03 -04:00
$(PYTHON3) driver.py $(DRIVER_FLAGS) --vcs --stop
2006-08-26 11:35:28 +00:00
######################################################################
nc:
2024-09-08 13:00:03 -04:00
$(PYTHON3) driver.py $(DRIVER_FLAGS) --nc --stop
2006-08-26 11:35:28 +00:00
######################################################################
vlt:
2024-09-08 13:00:03 -04:00
$(PYTHON3) driver.py $(DRIVER_FLAGS) --vlt --stop
2006-08-26 11:35:28 +00:00
2018-07-22 20:54:28 -04:00
vltmt:
2024-09-08 13:00:03 -04:00
$(PYTHON3) driver.py $(DRIVER_FLAGS) --vltmt --stop
2018-07-22 20:54:28 -04:00
2006-08-26 11:35:28 +00:00
######################################################################
random:
2024-09-08 13:00:03 -04:00
$(PYTHON3) driver.py $(DRIVER_FLAGS) --optimize : --stop
2006-08-26 11:35:28 +00:00
random_forever:
while ( VERILATOR_NO_DEBUG=1 CPPFLAGS_ADD=-Wno-error $(MAKE) random ) ; do \
echo ; \
2006-08-26 11:35:28 +00:00
done
2017-10-26 19:14:05 -04:00
#######################################################################
# Informational - used by some tests
print-cxx-version:
$(CXX) --version
2006-08-26 11:35:28 +00:00
######################################################################
maintainer-copy::
clean mostlyclean distclean maintainer-clean::
2018-05-07 20:42:28 -04:00
-rm -rf obj_* simv* simx* csrc cov_work INCA_libs *.log *.key logs vc_hdrs.h
2025-03-30 11:02:05 -04:00
-rm -rf t/obj_* t/__pycache__
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)
TEST_SNAP_IGNORE := \
*.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 t_pgo_threads *line-coverage*.txt \
profile.vlt *linkdot.txt *linkcells.txt *.log.sort *.vpp \
*.sarif
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:
$(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
.PHONY: test-diff
test-diff:
$(MAKE) impl-test-diff | grep -v "Only in obj_" \
| $$(git config --default less --global --get core.pager)