OpenCores
URL https://opencores.org/ocsvn/aes-128-ecb-encoder/aes-128-ecb-encoder/trunk

Subversion Repositories aes-128-ecb-encoder

[/] [aes-128-ecb-encoder/] [trunk/] [fpga/] [aes128_ecb_2017/] [aes128_ecb.ip_user_files/] [sim_scripts/] [clk_gen/] [vcs/] [clk_gen.sh] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 vv_gulyaev
#!/bin/bash -f
2
#*********************************************************************************************************
3
# Vivado (TM) v2017.4 (64-bit)
4
#
5
# Filename    : clk_gen.sh
6
# Simulator   : Synopsys Verilog Compiler 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
# Directory path for design sources and include directories (if any) wrt this path
37
ref_dir="."
38
 
39
# Override directory with 'export_sim_ref_dir' env path value if set in the shell
40
if [[ (! -z "$export_sim_ref_dir") && ($export_sim_ref_dir != "") ]]; then
41
  ref_dir="$export_sim_ref_dir"
42
fi
43
 
44
# Command line options
45
vlogan_opts="-full64"
46
vhdlan_opts="-full64"
47
vcs_elab_opts="-full64 -debug_pp -t ps -licqueue -l elaborate.log"
48
vcs_sim_opts="-ucli -licqueue -l simulate.log"
49
 
50
# Design libraries
51
design_libs=(xil_defaultlib xpm)
52
 
53
# Simulation root library directory
54
sim_lib_dir="vcs_lib"
55
 
56
# Script info
57
echo -e "clk_gen.sh - Script generated by export_simulation (Vivado v2017.4 (64-bit)-id)\n"
58
 
59
# Main steps
60
run()
61
{
62
  check_args $# $1
63
  setup $1 $2
64
  compile
65
  elaborate
66
  simulate
67
}
68
 
69
# RUN_STEP: <compile>
70
compile()
71
{
72
  # Compile design files
73
  vlogan -work xil_defaultlib $vlogan_opts -sverilog +incdir+"$ref_dir/../../../ipstatic" +incdir+"/opt/cad/xilinx/Vivado2017/Vivado/2017.4/data/xilinx_vip/include" \
74
    "/opt/cad/xilinx/Vivado2017/Vivado/2017.4/data/ip/xpm/xpm_cdc/hdl/xpm_cdc.sv" \
75
  2>&1 | tee -a vlogan.log
76
 
77
  vhdlan -work xpm $vhdlan_opts \
78
    "/opt/cad/xilinx/Vivado2017/Vivado/2017.4/data/ip/xpm/xpm_VCOMP.vhd" \
79
  2>&1 | tee -a vhdlan.log
80
 
81
  vlogan -work xil_defaultlib $vlogan_opts +v2k +incdir+"$ref_dir/../../../ipstatic" +incdir+"/opt/cad/xilinx/Vivado2017/Vivado/2017.4/data/xilinx_vip/include" \
82
    "$ref_dir/../../../../aes128_ecb.srcs/sources_1/ip/clk_gen/clk_gen_clk_wiz.v" \
83
    "$ref_dir/../../../../aes128_ecb.srcs/sources_1/ip/clk_gen/clk_gen.v" \
84
  2>&1 | tee -a vlogan.log
85
 
86
 
87
  vlogan -work xil_defaultlib $vlogan_opts +v2k \
88
    glbl.v \
89
  2>&1 | tee -a vlogan.log
90
 
91
}
92
 
93
# RUN_STEP: <elaborate>
94
elaborate()
95
{
96
  vcs $vcs_elab_opts xil_defaultlib.clk_gen xil_defaultlib.glbl -o clk_gen_simv
97
}
98
 
99
# RUN_STEP: <simulate>
100
simulate()
101
{
102
  ./clk_gen_simv $vcs_sim_opts -do simulate.do
103
}
104
 
105
# STEP: setup
106
setup()
107
{
108
  case $1 in
109
    "-lib_map_path" )
110
      if [[ ($2 == "") ]]; then
111
        echo -e "ERROR: Simulation library directory path not specified (type \"./clk_gen.sh -help\" for more information)\n"
112
        exit 1
113
      fi
114
      create_lib_mappings $2
115
    ;;
116
    "-reset_run" )
117
      reset_run
