PPT ½½¶óÀ̵å
To accomplish arithmetic operations on arrays --in effect treating them as binary or numerical representations, requires functions (sub-programs) supplied by the IEEE or the tool vendor.
The package std_logic_unsigned is an IEEE standard library and will provide maximum code portability.
Such functions will normally be included in so-called ¡°arithmetic packages¡±. The package may require compilation into the work library. FPGA Express has pre-compiled these packages into its own internal library.
package std_logic_unsigned is function ¡°+¡± (A,B: bit_vector) return bit_vector ; function ¡°+¡± (A: bit_vector, B: integer ) return bit_vector ; function ¡°-¡± (A,B: bit_vector) return bit_vector ;. . . .
library IEEE ;use IEEE.std_logic_1164.all ;use IEEE.std_logic_unsigned.all ;
The operator ¡°+¡± is overloaded in that it refers to a different function call, based on the left and right operand, and the return parameter in the function declaration.