CoE EE 00142 Computer Organization Set 5 Fetch Execute - PowerPoint PPT Presentation

1 / 91
About This Presentation
Title:

CoE EE 00142 Computer Organization Set 5 Fetch Execute

Description:

Fetching Instructions. Figure 5.5. Note: next instruction is 4 bytes later ... Instruction fetched and PC incremented $t2 value read from register ... – PowerPoint PPT presentation

Number of Views:93
Avg rating:3.0/5.0
Slides: 92
Provided by: ronhoe
Category:

less

Transcript and Presenter's Notes

Title: CoE EE 00142 Computer Organization Set 5 Fetch Execute


1
CoE - EE 00142Computer OrganizationSet 5 -
Fetch Execute
  • Ron Hoelzeman

2
Basic Computer Organization
3
Computer Addressing Techniques
  • Computer memory - variety of forms
  • RAM, ROM, Cache, Disk, Tape, etc.
  • Focus on RAM - operating memory
  • Basic concepts
  • Address and Contents

4
Example Memory
5
Fetch Execute Cycle
  • Fetch - get the next instruction from memory
  • Decode - figure out what to do with it
  • Execute - do it
  • This is how all computers work

6
Memory Organization
  • Address space - how much
  • Determines address width
  • Byte (8 bits)
  • Word (typically 16 or 32 bits)
  • Symbols - MA or M(A) denotes contents of memory
    at address A
  • example ACC MA implies put the contents
    of memory at location A onto the accumulator

7
Typical Registers
  • ACC Accumulator
  • IR Instruction Register
  • PSR - Status Register
  • A, B, etc. data registers
  • PC - Program Counter
  • SP - Stack Pointer

8
Simplified Control Unit
9
Example Program
10
Example System
11
Example of Fetch Execute Cycle
12
Instruction Types
  • Three Address Instructions
  • ADD T1,A,B
  • Two Address Instructions
  • ADD T1,A
  • One Address Instructions
  • ADD B
  • Zero Address Instructions
  • SHR

13
Typical Instruction Formatfor Register Operations
Assumes 8 registers - R0 - R7
Figure 8-16 Page 388
14
Example Register Operations
Example let DR 111 R7 let SA
001 R1 let SB 010 R2 Then the operation is
R1 R2 --gt R7
Figure 8-16 Page 388
15
Example Register Operations
Example let DR 111 R7 let SA
001 R1 let OP 011 3 Then the operation is
R1 3 --gt R7
Figure 8-16 Page 388
16
Mips Functional Units
Figure 5.1
17
Typical Storage Resources
Figure 8-18 Page 390
18
Stored Program Concept
19
MIPS Memory Addresses
Figure 3.2 - 3.3
20
Endianess
  • Big Endian address of msb word address (xx00
    Big End of word)
  • IBM 360/370, Motorola 68k, MIPS, Sparc, HP PA
  • Little Endian address of lsb word
    address(xx00 Little End of word)
  • Intel 80x86, DEC Vax, DEC Alpha (Windows NT)

21
Components of the Instruction Cycle
Figure 5.4
22
Fetching Instructions
Figure 5.5
23
Register File and ALU
Figure 5.6
24
R-type Instructions Datapath
Figure 5.7
25
MIPS Fetch Sequence
Figure 5.36
26
Typical Memory Instruction Format
Example let mode direct let address
2356 Then the operation is add the contents of
location 2356 to the acc and put the result on
the acc
27
Typical Addressing Modes
  • Implied Mode
  • Immediate Mode
  • Register Mode
  • Direct Mode
  • Indirect Mode
  • Relative Mode
  • Indexed Mode

28
Example for Addressing Modes
Mano Figure 11-4
29
Addressing Modes
Direct
Mano Table 11-1
30
Direct Addressing Mode
ACC 800
31
Addressing Modes
Immediate
32
Immediate Addressing Mode
ACC 500
33
Addressing Modes
Indirect
34
Indirect Addressing Mode
ACC 300
35
Addressing Modes
Relative
36
Relative Addressing Mode
500 252 752
Note PC 252
ACC 600
37
Addressing Modes
Index
38
Indexed Addressing Mode
500 400 900
ACC 200
39
Addressing Modes
Register
40
Register Addressing Mode
ACC 400
41
Addressing Modes
Register Indirect
42
Register Indirect Addressing
ACC 700
Note Subset of Indexed
43
Addressing Modes
44
MIPS Addressing Formats
  • Immediate Mode
  • Register Mode
  • Indirect Mode
  • Indexed Mode
  • Relative Mode

Figure 3.17
45
Basic Symbols for Register Transfers
Graphics from Logic and Computer Design
Fundamentals, Mano Kime, Prentice Hall
46
Typical Data Instructions
Graphics from Logic and Computer Design
Fundamentals, Mano Kime, Prentice Hall
47
Typical Data Instructions
  • Load LD
  • load register from memory
  • Store ST
  • store register into memory
  • Move MOVE
  • move from one register to another

48
MIPS Data Loads and Stores
Figure 5.8
49
MIPS Datapath for Load-Store
Figure 5.9
50
MIPS Load Instruction
Consider load lw t1, offset (t2)
Figure 5.25
51
MIPS Datapath for Branch
Figure 5.10
52
MIPS Addressing Formats
Figure 3.17
53
MIPS Combined Datapath
Figure 5.11
54
MIPS Datapath with Fetch
Figure 5.12
55
MIPS Datapath with Muxs
Figure 5.17
56
MIPS Datapath with Control
Figure 5.19
57
MIPS Simple Control and Datapath
Figure 5.29
58
MIPS Multicycle Datapath
Shared memory Shared ALU
Figure 5.30
59
MIPS Complete Multicycle
Figure 5.33
60
Finite State Machine Controller
Figure 5.43
61
Microcode Controller
Figure 5.47
62
Additional Example Data Instructions
  • Exchange XCH
  • move from one register to another or to/from
    memory (similar to MOVE)
  • Push PUSH
  • put data onto stack
  • Pop POP
  • pull data from stack

63
Additional Data Instructions
  • Input IN
  • input data from outside into accumulator
  • Output OUT
  • output data from accumulator to outside world

64
Typical Arithmetic Instructions
Graphics from Logic and Computer Design
Fundamentals, Mano Kime, Prentice Hall
65
Typical Arithmetic Instructions
  • Increment INC
  • add 1 to register or accumulator
  • Decrement DEC
  • subtract one from register or accumulator
  • Add ADD
  • add the contents of a memory location to a
    register or the accumulator
  • Subtract SUB
  • similar to add

66
Typical Arithmetic Instructions
  • Multiply MUL
  • typically multiply contents of a register or
    memory location times the accumulator and leave
    the result on accumulator
  • Divide DIV
  • typically divide contents of the accumulator by a
    register or memory location and leave the result
    on accumulator

67
Typical Arithmetic Instructions
Graphics from Logic and Computer Design
Fundamentals, Mano Kime, Prentice Hall
68
Typical Logic Bit Manipulation Instructions
Graphics from Logic and Computer Design
Fundamentals, Mano Kime, Prentice Hall
69
Typical Shift Instructions
All associated with accumulator or register
Graphics from Logic and Computer Design
Fundamentals, Mano Kime, Prentice Hall
70
Typical Program Control Instructions
71
Typical Branch Instructions
72
Typical Branch Instructions
73
Typical Branch Instructions
74
Jump or Branch Type Instructions
  • May be conditional or not
  • May be Direct, Relative, etc.
  • Change Program Counter - PC
  • Example
  • JMP 805 causes PC lt-- 805

75
Simplified Instruction Word Format
Word has 16 bits (2 Bytes) 4 bits for Opcode
(1610 combinations) 12 bits for operand or
address (409610 combinations)
76
Example Instruction Word Format
Word has 16 bits (2 Bytes) 4 bits for Opcode 12
bits for operand or address
77
Example Program
78
ExampleAssembled Program
79
(No Transcript)
80
Stack Instructions
  • Stack is portion of regular memory
  • Stack pointer is register which points to that
    memory
  • PUSH - puts data onto the stack from register or
    memory
  • POP - removes data from the stack

81
Stack Instructions
POP
SP --gt 102
82
Stack Instructions
PUSH
SP --gt 100
Graphics from Logic and Computer Design
Fundamentals, Mano Kime, Prentice Hall
83
Subroutines or Call Return
  • Typically used for a specific program task
  • Typically called from several places in the
    program
  • Requires control to return to main program at
    point of departure

84
Subroutines Typically Use Stack
  • Call subroutine
  • SP lt-- SP - 1
  • MSP lt-- PC
  • PC lt-- Effective address
  • Return from subroutine
  • PC lt-- MSP
  • SP lt-- SP 1

85
Call Instruction
501
500 CALL 250 SP lt-- 100 M100 lt-- 501 PC lt--
250
250
86
Return Instruction
501
260 RETURN PC lt-- M100 SP lt-- SP 1
261
87
Subroutine Call Example
LABEL OPCODE OPERAND COMMENT EXAMPLE NAM progr
am name SIZE EQU 04 array size
param ORG C100 MAIN PSHB save
state LDAA SIZE array size PSHA push size
param LDX R array addr PSHX push addr
param JSR ASUM jump to arraysum PULX clear
stack address PULB clear stack
size PULB restore state ABA calc.
Z STAA Z store result ASUM TSX X
SP - 1 LDAB 4,X BMX4 size LDX 2,X XMX
2MX3 CLRA LOOP ADDA X AAMX INX ne
xt array element DECB loop counter BGT LOOP
RTS Z FCB 0 initialize answer R FCB 1,2,3,4
initialize array END
88
MIPS Stack Example
Figure 3.10
89
Interrupts
Graphics from Logic and Computer Design
Fundamentals, Mano Kime, Prentice Hall
90
6811 Stack Notes
  • Stack grows toward low memory
  • SP always points to next free byte past top of
    stack
  • User stack should be initialized to DF00
  • Requires stack discipline

91
End of Set 5
Write a Comment
User Comments (0)
About PowerShow.com