Vhdl-Ams Rules 2.0
Vhdl-Ams Rules 2.0
Vhdl-Ams Rules 2.0
Summary
The available proposal summarizes rules that should be considered in order to establish
consistent VHDL-AMS models for modeling and simulation of automotive systems. It is in-
tended to assure that the models are running inside different VHDL-AMS simulators and
models of different origin can be combined. The draft proposal outlines the results of discus-
sions of the Working Group “Simulation of Mixed Systems with VHDL-AMS” (VDA/FAT AK
30).
In the following, rules are specified that shall help to fulfill these expectations. It is distin-
guished between requirements and recommendations. A rule that is specified as a re-
quirement has to be kept without restrictions. This is necessary to assure that the documen-
tation can be generated automatically. A recommendation should be mentioned in order to
unify the layout of the models. This helps to make the models better readable. An example
of a VHDL-AMS model that considers rules is given in appendix G.
Modification History
Comments to
Joachim Haase
E-Mail: [email protected]
1 Objectives
It is intended to establish a library of VHDL-AMS models that describe aspects of automotive
systems. To guarantee a unified layout of the library some guidelines that should be consid-
ered are summarized in the following.
• commitments that were worked out by the working group AK 30 “Modeling and simu-
lation with VHDL-AMS” (ref. to appendices A, B, and C),
• documents that settle VHDL modeling [1-3],
• the SAE standard „Model Specification Process Standard“ [4],
• IEEE standards or standard proposals [5-6],
• special problems concerning the design of models discussed in the working group
AK 30 (current limitations of tools etc.)
The aim of this document is to support the development of VHDL-AMS models that can be
combined and correspond to each other easier.
R2.1-1 (Requirement): The models are compiled into logical libraries. The characteristics of
the libraries are explained in table 2.1-1.
The source code of the models, test benches and other appropriate files are stored in a spe-
cial structure of the file system that is given in appendix A. A subdivision of the libraries for
administration purposes is introduced in this way.
R2.2-1 (Requirement): The values of branch through and across quantites of conservative
systems are measured in SI units with respect to the corresponding nature declaration given
in [6].
In the case of nonconservative systems, a used unit has to be added as a comment after the
port quantity declaration if it makes sense (see section 3.2). To avoid inconsistencies the
rules summarized in table 2.2-1 must be considered.
Nature/Port Comments
THERMAL An external heat flow source is directed to the correspond-
ing node. The across quantity (temperature) is measured
in Kelvin.
TRANSLATIONAL An external force is modeled as a through source directed
TRANSLATIONAL_VELOCITY to the corresponding node.
Optical net Optical networks for data transmission are modeled by
nonconservative systems. The quantity port represents the
optical power that is measured in W.
Digital signals Digital signal ports belong to the type STD_LOGIC of the
IEEE package STD_LOGIC_1164. The index range of
array should be descending (… downto …).
Example
y F
F
x
x x
z
Note
It should be mentioned that inconsistencies can occur if models of different provenience shall
be combined [8]. This especially concerns the common usage of MAST models and VHDL-
AMS models that are established with respect to rule 2.2-1.
R3.1-1 (Requirement): The entity declaration should be organized in the following way:
entity ....
generic (
…
port (
…
begin
-- assert statements to check the scope of application of parameters
end entity entity_name;
Each declaration of a generic parameter or a port has to be done in a separate line. It should
be checked using assert statements whether the current values of parameters are in the
scope of application or not. Default values should be assigned to parameters.
Example
entity RESISTOR is
generic (
R : REAL := 1.0 -- resistance [Ohm], MIN: 0.0, MAX: INF
);
port (
terminal P : ELECTRICAL; -- plus terminal
terminal N : ELECTRICAL -- minus terminal
);
begin
assert R > 0.0
report “ERROR: Value R > 0.0 required.”
severity error;
end entity RESISTOR;
The real-valued signals have to be initialized in their declaration (Requirement). The state-
ments of an architecture should observe the following order:
Example
library IEEE;
use IEEE.MATH_REAL.all;
R3.1-3 (Recommendation): All reserved words in VHDL-AMS shall be written lower case.
User-defined identifiers shall be written upper case. Also identifiers of predefined packages
shall be written upper case.
Example
library IEEE;
use IEEE.MATH_REAL.all;
entity BENCH is end entity BENCH;
Example
PROGRAM_COUNTER
LEFT_DATA_BUS
R3.1-5 (Recommendation): Identifiers should be named in accordance with table 3.1-1 (see
appendix A). It should be avoided to use names that are reserved words in Verilog (see ap-
pendix D).
R3.1-6 (Recommendation): Design units should be stored in separate files. The file names
should be chosen in accordance with the following table [1].
3.2 Annotation
R3.2-1 (Requirement): The comments have to be in English. The code has to start and stop
with the disclaimers (see R3.2-2). The start disclaimer has to be followed by the introduc-
tionary comment. Other comments have to be placed ahead the concerning statement.
3.2.1 Disclaimer
R3.2-2 (Requirement): At the beginning of a VHDL-AMS model the first disclaimers given in
appendix B has to be included. It must be followed by the comment for the file header (see
Appendix C). The model description must end with the second disclaimer shown in Appendix
B.
Note
After the comment for the file header the introductionary comment must follow.
Note
The comments are used to generate the model documentation automatically. Thus, the rules
should be applied carefully to avoid problems during the generation of the documentation.
Explanations are given in table 3.2-1.
There are currently some known limitations of the generation tool. To avoid problems the
hints in Table 3.2-1 should be considered.
Purpose Description
Title The first line of the comment is interpreted as title. It must
end with a point (.)
Example
-- SPICE-like Model of a Resistor.
Note:
Avoid double quotes and points in the title.
Description After the title the description follows. It ends at the next
keyword that starts with an @.
Example
-- <p>The following context clause should
-- be included:</p>
-- <pre>
-- library IEEE;
-- use IEEE.MATH_REAL.all;
-- </pre>
@generic After this keyword the description the identifier of generic
parameter and its description may follow. The unit of the
parameter must be included in brackets [ ]. For the abbre-
viation of units see Table 3.2-3.
Example
-- @generic FBRAKE Braking force [N]
Note
• The identifier has to be written in the same way as it is
written in the VHDL-AMS code.
• Restrictions of parameters should be explained using
passive concurrent assert statements in the entity
declaration.
Example
-- @port EL_VCC Electrical terminal
Notes
• The identifier has to be written in the same way as it is
written in the VHDL-AMS code of the model.
• Directions in and out should be added using lower
letters to describe signal and quantity ports.
• Avoid squared brackets [ ] in the description.
@test The name of the file with the test.bench in the subdirectory
tb may follow (without .vhd extension).
Note
The structure of a model subdirectory is shown in Table
4.2-1.
Example
The model is saved in the file res.vhd in the subdirectory
src. The test-bench is saved in the corresponding subdi-
rectory in bench_res.vhd. Thus include in res.vhd
-- @test bench_res
@reference .The reference description should follow.
Example
-- @reference Isermann, R.:
-- Fahrdynamik-Regelung.
-- Vieweg-Verlag, 2006.
@author The name(s) of the authors may follow.
Notes:
• There are special rules to comment package headers (see section 3.6).
• The units of parameters should be used in accordance with the tables 3.2-2 to 3.2-4. Units
that are derived from basic units should be composed using the multiplication sign “*“ or
the power sign “^” (compare [6]).
Examples
Example
library EXAMPLE_ECAR;
library IEEE;
use IEEE.ELECTRICAL_SYSTEMS.all;
entity BATTERY is
generic (
SOC_0 : REAL := 0.71
);
port (
terminal EL : ELECTRICAL;
quantity SOC : out REAL
);
begin
assert (SOC_0 > 0.0);
assert (SOC_0 <= 1.0);
end entity BATTERY;
Example
constant VT : REAL := PHYS_K*AMBIENT_TEMPERATURE/PHYS_Q; -- temperature voltage
Example
-- Clock generator
CLOCK <= not CLOCK after 5 ns;
-- State Transition
process (CLOCK) is
begin
STATE <= NEW_STATE;
end process;
R3.3-1 (Requirement):The hints concerning the usage and design of error messages given
in table 3.3-1 have to be taken into account.
Error messages can be arranged using the assert or report statement. The messages should
be constructed in the following way:
• The message starts with the severity level in upper cases followed by a colon, e. g.
ERROR:
• A short description of the problem follows. This should not exceed one line.
• The full path name to the model using the attribute ´INSTANCE_NAME should be in-
cluded in the error message if possible.
The severity levels FAILURE and ERROR cause in general the termination of the simulation.
Warnings and hints should be applied economically.
R3.4-1 (Recommendation): VHDL-AMS source layout should consider the following rules:
Example
entity EXAMPLE is
generic (N: NATURAL -- number of elements in the array MIN: 0
);
port (S : out BIT_VECTOR (N downto 1) -- output of signal generator
);
end entity EXAMPLE;
• No space shall preceed the signs “(“, “)“, “;“ and “,“. No space shall surround a single
quote or dot.
3.5 Limitations
R3.5-1 (Requirement): In accordance with the current coverage of the VHDL-AMS language
by the implementation of different EDA vendors the language constructs given in table 3.5-1
should be avoided.
Note:
A real number can be converted to a number
of type TIME by multiplication with (1 sec):
wait for real_expression*(1 sec);
• break:
The definition of initial conditions using the break statement should be avoided.
The requirements concerning tool dependent restrictions will be updated from time to time.
3.6 Documentation
A HTML documentation will be generated. This is possible if the requirements from section 3
are taken into account. The HTML document contains a link to the associated source code.
• entity-Name
• Symbol
• Generic parameters with
o Identifier
o Typ
o Default-Wert
o Unit
o Description
o Assertions (if report is available)
• Ports
o Kind of (signal | terminal | quantity)
o Identifier
o Nature or type
o Mode (only for signal and quantity ports: in| out | inout)
o Description
• References
• Libraries and design units/design entities that support the model
3.6.2 Architecture
If entity and architectures are stored in the same file the descriptions (sections 3.6.1 and
3.6.2) are combined in one document. This is usually applied.
3.6.3 Package
• constants
• functions
that are declared in a package header (see Table 3.6-1).
Purpose Description
constant In front of a constant declaration add:
--/**
-- Headline that ends with.
-- Description
--
--*/
Example
--/**
-- Air density.
-- The value describes the air density.
--*/
--/**
-- Headline that ends with.
-- Description
--
-- @arg Identifier1 Description
-- @arg Identifier2 Description
-- @return Description of return value
--
--*/
Example
--/**
-- MIN Function.
-- The function determines the minimum
-- of two INTEGER numbers.
--
-- @arg VALUE_1 First argument
-- @arg VALUE_2 Second argument
-- @return Minimum of both values
--*/
The administration of the accounts is done by the SVN repository administrator. The respon-
sibility is appointed by the working group.
• a subdirectory libs that contains scripts and information concerning the compilation
of the libraries
• file <model>.vhd that contains the VHDL-AMS source code and follows the rules
given in this document
• file <model>.png that contains the symbol information
Note
A proposal for a general symbol format [13] that will replace the png files if supported by the
EDA vendors.
• <bench>.vhd with a (simple) testbench that demonstrates the usage of the model
• <bench>.jpg with results of testbench simulation
• README file that contains
- summary files that have to be compiled to run the testbench (i. e. a list of logical
target library identifiers and appropriate files)
- Spice commands that specify simulation parameters (HMIN, HMAX, EPS, …)
- description of output nets
These files have to be integrated in the SVN respository as shown in table 4.2-1. This inte-
gration can be done by the SubVersion repository administrator or the model developer.
Tool-dependent versions of the source code and the testbench or additional material can be
stored in subdirectories of src and tb. The names of the subdirectories are chosen w.r.t. the
tools in accordance to appendix E.
References
[1] Bergeron, J.: Guidelines for Writing VHDL Models in a Team Environment.
Available: http://www.eda.org/misc/ModelingGuidelines.paper.ps
[2] Creasey, R.; Coirault, R.: VHDL Modelling Guidelines. estec European Space Re-
search and Technology Centre, Issue 1, September 1994.
Available: http://www.eda.org/misc/esa.model.guidelines/ModelGuide.ps
[3] VHDL Modelling Guidelines. Simulation and Documentation Aspects.
Second Draft, 23 February 1997.
[4] Model Specification Process Standard. Surface Vehicle Standard SAE J 2546.
February 2002. Informationen verfügbar über (Suchwort J2546):
Available: http://www.sae.org
[5] IEEE Std. 1076.1: IEEE Standard VHDL Analog and Mixed-Signal Extensions.
Approved 15 November 2007.
Available (1999 version): http://www.designers-guide.com/Modeling/1076.1-1999.pdf
[6] IEEE Std. 1076.1.1: Standard VHDL Analog and Mixed-Signal Extensions –
Packages for Multiple Energy Domain Support. Approved 5 April 2005.
[7] Verilog-AMS Language Reference Manual: Analog & Mixed-Signal Extensions
to VerilogHDL, Version 2.2, November 2004. Accellera.
Available: http://www.designers-guide.com/VerilogAMS/VlogAMS-2.2-pub.pdf
[8] Fedder, G.: Issues in MEMS Macromodeling. Proc. 2003 Int. Workshop on Behavioral
Modeling and Simulation BMAS, October 7-8, 2003, San Jose, pp. 64-89.
Available: http://www.bmas-conf.org/2003/papers/bmas03-fedder.pdf
[9] Version Control System SubVersion
Available: http://subversion.tigris.org
[10] SubVersion client TortoiseSVN
Available : http://tortoisesvn.tigris.org
[11] Standardizaition of library blocks for graphical model exchange. Version 1.12.
Manufacturer Supplier Relationship (MSR) Working group.
Available: http://www.msr-wg.de/megma/downlo.html
[12] Modelica Libraries.
Available : http://www.modelica.org/libraries
[13] Symbol Exchange with SVG (Version 10, January 24, 2008)
URL: http://fat-ak30.eas.iis.fraunhofer.de/exchange/index_de.html
Appendix A
magnetics
mechanics
position_force
translational
rotational
transducer energy transducer (translational↔rotational)
velocity_force
translational_v
rotational_v
transducer_v energy transducer (translational↔rotational)
thermal
hydraulics
pneumatics
acoustics
optics
transducer Energy transducer for physical domains
(simple models of heterogeneous systems like motor, ...)
control_systems time-continous transfer blocks
discrete_systems time-discrete transfer blocks
digital_systems digital blocks (gates, flip flops etc.)
data_conversion conversion between different waveform representations
a2s_vda converter (analog quantities to signals)
s2a_vda converter (signals to analog quantities)
s2s_vda converter (conversion between different signal
representations)
time_sources time continous waveform generators (non-conservative)
functions characteristics, sets of characteristic curves
table_look_up
algorithm e. g. mathematical functions
preliminary non standard packages
In general, an identifier consists of the first two letters of the corresponding domain followed
by an underscore and a number if it makes sense. An exception should be made in the case
of mechanical terminals. The first letter is an “M”. The second letter is either a “T” (transla-
tional) or an “R” (rotational). The third letter is a “V” if the velocity-force-analogy is used.
signals (time-discrete)
Appendix B
Disclaimer for File Header
-------------------------------------------------------------------------------
-- Copyright (c) 2004 VDA / FAT
--
-- This model is a component of the open source library created by the VDA / FAT
-- working group number 30 and is covered by this license agreement .
-- This model including any updates, modifications, revisions, copies, and
-- documentation are copyrighted works of the VDA / FAT.
-- USE OF THIS MODEL INDICATES YOUR COMPLETE AND
-- UNCONDITIONAL ACCEPTANCE OF THE TERMS AND CONDITIONS
-- SET FORTH IN THIS LICENSE AGREEMENT.
-- The VDA / FAT grants a non-exclusive license to use, reproduce,
-- modify and distribute this model under the condition, that:
-- (a) no fee or other consideration is charged for any distribution except
-- compilations distributed in accordance with Section (d) of this license
-- agreement
-- (b) the comment text embedded in this model is included verbatim
-- in each copy of this model made or distributed by you, whether or not such
-- version is modified
-- (c) any modified version must include a conspicuous
-- notice that this model has been modified and the date of modification; and
-- (d) any compilations sold by you that include this model must include a
-- conspicuous notice that this model is available from the VDA / FAT in its
-- original form at no charge.
--
-- THIS MODEL IS LICENSED TO YOU "AS IT IS" AND WITH NO WARRANTIES,
-- EXPRESSED OR IMPLIED. THE VDA / FAT AND ALL COMPANIES CONTRIBUTING
-- TO THIS LIBRARY SPECIFICALLY DISCLAIM ALL IMPLIED WARRANTIES OF
-- MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
-- THE VDA / FAT AND ALL COMPANIES ORGANIZED WITHIN MUST NOT
-- HAVE ANY RESPONSIBILITY FOR ANY DAMAGES, FINANCIAL OR LEGAL CLAIMS
-- WHATEVER.
-------------------------------------------------------------------------------
Appendix C
Comment for File Header
-- ----------------------------------------------------------------
-- Source:
-- <File name>
--
-- Development simulator:
-- <Simulator and version>
--
-- Tested on:
-- ------------------------------------------------------------------
-- Model Vers. Simulator Version OS Validator Date
-- ------------------------------------------------------------------
-- 1.0 …
--
-- Modification History:
-- ------------------------------------------------------------------
-- Version Author Date Description
-- ------------------------------------------------------------------
-- 1.0 N.N. ...... Original version
--
--
--
--
-- ------------------------------------------------------------------
-- $Version$
-- $Revision$
-- $Date$
-- $Author$
-- ------------------------------------------------------------------
Notes
Marker Description
-- Source: Name of the file with the model.
-- Development simulator:Simulator name follows in the next line.
-- Tested on: The description of the validation of the model has to be
-- ----------------------done in accordance with appendix C. The comment starts
-- Model Version … ....
-- ----------------------in the next line:
- Version of the model
- Simulator
- Simulator Version
- Operating system (version, release)
- Validator
- Date in the form YYYY/MM/DD
-- Modification History: The description of the modification history of the model
-- ----------------------- has to be done in accordance with appendix C. The com-
-- Logical Library ....
-- ----------------------- ment starts in the next line:
- Version of the model
- Author of the model
- Date in the form YYYY/MM/DD
- Comment
-- ----------------------- Variables for version control
-- $Id$
-- -----------------------
Appendix D
Reserved Words in VHDL-AMS [5]
Appendix E
Subdirectory Names
Appendix F
Administration of Models
Generation of tool-dependent
libraries by the EDA vendors
AK 30
Feedback
To author Feedback to
one AK address
Appendix G
VHDL-AMS Model Example
-- ----------------------------------------------------------------------------
-- Copyright (C) 2004-2006 VDA/FAT
--
-- This model is a component of the open source library created by the VDA/FAT
-- working group number 30 and is covered by this license agreement. This model
-- including any updates, modifications, revisions, copies, and documentation
-- are copyrighted works of the VDA/FAT. Use of this model indicates your
-- complete and unconditional acceptance of the terms and conditions set forth
-- in this license agreement.
--
-- The VDA/FAT grants a non-exclusive license to use, reproduce, modify and
-- distribute this model under the condition, that:
-- (a) no fee or other consideration is charged for any distribution except
-- compilations distributed in accordance with Section (d) of this license
-- agreement;
-- (b) the comment text embedded in this model is included verbatim in each
-- copy of this model made or distributed by you, whether or not such
-- version is modified;
-- (c) any modified version must include a conspicuous notice that this model
-- has been modified and the date of modification; and
-- (d) any compilations sold by you that include this model must include a
-- conspicuous notice that this model is available from the VDA/FAT in
-- its original form at no charge.
--
-- THIS MODEL IS LICENSED TO YOU "AS IT IS" AND WITH NO WARRANTIES, EXPRESSED
-- OR IMPLIED. THE VDA/FAT AND ALL COMPANIES CONTRIBUTING TO THIS LIBRARY
-- SPECIFICALLY DISCLAIM ALL IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS
-- FOR A PARTICULAR PURPOSE. THE VDA/FAT AND ALL COMPANIES ORGANIZED WITHIN
-- MUST NOT HAVE ANY RESPONSIBILITY FOR ANY DAMAGES, FINANCIAL OR LEGAL CLAIMS
-- WHATEVER.
-- ------------------------------------------------------------------------
-- Source:
-- capacitor.vhd
--
-- Development simulator:
-- SimulatorA
--
-- Tested on:
-- ------------------------------------------------------------------
-- Version Simulator Version OS Validator Date
-- ------------------------------------------------------------------
-- 1.1 SimulatorA 1.0 W2000 Mustermann_1 2004/07/05
-- 1.1 SimulatorB 4.1 W2000 Mustermann_2 2005/01/10
--
-- Modification History:
-- ------------------------------------------------------------------
-- Version Author Date Description
-- ------------------------------------------------------------------
-- 1.1 Mustermann_3 2004/07/05 Original Version
--
--
-- ----------------------------------------------------------------------------
-- $Version: 2.0.0 $
-- $Revision: 2135 $
-- $Date: 2007-05-14 16:35:43 +0200 (Mo, 14 Mai 2007) $
-- $Author: andre $
-- ----------------------------------------------------------------------------
--/**
--
-- Spice Capacitor Model.
-- The model describes an ideal capacitor in the same way as in Spice
-- (SPICE3 Version 3f3 User's Manual 3.1.5).
--
-- @generic C capacitance [F]
-- @generic IC (optional) initial condition [V]
--
-- @port P plus terminal
-- @port N minus terminal
--
-- @library SPICE2VHD
-- @structure general/basic
-- @test basic_test
library IEEE;
use IEEE.ELECTRICAL_SYSTEMS.all;
entity CAPACITOR is
generic (
C : REAL;
IC : REAL := REAL'LOW
);
port (
terminal P : ELECTRICAL;
terminal N : ELECTRICAL
);
end entity CAPACITOR;
-- ------------------------------------------------------------------------
-- Copyright (C) 2004-2006 VDA/FAT
-- ------------------------------------------------------------------------