Commit | Line | Data |
---|---|---|
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 | ||
18 | THIS_DIR := ${PWD} | |
19 | ||
20 | # do not over-ride! | |
21 | SYS_NAME ?= cmp1 | |
22 | VERA_LIBDIR ?= $(THIS_DIR)/lib | |
23 | # VERA_LIBDIR ?= ${MODEL_DIR}/${SYS_NAME}/rel-0.1/vera | |
24 | ||
25 | ECHO := echo | |
26 | COPY_CMD = cp -fp $< $@ | |
27 | COMMON_DIR := ${DV_ROOT}/verif/env/common/vera | |
28 | ||
29 | # NOT for users to use, ONLY CONFIG FILE | |
30 | VERA_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 | |
37 | VERA_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!!! | |
44 | VPATH := \ | |
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 | # | |
58 | ORDERD_LIST := \ | |
59 | std_display_class.vr \ | |
60 | baseUtilsClass.vr \ | |
61 | sparcBenchUtils.vr \ | |
62 | baseParamsClass.vr \ | |
63 | sparcParams.vr \ | |
64 | utilsClass.vr \ | |
65 | memArray.vr \ | |
66 | basePktClass.vr \ | |
67 | cpxPktClass.vr \ | |
68 | pcxPktClass.vr \ | |
69 | ccxDevBaseBFM.vr \ | |
70 | ccxDevMemBFM.vr \ | |
71 | ccxDevSpcBFM.vr \ | |
72 | MCUStub_class.vr \ | |
73 | ccx_tag_class.vr \ | |
74 | asmEvent.vr \ | |
75 | asmEventsToVera.vr \ | |
76 | baseAsmToVeraIntf.vr \ | |
77 | asmToVeraIntf.vr \ | |
78 | ccxPktMon.vr \ | |
79 | baseCCXtrans.vr \ | |
80 | irritator.vr \ | |
81 | cmp_top.vr | |
82 | ||
83 | ||
84 | ||
85 | # ORDERD_VRH := $(patsubst %.vr,$(VERA_LIBDIR)/%.vrh,$(ORDERD_LIST)) | |
86 | # targets list. .vro's we want to make. | |
87 | ORDERD_VRO := $(patsubst %.vr,$(VERA_LIBDIR)/%.vro,$(ORDERD_LIST)) | |
88 | VERA_DEP := $(foreach dir,$(VPATH),$(wildcard $(dir)/*.vr?)) | |
89 | ||
90 | # vera command line defines | |
91 | EMPTY := | |
92 | SPACE := $(EMPTY) $(EMPTY) | |
93 | VERA_INCDIR := $(subst $(SPACE),$(SPACE)-I,$(VPATH)) | |
94 | VERA_INCDIR := -I$(VERA_INCDIR) | |
95 | VERA_OPTS := -max_error 5 -q -g | |
96 | ||
97 | # NTB command line defines | |
98 | NTB_INCDIR := $(subst $(SPACE),+,$(VPATH)) | |
99 | NTB_INCDIR := -ntb_incdir $(NTB_INCDIR) | |
100 | NTB_OPTS ?= -ntb_opts compat+verbose+file_by_file | |
101 | NTB_DEFS := $(subst "-D","-ntb_define ",$(VERA_DEFS)) | |
102 | NTB_DEFS += $(subst "-D","-ntb_define ",$(VERA_SYS_DEFS)) | |
103 | NTB_DEFS += -ntb_define CMP_BENCH | |
104 | ||
105 | # commands | |
106 | VERA_VRH := vera -cmp $(VERA_INCDIR) -DCMP_BENCH $(VERA_DEFS) $(VERA_SYS_DEFS) $(VERA_OPTS) -h | |
107 | VERA_VRO := vera -cmp $(VERA_INCDIR) -DCMP_BENCH $(VERA_DEFS) $(VERA_SYS_DEFS) $(VERA_OPTS) | |
108 | VERA_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 | ||
115 | all: vera | |
116 | ||
117 | vera: makedir copy_stuff copy_vera_stuff $(ORDERD_VRO) | |
118 | ||
119 | # target is libtb.so | |
120 | ntb_lib: makedir $(VERA_LIBDIR)/libtb.so | |
121 | ||
122 | makedir: | |
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. | |
138 | copy_stuff: | |
139 | @vera -V | |
140 | @cp -fp include/*vcon* $(VERA_LIBDIR) | |
141 | @rm -f $(VERA_LIBDIR)/../$(SYS_NAME)_top_shell.v | |
142 | ||
143 | copy_vera_stuff: | |
144 | @cp -fp $(VERA_DEP) $(VERA_LIBDIR) | |
145 | ||
146 | clean: | |
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 | ||
155 | test: | |
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 | ||
162 | vrh: | |
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 |