Chapter 3

4.1 Adder

Half Adder

A half adder adds two single bits to give a sum and a carry.

S = (notA and B) OR (A and notB)
C = A and B

Full Adder

A full adder also adds together two single bits, but it takes into account a Carry in, to generate a sum and a carry out. A full adder can be built from two half adders and an OR gate.

4.2 Arithmetic and logic unit (ALU)

A one bit ALU (a bit-slice ALU) takes three single bits, A, B, and Carry-in as input and performs four operations simultaneously on them.

  • A and B
  • A or B
  • not B
  • A + B + Carry-in

Two function bits F0 and F1, determine which operation result is passed to the output.

An n-bit ALU can be made by connecting n one bit ALUs together. 

5.0 Register and Memory

Registers refer to memory units located within the CPU, while memory refers to memory units outside the CPU which are connected to the CPU through system busses.

5.1 D flip-flop as memory unit and the construction of register

Screenshot-2017-05-21-at-16.06.52.png

Used to store a single bit. Two inputs, D (data) and C (clock). Output Q.

When C = 1, Qnext = D
When C = 0, Qnext = Q (no change)

These can be used to build CPU registers. Because of the speed of the circuits making up the registers, and their proxmity, data transfers to and from a CPU register is normally an order of magnitude faster than access to the external memories. Can also be used to build static RAM

Screenshot-2017-05-21-at-16.10.22.png

Data from the inputs will only be stored when the clock signal is high.

5.2 Memory

A memory is a sequence of linked cells, each cell is of a fixed size (typically a byte) and can store a binary number. Memory cells are numbered, so that each cell can be located by a unique number, called a memory address.

In computers, a decoder is used to convert number addresses to electronic signals to locate the required memory cells.

5.2.1 RAM

Random access vs Sequential access. Random access means that memory at any address can be read from or written to in any order. Sequential access menas that to get to memory address N, memory addresses have to be read from 0 - N sequentially. An example of this is tape.

RAM stores OS information, Applications, Users' programs and data.

Static RAM: a single bit of memory is simply a d flip flop circuit and requires only continuous power to maintain its state.
Dynamic RAM: a bit of memory is a storage capacitor in either the charged or discharged condition. The term dynamic refers to the need to periodically renew or refresh the slowly discharging capacitor.

Both types are volatile. SRAM is simpler to use, and about ten times faster, and more reliable than DRAM. SRAM is more expensive, consumes more power and requires more physical space. DRAM is what most computer memory modules are made from. It must be refreshed hundreds of times per second in order to maintain the data stored in it.

5.2.2 ROM

Cannot be modified, used to store the inital program that runs when the computer is powered on or otherwise begins execution. 

5.3.1 Addressing Memory - Decoder

Memory cells are located by using their number addresses. Decoders use n address bits to select one memory cell among 2n memory cells. 

Screenshot-2017-05-21-at-16.36.14.png

It should be noted that when data is going to be written, the data is made available to all cells. It is not stored unless the clock signal for any particular cell is high, which is selected using the address decoder.

5.3.2 Memory Size Measure

1024 bytes = 1KB = 210 bytes
1024 KB = 1MB = 220 bytes
1024MB = 1GB = 230 bytes
1024GB = 1TB = 240 bytes

6 Timing Circuits

Used to synchronize all operations in a computer system. Generates square waves at constant intervals. Nearly everything that happens in a computer happens on the rising (or falling depending on the design) edge of the pulsed signal. A machine instruction typically takes several cycles to complete. Generally a faster clock signal leads to a higher processing speed.