Basic Unsigned Numeric Encoding


In order to represent and manipulate numeric values within the circuits of a computer system it is necessary to use some coding scheme whereby each number can be represented or "encoded" by the pattern of electrically on/off states in a collection of circuits. For a computer, the simplest and fastest scheme for encoding numeric values is the Unsigned Binary Encoding scheme.


Encoding

Number of Circuits Required for Encoding



The Decimal Odometer Analogy

Unsigned Binary Encoding

pattern in word: off

(0)

on

(1)

off

(0)

off

(0)

on

(1)

on

(1)

off

(0)

off

(0)

weight 128 64 32 16 8 4 2 1

the value of this encoded word (01001100) would be 64 + 8 + 4 = 76

weight 128 64 32 16 8 4 2 1
pattern 1 0 0 0 1 0 0 1


Multi-Column Addition

Each binary column therefore requires us to consider three bits: two bits from the actual numbers being added, and a third bit coming from the "carry" out of the column to the right. With three bits, there are only eight possible combinations:

Three bit addition, showing "result" and "carry":

	0 + 0 + 0 -->  result: 0   carry: 0
	0 + 0 + 1 -->  result: 1   carry: 0
	0 + 1 + 0 -->  result: 1   carry: 0
	0 + 1 + 1 -->  result: 0   carry: 1
	1 + 0 + 0 -->  result: 1   carry: 0
	1 + 0 + 1 -->  result: 0   carry: 1
	1 + 1 + 0 -->  result: 0   carry: 1
	1 + 1 + 1 -->  result: 1   carry: 1

We can express the above list In tabular form:

Adding Two Binary Numbers: The 8 Possible Input Combinations and Their Outputs
bit values being added

 
carry in from previous column

0
0

0

0
0

1

0
1

0

0
1

1

1
0

0

1
0

1

1
1

0

1
1

1

column result 0 1 1 0 1 0 0 1
carry to next column 0 0 0 1 0 1 1 1


Multi-Column Subtraction

3-Bit Subtraction: The 8 Possible Input Combinations and Their Outputs
"Subtrahend"
minus "minuend"

minus borrow from previous

0
0

0

0
0

1

0
1

0

0
1

1

1
0

0

1
0

1

1
1

0

1
1

1

column result 0 1 1 0 1 0 0 1
borrow from next column 0 1 1 1 0 0 0 1


Application of Logic Gates to Basic Binary Encoding


Simple binary logic gates operate on one pair of single bits at a time, but most basic computer operations work on pairs of multiple bits. In general this increases the speed at which the computer operates. For example, comparing two patterns of 16 bits each in parallel should be 16 times faster than performing 16 separate comparisons on pairs of single bits.

Each logic gate takes a certain (small) amount of time to respond to a change in its inputs; this is called the gate switching time. The time required to perform any basic computer instruction depends upon the maximum number of logic gates signals must pass through to complete the instructional operation (plus some other "overhead" factors.

The fastest instructions should therefore be those which involve no operational logic gates: the shifts and rotates, followed by those which involve only one level of operational logic gates: the bit level logical operators, and so on.

In actual practice, computer instructions are organized so as to start on regular internal clock pulses (a 200MHz clock, for example, providing 200 million pulses per second). Even at today's high clock speeds, modern gate switching times in VLSI is fast enough that multiple logic gates can be managed within a single clock pulse "frame"; however, when the instruction becomes complex enough that the number of logic gates on the longest path reaches a certain level, the instruction will require multiple clock pulse "frames" to complete.


Fast Operations That Require No Operational Logic Gates



Bit Manipulation with a Single Layer of Operational Gates

Note that while these computer operations have the same names as the logic gates on which they are based, they operate on two words in parallel and not on a pair of bits.

Unsigned Binary Addition - Multiple Layers of Gates