Top Banner
CSC 3650 Introduction to Computer Architecture Time: 3:30 to 6:30 Meeting Days: W Location: Oxendine 1237B Textbook: Essentials of Computer Architecture, Author: Douglas E. Comer, 2005, Pearson Prentice Hall Spring 2011 Chapter Five Processor Types and Instruction Sets Dr. Chuck Lillie
33
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: CS2252

CSC 3650 Introduction to Computer Architecture

Time: 3:30 to 6:30 Meeting Days: W Location: Oxendine 1237B

Textbook: Essentials of Computer Architecture, Author: Douglas E. Comer, 2005, Pearson Prentice Hall

Spring 2011

Chapter FiveProcessor Types and Instruction Sets

Dr. Chuck Lillie

Page 2: CS2252

Instruction Set

• Set of operations the hardware recognizes

• Representation the hardware uses for each operation

• The set of operations a processor provides represents a tradeoff among the copst of the hardware, the convenience for a programmer, and engineering considerations such as power consumption

Page 3: CS2252

Program Flow in Computer

Page 4: CS2252

Flowchart to execute assembly language program

Page 5: CS2252

Java Program Execution

Page 6: CS2252

Instruction Set Illustration

Page 7: CS2252

Instruction Formats

Page 8: CS2252

Variable-Length vs Fixed-Length Instructions

• Variable-Length– Makes optimal use of memory– Requires complex hardware to decode

• Fixed-Length– Requires less complex hardware– Processor can operate at higher speeds

• Can fetch and decode instruction without examining opcode

Page 9: CS2252

Registers• General Purpose

– Fixed size– Supports fetch and store– Acts as temporary storage facility– Small number of registers, < 100– Usually large enough to hold an integer

• Processor does 32 bit arithmetic, registers have 32 bits

– Numbered from 0 to N-1

Page 10: CS2252

Registers• Programming with Registers

– Operands stored in general purpose registers– Place results in general purpose registers– Must move value to registers and from registers

• load a copy of X into register 3

• Load a copyh of Y into register 6

• Add the value in register 3 to the value in register 6 and place the result in register 7

• Store a copy of the value in register 7 in Z

Page 11: CS2252

From Essentials of Computer Architecture by Douglas E. Comer. ISBN 0131491792. © 2005 Pearson Education, Inc. All rights reserved.

• Operands from an instruction must come from different banks

Page 12: CS2252

From Essentials of Computer Architecture by Douglas E. Comer. ISBN 0131491792. © 2005 Pearson Education, Inc. All rights reserved.

• Since operands must come from different banks, this presents a problem

• X and Y must be in separate banks• Z and X must be in different banks• So either Y or Z will have to be moved to complete

T

Page 13: CS2252

Complex and Reduced Instruction Sets

• Complex Instruction Set Computer (CISC)– Includes many instructions (hundreds)– Each instruction can perform an arbitrarily

complex computation– Intel’s Pentium is CISC

• Provides hundreds of instructions

• Complex instructions that require a long time to complete

• Instructions that manipulate graphics in memory, instructions to compute sine and cosine functions

Page 14: CS2252

Complex and Reduced Instruction Sets

• Reduced Instruction Set Computer (RISC)– Minimum set of instructions sufficient for all

computations, around 32– Each instruction performs a basic computation– Instructions are fixed size– Execute instruction in one clock cycle– Motorola’s MIPS processor, had 32 instructions

and each takes only one clock cycle

Page 15: CS2252

From Essentials of Computer Architecture by Douglas E. Comer. ISBN 0131491792. © 2005 Pearson Education, Inc. All rights reserved.

Page 16: CS2252

From Essentials of Computer Architecture by Douglas E. Comer. ISBN 0131491792. © 2005 Pearson Education, Inc. All rights reserved.

Although a RISC processor cannot perform all steps of the fetch-execute in a single clock cycle, an instruction pipeline with parallel hardware provides approximately the same performance once the pipeline is full, one instruction completes on every clock cycle

Fetch instruction

Examine opcode

Fetch operands

Perform operations

Store results

Page 17: CS2252

From Essentials of Computer Architecture by Douglas E. Comer. ISBN 0131491792. © 2005 Pearson Education, Inc. All rights reserved.

Page 18: CS2252

From Essentials of Computer Architecture by Douglas E. Comer. ISBN 0131491792. © 2005 Pearson Education, Inc. All rights reserved.

Fetch instruction

Examine opcode

Fetch operands

Perform operations

Store results

Page 19: CS2252

Other Causes of Stalls• Any instruction that delays processing or

disrupts the normal flow– Accesses external storage– Invokes a coprocessor– Branches to a new location– Calls a subroutine

Page 20: CS2252

From Essentials of Computer Architecture by Douglas E. Comer. ISBN 0131491792. © 2005 Pearson Education, Inc. All rights reserved.

Delay D subtract E C until C is available

Page 21: CS2252

From Essentials of Computer Architecture by Douglas E. Comer. ISBN 0131491792. © 2005 Pearson Education, Inc. All rights reserved.

Add a feature to the processor to detect the stallSends the output from Instruction K directly to Instruction K + 1

Page 22: CS2252

Types of Operations• Instructions are divided into basic

categories– Arithmetic instructions (integer arithmetic)– Logical instructions (also called Boolean)– Data access and transfer instructions– Conditional and unconditional branch

instructions– Floating point instructions– Processor control instructions

Page 23: CS2252

Data movement instructions for the 8085 microprocessor

Page 24: CS2252

Data Operation instructions for the 8085 microprocessor

Page 25: CS2252

Program Control instructions for the 8085 microprocessor

Page 26: CS2252

Program Counter, Fetch-Execute, and Branching

• Program counter: used to store the location of the next instruction in memory

• Start the fetch-execute cycle by getting the address of the next instruction in memory from the program counter

• Once the instruction is fetched, update program counter

Page 27: CS2252

Algorithm used to move through the fetch-execute cycle

Assign the program counter an intial program address. Repeat forever {

Fetch: access the next step of the program from the location given by the program counter.

Set an internal address register, A, to the address beyond the instruction that was just fetched

Execute: Perform the step of the program

Copy the contents of address register A to the program counter

Page 28: CS2252

Subroutine Calls, Arguments, and Register Windows

• Two basic methods to pass parameters– Store them in memory, eg, put on a stack

• Could be slow

– Use registers• Faster, but limited number which may cause conflict

with operands

• Could use a register window– Subset of registers used to pass parameters

Page 29: CS2252

From Essentials of Computer Architecture by Douglas E. Comer. ISBN 0131491792. © 2005 Pearson Education, Inc. All rights reserved.

• Registers are numbered from 0 through the window size – 1• Program places the parameters in registers 4 – 7• Subroutine gets the parameters from its registers 0 – 3• xi only available to main program, In only to subroutine

Page 30: CS2252

From Essentials of Computer Architecture by Douglas E. Comer. ISBN 0131491792. © 2005 Pearson Education, Inc. All rights reserved.

Page 31: CS2252

From Essentials of Computer Architecture by Douglas E. Comer. ISBN 0131491792. © 2005 Pearson Education, Inc. All rights reserved.

Page 32: CS2252

From Essentials of Computer Architecture by Douglas E. Comer. ISBN 0131491792. © 2005 Pearson Education, Inc. All rights reserved.

Page 33: CS2252

From Essentials of Computer Architecture by Douglas E. Comer. ISBN 0131491792. © 2005 Pearson Education, Inc. All rights reserved.