Subtract the contents of register B from P. 3. If P is negative, set the low-order bit of A to 0, otherwise set it to 1. After 8 repetitions, the quotient is in A. If P is non-negative, it is the remainder. The result will be available in the form of an integer and a rounded off fraction. A shift register is used for left shift.
Subtraction is carried out using two's complement.
The system has a two phase clock, for a synchronous design. Our goal was to implement an 8-bit ALU, supporting division, and including addition and subtraction. Logic is provided to choose the required operation. The outputs at the end of every state are available on the output pads for testability.