dio cane
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
entity CSA16_4x4 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_4x4;
|
||||
|
||||
architecture MyCSA16_4x4 of CSA16_4x4 is
|
||||
component RCA4 is
|
||||
Port (A,B: in bit_vector(3 downto 0);
|
||||
cin: in bit;
|
||||
S: out bit_vector(3 downto 0);
|
||||
cout: out bit);
|
||||
end component;
|
||||
signal c4,c8,c12: bit;
|
||||
signal cout0, cout1: bit_vector(3 downto 1);
|
||||
|
||||
signal SL_L: bit_vector(3 downto 0);
|
||||
|
||||
signal S10,S11,SL_H: bit_vector(7 downto 4);
|
||||
signal S20,S21,SH_L: bit_vector(11 downto 8);
|
||||
signal S30,S31,SH_H: bit_vector(15 downto 12);
|
||||
begin
|
||||
RCA0: RCA4 port map(A(3 downto 0),B(3 downto 0),cin,SL_L, c4);
|
||||
|
||||
RCA10: RCA4 port map(A(7 downto 4),B(7 downto 4),'0',S10, cout0(1));
|
||||
RCA11: RCA4 port map(A(7 downto 4),B(7 downto 4),'1',S11, cout1(1));
|
||||
|
||||
RCA20: RCA4 port map(A(11 downto 8),B(11 downto 8),'0',S20, cout0(2));
|
||||
RCA21: RCA4 port map(A(11 downto 8),B(11 downto 8),'1',S21, cout1(2));
|
||||
|
||||
RCA30: RCA4 port map(A(15 downto 12),B(15 downto 12),'0',S30, cout0(3));
|
||||
RCA31: RCA4 port map(A(15 downto 12),B(15 downto 12),'1',S31, cout1(3));
|
||||
|
||||
c8 <= cout0(1) when c4='0' else cout1(1);
|
||||
c12 <= cout0(2) when c8='0' else cout1(2);
|
||||
cout <= cout0(3) when c12='0' else cout1(3);
|
||||
|
||||
SL_H <= S10 when c4='0' else S11;
|
||||
SH_L <= S20 when c8='0' else S21;
|
||||
SH_H <= S30 when c12='0' else S31;
|
||||
|
||||
S(15 downto 12) <= SH_H;
|
||||
S(11 downto 8) <= SH_L;
|
||||
S(7 downto 4) <= SL_H;
|
||||
S(3 downto 0) <= SL_L;
|
||||
|
||||
end MyCSA16_4x4;
|
||||
Reference in New Issue
Block a user