?? 1076_3.html
字號(hào):
<p>The abstract literal portion (if present) of a physical literal appearing in a secondary unit declaration must be an integer literal.
<p>A physical literal consisting solely of a unit name is equivalent to the integer 1 followed by the unit name.
<p>There is a position number corresponding to each value of a physical type. The position number of the value corresponding to a unit name is the number of primary units represented by that unit name. The position number of the value corresponding to a physical literal with an abstract literal part is the largest integer that is not greater than the product of the value of the abstract literal and the position number of the accompanying unit name.
<p>The same arithmetic operators are predefined for all physical types (see <a href = "1076_7.HTM#7.2"> 7.2 </a> ). It is an error if the execution of such an operation cannot deliver the correct result (that is, if the value corresponding to the mathematical result is not a value of the physical type).
<p>An implementation may restrict the bounds of the range constraint of a physical type. However, an implementation must allow the declaration of any physical type whose range is wholly contained within the bounds -2147483647 and +2147483647 inclusive.
<p><i>Examples:</i>
<pre> <b>type</b> DURATION <b>is</b> <b>range</b> -1E18 <b>to</b> 1E18
<b>units</b>
fs; -- femtosecond
ps = 1000 fs; -- picosecond
ns = 1000 ps; -- nanosecond
us = 1000 ns; -- microsecond
ms = 1000 us; -- millisecond
sec = 1000 ms; -- second
min = 60 sec; -- minute
<b>end</b> <b>units</b>;
<b>type</b> DISTANCE <b>is</b> <b>range</b> 0 <b>to</b> 1E16
<b>units</b>
-- primary unit:
A; -- angstrom
-- metric lengths:
nm = 10 A; -- nanometer
um = 1000 nm; -- micrometer (or micron)
mm = 1000 um; -- millimeter
cm = 10 mm; -- centimeter
m = 1000 mm; -- meter
km = 1000 m; -- kilometer
-- English lengths:
mil = 254000 A; -- mil
inch = 1000 mil; -- inch
ft = 12 inch; -- foot
yd = 3 ft; -- yard
fm = 6 ft; -- fathom
mi = 5280 ft; -- mile
lg = 3 mi; -- league
<b>end</b> <b>units</b> DISTANCE;
variable x: distance; variable y: duration; variable z: integer;
x := 5 A + 13 ft - 27 inch;
y := 3 ns + 5 min;
z := ns / ps;
x := z * mi;
y := y/10;
z := 39.34 inch / m;
</pre>
<p>
<h4>NOTES</h4>
<p>1-- The 'POS and 'VAL attributes may be used to convert between abstract values and physical values.
<p>2-- The value of a physical literal whose abstract literal is either the integer value zero or the floating point value zero is the same value (specifically zero primary units) no matter what unit name follows the abstract literal.
<h4><a name="3.1.3.1"> <a href = "1076_3.HTM#3.1.3.1"> 3.1.3.1 </a> Predefined physical types</a></h4>
<p>The only predefined physical type is type TIME. The range of TIME is implementation dependent, but it is guaranteed to include the range -2147483647 to +2147483647. It is defined with an ascending range. All specifications of delays and pulse rejection limits must be of type TIME. The declaration of type TIME appears in package STANDARD in Section 14.
<p>By default, the primary unit of type TIME (1 femtosecond) is the <i>resolution limit</i> for type TIME. Any TIME value whose absolute value is smaller than this limit is truncated to zero (0) time units. An implementation may allow a given execution of a model (see <a href = "1076_12.HTM#12.6"> 12.6 </a> ) to select a secondary unit of type TIME as the resolution limit. Furthermore, an implementation may restrict the precision of the representation of values of type TIME and the results of expressions of type TIME, provided that values as small as the resolution limit are representable within those restrictions. It is an error if a given unit of type TIME appears anywhere within the design hierarchy defining a model to be executed, and if the position number of that unit is less than that of the secondary unit selected as the resolution limit for type TIME during the execution of the model.
<p>NOTE--By selecting a secondary unit of type TIME as the resolution limit for type TIME, it may be possible to simulate for a longer period of simulated time, with reduced accuracy, or to simulate with greater accuracy for a shorter period of simulated time.
<p><i>Cross-References:</i> Delay and rejection limit in a signal assignment, <a href = "1076_8.HTM#8.4"> 8.4 </a> ; Disconnection, delay of a guarded signal, <a href = "1076_5.HTM#5.3"> 5.3 </a> ; Function NOW, <a href = "1076_14.HTM#14.2"> 14.2 </a> ;Predefined attributes, functions of TIME, <a href = "1076_14.HTM#14.1"> 14.1 </a> ; Simulation time, <a href = "1076_12.HTM#12.6.2"> 12.6.2 </a> and <a href = "1076_12.HTM#12.6.3"> 12.6.3 </a> ; Type TIME, <a href = "1076_14.HTM#14.2"> 14.2 </a> ; Updating a projected waveform, <a href = "1076_8.HTM#8.4.1"> 8.4.1 </a> ; Wait statements, timeout clause in, <a href = "1076_8.HTM#8.1"> 8.1 </a> .
<h3><a name="3.1.4"> <a href = "1076_3.HTM#3.1.4"> 3.1.4 </a> Floating point types</a></h3>
<p>Floating point types provide approximations to the real numbers. Floating point types are useful for models in which the precise characterization of a floating point calculation is not important or not determined.
<pre> floating_type_definition ::= range_constraint
</pre>
<p>A floating type definition defines both a type and a subtype of that type. The type is an anonymous type, the range of which is selected by the implementation; this range must be such that it wholly contains the range given in the floating type definition. The subtype is a named subtype of this anonymous base type, where the name of the subtype is that given by the corresponding type declaration and the range of the subtype is the given range.
<p>Each bound of a range constraint that is used in a floating type definition must be a locally static expression of some floating point type, but the two bounds need not have the same floating point type. (Negative bounds are allowed.)
<p>Floating point literals are the literals of an anonymous predefined type that is called <i>universal_real</i> in this standard. Other floating point types have no literals. However, for each floating point type there exists an implicit conversion that converts a value of type <i>universal_real</i> into the corresponding value (if any) of the floating point type (see <a href = "1076_7.HTM#7.3.5"> 7.3.5 </a> ).
<p>The same arithmetic operations are predefined for all floating point types (see <a href = "1076_7.HTM#7.2"> 7.2 </a> ). A design is erroneous if the execution of such an operation cannot deliver the correct result (that is, if the value corresponding to the mathematical result is not a value of the floating point type).
<p>An implementation may restrict the bounds of the range constraint of floating point types other than type <i>universal_real</i>. However, an implementation must allow the declaration of any floating point type whose range is wholly contained within the bounds - <a href = "1076_1.HTM#1.0"> 1.0 </a> E38 and + <a href = "1076_1.HTM#1.0"> 1.0 </a> E38 inclusive. The representation of floating point types must include a minimum of six decimal digits of precision.
<p>NOTE--An implementation is not required to detect errors in the execution of a predefined floating point arithmetic operation, since the detection of overflow conditions resulting from such operations may not be easily accomplished on many host systems.
<h4><a name="3.1.4.1"> <a href = "1076_3.HTM#3.1.4.1"> 3.1.4.1 </a> Predefined floating point types</a></h4>
<p>The only predefined floating point type is the type REAL. The range of REAL is host-dependent, but it is guaranteed to include the range - <a href = "1076_1.HTM#1.0"> 1.0 </a> E38 to + <a href = "1076_1.HTM#1.0"> 1.0 </a> E38 inclusive. It is defined with an ascending range.
<p>NOTE--The range of REAL in a particular implementation may be determined from the 'LOW and 'HIGH attributes.
<h2><a name="3.2"> <a href = "1076_3.HTM#3.2"> 3.2 </a> Composite types</a></h2>
<p>Composite types are used to define collections of values. These include both arrays of values (collections of values of a homogeneous type) and records of values (collections of values of potentially heterogeneous types).
<pre> composite_type_definition ::=
array_type_definition
| record_type_definition
</pre>
<p>An object of a composite type represents a collection of objects, one for each element of the composite object. A composite type may only contain elements that are of scalar, composite, or access types; elements of file types are not allowed in a composite type. Thus an object of a composite type ultimately represents a collection of objects of scalar or access types, one for each noncomposite subelement of the composite object.
<h3><a name="3.2.1"> <a href = "1076_3.HTM#3.2.1"> 3.2.1 </a> Array types</a></h3>
<p>An array object is a composite object consisting of elements that have the same subtype. The name for an element of an array uses one or more index values belonging to specified discrete types. The value of an array object is a composite value consisting of the values of its elements.
<pre> array_type_definition ::=
unconstrained_array_definition | constrained_array_definition
unconstrained_array_definition ::=
<b>array</b> ( index_subtype_definition { , index_subtype_definition } )
<b>of</b> <i>element</i>_subtype_indication
constrained_array_definition ::=
<b>array</b> index_constraint <b>of</b> <i>element</i>_subtype_indication
index_subtype_definition ::= type_mark <b>range</b> <>
index_constraint ::= ( discrete_range { , discrete_range } )
discrete_range ::= <i>discrete</i>_subtype_indication | range
</pre>
<p>An array object is characterized by the number of indices (the dimensionality of the array); the type, position, and range of each index; and the type and possible constraints of the elements. The order of the indices is significant.
<p>A one-dimensional array has a distinct element for each possible index value. A multidimensional array has a distinct element for each possible sequence of index values that can be formed by selecting one value for each index (in the given order). The possible values for a given index are all the values that belong to the corresponding range; this range of values is called the <i>index range</i>.
<p>An unconstrained array definition defines an array type and a name denoting that type. For each object that has the array type, the number of indices, the type and position of each index, and the subtype of the elements are as in the type definition. The <i>index subtype</i> for a given index position is, by definition, the subtype denoted by the type mark of the corresponding index subtype definition. The values of the left and right bounds of each index range are not defined but must belong to the corresponding index subtype; similarly, the direction of each index range is not defined. The symbol <> (called a <i>box</i>) in an index subtype definition stands for an undefined range (different objects of the type need not have the same bounds and direction).
<p>A constrained array definition defines both an array type and a subtype of this type:
<ul>
<p>-- The array type is an implicitly declared anonymous type; this type is defined by an (implicit) unconstrained array definition, in which the element subtype indication is that of the constrained array definition and in which the type mark of each index subtype definition denotes the subtype defined by the corresponding discrete range.
<p>-- The array subtype is the subtype obtained by imposition of the index constraint on the array type.
</ul>
<p>If a constrained array definition is given for a type declaration, the simple name declared by this declaration denotes the array subtype.
<p>The direction of a discrete range is the same as the direction of the range or the discrete subtype indication that defines the discrete range. If a subtype indication appears as a discrete range, the subtype indication must not contain a resolution function.
<p><i>Examples:</i>
<pre>--Examples of constrained array declarations:
<b>type</b> MY_WORD <b>is</b> <b>array</b> (0 <b>to</b> 31) <b>of</b> BIT ;
-- A memory word type with an ascending range.
<b>type</b> DATA_IN <b>is</b> <b>array</b> (7 <b>downto</b> 0) <b>of</b> FIVE_LEVEL_LOGIC ;
-- An input port type with a descending range.
--Example of unconstrained array declarations:
<b>type</b> MEMORY <b>is</b> <b>array</b> (INTEGER <b>range</b> <>) <b>of</b> MY_WORD ;
-- A memory array type.
--Examples of array object declarations:
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -