aboutsummaryrefslogtreecommitdiffstats
path: root/src/vhdl
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2019-10-21 19:28:18 +0200
committerTristan Gingold <tgingold@free.fr>2019-10-21 19:28:18 +0200
commit92c75a0cbf315abe01b25b60f064941b3fadd80a (patch)
treeeabedba5f347cede43ab9b9335ee145e9d4c31b4 /src/vhdl
parent4894a7e85b327c24e26545b3a76d36b8bf7ef8d9 (diff)
downloadghdl-92c75a0cbf315abe01b25b60f064941b3fadd80a.tar.gz
ghdl-92c75a0cbf315abe01b25b60f064941b3fadd80a.tar.bz2
ghdl-92c75a0cbf315abe01b25b60f064941b3fadd80a.zip
vhdl-prints: handle restrict in vunit.
Diffstat (limited to 'src/vhdl')
-rw-r--r--src/vhdl/vhdl-prints.adb2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/vhdl/vhdl-prints.adb b/src/vhdl/vhdl-prints.adb
index 92fc984db..0ed2d8f31 100644
--- a/src/vhdl/vhdl-prints.adb
+++ b/src/vhdl/vhdl-prints.adb
@@ -4381,6 +4381,8 @@ package body Vhdl.Prints is
Disp_Psl_Assert_Directive (Ctxt, Expr);
when Iir_Kind_Psl_Assume_Directive =>
Disp_Psl_Assume_Directive (Ctxt, Expr);
+ when Iir_Kind_Psl_Restrict_Directive =>
+ Disp_Psl_Restrict_Directive (Ctxt, Expr);
when Iir_Kind_Error =>
declare
n149' href='#n149'>149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733
.. program:: ghdl
.. _USING:Invoking:

Invoking GHDL
#############

The form of the :program:`ghdl` command is ``ghdl command [options...]``. There are multiple available commands, but these general rules apply:

* The first argument selects the command. The options are used to slightly modify the action.
* No option is allowed before the command. Except for the run command, no option is allowed after a filename or a unit name.

.. HINT::
   If the number of options is large and the command line length is beyond the system limit, you can use a response file. An argument that starts with a ``@`` is considered as a response file; it is replaced by arguments read from the file (separated by blanks and end of line).

.. HINT::
   Only the most common commands and options are shown here. For the most advanced and experimental features see section :ref:`REF:Command`.

.. WARNING::
   During analysis and elaboration GHDL may read the ``std`` and ``ieee`` files. The location of these files is based on the prefix, which is (in order of priority):

	* the :option:`--PREFIX` command line option
	* the :envvar:`GHDL_PREFIX` environment variable
	* a built-in default path. It is a hard-coded path on GNU/Linux, and it corresponds to the value of the ``HKLM\Software\Ghdl\Install_Dir`` registry entry on Windows.

	You should use the :option:`--disp-config` command to display and debug installation problems.

Design building commands
========================

The most commonly used commands of GHDL are those to analyze and elaborate a design.


.. index:: cmd analysis

Analysis [``-a``]
---------------------

.. option:: -a <[options...] file...>

Analyzes/compiles one or more files, and creates an object file for each source file. Any argument starting with a dash is an option, the others are filenames. No options are allowed after a filename argument. GHDL analyzes each filename in the given order, and stops the analysis in case of error (remaining files are not analyzed).

See :ref:`GHDL:options`, for details on the GHDL options. For example, to produce debugging information such as line numbers, use: ``ghdl -a -g my_design.vhdl``.


.. index:: cmd elaboration

.. _Elaboration:command:

Elaboration [``-e``]
------------------------

.. option:: -e <[options...] primary_unit [secondary_unit]>

Re-analyzes all the configurations, entities, architectures and package declarations, and creates the default configurations and the default binding indications according to the LRM rules. It also generates the list of object files required for the executable. Then, it links all these files with the runtime library.

* The elaboration command, :option:`-e`, must be followed by a name of either:

	* a configuration unit
	* an entity unit
	* an entity unit followed by a name of an architecture unit

Name of the units must be a simple name, without any dot. You can select the name of the `WORK` library with the :option:`--work=NAME` option, as described in :ref:`GHDL:options`. See section :ref:`Top_entity`, for the restrictions on the root design of a hierarchy.

* If the GCC/LLVM backend was enabled during the compilation of GHDL, the elaboration command creates an executable containing the code of the VHDL sources, the elaboration code and simulation code to execute a design hierarchy. The executable is created in the current directory and the the filename is the name of the primary unit, or for the latter case, the concatenation of the name of the primary unit, a dash, and the name of the secondary unit (or architecture). Option :option:`-o` followed by a filename can override the default executable filename.

* If mcode is used, this command elaborates the design but does not generate anything. Since the run command also elaborates the design, this can be skipped.

  .. WARNING::
     This elaboration command is not a complete elaboration in terms of the VHDL standard. The actual elaboration is performed at runtime. Therefore, in order to get a complete VHDL elaboration without running the simulation, ``ghdl --elab-run --no-run`` is required.


.. index:: cmd run

Run [``-r``]
----------------

.. option:: -r <[options...] primary_unit [secondary_unit] [simulation_options...]>

Runs/simulates a design. The options and arguments are the same as for the :ref:`elaboration command <Elaboration_command>`.

* GGC/LLVM: simply, the filename of the executable is determined and it is executed. Options are ignored. You may also directly execute the program. The executable must be in the current directory.
* mcode: the design is elaborated and the simulation is launched. As a consequence, you must use the same options used during analysis.

This command exists for three reasons:

* You are using GCC/LLVM, but you don't need to create the executable program name.
* It is coherent with the :option:`-a` and :option:`-e` commands.
* It works with mcode implementation, where the executable code is generated in memory.

See section :ref:`USING:Simulation`, for details on options.


.. index:: cmd elaborate and run

Elaborate and run [``--elab-run``]
--------------------------------------

.. option:: --elab-run <[elab_options...] primary_unit [secondary_unit] [run_options...]>

Acts like the elaboration command (see :option:`-e`) followed by the run command (see :option:`-r`).


.. index:: cmd checking syntax

Check syntax [``-s``]
-------------------------

.. option:: -s <[options] files>

Analyze files but do not generate code. This command may be used to check the syntax of files. It does not update the library.


.. index:: cmd analyze and elaborate

Analyze and elaborate [``-c``]
----------------------------------

.. option:: -c <[options] file... -<e|r> primary_unit [secondary_unit]>

.. HINT::
   With GCC/LLVM, :option:`-e` should be used, and :option:`-r` with mcode.

The files are first parsed, and then a elaboration is performed, which drives an analysis. Effectively, analysis and elaboration are combined, but there is no explicit call to :option:`-a`. With GCC/LLVM, code is generated during the elaboration. With mcode, the simulation is launched after the elaboration.

All the units of the files are put into the `work` library. But, the work library is neither read from disk nor saved. Therefore, you must give all the files of the `work` library your design needs.

The advantages over the traditional approach (analyze and then elaborate) are:

* The compilation cycle is achieved in one command.
* Since the files are only parsed once, the compilation cycle may be faster.
* You don't need to know an analysis order.
* This command produces a smaller executable, since unused units and subprograms do not generate code.

.. HINT::
   However, you should know that most of the time is spent in code generation and the analyze and elaborate command generates code for all units needed, even units of ``std`` and ``ieee`` libraries. Therefore, according to the design, the time for this command may be higher than the time for the analyze command followed by the elaborate command.

.. WARNING::
   This command is still under development. In case of problems, you should go back to the traditional way.


Design rebuilding commands
==========================

Analyzing and elaborating a design consisting of several files can be tricky, due to dependencies. GHDL has a few commands to rebuild a design.


.. index:: cmd importing files

Import [``-i``]
-------------------

.. option:: -i <[options] file...>

All the files specified in the command line are scanned, parsed and added into the libraries but as not yet analyzed. No object files are created. Its purpose is to localize design units in the design files. The make command will then be able to recursively build a hierarchy from an entity name or a configuration name.

.. HINT::

	* Note that all the files are added to the work library. If you have many libraries, you must use the command for each library.
	* Since the files are parsed, there must be correct files. However, since they are not analyzed, many errors are tolerated by this command.

