【问题标题】:How to assign value to std_logic_vector in VHDL?如何在 VHDL 中为 std_logic_vector 赋值?
【发布时间】:2021-04-09 18:02:54
【问题描述】:

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

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

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

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

COMP96 错误 COMP96_0143:“无法写入对象“OUTPUT”。” “设计.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;

我哪里做错了?

【问题讨论】:

  • “OUTPUT”不是输入的好名字。

标签: vhdl low-level low-level-code edaplayground


【解决方案1】:

错误表示 "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)
 );

【讨论】:

    猜你喜欢
    • 2018-11-28
    • 2012-05-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-09-15
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多