blob: 3296de585259006aceba785fd8f53de63db1eb18 [file] [log] [blame]
##
## -------------------------------------------------------------
## Copyright 2010-2011 Mentor Graphics Corporation
## All Rights Reserved Worldwide
##
## Licensed under the Apache License, Version 2.0 (the
## "License"); you may not use this file except in
## compliance with the License. You may obtain a copy of
## the License at
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in
## writing, software distributed under the License is
## distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
## CONDITIONS OF ANY KIND, either express or implied. See
## the License for the specific language governing
## permissions and limitations under the License.
## -------------------------------------------------------------
##
USES_DPI = 1
ifdef UVM_NO_DPI
USES_DPI=0
endif
#---------------------------------------------------------------
# Define Variables
#---------------------------------------------------------------
UVM_HOME ?= ..
LIBDIR = $(UVM_HOME)/lib
#GCC = $(MTI_HOME)/gcc-4.1.2-linux/bin/g++
GCC = gcc
TEST = /usr/bin/test
BITS ?= 32
LIBNAME = uvm_dpi
DPI_SRC = $(UVM_HOME)/src/dpi/uvm_dpi.cc
GCCCMD = $(GCC) \
-m$(BITS) \
-fPIC \
-DQUESTA \
-g \
-W \
-shared \
-x c \
-I$(MTI_HOME)/include \
$(DPI_SRC) \
-o $(LIBDIR)/$(LIBNAME).so
GCC_WINCMD = \
$(WIN_GCC) \
-g \
-DQUESTA \
-W \
-shared \
-Bsymbolic \
-x c \
-I$(MTI_HOME)/include \
$(DPI_SRC) \
-o $(LIBDIR)/$(LIBNAME).dll \
$(MTI_HOME)/win32/mtipli.dll -lregex
WIN_GCC = $(MTI_HOME)/gcc-4.2.1-mingw32vc9/bin/g++.exe
VLIB = vlib work
VLOG = vlog \
-timescale "1ns/1ns" \
$(DPILIB_VLOG_OPT) \
$(VLOG_OPT) \
$(OPT_C) \
-mfcu \
-suppress 2181 \
+acc=rmb \
-writetoplevels questa.tops \
+incdir+$(UVM_HOME)/src \
$(UVM_HOME)/src/uvm.sv
VSIM = vsim \
$(DPILIB_VSIM_OPT) \
$(VSIM_OPT) \
$(OPT_R) \
-c \
-do "run -all; q" \
-l questa.log \
-f questa.tops
N_ERRS = 0
N_FATALS = 0
CHECK = \
@$(TEST) \( `grep -c 'UVM_ERROR : $(N_ERRS)' questa.log` -eq 1 \) -a \
\( `grep -c 'UVM_FATAL : $(N_FATALS)' questa.log` -eq 1 \)
#---------------------------------------------------------------
# If USES_DPI is set, enables compilation and loading of DPI
# libraries. Enabling DPI adds +acc on command line, which
# may adversely affect simulator performance.
#---------------------------------------------------------------
ifeq ($(USES_DPI),1)
DPILIB_VLOG_OPT =
DPILIB_VSIM_OPT = -sv_lib $(LIBDIR)/uvm_dpi
DPILIB_TARGET = dpi_lib$(BITS)
else
DPILIB_VLOG_OPT = +define+UVM_NO_DPI
DPILIB_VSIM_OPT =
DPILIB_TARGET =
endif
#---------------------------------------------------------------
# Define Targets
#
# vlog and vsim targets defined in individual examples
#---------------------------------------------------------------
help:
@echo "Usage: make -f Makefile.questa [target(s)]"
@echo ""
@echo "Typical: make -f Makefile.questa all"
@echo ""
@echo "where target is any of"
@echo ""
@echo " dpi_lib - compile DPI lib (use BITS=XX, def=32)"
@echo " dpi_lib32 - compile DPI lib for 32-bit Linux (BITS=32)"
@echo " dpi_lib64 - compile DPI lib for 64-bit Linux (BITS=64)"
@echo " dpi_libWin - compile DPI lib for Windows"
@echo ""
@echo " clean - removes all derived files"
@echo " vlib - creates work library"
@echo " prepare - invokes clean, vlib, and dpi_lib targets"
@echo ""
@echo "When this makefile is included by a Makefile from an example"
@echo "sub-directory, additional targets should be available:"
@echo ""
@echo " all - invokes targets prepare, vlog, and vsim"
@echo " vlog - invokes the vlog compiler"
@echo " vsim - invokes the vsim simulator"
@echo ""
@echo "Variables: specify any of the following on the make command line"
@echo ""
@echo " UVM_HOME - root directory of the UVM library (default:..)"
@echo " UVM_VERBOSITY - verbosity level for vsim (default:UVM_MEDIUM)"
@echo " BITS - the bus architecture: 32 or 64 (default:32)"
@echo " LIBNAME - the root name of the dpi library (default:uvm_dpi)"
@echo " LIBDIR - the location to put the dpi lib (default:UVM_HOME/lib)"
@echo ""
prepare: clean vlib $(DPILIB_TARGET)
dpi_lib:
mkdir -p $(LIBDIR)
$(GCCCMD)
dpi_libWin:
mkdir -p $(LIBDIR)
$(GCC_WINCMD)
dpi_lib32:
make -f Makefile.questa BITS=32 dpi_lib
dpi_lib64:
make -f Makefile.questa LIBNAME=uvm_dpi BITS=64 dpi_lib
vlib: $(DPILIB_TARGET)
vlib work
clean:
rm -rf *~ work vsim.wlf* *.log questa.tops transcript *.vstf