无法确定运营商“” - “”的定义?

时间:2015-11-24 14:23:46

标签: arrays vhdl

我收到了错误:无法确定运算符“” - “”的定义以获取以下代码。我不确定访问数组中每个unsigned的单独位。有什么问题?

library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use Ieee.numeric_std.all;

use work.genetica_type.all;

entity binario_fitness is
Port ( 
 clk : in std_logic;
 individuos: in genetica;
 adaptacao: out fitness;
 somafitness: out unsigned (7 downto 0)
 );
 end binario_fitness;


 architecture Behavioral of binario_fitness is
 begin



 process (clk)
 begin
 If (clk 'event and clk = '1') then

 for x in 0 to 49 loop

 adaptacao(x) <= individuos(x)(0)-individuos(x)(1) +individuos(x)(2)-       individuos(x)(3)+individuos(x)(4)- individuos(x)(5)+individuos(x)(6)-individuos(x)(7);
somafitness<=(others=>'0'); 
end loop;

end if  ;

end process;

end Behavioral;

其中包含另一个文件中的genetica_type:

library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_TEXTIO.ALL;
use ieee.numeric_std.all;

package genetica_type is
type genetica is array(0 to 49) of unsigned(7 downto 0);
type fitness is array(0 to 49) of unsigned (2 downto 0);
end package genetica_type;

1 个答案:

答案 0 :(得分:0)

您正在尝试对void List::ClearDv() { if(GetLength()>=1 && m_first->info%2==0) { DeleteAt(0); return; } else{ Node*T=m_first; while(T!=NULL) { T=T->link; if(T->info%2==0){ Node* P=T; T=T->link; delete P; } } } } 类型执行算术运算。

std_logic

切片信号type genetica is array(0 to 49) of unsigned(7 downto 0) ... individuos: in genetica; ... adaptacao(x) <= individuos(x)(0)-individuos(x)(1)... 实际上是individuos(X)(Y)类型。 减法运算符&#34; - &#34;没有为类型std_logic定义,因此存在错误。 根据您实际尝试的操作,您的问题的解决方案可能会有所不同 一种可能性是:

std_logic

这将起作用,因为一位切片adaptacao(x) <= "00"&individuos(x)(0 downto 0) - "00"&individuos(x)(1 downto 1) + "00"&individuos(x)(2 downto 2) - etc. 将保留切片矢量的类型,即在这种情况下为individuos(x)(y downto y)

从numeric_std.vhd的定义:

unsigned