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/] [xsim/] [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   : Xilinx Vivado 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
#*********************************************************************************************************
23
 
24
# Command line options
25
xvlog_opts="--relax -L xil_defaultlib"
26
 
27
 
28
# Script info
29
echo -e "clk_gen.sh - Script generated by export_simulation (Vivado v2017.4 (64-bit)-id)\n"
30
 
31
# Main steps
32
run()
33
{
34
  check_args $# $1
35
  setup $1 $2
36
  compile
37
  elaborate
38
  simulate
39
}
40
 
41
# RUN_STEP: <compile>
42
compile()
43
{
44
  # Compile design files
45
  xvlog $xvlog_opts -prj vlog.prj 2>&1 | tee compile.log
46
 
47
}
48
 
49
# RUN_STEP: <elaborate>
50
elaborate()
51
{
52
  xelab --relax --debug typical --mt auto -L xil_defaultlib -L unisims_ver -L unimacro_ver -L secureip -L xpm --snapshot clk_gen xil_defaultlib.clk_gen xil_defaultlib.glbl -log elaborate.log
53
}
54
 
55
# RUN_STEP: <simulate>
56
simulate()
57
{
58
  xsim clk_gen -key {Behavioral:sim_1:Functional:clk_gen} -tclbatch cmd.tcl -log simulate.log
59
}
60
 
61
# STEP: setup
62
setup()
63
{
64
  case $1 in
65
    "-lib_map_path" )
66
      if [[ ($2 == "") ]]; then
67
        echo -e "ERROR: Simulation library directory path not specified (type \"./clk_gen.sh -help\" for more information)\n"
68
        exit 1
69
      fi
70
     copy_setup_file $2
71
    ;;
72
    "-reset_run" )
73
      reset_run
74
      echo -e "INFO: Simulation run files deleted.\n"
75
      exit 0
76
    ;;
77
    "-noclean_files" )
78
      # do not remove previous data
79
    ;;
80
    * )
81
     copy_setup_file $2
82
  esac
83
 
84
  # Add any setup/initialization commands here:-
85
 
86
  # <user specific commands>
87
 
88
}
89
 
90
# Copy xsim.ini file
91
copy_setup_file()
92
{
93
  file="xsim.ini"
94
  lib_map_path="/opt/cad/xilinx/Vivado2017/Vivado/2017.4/data/xsim"
95
  if [[ ($1 != "") ]]; then
96
    lib_map_path="$1"
97
  fi
98
  if [[ ($lib_map_path != "") ]]; then
99
    ip_file="xsim_ip.ini"
100
    src_file="$lib_map_path/ip/$ip_file"
101
    if [[ -e $src_file ]]; then
102
      cp $src_file $file
103
    else
104
      src_file="$lib_map_path/$file"
105
      if [[ -e $src_file ]]; then
106
        cp $src_file .
107
      fi
108
    fi
109
 
110
    # Map local design libraries to xsim.ini
111
    map_local_libs
112
 
113
  fi
114
}
115
 
116
# Map local design libraries
117
map_local_libs()
118
{
119
  updated_mappings=()
120
  local_mappings=()
121
 
122
  # Local design libraries
123
  local_libs=(xil_defaultlib)
124
 
125
  if [[ 0 == ${#local_libs[@]} ]]; then
126
    return
127
  fi
128
 
129
  file="xsim.ini"
130
  file_backup="xsim.ini.bak"
131
 
132
  if [[ -e $file ]]; then
133
    rm -f $file_backup
134
    # Create a backup copy of the xsim.ini file
135
    cp $file $file_backup
136
    # Read libraries from backup file and search in local library collection
137
    while read -r line
138
    do
139
      IN=$line
140
      # Split mapping entry with '=' delimiter to fetch library name and mapping
141
      read lib_name mapping <<<$(IFS="="; echo $IN)
142
      # If local library found, then construct the local mapping and add to local mapping collection
143
      if `echo ${local_libs[@]} | grep -wq $lib_name` ; then
144
        line="$lib_name=xsim.dir/$lib_name"
145
        local_mappings+=("$lib_name")
146
      fi
147
      # Add to updated library mapping collection
148
      updated_mappings+=("$line")
149
    done < "$file_backup"
150
    # Append local libraries not found originally from xsim.ini
151
    for (( i=0; i<${#local_libs[*]}; i++ )); do
152
      lib_name="${local_libs[i]}"
153
      if `echo ${local_mappings[@]} | grep -wvq $lib_name` ; then
154
        line="$lib_name=xsim.dir/$lib_name"
155
        updated_mappings+=("$line")
156
      fi
157
    done
158
    # Write updated mappings in xsim.ini
159
    rm -f $file
160
    for (( i=0; i<${#updated_mappings[*]}; i++ )); do
161
      lib_name="${updated_mappings[i]}"
162
      echo $lib_name >> $file
163
    done
164
  else
165
    for (( i=0; i<${#local_libs[*]}; i++ )); do
166
      lib_name="${local_libs[i]}"
167
      mapping="$lib_name=xsim.dir/$lib_name"
168
      echo $mapping >> $file
169
    done
170
  fi
171
}
172
 
173
# Delete generated data from the previous run
174
reset_run()
175
{
176
  files_to_remove=(xelab.pb xsim.jou xvhdl.log xvlog.log compile.log elaborate.log simulate.log xelab.log xsim.log run.log xvhdl.pb xvlog.pb clk_gen.wdb xsim.dir)
177
  for (( i=0; i<${#files_to_remove[*]}; i++ )); do
178
    file="${files_to_remove[i]}"
179
    if [[ -e $file ]]; then
180
      rm -rf $file
181
    fi
182
  done
183
}
184
 
185
# Check command line arguments
186
check_args()
187
{
188
  if [[ ($1 == 1 ) && ($2 != "-lib_map_path" && $2 != "-noclean_files" && $2 != "-reset_run" && $2 != "-help" && $2 != "-h") ]]; then
189
    echo -e "ERROR: Unknown option specified '$2' (type \"./clk_gen.sh -help\" for more information)\n"
190
    exit 1
191
  fi
192
 
193
  if [[ ($2 == "-help" || $2 == "-h") ]]; then
194
    usage
195
  fi
196
}
197
 
198
# Script usage
199
usage()
200
{
201
  msg="Usage: clk_gen.sh [-help]\n\
202
Usage: clk_gen.sh [-lib_map_path]\n\
203
Usage: clk_gen.sh [-reset_run]\n\
204
Usage: clk_gen.sh [-noclean_files]\n\n\
205
[-help] -- Print help information for this script\n\n\
206
[-lib_map_path <path>] -- Compiled simulation library directory path. The simulation library is compiled\n\
207
using the compile_simlib tcl command. Please see 'compile_simlib -help' for more information.\n\n\
208
[-reset_run] -- Recreate simulator setup files and library mappings for a clean run. The generated files\n\
209
from the previous run will be removed. If you don't want to remove the simulator generated files, use the\n\
210
-noclean_files switch.\n\n\
211
[-noclean_files] -- Reset previous run, but do not remove simulator generated files from the previous run.\n\n"
212
  echo -e $msg
213
  exit 1
214
}
215
 
216
# Launch script
217
run $1 $2

powered by: WebSVN 2.1.0

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