⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 1076_4.html

📁 basic exemple. Do an ADD of two 4 bits numbers
💻 HTML
📖 第 1 页 / 共 5 页
字号:
         | <i>parameter</i>_name

     actual_part ::=
           actual_designator
         | <i>function</i>_name ( actual_designator )
         | type_mark ( actual_designator )

     actual_designator ::=
           expression
         | <i>signal</i>_name
         | <i>variable</i>_name
         | <i>file</i>_name
         | <b>open</b>
</pre>
<p>Each association element in an association list associates one actual designator with the corresponding interface element in the interface list of a subprogram declaration, component declaration, entity declaration, or block statement.  The corresponding interface element is determined either by position or by name.
<p>An association element is said to be <i>named</i> if the formal designator appears explicitly; otherwise, it is said to be <i>positional</i>.  For a positional association, an actual designator at a given position in an association list corresponds to the interface element at the same position in the interface list.
<p>Named associations can be given in any order, but if both positional and named associations appear in the same association list, then all positional associations must occur first at their normal position.  Hence once a named association is used, the rest of the association list must use only named associations.
<p>In the following, the term <i>actual</i> refers to an actual designator, and the term <i>formal</i> refers to a formal designator.
<p>The formal part of a named element association may be in the form of a function call, where the single argument of the function is the formal designator itself, if and only if the mode of the formal is <b>out</b>, <b>inout</b>,<b>buffer</b>, or <b>linkage</b>, and if the actual is not <b>open</b>.  In this case, the function name must denote a function whose single parameter is of the type of the formal and whose result is the type of the corresponding actual.  Such a <i>conversion function</i> provides for type conversion in the event that data flows from the formal to the actual.
<p>Alternatively, the formal part of a named element association may be in the form of a type conversion, where the expression to be converted is the formal designator itself, if and only if the mode of the formal is <b>out</b>,<b>inout</b>, <b>buffer</b>, or <b>linkage</b>, and if the actual is not <b>open</b>.  In this case, the base type denoted by the type mark must be the same as the base type of the corresponding actual.  Such a type conversion provides for type conversion in the event that data flows from the formal to the actual.  It is an error if the type of the formal is not closely related to the type of the actual. (See   <a href = "1076_7.HTM#7.3.5"> 7.3.5 </a>  .)
<p>Similarly, the actual part of a (named or positional) element association maybe in the form of a function call, where the single argument of the function is the actual designator itself, if and only if the mode of the formal is <b>in</b>, <b>inout</b>, or <b>linkage</b>, and if the actual is not <b>open</b>.  In this case, the function name must denote a function whose single parameter is of the type of the actual, and whose result is the type of the corresponding formal.  In addition, the formal must not be of class <b>constant</b> for this interpretation to hold (the actual is interpreted as an expression that is a function call if the class of the formal is <b>constant</b>).  Such a conversion function provides for type conversion in the event that data flows from the actual to the formal.
<p>Alternatively, the actual part of a (named or positional) element association may be in the form of a type conversion, where the expression to be type converted is the actual designator itself, if and only if the mode of the formal is <b>in</b>, <b>inout</b>, or <b>linkage</b>, and if the actual is not <b>open</b>.  In this case, the base type denoted by the type mark must be the same as the base type of the corresponding formal.  Such a type conversion provides for type conversion in the event that data flows from the actual to the formal.  It is an error if the type of the actual is not closely related to the type of the formal.
<p>The type of the actual (after applying the conversion function or type conversion, if present in the actual part) must be the same as the type of the corresponding formal, if the mode of the formal is <b>in</b>, <b>inout</b>, or <b>linkage</b>, and if the actual is not <b>open</b>.  Similarly, if the mode of the formal is <b>out</b>, <b>inout</b>, <b>buffer</b>, or <b>linkage</b>, and if the actual is not <b>open</b>, then the type of the formal (after applying the conversion function or type conversion, if present in the formal part) must be the same as the corresponding actual.
<p>For the association of signals with corresponding formal ports, association of a formal of a given composite type with an actual of the same type is equivalent to the association of each scalar subelement of the formal with the matching subelement of the actual, provided that no conversion function or type conversion is present in either the actual part or the formal part of the association element.  If a conversion function or type conversion is present,then the entire formal is considered to be associated with the entire actual.
<p>Similarly, for the association of actuals with corresponding formal subprogram parameters, association of a formal parameter of a given composite type with an actual of the same type is equivalent to the association of each scalar subelement of the formal parameter with the matching subelement of the actual.  Different parameter passing mechanisms may be required in each case, but in both cases the associations will have an equivalent effect.  This equivalence applies provided that no actual is accessible by more than one path (see  <a href = "1076_2.HTM#2.1.1.1"> 2.1.1.1 </a>  ).
<p>A formal may be either an explicitly declared interface object or member (see  <a href = "1076_3.HTM"> Section 3</a>)  of such an interface object.  In the former case,such a formal is said to be <i>associated in whole</i>.  In the latter cases,named association must be used to associate the formal and actual; the subelements of such a formal are said to be <i>associated individually</i>.  Furthermore, every scalar subelement of the explicitly declared interface object must be associated exactly once with an actual (or subelement thereof)in the same association list, and all such associations must appear in a contiguous sequence within that association list.  Each association element that associates a slice or subelement (or slice thereof) of an interface object must identify the formal with a locally static name.
<p>If an interface element in an interface list includes a default expression fora formal generic, for a formal port of any mode other than <b>linkage</b>, or for a formal variable or constant parameter of mode <b>in</b>, then any corresponding association list need not include an association element for that interface element.  If the association element is not included in the association list, or if the actual is <b>open</b>, then the value of the default expression is used as the actual expression or signal value in an implicit association element for that interface element.
<p>It is an error if an actual of <b>open</b> is associated with a formal that is associated individually.  An actual of <b>open</b> counts as the single association allowed for the corresponding formal but does not supply a constant, signal, or variable (as is appropriate to the object class of the formal) to the formal.

