复旦大学:《计算机原理 Computer System》课程PPT课件_Integer Operations; Floating Points

Integer Operations
1 Integer Operations

Outline Arithmetic operations overflow Unsigned addition, multiplication Signed addition, negation, multiplication Using Shift to perform power-of-2 multiply/divide Suggested read 1g Chap 2.3 Negation:取反
2 Outline • Arithmetic Operations – overflow – Unsigned addition, multiplication – Signed addition, negation, multiplication – Using Shift to perform power-of-2 multiply/divide • Suggested reading – Chap 2.3 Negation:取反

Unsigned Addition Operands: w bits 上: True Sum w+1 bits uty Discard Carry: w bits UAdd,(u, v)
3 Unsigned Addition • • • • • • u + v • • • u + v • • • True Sum: w+1 bits Operands: w bits Discard Carry: w bits UAddw(u , v)

Unsigned Addition Standard Addition Function Ignores carry output Implements Modular Arithmetic S= UAddwu, v=u+v mod 2W L+1 L1+p2 P67(2.9)
4 Unsigned Addition • Standard Addition Function – Ignores carry output • Implements Modular Arithmetic – s = UAddw(u , v) = (u + v) mod 2w UAddw(u,v) = u + v u + v 2 w u + v − 2 w u + v 2 w P67 (2.9)

Visualizing Unsigned Addition P68 Figure 2.16 Overflow Wraps around If true sum≥2Ww Addu, v) At most once True Sum 2 W+1 Overflow 64208 0 Modular sum Module:取模
5 Visualizing Unsigned Addition P68 Figure 2.16 • Wraps Around – If true sum ≥ 2w – At most once 0 2 4 6 8 10 12 14 0 2 4 6 8 10 12 14 0 2 4 6 8 10 12 14 16 UAdd4 (u , v) u v Overflow 0 2 w 2 w+1 True Sum Modular Sum Overflow Module: 取模

