
Description:

  Export a simulation script file for the target simulator (please see the list of supported
  simulators below). The generated script will contain simulator commands for compiling, 
  elaborating and simulating the design.

  The command will retrieve the simulation compile order of specified objects, and export
  this information in a shell script with the compiler commands and default options for the
  target simulator. The specified object can be either a simulation fileset, IP or a BD (Block
  Design).

  If the object is not specified, then this command will generate the script for the active
  simulation "top" from the current simulation fileset. Any verilog include directories or file
  paths for the files containing verilog define statements will be added to the compiler command line.

  By default, the design source file and include directory paths in the compiler command line
  will be set relative to the "reference_dir" variable that is set in the generated script.
  To make these paths absolute, specify the "-absolute_path" switch.

  The command will also copy data files (if any) from the fileset, IP or a BD to the output
  directory. If the design contains "Verilog" sources, then the generated script will also copy
  the "glbl.v" file from the software installation path to the output directory.

  A default ".do" file that is used in the compiler commands in the simulation script for the
  target simulator, will be written to the output directory.

  NOTE: In order to perform simulation with the generated script, the simulation libraries must
  be compiled first using the 'compile_simlib' Tcl command. The compiled library directory path
  must be specified when generating this script. The generated script will automatically include
  the setup files for the target simulator from the compiled library directory.

  Supported simulators:-

    Vivado Simulator (xsim)
    ModelSim Simulator (modelsim) 
    Questa Advanced Simulator (questa)
    Incisive Enterprise Simulator (ies)
    Xcelium Parallel Simulator (xcelium)
    Verilog Compiler Simulator (vcs)
    Riviera-PRO Simulator (riviera)
    Active-HDL Simulator (activehdl)

Arguments:

  -simulator - (Required) Specify name of the target simulator for which the simulation script
  needs to be generated. The valid simulators names are "xsim" "modelsim" "questa" "ies" "xcelium"
  "vcs" (or "vcs_mx") "riviera" and "activehdl". To generate simulation script for all simulators,
  specify "all".

  -of_objects - (Optional) Specify name of the target design object for which the simulation script
  needs to be generated. The target object can be either a simulation fileset (simset), IP or a BD. If
  this option is not specified, then this command will generate the script for the current simulation
  fileset.

  -ip_user_files_dir - (Optional) Specify path to the extracted design files for the generated IP.
  Default path of this directory is '<project>/<project>.ip_user_files'. For a managed project, the
  default path is "ip_user_files".

  -ipstatic_source_dir - (Optional) Specify path to the extracted static design files for the generated
  IP. Default path of this directory is '<project>/<project>.ip_user_files/ipstatic'. For a managed
  project, the default path is "ip_user_files/ipstatic".
  
  -lib_map_path - (Optional) Specify path to the Xilinx pre-compiled simulation library for the specified
  simulator. The simulation library is compiled using compile_simlib. Please see the header section in the
  generated script for more information. If this switch is not specified, then the generated script
  will not reference the pre-compiled simulation library and the static IP files will be compiled locally.

  -script_name - (Optional) Specify name of the generated script. Default name is '<simulation_top>.sh'.
  If the -of_objects switch is specified, then the default syntax of the script will be as follows:-

    -------------------------------------------------------------
     Object Type                            Script Name
    -------------------------------------------------------------
    -of_objects [current_fileset -simset]   <simulation_top>.sh
    -of_objects [get_ips <ip>]              <ip_name>.sh
    -of_objects [get_files <ip>.xci]        <ip_name>.sh
    -of_objects [get_files <name>.bd]       <bd_name>.sh
    -------------------------------------------------------------

  -directory - (Required) Specify the directory path where the script file will be generated.

  -runtime - (Optional) Specify simulation run time.

  -define - (Optiona) Specify the list of verilog defines used in the design.

  -generic - (Optional) Specify the list of VHDL generics used in the design.

  -include - (Optional) Specify the list of include directory paths for verilog include files in the design.

  -absolute_path - (Optional) Specify this option to make source and include directory paths absolute.
  By default, all paths are set relative to the output directory specified with the -directory switch.

  A "reference_dir" variable will be set when generating script for "ies" and "vcs" to point to the output
  directory that was set with the -directory switch.

  -use_ip_compiled_libs - (Optional) Specify this option to reference pre-compiled IP static library during
  compilation. This switch requires '-ip_user_files_dir' and '-ipstatic_source_dir' switches as well for
  generating scripts using the pre-compiled IPs.

  -absolute_path - (Optional) Specify this option to set file paths to absolute format in the generated
  script. By default, the file paths will be set relative to the directory where this script was generated. 

  -export_source_files - (Optional) Specify this option to copy the IP design files to the generated script
  directory in a sub-directory named 'srcs'. The generated script will reference the design files from this
  'srcs' directory.

  -32bit - (Optional) Specify this option to perform 32-bit simulation. If this option is not specified then
  by default 64-bit option will be added to the simulation command line as applicable.

  -force - (Optional) Overwrite an existing script of the same name. If the script file already exists, this
  command will return an error unless the -force argument is specified.

  -quiet - (Optional) Execute the command quietly, ignoring any command line errors and returning no messages.
  The command also returns TCL_OK regardless of any errors encountered during execution.

  -verbose - (Optional) Temporarily override any message limits and return all messages from this command.

  Note: Message limits can be defined with the set_msg_config command.

Examples:

  - Generate a simulation script named "tb_design.sh" for the current simulation fileset with the top set to
    "tb_design" for project "/project_1/project_1.xpr" for the "xsim" simulator. Use the pre-compiled IP static
    library from the Vivado installation. The script will be generated in "./test_xsim" directory:-

    % export_simulation -simulator xsim
                        -directory "./test_xsim"
                        -ip_user_files_dir "/project_1/project_1.ip_user_files_dir"
                        -ipstatic_source_dir "/project_1/project_1.ip_user_files_dir/ipstatic"
                        -use_ip_compiled_libs

  - Generate a simulation script for project "/project_1/project_1.xpr" for the "modelsim" simulator. Use the
    pre-compiled IP static library from the "/design/compiled_libs/modelsim/lib" directory and export the IP/BD
    source files to the "./proj/test_modelsim/srcs" directory. The source file paths in the generated script
    will be set relative to the "./srcs" directory in "./proj/test_modelsim":-

    % export_simulation -simulator modelsim
                        -directory "./proj/test_modelsim"
                        -ip_user_files_dir "/project_1/project_1.ip_user_files_dir"
                        -ipstatic_source_dir "/project_1/project_1.ip_user_files_dir/ipstatic"
                        -lib_map_path "/design/compiled_libs/modelsim/lib"
                        -use_ip_compiled_libs
                        -export_source_files

  - Generate a simulation script for project "/project_1/project_1.xpr" for the "questa" simulator. Use the
    pre-compiled IP static library from the "/design/compiled_libs/questa/lib" directory, set source file paths
    to the absolute format in the generated script and run simulator tools in 32bit mode:-

    % export_simulation -simulator questa
                        -directory "./proj/test_questa"
                        -ip_user_files_dir "/project_1/project_1.ip_user_files_dir"
                        -ipstatic_source_dir "/project_1/project_1.ip_user_files_dir/ipstatic"
                        -lib_map_path "/design/compiled_libs/questa/lib"
                        -use_ip_compiled_libs
                        -absolute_path
                        -32bit
                       

  - Generate a simulation script for the "clk_core" IP for the "ies" simulator. Use pre-compiled IP static
    library from the "/design/compiled_libs/ies/lib" directory and overwrite the existing script named
    "test_ip_ies.sh" in "./output" directory:-

    % export_simulation -simulator ies
                        -directory "./proj/test_ies"
                        -of_objects [get_ips clk_core]
                        -ip_user_files_dir "/project_1/project_1.ip_user_files_dir"
                        -ipstatic_source_dir "/project_1/project_1.ip_user_files_dir/ipstatic"
                        -lib_map_path "/design/compiled_libs/ies/lib"
                        -use_ip_compiled_libs
                        -script_name "./output/test_ip_ies.sh"
                        -force

  - Generate a simulation script for the current simulation fileset for the "xcelium" simulator. Use pre-compiled
    IP static library from the "/design/compiled_libs/xcelium/lib" directory and run simulation for 1000ns:-

    % export_simulation -simulator xcelium
                        -directory "./proj/test_xcelium"
                        -ip_user_files_dir "/project_1/project_1.ip_user_files_dir"
                        -ipstatic_source_dir "/project_1/project_1.ip_user_files_dir/ipstatic"
                        -lib_map_path "/design/compiled_libs/xcelium/lib"
                        -use_ip_compiled_libs
                        -script_name "./output/test_ip_xcelium.sh"


  - Generate a simulation script for the "clk_core" BD (Block Design) for the "vcs" simulator. Use pre-compiled
    IP static library from the "/design/compiled_libs/vcs/lib" directory, pass HEX_VAR verilog define, pass INCREMENT
    vhdl generic and run simulation for 1000ns:-

    % export_simulation -simulator vcs
                        -directory "./proj/test_vcs"
                        -of_objects [get_files clk_core.bd]
                        -ip_user_files_dir "/project_1/project_1.ip_user_files_dir"
                        -ipstatic_source_dir "/project_1/project_1.ip_user_files_dir/ipstatic"
                        -lib_map_path "/design/compiled_libs/vcs/lib"
                        -use_ip_compiled_libs
                        -script_name "./output/test_ip_vcs.sh"
                        -define [list {HEX_VAR=4'b0101}]
                        -generic [list {INCREMENT=10}]
                        -runtime 1000ns

  - Generate a simulation script for the current simulation fileset for the "riviera" simulator. Use pre-compiled
    IP static library from the "/design/compiled_libs/riviera/lib" directory, include verilog header files from the
    "./fifo/incl" directory and run simulation for 1000ns:-

    % export_simulation -simulator riviera
                        -directory "./proj/test_riviera"
                        -ip_user_files_dir "/project_1/project_1.ip_user_files_dir"
                        -ipstatic_source_dir "/project_1/project_1.ip_user_files_dir/ipstatic"
                        -lib_map_path "/design/compiled_libs/riviera/lib"
                        -use_ip_compiled_libs
                        -include [list {./fifo/incl}]
                        -runtime 1000ns

  - Generate a simulation script for the current simulation fileset for the "activehdl" simulator. Use pre-compiled
    IP static library from the "/design/compiled_libs/activehdl/lib" directory, include verilog header files from the
    "./fifo/incl" directory and run simulation for 1000ns:-

    % export_simulation -simulator activehdl
                        -directory "./proj/test_activehdl"
                        -ip_user_files_dir "/project_1/project_1.ip_user_files_dir"
                        -ipstatic_source_dir "/project_1/project_1.ip_user_files_dir/ipstatic"
                        -lib_map_path "/design/compiled_libs/activehdl/lib"
                        -use_ip_compiled_libs
                        -include [list {./fifo/incl}]
                        -runtime 1000ns

  - Generate a simulation script for all simulators. Use pre-compiled IP static library from the respective simulator
    directory specified with the -lib_map_path switch:-

    % export_simulation -simulator all
                        -directory "./proj/test_sim"
                        -ip_user_files_dir "/project_1/project_1.ip_user_files_dir"
                        -ipstatic_source_dir "/project_1/project_1.ip_user_files_dir/ipstatic"
                        -lib_map_path [list {xsim=/compiled_libs/xsim/lib}
                                            {modelsim=/compiled_libs/modelsim/lib} 
                                            {questa=/compiled_libs/questa/lib} 
                                            {ies=/compiled_libs/ies/lib} 
                                            {xcelium=/compiled_libs/xcelium/lib} 
                                            {vcs=/compiled_libs/vcs/lib} 
                                            {riviera=/compiled_libs/riviera/lib} 
                                            {activehdl=/compiled_libs/activehdl/lib} ]
                        -use_ip_compiled_libs

  - Generate a simulation script for the "clk_core" IP from a managed IP project for "xsim" simulator. Use the
    pre-compiled IP static library from the Vivado installation.:-

    % export_simulation -simulator questa
                        -directory "./proj/test_mip_xsim"
                        -of_objects [get_ips clk_core]
                        -ip_user_files_dir "/managed_ip_project/ip_user_files_dir"
                        -ipstatic_source_dir "/managed_ip_project/ip_user_files_dir/ipstatic"
                        -lib_map_path "/design/compiled_libs/xsim/lib"
                        -use_ip_compiled_libs

See Also:

   *  current_fileset
   *  get_files
   *  get_ips
   *  compile_simlib
