﻿ CS 3330: Computer Architecture

# CS 3330: Lec 2: 2330 Lite

This page does not represent the most current semester of this course; it is present merely as an archive.

## Oversimplified Electronics

A wire is like a hose; voltage measures water pressure and current measures water flow.

In a chip we generalize the world into two kinds of wires: those that have high voltage ("on" or "live" or "1") and those that have low voltage ("off" or "ground" or "0").

We will mostly ignore current in this course, besides two observations:

• Current happens in a chip when we change wires between their high- and low-voltage states. There is also some (though less) current even when nothing is changing.
• Current × voltage = energy; energy creates heat and can make things not work right.

## Transistors

A transistor is like a pressure-activated valve. There are three wires into it; if voltage is applied to one of them then current can flow between the other two.

## Larger Circuit Components

Transistors can be used to construct a variety of higher-level components often called "gates". How this is done is discussed in ECE/CS 2330. For our purposes, you just need to know about the behavior of the following components.

Hpyerphysics has a summary of how gates and inverters are made from transistors if you are curious.

### Boolean Gates

Boolean logic consists of the operators and, or, and not.

#### And

The expression x & y in programming languages is "on" if x and y are "on", "off" if either x or y is "off". In circuit diagrams we draw "and" as a D-shaped gate: . The output wire has high voltage only if both input wires have high voltage.

#### Or

The expression x | y in programming languages is "on" if either x or y is "on", "off" if both x and y are "off". In circuit diagrams we draw "and" as a spade-shaped gate: . The output wire has high voltage if either of the input wires has high voltage.

#### Not

The expression ~x in programming languages is "on" if x is "off", "off" is x is "on". In circuit diagrams we draw "not" as little circle, often attached to other gates. If we need to draw it by itself, we put it on a triangle: . The output wire has high voltage if the input is low, low if the input is high.

#### Exclusive Or

The expression x ^ y in programming languages is "on" if x | y but not x & y. In circuit diagrams we draw "exclusive-or" or "xor" as a spade-shaped gate with an extra line over the inputs: . The output wire has high voltage if one input is high and the other is low.

#### Others

The "not" circle can be attached to any input or output of any other gate symbol to make a new symbol. Two of these, the nand and nor , are common enough to have their own name and own symbol, but do not have a standard operator representation in code (we'd have to use ~(x & y) for nand and ~(x | y) for nor).

### Multiplexer

A multiplexer, or mux, selects one of a set of inputs to be the output. Given 2n inputs, it requires n selector inputs to decide which one to use. Multiplexers are typically drawn as trapezoids, though out textbook uses rounded boxes with the letters MUX in them instead.

Multiplexers are kind of like the hardware equivalent of an array. You can learn more at wikipedia.

### Decoder

A decoder has n input wires and 2n output wires; exactly one of those output wires is on, the rest being off. The output of a decoder is sometimes called "one-hot" encoding. They are commonly used to translate binary numbers into more useful electrical signals.