Skip to content

Commit

Permalink
Merge branch 'main' into pages
Browse files Browse the repository at this point in the history
  • Loading branch information
williaml33moore committed Aug 20, 2024
2 parents ac10857 + 9741326 commit c8f431b
Show file tree
Hide file tree
Showing 32 changed files with 2,005 additions and 3 deletions.
2 changes: 1 addition & 1 deletion bathtub_vip.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

# bathtub_vip.csh
# bathtub_vip.sh
# Set up Bathtub environment variable.
#
# Usage:
Expand Down
1 change: 1 addition & 0 deletions examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
| --- | --- |
| README.md | This file. |
| alu_division/ | |
| uvm_examples/ | Bathtub applied to examples provided with the UVM 1.x reference implementations. |
6 changes: 6 additions & 0 deletions examples/uvm_examples/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# uvm_examples
## Contents
| Name | Description |
| --- | --- |
| README.md | This file. |
| codec/ | Bathtub applied to the `integrated/codec` example from the UVM 1.x reference implementations. |
51 changes: 51 additions & 0 deletions examples/uvm_examples/codec/Makefile_inc.ius
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
##
## -------------------------------------------------------------
## Copyright 2010 Cadence.
## 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.
## -------------------------------------------------------------
##

x: all

#
# Include file for IUS Makefiles
#

UVM_VERBOSITY = UVM_LOW

#
# Note that "-access rw" have an adverse impact on performance
# and should not be used unless necessary.
#
# They are used here because they are required by some examples
# (backdoor register accesses).
#


TEST = /usr/bin/test
N_ERRS = 0
N_FATALS = 0

IUS = irun -access rw -uvmhome $(UVM_HOME) +UVM_VERBOSITY=$(UVM_VERBOSITY) -quiet -uvmnocdnsextra


CHECK = \
@$(TEST) \( `grep -c 'UVM_ERROR : $(N_ERRS)' xrun.log` -eq 1 \) -a \
\( `grep -c 'UVM_FATAL : $(N_FATALS)' xrun.log` -eq 1 \)

clean:
rm -rf *~ core csrc simv* vc_hdrs.h ucli.key *.log
180 changes: 180 additions & 0 deletions examples/uvm_examples/codec/Makefile_inc.questa
Original file line number Diff line number Diff line change
@@ -0,0 +1,180 @@
##
## -------------------------------------------------------------
## 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=rb \
-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


57 changes: 57 additions & 0 deletions examples/uvm_examples/codec/Makefile_inc.vcs
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
##
## -------------------------------------------------------------
## Copyright 2010-2011 Synopsys, Inc.
## 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.
## -------------------------------------------------------------
##

x: all

#
# Include file for VCS Makefiles
#

UVM_VERBOSITY = UVM_LOW

#
# Note that +acc and +vpi have an adverse impact on performance
# and should not be used unless necessary.
#
# They are used here because they are required by some examples
# (backdoor register accesses).
#


TEST = /usr/bin/test
N_ERRS = 0
N_FATALS = 0

VCS = vcs -sverilog -timescale=1ns/1ns \
+acc +vpi \
+incdir+$(UVM_HOME)/src $(UVM_HOME)/src/uvm.sv \
$(UVM_HOME)/src/dpi/uvm_dpi.cc -CFLAGS -DVCS

SIMV = ./simv +UVM_VERBOSITY=$(UVM_VERBOSITY) -l vcs.log

URG = urg -format text -dir simv.vdb

CHECK = \
@$(TEST) \( `grep -c 'UVM_ERROR : $(N_ERRS)' vcs.log` -eq 1 \) -a \
\( `grep -c 'UVM_FATAL : $(N_FATALS)' vcs.log` -eq 1 \)

clean:
rm -rf *~ core csrc simv* vc_hdrs.h ucli.key urg* *.log
52 changes: 52 additions & 0 deletions examples/uvm_examples/codec/Makefile_run.ius
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
##
## -------------------------------------------------------------
## Copyright 2010 Synopsys, Inc.
## Copyright 2010 Cadence Design, Inc.
## 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.
## -------------------------------------------------------------
##

UVM_HOME = ../../..

include ../../Makefile.ius


all run: test hw_reset bathtub_test

test:
$(IUS) -incdir ../apb -incdir vip tb_top.sv test.sv
$(CHECK)

hw_reset:
$(IUS) -incdir ../apb -incdir vip tb_top.sv test.sv \
+UVM_TESTNAME=hw_reset_test
$(CHECK)

bathtub_vip.f:
$(IUS) $(BATHTUB_VIP_DIR)/vip-spec.sv $(BATHTUB_VIP_DIR)/vip_setup.sv

bathtub_test: bathtub_vip.f
$(IUS) -f bathtub_vip.f -incdir ../apb -incdir vip tb_top.sv test.sv \
+UVM_TESTNAME=bathtub_test +bathtub_features=codec.feature
$(CHECK)

# Run the original test on the new testbench with Bathtub, without using Bathtub.
# Check that we didn't break the original test.
test_with_bathtub: bathtub_vip.f
$(IUS) -f bathtub_vip.f -incdir ../apb -incdir vip tb_top.sv test.sv \
+UVM_TESTNAME=test
$(CHECK)
Loading

0 comments on commit c8f431b

Please sign in to comment.