작성일: 2015.10.01
VHDL: numeric (IEEE) packages and std_logic (SYNOPSYS) packages...
Packages
Numeric Packages
- Numeric packages have been defined to support arithmetic operations on binary vectors. The IEEE packages numeric_std and numeric_bit provide the two types unsigned and signed, the latter in 2's complement number representation. The difference is that numeric_std uses vectors the components of which are of type std_logic while numeric_bit uses vectors of bit-type components.
- Package std_logic_arith is a proprietary stopgap developed by SYNOPSYS before the IEEE packages became available. It should not be used for new designs any longer now that there is an official IEEE standard.
Types in Binary Arithmetic Operations |
|
numeric_std |
std_logic_arith |
Argument 1 |
Argument 2 |
Result |
unsigned |
unsigned |
unsigned |
unsigned/std_logic_vector |
unsigned |
integer |
unsigned |
unsigned/std_logic_vector |
integer |
unsigned |
unsigned |
unsigned/std_logic_vector |
signed |
signed |
signed |
signed/std_logic_vector |
signed |
integer |
signed |
signed/std_logic_vector |
integer |
signed |
signed |
signed/std_logic_vector |
|
|
numeric_std |
std_logic_arith |
Type Conversion |
std_logic_vector -> unsigned |
unsigned(arg) |
unsigned(arg) |
std_logic_vector -> signed |
signed(arg) |
signed(arg) |
unsigned -> std_logic_vector |
std_logic_vector(arg) |
std_logic_vector(arg) |
signed -> std_logic_vector |
std_logic_vector(arg) |
std_logic_vector(arg) |
integer -> unsigned |
to_unsigned(arg,size) |
conv_unsigned(arg,size) |
integer -> signed |
to_signed(arg,size) |
conv_signed(arg,size) |
unsigned -> integer |
to_integer(arg) |
conv_integer(arg) |
signed -> integer |
to_integer(arg) |
conv_integer(arg) |
integer -> std_logic_vector |
integer -> unsigned/signed ->std_logic_vector |
std_logic_vector -> integer |
std_logic_vector -> unsigned/signed ->integer |
unsigned + unsigned -> std_logic_vector |
std_logic_vector(arg1 + arg2) |
arg1 + arg2 |
signed + signed -> std_logic_vector |
std_logic_vector(arg1 + arg2) |
arg1 + arg2 |
Resizing |
unsigned |
resize(arg,size) |
conv_unsigned(arg,size) |
signed |
resize(arg,size) |
conv_signed(arg,size) |
|
© 2015 ETH Zurich
Source: https://www.dz.ee.ethz.ch/en/information/hdl-help/vhdl-sources.html
Send to a colleague | Print this document