Search code examples
bashxilinxmodelsimvivadoquestasim

How can I compile Xilinx Vivado's simulation libraries for e.g. QuestaSim?


I want to compile the Xilinx Vivado simulation primitives for QuestaSim (ModelSim). The documentation lists a TCL command, but I would like to use a common shell command like the old one for ISE:

<ISEDirectory>\bin\nt64\compxlib.exe -family all - language all -library all -simulator questa ....

As far as I can see, the TCL command should be entered in the Vivado GUI.

How can I run the compilation from an user defined PowerShell or Bash script?


Solution

  • Just to answer my own question for completeness ...

    There is no other way then running the compile command from the Vivado Tcl shell, either in the GUI or on command line.

    Compiling Vivado libraries from Bash:

    VSimBinDir=/opt/questasim/10.4d/bin
    DestDir=xilinx-vivado
    
    Simulator=questa
    Language=vhdl
    Library=all
    Family=all
    
    CommandFile=vivado.tcl
    
    echo "compile_simlib -force -library $Library -family $Family -language $Language -simulator $Simulator -simulator_exec_path $VSimBinDir -directory $DestDir" > $CommandFile
    if [ $? -ne 0 ]; then
      echo 1>&2 -e "${COLORED_ERROR} Cannot create temporary tcl script.${ANSI_NOCOLOR}"
      exit -1;
    fi
    echo "exit" >> $CommandFile
    
    # compile common libraries
    $Vivado_tcl -mode tcl -source $CommandFile
    if [ $? -ne 0 ]; then
      echo 1>&2 -e "${COLORED_ERROR} Error while compiling Xilinx Vivado libraries.${ANSI_NOCOLOR}"
      exit -1;
    fi