0

我试图在下面的代码中为 OUTPUT std_logic_vector 赋值,但它给了我错误

COMP96 错误 COMP96_0143:“无法写入对象“输出”。” “设计.vhd” 20 18

COMP96 错误 COMP96_0143:“无法写入对象“输出”。” “设计.vhd” 21 18

COMP96 错误 COMP96_0143:“无法写入对象“输出”。” “设计.vhd” 22 18

COMP96 错误 COMP96_0143:“无法写入对象“输出”。” “设计.vhd” 23 20

library IEEE;
use IEEE.STD_LOGIC_1164.all;
use IEEE.STD_LOGIC_ARITH.ALL; 
use IEEE.STD_LOGIC_UNSIGNED.ALL; 
 
entity demux_1to4 is
 port(
 I : IN STD_LOGIC;
 S: IN STD_LOGIC_VECTOR(1 downto 0);
 OUTPUT: IN STD_LOGIC_VECTOR(3 downto 0)
 );
end demux_1to4;
 
architecture bhv of demux_1to4 is
begin
process (I,S) is
begin
    case(S) is 
    when "00" => OUTPUT <= "0001" ;
    when "01" => OUTPUT<= "0010" ;
    when "10" => OUTPUT<= "0100" ;
    when others => OUTPUT<= "1000" ;
    end case ; 
end process;
end bhv;

我在哪里做错了?

4

1 回答 1

2

错误表示 "Object "OUTPUT" cannot be written."

OUTPUT被声明为实体中的输入端口。要写入/分配值,它必须是输出端口。(或一般的内部信号)。

OUTPUT: OUT STD_LOGIC_VECTOR(3 downto 0)

 port(
 I     : IN STD_LOGIC;
 S     : IN STD_LOGIC_VECTOR(1 downto 0);
 OUTPUT: OUT STD_LOGIC_VECTOR(3 downto 0)
 );
于 2021-01-03T21:31:26.373 回答