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.
|
|
|
|
#
|
2014-01-07 00:28:57 +00:00
|
|
|
# Copyright 2003-2014 by Wilson Snyder. This program is free software; you can
|
2006-08-26 11:35:28 +00:00
|
|
|
# redistribute it and/or modify it under the terms of either the GNU
|
2009-05-04 21:07:57 +00:00
|
|
|
# Lesser General Public License Version 3 or the Perl Artistic License
|
|
|
|
# Version 2.0.
|
2006-08-26 11:35:28 +00:00
|
|
|
#
|
|
|
|
#****************************************************************************/
|
|
|
|
|
2006-12-18 20:33:10 +00:00
|
|
|
default: test_default
|
|
|
|
|
2006-08-26 11:35:28 +00:00
|
|
|
# This must point to the root of the VERILATOR kit
|
|
|
|
VERILATOR_ROOT := $(shell pwd)/..
|
|
|
|
export VERILATOR_ROOT
|
|
|
|
|
2006-12-18 20:33:10 +00:00
|
|
|
# Pick up PERL and other variable settings
|
|
|
|
include $(VERILATOR_ROOT)/include/verilated.mk
|
2006-09-25 15:58:17 +00:00
|
|
|
|
2008-12-12 21:04:56 +00:00
|
|
|
DEBUG_ON = --debug --trace-dups
|
2006-08-26 11:35:28 +00:00
|
|
|
|
|
|
|
######################################################################
|
2010-02-09 01:51:43 +00:00
|
|
|
ifneq ($(SYSTEMPERL),)
|
2010-02-08 13:10:07 +00:00
|
|
|
test_default: precopy prep preproc compile run coverage
|
|
|
|
test_debug: precopy prep_dbg preproc compile_dbg run coverage
|
|
|
|
test_nopublic: precopy prep_dbg_np preproc compile_dbg run coverage
|
2010-02-09 01:51:43 +00:00
|
|
|
else
|
|
|
|
test_default: nosp
|
|
|
|
test_debug: nosp
|
|
|
|
test_nopublic: nosp
|
|
|
|
endif
|
2006-08-26 11:35:28 +00:00
|
|
|
|
2006-12-18 20:05:02 +00:00
|
|
|
V_FLAGS = -f $(VERILATOR_ROOT)/test_v/input.vc
|
2008-11-17 22:13:57 +00:00
|
|
|
|
|
|
|
# Note the --public --output-split-cfunc is here for testing only,
|
|
|
|
# Avoid using these settings in real application Makefiles!
|
2008-12-12 21:04:56 +00:00
|
|
|
VERILATOR_FLAGS = --public --output-split-cfuncs 1000 --output-split 1000 \
|
2008-11-17 22:13:57 +00:00
|
|
|
--sp --coverage --stats --trace $(V_FLAGS) top.v
|
2006-08-26 11:35:28 +00:00
|
|
|
|
2010-02-08 13:10:07 +00:00
|
|
|
precopy: obj_dir obj_dir/sc_main.cpp
|
|
|
|
obj_dir/sc_main.cpp: ../test_sc/sc_main.cpp
|
|
|
|
mkdir -p obj_dir
|
|
|
|
cp $^ $@
|
|
|
|
|
2006-08-26 11:35:28 +00:00
|
|
|
prep:
|
2006-09-25 15:58:17 +00:00
|
|
|
$(PERL) $(VERILATOR_ROOT)/bin/verilator $(VERILATOR_FLAGS)
|
2006-08-26 11:35:28 +00:00
|
|
|
prep_dbg:
|
2006-09-25 15:58:17 +00:00
|
|
|
$(PERL) $(VERILATOR_ROOT)/bin/verilator $(DEBUG_ON) $(VERILATOR_FLAGS)
|
2006-08-26 11:35:28 +00:00
|
|
|
prep_dbg_np:
|
2006-09-25 15:58:17 +00:00
|
|
|
$(PERL) $(VERILATOR_ROOT)/bin/verilator $(DEBUG_ON) $(VERILATOR_FLAGS) --nopublic
|
2006-08-26 11:35:28 +00:00
|
|
|
|
|
|
|
preproc:
|
|
|
|
cd obj_dir ; $(MAKE) -j 1 -f ../Makefile_obj preproc
|
|
|
|
|
|
|
|
compile:
|
2006-08-30 01:14:29 +00:00
|
|
|
cd obj_dir ; $(MAKE) -j 3 -f ../Makefile_obj
|
|
|
|
|
|
|
|
compile_dbg:
|
|
|
|
cd obj_dir ; $(MAKE) OPT=-g -j 3 -f ../Makefile_obj
|
2006-08-26 11:35:28 +00:00
|
|
|
|
2008-06-10 01:25:10 +00:00
|
|
|
run:
|
2006-08-26 11:35:28 +00:00
|
|
|
obj_dir/simx
|
|
|
|
|
|
|
|
coverage:
|
|
|
|
vcoverage $(V_FLAGS)
|
|
|
|
|
|
|
|
######################################################################
|
|
|
|
|
|
|
|
obj_dir:
|
|
|
|
mkdir $@
|
|
|
|
|
2010-02-09 01:51:43 +00:00
|
|
|
nosp:
|
|
|
|
@echo
|
2012-01-29 23:26:39 +00:00
|
|
|
@echo %Skip: SYSTEMPERL not in environment
|
2010-02-09 01:51:43 +00:00
|
|
|
@echo
|
|
|
|
|
2006-08-26 11:35:28 +00:00
|
|
|
######################################################################
|
|
|
|
|
|
|
|
maintainer-copy::
|
|
|
|
clean mostlyclean distclean maintainer-clean::
|
2008-01-15 14:29:08 +00:00
|
|
|
-rm -rf obj_dir *.log *.dmp *.vpd *.vcd core logs
|
2006-08-26 11:35:28 +00:00
|
|
|
|