1 |
2 |
vv_gulyaev |
#!/bin/bash -f
|
2 |
|
|
#*********************************************************************************************************
|
3 |
|
|
# Vivado (TM) v2017.4 (64-bit)
|
4 |
|
|
#
|
5 |
|
|
# Filename : clk_gen.sh
|
6 |
|
|
# Simulator : Aldec Active-HDL Simulator
|
7 |
|
|
# Description : Simulation script for compiling, elaborating and verifying the project source files.
|
8 |
|
|
# The script will automatically create the design libraries sub-directories in the run
|
9 |
|
|
# directory, add the library logical mappings in the simulator setup file, create default
|
10 |
|
|
# 'do/prj' file, execute compilation, elaboration and simulation steps.
|
11 |
|
|
#
|
12 |
|
|
# Generated by Vivado on Thu Jul 23 09:42:11 MSK 2020
|
13 |
|
|
# SW Build 2086221 on Fri Dec 15 20:54:30 MST 2017
|
14 |
|
|
#
|
15 |
|
|
# Copyright 1986-2017 Xilinx, Inc. All Rights Reserved.
|
16 |
|
|
#
|
17 |
|
|
# usage: clk_gen.sh [-help]
|
18 |
|
|
# usage: clk_gen.sh [-lib_map_path]
|
19 |
|
|
# usage: clk_gen.sh [-noclean_files]
|
20 |
|
|
# usage: clk_gen.sh [-reset_run]
|
21 |
|
|
#
|
22 |
|
|
# Prerequisite:- To compile and run simulation, you must compile the Xilinx simulation libraries using the
|
23 |
|
|
# 'compile_simlib' TCL command. For more information about this command, run 'compile_simlib -help' in the
|
24 |
|
|
# Vivado Tcl Shell. Once the libraries have been compiled successfully, specify the -lib_map_path switch
|
25 |
|
|
# that points to these libraries and rerun export_simulation. For more information about this switch please
|
26 |
|
|
# type 'export_simulation -help' in the Tcl shell.
|
27 |
|
|
#
|
28 |
|
|
# You can also point to the simulation libraries by either replacing the <SPECIFY_COMPILED_LIB_PATH> in this
|
29 |
|
|
# script with the compiled library directory path or specify this path with the '-lib_map_path' switch when
|
30 |
|
|
# executing this script. Please type 'clk_gen.sh -help' for more information.
|
31 |
|
|
#
|
32 |
|
|
# Additional references - 'Xilinx Vivado Design Suite User Guide:Logic simulation (UG900)'
|
33 |
|
|
#
|
34 |
|
|
#*********************************************************************************************************
|
35 |
|
|
|
36 |
|
|
|
37 |
|
|
# Script info
|
38 |
|
|
echo -e "clk_gen.sh - Script generated by export_simulation (Vivado v2017.4 (64-bit)-id)\n"
|
39 |
|
|
|
40 |
|
|
# Main steps
|
41 |
|
|
run()
|
42 |
|
|
{
|
43 |
|
|
check_args $# $1
|
44 |
|
|
setup $1 $2
|
45 |
|
|
compile
|
46 |
|
|
simulate
|
47 |
|
|
}
|
48 |
|
|
|
49 |
|
|
# RUN_STEP: <compile>
|
50 |
|
|
compile()
|
51 |
|
|
{
|
52 |
|
|
# Compile design files
|
53 |
|
|
source compile.do 2>&1 | tee -a compile.log
|
54 |
|
|
|
55 |
|
|
}
|
56 |
|
|
|
57 |
|
|
# RUN_STEP: <simulate>
|
58 |
|
|
simulate()
|
59 |
|
|
{
|
60 |
|
|
runvsimsa -l simulate.log -do "do {simulate.do}"
|
61 |
|
|
}
|
62 |
|
|
|
63 |
|
|
# STEP: setup
|
64 |
|
|
setup()
|
65 |
|
|
{
|
66 |
|
|
case $1 in
|
67 |
|
|
"-lib_map_path" )
|
68 |
|
|
if [[ ($2 == "") ]]; then
|
69 |
|
|
echo -e "ERROR: Simulation library directory path not specified (type \"./clk_gen.sh -help\" for more information)\n"
|
70 |
|
|
exit 1
|
71 |
|
|
fi
|
72 |
|
|
copy_setup_file $2
|
73 |
|
|
;;
|
74 |
|
|
"-reset_run" )
|
75 |
|
|
reset_run
|
76 |
|
|
echo -e "INFO: Simulation run files deleted.\n"
|
77 |
|
|
exit 0
|
78 |
|
|
;;
|
79 |
|
|
"-noclean_files" )
|
80 |
|
|
# do not remove previous data
|
81 |
|
|
;;
|
82 |
|
|
* )
|
83 |
|
|
copy_setup_file $2
|
84 |
|
|
esac
|
85 |
|
|
|
86 |
|
|
# Add any setup/initialization commands here:-
|
87 |
|
|
|
88 |
|
|
# <user specific commands>
|
89 |
|
|
|
90 |
|
|
}
|
91 |
|
|
|
92 |
|
|
# Copy library.cfg file
|
93 |
|
|
copy_setup_file()
|
94 |
|
|
{
|
95 |
|
|
file="library.cfg"
|
96 |
|
|
lib_map_path=""
|
97 |
|
|
if [[ ($1 != "") ]]; then
|
98 |
|
|
lib_map_path="$1"
|
99 |
|
|
fi
|
100 |
|
|
if [[ ($lib_map_path != "") ]]; then
|
101 |
|
|
src_file="$lib_map_path/$file"
|
102 |
|
|
cp $src_file .
|
103 |
|
|
fi
|
104 |
|
|
}
|
105 |
|
|
|
106 |
|
|
# Delete generated data from the previous run
|
107 |
|
|
reset_run()
|
108 |
|
|
{
|
109 |
|
|
files_to_remove=(compile.log elaboration.log simulate.log dataset.asdb work activehdl)
|
110 |
|
|
for (( i=0; i<${#files_to_remove[*]}; i++ )); do
|
111 |
|
|
file="${files_to_remove[i]}"
|
112 |
|
|
if [[ -e $file ]]; then
|
113 |
|
|
rm -rf $file
|
114 |
|
|
fi
|
115 |
|
|
done
|
116 |
|
|
}
|
117 |
|
|
|
118 |
|
|
# Check command line arguments
|
119 |
|
|
check_args()
|
120 |
|
|
{
|
121 |
|
|
if [[ ($1 == 1 ) && ($2 != "-lib_map_path" && $2 != "-noclean_files" && $2 != "-reset_run" && $2 != "-help" && $2 != "-h") ]]; then
|
122 |
|
|
echo -e "ERROR: Unknown option specified '$2' (type \"./clk_gen.sh -help\" for more information)\n"
|
123 |
|
|
exit 1
|
124 |
|
|
fi
|
125 |
|
|
|
126 |
|
|
if [[ ($2 == "-help" || $2 == "-h") ]]; then
|
127 |
|
|
usage
|
128 |
|
|
fi
|
129 |
|
|
}
|
130 |
|
|
|
131 |
|
|
# Script usage
|
132 |
|
|
usage()
|
133 |
|
|
{
|
134 |
|
|
msg="Usage: clk_gen.sh [-help]\n\
|
135 |
|
|
Usage: clk_gen.sh [-lib_map_path]\n\
|
136 |
|
|
Usage: clk_gen.sh [-reset_run]\n\
|
137 |
|
|
Usage: clk_gen.sh [-noclean_files]\n\n\
|
138 |
|
|
[-help] -- Print help information for this script\n\n\
|
139 |
|
|
[-lib_map_path <path>] -- Compiled simulation library directory path. The simulation library is compiled\n\
|
140 |
|
|
using the compile_simlib tcl command. Please see 'compile_simlib -help' for more information.\n\n\
|
141 |
|
|
[-reset_run] -- Recreate simulator setup files and library mappings for a clean run. The generated files\n\
|
142 |
|
|
from the previous run will be removed. If you don't want to remove the simulator generated files, use the\n\
|
143 |
|
|
-noclean_files switch.\n\n\
|
144 |
|
|
[-noclean_files] -- Reset previous run, but do not remove simulator generated files from the previous run.\n\n"
|
145 |
|
|
echo -e $msg
|
146 |
|
|
exit 1
|
147 |
|
|
}
|
148 |
|
|
|
149 |
|
|
# Launch script
|
150 |
|
|
run $1 $2
|