2016-11-18 22 views
0

私はこのマッピングの問題を理解したと思っていましたが、私はそうは思われません...だから、コントロールとデータパスエンティティを持つトップエンティティ(circuito)内部。私はプロジェクトを合成すると、基本的にデータパス(入力と出力)のすべてのポートが接続されていないと警告(0エラー)を出します( "[Synth 8-3331]デザインデータパスは未接続ポートres [31]実際には、デザインのポートを接続せず、データパスエンティティを削除して、制御エンティティをcircuitoに保持することもありません(したがって、制御に問題はありません)。 resetとclkポートは両方のエンティティで同じですが、そのポートをデータパスにマップするのではなく、制御するだけです。みんな助けて、間違っている?コードが必要な場合は教えてください。データパス・コンポーネントを用いて実装されてポートマッピングは一部のエンティティでしか動作しません

library IEEE; 
use IEEE.STD_LOGIC_1164.ALL; 
USE ieee.numeric_std.ALL; 

entity circuito is 
    port (
    clk, reset: in std_logic; 
    x, c0, c1, c2, c3, c4, c5, c6, c7 : in signed(6 downto 0); 
    res : out signed(31 downto 0); 
    done : out std_logic 
    ); 
end circuito; 

architecture Behavioral of circuito is 
    component control 
    port(
    clk, reset, done : in std_logic; 
    e_in : out std_logic; 
    e_out : out std_logic; 
    e_inter : out std_logic_vector (4 downto 0); 
     mux_sel1, mux_sel2, mux_sel3, mux_sel5, mux_sel6 : out std_logic_vector (1 downto 0); 
    mux_sel4, mux_sel7 : out std_logic); 
    end component; 
    component datapath 
    port(
     x, c0, c1, c2, c3, c4, c5, c6, c7 : in signed(6 downto 0); 
       clk, reset : in std_logic; 
       e_in : in std_logic; 
       e_out : in std_logic; 
       e_inter : in std_logic_vector (4 downto 0); 
       mux_sel1, mux_sel2, mux_sel3, mux_sel5, mux_sel6 : in std_logic_vector (1 downto 0); 
       mux_sel4, mux_sel7 : in std_logic; 
       res : out signed (31 downto 0); 
       done : out std_logic); 
    end component; 

    signal e_in : std_logic; 
    signal e_inter : std_logic_vector(4 downto 0); 
    signal finish, e_out : std_logic; 
    signal mux_sel1, mux_sel2, mux_sel3, mux_sel5, mux_sel6 : std_logic_vector (1 downto 0); 
    signal mux_sel4, mux_sel7 : std_logic; 

begin 

inst_datapath: datapath port map(
    clk => clk, 
    reset => reset, 
    done => finish, 
    e_in => e_in, 
    e_out => e_out, 
    e_inter => e_inter, 
    mux_sel1 => mux_sel1, 
    mux_sel2 => mux_sel2, 
    mux_sel3 => mux_sel3, 
    mux_sel4 => mux_sel4, 
    mux_sel5 => mux_sel5, 
    mux_sel6 => mux_sel6, 
    mux_sel7 => mux_sel7, 
    res => res, 
    x => x, 
    c0 => c0, 
    c1 => c1, 
    c2 => c2, 
    c3 => c3, 
    c4 => c4, 
    c5 => c5, 
    c6 => c6, 
    c7 => c7 
    ); 
inst_control: control port map(
    clk => clk, 
    reset => reset, 
    done => finish, 
    e_in => e_in, 
    e_out => e_out, 
    e_inter => e_inter, 
    mux_sel1 => mux_sel1, 
    mux_sel2 => mux_sel2, 
    mux_sel3 => mux_sel3, 
    mux_sel4 => mux_sel4, 
    mux_sel5 => mux_sel5, 
    mux_sel6 => mux_sel6, 
    mux_sel7 => mux_sel7 
    );  

end Behavioral; 

library IEEE; 
use IEEE.STD_LOGIC_1164.ALL; 
USE ieee.numeric_std.ALL; 


--Datapath entity 
entity datapath is 
    port (x, c0, c1, c2, c3, c4, c5, c6, c7 : in signed(6 downto 0); 
      clk, reset : in std_logic; 
      e_in : in std_logic; 
      e_out : in std_logic; 
      e_inter : in std_logic_vector (4 downto 0); 
      mux_sel1, mux_sel2, mux_sel3, mux_sel5, mux_sel6 : in std_logic_vector (1 downto 0); 
      mux_sel4, mux_sel7 : in std_logic; 
      res : out signed (31 downto 0); 
      done : out std_logic  
      ); 
end datapath; 

architecture Behavioral of datapath is 
    signal Rx, Rc0, Rc1, Rc2, Rc3, Rc4, Rc5, Rc6, Rc7 : signed(6 downto 0) := (others => '0'); 
    signal Rout : signed(31 downto 0) := (others => '0'); 
    signal R1, R2, R3, R4, Rx2 : signed(31 downto 0) := (others => '0'); 
    signal add1, add2, mul1, mul2 : signed(31 downto 0) := (others => '0'); 
    signal mux1, mux2, mux3, mux4, mux5, mux6, mux7 : signed(31 downto 0) := (others => '0'); 

begin 
--"Fixed" Input Registers: 

--Register Rc0 
    process (clk, reset) 
    begin 
     if clk'event and clk = '1'then 
      if reset = '1' then 
       Rc0 <= "0000000"; 
      elsif e_in = '1'then 
       Rc0 <= c0; 
      end if; 
     end if; 
    end process; 

--Register Rc1 
    process (clk, reset) 
    begin 
     if clk'event and clk = '1'then 
      if reset = '1' then 
       Rc1 <= "0000000"; 
      elsif e_in = '1'then 
       Rc1 <= c1; 
      end if; 
     end if; 
    end process; 

--Register Rc2 
    process (clk, reset) 
    begin 
     if clk'event and clk = '1'then 
      if reset = '1' then 
       Rc2 <= "0000000"; 
      elsif e_in = '1'then 
       Rc2 <= c2; 
      end if; 
     end if; 
    end process; 

--Register Rc3 
    process (clk, reset) 
    begin 
     if clk'event and clk = '1'then 
      if reset = '1' then 
       Rc3 <= "0000000"; 
      elsif e_in = '1'then 
       Rc3 <= c3; 
      end if; 
     end if; 
    end process; 

--Register Rc4 
    process (clk, reset) 
    begin 
     if clk'event and clk = '1'then 
      if reset = '1' then 
       Rc4 <= "0000000"; 
      elsif e_in = '1'then 
       Rc4 <= c4; 
      end if; 
     end if; 
    end process; 

--Register Rc5 
    process (clk, reset) 
    begin 
     if clk'event and clk = '1'then 
      if reset = '1' then 
       Rc5 <= "0000000"; 
      elsif e_in = '1'then 
       Rc5 <= c5; 
      end if; 
     end if; 
    end process; 

--Register Rc6 
    process (clk, reset) 
    begin 
     if clk'event and clk = '1'then 
      if reset = '1' then 
       Rc6 <= "0000000"; 
      elsif e_in = '1'then 
       Rc6 <= c6; 
      end if; 
     end if; 
    end process; 

--Register Rc7 
    process (clk, reset) 
    begin 
     if clk'event and clk = '1'then 
      if reset = '1' then 
       Rc7 <= "0000000"; 
      elsif e_in = '1'then 
       Rc7 <= c7; 
      end if; 
     end if; 
    end process; 

--Register Rx 
    process (clk, reset) 
    begin 
     if clk'event and clk = '1'then 
      if reset = '1' then 
       Rx <= "0000000"; 
      elsif e_in = '1'then 
       Rx <= x; 
      end if; 
     end if; 
    end process; 

--Intermediate Registers: 

    --Register R1 
    process (clk, reset) 
    begin 
     if clk'event and clk = '1'then 
      if reset = '1' then 
       R1 <= X"00000000"; 
      elsif e_inter(0) = '1'then 
       R1 <= mul1; 
      end if; 
     end if; 
    end process; 

    --Register R2 
    process (clk, reset) 
    begin 
     if clk'event and clk = '1'then 
      if reset = '1' then 
       R2 <= X"00000000"; 
      elsif e_inter(1) = '1'then 
       R2 <= mul2; 
      end if; 
     end if; 
    end process; 

    --Register R3 
    process (clk, reset) 
    begin 
     if clk'event and clk = '1'then 
      if reset = '1' then 
       R3 <= X"00000000"; 
      elsif e_inter(2) = '1'then 
       R3 <= add1; 
      end if; 
     end if; 
    end process; 

    --Register R4 
    process (clk, reset) 
    begin 
     if clk'event and clk = '1'then 
      if reset = '1' then 
       R4 <= X"00000000"; 
      elsif e_inter(3) = '1'then 
       R4 <= add2; 
      end if; 
     end if; 
    end process; 

    --Register Rx2 
    process (clk, reset) 
    begin 
     if clk'event and clk = '1'then 
      if reset = '1' then 
       Rx2 <= X"00000000"; 
      elsif e_inter(4) = '1'then 
       Rx2 <= mul1; 
      end if; 
     end if; 
    end process; 

    --Multiplexer1 
    mux1 <= resize(Rc7, mux1'length) when mux_sel1 = B"00" else 
      resize(Rx, mux1'length) when mux_sel1 = B"01" else 
      resize(R3, mux1'length) when mux_sel1 = B"10" else 
      resize(Rx2, mux1'length) ; 

    --Multiplexer2 
    mux2 <= resize(Rx, mux2'length) when mux_sel2 = B"00" else 
      resize(Rx2, mux2'length) when mux_sel2 = B"01" else 
      resize(R1, mux2'length) ; 

    --Multiplexer3 
    mux3 <= resize(Rc7, mux3'length) when mux_sel3 = B"00" else 
      resize(Rc3, mux3'length) when mux_sel3 = B"01" else 
      resize(Rc1, mux3'length) when mux_sel3 = B"10" else 
      resize(R3, mux3'length) ; 

    --Multiplexer4 
    mux4 <= resize(Rx, mux4'length) when mux_sel4 = '0' else 
      resize(Rx2, mux4'length) when mux_sel4 = '1'; 

    --Multiplexer5 
    mux5 <= resize(R1, mux5'length) when mux_sel5 = B"00" else 
      resize(Rc2, mux5'length) when mux_sel5 = B"01" else 
      resize(R4, mux5'length) when mux_sel5 = B"10" else 
      resize(R3, mux5'length) ; 

    --Multiplexer6 
    mux6 <= resize(Rc6, mux6'length) when mux_sel6 = B"00" else 
      resize(R2, mux6'length) when mux_sel6 = B"01" else 
      resize(Rx2, mux6'length); 

    --Multiplexer7 
    mux7 <= resize(Rc4, mux7'length) when mux_sel7 = '0' else 
      resize(Rc0, mux7'length) when mux_sel7 = '1'; 


    --Adder1 
    add1 <= resize(mux5 + mux6, add1'length) ; 

    --Adder2 
    add2 <= resize(R2 + mux7, add1'length) ; 

    --Multiplier1 
    mul1 <= resize(mux1 * mux2, mul1'length) ; 

    --Multiplier1 
    mul2 <= resize(mux3 * mux4, mul2'length) ; 


    --"Fixed" Output Register: 

    --Register Rout 
    process (clk, reset) 
    begin 
     if clk'event and clk = '1'then 
      if reset = '1' then 
       Rout <= X"00000000"; 
      elsif (e_out = '1') then 
       Rout <= R3; 
       done <= '1'; 
      end if; 
     end if; 
    end process; 

    res <= Rout; 

end Behavioral; 

EDIT:いくつかの変更、働いていた何も考えて作られたが、今だけC5ポートが未接続の持っている、サーキットでのデータパスの両方

+0

'コンポーネントのデータパス 'で' res'はどのように駆動されますか?エラーは、あなたがこのエンティティから 'res'に何かを動かすのではなく、このポートが親エンティティに接続されていないことを意味します。 –

+0

res <= Rout; ここで、Routは単なる結果のレジスタです。私はまた、データパスの実装を追加しました –

+0

私は、合成ツールによって生成された警告を通過し、コードが最適化されていないことを確認します。追加した余分なコードに基づいて、 'control'で' e_inter'がどのように駆動されるのか見てみてください。 –

答えて

0

からコメント、出力e_intercontrolです。常に0です。

res <= Rout; 

R3は、このように駆動されて...

if clk'event and clk = '1'then 
    if reset = '1' then 
     Rout <= X"00000000"; 
    elsif (e_out = '1') then 
     Rout <= R3; 
     done <= '1'; 
    end if; 
end if; 

if clk'event and clk = '1'then 
    if reset = '1' then 
     R3 <= X"00000000"; 
    elsif e_inter(2) = '1'then 
     R3 <= add1; 
    end if; 
end if; 

をこれら2つのコードスニペットからあなたのエラー、datapathresは、このように割り当てられている信号を介してこれを、次のe_inter(2)が常に'0'である場合、に対して行うことができる唯一の割り当てはそれをすべてゼロにリセットすることです。したがって、このポートは定数なので、ツールは最適化します。

この種の問題を診断する基本的な方法は、警告を見ることです。多くの場合、このプロセスは面倒な警告をすることがありますが、メッセージフィルタリングを使用してそれらを少し薄くして、有用なメッセージを明らかにすることができます。この場合、定数伝搬またはシムミラーのために論理および/または信号が除去されていることを伝えるメッセージがあったはずです。

+0

e_inter(2)が正しく '1'に設定され、e_outもコントロールコンポーネントによって '1'意図したとおり、私はこれをシミュレーションで検証しました –

+0

コメントから、 "e_interはこのように駆動されます:' e_inter <= B "00000"; '"変更を加えてから、 'res'はもはや警告を生成していないことに言及しました。あなたが投稿したオリジナルのエラーメッセージを解決しただけでなく、同様の問題を診断するテクニックを提供していると思います。 –

+0

はい、それは本当です、あなたの時間のために多くのおかげで、今私は接続の問題がない –

関連する問題