我试图在Xilinx中运行以下代码,但我遇到了多个错误

时间:2017-03-27 07:58:26

标签: vhdl xilinx

我正在尝试在Xilinx中运行以下代码,但我遇到了多个错误。

代码:

Library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
use work.rng.all;

entity mutation is
    port(
        mut:in std_logic;
        pop_size:in integer range 0 to 15:=10;
        mem_mutated,bits_mutated:out arr
        );
end mutation;

architecture Behavioral of mutation is
begin
    process(mut)
        Variable s1,s4:integer:=1 ;
        Variable s2:integer range 0 to 15;
        Variable s3:integer range 0 to 1000:=5;
        variable s5:integer range 0 to 1000:= 8;
        variable ind_no, bit_mut:integer;
        variable mut_ind, bit_pos:arr;
    begin
        s2:= pop_size;
        if mut=’1’ then
            for i in 1 to mut_bits loop
                randg(s1,s2,s3,ind_no);
                mut_ind(i):=ind_no;
                s3:= s3+ 2;
                randg(s1,s5,s4,bit_mut);
                bit_pos(i):= bit_mut;
                s4:=s4 + 1;
            end loop;
            mem_mutated<= mut_ind;
            bits_mutated<= bit_pos;
        end if;
    end process;
end Behavioral;

以下是运行代码的错误:

  

错误:HDLC编译器:104 - &#34; D:\ mutation \ mutation.vhd&#34;第6行:找不到    在图书馆。请确保编译库,   并且VHDL文件中存在库和use子句。       错误:HDLC编译器:69 - &#34; D:\ mutation \ mutation.vhd&#34;第9行:未声明。       错误:HDLC编译器:854 - &#34; D:\ mutation \ mutation.vhd&#34;第7行:由于先前的错误而忽略了单位。       错误:HDLC编译器:374 - &#34; D:\ mutation \ mutation.vhd&#34;第11行:尚未编译实体。       错误:HDLC编译器:69 - &#34; D:\ mutation \ mutation.vhd&#34;第14行:未声明。       错误:HDLC编译器:69 - &#34; D:\ mutation \ mutation.vhd&#34;第15行:未声明。       错误:HDLC编译器:69 - &#34; D:\ mutation \ mutation.vhd&#34;第16行:未声明。       错误:HDLC编译器:69 - &#34; D:\ mutation \ mutation.vhd&#34;第17行:未声明。       错误:HDLC编译器:69 - &#34; D:\ mutation \ mutation.vhd&#34;第18行:未声明。       错误:HDLC编译器:69 - &#34; D:\ mutation \ mutation.vhd&#34;第19行:未声明。       错误:HDLC编译器:69 - &#34; D:\ mutation \ mutation.vhd&#34;第21行:未声明。       错误:HDLC编译器:69 - &#34; D:\ mutation \ mutation.vhd&#34;第23行:未声明。       错误:HDLC编译器:69 - &#34; D:\ mutation \ mutation.vhd&#34;第24行:未声明。       错误:HDLC编译器:69 - &#34; D:\ mutation \ mutation.vhd&#34;第25行:未声明。       错误:HDLC编译器:69 - &#34; D:\ mutation \ mutation.vhd&#34;第26行:未声明。       错误:HDLC编译器:69 - &#34; D:\ mutation \ mutation.vhd&#34;第27行:未声明。       错误:HDLC编译器:69 - &#34; D:\ mutation \ mutation.vhd&#34;第28行:未声明。       错误:HDLC编译器:69 - &#34; D:\ mutation \ mutation.vhd&#34;第29行:未声明。       错误:HDLC编译器:69 - &#34; D:\ mutation \ mutation.vhd&#34;第31行:未声明。

如何消除这些错误?

1 个答案:

答案 0 :(得分:2)

首先use IEEE.STD_LOGIC_ARITH.ALL;&lt; =不要使用它。

然后错误错误

ERROR:HDLCompiler:104 - "D:\mutation\mutation.vhd" Line 6: Cannot find <rng> in library <work>. Please ensure that the library was compiled, and that a library and a use clause are present in the VHDL file.
ERROR:HDLCompiler:69 - "D:\mutation\mutation.vhd" Line 24: <randg> is not declared.
ERROR:HDLCompiler:69 - "D:\mutation\mutation.vhd" Line 27: <randg> is not declared.

^显然你还没有编译rng。或者您切换了库。您无法实例化不存在的组件。

ERROR:HDLCompiler:69 - "D:\mutation\mutation.vhd" Line 9: <arr> is not declared.

^实体mutation的输出属于arr类型,但这种类型是什么?在哪里定义?

ERROR:HDLCompiler:854 - "D:\mutation\mutation.vhd" Line 7: Unit <mutation> ignored due to previous errors.

ERROR:HDLCompiler:374 - "D:\mutation\mutation.vhd" Line 11: Entity <mutation> is not yet compiled.

^太多错误要继续......

ERROR:HDLCompiler:69 - "D:\mutation\mutation.vhd" Line 14: <integer> is not declared.
ERROR:HDLCompiler:69 - "D:\mutation\mutation.vhd" Line 15: <integer> is not declared.
ERROR:HDLCompiler:69 - "D:\mutation\mutation.vhd" Line 16: <integer> is not declared.
ERROR:HDLCompiler:69 - "D:\mutation\mutation.vhd" Line 17: <integer> is not declared.
ERROR:HDLCompiler:69 - "D:\mutation\mutation.vhd" Line 18: <integer> is not declared.
ERROR:HDLCompiler:69 - "D:\mutation\mutation.vhd" Line 21: <s2> is not declared.
ERROR:HDLCompiler:69 - "D:\mutation\mutation.vhd" Line 26: <s3> is not declared.
ERROR:HDLCompiler:69 - "D:\mutation\mutation.vhd" Line 29: <s4> is not declared.

^这些是由于早期错误而发生的。如果其他人被修复,他们就会去。

ERROR:HDLCompiler:69 - "D:\mutation\mutation.vhd" Line 23: <mut_bits> is not declared.

^错误说的是:mut_bits未在任何地方声明。

ERROR:HDLCompiler:69 - "D:\mutation\mutation.vhd" Line 25: <mut_ind> is not declared.
ERROR:HDLCompiler:69 - "D:\mutation\mutation.vhd" Line 28: <bit_pos> is not declared.

^由于arr未知,mut_indbit_pos无法宣布。

ERROR:HDLCompiler:69 - "D:\mutation\mutation.vhd" Line 31: <mem_mutated> is not declared.

^ mem_mutated是组件的输入端口,但没有定义信号。

相关问题