chapter 10 instruction sets: characteristics and functions suzy hanko
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 PresentationTRANSCRIPT
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.
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
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
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
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
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.
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.
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.
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.
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.