<h4>NOTES</h4>
<p>1--It is a consequence of these rules that, if an association element is omitted from an association list in order to make use of the default expression on the corresponding interface element, all subsequent association elements in that association list must be named associations.
<p>2--Although a default expression can appear in an interface element that declares a (local or formal) port, such a default expression is not interpreted as the value of an implicit association element for that port.  Instead, the value of the expression is used to determine the effective value of that port during simulation if the port is left unconnected (see   <a href = "1076_12.HTM#12.6.2"> 12.6.2 </a>  ).
<p>3--Named association may not be used when invoking implicitly defined operations, since the formal parameters of these operators are not named (see   <a href = "1076_7.HTM#7.2"> 7.2 </a>  ).
<p>4--Since information flows only from the actual to the formal when the mode of the formal is <b>in</b>, and since a function call is itself an expression, the actual associated with a formal of object class <b>constant</b> is never interpreted as a conversion function or a type conversion converting an actual designator that is an expression.  Thus, the following association element is legal:
<pre>     Param => F (<b>open</b>)
</pre>
<p>under the conditions that Param is a constant formal and F is a function returning the same base type as that of Param and having one or more parameters, all of which may be defaulted.
<p>5--No conversion function or type conversion may appear in the actual part when the actual designator is <b>open</b>.
<h3><a name="4.3.3">  <a href = "1076_4.HTM#4.3.3"> 4.3.3 </a>   Alias declarations</a></h3>
<p>An alias declaration declares an alternate name for an existing named entity.
<pre>     alias_declaration ::=
          <b>alias</b> alias_designator [ : subtype_indication ] <b>is</b> name [ signature ] ;

     alias_designator ::=  identifier | character_literal | operator_symbol
</pre>
<p>An <i>object alias</i> is an alias whose alias designator denotes an object (that is, a constant, a variable, a signal, or a file).  A <i>nonobject alias</i> is an alias whose alias designator denotes some named entity other than an object.  An alias can be declared for all named entities except for labels, loop parameters, and generate parameters.
<p>The alias designator in an alias declaration denotes the named entity specified by the name and, if present, the signature in the alias declaration.  An alias of a signal denotes a signal; an alias of a variable denotes a variable; an alias of a constant denotes a constant; and an alias of a file denotes a file.  Similarly, an alias of a subprogram (including an operator) denotes a subprogram, an alias of an enumeration literal denotes an enumeration literal,and so forth.

