Chapter 5
Chapter 5
A Closer Look at
Instruction Set
Architectures
5.2 Instruction Formats
2
5.2 Instruction Formats
3
Big endian
4
Little Endian
In little endian machines, the least significant byte is followed by the most
significant byte.
5
Example
6
Internal Storage in the CPU
In choosing one over the other, the tradeoffs are simplicity and cost of hardware
7
design with execution speed and ease of use.
5.2 Instruction Formats
9
10
11
12
13
14
15
16
17
18
19
5.2 Instruction Formats
20
5.2 Instruction Formats
21
5.2 Instruction Formats
25
5.4 Addressing
• Immediate addressing
– is where the data is part of the instruction.
• Direct addressing
– is where the address of the data is given in the instruction.
• Register addressing
– is where the data is located in a register.
• Indirect addressing
– gives the address of the address of the data in the instruction.
• Register indirect addressing
– uses a register to store the address of the operand.
27
5.4 Addressing
• Indexed addressing ( E.A = R + address in operand)
– uses a register as an offset, which is added to the address in the
operand to determine the effective address of the data.
• Based addressing
– is similar except that a base register is used instead of an index
register
• The difference between these two is that an
– index register holds an offset relative to the address given in the
instruction
– a base register holds a base address where the address field
represents a displacement from this base.
• Stack addressing
28
– the operand is assumed to be on top of the stack.
5.4 Addressing
29
5.4 Addressing
30
5.5 Instruction-Level Pipelining
31
5.5 Instruction-Level Pipelining
32
5.5 Instruction-Level Pipelining
34
5.5 Instruction-Level Pipelining
35
5.5 Instruction-Level Pipelining
• Our equations take a number of things for granted
–First
we have to assume that the architecture supports
fetching instructions and data in parallel.
–Second
we assume that the pipeline can be kept filled at all
times. This is not always the case. Pipeline hazards
arise that cause pipeline conflicts and stalls
– Resource conflicts.
– Data dependencies.
– Conditional branching 36
Example
Q1) A nonpipelined system takes 40ns
to execute instructions. The instructions
for 31 instructions
Complex Instruction Set Computers
40
Complex Instruction Set Computers
• For this particular task, a CISC processor would
come prepared with a specific instruction (we'll call
it "MULT").
• When executed, this instruction
– loads the two values into separate registers
– multiplies the operands in the execution unit
– then stores the product in the appropriate location or
register.
– Thus, the entire task of multiplying two numbers can be
completed with one instruction:
41
– MULT 300, 200
42
Reduced Instruction Set Computers
• RISC processors only use simple instructions that
can be executed within one clock cycle.
• Thus, the "MULT" command described above could
be divided into three separate commands:
– LOAD, which moves data from the memory bank to a
register,
– MULT, which finds the product of two operands located
within the registers,
– STORE, which moves data from a register to the
memory banks.
43
Complex Instruction Set Computers
• It operates directly on the computer's memory banks
and does not require the programmer to explicitly
call any loading or storing functions.
• advantages of this system is that
– the compiler has to do very little work to translate a high-
level language statement into assembly.
– Because the length of the code is relatively short, very
little RAM is required to store instructions. The emphasis
is put on building complex instructions directly into the
hardware.
44
Reduced Instruction Set Computers
45
Reduced Instruction Set Computers
46
Reduced Instruction Set Computers
• However, the RISC strategy brings some very
important advantages.
– Because each instruction requires only one clock cycle to
execute, the entire program will execute in approximately
the same amount of time as the multi-cycle "MULT"
command.
– Because all of the instructions execute in a uniform amount
of time (i.e. one clock), pipelining is possible.
– Reduced instructions require less transistors of hardware
space than the complex instructions, leaving more room for
general purpose registers.
47
48