chapter 10 instruction sets: characteristics and functions suzy hanko

11
Chapter 10 Instruction Sets: Characteristics and Functions Suzy Hanko

Upload: audra-rodriguez

Post on 02-Jan-2016

37 views

Category:

Documents


6 download

DESCRIPTION

Chapter 10 Instruction Sets: Characteristics and Functions Suzy Hanko. Machine Instructions. Machine instructions are the instructions executed by the processor. These determine what the processor will do Inside the computer, each instruction is represented as a series of bits. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Chapter 10 Instruction Sets: Characteristics and Functions Suzy Hanko

Chapter 10

Instruction Sets:Characteristics and Functions

Suzy Hanko

Page 2: Chapter 10 Instruction Sets: Characteristics and Functions Suzy Hanko

Machine Instructions

Machine instructions are the instructions executed by the processor.

These determine what the processor will do Inside the computer, each instruction is

represented as a series of bits. Because this is difficult to remember, symbolic

representation is common.

Page 3: Chapter 10 Instruction Sets: Characteristics and Functions Suzy Hanko

Elements of Machine Instructions

Operation code (opcode): Tells the processor which operation to perform

Source operand reference: tells the processor where the operands can be found

Result operand reference: Tells the processor where to store the result

Next instruction reference: Tells the processor where to fetch the next instruction from

Not all elements are used in every instruction

Page 4: Chapter 10 Instruction Sets: Characteristics and Functions Suzy Hanko

Types of Instructions

Four main types of instructions: Data processing: Arithmetic and logic Data storage: Moving data between registers

and memory locations Data movement: Transferring data and

programs to memory or the user Control: Tests the value of data and/or

branches to a different set of instructions

Page 5: Chapter 10 Instruction Sets: Characteristics and Functions Suzy Hanko

Transfer of Control

This is when the next instruction performed is not the one that immediately follows the current one in memory.

Branch/Jump: jumps to an instruction other than the next one in sequence.

Skip: skips the next instruction in sequence Procedure call: executes a procedure before

coming back and executing the next instruction

Page 6: Chapter 10 Instruction Sets: Characteristics and Functions Suzy Hanko

Types of Operands

Four main types of operands: Numbers Characters Logical data Addresses

The actual names and exact effects of the operands varies between machines

Page 7: Chapter 10 Instruction Sets: Characteristics and Functions Suzy Hanko

Call/Return Instructions

These instructions call and return from functions.

Four Instructions in x86 architecture: Call, Enter, Leave, and Return

When a function is called must push the return point and frame pointer onto the stack, then move the frame pointer to a new frame and place the stack pointer in that frame.

Page 8: Chapter 10 Instruction Sets: Characteristics and Functions Suzy Hanko

Condition Codes

Condition codes set status flags, which are set by certain operations and used in conditional branch instructions.

Each status flag, and some combinations of status flags, can be tested as a condition for a jump.

Page 9: Chapter 10 Instruction Sets: Characteristics and Functions Suzy Hanko

Stacks

A stack is a LIFO (last-in-first-out) data structure

A stack (called the run-time stack) is used to manage procedure calls and returns, and variables.

Page 10: Chapter 10 Instruction Sets: Characteristics and Functions Suzy Hanko

Stacks (continued)

To operate the stack, three addresses are needed to be kept in registers:

The stack pointer, which contains the address of the top of the stack.

The stack base, which contains the address of the bottom of the reserved block.

The stack limit, which contains the address of the top of the reserved block.

Page 11: Chapter 10 Instruction Sets: Characteristics and Functions Suzy Hanko

Little- and Big-Endian

There are two main ways to store numbers in a computer

Big-endian stores the most significant byte in the lowest numerical address, similar to the way we write numbers

Little-endian stores the most significant byte in the highest numerical address

Both styles have advantages and disadvantages, with neither being better on average.