chapter 10 instruction set architecture. 10-1 computer architecture concepts machine language:...

32
Chapter 10 Instruction Set Architecture

Upload: dominick-sutton

Post on 30-Dec-2015

238 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: Chapter 10 Instruction Set Architecture. 10-1 Computer architecture concepts Machine language: binary language Assembly language: symbolic language In

Chapter 10

Instruction Set Architecture

Page 2: Chapter 10 Instruction Set Architecture. 10-1 Computer architecture concepts Machine language: binary language Assembly language: symbolic language In

10-1 Computer architecture concepts Machine language: binary language Assembly language: symbolic language In the past, architecture, organization and

hardware are used to descript a computer. Due to the higher and higher performance of

computer, the relationships among architecture, organization and hardware become interwined.

Instruction set architecture (ISA) is then used to encompass the whole of computer.

Page 3: Chapter 10 Instruction Set Architecture. 10-1 Computer architecture concepts Machine language: binary language Assembly language: symbolic language In

10-1 Computer architecture concepts The format of an instruction is divided into groups called fields as follows. opcode field address field mode field

The steps for executing an instruction:1. Fetch the instruction

2. Decode the instruction

3. Locate the operand

4. Fetch the operand (if necessary)

5. Execute the operation in processor registers

6. Store the results

7. Go back to step 1

Page 4: Chapter 10 Instruction Set Architecture. 10-1 Computer architecture concepts Machine language: binary language Assembly language: symbolic language In

10-1 Computer architecture concepts Program counter (PC) keeps track of the

instructions in the program stored in memory.

Register set

Register files in chap. 9 + processor status register (PSR)+ stack pointer (SPP

Page 5: Chapter 10 Instruction Set Architecture. 10-1 Computer architecture concepts Machine language: binary language Assembly language: symbolic language In

10-2 Operand addressing Three-address instructions (pages 518-519)

Use mainly memory Use mainly register

Two-address instructions (page 519) One-address instructions (pages 519-520)

A register called accumulator (ACC) is necessary.

Zero-address instructions (pages 530-521) Use a stack Last-in, first-out (LIFO) Use push and pop instruction TOS: top of stack

Page 6: Chapter 10 Instruction Set Architecture. 10-1 Computer architecture concepts Machine language: binary language Assembly language: symbolic language In

Addressing Architecture

Memory-to-memory PC is the only register 21 accesses to memory needed in the previous

example (includes accesses of address, data, instruction)

instruction count is low, but the execution time is potentially high

Page 7: Chapter 10 Instruction Set Architecture. 10-1 Computer architecture concepts Machine language: binary language Assembly language: symbolic language In

Addressing Architecture

Register-to-register allow only one memory address restrict its use to load and store type needs sizable register file see the program on the top of page 522 in textbook only 18 memory accesses are needed

Page 8: Chapter 10 Instruction Set Architecture. 10-1 Computer architecture concepts Machine language: binary language Assembly language: symbolic language In

Addressing Architecture Register-memory type

ADD R1, A R1← R1+M[A] program lengths and number of memory

accesses tend to be intermediate between the previous two architectures

Single-accumulator architecture no register file significant additional memory accesses would be

needed for complex programs inefficient, is restricted to use in CPUs for simple,

low-cost applications

Page 9: Chapter 10 Instruction Set Architecture. 10-1 Computer architecture concepts Machine language: binary language Assembly language: symbolic language In

Fig. 10-1

Stack architecture high frequency of memory accesses has made it

unattractive is useful for rapid interpretation of high-level

language programs

Infix expression

(A+B) ×C+(D×E)

Postfix expression

AB+C×DE×+

Page 10: Chapter 10 Instruction Set Architecture. 10-1 Computer architecture concepts Machine language: binary language Assembly language: symbolic language In

Fig. 10-2PUSH APUSH BADDPUSH CMUL

PUSH DPUSH EMULADD

Page 11: Chapter 10 Instruction Set Architecture. 10-1 Computer architecture concepts Machine language: binary language Assembly language: symbolic language In

10-3 Addressing ModeAddressing mode: The rule for interpreting or modifying the address field of an instruction.

Effective address: The address of operand produced by the application of the rule for interpreting or modifying the address field of the instruction before the operand is actually referenced.

Page 12: Chapter 10 Instruction Set Architecture. 10-1 Computer architecture concepts Machine language: binary language Assembly language: symbolic language In

Addressing Mode

To give programming flexibility to user To reduce the number of bits in the address

fields of the instruction

Fig. 10-3

Page 13: Chapter 10 Instruction Set Architecture. 10-1 Computer architecture concepts Machine language: binary language Assembly language: symbolic language In

Addressing Mode

Implied mode: needs no address field, the operand is specified implicitly in the definition of the opcode. For example, ADD in a stack computer.

Immediate mode: an instruction has an operand field rather than an address field (the immediate format in Fig. 9-14). For example, ADI in Table 9-8 or the instruction in address 45 in Table 9-9.

Page 14: Chapter 10 Instruction Set Architecture. 10-1 Computer architecture concepts Machine language: binary language Assembly language: symbolic language In

Addressing Mode Register and register-indirect mode:

Register mode: the address field specifies a processor register (the register format in Fig. 9-14)

Register-indirect mode: the instruction specifies a register in the processor whose content gives the address of the operand in the memory. the address field uses fewer bits to select a register than

would have been required to specify a memory address directly

For example, the auto-increment mode ADD (R1)+, 3 M[R1]←M[R1]+3, R1 ←R1+1

Page 15: Chapter 10 Instruction Set Architecture. 10-1 Computer architecture concepts Machine language: binary language Assembly language: symbolic language In

Addressing Mode Direct addressing mode: the address field

of the instruction gives the address of the operand in memory.

Fig. 10-4

ACC←M[ADRS]

Page 16: Chapter 10 Instruction Set Architecture. 10-1 Computer architecture concepts Machine language: binary language Assembly language: symbolic language In

Fig. 10-5 direct addressing in a branch instruction

Page 17: Chapter 10 Instruction Set Architecture. 10-1 Computer architecture concepts Machine language: binary language Assembly language: symbolic language In

Addressing Mode Indirect addressing mode: the address field

of the instruction gives the address at which the effective address is stored in memory. For example, in Fig. 10-4, the effective address is 800 (the operand is the one found in memory at address 800)

Relative addressing mode: Effective address= address part of the instruction + contents of PC (signed number) (the jump format in Fig. 9-14). For example, in Fig. 10-4, the effective address= 500 + 252 (next address in PC)

Page 18: Chapter 10 Instruction Set Architecture. 10-1 Computer architecture concepts Machine language: binary language Assembly language: symbolic language In

Addressing Mode

Indexed addressing mode: the content of an indexed register is added to the address part of the instruction to obtain the effective address. The indexed register may be a special register in

CPU or simply a register in register file. In the application of array, the distance between

the beginning address and the address of the operand is the index value stored in the register.

Page 19: Chapter 10 Instruction Set Architecture. 10-1 Computer architecture concepts Machine language: binary language Assembly language: symbolic language In

Fig. 10-6 Numerical example

Page 20: Chapter 10 Instruction Set Architecture. 10-1 Computer architecture concepts Machine language: binary language Assembly language: symbolic language In

Table 10-1 Symbolic convention for addressing mode

Page 21: Chapter 10 Instruction Set Architecture. 10-1 Computer architecture concepts Machine language: binary language Assembly language: symbolic language In

10-4 Instruction Set Architectures Reduced Instruction Set Computers (RISCs)

Simple instruction Flexibility Higher throughput Faster execution

Complex Instruction Set Computers (CISCs) Hardware support for high-level language Compact program

Page 22: Chapter 10 Instruction Set Architecture. 10-1 Computer architecture concepts Machine language: binary language Assembly language: symbolic language In

Properties of RISC and CISC

RISC Store/load are the only memory accesses Data manipulation instructions are register-to-

register Simple addressing mode Instruction formats are all the same length Instructions perform elementary operations One instruction per cycle (simple instruction)

Page 23: Chapter 10 Instruction Set Architecture. 10-1 Computer architecture concepts Machine language: binary language Assembly language: symbolic language In

Properties of RISC and CISC

CISC Memory access is available to most types of

instruction Many addressing mode (substantial in number) Instruction formats are of different lengths Instructions perform both elementary and complex

operations (microinstructions are then necessary0 Multiple cycle for executing one instruction

(complex instruction)

Page 24: Chapter 10 Instruction Set Architecture. 10-1 Computer architecture concepts Machine language: binary language Assembly language: symbolic language In

RISC and CISC Actual instruction set architecture range between

those which are purely RISC and those are purely CISC.

There is a basic set of elementary operations that most computers include among their instruction.

This chapter will focus on the elementary instructions that are included in both RISC and CISC Data transfer instructions Data manipulation instruction Program-control instructions

Page 25: Chapter 10 Instruction Set Architecture. 10-1 Computer architecture concepts Machine language: binary language Assembly language: symbolic language In

10-5 Data-transfer instructions

Page 26: Chapter 10 Instruction Set Architecture. 10-1 Computer architecture concepts Machine language: binary language Assembly language: symbolic language In

Stack instructions (push/pop)

Reside in memory Due to the negative effects on performance,

a stack typically handles only state information related to procedure calls/returns/interrupts.

A register holds the address for the stack is called stack pointer (SP).

Page 27: Chapter 10 Instruction Set Architecture. 10-1 Computer architecture concepts Machine language: binary language Assembly language: symbolic language In

Fig. 10-7 Memory stack

A new item is placed on the stack by the push operation:

SP ←SP-1

M[SP] ←R1

Page 28: Chapter 10 Instruction Set Architecture. 10-1 Computer architecture concepts Machine language: binary language Assembly language: symbolic language In

I/O Instruction

Independent I/O: The address ranges assigned to memory and I/O port are independent from each other.

Memory map I/O: assigns a sub-range of the memory addresses for addressing I/O port. Didn’t need distinct input or output instructions.

Page 29: Chapter 10 Instruction Set Architecture. 10-1 Computer architecture concepts Machine language: binary language Assembly language: symbolic language In

10-6 Data-manipulation instructions1. Arithmetic instructions

2. Logical and bit-manipulation instructions

3. Shift instruction

Page 30: Chapter 10 Instruction Set Architecture. 10-1 Computer architecture concepts Machine language: binary language Assembly language: symbolic language In

Arithmetic instructions

Page 31: Chapter 10 Instruction Set Architecture. 10-1 Computer architecture concepts Machine language: binary language Assembly language: symbolic language In

Logical and bit-manipulation instructions

Page 32: Chapter 10 Instruction Set Architecture. 10-1 Computer architecture concepts Machine language: binary language Assembly language: symbolic language In

Shift instruction