CPS3340 Computer Architecture Fall Semester, 2013

71
CPS3340 COMPUTER ARCHITECTURE Fall Semester, 2013 08/27/2013 Lecture 1: Overview Instructor: Ashraf Yaseen DEPARTMENT OF MATH & COMPUTER SCIENCE CENTRAL STATE UNIVERSITY, WILBERFORCE, OH 1

description

Lecture 1: Overview Instructor: Ashraf Yaseen. CPS3340 Computer Architecture Fall Semester, 2013. Department of Math & Computer Science Central State University, Wilberforce, OH. 08/27/2013. Outline. Course Administration Overview of CPS 3340: Inside the Computer Binary Numbers. - PowerPoint PPT Presentation

Transcript of CPS3340 Computer Architecture Fall Semester, 2013

Page 1: CPS3340  Computer  Architecture Fall Semester,  2013

CPS3340 COMPUTER

ARCHITECTURE Fall Semester, 2013

CPS3340 COMPUTER

ARCHITECTURE Fall Semester, 2013

08/27/2013

Lecture 1: OverviewInstructor: Ashraf Yaseen

DEPARTMENT OF MATH & COMPUTER SCIENCECENTRAL STATE UNIVERSITY, WILBERFORCE, OH

1

Page 2: CPS3340  Computer  Architecture Fall Semester,  2013

Outline

Course Administration

Overview of CPS 3340: Inside the Computer

Binary Numbers

2

Page 3: CPS3340  Computer  Architecture Fall Semester,  2013

Administrivia

Class Web Page http://www.cs.odu.edu/~ayaseen Syllabus

Class Policy Class Notes

Posted before class Read class notes before class

Assignments Posted after class Pay attention to the due dates

Blackboard Posting grades Sending out emails to class

3

Page 4: CPS3340  Computer  Architecture Fall Semester,  2013

Administrivia-cont.

Instructional E-Mail Addresses [email protected]

Instructor: Ashraf Yaseen Office phone: 937-376-6365 Office location: Henderson Hall, 139 Office hours:

M,W,F: 10:00AM-2:00PM T,R: 2:00PM-3:00PM by appointment

4

Page 5: CPS3340  Computer  Architecture Fall Semester,  2013

Administrivia-cont.

Grading Policy

Quizzes will be announced in class

Late Assignment/HW Policy 0~24 hrs: -5% 24~48 hrs: -10% >48 hrs: grade = 0

5

Number

Activities/ Evaluation Methods

Percentages

2 Term Exam 30%

1 Final Exam 25%

6 Assignments & Homework

30%

6 Quiz 15%

Class participation and presentation quality will also impact final grade

>=90 A Excellent80-89 B Very Good70-79 C Good60-69 D Passed<60 F Failed

Page 6: CPS3340  Computer  Architecture Fall Semester,  2013

Administrivia-cont.

Your Written/Read Responsibilities

5 Homework

Due at start of class on due date

Emergency arrangements; else hand in early

1-3 Term Test;

Final Exam: comprehensive exam.

Course Project and Presentations: student-led reviews/material integration before exams

Readings from textbooks – read before/after class

6

Page 7: CPS3340  Computer  Architecture Fall Semester,  2013

Administrivia-cont.

Textbook Computer Organization and Design: The

Hardware/Software Interface, 4th Edition, by Patterson and Hennessy, Morgan and Kaufman Publishers, Inc., 2009

Reference Computer Organization (5th Edition) By

Hamacher , Vranesic, Zaky. ISBN: 0-07-232086-9.

Recommended Reading (electronic version): NASM, X86 Assembly

language

7

Page 8: CPS3340  Computer  Architecture Fall Semester,  2013

CSU Honor Code The Honor Code applies to your conduct in this course. If

you have questions, talk to me

HOMEWORK: All submitted work must be your own Do not copy another student’s work Do discuss material and homework with classmates,

professor If you work with someone, write this on the first page

of your submitted work

EXAMS: Do not give assistance to or receive assistance from anyone but professor

Violations of this Code are treated seriously Evidence of cheating, plagiarism, or unauthorized

collaboration will result in a 0 grade for quiz/assignment/exam May have further consequences

8

Page 9: CPS3340  Computer  Architecture Fall Semester,  2013

How to get help?

Ask questions in class (or after class) Attend office hours Email me

Make sure that you put “CPS3340” in your subject line

Send it from your .edu account It wouldn’t come to my spam folder

State clearly what you need in your email

9

Page 10: CPS3340  Computer  Architecture Fall Semester,  2013

How to Get an A in this Class? Attendance

Attend class regularly and on time Ask questions Work on in-class exercises and labs

Notes Read over class notes before class Review class notes after class

Homework Get started as early as possible Contact me if you encounter problems

10

Page 11: CPS3340  Computer  Architecture Fall Semester,  2013

What You Will Learn

Representing numbers in computers Binary, Octal, Hexadecimal Positive, Negative Floating Point Numbers

Designing Computer Logic Computer Hardware Components

11

Page 12: CPS3340  Computer  Architecture Fall Semester,  2013

What You Will Learn-cont.

How programs are translated into the machine language And how the hardware executes them

The hardware/software interface What determines program performance

And how it can be improved How hardware designers improve

performance What is parallel processing

12

Page 13: CPS3340  Computer  Architecture Fall Semester,  2013

Understanding Performance

Algorithm Determines number of operations executed

Programming language, compiler, architecture Determine number of machine instructions

executed per operation Processor and memory system

Determine how fast instructions are executed I/O system (including OS)

Determines how fast I/O operations are executed

13

Page 14: CPS3340  Computer  Architecture Fall Semester,  2013

Topics

Overview of Computer Architectures Classes of computers Components of a computer

Input Output Processing

Programming languages High-level language Hardware language

Performance Definition Measure

Power wall

14

Page 15: CPS3340  Computer  Architecture Fall Semester,  2013

Topics-cont.

Basics of Logic Design Gates Truth Tables Logic Equations Combinational Logic Hardware Description Language ALU Clocks Memory Elements

Flip-Flops, Latches, and Registers SRAM and DRAM

Timing Methodologies Programmable Devices

15

Page 16: CPS3340  Computer  Architecture Fall Semester,  2013

Topics-cont.

Instructions of the Computer Operations and Operands of the Computer

Hardware Logical Instruction Decision Making Instructions

Representation of numbers Instruction representations Communication Addressing Synchronization Parallelism

16

Page 17: CPS3340  Computer  Architecture Fall Semester,  2013

Topics-cont.

Arithmetic Addition and Subtraction Multiplication and Division Floating Point Parallelism

17

Page 18: CPS3340  Computer  Architecture Fall Semester,  2013

Importance of This Course

Foundation for advanced courses Operating Systems Programming Language Compiler Design Networking Parallel Programming Algorithm I/O Management

18

Page 19: CPS3340  Computer  Architecture Fall Semester,  2013

About Me

I got my bachelor’s from JUST (Jordan University of Science & Technology)

Master’s from NYiT (New York Institute of Technology)

Ph.D. (in process) ODU (Old Dominion University)

My Research Computational Biology High Performance Computing

19

Page 20: CPS3340  Computer  Architecture Fall Semester,  2013

How about you?20

Tell us your name and year

In a few sentences, tell us about you, e.g. Where are you from? What is your major? Career plans or after-college plans? Favorite hobby, sport? Something interesting about yourself

Expectation in this class

Page 21: CPS3340  Computer  Architecture Fall Semester,  2013

Greater Expectations

Class Attendance & Participation: mandatory In-Class exercises/discussion questions

Solidify your understanding

Help gauge your understanding

Increase interactivity (reduce boredom)

You are expected to try your best in class

By attending, you work less out class.

If you miss class, you are responsible for learning what you missed

21

Page 22: CPS3340  Computer  Architecture Fall Semester,  2013

Greater Expectations-cont.

Student Presentations: Prepare/practice and cover all material clearly

and concisely (set time limit) Refresh/integrate course material before exams Student explanation benefits audience, presenter Practice: presentation skills are a key to success

Submitted work: neat, complete, well-organized logic, programming, math: clearly show steps

towards solution, comment programs Explanatory paragraphs: thoughtful, legible,

grammatical, full sentences

22

Page 23: CPS3340  Computer  Architecture Fall Semester,  2013

Greater Expectations-cont.

Behave and perform in a professional manner Be punctual, dress appropriately and be attentive Respect the rights of all participants by turning

off any device that could cause a disturbance during class (this includes pagers, cell phones, personal alarms and iPod music players).

Negative behavior patterns in class (e.g. unexcused absences, tardiness, and class disruptions, wearing hats, eating, drinking, smoking and sleeping) will be treated seriously could result in a reduction of up to 12.5% (labs)

of a student’s final grade.

23

Page 24: CPS3340  Computer  Architecture Fall Semester,  2013

While in Class,

No Facebook No Cell phone No Music players No Topic unrelated to class. No Sleep No Food No bad jokes

24

Page 25: CPS3340  Computer  Architecture Fall Semester,  2013

High-Level Overview of CPS 3340:

Inside the Computer

25

Page 26: CPS3340  Computer  Architecture Fall Semester,  2013

What is CPS3340 about?

Introduce design and implementation of computer hardware

Introduce major design advances in last decade: parallel processing of instructions and hierarchical memory organization

Focus on prototypical modern architecture Not on specific computer brands (range) Not on electrical circuits (blueprint) Final Presentations integrate current issues

26

Page 27: CPS3340  Computer  Architecture Fall Semester,  2013

What Questions will CPS 3340 Answer?

How are high-level programs (C, Java) understood by hardware?

How are they executed by hardware?

What is interface between computer’s software and hardware?

How does software tell hardware to perform tasks?

How can programmer improve program performance?

How can hardware designer improve hardware performance?

27

Page 28: CPS3340  Computer  Architecture Fall Semester,  2013

Computing Applications

“Computers” are everywhere today

Innumerable individual computing applications, e.g.: ATMs Computers in vehicles

(steering/braking/motion sensors) PDAs, Cellphones, Blackberries, IPods… Baby toys, kitchen appliances, …

28

Page 29: CPS3340  Computer  Architecture Fall Semester,  2013

3 Classes of Computing Applications

Desktop/Personal Computers (best-known)

Servers (widest range in cost/capability)

Embedded Computers (widest range use/power)

29

Page 30: CPS3340  Computer  Architecture Fall Semester,  2013

Classes of Computers

Desktop computers Personal computers (best-known) General purpose, variety of software Subject to cost/performance tradeoff

30

Page 31: CPS3340  Computer  Architecture Fall Semester,  2013

Classes of Computers-cont.

Server computers Network based; Multiple users access via

network Execute many small tasks at once (web);

execute one huge job (weather forecast supercomputer)

High capacity, performance, reliability Range

Small file servers Supercomputers

31

Page 32: CPS3340  Computer  Architecture Fall Semester,  2013

Poor Man’s Super Computer

What is a Cluster? “Collection of interconnected

stand-alone computers working together as a single, integrated computing resource”

Cluster consists of Nodes Network OS Cluster middleware

Standard components Avoiding expensive

proprietary components

32

Page 33: CPS3340  Computer  Architecture Fall Semester,  2013

Classes of Computers-cont.

Embedded computers Hidden as components of systems Examples

Computer in your car Processor in your cell phone

Stringent power/performance/cost constraints

33

Page 34: CPS3340  Computer  Architecture Fall Semester,  2013

Prototypical Computer System All computing

applications have a few key components: The computer

(box) to do the computing

Input devices (e.g. keyboard, mouse)

Output devices (e.g. display, printer)

Input/Output devices (disks, networks)

34

Page 35: CPS3340  Computer  Architecture Fall Semester,  2013

Inside the Box: Our Focus35

Page 36: CPS3340  Computer  Architecture Fall Semester,  2013

Inside the Box: Motherboard

36

Page 37: CPS3340  Computer  Architecture Fall Semester,  2013

Inside the Computer: Motherboard

PROCESSOR

37

Page 38: CPS3340  Computer  Architecture Fall Semester,  2013

Inside the Computer: Motherboard

MAIN

MEMORY

38

Page 39: CPS3340  Computer  Architecture Fall Semester,  2013

Inside the Computer: Motherboard

INPUT

OUTPUT

39

Page 40: CPS3340  Computer  Architecture Fall Semester,  2013

Inside the Computer: Basic Blueprint

40

Page 41: CPS3340  Computer  Architecture Fall Semester,  2013

Inside the Computer: Data Flow

Computer

Processor Main Memory

Devices

INPUT

OUTPUT

Data flows from input to memory to processor

Data is processed and flows back to main memory

Data flows to output devices for storage or display

Control

Datapath

41

Page 42: CPS3340  Computer  Architecture Fall Semester,  2013

Inside the Computer: Data Processing

Computer

Processor Main Memory

Devices

INPUT

OUTPUT

Control gets program instructions from memory

Control tells memory, datapath, I/O what to do with data

Datapath gets data from memory and operates on it

Control

Datapath

42

Page 43: CPS3340  Computer  Architecture Fall Semester,  2013

Inside the Computer: Data Storage

Computer

Processor Main Memory

Devices

INPUT

OUTPUT

Main memory: small, close, fast, expensive, volatile

2ndary (I/O) memory: big, far, slow, cheap, nonvolatile

VOLATILE NONVOLATILE

Control

Datapath

43

Page 44: CPS3340  Computer  Architecture Fall Semester,  2013

The Basis for Machine Communication:

Introduction to Binary Numbers

44

Page 45: CPS3340  Computer  Architecture Fall Semester,  2013

Human Language

Humans communicate via speech, text, image

English alphabet has 26 letters: a-z

Letter sequences form words: tree

Word sequences form discourse units (sentences, paragraphs):

Some trees have yellow leaves

45

Page 46: CPS3340  Computer  Architecture Fall Semester,  2013

Machine Language Machines communicate via electrical signals

(conveyed through wires or wireless EM waves) (power supplied by current, battery)

Machine alphabet has 2 letters: 0, 1(high/low voltage, on/off, true/false)

Letter sequences form meaningful units:

Data: 0011 3Instruction: 0001000110011 3 + 3Program: 000100011001111 swap two

010101000000001 variable000010001010101 values

46

Page 47: CPS3340  Computer  Architecture Fall Semester,  2013

Machine Language Assembly Language

Machine Language (ML) is easy for computers but time-consuming for humans

Assembly Language (AL) was developed as a “more natural” symbolic code for ML

ADD 3,3 0001000110011

Assemblers are programs developed to automatically translate AL to ML

47

Page 48: CPS3340  Computer  Architecture Fall Semester,  2013

High Level Programming Languages AL still thinking like a machine

1 AL instruction for every 1 ML instruction Why not develop a higher-level code for AL?

High-level Programming Languages (PL) were developed as symbolic codes for AL

C, Java, Perl, etc.

Compilers are programs developed to automatically translate PL to AL

48

Page 49: CPS3340  Computer  Architecture Fall Semester,  2013

C Program swap(int v[], int k) {int tmp;tmp = v[k];v[k] = v[k+1];v[k+1] = tmp;}

MIPS AL Program swap: muli $2, $5, 4add $4, $2lw $15, 0($2)lw $16, 4($2)sw $16, 0($2)sw $15, 4($2)jr $31

MIPS ML Program 000000001010000100000000000110000000000010001110000110000010000110001100011000100000000000000000011100011100011101001100010001 …

C compiler

MIPS assembler

49

Page 50: CPS3340  Computer  Architecture Fall Semester,  2013

C Program swap(int v[], int k) {int tmp;tmp = v[k];v[k] = v[k+1];v[k+1] = tmp;}

MIPS AL Program swap: muli $2, $5, 4add $4, $2lw $15, 0($2)lw $16, 4($2)sw $16, 0($2)sw $15, 4($2)jr $31

MIPS ML Program 000000001010000100000000000110000000000010001110000110000010000110001100011000100000000000000000011100011100011101001100010001 …

C compiler

MIPS assembler

50

Page 51: CPS3340  Computer  Architecture Fall Semester,  2013

Background: Number Systems

In grade school: decimal system

To “interpret” a digit sequence: assign each digit to a column, multiply each digit by the column, add them all together

Hundreds Tens Ones

2 3 7

2 x 100 + 3 x 10 +7 x 1’s = 237

Page 52: CPS3340  Computer  Architecture Fall Semester,  2013

Number Systems: Decimal System

Decimal System = Base 10

Hundreds

102

Tens

101

Ones

100

0-9 0-9 0-9

• Base 10 uses digits 0 – 9

• Largest number represented with 3 columns?

• How do we represent a larger number?

Page 53: CPS3340  Computer  Architecture Fall Semester,  2013

Interpreting Number Systems

For any Base B: use digits 0 – B-1 (digits greater than 9 replaced by letters)

Each column represents B raised to an exponent, increasing to the left

Bn B… B2 B1 B0

0 - (B-1) 0 - (B-1) 0 - (B-1) 0 - (B-1) 0 - (B-1)

Page 54: CPS3340  Computer  Architecture Fall Semester,  2013

Binary Number System

Binary system (base 2) uses digits 0 – 1

Machine Language uses base 2

25 24 23 22 21 20

2 3 7

1 0 1 1 0 0

Invalid

Valid

Page 55: CPS3340  Computer  Architecture Fall Semester,  2013

Conversion from Binary to DecimalConvert 100111base 2 to ???base 10

Assign each digit to a column (columns represent base raised to exponents increasing to left)

Multiply each digit by the column, then add them all together

25 24 23 22 21 20

1 0 0 1 1 1

1 x 25 + 0 x 24 + 0 x 23 + 1 x 22 + 1 x 21 + 1 x 20 =

32 + 0 + 0 + 4 + 2 + 1 =

39base10

Page 56: CPS3340  Computer  Architecture Fall Semester,  2013

Conversion from Decimal to Binary

Convert 237base10 to ??????base 2

Find the largest power of 2 in the decimal number (trial and error)

Record this largest power in its column Subtract this largest power: 237 – 128 =

109

28

256

27

128

26

64

25

32

24

16

23

8

22

4

21

2

20

1

1

Page 57: CPS3340  Computer  Architecture Fall Semester,  2013

Conversion from Decimal to Binary

REPEAT 1-3 with remainder, until 0 Record 0 for all powers not subtracted

109 45 13 5 1- 64 = 26 - 32 = 25 - 8 = 23 - 4 = 22 - 1 = 20

45 13 5 1 0

28

256

27

128

26

64

25

32

24

16

23

8

22

4

21

2

20

1

1 1 1 0 1 1 0 1

237base10 = 11101101base 2

Page 58: CPS3340  Computer  Architecture Fall Semester,  2013

Class Example: Convert Binary to Decimal

Convert 1011base 2 to ??base 10

Page 59: CPS3340  Computer  Architecture Fall Semester,  2013

Class Example: Convert Binary to Decimal

Convert 1011base 2 to ??base 10

23 22 21 20

1 0 1 1

1 x 23 + 0 x 22 + 1 x 21 + 1 x 20 =

8 + 0 + 2 + 1 =

11base10

Page 60: CPS3340  Computer  Architecture Fall Semester,  2013

Class Example: Convert Decimal to Binary

Convert 22base10 to ?????base 2

Page 61: CPS3340  Computer  Architecture Fall Semester,  2013

Class Example: Convert Decimal to Binary

Convert 22base10 to ?????base 2

22 6 2 - 16 = 24 - 4 = 22 - 2 = 21

6 2 0

25

32

24

16

23

8

22

4

21

2

20

1

0 1 0 1 1 0

22base10 = 10110base 2

Page 62: CPS3340  Computer  Architecture Fall Semester,  2013

Counting in the Binary Number System

23 22 21 20 Base 10

0 0

1 1

1 0 2

1 1 3

1 0 0 4

1 0 1 5

1 1 0 6

1 1 1 7

1 0 0 0 8

1 0 0 1 9

1 0 1 0 10

Page 63: CPS3340  Computer  Architecture Fall Semester,  2013

Other Number Systems

Octal system (base 8) uses digits 0 – 7

82 81 80

2 3 7

2 x 82 + 3 x 81 + 7 x 80 = 159base10 The interpretation of any digit sequence

is dependent on the number system

What’s the base 10 interpretation of 2378?

Page 64: CPS3340  Computer  Architecture Fall Semester,  2013

Other Number Systems

Hexadecimal system (base 16) uses digits 0 – 9, A-F

162 161 160

2 B D

2 x 162 + 11 x 161 + 13 x 160 = 701base10 The interpretation of any symbolic sequence

is dependent on the number system

What’s the base 10 interpretation of 2BD16?

Page 65: CPS3340  Computer  Architecture Fall Semester,  2013

Back to Machine Language

Machines communicate via electrical signals, which have 2 values: high/low voltage

Use Base 2 to represent machine language: 0, 1

Binary number sequences (multiple signals) create larger units:

Data: 0011 3

Instruction: 0001000110011 3 + 3

Program: (sequences of instructions)

65

Page 66: CPS3340  Computer  Architecture Fall Semester,  2013

Boolean Logic: Action of ML

A Machine Language instruction is a command for an operation to be performed

Boolean Logic (BL): represents how operation carried out on inputs to yield output (Action of Operation)

Logic Equation: describes action: output produced by combining inputs and logic operators

Logic Block: displays action: output produced by combining inputs and logic gates

gates encoded on chips with conductive material

Truth Table: enumerates action: output produced by all possible input combinations

66

Page 67: CPS3340  Computer  Architecture Fall Semester,  2013

Atomic Logic Operator: AND

C = A AND BC = A ● BC = A BC = A & B

(logical product)

iff A is true and B is true then C is true(any # inputs)

True = 1False = 0

A B C

0 0 0

0 1 0

1 0 0

1 1 1

Truth Table

●A

BC

Logic Gate

Page 68: CPS3340  Computer  Architecture Fall Semester,  2013

Atomic Logic Operators: OR

C = A OR BC = A + BC = A BC = A | B(logical sum)

iff A is true or B is true then C is true(any # inputs)

True = 1False = 0

A B C

0 0 0

0 1 1

1 0 1

1 1 1

Truth Table

A

BC+

Logic Gate

Page 69: CPS3340  Computer  Architecture Fall Semester,  2013

Atomic Logic Operators: NOT

C = NOT AC = ¬AC = AC = A’(inverse/inverter)

iff A is true then C is false

True = 1False = 0

A C

0 1

1 0

Truth Table

¬ CA

Logic Gate

Page 70: CPS3340  Computer  Architecture Fall Semester,  2013

Summary

Syllabus Classes of Computers Decimal, Binary, Octal, Hexadecimal

Representations Conversion btw. Different

Representations

70

Page 71: CPS3340  Computer  Architecture Fall Semester,  2013

What I want you to do

Review Chapter 1 and Class Slides Enjoy your new semester

71