Question: TASK 4 You are required to modify and fill in the body of the functions to implement a divider with unsign numbers. */ // write
TASK 4
You are required to modify and fill in the body of the functions to implement a divider with unsign numbers. */
// write your code here.
}
/*****************************************************************************\ Function Description: unsigned_div. this function simulat a divider with signed numbers. it will save the results in Remainder and Quotient.
Arguments: IN Dividend : int - the Dividend IN Divisor : int - the Divisor OUT Remainder : int * - the Remainder OUT Quotient : int * - the Quotient
Return Value: void \*****************************************************************************/ void signed_div(IN int Dividend, IN int Divisor, OUT int * Remainder, OUT int * Quotient){ BOOL DividendBS = get_bit(Dividend, WIDTH - 1); if(DividendBS == TRUE) Dividend = neg(Dividend);
BOOL DivisorBS = get_bit(Divisor, WIDTH - 1); if(DivisorBS == TRUE) Divisor = neg(Divisor);
unsigned_div(Dividend, Divisor, Remainder, Quotient);
BOOL RemainderBS = DividendBS; BOOL QuotientBS = xor_gate(DividendBS, DivisorBS);
if(RemainderBS == TRUE) *Remainder = neg(*Remainder); if(QuotientBS == TRUE) *Quotient = neg(*Quotient); }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
