VHDL _ TO_INTEGER

VHDL _ TO_INTEGER

我对 VHDL 中的一个问题感到困惑。

我做了一个VGA_display_ characters,所以我想把一些std_logic_vectors转换成无符号的to_integer整数,然后我想休养生息, 这样我就不能同时使用这些库了。

ieee.std_logic_arith.allieee.numeric_std.all quartus给出的错误:

(Error (10621): VHDL Use Clause error at interface.vhd(34): more than one Use Clause imports a declaration of simple name "unsigned" -- none of the declarations are directly visible Error (10784): HDL error at syn_arit.vhd(26): see declaration for object "unsigned" bellow my code :

to_integer

conv_std_logic_vector

我的建议是:不要使用 ieee.std_logic_arith。它是专有的(不是 VHDL 的正式部分)并且导致的问题远比它解决的问题多得多。

只使用numeric_std,你可以做你想做的一切:

to_integer(unsigned(X))to_integer(signed(X)),其中 Xstd_logic_vector.

要反方向转换回来:

std_logic_vector(to_unsigned(K, N))std_logic_vector(to_signed(K, N)) 其中 K 是要转换的整数,N 是位数。