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

powered by: WebSVN 2.1.0

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