nim*_*adi 0 arrays string vhdl
我正在vhdl中编写代码并遇到此错误
Assignment target incompatible with right side. Cannot convert 'dataArray' to 'STRING'
Run Code Online (Sandbox Code Playgroud)
这是我的代码
entity instructionTranslator is
port(clk :in std_logic;
instructionCode :in std_logic_vector(4 downto 0);
instructionType:out std_logic_vector(1 downto 0) ;
data :out string (1 to 1)--here is data
);
end instructionTranslator;
.
.
.
architecture Translator of instructionTranslator is
type dataArray is array (0 to 13)of string(1 to 1);
process(clk) begin
data<=dataArray(1);
Run Code Online (Sandbox Code Playgroud)
应该如何在vhdl中选择数组的特殊索引.
这里.我为你做了一个[MCVE].这个编译.
你声明了一个类型dataArray.然后你没有继续声明该类型的信号(或变量或常数).
将一个类型的成员(这是抽象的东西)分配给一个真实的信号显然是行不通的.
然而,分配该类型的信号(等)的成员......
library ieee;
use ieee.std_logic_1164.all;
entity instructionTranslator is
port(clk :in std_logic;
instructionCode :in std_logic_vector(4 downto 0);
instructionType:out std_logic_vector(1 downto 0) ;
data :out string (1 to 1)--here is data
);
end instructionTranslator;
architecture Translator of instructionTranslator is
type dataArray is array (0 to 13)of string(1 to 1);
signal da : dataArray;
begin
process(clk) is
begin
data<=da(1);
end process;
end Translator;
Run Code Online (Sandbox Code Playgroud)