VHDL数组初始化错误:"":="附近的语法错误

时间:2017-06-19 11:15:15

标签: vhdl

我有一个用于数组初始化的代码。但它显示我跟随错误。

  

错误:HDLCompiler:806 - "":="附近的语法错误。

     

错误:HDLCompiler:854 - 由于先前的错误而忽略了单位。

library IEEE;
use IEEE.std_logic_1164.all;

entity kelvin is
end kelvin;

architecture ospl of kelvin is
type array_new is array (0 to 1) of integer;

begin
array_new := ('127','126');

end ospl;

1 个答案:

答案 0 :(得分:3)

您所做的是声明一个名为array_new的数组类型,并且您直接为其指定一个值。您错过了介绍数组类型对象的步骤。

在代码行之后

type array_new is array (0 to 1) of integer;

您应声明类型为array_new的信号。对于例如修改后的代码如下所示:

library IEEE;
use IEEE.std_logic_1164.all;

entity kelvin is
end kelvin;

architecture ospl of kelvin is
type array_new is array (0 to 1) of integer;
signal array_new_signal: array_new;

begin
array_new_signal <= (127,126);

end ospl;

Refer this link for further explanation:

相关问题