-
Notifications
You must be signed in to change notification settings - Fork 34
/
system_vcs.mk
132 lines (108 loc) · 3.37 KB
/
system_vcs.mk
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
##############################################################################
## This file is part of 'SLAC Firmware Standard Library'.
## It is subject to the license terms in the LICENSE.txt file found in the
## top-level directory of this distribution and at:
## https://confluence.slac.stanford.edu/display/ppareg/LICENSE.html.
## No part of 'SLAC Firmware Standard Library', including this file,
## may be copied, modified, propagated, or distributed except according to
## the terms contained in the LICENSE.txt file.
##############################################################################
# Project Base Path
ifndef TOP_DIR
export TOP_DIR = $(realpath $(PWD)/../.. )
endif
# Project Name
ifndef PROJECT
export PROJECT = $(notdir $(TOP_DIR))
endif
# ROOT Directory Name
ifndef ROOTDIR
export ROOTDIR = $(firstword $(subst /, ,$(TOP_DIR)))
endif
# Release Directory Path
ifndef RELEASE
export RELEASE = $(realpath $(PWD))/release
endif
# Release IP name
ifndef IP_NAME
export IP_NAME = ASIC
endif
# Design libraries
ifndef DESIGN_LIBS
export DESIGN_LIBS = work
endif
# Simulation root library directory
ifndef SIM_LIB_DIR
export SIM_LIB_DIR = vcs_lib
endif
# Simulation root library directory
ifndef SIM_OUT_DIR
export SIM_OUT_DIR = vcs_output
endif
# VCS elaborate options
ifndef VCS_ELAB_OPTS
export VCS_ELAB_OPTS = -full64 -debug_acc+pp+dmptf +warn=none -kdb -lca -debug_pp -t ps -licqueue -l $(SIM_OUT_DIR)/elaborate.log
endif
# Path to VCS analyze script
ifndef ANALYZE
export ANALYZE = $(realpath $(PWD)/analyze.sh )
endif
# Files/Directories to remove during "clean"
ifndef CLEAN
export CLEAN = $(RELEASE) $(SIM_LIB_DIR) $(SIM_OUT_DIR) *.conf *.rc *.log synopsys_sim.setup csrc simv vcs_output simv.daidir DVEfiles verdiLog inter.vpd ucli.key
endif
all: elaborate
.PHONY : test
test:
@echo TOP_DIR: $(TOP_DIR)
@echo PROJECT: $(PROJECT)
@echo ROOTDIR: $(ROOTDIR)
@echo RELEASE: $(RELEASE)
@echo IP_NAME: $(IP_NAME)
@echo DESIGN_LIBS: $(DESIGN_LIBS)
@echo SIM_LIB_DIR: $(SIM_LIB_DIR)
@echo SIM_OUT_DIR: $(SIM_OUT_DIR)
@echo VCS_ELAB_OPTS: $(VCS_ELAB_OPTS)
@echo ANALYZE: $(ANALYZE)
@echo CLEAN: $(CLEAN)
@echo ELAB_TESTBED: $(ELAB_TESTBED)
# Remove all the compile output files/directories
clean:
rm -rf $(CLEAN)
# Create all the directories
dir: $(DESIGN_LIBS)
mkdir -p $(SIM_OUT_DIR)
# Create the DESIGN_LIBS directory
$(DESIGN_LIBS): $(SIM_LIB_DIR)
mkdir -p $(SIM_LIB_DIR)/$@
echo $@:$(SIM_LIB_DIR)/$@ >> synopsys_sim.setup
# Create the synopsys_sim.setup and SIM_LIB_DIR directory
$(SIM_LIB_DIR):
mkdir -p $@
rm -f synopsys_sim.setup
touch synopsys_sim.setup
echo "WORK > DEFAULT" >> synopsys_sim.setup
echo DEFAULT:$(SIM_LIB_DIR)/work >> synopsys_sim.setup
# VCS analyze
analyzes: dir
$(ANALYZE) 1
# VCS elaborate
elaborate: analyzes
vcs $(VCS_ELAB_OPTS) $(ELAB_TESTBED) -o simv
# VCS GUI
gui: elaborate
./simv -gui -l gui.log&
# VCS gen_vcs_ip
gen_vcs_ip: dir
# Generate the IP release
gen_vcs_ip -top_name $(IP_NAME) -ipdir $(RELEASE) -noencrypt -parse -e "$(ANALYZE) 0"
# Reorganize the released source code
mv $(RELEASE)/$(TOP_DIR) $(RELEASE)/$(PROJECT)
rm -rf $(RELEASE)/$(ROOTDIR)
# Update the metadata file's source code paths
sed -i 's+$(TOP_DIR)+/$(PROJECT)+g' $(RELEASE)/*file_list.*
sed -i 's+____ ./$(ROOTDIR)+____ ./$(PROJECT)+g' $(RELEASE)/GENIP_README
# VCS pre-compiled IP
pre_compiled_ip: dir
$(ANALYZE) 0
vcs -lca -genip $(IP_NAME) -dir=$(RELEASE)