?? 1076_7.html
字號:
-- The following concatenation accepts two MEMORYs and returns a MEMORY (case a):
<b>constant</b> C5: MEMORY := C2 & C3;
<b>type</b> R1 <b>is</b> 0 <b>to</b> 7;
<b>type</b> R2 <b>is</b> 7 <b>downto</b> 0;
<b>type</b> T1 <b>is</b> <b>array</b> (R1 <b>range</b> <>) <b>of</b> Bit;
<b>type</b> T2 <b>is</b> <b>array</b> (R2 <b>range</b> <>) <b>of</b> Bit;
<b>subtype</b> S1 <b>is</b> T1(R1);
<b>subtype</b> S2 <b>is</b> T2(R2);
<b>constant</b> K1: S1 := (<b>others</b> => '0');
<b>constant</b> K2: T1 := K1(1 <b>to</b> 3) & K1(3 <b>to</b> 4); -- K2'Left = 0 <b>and</b> K2'Right = 4
<b>constant</b> K3: T1 := K1(5 <b>to</b> 7) & K1(1 <b>to</b> 2); -- K3'Left = 0 <b>and</b> K3'Right = 4
<b>constant</b> K4: T1 := K1(2 <b>to</b> 1) & K1(1 <b>to</b> 2); -- K4'Left = 0 <b>and</b> K4'Right = 1
<b>constant</b> K5: S2 := (<b>others</b> => '0');
<b>constant</b> K6: T2 := K5(3 <b>downto</b> 1) & K5(4 <b>downto</b> 3); -- K6'Left = 7 <b>and</b> K6'Right = 3
<b>constant</b> K7: T2 := K5(7 <b>downto</b> 5) & K5(2 <b>downto</b> 1) -- K7'Left = 7 <b>and</b> K7'Right = 3
<b>constant</b> K8: T2 := K5(1 <b>downto</b> 2) & K5(2 <b>downto</b> 1); -- K8'Left = 7 <b>and</b> K8'Right = 6
</pre>
<h4>NOTES</h4>
<p>
<p>1--For a given concatenation whose operands are of the same type, there maybe visible more than one array type that could be the result type according to the rules of case 3. The concatenation is ambiguous and therefore an error if, using the overload resolution rules of <a href = "1076_2.HTM#2.3"> 2.3 </a> and <a href = "1076_10.HTM#10.5"> 10.5 </a> , the type of the result is not uniquely determined.
<p>2--Additionally, for a given concatenation, there may be visible array types that allow both case a and case c to apply. The concatenation is again ambiguous and therefore an error if the overload resolution rules cannot be used to determine a result type uniquely.
<h3><a name="7.2.5"> <a href = "1076_7.HTM#7.2.5"> 7.2.5 </a> Sign operators</a></h3>
<p>Signs + and - are predefined for any numeric type and have their conventional mathematical meaning: they respectively represent the identity and negation functions. For each of these unary operators, the operand and the result have the same type.<br><br>
<center>
<table border="1">
<tr align="center"><td align="center"><b>Operator</b><td align="center"><b>Operation</b><td align="center"><b>Operand type</b><td align="center"><b>Result type</b></tr>
<tr><td align="center">+<td align="center">Identity<td align="center">Any numeric type<td align="center">Same type</tr>
<tr><td align="center">-<td align="center">Negation<td align="center">Any numeric type<td align="center">Same type</tr>
</table>
</center>
<p>
<p>
<p>NOTE--Because of the relative precedence of signs + and - in the grammar for expressions, a signed operand must not follow a multiplying operator, the exponentiating operator **, or the operators <b>abs</b> and <b>not</b>. For example, the syntax does not allow the following expressions:
<pre> <i>A/+B -- An illegal expression</i>
<i>A**-B -- An illegal expression</i>
</pre>
<p>However,these expressions may be rewritten legally as follows:
<pre> A/(+B) -- A legal expression
A**(-B) -- A legal expression
</pre>
<h3><a name="7.2.6"> <a href = "1076_7.HTM#7.2.6"> 7.2.6 </a> Multiplying operators</a></h3>
<p>The operators * and / are predefined for any integer and any floating point type and have their conventional mathematical meaning; the operators <b>mod</b> and <b>rem</b> are predefined for any integer type. For each of these operators, the operands and the result are of the same type.<br><br>
<center>
<table border="1">
<tr><td align="center"><b>Operator</b><td><b>Operation</b><td><b>Left operand type</b><td><b>Right operand type</b><td><b>Result type</b></tr>
<tr><td rowspan="2" align="center">*<td rowspan="2">Multiplication<td>Any integer type<td>Same type<td>Same type</tr>
<tr><td>Any floating point type<td>Same type<td>Same type</tr>
<tr><td rowspan="2" align="center">/<td rowspan="2">Division<td>Any integer type<td>Same type<td>Same type</tr>
<tr><td>Any floating point type<td>Same type<td>Same type</tr>
<tr><td align="center"><b>mod</b><td>Modulus<td>Any integer type<td>Same type<td>Same type</tr>
<tr><td align="center"><b>rem</b><td>Remainder<td>Any integer type<td>Same type<td>Same type</tr>
</table>
</center>
<p>
<p>Integer division and remainder are defined by the following relation:
<pre> A = (A/B)*B + (A <b>rem</b> B)
</pre>
<p>where(A <b>rem</b> B) has the sign of A and an absolute value less than the absolute value of B. Integer division satisfies the following identity:
<pre> (-A)/B = -(A/B) = A/(-B)
</pre>
<p>The result of the modulus operation is such that (A <b>mod</b> B) has the sign of B and an absolute value less than the absolute value of B; in addition, for some integer value N, this result must satisfy the relation:
<pre> A = B*N + (A <b>mod</b> B)
</pre>
<p>In addition to the above table, the operators * and / are predefined for any physical type.<br><br>
<p>
<center>
<table border="1">
<tr><td align="CENTER"><b>Operator</b><td><b>Operation</b><td><b>Left operand type</b><td><b>Right operand type</b><td><b>Result type</b></tr>
<tr><td rowspan="4" align="CENTER">*<td rowspan="4">Multiplication<td>Any physical type<td>INTEGER<td>Same as left</tr>
<tr><td>Any physical type<td>REAL<td>Same as left</tr>
<tr><td>INTEGER<td>Any physical type<td>Same as right</tr>
<tr><td>REAL<td>Any physical type<td>Same as right</tr>
<tr><td rowspan="3" align="CENTER">/<td rowspan="3">Division<td>Any physical type<td>INTEGER<td>Same as left</tr>
<tr><td>Any physical type<td>REAL<td>Same as left</tr>
<tr><td>Any physical type<td>The same type<td><i>Universal integer</i></tr>
</table>
</center>
<p>Multiplication of a value P of a physical type T<sub>p</sub> by a value I of type INTEGER is equivalent to the following computation:
<pre> T<sub>p</sub>'Val( T<sub>p</sub>'Pos(P) * I )
</pre>
<p>Multiplication of a value P of a physical type T<sub>p</sub> by a value F of type REAL is equivalent to the following computation:
<pre> T<sub>p</sub>'Val( INTEGER( REAL( T<sub>p</sub>'Pos(P) ) * F ))
</pre>
<p>Division of a value P of a physical type T<sub>p</sub> by a value I of type INTEGER is equivalent to the following computation:
<pre> T<sub>p</sub>'Val( T<sub>p</sub>'Pos(P) / I )
</pre>
<p>Division of a value P of a physical type T<sub>p</sub> by a value F of type REAL is equivalent to the following computation:
<pre> T<sub>p</sub>'Val( INTEGER( REAL( T<sub>p</sub>'Pos(P) ) / F ))
</pre>
<p>Division of a value P of a physical type T<sub>p</sub> by a value P2 of the same physical type is equivalent to the following computation:
<pre> T<sub>p</sub>'Pos(P) / T<sub>p</sub>'Pos(P2)
</pre>
<p><i>Examples:</i>
<pre> 5 <b>rem</b> 3 = 2
5 <b>mod</b> 3 = 2
(-5) <b>rem</b> 3 = -2
(-5) <b>mod</b> 3 = 1
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -