Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / verif / env / common / pli / vera / loadpli / Makefile.nc
CommitLineData
86530b38
AT
1include $(INSTALL_DIR)/tools/inca/files/Makefile.nc.defines
2# Uncomment the following line to use the GCC compiler
3USE_COMPILER = gcc
4# Uncomment the following line to use the C++ compiler to link shared libs
5USE_LINKER = gcc
6include $(INSTALL_DIR)/tools/inca/files/Makefile.nc.$(ARCH)
7
8################# PUT ALL USER MACROS AFTER THIS LINE #################
9
10#
11# Makefile.nc
12#
13# This makefile can be used as a template makefile for statically or
14# dynamically linking PLI/VPI, LMSI, or SWIFT code into the NC-Verilog tools
15# For C++ Rules and Macros refer to 'C++ HOWTO' in this file.
16#
17# All of the defines in this Makefile also exist in
18# $(INSTALL_DIR)/tools/inca/files/Makefile.nc.defines
19# By modifying them here, you will override the default values there.
20#
21# Any targets that you do not need can be safely deleted from this file.
22#
23
24#
25# The TARGETDIR macro should be set to the directory where the resulting
26# executables should be placed. This defaults to the current directory.
27#
28TARGETDIR=.
29
30# Shared libraries
31VPILIB = $(TARGETDIR)/libvpi.$(SHARED_LIB_POSTFIX)
32# PLILIB = $(TARGETDIR)/libpli.$(SHARED_LIB_POSTFIX)
33PLILIB = $(TARGETDIR)/libverapli.$(SHARED_LIB_POSTFIX)
34VHPILIB = $(TARGETDIR)/libvhpi.$(SHARED_LIB_POSTFIX)
35CFCLIB = $(TARGETDIR)/libcfc.$(SHARED_LIB_POSTFIX)
36FMILIB = $(TARGETDIR)/libfmi.$(SHARED_LIB_POSTFIX)
37DPILIB = $(TARGETDIR)/libdpi.$(SHARED_LIB_POSTFIX)
38
39#
40# Set this to the set of targets that you want executed. For example, if
41# you want to create a libpli.so file, then set it to:
42#
43FIRST_TARGET = $(PLILIB)
44
45#
46# Specify any defines that you want set by uncommenting the USR_DEFINES
47# Macro below. All defines should have a '-D' prefix to work properly
48# e.g. INCA, INCA_test, MYTEST and ETC are defined below.
49#
50# USR_DEFINES = -DINCA -DINCA_test -DMYTEST -DETC
51
52#
53# The VPI_USER_C macro should be set to the vpi_user.c file containing any
54# user defined 'C' routines for use with VPI (PLI 2.0).
55# vpi_user.c can be copied from $(INSTALL_DIR)/tools/inca/src/vpi_user.c
56#
57VPI_USER_C = ./vpi_user.c
58# VPI_USER_O = $(TARGETDIR)/vpi_user.$(OBJ_POSTFIX)
59VPI_USER_O =
60
61#
62# The VPI_OBJECTS_SAFE macro should be set to the object files which you do
63# not want deleted in "clean" target.
64#
65VPI_OBJECTS_SAFE =
66
67#
68# Add any VPI objects which need to be compiled, and can be deleted using the
69# "clean" target here:
70#
71VPI_OBJECTS =
72
73#
74# Add any library linking options needed to resolve external references for
75# the VPILIB shared library
76#
77VPI_EXTERN_LIBS =
78
79#
80# The VERIUSER_C macro should be set to the veriuser.c file containing any
81# user defined 'C' routines for use with PLI 1.0.
82# veriuser.c can be copied from $(INSTALL_DIR)/tools/inca/src/veriuser.c
83#
84VERIUSER_C = ./veriuser.c
85# VERIUSER_O = $(DV_ROOT)/verif/env/common/pli/vera/loadpli/veriuser.$(OBJ_POSTFIX)
86VERIUSER_O =
87
88#
89# The PLI_OBJECTS_SAFE macro should be set to the object files which you do
90# not want deleted in "clean" target.
91#
92PLI_OBJECTS_SAFE = $(DV_ROOT)/verif/env/common/pli/vera/loadpli/vmc.o \
93 $(DV_ROOT)/verif/env/common/pli/vera/loadpli/veriuser.o \
94 $(VERA_HOME)/lib/vlog/libSysSciTask.a \
95 $(VERA_HOME)/lib/vlog/libvlog_br.a \
96 $(VERA_HOME)/lib/libVERA.a \
97 $(VERA_HOME)/lib/vera_user.o
98
99#
100# Add any PLI objects which need to be compiled, and can be deleted using the
101# "clean" target here:
102#
103PLI_OBJECTS =
104
105#
106# Add any library linking options needed to resolve external references for
107# the PLILIB shared library
108#
109PLI_EXTERN_LIBS =
110
111#
112# The VHPI_OBJECTS_SAFE macro should be set to the object files which you do
113# not want deleted in "clean" target.
114#
115VHPI_OBJECTS_SAFE =
116
117#
118# Add any VHPI objects which need to be compiled, and can be deleted using the
119# "clean" target here:
120#
121VHPI_OBJECTS =
122
123#
124# Add any library linking options needed to resolve external references for
125# the VHPILIB shared library
126#
127VHPI_EXTERN_LIBS =
128
129#
130# The CFC_OBJECTS_SAFE macro should be set to the object files which you do
131# not want deleted in "clean" target.
132#
133CFC_OBJECTS_SAFE =
134
135#
136# Add any CFC objects which need to be compiled, and can be deleted using the
137# "clean" target here:
138#
139CFC_OBJECTS =
140
141#
142# Add any library linking options needed to resolve external references for
143# the CFCLIB shared library
144#
145CFC_EXTERN_LIBS =
146
147#
148# The FMI_OBJECTS_SAFE macro should be set to the object files which you do
149# not want deleted in "clean" target.
150#
151FMI_OBJECTS_SAFE =
152
153#
154# Add any FMI objects which need to be compiled, and can be deleted using the
155# "clean" target here:
156#
157FMI_OBJECTS =
158
159#
160# Add any library linking options needed to resolve external references for
161# the FMILIB shared library
162#
163FMI_EXTERN_LIBS =
164
165#
166# The DPI_OBJECTS_SAFE macro should be set to the object files which you do
167# not want deleted in "clean" target.
168#
169DPI_OBJECTS_SAFE =
170
171#
172# Add any DPI objects which need to be compiled, and can be deleted using the
173# "clean" target here:
174#
175DPI_OBJECTS =
176
177#
178# Add any library linking options needed to resolve external references for
179# the DPILIB shared library
180#
181DPI_EXTERN_LIBS =
182
183DPI_USER_C = ./_sv_export.c
184DPI_USER_O = $(TARGETDIR)/_sv_export.$(OBJ_POSTFIX)
185
186#
187# LMC_HOME is set to the swift installation
188# Shared library path environment variable should be set to include the
189# path of the swift shared library.
190#
191LMC_HOME =
192
193#
194# The SFI_ROOT macro should be set to the lmsi installation
195#
196SFI_ROOT =
197
198#
199# The NCELAB macro should be set to the name of the elaborator which should
200# be generated by the static link.
201#
202NCELAB = $(TARGETDIR)/ncelab
203
204#
205# The NCSIM macro should be set to the name of the simulator which should
206# be generated by the static link.
207#
208NCSIM = $(TARGETDIR)/ncsim
209
210#
211# The TARGETS macro should be set to pli/vpi objects/executables with statically
212# linked PLI/VPI objects
213#
214PLI_O_TARGETS = $(VERIUSER_O) $(PLI_OBJECTS) $(PLI_OBJECTS_SAFE)
215VPI_O_TARGETS = $(VPI_USER_O) $(VPI_OBJECTS) $(VPI_OBJECTS_SAFE)
216VHPI_O_TARGETS = $(VHPI_OBJECTS) $(VHPI_OBJECTS_SAFE)
217DPI_O_TARGETS = $(DPI_OBJECTS) $(DPI_OBJECTS_SAFE)
218
219# To add PLI 1.0 applications when linking statically, add $(PLI_O_TARGETS) to
220# the O_TARGETS list below.
221#
222# To add VPI applications when linking statically, add $(VPI_O_TARGETS) to
223# the O_TARGETS list below.
224#
225# To add VHPI applications when linking statically, add $(VHPI_O_TARGETS) to
226# the O_TARGETS list below.
227#
228#O_TARGETS = $(PLI_O_TARGETS) $(VPI_O_TARGETS) $(VHPI_O_TARGETS)
229
230O_TARGETS =
231
232# The CFC_O_TARGETS and FMI_O_TARGETS should be set to CFC/FMI objects/
233# executables with statically linked CFC/FMI objects respectively
234CFC_O_TARGETS = $(CFC_OBJECTS) $(CFC_OBJECTS_SAFE)
235FMI_O_TARGETS = $(FMI_OBJECTS) $(FMI_OBJECTS_SAFE)
236
237# To add CFC applications to ncsim when linking statically, add $(CFC_O_TARGETS)
238# to the NCSIM_O_TARGETS list below.
239#
240# To add FMI applications to ncsim when linking statically, add $(FMI_O_TARGETS)
241# to the NCSIM_O_TARGETS list below.
242
243NCSIM_O_TARGETS = \
244 $(CFC_OBJECTS) $(CFC_OBJECTS_SAFE) \
245 $(FMI_OBJECTS) $(FMI_OBJECTS_SAFE)
246
247TARGETS = $(NCELAB) $(NCSIM)
248
249# DYNAMIC LINKING
250
251# Begin targets for PLI/VPI dynamic linking
252# The dynamic target builds the NC executables for debugging with shared
253# libraries
254# The shared_libs target builds the VPI and PLI shared libraries.
255#
256
257DYN_TARGETS = $(NCELAB)_dynamic $(NCSIM)_dynamic
258
259#
260#
261#
262# C++ HOWTO
263#
264# History:
265# The Elaborator as well as the Simulator routines are written in C.
266# The supporting library routines are written in C too. However, there
267# are applications which have been written using C++. There are
268# some 3rd party vendors that have written their IP in C++ too. We
269# therefore need a way to integrate all of this into a single Elaborator
270# executable and a single Simulator executable.
271#
272# In order for C++ objects to be properly integrated with the ncelab and
273# ncsim objects (i.e. ncelab.$(OBJ_POSTFIX) and ncsim.$(OBJ_POSTFIX)) it
274# is required that the main() routine be compiled using C++. That was
275# the motivation for the following set of Rules and Macros.
276#
277# Gotchas:
278# There are some quirks that you should be aware of before integrating
279# the C++ routines.
280#
281# o You should ensure that the same C++ compiler is used to compile all
282# of the code, including the IP's provided by 3rd party vendor's.
283# It is not possible for a user.cc, compiled using CC and vendor.cc,
284# compiled using gcc, to be integrated together, due to name-mangling and
285# various other issues.
286#
287# o The routines and variables in your C++ code that are used in veriuser.c
288# and vpi_user.c, should be explicitly declared in your C++ code as an
289# 'extern "C"'. This tells the C++ compiler not to mangle the names that
290# will eventually be used in routines compiled using a C compiler. e.g.
291# File: veriuser.c
292# ----------------
293# extern int hello_world(int);
294# s_tfcell veriusertfs[TF_MAXARRAY] = {
295# {usertask, 0, 0, 0, (int (*)())hello_world, 0, "$hello_world", 1 },
296# 0
297# };
298#
299# File: user_code.cc
300# -------------------
301# extern "C" int hello_world(int);
302# extern "C" void io_printf(char*);
303# int hello_world(int foo) { io_printf("Hello World\n"); return(foo);}
304#
305# o If you intend on including some of the VPI/PLI include files, you
306# should ensure that proper defines are put in place. e.g.
307# File: user_code.cc
308# -------------------
309# #define PROTO_PARAMS(params) params
310# #define PLI_EXTERN extern "C"
311# #include <stdio.h>
312# #include "vpi_user.h"
313# #undef PROTO_PARAMS
314# #undef PLI_EXTERN
315# /* Other routines and declarations. */
316#
317# o '.cc' is the assumed extension of all the C++ files used here. You
318# should make appropriate corrections if you are using different
319# extensions, via the CC_EXTENSION macro.
320#
321# o You should copy over main.cc and veriuser.c and/or vpi_user.c from
322# $(INSTALL_DIR)/tools/inca/src and make the appropriate changes before
323# using them.
324#
325# o You should remember to modify the following macros as appropriate.
326# CCC -> To specify the C++ compiler (Default: CC)
327# CCFLAGS -> Flags for the C++ compiler (Default: CFLAGS)
328# CC_EXTENSION -> Extensions for C++ files (Default: .cc)
329# TARGETDIR -> Directory where targets will be put (Default: .)
330# VPI_USER_C -> Your vpi_user.c file if any (Default: ./vpi_user.c)
331# VERIUSER_C -> Your veriuser.c file if any (Default: ./veriuser.c)
332# CCC_MAIN_CC -> main.cc copied from $(INSTALL_DIR)/tools/inca/src
333# CCC_OBJECTS -> Objects created from your C++ files
334#
335
336
337#
338# The CCC_MAIN_CC macro should be set to the main.cc file containing the
339# main() routine. This topmost routine should be compiled using a C++
340# compiler. It can be copied from $(INSTALL_DIR)/tools/inca/src/main.cc.
341# If copied to another location make appropriate changes to following macros.
342#
343CCC_MAIN_CC = $(INSTALL_DIR)/tools/inca/src/main.$(CC_EXTENSION)
344CCC_MAIN_O = main.$(OBJ_POSTFIX)
345
346
347#
348# The CCC_OBJECTS macro should be populated with the names of your
349# C++ files' objects. For example:
350# If your sources are foo1.cc and foo2.cc then
351# CCC_OBJECTS = foo1.$(OBJ_POSTFIX) foo2.$(OBJ_POSTFIX)
352# These objects will be deleted by the 'clean' target.
353#
354CCC_OBJECTS =
355
356
357#
358# The CCC_OBJECTS_SAFE macro should be populated with the names of your
359# C++ files' objects. For example:
360# If your sources are foo1.cc and foo2.cc then
361# CCC_OBJECTS_SAFE = foo1.$(OBJ_POSTFIX) foo2.$(OBJ_POSTFIX)
362# These objects will *NOT* be deleted by the 'clean' target.
363#
364CCC_OBJECTS_SAFE =
365
366
367#
368# The OCCC_TARGETS macro should be set to pli/vpi objects
369# OCCC_TARGETS = $(VPI_USER_O) $(VERIUSER_O) $(CCC_OBJECTS) $(CCC_OBJECTS_SAFE)
370#
371OCCC_TARGETS =
372
373CCC_TARGETS = $(NCELAB)C $(NCSIM)C
374
375################# PUT ALL USER MACROS BEFORE THIS LINE #################
376include $(INSTALL_DIR)/tools/inca/files/Makefile.nc.targets