【发布时间】:2015-05-31 06:18:54
【问题描述】:
我在 vhdl 中有一个 4 到 16 的解码器。我想输入一个启用输入,但我是 vhdl 编码的新手。我想保留这种代码结构(我不想使用任何其他快捷方式,或者完全改变代码)。我尝试为启用编写 e 输入,并尝试执行 if e = "1" then 但它不起作用。
library IEEE;
use IEEE.STD_LOGIC_1164.all;
entity decode4to16 is
port(
oct : in std_logic_vector(3 downto 0);
e : in std_logic;
dec : out std_logic_vector(15 downto 0));
end decode4to16;
architecture arch of decode4to16 is
begin
if e = "1" then
with oct select
dec <=
"0000000000000001" when "0000",
"0000000000000010" when "0001",
"0000000000000100" when "0010",
"0000000000001000" when "0011",
"0000000000010000" when "0100",
"0000000000100000" when "0101",
"0000000001000000" when "0110",
"0000000010000000" when "0111",
"0000000100000000" when "1000",
"0000001000000000" when "1001",
"0000010000000000" when "1010",
"0000100000000000" when "1011",
"0001000000000000" when "1100",
"0010000000000000" when "1101",
"0100000000000000" when "1110",
"1000000000000000" when "1111",
"0000000000000000" when others;
end if;
end arch;
【问题讨论】: