Fixed some bugs.
[calu.git] / cpu / src / exec_op / add_op_b.vhd
index 919c795d23a76eae9f9149eae22dda568226ddec..88e34d432b75e0ba2cf046959ef60f3e8e7a1e67 100644 (file)
@@ -31,7 +31,7 @@ begin
                l_neg := left_operand(gp_register_t'high);
                
                carry_res := unsigned('0' & left_operand)+addcarry;
-               oflo1 := add_oflo(l_neg,'0',std_logic_vector(carry_res)(gp_register_t'high));
+               oflo1 := add_oflo(l_neg,'0',carry_res(gp_register_t'high));
                
                if sub = '1' then
                        tmp_right_operand := unsigned('0' & complement);
@@ -39,15 +39,15 @@ begin
                        tmp_right_operand := unsigned('0' & right_operand);
                end if;
                
-               l_neg := std_logic_vector(carry_res)(gp_register_t'high);
-               r_neg := std_logic_vector(tmp_right_operand)(gp_register_t'high);
+               l_neg := carry_res(gp_register_t'high);
+               r_neg := tmp_right_operand(gp_register_t'high);
                
                carry_res := carry_res + tmp_right_operand;
-               oflo2 := add_oflo(l_neg,r_neg,std_logic_vector(carry_res)(gp_register_t'high));
+               oflo2 := add_oflo(l_neg,r_neg,carry_res(gp_register_t'high));
                
 
-               alu_result_v.result := std_logic_vector(carry_res)(gp_register_t'range);
-               alu_result_v.status.carry := std_logic_vector(carry_res)(carry_res'high);
+               alu_result_v.result := std_logic_vector(carry_res(gp_register_t'range));
+               alu_result_v.status.carry := carry_res(carry_res'high);
                
                
                alu_result_v.status.carry := oflo1 or oflo2;