## CPSC 100: Principles of Computer Science

Spring 1997

Week 2 Reading GuideThis is the second of the weekly reading guides for Computer Science 100.

## Week 2 (April 7 to April 11)

The reading for this week is Chapter 2, except that we will avoid some of the more technical details. Read pages 29-48, 54-56, and 58-64. You are not responsible for memorizing the internal structure of any of the specific circuits covered in this reading. However, you should know the functions that they perform. (And in many cases, you really should be able to reconstruct the circuit, if necessary, based on the principles of circuit design that are covered in the reading.)

Propositional logic, which for our purposes can be taken to be the same thing as Boolean algebra, is the study of how the values true and false can be combined with the logical operators AND, OR, and NOT. It is possible to build logic gates that perform these logical operations. Circuits built from such AND, OR, and NOT gates are called logic circuits. Boolean algebra is a guide for understanding these circuits. It can also be used as a tool for building a circuit that has some specified behavior.

By identifying true and false with the fundamental binary numbers 1 and 0, we can used logic circuits to perform operations on binary numbers. It is possible to build circuits to add binary numbers. For example, a half-adder can compute the sum of two bits, and a full-adder can add three bits together. Several full-adders can be combined in a circuit for adding multi-bit binary numbers.

An arithmetic-logic unit (ALU) combines a number of circuits for doing various computations with binary numbers. An ALU is used in a computer as part of a CPU. It is the circuit that does all the basic arithmetical and logical operations that the computer is capable of doing. An ALU takes two binary numbers as input, and from them it computes an output value. Since it can do several different computations, it has some control wires that tell it which computation to perform.

Besides being able to do computations, a computer needs a way to store numbers. Like computational circuits, computer memory can also be made from logic gates. Memory circuits use feedback loops to make it possible to store an input for retrieval at a later time.

Week 2 Concept List:

- Logic operators: AND, OR, and NOT
- Propositional logic / Boolean algebra
- Logic gates
- Logic circuits
- Input/output table for a circuit
- Addition of binary numbers
- Half-adder, full-adder, and k-bit adder circuits
- Megahertz (and the question of time)
- ALU
- Control wires
- Feedback loop in a circuit
- One-bit memory circuit
- Register