2017-06-19 66 views
-1

我有數組初始化的寫代碼,但它顯示我以下錯誤VHDL陣列初始化錯誤:「附近有語法錯誤‘:=’

ERROR:HDLCompiler:806 - "Syntax error near ":=".

ERROR:HDLCompiler:854 - Unit ignored due to previous errors.

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; 
+5

我認爲你需要退後一步,並先學習一些VHDL。試試我公司網站[本頁](https://www.doulos.com/knowhow/vhdl_designers_guide/)上的VHDL背景鏈接。具體來說,'array_new'是_type_,而不是_object_;你不能給它賦值,你需要聲明一個類型的對象(例如信號,變量)。 –

回答

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:

+0

我越來越errro @array_new_signal <=('127','126');行 –

+0

@KelvinKalariya - 我很抱歉遲到的回覆,刪除單引號將解決問題。 – x7ktrz