Computer logic
Craig A. Cunningham, Ph.D.



 

Basic Concepts in Computer Logic

source: http://www.cs.colostate.edu/~clevelan/computer%20diagram.jpg

When you think about a computer and what it does, you of course think that it.. well.. computes. And this is indeed one part of its job. Computing is really another term for "information transformation"--changing information from one form to another. source: http://www.pcguide.com/intro/works/jobs.htm

  • system: a group of interrelated parts that are assembled to achieve some common goal or end.
  • central processing unit (CPU): The part of a computer which controls all the other parts. . Generally consists of a "control unit," an "arithmetic/logic unit" and "primary storage unit."
  • control unit: The part of a CPU responsible for performing the machine cycle - fetch, decode, execute, store. (click here to read more on this.)
  • arithmetic/logic unit: The part of the central processing unit which performs operations such as addition, subtraction and multiplication of integers and bit-wise AND, OR, NOT, XOR and other Boolean operations.
  • memory: These days, usually used synonymously with Random Access Memory or Read-Only Memory, but in the general sense it can be any device that can hold data in machine-readable format.
  • bus: One of the sets of conductors (wires, PCB tracks or connections in an integrated circuit) connecting the various functional units in a computer.
  • input: subsystems designed to feed data and instructions to a central processing unit
  • process: The sequence of states of an executing program. A process consists of the program code (which may be shared with other processes which are executing the same program), private data, and the state of the processor, particularly the values in its registers.
  • output: Data transferred from a computer system to the outside world via some kind of output device.
  • program: A single, complete and more-or-less self-contained list of instructions, often stored in a single file, whereas "code" and "software" are uncountable nouns describing some number of instructions which may constitute one or more programs or part thereof. Most programs, however, rely heavily on various kinds of operating system software for their execution. The nounds "code" and "software" both refer to the same thing but "code" tends to suggest an interest in the implementation details whereas "software" is more of a user's term.
  • analog vs. digital: analog information exists as an infinite range of continuous values (for example, temperature can be 98.6°F or 98.65°F or 98.651°F, etc., while digital information is limited to a small range of values (for example, 1 o 0). Advantages of digital information include: simplicity, expandability, clarity, and speed. See http://www.pcguide.com/intro/works/comput.htm.

Resource: Free Online Dictionary of Computing, http://wombat.doc.ic.ac.uk/foldoc/ or (US Mirror) http://www.johnsguide.com/foldoc/index.html

Binary numbers

We normally represent numbers in the decimal system. Each "digit" can hold one of ten values, 0,1,2,3,4,5,6,7,8,9. When we count, we increment the right-most digit by 1, until we reach "9," then we increment the next digit and reset the right-most digit to 0.

In binary numbers, each digit can only have two values: 0 and 1. But the system worksthe same way:

0 0
1 1
10 2
11 3
100 4
101 5
110 6
111 7
1000 8

Each binary digit is called a "bit."

To represent letters, a system has been devised that uses 8 bits (one "byte") to represent 256 possible combinations, with each combination assigned to a letter or symbol. This is known as the ASCII system. Only the first 128 values are standard; the remaining 128 are assigned to different values depending on the "character set."

See here to see a table of the ASCII values along with their binary equivalents.

Here is a binary to text converter (and vice versa).

 

Exercise in Computer Logic

As a class, you will write a computer "program" to discover which one of sixteen buttons has been secretly selected in advance by the instructor.

As a "computer" you are limited in your "thinking" to TWO possible answers to any question. Any necessary memory storage must also be done in terms of 1s and 0s.

(The "program" will be projected onto the screen. Each step in the program is )

The "computer" you create will be made of a human "chain" of steps in a process together with a number of"memory addresses" (which will also be humans).

The "input" will be when the instructor says "go." The "output" will be "printing" a choice of button from among the 16 below onto a "screen.".

See how many "steps" you will need to discover the secret selection every time.

Errors and inefficiencies are NOT allowed!

1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14
.
15.
16.

 

 

(adapted from http://www.learner.org/teacherslab/math/patterns/buttons/)