Lecture 7: Instruction Set Architecture

1 / 14

# Lecture 7: Instruction Set Architecture - PowerPoint PPT Presentation

Lecture 7: Instruction Set Architecture. Computer Engineering 585 Fall 2001. Control Flow Instructions. Cond. Branches, jumps, procedure call/return Branch instruction : while C do if C then for I=x to y do endwhile endif endfor eval C eval C I=x

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.

## PowerPoint Slideshow about 'Lecture 7: Instruction Set Architecture' - sancho

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

### Lecture 7: Instruction Set Architecture

Computer Engineering 585

Fall 2001

Control Flow Instructions
• Cond. Branches, jumps, procedure call/return
• Branch instruction:

while C do if C then for I=x to y do

endwhile endif endfor

eval C eval C I=x

Br ¬C, +N Br ¬C, +N Br I==y, +N

PC-relative Branches: PC+N

Branch Taken

inst1

branch0 R1

inst1

inst2

• 90% of the Loop branches taken.

inst2

inst N

branch0 R1

Backward-going branch

Forward-going branch

any loop -- for, while)

(if-then-else)

Frequency of Forward Branches

25% branches: backward

75% branches: forward

Frequency of taken branches: 53%

%Taken = (% Taken backward * % Backward) + (% Taken forward * % forward)

Relative Frequency of Control Inst

MIPS based measurements

Branch Offset Size

Branch offset: at least 8 bits

Say 16 bit offset is supported --- target 24 bits away!

Branch C, target

Not-Taken code

Branch ¬C, +2

Jump target

Not-Taken code

Gnd

Result

Condition Specification
• Condition Code: Instructions set C,N,Z,V.
• Condition Register: Two step process, one ALU inst. sets the condition register, and a branch checks it.
• Compare & branch: Condition is part of branch instruction. Often comparison against 0.

Register

Procedure calls/returns

P1 P2 P3

• Where is the return address saved? an implicit dedicated register, or a GP register or a memory location.
• For a register based machine, does P1 save the registers (caller-saving) or does P2 save them (callee-saving).
Operand types
• character: a byte; half-word: 2 bytes; word: 4 bytes; double-word: 8 bytes; single-precison FP: 4 bytes; double-precison FP: 8 bytes; character strings: one byte per char; packed decimal: one byte per two decimal digits.
• How does an instruction know the operand type?
• Add R1, R2, R3: Is R1 a byte or half-word or word?
• Either instruction encodes this information: AddH: Add half-words or data carries a tag with it.
Operand Specification

Opcode/#operands

Opcode

Addl3 R1, 1024(R2), (R3):

1 byte 1 byte 1+2 bytes 1 byte = 5 bytes

Compiler Structure

Front end

High Level

Optimizations

Global

Optimizations

Code generator