| Line 50... |
Line 50... |
variable aa, bb : std_logic_vector(32 downto 0);
|
variable aa, bb : std_logic_vector(32 downto 0);
|
variable sum : std_logic_vector(32 downto 0);
|
variable sum : std_logic_vector(32 downto 0);
|
variable start : std_logic;
|
variable start : std_logic;
|
variable do_write : std_logic;
|
variable do_write : std_logic;
|
variable do_hi : std_logic;
|
variable do_hi : std_logic;
|
|
variable sign_extend : std_logic;
|
|
|
begin
|
begin
|
do_div_temp := do_div_reg;
|
do_div_temp := do_div_reg;
|
do_signed_temp := do_signed_reg;
|
do_signed_temp := do_signed_reg;
|
count_temp := count_reg;
|
count_temp := count_reg;
|
a_temp := reg_a;
|
a_temp := reg_a;
|
b_temp := reg_b;
|
b_temp := reg_b;
|
answer_temp := answer_reg;
|
answer_temp := answer_reg;
|
|
sign_extend := do_signed_reg and not do_div_reg;
|
|
|
aa := '0' & ZERO;
|
aa := '0' & ZERO;
|
bb := '0' & ZERO;
|
bb := '0' & ZERO;
|
sum := '0' & ZERO;
|
sum := '0' & ZERO;
|
start := '0';
|
start := '0';
|
| Line 78... |
Line 80... |
do_write := '1';
|
do_write := '1';
|
do_hi := '1';
|
do_hi := '1';
|
when mult_mult =>
|
when mult_mult =>
|
start := '1';
|
start := '1';
|
do_div_temp := '0';
|
do_div_temp := '0';
|
|
do_signed_temp := '0';
|
|
when mult_signed_mult =>
|
|
start := '1';
|
|
do_div_temp := '0';
|
|
do_signed_temp := a(31) xor b(31);
|
when mult_divide =>
|
when mult_divide =>
|
start := '1';
|
start := '1';
|
do_div_temp := '1';
|
do_div_temp := '1';
|
do_signed_temp := '0';
|
do_signed_temp := '0';
|
when mult_signed_divide =>
|
when mult_signed_divide =>
|
| Line 120... |
Line 127... |
end if;
|
end if;
|
|
|
if do_div_reg = '1' then
|
if do_div_reg = '1' then
|
bb := reg_b(32 downto 0);
|
bb := reg_b(32 downto 0);
|
else
|
else
|
bb := '0' & reg_b(63 downto 32);
|
-- bb := '0' & reg_b(63 downto 32);
|
|
bb := (reg_b(63) and sign_extend) & reg_b(63 downto 32);
|
end if;
|
end if;
|
aa := '0' & reg_a;
|
-- aa := '0' & reg_a;
|
|
aa := (reg_a(31) and sign_extend) & reg_a;
|
sum := bv_adder(aa, bb, do_div_reg);
|
sum := bv_adder(aa, bb, do_div_reg);
|
-- sum := bv_adder_lookahead(aa, bb, do_div_reg);
|
-- sum := bv_adder_lookahead(aa, bb, do_div_reg);
|
|
|
if count_reg(5) = '0' and start = '0' then
|
if count_reg(5) = '0' and start = '0' then
|
count_temp := bv_inc6(count_reg);
|
count_temp := bv_inc6(count_reg);
|
| Line 150... |
Line 159... |
end if;
|
end if;
|
else -- mult_mode
|
else -- mult_mode
|
if reg_b(0) = '1' then
|
if reg_b(0) = '1' then
|
b_temp(63 downto 31) := sum;
|
b_temp(63 downto 31) := sum;
|
else
|
else
|
b_temp(63 downto 31) := '0' & reg_b(63 downto 32);
|
b_temp(63 downto 31) := sign_extend & reg_b(63 downto 32);
|
|
if reg_b(63 downto 32) = ZERO then
|
|
b_temp(63) := '0';
|
|
end if;
|
end if;
|
end if;
|
b_temp(30 downto 0) := reg_b(31 downto 1);
|
b_temp(30 downto 0) := reg_b(31 downto 1);
|
if count_reg = "010000" and --early stop
|
if count_reg = "010000" and sign_extend = '0' and --early stop
|
reg_b(15 downto 0) = ZERO(15 downto 0) then
|
reg_b(15 downto 0) = ZERO(15 downto 0) then
|
count_temp := "111111";
|
count_temp := "111111";
|
b_temp(31 downto 0) := reg_b(47 downto 16);
|
b_temp(31 downto 0) := reg_b(47 downto 16);
|
end if;
|
end if;
|
if count_reg = "001000" and --early stop
|
if count_reg = "001000" and sign_extend = '0' and --early stop
|
reg_b(23 downto 0) = ZERO(23 downto 0) then
|
reg_b(23 downto 0) = ZERO(23 downto 0) then
|
count_temp := "111111";
|
count_temp := "111111";
|
b_temp(31 downto 0) := reg_b(55 downto 24);
|
b_temp(31 downto 0) := reg_b(55 downto 24);
|
end if;
|
end if;
|
end if;
|
end if;
|
| Line 193... |
Line 205... |
end process;
|
end process;
|
|
|
end; --architecture logic
|
end; --architecture logic
|
|
|
|
|
|
|
No newline at end of file
|
No newline at end of file
|