Lecture 04 ALU Design Part 1

Lecture 04 ALU Design Part 1 - CS M151B / EE M116C Computer...

Info iconThis preview shows pages 1–7. Sign up to view the full content.

View Full Document Right Arrow Icon
Reinman 4-1 CS M151B / EE M116C Computer Systems Architecture ALU Design Part 1 Some notes adopted from Morgan Kaufman Publishing
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Reinman 4-2 Arithmetic for Computers • Operations on integers – Addition and subtraction – Multiplication and division – Dealing with overflow • Floating-point real numbers – Representation and operations
Background image of page 2
Reinman 4-3 Integer Addition • Example: 7 + 6 • Overflow if result out of range – Adding +ve and –ve operands, no overflow – Adding two +ve operands • Overflow if result sign is 1 – Adding two –ve operands • Overflow if result sign is 0
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Reinman 4-4 Integer Subtraction • Add negation of second operand • Example: 7 – 6 = 7 + (–6) +7: 0000 0000 … 0000 0111 –6: 1111 1111 … 1111 1010 +1: 0000 0000 … 0000 0001 • Overflow if result out of range – Subtracting two +ve or two –ve operands, no overflow – Subtracting +ve from –ve operand • Overflow if result sign is 0 – Subtracting –ve from +ve operand • Overflow if result sign is 1
Background image of page 4
Reinman 4-5 Dealing with Overflow • Some languages (e.g., C) ignore overflow – Use MIPS addu , addui , subu instructions • Other languages (e.g., Ada, Fortran) require raising an exception – Use MIPS add , addi , sub instructions – On overflow, invoke exception handler • Save PC in exception program counter (EPC) register • Jump to predefined handler address •mfc0 (move from coprocessor reg) instruction can retrieve EPC value, to return after corrective action
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Reinman 4-6 Arithmetic Logic Unit Design
Background image of page 6
Image of page 7
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 24

Lecture 04 ALU Design Part 1 - CS M151B / EE M116C Computer...

This preview shows document pages 1 - 7. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online