Title: Lecture 3: ISAI: Basic Arithmetic Operations
1Lecture 3 ISA-I Basic Arithmetic Operations
- Last Time
- Computer elements
- Circuits and timing
- Today
- Quick discussion of clock rate and CPI
- Basic instruction sets, arithmetic operations
2Cycles Per Instruction (CPI)
- Depends on the instruction
- Average cycles per instruction
- Example
3Comparing and Summarizing Performance
- Fair way to summarize performance?
- Capture in a single number?
- Example Which of the following machines is best?
4LC-2 Instruction Set
5LC-2 ISA Continued
- Memory
- 16-bit addresses, 16-bit addressability
- Addressing modes
- immediate, pageoffset, baseoffset, indirect
- 8 registers
- R7 updated on JSR, JSRR
- State
- PC, registers, memory, condition code registers
- 16-bit instructions
- Simple instruction set
6Instruction Set Architecture
- Contract between programmer and the hardware
- Defines visible state of the system
- Defines how state changes in response to
instructions - Programmer ISA is model of how a program will
execute - Hardware Designer ISA is formal definition of
the correct way to execute a program - ISA specification
- The binary encodings of the instruction set
7ISA Basics
instruction
Instruction formats Instruction types Addressing
modes
Op
Mode
Ra
Rb
Data types Operations Interrupts/Events
Machine state Memory organization Register
organization
8Architecture vs. Implementation
- Architecture defines what a computer system does
in response to a program and a set of data - Programmer visible elements of computer system
- Implementation defines how a computer does it
- Sequence of steps to complete operations
- Time to execute each operation
- Hidden bookkeeping functions
9Examples
- Architecture or Implementation?
- Number of GP registers
- Width of memory bus
- Binary representation of the instructionsub
r4,r2,27 - Number of cycles to execute FP instruction
- Which condition code bits are set on a move
instruction - Size of the instruction cache
- Type of FP format
10Machine State
- Registers
- Size/Type
- Program Counter ( IP)
- accumulators
- index registers
- general registers
- control registers
- Memory
- Visible hierarchy (if any)
- Addressibility
- byte, word, bit
- byte order (endian-ness)
- maximum size
- protection/relocation
11Components of Instructions
- Operations (opcodes)
- Number of operands
- Operand specifiers
- Instruction encodings
- Instruction classes
- ALU ops (add, sub, shift)
- Branch (beq, bne, etc.)
- Memory (ld/st)
add r1,r2,r3
12Operand Number
- No Operands HALT NOP
- 1 operand NOT R4 R4 ? R4 JMP _L1
- 2 operands ADD R1, R2 R1 ? R1 R2 LDI R3,
1234 - 3 operands ADD R1, R2, R3 R1 ? R2 R3
- gt 3 operands MADD R4,R1,R2,R3 R4 ?R1(R2R3)
13Effect of Operand Number
E (CD)(C-D)
Assign
C ? r1 D ? r2 E ? r3
3 operand machine
2 operand machine
mov r3,r1 add r3,r2 sub r2,r1 mult r3,r2
add r3,r1,r2 sub r4,r1,r2 mult r3,r4,r3
14Summary
- ISA definition
- system state (general/special registers, memory)
- the effect of each operation on the system state
- Next Time
- Addressing modes
- Data types
- Common instruction types
- Case studies MIPS others
- Due next class
- Reading assignment PH 2.5-2.9
- HW1
- HW2 assigned