2014-09-19 126 views
0

我對此更新,這是作業,但我想了解這個真正不一致的錯誤。我有2個錯誤;一個在第11行,一個在第17行,它們都是語法錯誤VHDL語法錯誤10500

); -- line 11 BEGIN --line 17

所有代碼

Library ieee; 
Use ieee.std_logic_1164.all; 
entity addsub4 is 

port(
a: in std_logic_vector(3 downto 0); 
b: in std_logic_vector (3 downto 0); 
e: in std_logic; 
carry: out std_logic; 
over: out std_logic; 
sout: out std_logic_vector (3 downto 0); 
); 
end addsub4; 

architecture addsub4 of addsub4 is 
signal c: std_logic_vector (4 downto 0); 
signal bx: std_logic_vector (3 downto 0); 
BEGIN 
bx <= b xor e&e&e&e; 
c(0) <= e; 
s <= a xor bx xor c(3 downto 0); 
c (4 downto 1) <= (a and bx) or (c(3 downto 0) and (a xor bx)); 
carry <= c(4); 
over <= c(3) xor c(4); 
end addsub4; 
+0

請添加您收到的錯誤 – Deepend 2014-09-19 17:52:06

+0

有一些工具可以提供更多信息 - ghdl -a addsub4.vhdl:「addsub4.vhdl:11:40:extra';'在接口列表的末尾「,以及那些告訴你爲什麼 - nvc -a addsub4.vhdl」**錯誤:意外)解析接口聲明,期望常量,信號,變量,文件或標識符之一文件addsub4.vhdl,Line 12「(同時顯示字符和行)。 VHDL中的語法規則允許使用前面的語法進行解析。我認爲Altera的10500給了你一個期待的列表,有點像nvc。 – user1155120 2014-09-19 20:39:16

回答

0

對於第一錯誤;在一個PORT聲明中,分號是一個分隔符,而不是終結符。換句話說,最後的聲明;

sout: out std_logic_vector (3 downto 0); 

應該只是

sout: out std_logic_vector (3 downto 0) 

...因爲沒有進一步的聲明分離。

+0

謝謝你,並修復了我的所有問題!謝謝!!! – Josh 2014-09-19 18:01:42