Post

VCS Cheat Sheet

Synopsys VCS is a popular Verilog simulator. Here are some useful commands:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# Variables
TB_TOP ?= 
RTL_TOP ?= 
ASSERT_TOP ?= 
RTL_DIR ?= 
ASSERT_DIRS ?= 
INC_DIRS ?=

VLIBS ?=
DEFINES ?=


UVM_HOME ?= 

VERDI_HOME ?= 

SEARCH_PATHS = -y $(RTL_DIR) +libext++.v +libext+.sv
SEARCH_PATHS += -y $(ASSERT_DIRS) +libext+.vlib+.v+.vv+.sv

LD_LIBRARY_PATH := $(VERDI_HOME)/share/PLI/VCS/LINUX64

VCS = vcs
VCS_OPTS = -full64 -kdb -debug_acc+pp+f+dmptf -debug_region+cell+encrypt -sverilog -timescale=1ns/1ps
VCS_OPTS += -P $(LD_LIBRARY_PATH)/novas.tab $(LD_LIBRARY_PATH)/pli.a
VCS_OPTS += $(foreach dir, $(INC_DIRS), +incdir+$(dir))
VCS_OPTS += $(foreach def, $(DEFINES), +define+$(def))
VCS_OPTS += $(foreach lib, $(VLIBS), -v $(lib))

ifneq ($(UVM_HOME),)
# VCS_OPTS += -ntb_opts uvm-1.2
VCS_OPTS += +incdir+$(UVM_HOME)/src $(UVM_HOME)/src/uvm.sv
VCS_OPTS += $(UVM_HOME)/src/dpi/uvm_dpi.cc -CFLAGS -DVCS
endif

OUTPUT = simv
WAVES = +waves_on
FSDB_FILE = $(RTL_TOP_MODULE).fsdb

ASSERT_FILES = $(ASSERT_DIRS)/$(ASSERT_TOP)

# Default target
all: compile run

# Compile the design and testbench using search paths and file list
compile:
	$(VCS) $(VCS_OPTS) $(SEARCH_PATHS) $(TB_TOP) $(RTL_TOP) $(ASSERT_FILES) -o $(OUTPUT) -l compile.log

# Run the simulation
run:
	./$(OUTPUT) $(WAVES) +fsdb=$(FSDB_FILE) | tee sim.log

# Clean up the generated files
clean:
	rm -rf csrc $(OUTPUT)* ucli.key vc_hdrs.h DVEfiles/ *.vpd *.log verdiLog novas*

# verdi launch
verdi:
	verdi -simflow -simBin $(OUTPUT) -ssf $(FSDB_FILE) &


fsdb2saif:
	fsdb2saif $(FSDB_FILE) -o $(FSDB_FILE).saif


echo_var:
	@echo "RTL_TOP: $(RTL_TOP)"
	@echo "RTL_DIR: $(RTL_DIR)"
	@echo "SEARCH_PATHS: $(SEARCH_PATHS)"

.PHONY: all compile run clean verdi echo_var

This post is licensed under CC BY 4.0 by the author.