我正在制作 N 到 2^N 解码器并面临一些错误。请帮帮我。
Naddr
- 地址位数整数addr
- 地址位std_logic_vector
fbd
- (integer,std_logic_vector
) - 从二进制转换为十进制的函数fpower
- (整数) - 提供 2^N 的函数
代码:
Architecture deco of Deco is
begin
process(addr, En)
variable a : integer;
begin
a := fbd(Naddr, addr);
if(En = '1') then
q <= (a => '1', others => '0'); --- error1
elsif(En = '0') then
q <= (fpower(Naddr)-1 downto 0 => '0');
end if;
end process;
end deco;
我得到的错误是:
1) 错误 (10318):Deco.vhd(33) 处的 VHDL 聚合错误:选择必须保持不变 (error1)
2) 错误:无法详细说明顶级用户层次结构