Unsigned Addition Forms an Abelian Group P68 Closed under addition 0≤ UAdduu,v)≤2w-1 Commutative(交换律) Add(,)=∪Add(v,u) Associative(结合律) UAddw(t, UAddw(u, v)=UAddwqUAddw(t,u,v
6 Unsigned Addition Forms an Abelian Group P68 • Closed under addition – 0 UAddw(u , v) 2 w –1 • Commutative (交换律) – UAddw(u , v) = UAddw(v , u) • Associative (结合律) – UAddw (t, UAddw (u,v)) = UAddw (UAddw (t, u ), v)

Unsigned Addition Forms an Abelian Group o is additive identity UAddw u,o) Every element has additive inverse Let UCompw(u)=2w-u P68(2.10) UAddw(u, UCompw(u))=0
7 Unsigned Addition Forms an Abelian Group • 0 is additive identity – UAddw (u , 0) = u • Every element has additive inverse – Let UCompw (u ) = 2 w – u – UAddw(u , UCompw (u )) = 0 P68 (2.10)

Signed Addition Functionality True sum requires w+l bits Drop off msB Treat remaining bits as 2s comp. integer u+v-2", TMax <u+v(PosOver) Tadd (u, v) 1+V,TMin,≤l+v≤Mamx P70(2.12) u+v+2, u+v<TMin(NegOver PosOver: Positive Overflow NegOver: Negative Overflow
8 Signed Addition • Functionality – True sum requires w+1 bits – Drop off MSB – Treat remaining bits as 2’s comp. integer + + + + + + − + = 2 , ( ) , 2 , ( ) ( , ) u v u v TMin NegOver u v TMin u v TMax u v TMax u v PosOver Tadd u v w w w w w w PosOver:Positive Overflow NegOver:Negative Overflow P70 (2.12)

Signed Addition P70 Figure 2.17 True sum PosOver TAdd(u, v) 0111.1 PosOver TAdd Result 0100..0 2W-1 011.1 <0 0000.00 000..0 NegOver 11000-2-1 100..0 1000..0-2W NegOvel
9 Signed Addition P70 Figure 2.17 u v 0 0 NegOver PosOver TAdd(u , v) –2 w –1 –2 w 0 2 w –1 2 w–1 True Sum TAdd Result 1 000…0 1 100…0 0 000…0 0 100…0 0 111…1 100…0 000…0 011…1 PosOver NegOver

Visualizing 2s Comp. Addition Values 4-bit twos comp. Range from -8 to +7 Wraps Around If sum≥2W-1 Becomes negative If sum <-2W1 Becomes positive
10 Visualizing 2’s Comp. Addition • Values – 4-bit two’s comp. – Range from -8 to +7 • Wraps Around – If sum 2 w-1 • Becomes negative – If sum < –2 w–1 • Becomes positive
按次数下载不扣除下载券;
注册用户24小时内重复下载只扣除一次;
顺序:VIP每日次数-->可用次数-->下载券;
- 复旦大学:《计算机原理 Computer System》课程PPT课件_Integer Representations.ppt
- 复旦大学:《计算机原理 Computer System》课程PPT课件_Introduction to Computer Systems; Information is Bits+Context; Information Storage.ppt
- 复旦大学:《计算机原理 Computer System》课程资源_2006年期中考试题目.doc
- 复旦大学:《计算机原理 Computer System》课程资源_2006年期中考试答案.doc
- 复旦大学:《计算机原理 Computer System》课程资源_教学大纲.pdf
- 复旦大学:《计算机图形学》课后习题答案_7.docx
- 复旦大学:《计算机图形学》课后习题答案_6.docx
- 复旦大学:《计算机图形学》课后习题答案_5.docx
- 复旦大学:《计算机图形学》课后习题答案_4.docx
- 复旦大学:《计算机图形学》课后习题答案_3.docx
- 复旦大学:《计算机图形学》课后习题答案_2.docx
- 复旦大学:《计算机图形学》课后习题答案_1.docx
- 复旦大学:《电子商务》课程PPT课件_第十次课 社会化电子商务——Hold住社会化媒体营销.ppt
- 复旦大学:《电子商务》课程PPT课件_第六次课 电子商务运营与管理 Operating Your E-Business.ppt
- 复旦大学:《电子商务》课程PPT课件_第六次课 电子商务运营与管理 Getting Your E-Business Off The Ground.ppt
- 复旦大学:《电子商务》课程PPT课件_第八次课 电子商务模式与应用课程主题案例分析与展示——电子商务团购.ppt
- 复旦大学:《电子商务》课程PPT课件_第五次课 商业模式的概念与内涵(发现商业模式).ppt
- 复旦大学:《电子商务》课程PPT课件_第九次课 B2B电子商务(B2B行业平台).ppt
- 复旦大学:《电子商务》课程PPT课件_第七次课 B2C电子商务——网上零售.pptx
- 复旦大学:《电子商务》课程PPT课件_第四次课 电子商务商业计划书写作 Creating a Winning E-Business Second Edition.ppt
- 复旦大学:《计算机原理 Computer System》课程PPT课件_Machine-Level Representation of Programs I.ppt
- 复旦大学:《计算机原理 Computer System》课程PPT课件_Machine-Level Representation of Programs Ⅱ.ppt
- 复旦大学:《计算机原理 Computer System》课程PPT课件_Procedure Call and Array.ppt
- 复旦大学:《计算机原理 Computer System》课程PPT课件_Heterogeneous Data Structures & Alignment; Putting it Together; Floating Point.ppt
- 复旦大学:《计算机原理 Computer System》课程PPT课件_Processor Architecture.ppt
- 复旦大学:《计算机原理 Computer System》课程PPT课件_09、10 Sequential CPU Implementation.ppt
- 复旦大学:《计算机原理 Computer System》课程PPT课件_Pipelined Implementation Part I.ppt
- 复旦大学:《计算机原理 Computer System》课程PPT课件_Pipelined Implementation Part II.ppt
- 复旦大学:《计算机原理 Computer System》课程PPT课件_12b Code Optimization(• Machine-Independent Optimization – Code motion – Memory optimization • Suggested reading).ppt
- 复旦大学:《计算机原理 Computer System》课程PPT课件_13 Code Optimization(• Optimizing Blockers • Understanding Modern Processor • More Code Optimization techniques • Performance Tuning).ppt
- 复旦大学:《计算机原理 Computer System》课程PPT课件_Hardware Organization.ppt
- 复旦大学:《计算机原理 Computer System》课程PPT课件_Memory Hierarchy(• Random-Access Memory(RAM)• Nonvolatile Memory • Disk Storage • Locality • Memory hierarchy).ppt
- 复旦大学:《计算机原理 Computer System》课程PPT课件_Cache Memory(• General concepts • 3 ways to organize cache memory • Issues with writes • Write cache friendly codes • Cache mountain).ppt
- 复旦大学:《计算机原理 Computer System》课程PPT课件_Cache Memory(• Cache mountain • Matrix multiplication).ppt
- 复旦大学:《计算机原理 Computer System》课程PPT课件_Virtual Memory(• Virtual Space• Address translation • Accelerating translation• Different points of view).ppt
- 复旦大学:《计算机原理 Computer System》课程PPT课件_Virtual Memory(• Multilevel page tables • Different points of view • Pentium/Linux Memory System • Memory Mapping).ppt
- 复旦大学:《计算机原理 Computer System》课程PPT课件_Dynamic Memory Allocation(• Implementation of a simple allocator • Explicit Free List • Segregated Free List).ppt
- 复旦大学:《计算机原理 Computer System》课程PPT课件_Linking II(• Static linking • Symbols & Symbol Table • Relocation • Executable Object Files • Loading).ppt
- 复旦大学:《计算机原理 Computer System》习题PPT课件_chapter2.pptx
- 复旦大学:《计算机原理 Computer System》习题PPT课件_Chapter 3 Machine-Level Representation of Programs.pptx