2013-04-23 196 views
0

,我發現了以下錯誤的不兼容:從我的VHDL項目:類型的「變量」,類型爲「可變」

ERROR:HDLParsers:800 - "C:/Users/Theo/Desktop/Dropbox/ECE 120/Robotic Arm/top.vhd" Line 90. Type of in_tilt is incompatible with type of tilt.

ERROR:HDLParsers:800 - "C:/Users/Theo/Desktop/Dropbox/ECE 120/Robotic Arm/top.vhd" Line 91. Type of in_pan is incompatible with type of pan.

ERROR:HDLParsers:800 - "C:/Users/Theo/Desktop/Dropbox/ECE 120/Robotic Arm/top.vhd" Line 92. Type of pwm_tilt is incompatible with type of pwm_tilt.

ERROR:HDLParsers:800 - "C:/Users/Theo/Desktop/Dropbox/ECE 120/Robotic Arm/top.vhd" Line 93. Type of pwm_pan is incompatible with type of pwm_pan.

這裏是適用的代碼。我用下面的代碼頂級VHDL模塊:

library IEEE; 
use IEEE.STD_LOGIC_1164.ALL; 
use ieee.std_logic_unsigned.all; 

entity top is 
port (
    clk_in : in std_logic; 
    pause : in std_logic; 
    reset : in std_logic; 
    switch : in std_logic_vector(3 downto 0);----------------------------------------- 
    deb_in : in std_logic; ---from another switch 
    deb_out : out std_logic; ---to test the debouncer 
    pwm_pan : out std_logic_vector(7 downto 0); 
    pwm_tilt : out std_logic_vector(7 downto 0) 
); 
end top; 

爲PWM組件聲明:

COMPONENT PWM 
PORT(
    clk_100 : in std_logic; 
    reset : IN std_logic; 
     in_tilt : in std_logic; 
     in_pan : in std_logic; 
    pwm_pan : OUT std_logic; 
     pwm_tilt : out std_logic 
    ); 
END COMPONENT; 

另外適當的信號:後

signal tilt : std_logic_vector (7 downto 0); 
signal pan : std_logic_vector (7 downto 0); 

然後在此代碼:(這是我的錯誤出現的地方。)

u1: PWM PORT MAP (
    clk_100 => clk_100, 
    reset => reset, 
--Line 90 in_tilt => tilt, 
--Line 91 in_pan => pan,   
--Line 92 pwm_tilt => pwm_tilt, 
--Line 93 pwm_pan => pwm_pan 
); 

這是PWM模塊VHDL代碼中:

library IEEE; 
use IEEE.STD_LOGIC_1164.ALL; 
use ieee.std_logic_unsigned.all; 

entity PWM is 
Port (clk_100 : in STD_LOGIC; 
     reset : in STD_LOGIC; 
      in_tilt : in std_logic_vector(7 downto 0); 
      in_pan : in std_logic_vector(7 downto 0); 
      pwm_tilt : out std_logic_vector (7 downto 0); 
      pwm_pan : out std_logic_vector (7 downto 0) 
     ); 
end PWM;  

任何想法是什麼造成這個錯誤?我希望我已經包含了所有相關的代碼。謝謝。

+0

「傾斜」和「平移」的類型是什麼? 「PWM」組件聲明的外觀如何? – baldyHDL 2013-04-23 05:46:21

+0

@baldyHDL我添加了組件聲明以及傾斜和平移的類型。 – codedude 2013-04-23 12:33:19

回答

2

在組件聲明中聲明in_tilt,in_pan,pwm_tilt和pwm_pan爲std_logic。稍後調整的信號(傾斜,平移,pwm_tilt,pwm_pan)都是std_logic_vectors!因此這些類型真的不兼容;-)

要解決這個問題,請調整您的組件聲明並在聲明中使用std_logic_vector!

0

tiltstd_logic型。

in_tiltstd_logic_vector型。

對於panin_pan也是如此。 std_logicstd_logic_vector類型通常不兼容(除非您的寬度爲1)。