<h4>NOTES</h4>
<p>1--Since, for example, the alias of a variable is a variable, every reference within this document to a designator (a name, character literal, or operator symbol) that requires the designator to denote a named entity with certain characteristics (for example, to be a variable) allows the designator to denote an alias, so long as the aliased name denotes a named entity having the required characteristics.  This situation holds except where aliases are specifically prohibited.
<p>2--The alias of an overloadable object is itself overloadable.
<h4><a name="4.3.3.1">  <a href = "1076_4.HTM#4.3.3.1"> 4.3.3.1 </a>   Object aliases</a></h4>
<p>The following rules apply to object aliases:
<ol type="a">
<li>A signature may not appear in a declaration of an object alias.
<li>The name must be a static name (see   <a href = "1076_6.HTM#6.1"> 6.1 </a>  ) that denotes an object.  The base type of the name specified in an alias declaration must be the same as the base type of the type mark in the subtype indication (if the subtype indication is present); this type must not be a multi-dimensional array type.  When the object denoted by the name is referenced via the alias defined by the alias declaration, the following rules apply:
</ol>
<ul>
<p>--  If the subtype indication is absent or if it is present and denotes an unconstrained array type:
<ul>
<p>--  If the alias designator denotes a slice of an object, then the subtype of the object is viewed as if it were of the subtype specified by the slice
<p>--  Otherwise, the object is viewed as if it were of the subtype specified in the declaration of the object denoted by the name
</ul>
<p>--  If the subtype indication is present and denotes a constrained array subtype, then the object is viewed as if it were of the subtype specified by the subtype indication; moreover, the subtype denoted by the subtype indication must include a matching element (see   <a href = "1076_7.HTM#7.2.2"> 7.2.2 </a>  ) for each element of the object denoted by the name;
<p>--  If the subtype indication denotes a scalar subtype, then the object is viewed as if it were of the subtype specified by the subtype indication;moreover, it is an error if this subtype does not have the same bounds and direction as the subtype denoted by the object name.
</ul>
<ol type="a">
<li>The same applies to attribute references where the prefix of the attribute name denotes the alias.
<p>
<li>A reference to an element of an object alias is implicitly a reference to the matching element of the object denoted by the alias.  A reference to a slice of an object alias consisting of the elements e<sub>1</sub>, e<sub>2</sub>, ..., e<sub>n</sub> is implicitly a reference to a slice of the object denoted by the alias consisting of the matching elements corresponding to each of e<sub>1</sub> through e<sub>n</sub>.
</ol>
<h4><a name="4.3.3.2">  <a href = "1076_4.HTM#4.3.3.2"> 4.3.3.2 </a>   Nonobject aliases</a></h4>
<p>The following rules apply to nonobject aliases:
<ol type="a">
<li>A subtype indication may not appear in a nonobject alias.
<p>
<li>A signature is required if the name denotes a subprogram (including an operator) or enumeration literal.  In this case, the signature is required to match (see   <a href = "1076_2.HTM#2.3"> 2.3 </a>  ) the parameter and result type profile of exactly one of the subprograms or enumeration literals denoted by the name.
<p>
<li>If the name denotes an enumeration type, then one implicit alias declaration for each of the literals of the type immediately follows the alias declaration for the enumeration type; each such implicit declaration has, as its alias designator, the simple name or character literal of the literal and has, as its name, a name constructed by taking the name of the alias for thee numeration type and substituting the simple name or character literal being aliased for the simple name of the type.  Each implicit alias has a signature that matches the parameter and result type profile of the literal being aliased.
<p>
<li>Alternatively, if the name denotes a physical type, then one implicitali as declaration for each of the units of the type immediately follows the alias declaration for the physical type; each such implicit declaration has, as its name, a name constructed by taking the name of the alias for the physical type and substituting the simple name of the unit being aliased for the simple name of the type.
<p>
<li>Finally, if the name denotes a type, then implicit alias declarations for each predefined operator for the type immediately follow the explicit alias declaration for the type and, if present, any implicit alias declarations for literals or units of the type.  Each implicit alias has a signature that matches  the parameter and result type profile of the implicit operator being aliased.
</ol>
<p><i>Examples:</i>
<pre>     <b>variable</b> REAL_NUMBER : BIT_VECTOR (0 <b>to</b> 31);

     <b>alias</b> SIGN : BIT <b>is</b> REAL_NUMBER (0);
         -- SIGN is now a scalar (BIT) value

     <b>alias</b> MANTISSA : BIT_VECTOR (23 <b>downto</b> 0) <b>is</b> REAL_NUMBER (8 <b>to</b> 31);
         -- MANTISSA is a 24b value whose range is 23 <b>downto</b> 0.
         -- Note that the ranges of MANTISSA and REAL_NUMBER (8 <b>to</b> 31)
         -- have opposite directions.  A reference to MANTISSA (23 <b>downto</b> 18)
         -- is equivalent to a reference to REAL_NUMBER (8 <b>to</b> 13).

     <b>alias</b> EXPONENT : BIT_VECTOR (1 <b>to</b> 7) <b>is</b> REAL_NUMBER (1 <b>to</b> 7);
          -- EXPONENT is a 7-bit value whose range is 1 <b>to</b> 7.

     <b>alias</b> STD_BIT   <b>is</b> STD.STANDARD.BIT;                 --   explicit alias

     --  <b>alias</b> '0'   <b>is</b> STD.STANDARD.'0'        --   implicit aliases ...
     --                         [<b>return</b> STD.STANDARD.BIT];
     -- <b>alias</b> '1'   <b>is</b> STD.STANDARD.'1'
     --                         [<b>return</b> STD.STANDARD.BIT];
     -- <b>alias</b> "and" <b>is</b> STD.STANDARD."and"
     --                     [STD.STANDARD.BIT, STD.STANDARD.BIT
     --                         <b>return</b> STD.STANDARD.BIT];
     -- <b>alias</b> "or"  <b>is</b> STD.STANDARD."or"
     --                     [STD.STANDARD.BIT, STD.STANDARD.BIT
     --                         <b>return</b> STD.STANDARD.BIT];
     -- <b>alias</b> "nand" <b>is</b> STD.STANDARD."nand"
     --                     [STD.STANDARD.BIT, STD.STANDARD.BIT

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -