34 lines
869 B
VHDL
34 lines
869 B
VHDL
|
|
entity CSA16_2x8 is
|
|
Port (A,B: in bit_vector(15 downto 0);
|
|
cin: in bit;
|
|
S: out bit_vector(15 downto 0);
|
|
cout: out bit);
|
|
end CSA16_2x8;
|
|
|
|
architecture MyCSA16_2x8 of CSA16_2x8 is
|
|
component RCA8 is
|
|
Port (A,B: in bit_vector(7 downto 0);
|
|
cin: in bit;
|
|
S: out bit_vector(7 downto 0);
|
|
cout: out bit);
|
|
end component;
|
|
|
|
signal c8: bit;
|
|
signal cout0, cout1: bit;
|
|
signal SL: bit_vector(7 downto 0);
|
|
signal SH: bit_vector(15 downto 8);
|
|
signal S0,S1: bit_vector(15 downto 8);
|
|
begin
|
|
RCA8_1: RCA8 port map(A(7 downto 0),B(7 downto 0),cin,SL,c8);
|
|
RCA8_21: RCA8 port map(A(15 downto 8),B(15 downto 8),'0',S0,cout0);
|
|
RCA8_22: RCA8 port map(A(15 downto 8),B(15 downto 8),'1',S1,cout1);
|
|
|
|
cout <= cout0 when c8='0' else cout1;
|
|
|
|
SH <= S0 when c8='0' else S1;
|
|
S(15 downto 8) <= SH;
|
|
S(7 downto 0) <= SL;
|
|
|
|
end MyCSA16_2x8;
|