43
Images courtesy of Addison Wesley Longman, Inc. Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001 Copyright © 2001 Chapter 3 Chapter 3 Instruction Set Instruction Set Architectures Architectures

Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001 Chapter 3 Instruction Set Architectures

Embed Size (px)

Citation preview

Page 1: Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001 Chapter 3 Instruction Set Architectures

Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001 Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001

Chapter 3Chapter 3Instruction Set ArchitecturesInstruction Set Architectures

Page 2: Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001 Chapter 3 Instruction Set Architectures

Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001 Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001

Chapter OutlineChapter Outline

• Programming LanguagesProgramming Languages

• Assembly LanguagesAssembly Languages

• Instruction Set Architecture DesignInstruction Set Architecture Design

• A Relatively Simple ISAA Relatively Simple ISA

• ISA of the 8085 microprocessorISA of the 8085 microprocessor

Page 3: Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001 Chapter 3 Instruction Set Architectures

Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001 Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001

Programming LanguagesProgramming Languages

• High level languagesHigh level languages

• Assembly languagesAssembly languages

• Machine languagesMachine languages

Page 4: Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001 Chapter 3 Instruction Set Architectures

Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001 Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001

Compilation ProcessCompilation Process

Page 5: Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001 Chapter 3 Instruction Set Architectures

Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001 Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001

Assembly ProcessAssembly Process

Page 6: Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001 Chapter 3 Instruction Set Architectures

Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001 Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001

Java AppletsJava Applets

Page 7: Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001 Chapter 3 Instruction Set Architectures

Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001 Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001

Assembly Language AttributesAssembly Language Attributes

• Instruction typesInstruction types

• Data typesData types

• Addressing modesAddressing modes

• Instruction formatsInstruction formats

Page 8: Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001 Chapter 3 Instruction Set Architectures

Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001 Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001

Instruction TypesInstruction Types

• Data transferData transfer

• Data operationData operation

• Program controlProgram control

Page 9: Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001 Chapter 3 Instruction Set Architectures

Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001 Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001

Data TypesData Types

• Numeric (integer, floating point)Numeric (integer, floating point)

• Boolean (true, false)Boolean (true, false)

• Character (ASCII, Unicode)Character (ASCII, Unicode)

Page 10: Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001 Chapter 3 Instruction Set Architectures

Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001 Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001

Addressing modes - DirectAddressing modes - Direct

Page 11: Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001 Chapter 3 Instruction Set Architectures

Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001 Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001

Addressing modes - IndirectAddressing modes - Indirect

Page 12: Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001 Chapter 3 Instruction Set Architectures

Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001 Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001

Addressing modes - Register Addressing modes - Register DirectDirect

Page 13: Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001 Chapter 3 Instruction Set Architectures

Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001 Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001

Addressing modes - Register Addressing modes - Register IndirectIndirect

@ R

Page 14: Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001 Chapter 3 Instruction Set Architectures

Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001 Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001

Addressing modes - Addressing modes - ImmediateImmediate

Page 15: Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001 Chapter 3 Instruction Set Architectures

Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001 Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001

Addressing modes - ImplicitAddressing modes - Implicit

Page 16: Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001 Chapter 3 Instruction Set Architectures

Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001 Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001

Addressing modes - RelativeAddressing modes - Relative

Page 17: Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001 Chapter 3 Instruction Set Architectures

Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001 Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001

Addressing modes - IndexedAddressing modes - Indexed

Page 18: Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001 Chapter 3 Instruction Set Architectures

Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001 Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001

Instruction FormatsInstruction Formats

• More operands = less instructionsMore operands = less instructions

• More operands = larger wordsMore operands = larger words

Page 19: Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001 Chapter 3 Instruction Set Architectures

Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001 Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001

3-operand Instructions3-operand Instructions

Page 20: Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001 Chapter 3 Instruction Set Architectures

Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001 Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001

2-operand Instructions2-operand Instructions

Page 21: Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001 Chapter 3 Instruction Set Architectures

Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001 Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001

1-operand Instructions1-operand Instructions

Page 22: Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001 Chapter 3 Instruction Set Architectures

Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001 Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001

0-operand Instructions0-operand Instructions

Page 23: Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001 Chapter 3 Instruction Set Architectures

Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001 Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001

Instruction Set ArchitectureInstruction Set Architecture

• Instruction setInstruction set

• Register setRegister set

• Memory access informationMemory access information

Page 24: Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001 Chapter 3 Instruction Set Architectures

Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001 Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001

ISA AttributesISA Attributes

