CDA 3100 Spring 2009 Special Thanks Thanks to

  • Slides: 44
Download presentation
CDA 3100 Spring 2009

CDA 3100 Spring 2009

Special Thanks • Thanks to Dr. Xiuwen Liu for letting me use his class

Special Thanks • Thanks to Dr. Xiuwen Liu for letting me use his class slides and other materials as a base for this course

Class organization • Class web page – http: //www. cs. fsu. edu/~zzhang/CDA 3100_Spring _2009.

Class organization • Class web page – http: //www. cs. fsu. edu/~zzhang/CDA 3100_Spring _2009. htm – Academic honor code – Programs you submitted must be your own work – While discussions of class materials and assignments are allowed, copying of solutions is strictly prohibited 9/25/2020 CDA 3100 3

Class Communication • This class will use class web site to post news, changes,

Class Communication • This class will use class web site to post news, changes, and updates. So please check the class website regularly • Please also make sure that you check your emails on the account on your University record 9/25/2020 CDA 3100 4

Required Textbook • The required textbook for this class is – “Computer Organization and

Required Textbook • The required textbook for this class is – “Computer Organization and Design” • The hardware/software interface – By David A. Patterson and John L. Hennessy – Third Edition – Morgan Kaufmann Publishers, part of Elsevier – 2007 – We will cover chapters 1 -4, part of 5, and appendix A, B 9/25/2020 CDA 3100 5

Lecture Notes and Textbook • All the materials that you will be tested on

Lecture Notes and Textbook • All the materials that you will be tested on will be covered in the lectures – Even though you may need to read the textbook for review and further detail explanations – The lectures will be based on the textbook and handouts distributed in class 9/25/2020 CDA 3100 6

Programming Environment at CS • For this class, we will use “linprog” most of

Programming Environment at CS • For this class, we will use “linprog” most of the time – “linprog” is a machine stack, consisting of four Pentium III machines • Running Linux 2. 6. 9 • Another available machine stack is “program”, consisting of four Sun workstations (Sun-Fire. V 240, sparc ISA) – Running Sun. OS 5. 10 • Using ssh to remotely login to these machines 9/25/2020 CDA 3100 7

What you will learn to answer (among other things) • How does the software

What you will learn to answer (among other things) • How does the software instruct the hardware to perform the needed functions • What is going on in the processor • How a simple processor is designed

Computer System Overview • A computer system consists of hardware and software that are

Computer System Overview • A computer system consists of hardware and software that are combined to provide a tool to solve problems (with best performance) – Hardware includes CPU, memory, disks, printers, screen, keyboard, mouse. . . – Software includes • System software – A general environment to create specific applications • Application software – A tool to solve a specific problem 9/25/2020 CDA 3100 9

Computer System Overview – cont. 9/25/2020 CDA 3100 10

Computer System Overview – cont. 9/25/2020 CDA 3100 10

Steps to Run a C Program • First we need to compile the program

Steps to Run a C Program • First we need to compile the program 9/25/2020 CDA 3100 11

Steps to Run a C Program • Then we need to run the program

Steps to Run a C Program • Then we need to run the program – The operating system locates where the program is – Then it loads the program into memory – The instructions in the program are then executed one by one – When the program is done, the operating system then releases the memory and other resources allocated to the program 9/25/2020 CDA 3100 13

Opening the Box 9/25/2020 CDA 3100 14

Opening the Box 9/25/2020 CDA 3100 14

A Pentium 4 Processor Chip 9/25/2020 CDA 3100 15

A Pentium 4 Processor Chip 9/25/2020 CDA 3100 15

Five Classic Components 9/25/2020 CDA 3100 16

Five Classic Components 9/25/2020 CDA 3100 16

Hierarchical Abstraction • We focus on principles underlying these computer systems using hierarchical abstractions

Hierarchical Abstraction • We focus on principles underlying these computer systems using hierarchical abstractions 9/25/2020 CDA 3100 17

Hierarchical Abstractions – – Applications/systems software Assembly/machine language Architectural issues: i. e. , caches,

Hierarchical Abstractions – – Applications/systems software Assembly/machine language Architectural issues: i. e. , caches, virtual memory, pipelining Boolean logic, 1 s and 0 s • Sequential logic, finite state machines • Combinational logic, arithmetic circuits – Transistors used to build logic gates (CMOS) – Semiconductors/silicon used to build transistors – Properties of atoms, electrons, and quantum dynamics • In this class we focus on the software-hardware interface – Known as the instruction set architectures (ISA) 9/25/2020 CDA 3100 18

Instruction Set Architecture • A very important abstraction – Interface between hardware and low-level

Instruction Set Architecture • A very important abstraction – Interface between hardware and low-level software – Standardizes instructions, machine language bit patterns, etc. – Advantage: different implementations of the same architecture • Modern instruction set architectures – IA-32, Power. PC, MIPS, SPARC, ARM, …

Market 9/25/2020 CDA 3100 20

Market 9/25/2020 CDA 3100 20

Why This Class Important? • If you want to create better computers – It

Why This Class Important? • If you want to create better computers – It introduces necessary concepts, components, and principles for a computer scientist – By understanding the existing systems, you may create better ones • If you want to build software with better performance • If you want to have a good choice of jobs • If you want to be a real computer science major 9/25/2020 CDA 3100 21

Career Potential for a Computer Science Graduate http: //www. jobweb. com/studentarticles. asp x? id=904&terms=starting+salary

Career Potential for a Computer Science Graduate http: //www. jobweb. com/studentarticles. asp x? id=904&terms=starting+salary 9/25/2020 CDA 3100 22

