chapter 10 instruction sets: characteristics and functions felipe navarro luis gomez collin brown
TRANSCRIPT
![Page 1: Chapter 10 Instruction Sets: Characteristics and Functions Felipe Navarro Luis Gomez Collin Brown](https://reader036.vdocuments.site/reader036/viewer/2022062322/5697bfee1a28abf838cb9992/html5/thumbnails/1.jpg)
Chapter 10Instruction Sets:
Characteristics and Functions
Felipe NavarroLuis GomezCollin Brown
![Page 2: Chapter 10 Instruction Sets: Characteristics and Functions Felipe Navarro Luis Gomez Collin Brown](https://reader036.vdocuments.site/reader036/viewer/2022062322/5697bfee1a28abf838cb9992/html5/thumbnails/2.jpg)
The complete collection of instructions that are understood by a CPU
Machine Code Binary Usually represented by assembly codes
![Page 3: Chapter 10 Instruction Sets: Characteristics and Functions Felipe Navarro Luis Gomez Collin Brown](https://reader036.vdocuments.site/reader036/viewer/2022062322/5697bfee1a28abf838cb9992/html5/thumbnails/3.jpg)
Operation code (Op code) Do this
Source Operand reference To this
Result Operand reference Put the answer here
Next Instruction Reference When you have done that, do this...
![Page 4: Chapter 10 Instruction Sets: Characteristics and Functions Felipe Navarro Luis Gomez Collin Brown](https://reader036.vdocuments.site/reader036/viewer/2022062322/5697bfee1a28abf838cb9992/html5/thumbnails/4.jpg)
![Page 5: Chapter 10 Instruction Sets: Characteristics and Functions Felipe Navarro Luis Gomez Collin Brown](https://reader036.vdocuments.site/reader036/viewer/2022062322/5697bfee1a28abf838cb9992/html5/thumbnails/5.jpg)
In machine code each instruction has a unique bit pattern
For human consumption (well, programmers anyway) a symbolic representation is used e.g. ADD, SUB, LOAD
Operands can also be represented in this way ADD A,B
![Page 6: Chapter 10 Instruction Sets: Characteristics and Functions Felipe Navarro Luis Gomez Collin Brown](https://reader036.vdocuments.site/reader036/viewer/2022062322/5697bfee1a28abf838cb9992/html5/thumbnails/6.jpg)
![Page 7: Chapter 10 Instruction Sets: Characteristics and Functions Felipe Navarro Luis Gomez Collin Brown](https://reader036.vdocuments.site/reader036/viewer/2022062322/5697bfee1a28abf838cb9992/html5/thumbnails/7.jpg)
Data processing Data storage (main memory) Data movement (I/O) Program flow control
![Page 8: Chapter 10 Instruction Sets: Characteristics and Functions Felipe Navarro Luis Gomez Collin Brown](https://reader036.vdocuments.site/reader036/viewer/2022062322/5697bfee1a28abf838cb9992/html5/thumbnails/8.jpg)
3 addresses Operand 1, Operand 2, Result a = b + c; May be a forth - next instruction (usually
implicit) Not common Needs very long words to hold everything
![Page 9: Chapter 10 Instruction Sets: Characteristics and Functions Felipe Navarro Luis Gomez Collin Brown](https://reader036.vdocuments.site/reader036/viewer/2022062322/5697bfee1a28abf838cb9992/html5/thumbnails/9.jpg)
2 addresses One address doubles as operand and result a = a + b Reduces length of instruction Requires some extra work
Temporary storage to hold some results
![Page 10: Chapter 10 Instruction Sets: Characteristics and Functions Felipe Navarro Luis Gomez Collin Brown](https://reader036.vdocuments.site/reader036/viewer/2022062322/5697bfee1a28abf838cb9992/html5/thumbnails/10.jpg)
1 address Implicit second address Usually a register (accumulator) Common on early machines
![Page 11: Chapter 10 Instruction Sets: Characteristics and Functions Felipe Navarro Luis Gomez Collin Brown](https://reader036.vdocuments.site/reader036/viewer/2022062322/5697bfee1a28abf838cb9992/html5/thumbnails/11.jpg)
0 (zero) addresses All addresses implicit Uses a stack e.g. push a push b add pop c
c = a + b
![Page 12: Chapter 10 Instruction Sets: Characteristics and Functions Felipe Navarro Luis Gomez Collin Brown](https://reader036.vdocuments.site/reader036/viewer/2022062322/5697bfee1a28abf838cb9992/html5/thumbnails/12.jpg)
More addresses More complex (powerful?) instructions More registers
Inter-register operations are quicker Fewer instructions per program
Fewer addresses Less complex (powerful?) instructions More instructions per program Faster fetch/execution of instructions
![Page 13: Chapter 10 Instruction Sets: Characteristics and Functions Felipe Navarro Luis Gomez Collin Brown](https://reader036.vdocuments.site/reader036/viewer/2022062322/5697bfee1a28abf838cb9992/html5/thumbnails/13.jpg)
Operation repertoire How many ops? What can they do? How complex are they?
Data types (Characteristics later…) Different forms of data to which operations are
performed Instruction formats
Length of op code field Number of addresses Size of various fields
![Page 14: Chapter 10 Instruction Sets: Characteristics and Functions Felipe Navarro Luis Gomez Collin Brown](https://reader036.vdocuments.site/reader036/viewer/2022062322/5697bfee1a28abf838cb9992/html5/thumbnails/14.jpg)
Registers Number of CPU registers available Which operations can be performed on which
registers? Addressing modes (later…)
RISC vs. CISC
![Page 15: Chapter 10 Instruction Sets: Characteristics and Functions Felipe Navarro Luis Gomez Collin Brown](https://reader036.vdocuments.site/reader036/viewer/2022062322/5697bfee1a28abf838cb9992/html5/thumbnails/15.jpg)
Addresses Numbers
Integer/floating point Characters
ASCII etc. Logical Data
![Page 16: Chapter 10 Instruction Sets: Characteristics and Functions Felipe Navarro Luis Gomez Collin Brown](https://reader036.vdocuments.site/reader036/viewer/2022062322/5697bfee1a28abf838cb9992/html5/thumbnails/16.jpg)
Data Transfer Arithmetic Logical Conversion I/O System Control Transfer of Control
![Page 17: Chapter 10 Instruction Sets: Characteristics and Functions Felipe Navarro Luis Gomez Collin Brown](https://reader036.vdocuments.site/reader036/viewer/2022062322/5697bfee1a28abf838cb9992/html5/thumbnails/17.jpg)
Specify Source Destination Amount of data Addressing mode (later…)
May be different instructions for different movements e.g. IBM 390
Or one instruction and different addresses e.g. VAX
![Page 18: Chapter 10 Instruction Sets: Characteristics and Functions Felipe Navarro Luis Gomez Collin Brown](https://reader036.vdocuments.site/reader036/viewer/2022062322/5697bfee1a28abf838cb9992/html5/thumbnails/18.jpg)
Add, Subtract, Multiply, Divide Signed Integer (Always provided for) Floating point (Often provided for) Packed decimals (Often provided for) May include
Increment (a++) Decrement (a--) Absolute Value (|a|) Negate (-a)
May involve data transfer operations
![Page 19: Chapter 10 Instruction Sets: Characteristics and Functions Felipe Navarro Luis Gomez Collin Brown](https://reader036.vdocuments.site/reader036/viewer/2022062322/5697bfee1a28abf838cb9992/html5/thumbnails/19.jpg)
Bitwise operations AND, OR, XOR, NOT, Equals
Conversion
• Ex: Binary to Decimal. Decimal to Binary
![Page 20: Chapter 10 Instruction Sets: Characteristics and Functions Felipe Navarro Luis Gomez Collin Brown](https://reader036.vdocuments.site/reader036/viewer/2022062322/5697bfee1a28abf838cb9992/html5/thumbnails/20.jpg)
Falls into the following categories: Control and timing Processor communication Device communication Data buffering Error detection
May be specific instruction May be done using data movement
instructions (memory mapped) May be done by a separate controller (DMA)
![Page 21: Chapter 10 Instruction Sets: Characteristics and Functions Felipe Navarro Luis Gomez Collin Brown](https://reader036.vdocuments.site/reader036/viewer/2022062322/5697bfee1a28abf838cb9992/html5/thumbnails/21.jpg)
Executed only in a privileged state CPU needs to be in specific state
Ring 0 on 80386+ Kernel mode
For operating systems use
![Page 22: Chapter 10 Instruction Sets: Characteristics and Functions Felipe Navarro Luis Gomez Collin Brown](https://reader036.vdocuments.site/reader036/viewer/2022062322/5697bfee1a28abf838cb9992/html5/thumbnails/22.jpg)
Branch e.g. branch to x if result is zero
Skip e.g. increment and skip if zero ISZ Register1 Branch xxxx ADD A
![Page 23: Chapter 10 Instruction Sets: Characteristics and Functions Felipe Navarro Luis Gomez Collin Brown](https://reader036.vdocuments.site/reader036/viewer/2022062322/5697bfee1a28abf838cb9992/html5/thumbnails/23.jpg)
![Page 24: Chapter 10 Instruction Sets: Characteristics and Functions Felipe Navarro Luis Gomez Collin Brown](https://reader036.vdocuments.site/reader036/viewer/2022062322/5697bfee1a28abf838cb9992/html5/thumbnails/24.jpg)
![Page 25: Chapter 10 Instruction Sets: Characteristics and Functions Felipe Navarro Luis Gomez Collin Brown](https://reader036.vdocuments.site/reader036/viewer/2022062322/5697bfee1a28abf838cb9992/html5/thumbnails/25.jpg)
![Page 26: Chapter 10 Instruction Sets: Characteristics and Functions Felipe Navarro Luis Gomez Collin Brown](https://reader036.vdocuments.site/reader036/viewer/2022062322/5697bfee1a28abf838cb9992/html5/thumbnails/26.jpg)
![Page 27: Chapter 10 Instruction Sets: Characteristics and Functions Felipe Navarro Luis Gomez Collin Brown](https://reader036.vdocuments.site/reader036/viewer/2022062322/5697bfee1a28abf838cb9992/html5/thumbnails/27.jpg)
What order do we read numbers that occupy more than one byte
e.g. (numbers in hex to make it easy to read)
12345678 can be stored in 4x8bit locations as follows
![Page 28: Chapter 10 Instruction Sets: Characteristics and Functions Felipe Navarro Luis Gomez Collin Brown](https://reader036.vdocuments.site/reader036/viewer/2022062322/5697bfee1a28abf838cb9992/html5/thumbnails/28.jpg)
• Provide four instructions to support procedure call/return CALL ENTER LEAVE RETURN
• A new Procedure call/return• Push the return point on the stack• Push the current frame pointer on the stack• Copy the stack pointer as the new value of the frame pointer• Adjust the stack pointer to allocate frame
![Page 29: Chapter 10 Instruction Sets: Characteristics and Functions Felipe Navarro Luis Gomez Collin Brown](https://reader036.vdocuments.site/reader036/viewer/2022062322/5697bfee1a28abf838cb9992/html5/thumbnails/29.jpg)
Address Value (1) Value(2) 184 12 78 185 34 56 186 56 34 186 78 12
i.e. read top down or bottom up?
![Page 30: Chapter 10 Instruction Sets: Characteristics and Functions Felipe Navarro Luis Gomez Collin Brown](https://reader036.vdocuments.site/reader036/viewer/2022062322/5697bfee1a28abf838cb9992/html5/thumbnails/30.jpg)
The problem is called Endian The system on the left has the least
significant byte in the lowest address This is called big-endian The system on the right has the least
significant byte in the highest address This is called little-endian
![Page 31: Chapter 10 Instruction Sets: Characteristics and Functions Felipe Navarro Luis Gomez Collin Brown](https://reader036.vdocuments.site/reader036/viewer/2022062322/5697bfee1a28abf838cb9992/html5/thumbnails/31.jpg)
![Page 32: Chapter 10 Instruction Sets: Characteristics and Functions Felipe Navarro Luis Gomez Collin Brown](https://reader036.vdocuments.site/reader036/viewer/2022062322/5697bfee1a28abf838cb9992/html5/thumbnails/32.jpg)
![Page 33: Chapter 10 Instruction Sets: Characteristics and Functions Felipe Navarro Luis Gomez Collin Brown](https://reader036.vdocuments.site/reader036/viewer/2022062322/5697bfee1a28abf838cb9992/html5/thumbnails/33.jpg)
1 What are the typical elements of a machine instruction?
2 What types of locations can hold source and destination operands?
3 If an instruction contains four addresses, what might be the purpose of each address?
4 What types of operands are typical in machine instruction set?
5 What is the difference between an arithmetic shift and a logic shift?
6 What is the difference between assembly language and machine language
7 What is the difference between big endian and little endian?
8 List three places for storing the return address for a procedure return.
![Page 34: Chapter 10 Instruction Sets: Characteristics and Functions Felipe Navarro Luis Gomez Collin Brown](https://reader036.vdocuments.site/reader036/viewer/2022062322/5697bfee1a28abf838cb9992/html5/thumbnails/34.jpg)
1Operation code, source operand reference, result operand reference and next instruction reference.
2 Register and memory.3 Two operands, one result, and the address of
the next instruction.4 Address, character, numbers and logical data.5 In logical shift, the bits of word are shifted left
or right. Arithmetic shift treats the data as a signed integer and does not shift the sign bit.
![Page 35: Chapter 10 Instruction Sets: Characteristics and Functions Felipe Navarro Luis Gomez Collin Brown](https://reader036.vdocuments.site/reader036/viewer/2022062322/5697bfee1a28abf838cb9992/html5/thumbnails/35.jpg)
6 Assemble language uses symbolic names for addresses that are not fixed to specific physical address; this is not the case with machine language.
7 A multibyte numerical value stored with the most significant byte in the lowest numerical address. A multibyte numerical value stored with the most significant byte in the highest numerical address.
8 Register, start of procedure, top of stack