无法将字符串 [] 转换为 vhdl 中的字符串
can't convert string[] to string in vhdl
我正在用 vhdl 编写代码并遇到此错误
Assignment target incompatible with right side. Cannot convert 'dataArray' to 'STRING'
这是我的代码
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);
在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;
我正在用 vhdl 编写代码并遇到此错误
Assignment target incompatible with right side. Cannot convert 'dataArray' to 'STRING'
这是我的代码
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);
在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;