MeasDataFifo.sh 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. #!/bin/bash -f
  2. #*********************************************************************************************************
  3. # Vivado (TM) v2020.2 (64-bit)
  4. #
  5. # Filename : MeasDataFifo.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 Wed May 03 12:25:18 +0700 2023
  13. # SW Build 3064766 on Wed Nov 18 09:12:45 MST 2020
  14. #
  15. # Copyright 1986-2020 Xilinx, Inc. All Rights Reserved.
  16. #
  17. # usage: MeasDataFifo.sh [-help]
  18. # usage: MeasDataFifo.sh [-lib_map_path]
  19. # usage: MeasDataFifo.sh [-noclean_files]
  20. # usage: MeasDataFifo.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 'MeasDataFifo.sh -help' for more information.
  31. #
  32. # Additional references - 'Xilinx Vivado Design Suite User Guide:Logic simulation (UG900)'
  33. #
  34. #*********************************************************************************************************
  35. # Directory path for design sources and include directories (if any) wrt this path
  36. ref_dir="."
  37. # Override directory with 'export_sim_ref_dir' env path value if set in the shell
  38. if [[ (! -z "$export_sim_ref_dir") && ($export_sim_ref_dir != "") ]]; then
  39. ref_dir="$export_sim_ref_dir"
  40. fi
  41. # Command line options
  42. vlogan_opts="-full64"
  43. vhdlan_opts="-full64"
  44. vcs_elab_opts="-full64 -debug_pp -t ps -licqueue -l elaborate.log"
  45. vcs_sim_opts="-ucli -licqueue -l simulate.log"
  46. # Design libraries
  47. design_libs=(xpm xil_defaultlib)
  48. # Simulation root library directory
  49. sim_lib_dir="vcs_lib"
  50. # Script info
  51. echo -e "MeasDataFifo.sh - Script generated by export_simulation (Vivado v2020.2 (64-bit)-id)\n"
  52. # Main steps
  53. run()
  54. {
  55. check_args $# $1
  56. setup $1 $2
  57. compile
  58. elaborate
  59. simulate
  60. }
  61. # RUN_STEP: <compile>
  62. compile()
  63. {
  64. # Compile design files
  65. vlogan -work xpm $vlogan_opts -sverilog \
  66. "C:/Xilinx/Vivado/2020.2/data/ip/xpm/xpm_cdc/hdl/xpm_cdc.sv" \
  67. "C:/Xilinx/Vivado/2020.2/data/ip/xpm/xpm_memory/hdl/xpm_memory.sv" \
  68. 2>&1 | tee -a vlogan.log
  69. vhdlan -work xpm $vhdlan_opts \
  70. "C:/Xilinx/Vivado/2020.2/data/ip/xpm/xpm_VCOMP.vhd" \
  71. 2>&1 | tee -a vhdlan.log
  72. vlogan -work xil_defaultlib $vlogan_opts +v2k \
  73. "$ref_dir/../../../../S5443.srcs/sources_1/ip/MeasDataFifo/MeasDataFifo_sim_netlist.v" \
  74. 2>&1 | tee -a vlogan.log
  75. vlogan -work xil_defaultlib $vlogan_opts +v2k \
  76. glbl.v \
  77. 2>&1 | tee -a vlogan.log
  78. }
  79. # RUN_STEP: <elaborate>
  80. elaborate()
  81. {
  82. vcs $vcs_elab_opts xil_defaultlib.MeasDataFifo xil_defaultlib.glbl -o MeasDataFifo_simv
  83. }
  84. # RUN_STEP: <simulate>
  85. simulate()
  86. {
  87. ./MeasDataFifo_simv $vcs_sim_opts -do simulate.do
  88. }
  89. # STEP: setup
  90. setup()
  91. {
  92. case $1 in
  93. "-lib_map_path" )
  94. if [[ ($2 == "") ]]; then
  95. echo -e "ERROR: Simulation library directory path not specified (type \"./MeasDataFifo.sh -help\" for more information)\n"
  96. exit 1
  97. fi
  98. create_lib_mappings $2
  99. ;;
  100. "-reset_run" )
  101. reset_run
  102. echo -e "INFO: Simulation run files deleted.\n"
  103. exit 0
  104. ;;
  105. "-noclean_files" )
  106. # do not remove previous data
  107. ;;
  108. * )
  109. create_lib_mappings $2
  110. esac
  111. create_lib_dir
  112. # Add any setup/initialization commands here:-
  113. # <user specific commands>
  114. }
  115. # Define design library mappings
  116. create_lib_mappings()
  117. {
  118. file="synopsys_sim.setup"
  119. if [[ -e $file ]]; then
  120. if [[ ($1 == "") ]]; then
  121. return
  122. else
  123. rm -rf $file
  124. fi
  125. fi
  126. touch $file
  127. lib_map_path=""
  128. if [[ ($1 != "") ]]; then
  129. lib_map_path="$1"
  130. fi
  131. for (( i=0; i<${#design_libs[*]}; i++ )); do
  132. lib="${design_libs[i]}"
  133. mapping="$lib:$sim_lib_dir/$lib"
  134. echo $mapping >> $file
  135. done
  136. if [[ ($lib_map_path != "") ]]; then
  137. incl_ref="OTHERS=$lib_map_path/synopsys_sim.setup"
  138. echo $incl_ref >> $file
  139. fi
  140. }
  141. # Create design library directory paths
  142. create_lib_dir()
  143. {
  144. if [[ -e $sim_lib_dir ]]; then
  145. rm -rf $sim_lib_dir
  146. fi
  147. for (( i=0; i<${#design_libs[*]}; i++ )); do
  148. lib="${design_libs[i]}"
  149. lib_dir="$sim_lib_dir/$lib"
  150. if [[ ! -e $lib_dir ]]; then
  151. mkdir -p $lib_dir
  152. fi
  153. done
  154. }
  155. # Delete generated data from the previous run
  156. reset_run()
  157. {
  158. files_to_remove=(ucli.key MeasDataFifo_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 MeasDataFifo_simv.daidir)
  159. for (( i=0; i<${#files_to_remove[*]}; i++ )); do
  160. file="${files_to_remove[i]}"
  161. if [[ -e $file ]]; then
  162. rm -rf $file
  163. fi
  164. done
  165. create_lib_dir
  166. }
  167. # Check command line arguments
  168. check_args()
  169. {
  170. if [[ ($1 == 1 ) && ($2 != "-lib_map_path" && $2 != "-noclean_files" && $2 != "-reset_run" && $2 != "-help" && $2 != "-h") ]]; then
  171. echo -e "ERROR: Unknown option specified '$2' (type \"./MeasDataFifo.sh -help\" for more information)\n"
  172. exit 1
  173. fi
  174. if [[ ($2 == "-help" || $2 == "-h") ]]; then
  175. usage
  176. fi
  177. }
  178. # Script usage
  179. usage()
  180. {
  181. msg="Usage: MeasDataFifo.sh [-help]\n\
  182. Usage: MeasDataFifo.sh [-lib_map_path]\n\
  183. Usage: MeasDataFifo.sh [-reset_run]\n\
  184. Usage: MeasDataFifo.sh [-noclean_files]\n\n\
  185. [-help] -- Print help information for this script\n\n\
  186. [-lib_map_path <path>] -- Compiled simulation library directory path. The simulation library is compiled\n\
  187. using the compile_simlib tcl command. Please see 'compile_simlib -help' for more information.\n\n\
  188. [-reset_run] -- Recreate simulator setup files and library mappings for a clean run. The generated files\n\
  189. from the previous run will be removed. If you don't want to remove the simulator generated files, use the\n\
  190. -noclean_files switch.\n\n\
  191. [-noclean_files] -- Reset previous run, but do not remove simulator generated files from the previous run.\n\n"
  192. echo -e $msg
  193. exit 1
  194. }
  195. # Launch script
  196. run $1 $2