# Computer Architecture

This document is a collection of web pages on computer architecture.

The first part is an introduction to digital circuits. We recommend you read the pages in this order:

1. Gates. Here, we introduce the fundamental building blocks of digital computers.
2. Truth tables. We discuss truth tables as a way both of describing an existing circuit and of specifying a circuit to be built.
3. Combinatorial circuits. We introduce circuits whose output values depend only on a combination of the input values.
4. Logic expressions. We explain how to describe circuits as algebraic formulae and how to manipulate those formulae with algebraic laws.
5. Multiplexer. A particular combinatorial circuit so commonly used that we discuss it separately.
6. Demultiplexer. A particular combinatorial circuit so commonly used that we discuss it separately.
7. Decoder. A particular combinatorial circuit so commonly used that we discuss it separately.
8. Binary arithmetic. In this section, we introduce the fundamentals of binary arithmetic and representation of numbers.
9. Circuits for binary arithmetic. We show different circuits for binary arithmetic and explain trade-offs between speed and number of gates.
10. Latches and flip-flops. Flip-flops are the basic elements of sequential circuits, the way gates are the basic elements of combinatorial circuits.
11. State table. We discuss state tables as a way both of describing an existing sequential circuit and as a way of specifying a sequential circuit to be built.
12. Sequential circuits. We introduce circuits whose output values depend not only on the inputs, but also on previous input and output values.
13. Registers. A register is a particularly simple sequential circuit that can be instructed to store its input values indefinitely.
14. Counters. A counter is a another particularly simple sequential circuit that normally increments its stored value for each clock pulse.
15. Binary multiplication. We show how to build a circuit for binary multiplication.
16. Tri-state logic circuits. Tri-state logic circuits represent a pragmatic solution to some problems of circuit complexity.
17. Buses. With tri-state logic, we can use a bus to transport data.
18. Memories. While memories are clearly sequential circuits, they have a special structure that makes it interesting to look at them separately.
19. Read-only memories. A read-only memory is nothing more than a combinatorial circuit, but often built as a memory.
Next, we design a number of specific combinatorial and sequential circuits, which will be the building blocks of a simple computer:
1. Counter with clear. This sequential circuit is nominally an ordinary counter, but an additional input allows us to clear the contents of the counter.
2. Counter register. This sequential circuit is a combination of a counter and a register.
3. Counter register with clear. This sequential circuit is a combination of a counter with clear and a register.
4. Counter register with clear and explicit increment. This sequential circuit is similar to a counter register with clear, except that it does not increment unless explicitly instructed to.
5. Micro memory. This is a combinatorial circuit sometimes in the form of a PROM.
6. Instruction decoder. This is a combinatorial circuit sometimes in the form of a PROM.
7. Arithmetic and logic unit. This is a combinatorial circuit for doing arithmetic and logic operations. The operation can be selected by the value of inputs.
8. The first computer. We present our first simple computer, allowing us to make some very simple computations.
Now, we gradually complicate our simple computer:
1. Conditional jumps. So far, our computer could only do unconditional jumps. Now, we show how to introduce conditional jumps as well.
2. Subprograms. We add support for procedures and functions in high-level languages and discuss call/return protocols.
3. Parameter passing. We add support for passing parameters to subroutines on the stack.
4. Local variables We show how to use existing instructions to allocate space on the stack for local variables.
5. Interrupts. Our computer must know how to react to external events from timers and peripherals. The mechanism for interrupts makes that possible.