?? 1076_4.html
字號:
<b>file</b> F2: IntegerFile <b>is</b> "test.dat"; -- At elaboration, an implicit call is performed:
-- FILE_OPEN (F2, "test.dat");
-- The OPEN_KIND parameter defaults to
-- READ_MODE.
<b>file</b> F3: IntegerFile <b>open</b> WRITE_MODE <b>is</b> "test.dat";
-- At elaboration, an implicit call is performed:
-- FILE_OPEN (F3, "test.dat", WRITE_MODE);
</pre>
<p>NOTE--All file objects associated with the same external file should be of the same base type.
<h3><a name="4.3.2"> <a href = "1076_4.HTM#4.3.2"> 4.3.2 </a> Interface declarations</a></h3>
<p>An interface declaration declares an <i>interface object</i> of a specified type. Interface objects include <i>interface constants</i> that appear as generics of a design entity, a component, or a block, or as constant parameters of subprograms; <i>interface signals</i> that appear as ports of a design entity, component, or block, or as signal parameters of subprograms;<i>interface variables</i> that appear as variable parameters of subprograms; and <i>interface files</i> that appear as file parameters of subprograms.
<pre> interface_declaration ::=
interface_constant_declaration
| interface_signal_declaration
| interface_variable_declaration
| interface_file_declaration
interface_constant_declaration ::=
[<b>constant</b>] identifier_list : [<b> in </b>] subtype_indication [ := <i>static</i>_expression ]
interface_signal_declaration ::=
[<b>signal</b>] identifier_list : [ mode ] subtype_indication [<b> bus </b>] [ := <i>static</i>_expression ]
interface_variable_declaration ::=
[<b>variable</b>] identifier_list : [ mode ] subtype_indication [ := <i>static</i>_expression ]
interface_file_declaration ::=
<b>file</b> identifier_list subtype_indication
mode ::= <b>in</b> | <b>out</b> | <b>inout</b> | <b>buffer</b> | <b>linkage</b>
</pre>
<p>If no mode is explicitly given in an interface declaration other than an interface file declaration, mode <b>in</b> is assumed.
<p>For an interface constant declaration or an interface signal declaration, the subtype indication must define a subtype that is neither a file type nor an access type.
<p>For an interface file declaration, it is an error if the subtype indication does not denote a subtype of a file type.
<p>If an interface signal declaration includes the reserved word <b>bus</b>, then the signal declared by that interface declaration is a guarded signal of signal kind <b>bus</b>.
<p>If an interface declaration contains a ":=" symbol followed by an expression,the expression is said to be the <i>default</i> <i>expression</i> of the interface object. The type of a default expression must be that of the corresponding interface object. It is an error if a default expression appears in an interface declaration and any of the following conditions hold:
<ul>
<p>-- The mode is <b>linkage</b>
<p>-- The interface object is a formal signal parameter
<p>-- The interface object is a formal variable parameter of mode other than <b>in</b>.
</ul>
<p>In an interface signal declaration appearing in a port list, the default expression defines the default value(s) associated with the interface signal or its subelements. In the absence of a default expression, an implicit default value is assumed for the signal or for each scalar subelement, as defined for signal declarations (see <a href = "1076_4.HTM#4.3.1.2"> 4.3.1.2 </a> ). The value, whether implicitly or explicitly provided, is used to determine the initial contents of drivers, if any, of the interface signal as specified for signal declarations.
<p>An interface object provides a channel of communication between the environment and a particular portion of a description. The value of an interface object may be determined by the value of an associated object or expression in the environment; similarly, the value of an object in the environment may be determined by the value of an associated interface object. The manner in which such associations are made is described in <a href = "1076_4.HTM#4.3.2.2"> 4.3.2.2 </a> .
<p>The value of an object is said to be <i>read</i> when one of the following conditions is satisfied:
<ul>
<p>-- When the object is evaluated, and also (indirectly) when the object is associated with an interface object of the modes <b>in</b>, <b>inout</b>, or <b>linkage</b>.
<p>-- When the object is a signal and a name denoting the object appears in a sensitivity list in a wait statement or a process statement.
<p>-- When the object is a signal and the value of any of its predefined attributes 'STABLE, 'QUIET, 'DELAYED, 'TRANSACTION, 'EVENT, 'ACTIVE,'LAST_EVENT, 'LAST_ACTIVE, or 'LAST_VALUE is read.
<p>-- When one of its subelements is read.
<p>-- When the object is a file and a READ operation is performed on the file.
</ul>
<p>The value of an object is said to be <i>updated</i> when one of the following conditions is satisfied:
<ul>
<p>-- When it is the target of an assignment, and also (indirectly) when the object is associated with an interface object of the modes <b>out</b>,<b>buffer</b>, <b>inout</b>, or <b>linkage</b>.
<p>-- When one of its subelements is updated.
<p>-- When the object is a file and a WRITE operation is performed on the file.
</ul>
<p>Only signal, variable, or file objects may be updated.
<p>An interface object has one of the following modes:
<ul>
<p>-- <b>in.</b> The value of the interface object may only be read. In addition, any attributes of the interface object may be read, except that attributes 'STABLE, 'QUIET, 'DELAYED, and 'TRANSACTION of a subprogram signal parameter may not be read within the corresponding subprogram. For a file object, operation ENDFILE is allowed.
<p>-- <b>out. </b> The value of the interface object may be updated. Reading the attributes of the interface element, other than the predefined attributes 'STABLE, 'QUIET, 'DELAYED, 'TRANSACTION, 'EVENT, 'ACTIVE, 'LAST_EVENT,'LAST_ACTIVE, and 'LAST_VALUE, is allowed. No other reading is allowed.
<p>-- <b>inout. </b> The value of the interface object may be both read and updated. Reading the attributes of the interface object, other than the attributes 'STABLE, 'QUIET, 'DELAYED, and 'TRANSACTION of a signal parameter,is also permitted. For a file object, all file operations (see <a href = "1076_3.HTM#3.4.1"> 3.4.1 </a> ) are allowed.
<p>-- <b>buffer. </b> The value of the interface object may be both read and updated. Reading the attributes of the interface object is also permitted.
<p>-- <b>linkage.</b> The value of the interface object may be read or updated,but only by appearing as an actual corresponding to an interface object of mode <b>linkage</b>. No other reading or updating is permitted.
</ul>
<h4>NOTES</h4>
<p>1--Although signals of modes <b>inout</b> and <b>buffer</b> have the same characteristics with respect to whether they may be read or updated, a signal of mode <b>inout</b> may be updated by zero or more sources, whereas a signal of mode <b>buffer</b> must be updated by at most one source (see <a href = "1076_1.HTM#1.1.1.2"> 1.1.1.2 </a> ).
<p>2--A subprogram parameter that is of a file type must be declared as a file parameter.
<p>3--Since shared variables are a subclass of variables, a shared variable may be associated as an actual with a formal of class variable.
<h4><a name="4.3.2.1"> <a href = "1076_4.HTM#4.3.2.1"> 4.3.2.1 </a> Interface lists</a></h4>
<p>An interface list contains the declarations of the interface objects required by a subprogram, a component, a design entity, or a block statement.
<pre> interface_list ::=
interface_element { ; interface_element }
interface_element ::= interface_declaration
</pre>
<p>A <i>generic</i> interface list consists entirely of interface constant declarations. A <i>port</i> interface list consists entirely of interface signal declarations. A <i>parameter</i> interface list may contain interface constant declarations, interface signal declarations, interface variable declarations, interface file declarations, or any combination thereof.
<p>A name that denotes an interface object may not appear in any interface declaration within the interface list containing the denoted interface object except to declare this object.
<p>NOTE--The above restriction makes the following three interface lists illegal:
<pre> <b><i>entity</i></b> <i>E</i> <b><i>is</i></b><i>
</i><b><i>generic</i></b><i> (G1: INTEGER; G2: INTEGER := G1); -- illegal
</i><b><i>port</i></b><i> (P1: STRING; P2: STRING(P1'RANGE)); -- illegal
</i><b><i>procedure</i></b><i> X (Y1, Y2: INTEGER; Y3: INTEGER </i><b><i>range</i></b> <i>Y1</i> <b><i>to</i></b><i> Y2)</i>; <i>-- illegal
</i><b><i>end</i></b><i> E;</i>
</pre>
<p>However,the following interface lists are legal:
<pre> <b>entity</b> E <b>is</b>
<b>generic</b> (G1, G2, G3, G4: INTEGER);
<b>port</b> (P1, P2: STRING (G1 <b>to</b> G2));
<b>procedure</b> X (Y3: INTEGER <b>range</b> G3 <b>to</b> G4);
<b>end</b> E;
</pre>
<h4><a name="4.3.2.2"> <a href = "1076_4.HTM#4.3.2.2"> 4.3.2.2 </a> Association lists</a></h4>
<p>An association list establishes correspondences between formal or local generic, port, or parameter names on the one hand and local or actual names or expressions on the other.
<pre> association_list ::=
association_element { , association_element }
association_element ::=
[ formal_part => ] actual_part
formal_part ::=
formal_designator
| <i>function</i>_name ( formal_designator )
| type_mark ( formal_designator )
formal_designator ::=
<i>generic</i>_name
| <i>port</i>_name
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -