问题描述
我对VHDL中的问题感到困惑.
I'm confused about a problem I have in VHDL.
我做一个VGA_display_ characters
,所以我想用to_integer
无符号将一些std_logic_vectors
转换成整数,然后我想恢复健康,这样,我无法同时使用这些库.
I make one VGA_display_ characters
, so I wanna convert some std_logic_vectors
into integer by to_integer
unsigned, then I wanna recuperate, in this way I can't use those libraries in the same time.
ieee.std_logic_arith.all
和ieee.numeric_std.all
quartus给出的错误:
ieee.std_logic_arith.all
and ieee.numeric_std.all
The error given by quartus:
推荐答案
我的建议是:不要使用ieee.std_logic_arith
.它是专有的(不是VHDL的正式组成部分),并且引起的问题远远超过其解决的问题.
My advice is: don't use ieee.std_logic_arith
. It's proprietary (not officially part of VHDL) and causes far, far more problems than it solves.
仅使用numeric_std
,您就可以做所需的一切:
Use only numeric_std
and you can do everything you need:
to_integer(unsigned(X))
和to_integer(signed(X))
,其中X
是std_logic_vector
.
要向另一个方向转换:
std_logic_vector(to_unsigned(K, N))
和std_logic_vector(to_signed(K, N))
,其中K
是要转换的整数,N
是位数.
std_logic_vector(to_unsigned(K, N))
and std_logic_vector(to_signed(K, N))
where K
is the integer to convert and N
is the number of bits.
这篇关于VHDL _ TO_INTEGER的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!