- ENSEIRB - E2 - STAGE CCI -

Travaux Pratiques
de
VHDL
Patrice Kadionik

Septembre 1999

barre.gif (2311 octets)

I. OBJECTIFS DU TP

Prise en main de l’environnement VHDL Mentor (ModelSim) :

- les principales commandes.

- l’environnement de simulation.

- simulation (approches structurelle, comportementale et flot de données).

II. LES PRINCIPALES COMMANDES

Voici les principales commandes que vous aurez à utiliser durant ce stage VHDL.

Lors de la description des principales commandes UNIX, il faut noter que les paramètres entre crochets [] sont facultatifs.

1. Création d’une bibliothèque de travail :

% vlib nom_bibliotheque_de_travail

Exemples :

Création de la bibliothèque "work" dans le répertoire courant.

% vlib work

2. Association nom logique path d’une bibliothèque :

% vmap [nom_logique_bibliotheque] [path_de_la_bibliotheque]

Exemples :

Liste des associations nom logique/path des bibliothèques valides.

% vmap
Reading modelsim.ini
Reading /net/modeltech/bin/../sunos5/../modelsim.ini
"std" maps to directory /net/modeltech/bin/../sunos5/../std.
"ieee" maps to directory /net/modeltech/bin/../sunos5/../ieee.
"verilog" maps to directory /net/modeltech/bin/../sunos5/../verilog.
"arithmetic" maps to directory /net/modeltech/bin/../sunos5/../arithmetic.
"mgc_portable" maps to directory /net/modeltech/bin/../sunos5/../mgc_portable.
"std_developerskit" maps to directory /net/modeltech/bin/../sunos5/../std_developerskit.
"synopsys" maps to directory /net/modeltech/bin/../sunos5/../synopsys.
"logiblox" maps to directory /net/xilinx/mentor/data/vhdl/logiblox.
"simprim" maps to directory /net/xilinx/mentor/data/vhdl/simprim.
"unisim" maps to directory /net/xilinx/mentor/data/vhdl/unisim.
"unisim_5k" maps to directory /net/xilinx/mentor/data/vhdl/unisim_5k.

3. Liste des Unités de Conception primaires d’une bibliothèque :

% vdir [-l] [-lib path] [UC_primaire]

Exemples :

Liste des UC primaires de la bibliothèque work (par défaut).

% vdir

ENTITY counter

Liste verbeuse des UC primaires de la bibliothèque work (par défaut).

% vdir -l
ENTITY memoire_rs
Source modified time: 937574476
Source file: /a/rackham/home3/ens/kadionik/vhdl/rs.vhd
Version number: Pf_[C1AaaDUGAEIDKL>2K3
Opcode format: 5.2a; VCOM Object Version 13

Liste des architectures de l’UC primaire counter (entité) de la bibliothèque work (par défaut).

% vdir counter
ENTITY counter
ARCH only

4. Effacement d’une UC primaire d’une bibliothèque :

% vdel [-lib path] [-v] UC_primaire [UC_secondaire]

Exemples :

Effacement de l’UC primaire counter (entité) de la bibliothèque work (par défaut).

% vdel counter

Effacement de l’UC secondaire only (architecture) de l’UC primaire counter (entité) de la bibliothèque work (par défaut).

% vdel counter only

5. Compilation de fichiers sources VHDL :

% vcom [options] files
Options: -help Print this message
-work path Specify library WORK
-line # Specify starting line number
-source Print the source line with error messages
-nodebug Do not put symbolic debugging information into library
-quiet Disable 'loading' messages
-refresh Refresh library image from .dat file(s)
-f path Specify file with more command line arguments
-nologo Disable startup banner
-O0 Disable optimizations
-O4 Enable all optimizations (default)
-s Do not load standard
-nowarn # Do not flag warnings for the warning number specified.
-nocheck Disables run-time range checks
-no1164 Disables optimization for the std_logic_1164 package
-novital Disables all VITAL optimizations
-novitalcheck Disables VITAL Level 1 compliance checking, and optimizations
-noaccel pname Disables optimization for package pname
-explicit Resolve resolution conflicts in favor of explicit functions
-check_synthesis Check for compliance to some synthesis rules
-93 Enable support for 1076-93
-87 Disable support for 1076-93
-just eapbc Compile only selected design unit kinds
(e=entity, a=arch, p=package, b=body, c=config)
-skip eapbc Compile all but selected design unit kinds
(e=entity, a=arch, p=package, b=body, c=config)
- Indicates end of optional arguments

Exemples :

Compilation du fichier source rs.vhd.

% vcom rs.vhd
// ModelSim EE 5.2a Sep 15 1998 SunOS 5.7
//
// Copyright (c) Mentor Graphics Corporation, 1982-1998, All Rights Reserved.
// UNPUBLISHED, LICENSED SOFTWARE.
// CONFIDENTIAL AND PROPRIETARY INFORMATION WHICH IS THE
// PROPERTY OF MENTOR GRAPHICS CORPORATION OR ITS LICENSORS.
//
// Copyright (c) Model Technology Incorporated 1990-1998, All Rights Reserved.
//
-- Loading package standard
-- Compiling entity memoire_rs
-- Compiling architecture processus of memoire_rs

6. Lancement du simulateur VHDL :

% vsim [options] [bibliothèque] UC_primaire [architecture]
-help Print this message
-t [1|10|100]fs|ps|ns|us|ms|sec Time resolution limit
(VHDL default: resolution setting from .ini file)
(Verilog default: minimum time_precision in the design)
-c Command line mode
-i Force interactive mode
-l <filename> Write simulation log to <filename> (default: transcript)
-f <filename> Read command line arguments from <filename>
-lib <libname> Load top-level design units from <libname> (default: work)
-do "<command>" Execute <command> on startup; <command> may be macro filename
-title Optional title for the transcript window
-keepstdout Do not redirect stdout to transcript window
-view <filename> View the contents of the event log file
-wav <filename> Specify the name of the event log file (default: vsim.wav)
-restore <filename> Restore simulation from previous checkpoint
-nocompress In conjuction with -restore, if compression was off
-trace_foreign <n> Set foreign interface/PLI tracing to level <n>
-tag <string> Set tag for foreign interface/PLI tracing to <string>
+notimingchecks Disable Verilog and VITAL timing checks
+no_tchk_msg Disable timing constraint error messages
+no_glitch_msg Disable glitch error messages
+no_notifier Disable notifier toggling for timing constraint violations
-sdfnowarn Disable warnings from SDF annotator
-sdfnoerror Treat SDF errors as warnings
-sdfmin [<instance>=]<sdffile> Annotate VITAL or Verilog <instance> with
minimum timing from <sdffile>
-sdftyp [<instance>=]<sdffile> Annotate VITAL or Verilog <instance> with
typical timing from <sdffile>
-sdfmax [<instance>=]<sdffile> Annotate VITAL or Verilog <instance> with
maximum timing from <sdffile>
-multisource_delay min|max|latest Controls annotation of SDF INTERCONNECT
construct (default: max)
-quiet Don't report 'Loading...' messages
-lic_plus Immediately reserve a VHDL and Verilog license
-lic_nomgc Do not look for Mentor Graphics Licenses
-lic_nomti Do not look for Model Technology Licenses
-lic_noqueue Do not wait in the license queue when a license isn't available
-g<Name=value> Specify generic Value for Name
-G<Name=value> Override generic with specified Value
-vcdread <filename> Stimulate the VHDL top-level design from a VCD file
-std_input <filename> Use filename for VHDL textio STD_INPUT file
-std_output <filename> Use filename for VHDL textio STD_OUTPUT file
-foreign <filename> Load foreign module
-vital2.2b Select SDF mapping for VITAL 2.2b (default: VITAL 95)
-noglitch Disable VITAL glitch generation
-strictvital Sacrifice performance for strict VITAL compliance
-lic_vhdl Immediately reserve a VHDL license

Exemples :

Lancement du simulateur (choix des UC par menu ensuite).

% vsim

Lancement du simulateur pour l’UC primaire counter (entité) et l’UC secondaire only (architecture).

% vsim counter only

III. FICHIER DE CONFIGURATION quickhdl.ini

Le fichier de configuration s’appelle modelsim.ini. Ce fichier est lu lors du lancement du simulateur (commande vsim) pour initialiser son environnement :

- PATH des bibliothèques, position des fenêtres, résolution par défaut...

Il est possible d’éditer alors ce fichier (fichier de format ASCII) pour configurer le simulateur à son application.

Les champs particulièrement intéressants sont :

- paragraphe Resolution : choix de la résolution par défaut du simulateur.

- paragraphe RunLength : durée par défaut de la simulation.

- paragraphe BreakOnAssertion : arrêt du simulateur sur clause ASSERT avec choix de la sévérité.

- paragraphe Startup : nom du fichier de commandes TCL exécuté au démarrage.

Ces différents paragraphes pourront être modifiés pour coller au mieux à un projet VHDL en s’évitant ainsi toutes les étapes de configuration à l’aide des menus du simulateur ensuite ; d’où un gain de temps appréciable.

IV. AIDE EN LIGNE

Vous avez toujours accès à l’aide en ligne à partir du simulateur vsim, menu Help.

Les documents se trouvent sous /opt/modeltech/docs au format PDF

Vous avez aussi accès au newsgroup du VHDL : comp.lang.vhdl

Et à la page de Modeltech : www.model.com

V. PRINCIPAUX CHANGEMENTS DE MODELSIM PAR RAPPORT A LA DERNIERE RELEASE

Les principaux changements entre la release courante de ModelSim et la précédente qui s'appelait QuickVHDL concernent essentiellement les noms des commandes UNIX :

Les anciennes commandes sont toujours utilisables (voir sous /opt/modeltech/bin).

Il est possible maintenant dans ModelSim d'éditer le source VHDL et de le compiler contrairement à l'ancienne version.