Career Potential for a Computer Science Graduate Source: NACE Fall 2005 Report (http: //www.

Career Potential for a Computer Science Graduate Source: NACE Fall 2005 Report (http: //www. jobweb. com/resources/library/Careers_In/Starting_Salary_51_01. htm) 9/25/2020 CDA 3100 23

Numbers • Numbers are abstraction of quantities – http: //www. debtclock. com/ – How

Numbers • Numbers are abstraction of quantities – http: //www. debtclock. com/ – How do we represent these quantities? 9/25/2020 CDA 3100 24

Decimal Numbering System • We humans naturally use a particular numbering system 9/25/2020 CDA

Decimal Numbering System • We humans naturally use a particular numbering system 9/25/2020 CDA 3100 25

Decimal Numbering System • For any nonnegative integer value is given by , its

Decimal Numbering System • For any nonnegative integer value is given by , its – Here d 0 is the least significant digit and dn is the most significant digit 9/25/2020 CDA 3100 26

Decimal Numbering System • For any nonnegative integer is given by , its value

Decimal Numbering System • For any nonnegative integer is given by , its value val = 0; While there are more digits, end 9/25/2020 CDA 3100 27

General Numbering System – Base X • Besides 10, we can use other bases

General Numbering System – Base X • Besides 10, we can use other bases as well – In base X, the value of 9/25/2020 CDA 3100 28

General Numbering System – Base X • Besides 10, we can use other bases

General Numbering System – Base X • Besides 10, we can use other bases as well – In base X, the value of val = 0; While there are more digits, end 9/25/2020 CDA 3100 29

Commonly Used Bases Base Common Name Representation Digits 10 Decimal 5023 ten or 5023

Commonly Used Bases Base Common Name Representation Digits 10 Decimal 5023 ten or 5023 0 -9 2 Binary 10011111 two 0 -1 8 Octal 11637 eight 0 -7 16 Hexadecimal 139 Fhex or 0 x 139 F 0 -9, A-F – Note that other bases are used as well including 12 and 60 • Which one is natural to computers? – Why? 9/25/2020 CDA 3100 30

Meaning of a Number Representation • When we specify a number, we need also

Meaning of a Number Representation • When we specify a number, we need also to specify the base – For example, 10 presents a different quantity in a different base There are 10 kinds of mathematicians. Those who can think binarily and those who can't. . . http: //www. math. ualberta. ca/~runde/jokes. html 9/25/2020 CDA 3100 31

Conversion between Representations • Now we can represent a quantity in different number representations

Conversion between Representations • Now we can represent a quantity in different number representations – How can we convert from one representation to another one? – For example, how can we convert a decimal number to binary? – How can we then convert a binary number to a decimal one? – How can we convert between base X 1 and base X 2? 9/25/2020 CDA 3100 33

Conversion Between Bases • From binary to decimal example 15 10 9 8 7

Conversion Between Bases • From binary to decimal example 15 10 9 8 7 6 5 4 3 2 1 0 215 214 213 212 211 210 29 28 27 26 25 24 23 22 21 20 1 1 1 0 9/25/2020 14 0 13 0 12 1 11 0 0 CDA 3100 34

Conversion Between Bases • From octal to decimal • From hexadecimal to decimal 9/25/2020

Conversion Between Bases • From octal to decimal • From hexadecimal to decimal 9/25/2020 CDA 3100 35

Conversion Between Bases • From base X to decimal (base 10) 9/25/2020 CDA 3100

Conversion Between Bases • From base X to decimal (base 10) 9/25/2020 CDA 3100 36

Conversion Program 9/25/2020 CDA 3100 37

Conversion Program 9/25/2020 CDA 3100 37

Conversion from Decimal to Base X • Given 5023 ten, what is the representation

Conversion from Decimal to Base X • Given 5023 ten, what is the representation in the following bases? – Binary? – Hexadecimal? – Octal? 9/25/2020 CDA 3100 38

Conversion from Decimal to Base X • We have the following formula – How

Conversion from Decimal to Base X • We have the following formula – How do we generate d 0? 9/25/2020 CDA 3100 39

Conversion from Decimal to Base X • We have the following formula – How

Conversion from Decimal to Base X • We have the following formula – How do we generate d 0? • Divide by X, the reminder is d 0 – How do we generate d 1? • Divide the quotient by X again and the reminder is d 1 9/25/2020 CDA 3100 40

Conversion between Two Bases • We can always do the conversion in two steps,

Conversion between Two Bases • We can always do the conversion in two steps, from base 1 to decimal and from decimal to base 2 • In some cases, the conversion is straightforward – For example, we often need to convert between a binary number and a hexadecimal number 9/25/2020 CDA 3100 42

Number Representations in Computers • Binary is the natural choice for computers – Since

Number Representations in Computers • Binary is the natural choice for computers – Since computers consist of transistors which have two different states • Additionally, for efficiency, we typically use a fixed number of bits – unsigned char – unsigned short – unsigned int • unsigned long – The least significant bit is the rightmost bit while the most significant bit is the leftmost bit – Overflow occurs if a number can not be represented correctly in the given format 9/25/2020 CDA 3100 43

Unsigned Formats and Their Ranges Type (C) Number of bits Largest number (decimal) unsigned

Unsigned Formats and Their Ranges Type (C) Number of bits Largest number (decimal) unsigned char 8 255 unsigned short 16 65535 unsigned int 32 4, 294, 967, 295 unsigned long 64 18, 446, 744, 073, 709, 551, 615 Exact arithmetic ? ? 9/25/2020 CDA 3100 44