• CompletenessCompleteness

• OrthogonalityOrthogonality

• Register set designRegister set design

Page 25: Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001 Chapter 3 Instruction Set Architectures

Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001 Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001

ISA RequirementsISA Requirements

• Backward compatibility?Backward compatibility?

• Data types/sizesData types/sizes

• Interrupts?Interrupts?

• Conditional instructions?Conditional instructions?

Page 26: Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001 Chapter 3 Instruction Set Architectures

Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001 Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001

A Relatively Simple ISA - A Relatively Simple ISA - RegistersRegisters

• Accumulator Accumulator ACAC

• General purpose register General purpose register RR

• Flag Flag ZZ

Page 27: Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001 Chapter 3 Instruction Set Architectures

Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001 Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001

A Relatively Simple ISA - A Relatively Simple ISA - Instruction SetInstruction Set

Page 28: Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001 Chapter 3 Instruction Set Architectures

Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001 Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001

A Relatively Simple ISA - A Relatively Simple ISA - Instruction Set (continued)Instruction Set (continued)

Page 29: Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001 Chapter 3 Instruction Set Architectures

Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001 Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001

A Relatively Simple ISA - A Relatively Simple ISA - Instruction FormatsInstruction Formats

Page 30: Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001 Chapter 3 Instruction Set Architectures

Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001 Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001

Example Relatively Simple Example Relatively Simple ProgramProgram

1

1 2 ... , or

This could be written as a high-level language

code snippet as follows.

total=0;

FOR i=1 to n DO {total = total + i};

1. total = 0, i = 0

2. i =

n

i

n i

i + 1

3. total = total + i

4. IF i n THEN GOTO 2

Page 31: Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001 Chapter 3 Instruction Set Architectures

Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001 Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001

Example Relatively Simple Example Relatively Simple Program CodeProgram Code

Page 32: Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001 Chapter 3 Instruction Set Architectures

Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001 Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001

Example Relatively Simple Example Relatively Simple Program TraceProgram Trace

Page 33: Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001 Chapter 3 Instruction Set Architectures

Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001 Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001

A Relatively Simple ISA - A Relatively Simple ISA - AnalysisAnalysis

• CompletenessCompleteness

• OrthogonalityOrthogonality

• Register set designRegister set design

Page 34: Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001 Chapter 3 Instruction Set Architectures

Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001 Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001

The 8085 ISA - RegistersThe 8085 ISA - Registers

• Accumulator Accumulator AA

• General purpose registers General purpose registers BB, , CC, , DD, , EE, , HH, , LL

• Stack pointer Stack pointer SPSP

• Flags Flags SS, , ZZ, , PP, , CYCY, , ACAC

Page 35: Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001 Chapter 3 Instruction Set Architectures

Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001 Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001

The 8085 ISA - Instruction SetThe 8085 ISA - Instruction Set• Data movement instructionsData movement instructions

Page 36: Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001 Chapter 3 Instruction Set Architectures

Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001 Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001

The 8085 ISA - Instruction SetThe 8085 ISA - Instruction Set• Data operation instructionsData operation instructions

Page 37: Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001 Chapter 3 Instruction Set Architectures

Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001 Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001

The 8085 ISA - Instruction SetThe 8085 ISA - Instruction Set• Program control instructionsProgram control instructions

Page 38: Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001 Chapter 3 Instruction Set Architectures

Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001 Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001

The 8085 ISA - Instruction The 8085 ISA - Instruction FormatsFormats

Page 39: Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001 Chapter 3 Instruction Set Architectures

Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001 Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001

Example 8085 ProgramExample 8085 Program

1

1 2 ... , or

1. i = n, sum = 0

2. sum = sum + i, i = i - 1

3. IF i 0 THEN GOTO 2

4. total = sum

n

i

n i

Page 40: Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001 Chapter 3 Instruction Set Architectures

Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001 Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001

Example 8085 Program CodeExample 8085 Program Code

Page 41: Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001 Chapter 3 Instruction Set Architectures

Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001 Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001

Example 8085 Program TraceExample 8085 Program Trace

Page 42: Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001 Chapter 3 Instruction Set Architectures

Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001 Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001

The 8085 ISA - AnalysisThe 8085 ISA - Analysis

• CompletenessCompleteness

• OrthogonalityOrthogonality

• Register set designRegister set design

Page 43: Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001 Chapter 3 Instruction Set Architectures

Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001 Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001

SummarySummary

• Programming LanguagesProgramming Languages

• ISA DesignISA Design