question archive How does Addition, Subtraction, Multiplication and Division work in CCR(condition code register)?  

How does Addition, Subtraction, Multiplication and Division work in CCR(condition code register)?  

Subject:Computer SciencePrice:2.86 Bought12

How does Addition, Subtraction, Multiplication and Division work in CCR(condition code register)?

 

pur-new-sol

Purchase A New Answer

Custom new solution created by our subject matter experts

GET A QUOTE

Answer Preview

Addition and subtraction mechanism-:

There are four types of flags-:

1)Carry

2)Overflow

3)Negative

4) Zero

Setting the all four flags currently and this will help letter subtraction has similar analogy but what we did is we change sign of second operand in subtraction

How the C, V, N and Z bits of the CCR are changed

Condition Code Register Bits Negative, Zero, Overflow, Carry

Overflow bit is set if operation produced an overflow (overflow handling is done here)

Zero bit is set if result of operation is zero (All bits = 0)

Negative bit is set if result of operation in negative (Checking Most Significant Bit = 1)

Carry bit is set if operation produced a carry (for checking borrow on subtraction)

/// These are with regards to CCR

Multiplication and division in CCR -:

We have to handle two types of things here basically 32 bit Multiplication and 64 bit Multiplication two things need to be simultaneously handled so overflow carry flag are must in it and it is the result of repetitive addition at a time Multiplication is result of repetitive addition and division is result of repetitive subtraction so this are all are handled by basic operation like addition and subtraction

So four flags -:

1)Carry

2)Overflow

3)Negative

4) Zero

These are very necessary for Multiplication and division one more point at a time is there is need of two registers if we have to perform 64 bit Multiplications so it need to be handled accordingly and you have to solve it then . All this are handled by programmers intelligence as overflow is handled with the help of two registers and we actually stores it accordingly

In case of division we have to handle special case that is division by zero basically as repetitive subtraction would not help there so it handled with the help of flag variable and answer is not defined at that point of time.