02 ISA-Ch10
02 ISA-Ch10
Chapter (10 )
1
Instruction Set Architecture (ISA)
• Complete set of instructions used by a machine
• Abstract interface between the HW and lowest-
level SW.
• An ISA includes the following …
— Instructions and Instruction Formats
– Data Types, Encodings, and Representations
– Programmable Storage: Registers and Memory
– Addressing Modes: to address Instructions and Data
– Handling Exceptional Conditions (like division by zero)
software
instruction set
hardware
9
Where have all the Operands Gone?
Where is the next instruction to be fetched?
• Main memory (or virtual memory or
cache)
• CPU register
• I/O device
Typical Operations
Types of Operand
• Addresses
• Numbers
—Integer/floating point
• Characters
—ASCII etc.
• Logical Data
—Bits or flags
Types of Operation
• Data Transfer
• Arithmetic
• Logical
• Conversion
• I/O
• System Control
• Transfer of Control
Data Transfer
• Specify
—Source
—Destination
—Amount of data
• May be different instructions for different
movements
—e.g. IBM 370
• Or one instruction and different addresses
—e.g. VAX
Arithmetic
• Add, Subtract, Multiply, Divide
• Signed Integer
• Floating point ?
• May include
—Increment (a++)
—Decrement (a--)
—Negate (-a)
Types of Operation
• Systems Control
—For operating systems use
Transfer of Control
• Branch
—e.g. BRZ X branch to x if result of (ADD,SUB,…) is zero
— See next slide
• Skip
—e.g. increment and skip if zero ISZ
301
.
.
309 ISZ R1
310 BR 301
311
* eg. R1is set to -1000, the loop will be executed 1000 times
• Subroutine call
—c.f. interrupt call
Branch Instruction
Procedure Calls Instructions
• Computer program that is incorporated
with larger program.
• At any point in the program the procedure
may be invoked, or called
• When the procedure is executed, return to
the point at which the call took place.
• Advantages:
—Economy:
+The same piece of Code can be used many times-
efficient use of storage space in the system
—Modularity
+Allow large programming tasks to be divided into
smaller units which eases the programming
task
Procedure Calls Instructions
• Involves two basic instructions
—Call: branch to the procedure location
—Return: from the procedure to the place from
which it was called
(3 * 4) + (5 * 6) ⇒ 34*56*+
6
4 5 5 30
3 3 12 12 12 12 42
3 4 * 5 6 * +
Number of Addresses (d)
• 0 (zero) addresses
—Applicable to a special memory organization
called Stack
—Stack is known location
—Often at least the top two stack elements are
in processor registers
– ADD
– All addresses implicit
—e.g. push a
— push b
— add
— pop c
—c = a + b
How Many Addresses
• 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
• Most processor designs involve a variety
of instruction formats.
Fundamental Issues in Instruction Set Design
• Operation repertoire
— How many ops?
— What can they do?
— How complex are they?
• Data types
— The data type that the processor can deal with
— E.g., Pentium can deal wit data types of:
– Byte, 8 bits
– Word, 16 bits
– Doubleword, 32 bits
– Quadword, 64 bits
– Other data type…
• Instruction formats
— Length of op code field
— Number of addresses
Fundamental Issues in Instruction Set Design
• Registers
—Number of CPU registers available
—Which operations can be performed on which
registers?
• Addressing modes (later…)
• RISC v CISC
Byte Order
(A portion of chips?)
• 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
Byte Order (example)
• Address Value (1) Value(2)
• 184 12 78
• 185 34 56
• 186 56 34
• 186 78 12