2014-03-26 50 views
1

我試圖用VHDL一些簡單的數學函數,但我不斷收到錯誤VHDL綜合誤差

found '0' definitions of operator "+", cannot determine exact overload matching definition for "+",我也得到有關司同樣的錯誤。

下面是相關代碼:

signal delay_1   : integer range 0 to 127; 
-- signal delay_2   : integer range 0 to 127; 
-- signal delay_3   : integer range 0 to 127; 
-- signal delay_4   : integer range 0 to 127; 
    signal us_clock   : std_logic; 
    signal ds_squareroot  : integer range 0 to 100; 
    signal ds_squared  : integer range 0 to 5000; 

if(i_reset = '1') then 
     delay_1  <= 0; 
     delay_2  <= 0; 
     delay_3  <= 0; 
     delay_4  <= 0; 
     ds_squared  <= 0; 
     ds_squareroot <= 0; 
    elsif(rising_edge(i_clock)) then 
     -- Delay 1 calculations 
     ds_squared <= (i_distance*i_distance + (speaker_distance)*(speaker_distance)); 
     for n in 0 to 20 loop 
      ds_squareroot <= ((50 + ds_squared/ds_squareroot)/2); 
     end loop; 
     delay_1 <= (ds_squareroot - i_distance)/ speed_sound; 

這裏是我打電話的庫。

library IEEE; 
use IEEE.STD_LOGIC_1164.ALL; 
use IEEE.NUMERIC_STD.ALL; 
use IEEE.STD_LOGIC_UNSIGNED.ALL; 
library UNISIM; 
use UNISIM.VComponents.all; 

任何意見,爲什麼這不是編譯將是非常有益的。

+0

你可以看看http://stackoverflow.com/questions/8109078/addition-in-vhdl-not-compiling,它有一個類似的錯誤。 – sashoalm

+2

在另一個說明中,不應該將'numeric_std'和'std_logic_unsigned'一起使用,事實上,根本不應該使用'std_logic_unsigned',因爲它實際上不是一個標準包。 –

+2

這一切都與你的信號有哪些數據類型有關。既然你切斷了聲明,我們無法真正幫助你。請讓你的代碼片段VETSMOD。 http://www.sigasi.com/content/vetsmod-get-better-feedback-your-vhdl-code-snippets – Philippe

回答

0

錯誤是i_distance是std_logic_vector和speaker_distance是一個整數。顯然這並沒有綜合,因爲這裏的類型不同。我用這個簡單的表達式解決了它

distance  <= conv_integer(i_distance); 

這使得兩個整數,允許設計合成。謝謝您的幫助。