23use ieee.std_logic_1164.
all;
24use ieee.std_logic_arith.
all;
25use ieee.std_logic_unsigned.
all;
69 variable msrc : slv16 := (others=>'0');
70 variable mdst : slv16 := (others=>'0');
71 variable mci : slbit := '0';
72 variable sum : slv16 := (others=>'0');
73 variable co8 : slbit := '0';
74 variable co16 : slbit := '0';
76 variable nno : slbit := '0';
77 variable nzo : slbit := '0';
78 variable nvo : slbit := '0';
79 variable nco : slbit := '0';
81 variable src_msb : slbit := '0';
82 variable dst_msb : slbit := '0';
83 variable sum_msb : slbit := '0';
94 variable pa :
in slv8; -- input a
95 variable pb :
in slv8; -- input b
96 variable pci :
in slbit; -- carry
in
97 variable psum :
out slv8; -- sum
out
98 variable pco :
out slbit -- carry
out
105 tmp := conv_std_logic_vector((conv_integer(pa) + conv_integer(pb) +
106 conv_integer(pci)),9);
107 psum := tmp(7 downto 0);
110 end procedure do_add8_ci_co;
115 when c_aunit_mod_pass => msrc := DSRC;
116 when c_aunit_mod_inv => msrc := not DSRC;
117 when c_aunit_mod_zero => msrc := (others=>'0');
118 when c_aunit_mod_one => msrc := (others=>'1');
123 when c_aunit_mod_pass => mdst := DDST;
124 when c_aunit_mod_inv => mdst := not DDST;
125 when c_aunit_mod_zero => mdst := (others=>'0');
126 when c_aunit_mod_one => mdst := (others=>'1');
131 when c_aunit_mod_pass => mci := CI;
132 when c_aunit_mod_inv => mci := not CI;
133 when c_aunit_mod_zero => mci := '0';
134 when c_aunit_mod_one => mci := '1';
138 do_add8_ci_co(msrc(7 downto 0), mdst(7 downto 0), mci,
139 sum(7 downto 0), co8);
140 do_add8_ci_co(msrc(15 downto 8), mdst(15 downto 8), co8,
141 sum(15 downto 8), co16);
157 if unsigned(sum(7 downto 0)) = 0 then
170 if unsigned(sum) = 0 then
186 if unsigned(CIMOD) = unsigned(c_aunit_mod_zero) then
187 nvo := not(src_msb xor dst_msb) and (src_msb xor sum_msb);
189 if unsigned(SRCMOD) = unsigned(c_aunit_mod_inv) then
190 nvo := (src_msb xor dst_msb) and not (src_msb xor sum_msb);
192 nvo := (src_msb xor dst_msb) and not (dst_msb xor sum_msb);
199 when c_aunit_ccmode_clr|c_aunit_ccmode_tst =>
203 when c_aunit_ccmode_com =>
207 when c_aunit_ccmode_inc =>
208 nvo := sum_msb and not dst_msb;
211 when c_aunit_ccmode_dec =>
212 nvo := not sum_msb and dst_msb;
215 when c_aunit_ccmode_neg =>
216 nvo := sum_msb and dst_msb;
219 when c_aunit_ccmode_adc =>
220 nvo := sum_msb and not dst_msb;
222 when c_aunit_ccmode_sbc =>
223 nvo := not sum_msb and dst_msb;
do_add8_ci_copa,pb,pci,psum,pco,
std_logic_vector( 3 downto 0) slv4
std_logic_vector( 2 downto 0) slv3
std_logic_vector( 8 downto 0) slv9
std_logic_vector( 15 downto 0) slv16
std_logic_vector( 7 downto 0) slv8
std_logic_vector( 1 downto 0) slv2