CPSC 100: Principles of Computer Science
Spring 1997
Week 3 Reading Guide

This is the third of the weekly reading guides for Computer Science 100.

Week 3 (April 14 to April 18)

The reading for this week is Chapter 3 of the text, except that you can skim or skip entirely certain technical sections: You can skip the implementation of a RAM, pages 71--73; you can skip the details of how machine language instructions are implemented, pages 84--91; and you can skip all of Section 3.4, except for the very general idea of what is meant by the term "assembly language."

Chapter 3 deals with a model of a simple computer called xComputer, which is a model of a computer stripped down to its essential components: a Central Processing Unit, or CPU, and a main memory, or RAM. You should understand that a real computer has many other components in addition to these two major components, and that the CPU of a modern computer is quite a bit more complicated than the CPU of xComputer. However, this model does give a fairly good idea or what goes on at the heart of a computer, and it demonstrates how mechanical execution of programs can be implemented.

The main memory holds data and programs that are immediately accessible to the CPU. Memory consists of a numbered sequence of locations. Each location holds a binary number. The main memory of xComputer has 1024 locations, numbered from 0 to 1023, and each location holds a 16-bit binary number. A number stored in some memory location can be a machine language instruction that is part of some program, or it can be data to be manipulated by the program. Of course, you can't tell which it is just by looking at it. (Modern computers have millions of memory locations. Generally, each location holds an eight-bit binary number. A machine-language instruction or piece of data often takes up several memory locations.)

Main memory is often called RAM. The term RAM stands for "random access memory." This term is often used to refer to a computer's main memory, although random access memory is really a more general term. "RAM" properly refers to any memory device that consists of a series of locations that can be accessed "at random" -- that is, any location can be accessed at any time.

The CPU is the active component of a computer. It executes programs by repeating a fetch-and-execute cycle over and over. During each fetch-and-execute cycle, the CPU reads one machine-language instruction from main memory and performs the task indicated by that instruction.

The CPU contains several registers. Each register is a memory unit that holds a single binary number. A fetch-and-execute cycle is actually made up of several very simple steps. Each of these small steps consists of some simple operation, such as moving data from one register to another, storing the output of the ALU into a register, or adding 1 to the value stored in a register. The steps are driven by a clock; every time the clock ticks, one of the small steps that make up a fetch-and-execute cycle is performed.

The CPU contains a circuit that "decides" what to do at each step. This master circuit is called the Control Circuit. The control circuit does its work by turning on control wires that are connected to the registers and other components of the computer. The control circuit is simply a logic circuit. The control wires are its outputs. Its inputs are wires that carry all the information that is needed to determine what action the CPU should take.

Taken together, Chapters 2 and 3 show how a very complex system can be constructed, level-by-level, from simple components. A central theme is the creation and use of black boxes. A black box has two aspects, an implementation and an interface. The interface is how the black box interacts with the rest of the world; the implementation is what's inside the box. From the outside, all the details of the implementation are hidden. From the inside, all the details of the outside world are hidden. The outside and inside interact only through the interface. Complexity can be managed by creating and using black boxes to divide a complex system up into manageable chunks.

Week 3 Concept List: