+ All Categories
Home > Documents > CS 1308 – Computer Literacy and the Internet Building the CPU.

CS 1308 – Computer Literacy and the Internet Building the CPU.

Date post: 20-Jan-2016
Category:
Upload: clifton-walsh
View: 215 times
Download: 0 times
Share this document with a friend
Popular Tags:
34
CS 1308 – Computer Literacy and the Internet Building the CPU
Transcript
Page 1: CS 1308 – Computer Literacy and the Internet Building the CPU.

CS 1308 – Computer Literacy and the Internet

Building the CPU

Page 2: CS 1308 – Computer Literacy and the Internet Building the CPU.

It’s Not MagicThe goal of the next series of lectures is to

show you exactly how a computer works.We will discuss the logic used to create

computer instructions and how the computer decides which instructions to execute.

Although at times it may appear to be magical. It’s just math and science.

2

Page 3: CS 1308 – Computer Literacy and the Internet Building the CPU.

Our Picture of a Computer

Data Bus

memory input/ output

controlunit

arithmetic-logic unit

Central ProcessingUnit (CPU)

registers

Page 4: CS 1308 – Computer Literacy and the Internet Building the CPU.

The Reliability of Binary Representation

4

Electronic devices are most reliable in a bistable environment

Bistable environmentDistinguishing only two electronic states

Current flowing or not

Direction of flow

Computers are bistable: hence binary representations

Page 5: CS 1308 – Computer Literacy and the Internet Building the CPU.

A Switch is a 2-state device that can be toggled

5

A relay is a switch built with an electromagnet

controlled current

controlling current

when the controlling current is 1, the electromagnet pullsthe switch closed, and the controlled current flows through

the switch

Page 6: CS 1308 – Computer Literacy and the Internet Building the CPU.

Switches can do it all

6

With switches we can implement AND, OR, and NOT gates

With just those types of gates, we can design circuits to perform any computation

Remember, computers do very simple tasks, very quickly

Page 7: CS 1308 – Computer Literacy and the Internet Building the CPU.

Basic electric circuits: Computing AND

CS 302 - Computer Fluency7

in1 in2 out 0 0 0 0 1 0 1 0 0 1 1 1

truth table for AND}

when both inputs are 1,the circuit is closed

andin1in2 out

= in1 in2

outpowersource

in1 in2

Page 8: CS 1308 – Computer Literacy and the Internet Building the CPU.

Basic electric circuits: Computing OR

8

in1 in2 out 0 0 0 0 1 1 1 0 1 1 1 1

truth table for OR}in1

in2 outor

= in1 + in2

out

in1

in2

when either input is 1,the circuit is closed

Page 9: CS 1308 – Computer Literacy and the Internet Building the CPU.

Basic electric circuits: Computing NOT

9

in1 out 0 1 1 0

truth table for NOT}

A new type of switch

which is closedat rest

in1 out

= in1’

not

out

in1

Page 10: CS 1308 – Computer Literacy and the Internet Building the CPU.

A better switch: Transistors

10

bi-stable, solid state device switching is done electronically, not

mechanicallyno moving parts; therefore, fast, small, reliablecan switch states in about one 10 billionth of a

secondabout 5 million transistors can fit on a chip 1

centimeter square. Density is increasing rapidly with new technology.

Page 11: CS 1308 – Computer Literacy and the Internet Building the CPU.

Figure 4.11

Simplified Model of a Transistor

CS 302 - Computer Fluency 11

Page 12: CS 1308 – Computer Literacy and the Internet Building the CPU.

Boolean Logic and Gates: Boolean Logic

12

Boolean logic describes operations on true/false values

True/false maps easily onto bistable environment

Boolean logic operations on electronic signals may be built out of transistors and other electronic devices

Page 13: CS 1308 – Computer Literacy and the Internet Building the CPU.

Boolean Logic (continued)

13

Boolean expressions

Constructed by combining together Boolean operations

Example: (a AND b) OR ((NOT b) AND (NOT a))

Truth tables capture the output/value of a Boolean expression

A column for each input plus the output

A row for each combination of input values

Page 14: CS 1308 – Computer Literacy and the Internet Building the CPU.

Boolean Logic (continued)

14

Example: (a AND b) OR ((NOT b) and (NOT a))

a b Value

0 0 1

0 1 0

1 0 0

1 1 1

Page 15: CS 1308 – Computer Literacy and the Internet Building the CPU.

Building Computer Circuits: Introduction

15

A circuit is a collection of logic gates:

Transforms a set of binary inputs into a set of binary outputs

Values of the outputs depend only on the current values of the inputs

Combinational circuits have no cycles in them (no outputs feed back into their own inputs)

Page 16: CS 1308 – Computer Literacy and the Internet Building the CPU.

A Compare-for-equality Circuit

16

Compare-for-equality circuit

CE compares two unsigned binary integers for equality

Built by combining together 1-bit comparison circuits (1-CE)

Integers are equal if corresponding bits are equal (AND together 1-CD circuits for each pair of bits)

Page 17: CS 1308 – Computer Literacy and the Internet Building the CPU.

A Compare-for-equality Circuit (continued)

17

1-CE circuit truth table

a b Output

0 0 1

0 1 0

1 0 0

1 1 1

Page 18: CS 1308 – Computer Literacy and the Internet Building the CPU.

Figure 4.22

One-Bit Compare for Equality Circuit

CS 302 - Computer Fluency 18

Page 19: CS 1308 – Computer Literacy and the Internet Building the CPU.

A Compare-for-equality Circuit (continued)

19

1-CE Boolean expression

First case: (NOT a) AND (NOT b)

Second case: a AND b

Combined:

((NOT a) AND (NOT b)) OR (a AND b)

Page 20: CS 1308 – Computer Literacy and the Internet Building the CPU.

Figure 4.19Diagram of a Typical Computer Circuit

CS 302 - Computer Fluency 20

Page 21: CS 1308 – Computer Literacy and the Internet Building the CPU.

A Circuit Construction Algorithm

21

Sum-of-products algorithmTruth table captures every input/output possible

for circuit

Repeat process for each output lineBuild a Boolean expression using AND and NOT

for each 1 of the output line

Combine together all the expressions with ORs

Build circuit from whole Boolean expression

Page 22: CS 1308 – Computer Literacy and the Internet Building the CPU.

Examples Of Circuit Design And Construction

22

Compare-for-equality circuit

Addition circuit

Both circuits can be built using the sum-of-products algorithm

Page 23: CS 1308 – Computer Literacy and the Internet Building the CPU.

An Addition Circuit

23

Addition circuit

Adds two unsigned binary integers, setting output bits and an overflow

Built from 1-bit adders (1-ADD)

Starting with rightmost bits, each pair produces

A value for that order

A carry bit for next place to the left

Page 24: CS 1308 – Computer Literacy and the Internet Building the CPU.

An Addition Circuit (continued)

24

1-ADD truth table

Input

One bit from each input integer

One carry bit (always zero for rightmost bit)

Output

One bit for output place value

One “carry” bit

Page 25: CS 1308 – Computer Literacy and the Internet Building the CPU.

Figure 4.24

The 1-ADD Circuit and Truth Table

25

Page 26: CS 1308 – Computer Literacy and the Internet Building the CPU.

An Addition Circuit (continued)

26

Building the full adder

Put rightmost bits into 1-ADD, with zero for the input carry

Send 1-ADD’s output value to output, and put its carry value as input to 1-ADD for next bits to left

Repeat process for all bits

Page 27: CS 1308 – Computer Literacy and the Internet Building the CPU.

Computer InstructionsThe logic for every instruction is

executed on every cycle by the Arithmetic and Logic Unit (ALU).

The answer used is the one for the instruction that is currently decoded and executed by the CPU.

This selection is done by the Control Circuits.

27

Page 28: CS 1308 – Computer Literacy and the Internet Building the CPU.

Control Circuits

28

Do not perform computationsChoose order of operations or select among

data valuesMajor types of controls circuits

MultiplexorsSelect one of inputs to send to output

DecodersSends a 1 on one output line, based on what

input line indicates

Page 29: CS 1308 – Computer Literacy and the Internet Building the CPU.

Control Circuits (continued)

29

Multiplexor form2N regular input linesN selector input lines1 output line

Multiplexor purposeGiven a code number for some input, selects that

input to pass along to its outputUsed to choose the right input value to send to a

computational circuit

Page 30: CS 1308 – Computer Literacy and the Internet Building the CPU.

Figure 4.28A Two-Input Multiplexor Circuit

30

Page 31: CS 1308 – Computer Literacy and the Internet Building the CPU.

Control Circuits (continued)

31

Decoder

Form

N input lines (typically the size of the BUS)

2N output lines

N input lines indicate a binary number, which is used to select one of the output lines

Selected output sends a 1, all others send 0

Page 32: CS 1308 – Computer Literacy and the Internet Building the CPU.

Control Circuits (continued)

32

Decoder purpose

Given a number code for some operation, trigger just that operation to take place

Numbers might be codes for arithmetic: add, subtract, etc.

Decoder signals which operation takes place next

Page 33: CS 1308 – Computer Literacy and the Internet Building the CPU.

Figure 4.29A 2-to-4 Decoder Circuit

33

Page 34: CS 1308 – Computer Literacy and the Internet Building the CPU.

Summary

34

Binary values create a bistable environment, making computers reliable

Boolean logic maps easily onto electronic hardware

Circuits are constructed using Boolean expressions as an abstraction

Computational and control circuits may be built from Boolean gates


Recommended