【问题标题】:I am trying to run the following code in Xilinx but i am encountering multiple errors我正在尝试在 Xilinx 中运行以下代码,但遇到多个错误
【发布时间】:2017-03-28 15:08:07
【问题描述】:

我尝试在 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;

以下是运行代码的错误:

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

我可以做些什么来消除这些错误?

【问题讨论】:

  • 无法理解您使用的是哪个程序。但是,通常重新安装程序就足够了

标签: vhdl xilinx


【解决方案1】:

首先use IEEE.STD_LOGIC_ARITH.ALL;

然后一错再错

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是组件的输入端口,但没有定义信号。

【讨论】:

    猜你喜欢
    • 2022-11-11
    • 2021-11-04
    • 2021-08-07
    • 2020-06-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-04-22
    • 2020-07-06
    相关资源
    最近更新 更多