Upload
others
View
9
Download
1
Embed Size (px)
Citation preview
University of Texas at Austin CS352H - Computer Systems Architecture Fall 2009 Don Fussell
CS352H: Computer Systems Architecture
Lecture 4: Instruction Set Architectures III + MIPSALU
September 10, 2008
University of Texas at Austin CS352H - Computer Systems Architecture Fall 2009 Don Fussell 2
ISA Example: IA-32
A 20-year old ISA! (30 years if you count earlier x86)Blend of RR & RM ISA
Two-operand instructionsSeven addressing modesMode to indicate whether 8086, 286 or IA-32 (>=386)
More than 630 instructions!Evolved to include multimedia, graphicsSupport operations on 8, 16 and 32-bit operands
Variable-length instructions1 – 15 bytes long (3 bytes on average)
University of Texas at Austin CS352H - Computer Systems Architecture Fall 2009 Don Fussell 3
IA-32 Registers
Originally 16-bit registers
As of 386 eight GP 32-bit regs
Segment registers encodeaddress prefix
Certain accesses particularsegment registers by default
Condition code register
University of Texas at Austin CS352H - Computer Systems Architecture Fall 2009 Don Fussell 4
IA Instruction Formats
University of Texas at Austin CS352H - Computer Systems Architecture Fall 2009 Don Fussell 5
Principles of ISA Design
KISS — Keep It Simple, Stupid (Cray)Complexity increases
Logic areaPipe stage durationDevelopment time
Evolution leads to kludges
OrthogonalitySimple rules, few exceptionsAll ops on all registers in all addressing modes
FrequencyMake the common case fast
Instructions are not born equal!
University of Texas at Austin CS352H - Computer Systems Architecture Fall 2009 Don Fussell 6
Principles of ISA Design (cont)
GeneralityNot all problems need the same capabilities
Toaster oven vs. supercomputer
Performance should be easy to predictPeter Denning: Don’t build it if you can’t model it
Permit efficient implementationToday10 years from now
University of Texas at Austin CS352H - Computer Systems Architecture Fall 2009 Don Fussell 7
CISC vs. RISC
Complex Instruction Set Computer(CISC)Typically includes:
Variable-length instructionsRM instructionsMany, complex addressingmodesComplex instructions
Examples:VAX, IBM 360/370, x86
AdvantagesCode densityLegacy SW
Reduced Instruction Set Computer(RISC)Typically includes:
GP registersFixed 3-address formatStrict load/store conformanceFew, simple addressing modesSimple instructions
Examples:DEC Alpha, MIPS
AdvantagesGood compiler targetEasy to implement/pipeline
In practice, other than a handful of ISAs, most contain elements of both.
University of Texas at Austin CS352H - Computer Systems Architecture Fall 2009 Don Fussell 8
MIPS ALU
Needs to supportadd, addi, suband, andi, or, ori, xor, xorisll, srl, sra, sllv, srlv, sravslt, sltiAll the unsigned versions
A
B
ALU
32
SE32
1632
OP
University of Texas at Austin CS352H - Computer Systems Architecture Fall 2009 Don Fussell 9
Bit Slice Approach
• For subtraction: set invert & CarryIn to 1 (2’s complement arithmetic)• How about SLT?
University of Texas at Austin CS352H - Computer Systems Architecture Fall 2009 Don Fussell 10
LSB and MSB Need to Do Extra
University of Texas at Austin CS352H - Computer Systems Architecture Fall 2009 Don Fussell 11
Overflow DetectionOverflow occurs when the result is too large to represent in the
number of bits allocatedadding two positives yields a negativeor, adding two negatives gives a positiveor, subtract a negative from a positive gives a negativeor, subtract a positive from a negative gives a positive
On your own: Prove you can detect overflow by:Carry into MSB xor Carry out of MSB
1
1
1 10
1
0
1
1
0
0 1 1 1
0 0 1 1+
7
3
0
1
– 6
1 1 0 0
1 0 1 1+
–4
– 5
71
0
University of Texas at Austin CS352H - Computer Systems Architecture Fall 2009 Don Fussell 12
Overflow Detection Logic
For an N-bit ALU: Overflow = CarryIn[N-1] XOR CarryOut[N-1]
University of Texas at Austin CS352H - Computer Systems Architecture Fall 2009 Don Fussell 13
LSB and MSB Need to Do Extra
University of Texas at Austin CS352H - Computer Systems Architecture Fall 2009 Don Fussell 14
What About Performance?
Critical path of N-bit ripple-carry adder is N * Tadd
Throw hardware at it! (Next lecture)
University of Texas at Austin CS352H - Computer Systems Architecture Fall 2009 Don Fussell 15
Next Lecture
Finish MIPS ALUSee Appendix C (on CD)
In particular, Sections C-5 & C-6 for fast addersSee Chapter 3.3 & 3.4 for Multiplication & DivisionSee Chapter 3.5 for Floating point ops