【发布时间】:2015-12-06 00:34:10
【问题描述】:
在 SO 而不是 EE 上发布这个问题是因为我正在努力解决编码/软件缺陷。
我是 VHDL 新手,正在阅读“Free range VHDL”一书。玩弄bit_vector 我发现在总线语法中访问单线遵循bus_name(0)(0 只是示例)。
牢记这一点,我编写了 4 个输入多路复用器的简单表示。
library ieee;
use ieee.std_logic_1164.all;
entity Multiplexer4_1 is
port
(
data : in bit_vector(3 to 0);
selector : in bit_vector(1 to 0);
output : out bit
);
end entity Multiplexer4_1;
architecture m4_1 of Multiplexer4_1 is
begin
output <= data(3) when (selector = "11") else
data(2) when (selector = "10") else
data(1) when (selector = "01") else
data(0) when (selector = "00") else
'0';
end architecture m4_1;
我正在使用ghdl在linux下使用以下命令处理VHDL。
ghdl -a 4Multiplexer.vhdl
因此,我收到 4 条错误消息,显然是因为 data(0)、data(1) 和其他原因,如下所列。
4Multiplexer.vhdl:15:23: static constant violates bounds
4Multiplexer.vhdl:16:21: static constant violates bounds
4Multiplexer.vhdl:17:21: static constant violates bounds
4Multiplexer.vhdl:18:21: static constant violates bounds
ghdl: compilation error
问题是:
- 如何解决这个问题?
- 如果
bus_name(index)是正确的语法?
更新:
不要犯同样的错误,了解数组/范围在 VHDL 中的工作方式至关重要。
感谢您的帮助!
【问题讨论】:
标签: vhdl digital-logic ghdl