1
entity Adder4Bit is
Port ( A : in  STD_LOGIC_VECTOR (3 downto 0);
       B : in  STD_LOGIC_VECTOR (3 downto 0);
       S : out  STD_LOGIC_VECTOR (3 downto 0);
       COUT : out  STD_LOGIC);
end Adder4Bit;

architecture structure of Adder4Bit is

component FullAdder -- add the fulladder to this architecture
port (
        A       : in std_logic;
        B       : in std_logic;
        CIN : in std_logic;
        SUM : out std_logic;
        COUT    : out std_logic
        );
end component;

signal wires : std_logic_vector(3 downto 1) := "000";       -- Make a signal "wires" with initial value 000

begin

adder0 : FullAdder port map ( A=> A(0), B => B(0), CIN => '0', SUM => S(0), COUT => wires(1)        );
adder1 : FullAdder port map ( A=> A(1), B => B(1), CIN => wires(1), SUM => S(1), COUT => wires(2)   );
adder2 : FullAdder port map ( A=> A(2), B => B(2), CIN => wires(2), SUM => S(2), COUT => wires(3)   );
adder3 : FullAdder port map ( A=> A(3), B => B(3), CIN => wires(3), SUM => S(3), COUT => COUT       );


end structure;

一番下の adder3 で、プログラムはどの cout がエンティティ Adder4Bit に属し、どの cout がコンポーネント FullAdder に属しているかをどのように認識しますか? 矢印の向きと関係ありますか?

事前にどうもありがとうございました

4

2 に答える 2

4

もちろん、左側はコンポーネント内の名前であり、右側はvhdlシグナルの名前です。

これは、左側のBがstd_logicであり、右側のBがstd_logic_vectorであることを認識しているのと同じ方法です。

于 2012-04-18T09:50:50.363 に答える
2

左側は「ピン名」、右側は「ワイヤ名」です。つまり、次の 2 つです。

adder2 : FullAdder port map ( A=> A(2), B => B(2), CIN => wires(2), SUM => S(2), COUT => wires(3)   );
adder3 : FullAdder port map ( A=> A(3), B => B(3), CIN => wires(3), SUM => S(3), COUT => COUT       );

adder2COUTピンは という信号に接続し、wires(3)adder3ピンCOUTは という信号に接続しますCOUT

これは、ピンと信号に同じ名前を付けることに伴う問題の 1 つです。そのままにしておくと、1 週間程度でそのことを考えても気付かないでしょう。

于 2012-04-18T13:02:12.990 に答える