william stallings computer organization and architecture 8 th edition
DESCRIPTION
William Stallings Computer Organization and Architecture 8 th Edition. Chapter 11 Instruction Sets: Addressing Modes and Formats Gabriel Baron Sydney Chow. Addressing Modes. Immediate Direct Indirect Register Register Indirect Displacement (Indexed) Stack. Immediate Addressing. - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: William Stallings Computer Organization and Architecture 8 th Edition](https://reader035.vdocuments.mx/reader035/viewer/2022070410/5681455b550346895db22ace/html5/thumbnails/1.jpg)
Chapter 11Instruction Sets:
Addressing Modes and Formats
Gabriel BaronSydney Chow
![Page 2: William Stallings Computer Organization and Architecture 8 th Edition](https://reader035.vdocuments.mx/reader035/viewer/2022070410/5681455b550346895db22ace/html5/thumbnails/2.jpg)
Immediate Direct Indirect Register Register Indirect Displacement (Indexed) Stack
![Page 3: William Stallings Computer Organization and Architecture 8 th Edition](https://reader035.vdocuments.mx/reader035/viewer/2022070410/5681455b550346895db22ace/html5/thumbnails/3.jpg)
Simplest form of addressing Operand value is present in instruction Operand = A e.g. ADD 5
Add 5 to contents of accumulator 5 is operand
Advantages No memory reference to fetch data Fast
Disadvantages Size restriction to the size of address field
![Page 4: William Stallings Computer Organization and Architecture 8 th Edition](https://reader035.vdocuments.mx/reader035/viewer/2022070410/5681455b550346895db22ace/html5/thumbnails/4.jpg)
OperandOpcode
Instruction
Example: LDAAOpcode = 86Operand = 05
![Page 5: William Stallings Computer Organization and Architecture 8 th Edition](https://reader035.vdocuments.mx/reader035/viewer/2022070410/5681455b550346895db22ace/html5/thumbnails/5.jpg)
Simple form of addressing Address field contains address of operand
Effective address (EA) = address field (A) e.g. ADD A
Add contents of cell A to accumulator Look in memory at address A for operand
Single memory reference to access data No additional calculations to work out
effective address Disadvantage
Limited address space
![Page 6: William Stallings Computer Organization and Architecture 8 th Edition](https://reader035.vdocuments.mx/reader035/viewer/2022070410/5681455b550346895db22ace/html5/thumbnails/6.jpg)
Address AOpcode
Instruction
Memory
OperandExample: LDAAOpcode = 96A= E5Address A = 00 E5
![Page 7: William Stallings Computer Organization and Architecture 8 th Edition](https://reader035.vdocuments.mx/reader035/viewer/2022070410/5681455b550346895db22ace/html5/thumbnails/7.jpg)
Memory cell pointed to by address field that contains the address of (pointer to) the operand
EA = (A) [parentheses means contents of] Look in A, find address (A) and look there for
operand e.g. ADD (A)
Add contents of cell pointed to by contents of A to accumulator
Advantages For word length N, space 2n now available Large address space
![Page 8: William Stallings Computer Organization and Architecture 8 th Edition](https://reader035.vdocuments.mx/reader035/viewer/2022070410/5681455b550346895db22ace/html5/thumbnails/8.jpg)
Disadvantages Requires two memory references to fetch
operand One to get its address Second to get its value
Slower Multiple memory accesses to find operand
![Page 9: William Stallings Computer Organization and Architecture 8 th Edition](https://reader035.vdocuments.mx/reader035/viewer/2022070410/5681455b550346895db22ace/html5/thumbnails/9.jpg)
Address AOpcode
Instruction
Memory
Operand
Pointer to operand
Example:Opcode = XXA = 11C511C5 = Operand
![Page 10: William Stallings Computer Organization and Architecture 8 th Edition](https://reader035.vdocuments.mx/reader035/viewer/2022070410/5681455b550346895db22ace/html5/thumbnails/10.jpg)
Address field refers to a register rather than a main memory address
EA = R Advantages
Very small address field needed Shorter instructions Faster instruction fetch
No memory reference required Very fast execution Multiple registers helps performance
Requires good assembly programming or compiler writing
![Page 11: William Stallings Computer Organization and Architecture 8 th Edition](https://reader035.vdocuments.mx/reader035/viewer/2022070410/5681455b550346895db22ace/html5/thumbnails/11.jpg)
Disadvantage Very limited address space
![Page 12: William Stallings Computer Organization and Architecture 8 th Edition](https://reader035.vdocuments.mx/reader035/viewer/2022070410/5681455b550346895db22ace/html5/thumbnails/12.jpg)
Register Address ROpcode
Instruction
Registers
Operand
Example:Opcode = XXRegister R = Operand
![Page 13: William Stallings Computer Organization and Architecture 8 th Edition](https://reader035.vdocuments.mx/reader035/viewer/2022070410/5681455b550346895db22ace/html5/thumbnails/13.jpg)
EA = (R) Operand is in memory cell pointed to by
contents of register R Advantages
For word length N, space 2n now available Large address space One fewer memory access than indirect
addressing Disadvantages
Requires two memory references to fetch operand Multiple memory accesses to find operand Slower
![Page 14: William Stallings Computer Organization and Architecture 8 th Edition](https://reader035.vdocuments.mx/reader035/viewer/2022070410/5681455b550346895db22ace/html5/thumbnails/14.jpg)
Register Address ROpcode
Instruction
Memory
OperandPointer to Operand
Registers
![Page 15: William Stallings Computer Organization and Architecture 8 th Edition](https://reader035.vdocuments.mx/reader035/viewer/2022070410/5681455b550346895db22ace/html5/thumbnails/15.jpg)
Combines the capabilities of direct addressing and register indirect addressing
EA = A + (R) Advantages
Flexibility Disadvantages
Complexity Requirements
Address field hold two values A = base value R = register that holds displacement or vice versa
![Page 16: William Stallings Computer Organization and Architecture 8 th Edition](https://reader035.vdocuments.mx/reader035/viewer/2022070410/5681455b550346895db22ace/html5/thumbnails/16.jpg)
Register ROpcode
Instruction
Memory
OperandPointer to Operand
Registers
Address A
+
![Page 17: William Stallings Computer Organization and Architecture 8 th Edition](https://reader035.vdocuments.mx/reader035/viewer/2022070410/5681455b550346895db22ace/html5/thumbnails/17.jpg)
Linear array of locations (last-in-first-out) Operand is (implicitly) on top of stack EA = top of stack Advantages
No memory reference Disadvantage
Limited applicability e.g.
ADD Pop top two items from stackand add
![Page 18: William Stallings Computer Organization and Architecture 8 th Edition](https://reader035.vdocuments.mx/reader035/viewer/2022070410/5681455b550346895db22ace/html5/thumbnails/18.jpg)
![Page 19: William Stallings Computer Organization and Architecture 8 th Edition](https://reader035.vdocuments.mx/reader035/viewer/2022070410/5681455b550346895db22ace/html5/thumbnails/19.jpg)
The memory is divided into portions that maybe addressed by a single index register without changing a 16-bit segment selector. A segment is always 64 KB in size using a 16-bit offset.
The X86 Addressing modes are as follows: Register Memory Displacement Only Indirect Indexed Based Indexed
![Page 20: William Stallings Computer Organization and Architecture 8 th Edition](https://reader035.vdocuments.mx/reader035/viewer/2022070410/5681455b550346895db22ace/html5/thumbnails/20.jpg)
Layout of bits in an instruction Includes opcode Includes (implicit or explicit) operand(s) Usually more than one instruction format
in an instruction set
![Page 21: William Stallings Computer Organization and Architecture 8 th Edition](https://reader035.vdocuments.mx/reader035/viewer/2022070410/5681455b550346895db22ace/html5/thumbnails/21.jpg)
The most basic design issue to be faced Affected by and affects:
Memory size Memory organization Bus structure CPU complexity CPU speed
Trade off between powerful instruction repertoire and saving space
![Page 22: William Stallings Computer Organization and Architecture 8 th Edition](https://reader035.vdocuments.mx/reader035/viewer/2022070410/5681455b550346895db22ace/html5/thumbnails/22.jpg)
Number of addressing modes Sometimes an addressing mode can be
indicated implicitly i.e. certain opcodes might always call for
indexing, so the addressing modes must be explicit and one or more mode bits will be needed
Number of operands Fewer addresses can make for longer, more
awkward programs Register versus memory
The more that registers can be used or operand references, the fewer bits are needed
![Page 23: William Stallings Computer Organization and Architecture 8 th Edition](https://reader035.vdocuments.mx/reader035/viewer/2022070410/5681455b550346895db22ace/html5/thumbnails/23.jpg)
Number of register sets These registers can be used to store data and
can be used to store addresses for displacement addressing
Address range For addresses that reference memory, the range
of addresses that can be referenced is related to the number of address bits
Address granularity In a system with 16- or 32- bit words, an
address can reference a word or byte at the designer’s choice
![Page 24: William Stallings Computer Organization and Architecture 8 th Edition](https://reader035.vdocuments.mx/reader035/viewer/2022070410/5681455b550346895db22ace/html5/thumbnails/24.jpg)
One of the simplest instruction designs for a general purpose
Each memory reference consist of 7 bits plus two 1-bit modifiers
The memory is divided into fixed-length pages of 27 = 128 words
Supports indirect addressing, displacement addressing and indexing
![Page 25: William Stallings Computer Organization and Architecture 8 th Edition](https://reader035.vdocuments.mx/reader035/viewer/2022070410/5681455b550346895db22ace/html5/thumbnails/25.jpg)
![Page 26: William Stallings Computer Organization and Architecture 8 th Edition](https://reader035.vdocuments.mx/reader035/viewer/2022070410/5681455b550346895db22ace/html5/thumbnails/26.jpg)
Designed to be a large-scale time-shared system, with an emphasis on making the system program easy
Some design principals Orthogonality
Two variables are independent of each other Completeness
Each arithmetic data type should have a complete and identical set of operations
Direct addressing Base plus displacement addressing, usually
avoided in favor of direct addressing
![Page 27: William Stallings Computer Organization and Architecture 8 th Edition](https://reader035.vdocuments.mx/reader035/viewer/2022070410/5681455b550346895db22ace/html5/thumbnails/27.jpg)
![Page 28: William Stallings Computer Organization and Architecture 8 th Edition](https://reader035.vdocuments.mx/reader035/viewer/2022070410/5681455b550346895db22ace/html5/thumbnails/28.jpg)
Provides a powerful and flexible instruction set within the constraints of a 16-bit microcomputer
Employs a set of eight 16-bit general-purpose registers
Increases hardware cost and programming complexity because of addressing capability More efficient or compact programs can be
deeloped
![Page 29: William Stallings Computer Organization and Architecture 8 th Edition](https://reader035.vdocuments.mx/reader035/viewer/2022070410/5681455b550346895db22ace/html5/thumbnails/29.jpg)
![Page 30: William Stallings Computer Organization and Architecture 8 th Edition](https://reader035.vdocuments.mx/reader035/viewer/2022070410/5681455b550346895db22ace/html5/thumbnails/30.jpg)
Begins with a 1-byte opcode On hexadecimal codes
Actual opcode being specified in the second byte
Remainder of instructions consist of up to six operand specifiers Minimum 1-byte format which leftmost 4 bits
are the address mode specifier Provides for a wide variety of operations
and addressing modes
![Page 31: William Stallings Computer Organization and Architecture 8 th Edition](https://reader035.vdocuments.mx/reader035/viewer/2022070410/5681455b550346895db22ace/html5/thumbnails/31.jpg)
![Page 32: William Stallings Computer Organization and Architecture 8 th Edition](https://reader035.vdocuments.mx/reader035/viewer/2022070410/5681455b550346895db22ace/html5/thumbnails/32.jpg)
Types of addressing modes are: Immediate, Direct, Indirect, Register, Register-Indirect, Displacement ,
Stack …
Some of the Key Design issues for instruction formats are: Instruction length, allocation of bits, PDP-8,
PDP-10, PDP-11, VAX.
![Page 33: William Stallings Computer Organization and Architecture 8 th Edition](https://reader035.vdocuments.mx/reader035/viewer/2022070410/5681455b550346895db22ace/html5/thumbnails/33.jpg)
1. What are four addressing modes?Ans: Immediate, Direct, Indirect, Stack.
2. What is simplest addressing mode?Ans: Immediate Addressing Mode.
3. What is the disadvantage of the direct addressing mode?
Ans: Limited Address Space.
4. What is indirect addressing?Ans: The operand is stored in an address, which is stored
in an memory cell.
5. Which addressing mode refers to a register instead of a memory address?
Ans: Register Addressing Mode
![Page 34: William Stallings Computer Organization and Architecture 8 th Edition](https://reader035.vdocuments.mx/reader035/viewer/2022070410/5681455b550346895db22ace/html5/thumbnails/34.jpg)
6. How does the register indirect addressing mode access the operand?
Ans: The operand is store in an address that is pointed to by a memory cell.
7. What two values does the address field hold in the Displacement Addressing mode?
Ans: Base value, Register value
8. What order is data sorted in the stack addressing mode?
Ans: Last in First Out
9. What are four X86 Addressing Modes?Ans: Register, memory, displacement, indirect.
![Page 35: William Stallings Computer Organization and Architecture 8 th Edition](https://reader035.vdocuments.mx/reader035/viewer/2022070410/5681455b550346895db22ace/html5/thumbnails/35.jpg)
10. Which instruction design is the simplest for general purpose?
Ans: PDP-8
![Page 36: William Stallings Computer Organization and Architecture 8 th Edition](https://reader035.vdocuments.mx/reader035/viewer/2022070410/5681455b550346895db22ace/html5/thumbnails/36.jpg)
X86 Addressing Modes http://www.arl.wustl.edu/~lockwood/class/cs306/books/artofasm/Chapter_4/CH
04-2.html#HEADING2-1 http://www.cs.cmu.edu/~410/doc/segments/segments.html