3. Binary Circuit Encoding


Digital Computers and Binary Circuits

There are two basic types of computers:
          digital computers, and
          analog computers.

Analog computers tend to be used for special purpose applications which involve controlling manufacturing or similar "real-time" processes. They measure values using a continuous range (typically, a continuous range of electrical voltages) to manipulate environmental characteristics such as temperature and gas pressure. There has been a tendency over the past 10 or 20 years to replace this type of computer with digital computers which are connected to the "real-world" with "analog-to-digital" interface devices.

Digital computers are, by far, the more common type. They are the only type which we will consider in this course.

The main idea behind a digital computer is that, at least at a low level, values are represented using "descrete", rather than "continuous" units. Instead of a value being represented by any possible voltage between 0 volts and 5 volts (for example), a digital computer might require that the value be represented by one of the voltages: 0 volts, 1.5 volts, 3.0 volts, or 4.5 volts.

Some early digital computer systems used a 10-level representation scheme (which made working with our "normal" base 10 number system easy). Various other numbers of levels have been attempted with varying degrees of success. Modern digital computers, however, are restricted to a simple 2-level, or "binary" system.

As currently implemented, a "digital computer" is synonymous with a "computer which uses a binary system for value representation".


What is a "code"?

A "code" is a symbol which represents something else, where the "something else" could be any "real" or "abstract" entity. The "code symbol" has no meaning unless the relationship between the symbol and the represented entity (called the coding system) is known.

There are 3 main reasons for using codes:

  1. communication: When we talk to someone-else, we use "words" which are really codes for ideas (we actually use varying frequencies of sound waves as codes for words, which are in turn codes for ideas). Alternately, we might use flashes of light of different duration to send messages using Morse code. Typically, computer components use patterns of "off" and "on" electrical signals to transmit information to other components.
  2. internal representation: When we remember or think about some object, that object is represented in our brain as some complex collection of connections of neurons (it is interesting to note that the neurological connections used to represent the same object in the brains of two different people will be quite different). In a computer information is internally represented using the same kind of "off"/"on" patterns used for communication.
  3. encryption: Encryption can be thought of as a method of limiting communication. By using a system of codes known only to the originator and the intended receiver, the ability of someone (or something) else understanding the message is avoided.

Codes are used to identify a particular entity (or value) from within a larger collection of possible values. This "collection of possible values" is called the domain. The Morse code, for example, provides a collection of "code values" for letters and other character symbols. The domain of the Morse code is the collection of "character symbols". Any code system has a limited domain of things it can represent. When information is to be represented using a code, it is important to classify the information in terms of an appropriate domain, in order to select an appropriate code system.

A code system which assigned the collection of symbols:
     @ # $ %
to the entities:
     spring summer fall winter
respectively, has a domain which would be appropriate if the information to be encoded were "my favourite season"; its domain would not be appropriate if the information were "my age".

Within any particular domain, we usually think of the relationship between codes and represented entities as being one-to-one; that is, each code stands for only one entity and each entity is only represented by a unique code. Note, however, that in certain situations, one-to-many or many-to-one relationships between codes and entities may be appropriate.


Coding Schemes: Encoding and Decoding

An encoding scheme is a method for determining the code to be used to represent some specific entity. With a "proper" encoding scheme, a single entity may only be "encoded" into one, unique code value.

A decoding scheme is a method for determing the entity being represented by a particular code. With a "proper" decoding scheme, a single code can represent only one, unique entity.

A coding system is a combination of encoding and decoding schemes.

Entities may belong to many "proper" coding systems (same entity, different codes) provided that there is a unique relationship between the entity and its code in each system.

Similarly, codes may belong to many ("proper") coding systems (same code representing a different entity in a different system).

Coding systems are often defined using a tabular representation. For example, the Morse code could be defined by the table:
A   .-
B   -...
C   -.-.
D   -..
E   .
F   ..-.
G   --.
H   ....
I   ..
J   .---
K   -.-
L   .-..
M   --
N   -.
O   ---
P   .--.
Q   --.-
R   .-.
S   ...
T   -
U   ..-
V   ...-
W   .--
X   -..-
Y   -.--
Z   --..
0   -----
1   .----
2   ..---
3   ...--
4   ....-
5   .....
6   -....
7   --...
8   ---..
9   ----.
Fullstop   .-.-.-
Comma   --..--
Query   ..--..

Although it might, at first, seem useless, it is possible to have an encoding system with no corresponding decoding system, a system whereby entities can be transformed into codes, with no ability to perform the reverse transformation. A simple example of where this is often used is in "password systems"; the original password is encoded and stored in its encoded form; when someone wants to use the "passworded" system, he/she enters the password which is encoded and compared to the encoded original password; in this way the real password is never stored in a form which could be accessed by an illegal "hacker".


Binary Codes

Although a single binary code system (one with only two code values) is extremely restrictive, very complex code systems can be developed using sequences or patterns of binary code values.

Almost all computer systems employ only code systems in which the codes are composed of multiple binary values.