.. program:: ghdl .. _USING:Simulation: Simulation (runtime) #################### .. _simulation_options: Simulation options ================== In most system environments, it is possible to pass CLI options while invoking a program. Contrary to most programming languages, there is no standard method in VHDL to obtain the arguments or to set the exit status. However, the GHDL runtime behaviour can be modified with some options: - It is possible to pass parameters to your design through the generic interfaces of the top entity. - It is also possible to stop simulation after a certain time. The exit status of the simulation is ``EXIT_SUCCESS`` (``0``) if the simulation completes, or ``EXIT_FAILURE`` (``1``) in case of error (assertion failure, overflow or any constraint error). Here is the list of the most useful options. For further info, see :ref:`DEV:Debugging`. .. HINT:: Note that these arguments are represented as ``simulation_options...`` in this documentation. For analysis/elaboration options, see :ref:`USING:Invoking`. .. option:: -gGENERIC=VALUE Set value `VALUE` to generic with name `GENERIC`. Example:: $ ghdl -r --std=08 my_unit -gDEPTH=12 .. NOTE:: This is currently a run option; but in the (not near) future it might be deprecated to become an elaboration option only. As a result, now you can generate a single binary and execute it multiple times with different arguments. That might not be possible in the future. As explained in :option:`-e`, performing a complete elaboration in terms of the LRM requires to get rid of the compile and link model. This is mostly because delaying certain elaboration steps to the runtime prevents elaboration-time optimisions. .. HINT:: Currently, GHDL has limited support for generic types in the CLI. It is suggested to use strings or integers. Nonetheless, project `JSON-for-VHDL `_ allows to encode a set of parameters as stringified JSON, and it provides VHDL functions to read specific values from it. It is valid for synthesis. .. option:: --assert-level= Select the assertion level at which an assertion violation stops the simulation. `LEVEL` is the name from the `severity_level` enumerated type defined in the `standard` package or the ``none`` name. By default, only assertion violation of severity level ``failure`` stops the simulation. For example, if `LEVEL` was ``warning``, any assertion violation with severity level ``warning``, ``error`` or ``failure`` would stop simulation, but the assertion violation at the ``note`` severity level would only display a message. Option :option:`--assert-level=none <--assert-level>` prevents any assertion violation from stopping simulation. .. option:: --backtrace-severity= Select the assertion level at which an assertion violation display a backtrace (if available). This is useful when the assertion is generated by a function (like assertions in ``ieee.numeric_std``) whose location is not very useful. .. option:: --ieee-asserts= .. option:: --asserts= Select how assertions are handled. `POLICY` can be ``enable`` (the default), ``disable`` which disables all assertions and ``disable-at-0`` which disables only at the start of simulation. The ``--ieee-asserts`` applies only to assertions from ``ieee`` package. This option can be useful to avoid assertion messages from ``ieee.numeric_std`` (and other ``ieee`` packages). The ``--asserts`` option applies to all assertions, including those from the ``ieee`` units. The behaviour of the latter can be overridden by using the ``--ieee-asserts`` option after the ``--asserts`` option. .. option:: --stop-time=