2016-12-09 11 views
0

私は、次の3つのファイルでプロジェクトを持っている、と私はCAファイルで、このエラーを取得しています:(VHDL)STD_LOGIC_VECTOR値

 
Line 65: Type error near state_int ; current type std_logic_vector; expected type std_logic 
ERROR:HDLCompiler:854 - "" Line 40: Unit ignored due to previous errors. 

CAファイル

library IEEE; 
use IEEE.STD_LOGIC_1164.ALL; 

-- Uncomment the following library declaration if using 
-- arithmetic functions with Signed or Unsigned values 
--use IEEE.NUMERIC_STD.ALL; 

-- Uncomment the following library declaration if instantiating 
-- any Xilinx primitives in this code. 
--library UNISIM; 
--use UNISIM.VComponents.all; 

entity CA is 

    port(clk,rst:in std_logic; 
      state:out std_logic_vector(0 to 8) 
      ); 

end CA; 

architecture Behavioral of CA is 

    Component cell 
     port(L,R,clk,rst:in std_logic; 
       state:out std_logic 
      ); 
    end component; 

    Component cellm 
     port(L,R,clk,rst:in std_logic; 
       state:out std_logic 
      ); 
    end component; 

    signal state_int:std_logic_vector(0 to 8); 

begin 


    state <= state_int; 
    U_cell0:cell 

    port map(clk => clk, 
       rst =>rst, 
       L => '0', 
       R => state_int, 
       state => state_int(0) 
       ); 


end Behavioral; 

セルファイル

entity cell is 

    port(L,R,clk,rst:in std_logic; 
       state:out std_logic 
      ); 

end cell; 

architecture Behavioral of cell is 

signal state_pr,state_nx:std_logic; 

begin 

    state_nx <= ((not L) and R and state_pr) or (L and (not R)); 

    Process(clk,rst) 
    Begin 
     if rst = '0' then 
      state_pr <= '0';  
     elsif rising_edge(clk) then 
      state_pr <= state_nx; 
     end if; 
    end process;  

end Behavioral; 

CELLMファイル

entity cellm is 

    port(L,R,clk,rst:in std_logic; 
       state:out std_logic 
      ); 

end cellm; 

architecture Behavioral of cellm is 

    signal state_pr,state_nx:std_logic; 

begin 

    state_nx <= ((not L) and R and state_pr) or (L and (not R)); 

    Process(clk,rst) 
    Begin 
     if rst = '0' then 
      state_pr <= '1';  
     elsif rising_edge(clk) then 
      state_pr <= state_nx; 
     end if; 
    end process; 
end Behavioral; 

私が間違って何をしているのですか?

+0

私はVHDLを行って以来、しばらくしていますが、あなたは 'std_logic_vector 'シグナルと' std_logic'ポートを接続しようとしているようです。これは明らかに、ミスマッチ(単一対複数レーン)のために機能しません。 – MasterAM

+0

コンポーネントU_cell0のstate_int(std_logic_vector)にR(std_logic)をマップしました。 'R => state_int' –

答えて

1

実際には、デザインに3つの問題があります。最初の二つの問題は、コメントで言及された:

  1. をあなたはSTD_LOGIC_VECTOR信号state_intとSTD_LOGICポートRを接続しようとしています。これは、明らかに、原因あなたもSTD_LOGIC_VECTOR信号状態とSTD_LOGICポートstate_int(0)に接続しようとしている次の行で
  2. (マルチレーン対シングル)のミスマッチに動作しません。
  3. また、セルエンティティに別の問題があります。 の状態の出力は何にも割り当てられません。したがって、セルエンティティからの実際の出力はありません。最終的にコンパイラから警告が出るかもしれません。
+0

あなたの答えは自己完結型にしてください。クレジットを与えることは常に礼儀正しいですが、コメントは消える可能性があるため、回答に関連情報を含めてください。 – rici

+0

よろしくお願い致します。私はちょうどそれを編集しました。 – Renato

+0

1. 'R'と' state_int'は異なる* types *であり、関連付けることはできません。 'R'をインデックス名' state_int(0) 'に関連付けますか? 2.正式な「状態」を実際の名前付き( 'state_int(0)')に接続することは合法です。要素タイプstd_logic_vectorの基本タイプは、基本タイプstd_logic(std_ulogicまたはstd_logicは-2008以前に依存)と同じです。 3.このコードは未完成です。 'U_cell0'出力' state'は、出力ポート 'state'の要素に割り当てられる' state_int(0) 'と関連しています。 – user1155120