Microsoft AGB-00001 Spécifications Page 31

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 144
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 30
How to Write Synthesizable VHDL
VHDL Reference Manual 3-5
Relational Operators
VHDL provides relational operators as shown in Table 3-1.
Table 3-1: Relational Operators
Operator Description
= Equal
/= Not equal to
> Greater than
< Less than
>= Greater than or equal to
<= Less than or equal to
The equality operators ( = and /= ) are defined for all VHDL data
types. The magnitude operators ( >=, <=, >, < ) are defined for
numeric types, enumerated types, and some arrays. The resulting
single-bit type for all these operators is Boolean. In addition to the
built-in relational operators, overloaded versions of these operators are
supplied in the packages bit_ops and std_logic_ops (found in the file
\synario\lib5\dataio.vhd) for bit_vector and std_logic_vector types.
The overloaded operators found in these packages treat bit_vectors
and std_logic_vectors as unsigned quantities.
The simple comparisons (equal and not equal) are more efficient to
implement (in terms of gates or product terms) than the magnitude
operators. To illustrate, the first example below uses an equal operator
while the second uses a greater-than-or-equal-to operator. As you can
see from the schematic of Figure 3-2, the second example uses more
than twice as many gates as the first.
Example 1:
entity relational_ops_1 is
port (a, b: in bit_vector (0 to 3); m: out Boolean);
end relational_ops_1;
architecture example of relational_ops_1 is
begin
m <= a = b;
end example;
Example 2:
entity relational_ops_2 is
port (a, b: in integer range 0 to 3; m: out Boolean);
end relational_ops_2;
architecture example of relational_ops_2 is
begin
m <= a >= b;
end example;
Vue de la page 30
1 2 ... 26 27 28 29 30 31 32 33 34 35 36 ... 143 144

Commentaires sur ces manuels

Pas de commentaire