
    # no op
  } else {
    puts $fh "\nquit -force"
  }

  # Intentional: add a blank line at the very end in do file to avoid vsim error detecting '\' at EOF
  #              when executing the do file directly with vsim (vsim -c -do tb.do)
  #              ** Error: <EOF> reached in ./tb_compile.do with incomplete command at line
  #              e.g vcom test.vhd \
  #
  puts $fh ""

  close $fh
}

proc usf_modelsim_create_do_file_for_elaboration { do_file } {
  # Summary:
  # Argument Usage:
  # Return Value:

  set top $::tclapp::xilinx::modelsim::a_sim_vars(s_sim_top)
  set dir $::tclapp::xilinx::modelsim::a_sim_vars(s_launch_dir)
  set b_batch $::tclapp::xilinx::modelsim::a_sim_vars(b_batch)
  set b_scripts_only $::tclapp::xilinx::modelsim::a_sim_vars(b_scripts_only)

  set fh 0
  if {[catch {open $do_file w} fh]} {
    send_msg_id USF-ModelSim-019 ERROR "Failed to open file to write ($do_file)\n"
    return 1
  }

  usf_modelsim_write_header $fh $do_file
  if { [get_param "project.writeNativeScriptForUnifiedSimulation"] } {
    # no op
  } else {
    usf_add_quit_on_error $fh "elaborate"
  }

  
  if { [get_param "project.enable2StepFlowForModelSim"] } {
    # call vopt args in simulation
  } else {
    set cmd_str [usf_modelsim_get_elaboration_cmdline]
    puts $fh "$cmd_str"
  }

  set b_is_unix false
  if {$::tcl_platform(platform) == "unix"} {
    set b_is_unix true
  }

  if { [get_param "project.writeNativeScriptForUnifiedSimulation"] && $b_is_unix } {
    # no op
  } else {
    puts $fh "\nquit -force"
  }

  close $fh
}

proc usf_modelsim_get_elaboration_cmdline {} {
  # Summary:
  # Argument Usage:
  # Return Value:

  variable a_sim_vars
  variable l_compiled_libraries
  set top $::tclapp::xilinx::modelsim::a_sim_vars(s_sim_top)
  set dir $::tclapp::xilinx::modelsim::a_sim_vars(s_launch_dir)
  set sim_flow $::tclapp::xilinx::modelsim::a_sim_vars(s_simulation_flow)
  set fs_obj [get_filesets $::tclapp::xilinx::modelsim::a_sim_vars(s_simset)]

  set target_lang  [get_property "TARGET_LANGUAGE" [c