Bit-Slice Design: Controllers and ALUs

by Donnamaie E. White

Copyright © 1996, 2001, 2002 Donnamaie E. White

 
 

Preface

Table of Contents

1. Introduction

2. Simple Controllers

3. Adding Programming Support to the Controller

4. Refining the CCU

5. Evolution of the ALU

6. The ALU and Basic Arithmetic

7. Tying the System Together

Glossary

 

 

The ALU and Basic Arithmetic

Last Edit November 1, 1996; May 1, 1999 ; July 15, 2001


Arithmetic - General

The Am2901 and Am2903 perform two's complement arithmetic. Two's complement notation is a weighted binary code, where the sign bit (most significant bit) has a negative weight. For example, for an 8-bit system

The negative number encoding can be formed by logically complementing all bits abd adding 1 to the encoding of the positive number.

The advantage of the two's complement number system is that there is a single zero. The numbers are normally considered to be binary fractions, so that a positive number is less than 1 and a negative number is greater than 1.

Addition

Addition is performed as a straightforward binary addition, with the sign of the result dependent on the signs of the operands.

For two positive numbers the sign is positive, and for two negative numbers it is negative. A check should always be made for overflow, which is possible when the sums of the magnitudes exceed 1. The Am2901 and the Am2903 both provide an overflow pin.

Subtraction

SUbtraction is processed in the same manne as addition, i.e., complement the subtrahend and add. Both the Am2901 and Am2903 provide two subtraction operations, A - b and B - A.

Multiplication

The most difficult of the arithmetic operations so far is multiplication.

Unsigned Binary

To perform B x A in two's complement, where the numbers are either both unsigned or both positive, the procedure is the same as for binary multiplication. The multiplier is examined bit by bitright to left (least significant to most significant bit) to determine if the multiplicand is to be added to the partial result. If so, the multiplicand is aligned so that the least significant is under the multiplier bit's position, as shown in Figure 6-5.

Figure 6-5 Unsigned binary multiplication

Multiplicand Negative

When the multiplicand is negative, B * (-A), sign extension of the multiplicand is used to form the first partial product, maintaining the 2n length of the magnitude. Each time the multiplicand is added, the sign extension form is used. The sign of the multiplicand is the sign of the result.

Multiplier Negative

When the multiplier is negative, (-B) * A, the multiplication proceeds as for the unsigned or both-positive case, except that at the end, the two's complement of A, the multiplicand, is added aligned on the binary points and not by placing the least significant bit of A under the sign bit of B, the multiplier.

Both Negative

Where both numbers are negative, the multiplicand is sign-extended and added as for the multiplicand-negative algorithm. At the end, the two's complement of the multiplicand is added, properly aligned as for the multiplier-negative alforithm.

Result

The point of reviewing the various cases was to produce a common algorithm (method 1, Flores, Computer Arithmetic):

  1. the leftmost bits are a function of the sign of the multiplicand
  2. partial product addition is required with alignment
  3. the two's complement of the multiplicand is added at the end if the sign of the multiplier is negative.

 

For information about this file or to report problems in its use email dew@Donnamaie.com

Copyright © September 1996, 1999, 2001, 2002 Donnamaie E. White White Enterprises