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