118
      echo -e "INFO: Simulation run files deleted.\n"
119
      exit 0
120
    ;;
121
    "-noclean_files" )
122
      # do not remove previous data
123
    ;;
124
    * )
125
      create_lib_mappings $2
126
  esac
127
 
128
  create_lib_dir
129
 
130
  # Add any setup/initialization commands here:-
131
 
132
  # <user specific commands>
133
 
134
}
135
 
136
# Define design library mappings
137
create_lib_mappings()
138
{
139
  file="synopsys_sim.setup"
140
  if [[ -e $file ]]; then
141
    if [[ ($1 == "") ]]; then
142
      return
143
    else
144
      rm -rf $file
145
    fi
146
  fi
147
 
148
  touch $file
149
 
150
  lib_map_path="<SPECIFY_COMPILED_LIB_PATH>"
151
  if [[ ($1 != "" && -e $1) ]]; then
152
    lib_map_path="$1"
153
  else
154
    echo -e "ERROR: Compiled simulation library directory path not specified or does not exist (type "./top.sh -help" for more information)\n"
155
  fi
156
 
157
  for (( i=0; i<${#design_libs[*]}; i++ )); do
158
    lib="${design_libs[i]}"
159
    mapping="$lib:$sim_lib_dir/$lib"
160
    echo $mapping >> $file
161
  done
162
 
163
  if [[ ($lib_map_path != "") ]]; then
164
    incl_ref="OTHERS=$lib_map_path/synopsys_sim.setup"
165
    echo $incl_ref >> $file
166
  fi
167
}
168
 
169
# Create design library directory paths
170
create_lib_dir()
171
{
172
  if [[ -e $sim_lib_dir ]]; then
173
    rm -rf $sim_lib_dir
174
  fi
175
 
176
  for (( i=0; i<${#design_libs[*]}; i++ )); do
177
    lib="${design_libs[i]}"
178
    lib_dir="$sim_lib_dir/$lib"
179
    if [[ ! -e $lib_dir ]]; then
180
      mkdir -p $lib_dir
181
    fi
182
  done
183
}
184
 
185
# Delete generated data from the previous run
186
reset_run()
187
{
188
  files_to_remove=(ucli.key clk_gen_simv vlogan.log vhdlan.log compile.log elaborate.log simulate.log .vlogansetup.env .vlogansetup.args .vcs_lib_lock scirocco_command.log 64 AN.DB csrc clk_gen_simv.daidir)
189
  for (( i=0; i<${#files_to_remove[*]}; i++ )); do
190
    file="${files_to_remove[i]}"
191
    if [[ -e $file ]]; then
192
      rm -rf $file
193
    fi
194
  done
195
 
196
  create_lib_dir
197
}
198
 
199
# Check command line arguments
200
check_args()
201
{
202
  if [[ ($1 == 1 ) && ($2 != "-lib_map_path" && $2 != "-noclean_files" && $2 != "-reset_run" && $2 != "-help" && $2 != "-h") ]]; then
203
    echo -e "ERROR: Unknown option specified '$2' (type \"./clk_gen.sh -help\" for more information)\n"
204
    exit 1
205
  fi
206
 
207
  if [[ ($2 == "-help" || $2 == "-h") ]]; then
208
    usage
209
  fi
210
}
211
 
212
# Script usage
213
usage()
214
{
215
  msg="Usage: clk_gen.sh [-help]\n\
216
Usage: clk_gen.sh [-lib_map_path]\n\
217
Usage: clk_gen.sh [-reset_run]\n\
218
Usage: clk_gen.sh [-noclean_files]\n\n\
219
[-help] -- Print help information for this script\n\n\
220
[-lib_map_path <path>] -- Compiled simulation library directory path. The simulation library is compiled\n\
221
using the compile_simlib tcl command. Please see 'compile_simlib -help' for more information.\n\n\
222
[-reset_run] -- Recreate simulator setup files and library mappings for a clean run. The generated files\n\
223
from the previous run will be removed. If you don't want to remove the simulator generated files, use the\n\
224
-noclean_files switch.\n\n\
225
[-noclean_files] -- Reset previous run, but do not remove simulator generated files from the previous run.\n\n"
226
  echo -e $msg
227
  exit 1
228
}
229
 
230
# Launch script
231
run $1 $2

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.