【发布时间】:2013-07-28 17:10:31
【问题描述】:
如何实现具有“无关”输入并直接表示“无关”的 VHDL 函数?
Free Range VHDL 的练习 4.8-2a 要求我:
...编写实现这些功能的 VHDL 模型,使用...选定的信号分配。
a) F (A, B, C, D) = A'CD' + B'C + BCD'
此代码有效:
library ieee;
use ieee.std_logic_1164.all;
entity funca_selected is
port (
a: in std_ulogic;
b: in std_ulogic;
c: in std_ulogic;
d: in std_ulogic;
x: out std_ulogic);
end entity;
architecture rtl of funca_selected is
signal s: std_ulogic_vector(3 downto 0);
begin
s <= a & b & c & d;
with s select x <=
'1' when "0010" | "0110" | "0011" | "1010" | "1011" | "1110",
'0' when others;
end architecture;
但是,它是函数定义的不良表示。我想使用“无关”输入对其进行编码,以便代码更接近定义。这将减少工作量,并且更容易正确。我试过这个:
with s select x <=
'1' when "0-10" | "-01-" | "-110",
'0' when others;
这不起作用:当我的测试台执行此功能时,结果始终为 '0'。
我使用的是 GHDL 版本 0.29+gcc4.3.i386。
VHDL 函数如何表示“无关”输入?
【问题讨论】:
标签: vhdl truthtable