Forum Discussion
Altera_Forum
Honored Contributor
17 years agoI have re-written your code snippet to try to show you what I mean.
I have not checked it so please forgive any typos. library IEEE; use IEEE.STD_LOGIC_1164.all; Entity Adder4 is port( C : in std_logic; X, Y, clock : in std_logic_vector (1 downto 0); R : out std_logic_vector (2 downto 0)); end Adder4; Architecture Version1 of Adder4 is signal Carry : std_logic; component FullAdd3_B port ( A, B, Cin, clk : in std_logic; Sum, Cout : out std_logic); end component; begin --- --- Instantiating modules is not done inside of a process --- All I did was strip away the process statements --- around your 2 instantiations of component FullAdd3_B --- --- in the below example the signals in the --- top level design are associated with --- the signals in the component through --- named association or explicit association --- not by position --- in this case the position is the same as --- your component declaration, but it does --- not have to be UO1: FullAdd3_B PORT MAP (A => X(0), B => Y(0), Cin => C, clk => clock(0), Sum => R(0), Cout => Carry); --- in the instantiation below --- which I have left as you had it --- you are creating the association --- between signals by way of the position --- of the signals in the declaration --- UO2: FullAdd3_B PORT MAP (X(1), Y(1), Carry, clock(1), R(2), R(1)); --- both methods are allowed --- I just like the former as it --- keeps me from stepping on my --- own toes which I do enough --- without even trying end Version1;