Sunday, July 6, 2014

Introduction to instruction set architecture

Instruction Set Architecture (ISA)

The Instruction Set Architecture (ISA) is the part of the processor that is visible to the programmer or compiler writer. The ISA serves as the boundary between software and hardware. We will briefly describe the instruction sets found in many of the microprocessors used today. The ISA of a processor can be described using 5 categories: 

1. Operand Storage in the CPU Where are the operands kept other than in memory? 

2. Number of explicit named operands How many operands are named in a typical instruction. 

3. Operand location Can any ALU instruction operand be located in memory? Or must all operands be    
    kept internally in the CPU? 

4. Operations What operations are provided in the ISA. 

5. Type and size of operands What is the type and size of each operand and how is it specified? Of all the
    above the most distinguishing factor is the first. The 3 most common types of ISAs are:
 
           a. Stack - The operands are implicitly on top of the stack.
           b. Accumulator - One operand is implicitly the accumulator.
           c. General Purpose Register (GPR) - All operands are explicitely mentioned, they are either 
                registers or memory locations.

Advantages and disadvantages

Stack

Advantages: Simple Model of expression evaluation (reverse polish). Short instructions. 
Disadvantages: A stack can't be randomly accessed This makes it hard to generate efficient code. The 
                           stack itself is accessed every operation and becomes a bottleneck.

Accumulator

Advantages: Short instructions 
Disadvantages: The accumulator is only temporary storage so memory traffic is the highest for this
                           approach.

GPR

Advantages: Makes code generation easy. Data can be stored for long periods in registers. 
Disadvantages: All operands must be named leading to longer instructions. Earlier CPUs were of the first 2
                           types but in the last 15 years all CPUs made are GPR processors. The 2 major reasons 
                           are that registers are faster than memory, the more data that can be kept internally in the
                           CPU the faster the program will run. The other reason is that registers are easier for a 
                           compiler to use.


0 comments:

Post a Comment