See :option:`-m`, to actually build the design.


.. index:: cmd make

Make [``-m``]
-----------------

.. option:: -m <[options] primary [secondary]>

Analyze automatically outdated files and elaborate a design. The primary unit denoted by the ``primary`` argument must already be known by the system, either because you have already analyzed it (even if you have modified it) or because you have imported it. A file may be outdated because it has been modified (e.g. you have just edited it), or because a design unit contained in the file depends on a unit which is outdated. This rule is of course recursive.

* With option :option:`--bind`, GHDL will stop before the final linking step. This is useful when the main entry point is not GHDL and you're linking GHDL object files into a foreign program.
* With option :option:`-f` (force), GHDL analyzes all the units of the work library needed to create the design hierarchy. Outdated units are recompiled. This is useful if you want to compile a design hierarchy with new compilation flags (for example, to add the *-g* debugging option).

The make command will only re-analyze design units in the work library. GHDL fails if it has to analyze an outdated unit from another library.

The purpose of this command is to be able to compile a design without prior knowledge of file order. In the VHDL model, some units must be analyzed before others (e.g. an entity before its architecture). It might be a nightmare to analyze a full design of several files if you don't have the ordered list of files. This command computes an analysis order.

The make command fails when a unit was not previously parsed. For example, if you split a file containing several design units into several files, you must either import these new files or analyze them so that GHDL knows in which file these units are.

The make command imports files which have been modified. Then, a design hierarchy is internally built as if no units are outdated. Then, all outdated design units, using the dependencies of the design hierarchy, are analyzed. If necessary, the design hierarchy is elaborated.

This is not perfect, since the default architecture (the most recently analyzed one) may change while outdated design files are analyzed. In such a case, re-run the make command of GHDL.


.. index:: cmd generate makefile

Generate Makefile [``--gen-makefile``]
--------------------------------------

.. option:: --gen-makefile <[options] primary [secondary]>

This command works like the make command (see :option:`-m`), but only a makefile is generated on the standard output.

.. index:: --gen-depends command

Generate dependency file command [``--gen-depends``]
----------------------------------------------------

.. option:: --gen-depends <[options] primary [secondary]>

Generate a Makefile containing only dependencies to build a design unit.

This command works like the make and gen-makefile commands (see :option:`-m`), but instead of a full makefile only dependencies without rules are generated on the standard output.
Theses rules can then be integrated in another Makefile.

.. _GHDL:options:

Options
=======

.. index:: IEEE 1164
.. index:: 1164
.. index:: IEEE 1076.3
.. index:: 1076.3

.. HINT:: Besides the options described below, `GHDL` passes any debugging options (those that begin with :option:`-g`) and optimizations options (those that begin with :option:`-O` or :option:`-f`) to `GCC`. Refer to the `GCC` manual for details.

.. index:: WORK library

.. option:: --work=<NAME>

  Specify the name of the ``WORK`` library. Analyzed units are always placed in the library logically named ``WORK``. With this option, you can set its name. By default, the name is ``work``.

  `GHDL` checks whether ``WORK`` is a valid identifier. Although being more or less supported, the ``WORK`` identifier should not be an extended identifier, since the filesystem may prevent it from working correctly (due to case sensitivity or forbidden characters in filenames).

  `VHDL` rules forbid you from adding units to the ``std`` library. Furthermore, you should not put units in the ``ieee`` library.

.. option:: --workdir=<DIR>

  Specify the directory where the ``WORK`` library is located. When this option is not present, the ``WORK`` library is in the current directory. The object files created by the compiler are always placed in the same directory as the ``WORK`` library.

  Use option :option:`-P` to specify where libraries other than ``WORK`` are placed.

.. option:: --std=<STD>

  Specify the standard to use. By default, the standard is ``93c``, which means VHDL-93 accepting VHDL-87 syntax. For details on ``STD`` values see section :ref:`VHDL_standards`.

.. option:: --ieee=<VER>

  .. index:: ieee library
  .. index:: synopsys library
  .. index:: mentor library

  Select the ``IEEE`` library to use. ``VER`` must be one of: