Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / verif / env / cmp / vera / Makefile
CommitLineData
86530b38
AT
1################################################################################
2## File: Makefile
3## Notes: runs with "gmake" only, not with "make"
4##
5## Description:
6## -----------
7## Top level Makefile for compiling Vera/NTB environment.
8##
9## $Id: Makefile,v 1.2 2007/05/03 18:12:41 drp Exp $
10################################################################################
11
12################################################################################
13# variable declarations
14################################################################################
15
16.SUFFIXES:
17
18THIS_DIR := ${PWD}
19
20# do not over-ride!
21SYS_NAME ?= cmp1
22VERA_LIBDIR ?= $(THIS_DIR)/lib
23# VERA_LIBDIR ?= ${MODEL_DIR}/${SYS_NAME}/rel-0.1/vera
24
25ECHO := echo
26COPY_CMD = cp -fp $< $@
27COMMON_DIR := ${DV_ROOT}/verif/env/common/vera
28
29# NOT for users to use, ONLY CONFIG FILE
30VERA_SYS_DEFS ?=
31
32# compile options that users can over-ride at will
33# VERA_OPTS
34# NTB_OPTS
35
36# for any user use and over-ride at will
37VERA_DEFS ?=
38
39
40# All paths to all vera files (include files and .vr files)
41# Do not change VPATH name or delete it!!!
42#
43# KEEP UP TO DATE!!!
44VPATH := \
45${PWD}/classes ${PWD}/include ${PWD}/interfaces ${PWD} \
46$(COMMON_DIR)/classes $(COMMON_DIR)/ccxDevices \
47$(COMMON_DIR)/include $(COMMON_DIR)/interfaces \
48${PWD}/../../../../design/sys/iop/cpu/rtl
49
50
51# All files that we want to *compile*.
52# Will be processed IN THIS ORDER. Base classes before the extended versions, etc.
53# (dependencies matter if letting vera make vrh files, but were not).
54# Will get fresh .vro files made from these files if the .vr, or any .vr[hi] has changed.
55#
56# KEEP UP TO DATE!!!
57#
58ORDERD_LIST := \
59std_display_class.vr \
60baseUtilsClass.vr \
61sparcBenchUtils.vr \
62baseParamsClass.vr \
63sparcParams.vr \
64utilsClass.vr \
65memArray.vr \
66basePktClass.vr \
67cpxPktClass.vr \
68pcxPktClass.vr \
69ccxDevBaseBFM.vr \
70ccxDevMemBFM.vr \
71ccxDevSpcBFM.vr \
72MCUStub_class.vr \
73ccx_tag_class.vr \
74asmEvent.vr \
75asmEventsToVera.vr \
76baseAsmToVeraIntf.vr \
77asmToVeraIntf.vr \
78ccxPktMon.vr \
79baseCCXtrans.vr \
80irritator.vr \
81cmp_top.vr
82
83
84
85# ORDERD_VRH := $(patsubst %.vr,$(VERA_LIBDIR)/%.vrh,$(ORDERD_LIST))
86# targets list. .vro's we want to make.
87ORDERD_VRO := $(patsubst %.vr,$(VERA_LIBDIR)/%.vro,$(ORDERD_LIST))
88VERA_DEP := $(foreach dir,$(VPATH),$(wildcard $(dir)/*.vr?))
89
90# vera command line defines
91EMPTY :=
92SPACE := $(EMPTY) $(EMPTY)
93VERA_INCDIR := $(subst $(SPACE),$(SPACE)-I,$(VPATH))
94VERA_INCDIR := -I$(VERA_INCDIR)
95VERA_OPTS := -max_error 5 -q -g
96
97# NTB command line defines
98NTB_INCDIR := $(subst $(SPACE),+,$(VPATH))
99NTB_INCDIR := -ntb_incdir $(NTB_INCDIR)
100NTB_OPTS ?= -ntb_opts compat+verbose+file_by_file
101NTB_DEFS := $(subst "-D","-ntb_define ",$(VERA_DEFS))
102NTB_DEFS += $(subst "-D","-ntb_define ",$(VERA_SYS_DEFS))
103NTB_DEFS += -ntb_define CMP_BENCH
104
105# commands
106VERA_VRH := vera -cmp $(VERA_INCDIR) -DCMP_BENCH $(VERA_DEFS) $(VERA_SYS_DEFS) $(VERA_OPTS) -h
107VERA_VRO := vera -cmp $(VERA_INCDIR) -DCMP_BENCH $(VERA_DEFS) $(VERA_SYS_DEFS) $(VERA_OPTS)
108VERA_NTB := vcs -ntb -ntb_define NTB -ntb_define CMP_BENCH -ntb_cmp -ntb_sname ${SYS_NAME}_test -ntb_filext .vr+.vrh+.vri+.vrl $(NTB_OPTS) $(NTB_INCDIR) $(ORDERD_LIST) -Mupdate
109
110
111################################################################################
112# all
113################################################################################
114
115all: vera
116
117vera: makedir copy_stuff copy_vera_stuff $(ORDERD_VRO)
118
119# target is libtb.so
120ntb_lib: makedir $(VERA_LIBDIR)/libtb.so
121
122makedir:
123 @if (test ! -d $(VERA_LIBDIR)) then mkdir $(VERA_LIBDIR) ; fi
124
125
126# Dependancy files are copied to $(VERA_LIBDIR) ONLY so that the need for an
127# incremental compile can be detected.
128#
129# For the actual Vera compile, this makefile knows how find dependency
130# files where they live and tells vera. Vera compiles with the
131# ORIGINAL vrh/vri file, not a copy if you use #include <file> syntax,
132# not #include "file", which is a good idea if you want Vera's -I to
133# find the right include file every time. See VPATH
134#
135# Be aware, you can get name collisions in $(VERA_LIBDIR) which could cause
136# problems. When using vera diags, you must copy any include files that the
137# diag needs into VERA_LIBDIR.
138copy_stuff:
139 @vera -V
140 @cp -fp include/*vcon* $(VERA_LIBDIR)
141 @rm -f $(VERA_LIBDIR)/../$(SYS_NAME)_top_shell.v
142
143copy_vera_stuff:
144 @cp -fp $(VERA_DEP) $(VERA_LIBDIR)
145
146clean:
147 rm -rf $(VERA_LIBDIR)/* ; rm -rf $(VERA_LIBDIR)/../$(SYS_NAME)_top_shell.v
148
149# cleanNTB:
150# @rm -f $(VERA_LIBDIR)/libtb.so $(VERA_LIBDIR)/*.vcon
151#
152# cleanVera:
153# @rm -f $(VERA_LIBDIR)/*.vro $(VERA_LIBDIR)/*.vcon $(VERA_LIBDIR)/*.vshell $(VERA_LIBDIR)/*.proj*
154
155test:
156 @echo "<<VERA_DEP>>" $(VERA_DEP)
157 @echo "<<PWD>>" ${PWD}
158 @echo "<<VERA_NTB>>" $(VERA_NTB)
159 @echo "<<VERA_INCDIR>>" $(VERA_INCDIR)
160 @echo "<<VERA_LIBDIR>>" $(VERA_LIBDIR)
161
162vrh:
163 @echo "To make a vrh for your class do --> " $(VERA_VRH) "path_to_class"
164
165
166################################################################################
167# generic rules
168################################################################################
169
170$(VERA_LIBDIR)/%.vro: %.vr $(VERA_DEP)
171 @echo ">>>> Vera: compiling $(notdir $<)"
172 @cd $(dir $<) ; $(VERA_VRO) $(notdir $<) $@
173
174$(VERA_LIBDIR)/libtb.so: $(VERA_DEP)
175 @echo ">>>> Vera: compiling NTB testbench libtb.so"
176 cd $(VERA_LIBDIR) ; $(VERA_NTB) ; cd $(THIS_DIR) ; mv -f *.vshell $(VERA_LIBDIR)/../$(SYS_NAME)_top_shell.v
177# DO NOT DELETE