vhdl - 将 STD_LOGIC_VECTOR 中的一位分配给 STD_LOGIC

标签 vhdl

似乎我已经这样做了很多次,但由于某种原因,今天它只是不想工作。

我想将 16 位向量的 MSB 分配给一位变量。

Din : in  STD_LOGIC_VECTOR (15 downto 0);

...

signal signBit : std_logic;

begin
    signBit <= Din(15 downto 15);

给出的错误是:
Type of signBit is incompatible with type of Din.

是的,我明白了,向量在 std_logic 上表现不佳,但这是 1 位,清楚地表示为 (15 downto 15)

最佳答案

Din(15 downto 15);

是 std_logic_vector,1 位长
Din(15);

是 std_logic_vector 的一个元素,即 std_logic。

关于vhdl - 将 STD_LOGIC_VECTOR 中的一位分配给 STD_LOGIC,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22720319/

相关文章:

attributes - 从 VHDL 记录类型获取字段的属性

vhdl - 调试 VHDL Modelsim 中的迭代限制错误

vhdl - 在ncvhdl中获取vhdl设计的内部信号(替代modelsim的signal spy)

arrays - 获取最后 512 个值中最大值的更节省资源的方法

syntax-error - 从 Vivado 获取 "No such design unit"

compiler-errors - VHDL - 分配默认值

vhdl - 如何在 Xilinx 中将引脚分配给自然类型的端口

syntax-error - 如何解决VHDL中的代码错误?

c - 串行蓝牙连接到 Roomba iRobot

syntax - => 和 <= 之间的 VHDL 区别