MeasDataFifo.sh 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. #!/bin/bash -f
  2. #*********************************************************************************************************
  3. # Vivado (TM) v2020.2 (64-bit)
  4. #
  5. # Filename : MeasDataFifo.sh
  6. # Simulator : Mentor Graphics Questa Advanced 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. # Script info
  36. echo -e "MeasDataFifo.sh - Script generated by export_simulation (Vivado v2020.2 (64-bit)-id)\n"
  37. # Main steps
  38. run()
  39. {
  40. check_args $# $1
  41. setup $1 $2
  42. compile
  43. elaborate
  44. simulate
  45. }
  46. # RUN_STEP: <compile>
  47. compile()
  48. {
  49. # Compile design files
  50. source compile.do 2>&1 | tee -a compile.log
  51. }
  52. # RUN_STEP: <elaborate>
  53. elaborate()
  54. {
  55. source elaborate.do 2>&1 | tee -a elaborate.log
  56. }
  57. # RUN_STEP: <simulate>
  58. simulate()
  59. {
  60. vsim -c -do "do {simulate.do}" -l simulate.log
  61. }
  62. # STEP: setup
  63. setup()
  64. {
  65. case $1 in
  66. "-lib_map_path" )
  67. if [[ ($2 == "") ]]; then
  68. echo -e "ERROR: Simulation library directory path not specified (type \"./MeasDataFifo.sh -help\" for more information)\n"
  69. exit 1
  70. fi
  71. copy_setup_file $2
  72. ;;
  73. "-reset_run" )
  74. reset_run
  75. echo -e "INFO: Simulation run files deleted.\n"
  76. exit 0
  77. ;;
  78. "-noclean_files" )
  79. # do not remove previous data
  80. ;;
  81. * )
  82. copy_setup_file $2
  83. esac
  84. create_lib_dir
  85. # Add any setup/initialization commands here:-
  86. # <user specific commands>
  87. }
  88. # Copy modelsim.ini file
  89. copy_setup_file()
  90. {
  91. file="modelsim.ini"
  92. if [[ ($1 != "") ]]; then
  93. lib_map_path="$1"
  94. else
  95. lib_map_path="C:/Users/work/Desktop/S5243PM_REPO/S5443_M/S5443.cache/compile_simlib/questa"
  96. fi
  97. if [[ ($lib_map_path != "") ]]; then
  98. src_file="$lib_map_path/$file"
  99. cp $src_file .
  100. fi
  101. }
  102. # Create design library directory
  103. create_lib_dir()
  104. {
  105. lib_dir="questa_lib"
  106. if [[ -e $lib_dir ]]; then
  107. rm -rf $lib_dir
  108. fi
  109. mkdir $lib_dir
  110. }
  111. # Delete generated data from the previous run
  112. reset_run()
  113. {
  114. files_to_remove=(compile.log elaborate.log simulate.log vsim.wlf questa_lib)
  115. for (( i=0; i<${#files_to_remove[*]}; i++ )); do
  116. file="${files_to_remove[i]}"
  117. if [[ -e $file ]]; then
  118. rm -rf $file
  119. fi
  120. done
  121. create_lib_dir
  122. }
  123. # Check command line arguments
  124. check_args()
  125. {
  126. if [[ ($1 == 1 ) && ($2 != "-lib_map_path" && $2 != "-noclean_files" && $2 != "-reset_run" && $2 != "-help" && $2 != "-h") ]]; then
  127. echo -e "ERROR: Unknown option specified '$2' (type \"./MeasDataFifo.sh -help\" for more information)\n"
  128. exit 1
  129. fi
  130. if [[ ($2 == "-help" || $2 == "-h") ]]; then
  131. usage
  132. fi
  133. }
  134. # Script usage
  135. usage()
  136. {
  137. msg="Usage: MeasDataFifo.sh [-help]\n\
  138. Usage: MeasDataFifo.sh [-lib_map_path]\n\
  139. Usage: MeasDataFifo.sh [-reset_run]\n\
  140. Usage: MeasDataFifo.sh [-noclean_files]\n\n\
  141. [-help] -- Print help information for this script\n\n\
  142. [-lib_map_path <path>] -- Compiled simulation library directory path. The simulation library is compiled\n\
  143. using the compile_simlib tcl command. Please see 'compile_simlib -help' for more information.\n\n\
  144. [-reset_run] -- Recreate simulator setup files and library mappings for a clean run. The generated files\n\
  145. from the previous run will be removed. If you don't want to remove the simulator generated files, use the\n\
  146. -noclean_files switch.\n\n\
  147. [-noclean_files] -- Reset previous run, but do not remove simulator generated files from the previous run.\n\n"
  148. echo -e $msg
  149. exit 1
  150. }
  151. # Launch script
  152. run $1 $2