.. _UG/Concepts: Concepts ######## .. _UG/Concepts/Directories: Directories *********** .. _UG/Concepts/CurrentSimulationDirectory: Simulation Directory ==================== .. grid:: 2 .. grid-item:: :columns: 6 The :term:`simulation directory` is the directory in which the simulator runs. :acs:`OSVVM` keeps its absolute path in the variable ``::osvvm::CurrentSimulationDirectory``. Simulators write :term:`library` mappings and other files into this directory, and OSVVM puts its output there: the libraries (:file:`VHDL_LIBS`), the :term:`build` results and reports, and :file:`index.html` with an overview of all builds. Create a separate directory for simulations, for example :file:`sim` or :file:`temp` next to :file:`OsvvmLibraries`. Cleaning up is then just deleting and recreating it. .. grid-item:: :columns: 6 .. tree:: :root-icon: 📁 :node-icon: 📁 :leaf-icon: 📄 :icons: > 📁 > :file:`OsvvmLibraries` - :file:`sim` | CurrentSimulationDirectory - :file:`VHDL_LIBS` > :file:`-` | compiled libraries > :file:`` | results of a build - :file:`index.html` | all builds - :file:`index.yml` .. _UG/Concepts/CurrentWorkingDirectory: Working Directory ================= .. grid:: 2 .. grid-item:: :columns: 6 The :term:`working directory` is the directory of the script that is currently running. OSVVM keeps it in the variable ``::osvvm::CurrentWorkingDirectory``. All OSVVM commands that take a path resolve a relative path against the working directory. So a script names its files relative to its own location, no matter from where it is called. :ref:`RUFF/osvvm/include` and :ref:`RUFF/osvvm/build` set the working directory to the directory of the script they run, and restore it afterwards. .. grid-item:: :columns: 6 .. code-block:: tcl # File: OsvvmLibraries/AXI4/Axi4/src/build.pro # The working directory is .../AXI4/Axi4/src analyze Axi4Manager.vhd analyze Axi4Subordinate.vhd .. _UG/Concepts/NoCd: Don't use Tcl's ``cd`` ====================== .. grid:: 2 .. grid-item:: :columns: 6 .. caution:: Don't use :acs:`Tcl`'s ``cd``. ``cd`` changes the simulation directory and loses the library mappings and other information the simulator keeps there. To work relative to another directory inside a script, change the working directory with :ref:`RUFF/osvvm/ChangeWorkingDirectory`; like ``cd``, it accepts a relative or an absolute path. To get a path relative to the working directory, for a command or for Tcl, use :ref:`RUFF/osvvm/JoinWorkingDirectory`. If you used ``cd`` anyway, :ref:`RUFF/osvvm/LinkCurrentLibraries` maps all libraries OSVVM knows into the new simulation directory. .. grid-item:: :columns: 6 .. code-block:: tcl ChangeWorkingDirectory src analyze Axi4Manager.vhd .. code-block:: tcl LinkLibraryDirectory [JoinWorkingDirectory RelativePath] .. _UG/Concepts/NoSource: Don't use Tcl's ``source`` or a simulator's ``do`` ================================================== .. grid:: 2 .. grid-item:: :columns: 6 .. caution:: Don't use Tcl's ``source`` or a simulator's ``do`` to run OSVVM scripts. :ref:`RUFF/osvvm/include` runs a script with ``source`` (or ``do`` for a :file:`*.do` file), but it also sets the working directory to the script's directory and restores it afterwards. With ``source`` or ``do``, the script would have to manage its paths itself. .. grid-item:: :columns: 6 .. code-block:: tcl # Instead of: source ../src/build.pro include ../src .. _UG/Concepts/BuildInclude: Builds and Includes ******************* .. grid:: 2 .. grid-item:: :columns: 6 :ref:`RUFF/osvvm/include` runs another script. Scripts are composed hierarchically like the design: a script includes the scripts of its sub-directories. :ref:`RUFF/osvvm/build` is :ref:`RUFF/osvvm/include` plus a logging point. It's called from the simulator's console (or a start-up script) to run a script and: * starts a new log file for everything the script and the simulator print, * collects the results of all :term:`test suites ` and :term:`test cases ` the script runs, * creates the build reports when the script finishes (see :ref:`RPT`). A :ref:`RUFF/osvvm/build` inside a running build acts like :ref:`RUFF/osvvm/include`. .. grid-item:: :columns: 6 .. code-block:: tcl # In the simulator's console: build ../OsvvmLibraries/OsvvmLibraries.pro .. code-block:: tcl # Inside a script: include ./osvvm/osvvm.pro include ./Common .. _UG/Concepts/BuildName: Build Name and Output ===================== .. grid:: 2 .. grid-item:: :columns: 6 The :term:`build name` is derived from the script: ``_