msim_setup.tcl 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272
  1. # (C) 2001-2024 Altera Corporation. All rights reserved.
  2. # Your use of Altera Corporation's design tools, logic functions and
  3. # other software and tools, and its AMPP partner logic functions, and
  4. # any output files any of the foregoing (including device programming
  5. # or simulation files), and any associated documentation or information
  6. # are expressly subject to the terms and conditions of the Altera
  7. # Program License Subscription Agreement, Altera MegaCore Function
  8. # License Agreement, or other applicable license agreement, including,
  9. # without limitation, that your use is for the sole purpose of
  10. # programming logic devices manufactured by Altera and sold by Altera
  11. # or its authorized distributors. Please refer to the applicable
  12. # agreement for further details.
  13. # ----------------------------------------
  14. # Auto-generated simulation script msim_setup.tcl
  15. # ----------------------------------------
  16. # This script provides commands to simulate the following IP detected in
  17. # your Quartus project:
  18. # mainpll
  19. #
  20. # Altera recommends that you source this Quartus-generated IP simulation
  21. # script from your own customized top-level script, and avoid editing this
  22. # generated script.
  23. #
  24. # To write a top-level script that compiles Altera simulation libraries and
  25. # the Quartus-generated IP in your project, along with your design and
  26. # testbench files, copy the text from the TOP-LEVEL TEMPLATE section below
  27. # into a new file, e.g. named "mentor.do", and modify the text as directed.
  28. #
  29. # ----------------------------------------
  30. # # TOP-LEVEL TEMPLATE - BEGIN
  31. # #
  32. # # QSYS_SIMDIR is used in the Quartus-generated IP simulation script to
  33. # # construct paths to the files required to simulate the IP in your Quartus
  34. # # project. By default, the IP script assumes that you are launching the
  35. # # simulator from the IP script location. If launching from another
  36. # # location, set QSYS_SIMDIR to the output directory you specified when you
  37. # # generated the IP script, relative to the directory from which you launch
  38. # # the simulator.
  39. # #
  40. # set QSYS_SIMDIR <script generation output directory>
  41. # #
  42. # # Source the generated IP simulation script.
  43. # source $QSYS_SIMDIR/mentor/msim_setup.tcl
  44. # #
  45. # # Set any compilation options you require (this is unusual).
  46. # set USER_DEFINED_COMPILE_OPTIONS <compilation options>
  47. # set USER_DEFINED_VHDL_COMPILE_OPTIONS <compilation options for VHDL>
  48. # set USER_DEFINED_VERILOG_COMPILE_OPTIONS <compilation options for Verilog>
  49. # #
  50. # # Call command to compile the Quartus EDA simulation library.
  51. # dev_com
  52. # #
  53. # # Call command to compile the Quartus-generated IP simulation files.
  54. # com
  55. # #
  56. # # Add commands to compile all design files and testbench files, including
  57. # # the top level. (These are all the files required for simulation other
  58. # # than the files compiled by the Quartus-generated IP simulation script)
  59. # #
  60. # vlog <compilation options> <design and testbench files>
  61. # #
  62. # # Set the top-level simulation or testbench module/entity name, which is
  63. # # used by the elab command to elaborate the top level.
  64. # #
  65. # set TOP_LEVEL_NAME <simulation top>
  66. # #
  67. # # Set any elaboration options you require.
  68. # set USER_DEFINED_ELAB_OPTIONS <elaboration options>
  69. # #
  70. # # Call command to elaborate your design and testbench.
  71. # elab
  72. # #
  73. # # Run the simulation.
  74. # run -a
  75. # #
  76. # # Report success to the shell.
  77. # exit -code 0
  78. # #
  79. # # TOP-LEVEL TEMPLATE - END
  80. # ----------------------------------------
  81. #
  82. # IP SIMULATION SCRIPT
  83. # ----------------------------------------
  84. # If mainpll is one of several IP cores in your
  85. # Quartus project, you can generate a simulation script
  86. # suitable for inclusion in your top-level simulation
  87. # script by running the following command line:
  88. #
  89. # ip-setup-simulation --quartus-project=<quartus project>
  90. #
  91. # ip-setup-simulation will discover the Altera IP
  92. # within the Quartus project, and generate a unified
  93. # script which supports all the Altera IP within the design.
  94. # ----------------------------------------
  95. # ACDS 23.1 991 linux 2024.05.19.19:48:27
  96. # ----------------------------------------
  97. # Initialize variables
  98. if ![info exists SYSTEM_INSTANCE_NAME] {
  99. set SYSTEM_INSTANCE_NAME ""
  100. } elseif { ![ string match "" $SYSTEM_INSTANCE_NAME ] } {
  101. set SYSTEM_INSTANCE_NAME "/$SYSTEM_INSTANCE_NAME"
  102. }
  103. if ![info exists TOP_LEVEL_NAME] {
  104. set TOP_LEVEL_NAME "mainpll"
  105. }
  106. if ![info exists QSYS_SIMDIR] {
  107. set QSYS_SIMDIR "./../"
  108. }
  109. if ![info exists QUARTUS_INSTALL_DIR] {
  110. set QUARTUS_INSTALL_DIR "/home/bart/intelFPGA_lite/23.1std/quartus/"
  111. }
  112. if ![info exists USER_DEFINED_COMPILE_OPTIONS] {
  113. set USER_DEFINED_COMPILE_OPTIONS ""
  114. }
  115. if ![info exists USER_DEFINED_VHDL_COMPILE_OPTIONS] {
  116. set USER_DEFINED_VHDL_COMPILE_OPTIONS ""
  117. }
  118. if ![info exists USER_DEFINED_VERILOG_COMPILE_OPTIONS] {
  119. set USER_DEFINED_VERILOG_COMPILE_OPTIONS ""
  120. }
  121. if ![info exists USER_DEFINED_ELAB_OPTIONS] {
  122. set USER_DEFINED_ELAB_OPTIONS ""
  123. }
  124. # ----------------------------------------
  125. # Initialize simulation properties - DO NOT MODIFY!
  126. set ELAB_OPTIONS ""
  127. set SIM_OPTIONS ""
  128. if ![ string match "*-64 vsim*" [ vsim -version ] ] {
  129. } else {
  130. }
  131. # ----------------------------------------
  132. # Copy ROM/RAM files to simulation directory
  133. alias file_copy {
  134. echo "\[exec\] file_copy"
  135. }
  136. # ----------------------------------------
  137. # Create compilation libraries
  138. proc ensure_lib { lib } { if ![file isdirectory $lib] { vlib $lib } }
  139. ensure_lib ./libraries/
  140. ensure_lib ./libraries/work/
  141. vmap work ./libraries/work/
  142. vmap work_lib ./libraries/work/
  143. if ![ string match "*Intel*FPGA*" [ vsim -version ] ] {
  144. ensure_lib ./libraries/altera_ver/
  145. vmap altera_ver ./libraries/altera_ver/
  146. ensure_lib ./libraries/lpm_ver/
  147. vmap lpm_ver ./libraries/lpm_ver/
  148. ensure_lib ./libraries/sgate_ver/
  149. vmap sgate_ver ./libraries/sgate_ver/
  150. ensure_lib ./libraries/altera_mf_ver/
  151. vmap altera_mf_ver ./libraries/altera_mf_ver/
  152. ensure_lib ./libraries/altera_lnsim_ver/
  153. vmap altera_lnsim_ver ./libraries/altera_lnsim_ver/
  154. ensure_lib ./libraries/cyclonev_ver/
  155. vmap cyclonev_ver ./libraries/cyclonev_ver/
  156. ensure_lib ./libraries/cyclonev_hssi_ver/
  157. vmap cyclonev_hssi_ver ./libraries/cyclonev_hssi_ver/
  158. ensure_lib ./libraries/cyclonev_pcie_hip_ver/
  159. vmap cyclonev_pcie_hip_ver ./libraries/cyclonev_pcie_hip_ver/
  160. }
  161. # ----------------------------------------
  162. # Compile device library files
  163. alias dev_com {
  164. echo "\[exec\] dev_com"
  165. if ![ string match "*Intel*FPGA*" [ vsim -version ] ] {
  166. eval vlog $USER_DEFINED_VERILOG_COMPILE_OPTIONS $USER_DEFINED_COMPILE_OPTIONS "$QUARTUS_INSTALL_DIR/eda/sim_lib/altera_primitives.v" -work altera_ver
  167. eval vlog $USER_DEFINED_VERILOG_COMPILE_OPTIONS $USER_DEFINED_COMPILE_OPTIONS "$QUARTUS_INSTALL_DIR/eda/sim_lib/220model.v" -work lpm_ver
  168. eval vlog $USER_DEFINED_VERILOG_COMPILE_OPTIONS $USER_DEFINED_COMPILE_OPTIONS "$QUARTUS_INSTALL_DIR/eda/sim_lib/sgate.v" -work sgate_ver
  169. eval vlog $USER_DEFINED_VERILOG_COMPILE_OPTIONS $USER_DEFINED_COMPILE_OPTIONS "$QUARTUS_INSTALL_DIR/eda/sim_lib/altera_mf.v" -work altera_mf_ver
  170. eval vlog -sv $USER_DEFINED_VERILOG_COMPILE_OPTIONS $USER_DEFINED_COMPILE_OPTIONS "$QUARTUS_INSTALL_DIR/eda/sim_lib/altera_lnsim.sv" -work altera_lnsim_ver
  171. eval vlog $USER_DEFINED_VERILOG_COMPILE_OPTIONS $USER_DEFINED_COMPILE_OPTIONS "$QUARTUS_INSTALL_DIR/eda/sim_lib/mentor/cyclonev_atoms_ncrypt.v" -work cyclonev_ver
  172. eval vlog $USER_DEFINED_VERILOG_COMPILE_OPTIONS $USER_DEFINED_COMPILE_OPTIONS "$QUARTUS_INSTALL_DIR/eda/sim_lib/mentor/cyclonev_hmi_atoms_ncrypt.v" -work cyclonev_ver
  173. eval vlog $USER_DEFINED_VERILOG_COMPILE_OPTIONS $USER_DEFINED_COMPILE_OPTIONS "$QUARTUS_INSTALL_DIR/eda/sim_lib/cyclonev_atoms.v" -work cyclonev_ver
  174. eval vlog $USER_DEFINED_VERILOG_COMPILE_OPTIONS $USER_DEFINED_COMPILE_OPTIONS "$QUARTUS_INSTALL_DIR/eda/sim_lib/mentor/cyclonev_hssi_atoms_ncrypt.v" -work cyclonev_hssi_ver
  175. eval vlog $USER_DEFINED_VERILOG_COMPILE_OPTIONS $USER_DEFINED_COMPILE_OPTIONS "$QUARTUS_INSTALL_DIR/eda/sim_lib/cyclonev_hssi_atoms.v" -work cyclonev_hssi_ver
  176. eval vlog $USER_DEFINED_VERILOG_COMPILE_OPTIONS $USER_DEFINED_COMPILE_OPTIONS "$QUARTUS_INSTALL_DIR/eda/sim_lib/mentor/cyclonev_pcie_hip_atoms_ncrypt.v" -work cyclonev_pcie_hip_ver
  177. eval vlog $USER_DEFINED_VERILOG_COMPILE_OPTIONS $USER_DEFINED_COMPILE_OPTIONS "$QUARTUS_INSTALL_DIR/eda/sim_lib/cyclonev_pcie_hip_atoms.v" -work cyclonev_pcie_hip_ver
  178. }
  179. }
  180. # ----------------------------------------
  181. # Compile the design files in correct order
  182. alias com {
  183. echo "\[exec\] com"
  184. eval vlog $USER_DEFINED_VERILOG_COMPILE_OPTIONS $USER_DEFINED_COMPILE_OPTIONS "$QSYS_SIMDIR/mainpll.vo"
  185. }
  186. # ----------------------------------------
  187. # Elaborate top level design
  188. alias elab {
  189. echo "\[exec\] elab"
  190. eval vsim -t ps $ELAB_OPTIONS $USER_DEFINED_ELAB_OPTIONS -L work -L work_lib -L altera_ver -L lpm_ver -L sgate_ver -L altera_mf_ver -L altera_lnsim_ver -L cyclonev_ver -L cyclonev_hssi_ver -L cyclonev_pcie_hip_ver $TOP_LEVEL_NAME
  191. }
  192. # ----------------------------------------
  193. # Elaborate the top level design with -voptargs=+acc option
  194. alias elab_debug {
  195. echo "\[exec\] elab_debug"
  196. eval vsim -voptargs=+acc -t ps $ELAB_OPTIONS $USER_DEFINED_ELAB_OPTIONS -L work -L work_lib -L altera_ver -L lpm_ver -L sgate_ver -L altera_mf_ver -L altera_lnsim_ver -L cyclonev_ver -L cyclonev_hssi_ver -L cyclonev_pcie_hip_ver $TOP_LEVEL_NAME
  197. }
  198. # ----------------------------------------
  199. # Compile all the design files and elaborate the top level design
  200. alias ld "
  201. dev_com
  202. com
  203. elab
  204. "
  205. # ----------------------------------------
  206. # Compile all the design files and elaborate the top level design with -voptargs=+acc
  207. alias ld_debug "
  208. dev_com
  209. com
  210. elab_debug
  211. "
  212. # ----------------------------------------
  213. # Print out user commmand line aliases
  214. alias h {
  215. echo "List Of Command Line Aliases"
  216. echo
  217. echo "file_copy -- Copy ROM/RAM files to simulation directory"
  218. echo
  219. echo "dev_com -- Compile device library files"
  220. echo
  221. echo "com -- Compile the design files in correct order"
  222. echo
  223. echo "elab -- Elaborate top level design"
  224. echo
  225. echo "elab_debug -- Elaborate the top level design with -voptargs=+acc option"
  226. echo
  227. echo "ld -- Compile all the design files and elaborate the top level design"
  228. echo
  229. echo "ld_debug -- Compile all the design files and elaborate the top level design with -voptargs=+acc"
  230. echo
  231. echo
  232. echo
  233. echo "List Of Variables"
  234. echo
  235. echo "TOP_LEVEL_NAME -- Top level module name."
  236. echo " For most designs, this should be overridden"
  237. echo " to enable the elab/elab_debug aliases."
  238. echo
  239. echo "SYSTEM_INSTANCE_NAME -- Instantiated system module name inside top level module."
  240. echo
  241. echo "QSYS_SIMDIR -- Platform Designer base simulation directory."
  242. echo
  243. echo "QUARTUS_INSTALL_DIR -- Quartus installation directory."
  244. echo
  245. echo "USER_DEFINED_COMPILE_OPTIONS -- User-defined compile options, added to com/dev_com aliases."
  246. echo
  247. echo "USER_DEFINED_ELAB_OPTIONS -- User-defined elaboration options, added to elab/elab_debug aliases."
  248. echo
  249. echo "USER_DEFINED_VHDL_COMPILE_OPTIONS -- User-defined vhdl compile options, added to com/dev_com aliases."
  250. echo
  251. echo "USER_DEFINED_VERILOG_COMPILE_OPTIONS -- User-defined verilog compile options, added to com/dev_com aliases."
  252. }
  253. file_copy
  254. h