C Puzzles The course that gives CMU its Zip! Integer Arithmetic Operations Jan. 25, Unsigned Addition. Visualizing Integer Addition
|
|
- Marcus Foster
- 5 years ago
- Views:
Transcription
1 1513 The corse that gies CMU its Zip! Integer Arithmetic Operations Jan. 5, 1 Topics Basic operations Addition, negation, mltiplication Programming Implications Conseqences of oerflow Using shifts to perform powerof mltiply/diide C Pzzles Taen from Exam #, CS 37, Spring 97 Assme machine with 3 bit word size, two s complement integers For each of the following C expressions, either: Arge that is tre for all argment ales Gie example where not tre Initialization int x = foo(); int y = bar(); nsigned x = x; nsigned y = y; x < ((x*) < ) x >= x & 7 == 7 (x<<3) < x > 1 x > y x < y x * x >= x > && y > x y > x >= x <= x <= x >= Operands: w bits Tre Sm: w1 bits Unsigned Addition Standard Addition Fnction Ignores carry otpt Implements Modlar Arithmetic s = (, ) = mod w Discard Carry: w bits (, ) (,) = w < w w Visalizing Integer Addition Integer Addition bit integers and Compte tre sm Add (, ) Vales increase linearly with and Forms planar srface Add (, ) Page 1
2 Visalizing Unsigned Addition Wraps Arond If tre sm At most once Tre Sm w1 Oerflow w Modlar Sm w Oerflow UAdd (, ) Mathematical Properties Modlar Addition Forms an Abelian Grop Closed nder addition (, ) w 1 Commtatie (, ) = (, ) Associatie (t, (, )) = ( (t, ), ) is additie identity (, ) = Eery element has additie inerse Let UComp w ( ) = w (, UComp w ( )) = 5 Detecting Unsigned Oerflow Tas Gien s = (, ) Determine if s = Application nsigned s,, ; s = ; Did addition oerflow? Claim Oerflow iff s < of = (s < ) Or symmetrically iff s < Proof Know that < w No Oerflow No oerflow s = = Oerflow s = w < = s w Oerflow w s Operands: w bits Two s Complement Addition Tre Sm: w1 bits TAdd and UAdd hae Identical BitLeel Behaior Signed s. nsigned addition in C: int s, t,, ; s = (int) ((nsigned) (nsigned) ); t = Will gie s == t Discard Carry: w bits TAdd w (, ) 7 Page
3 Fnctionality Tre sm reqires w1 bits Drop off MSB Treat remaining bits as s comp. integer TAdd(, ) > < NegOer < > Characterizing TAdd PosOer TAdd w (,) = w 1 w w 1 1 w w 1 w 1 Tre Sm PosOer NegOer TAdd Reslt < TMin (NegOer) w TMin w TMax w TMax w < (PosOer) Vales Visalizing s Comp. Addition bit two s comp. Range from to 7 Wraps Arond If sm w 1 Becomes negatie At most once If sm < w 1 Becomes positie At most once NegOer TAdd (, ) PosOer 9 1 Detecting s Comp. Oerflow Tas Gien s = TAdd w (, ) Determine if s = Add w (, ) Example int s,, ; s = ; Claim Oerflow iff either: w 1 w 1, <, s (NegOer),, s < (PosOer) of = (< == <) && (<!= s<); Proof PosOer NegOer Mathematical Properties of TAdd Isomorphic Algebra to UAdd TAdd w (, ) = UT( (TU( ), TU())) Since both hae identical bit patterns Two s Complement Under TAdd Forms a Grop Closed, Commtatie, Associatie, is additie identity Eery element has additie inerse Let TComp w ( ) = UT(UComp w (TU( )) TAdd w (, TComp w ( )) = TComp w () = TMin w TMin w = TMin w Easy to see that if and <, then TMin w TMax w Symmetrically if < and Other cases from analysis of TAdd 11 1 Page 3
4 Two s Complement Negation Mostly lie Integer Negation TComp() = TMin is Special Case TComp(TMin) = TMin Negation in C is Actally TComp mx = x mx = TComp(x) Comptes additie inerse for TAdd x x == Tcomp( ) w w 1 w w 1 Negating with Complement & Increment In C ~x 1 == x Complement Obseration: ~x x == == 1 x ~x Increment ~x x (x 1) == 1 (x 1) ~x 1 == x Warning: Be catios treating int s as integers OK here: We are sing grop properties of TAdd and TComp 1 x = 1513 Comp. & Incr. Examples Decimal Hex Binary x B D ~x 151 C ~x C y 1513 C TMin Decimal Hex Binary TMin 37 1 ~TMin 377 7F FF ~TMin Decimal Hex Binary ~ 1 FF FF ~1 Comparing Two s Complement Nmbers Tas Gien signed nmbers, Determine whether or not > Retrn 1 for nmbers in shaded region below Bad Approach Test ( ) > > < < < > TSb(,) = TAdd(, TComp()) == > Problem: Thrown off by either Negatie or Positie Oerflow 15 1 Page
5 Will Get Wrong Reslts NegOer: <, > Comparing with TSb bt > PosOer: >, < bt < NegOer > < < > PosOer NegOer 17 TSb (, ) PosOer Woring Arond Oerflow Problems Partition into Three Regions <, < < < <, same sign does not oerflow Can safely se test ( ) > < < < < 1, < > < < < < < Mltiplication Compting Exact Prodct of wbit nmbers x, y Either signed or nsigned Ranges Unsigned: x * y Up to w bits Two s complement min: x * y Up to w 1 bits Two s complement max: x * y Up to w bits, bt only for TMin w Maintaining Exact Reslts w 1) = w w1 1 w 1 )*( w 1 1) = w w 1 w 1 ) = w Wold need to eep expanding word size with each prodct compted Done in software by arbitrary precision arithmetic pacages Also implemented in Lisp, ML, and other adanced langages Operands: w bits Tre Prodct: *w bits Unsigned Mltiplication in C Discard w bits: w bits UMlt w (, ) Standard Mltiplication Fnction Ignores high order w bits Implements Modlar Arithmetic UMlt w (, ) = mod w * 19 Page 5
6 Unsigned s. Signed Mltiplication Unsigned Mltiplication nsigned x = (nsigned) x; nsigned y = (nsigned) y; nsigned p = x * y Trncates prodct to wbit nmber p = UMlt w (x, y) Simply modlar arithmetic p = x y mod w Two s Complement Mltiplication int x, y; int p = x * y; Compte exact prodct of two wbit nmbers x, y Trncate reslt towbit nmber p = TMlt w (x, y) Relation Signed mltiplication gies same bitleel reslt as nsigned p == (nsigned) p 1 x = 1513: txx = : xx = 7753: xx = 13: Mltiplication Examples short int x = 1513; int txx = ((int) x) * x; int xx = (int) (x * x); int xx = (int) ( * x * x); Obserations Casting order important If either operand int, will perform int mltiplication If both operands short int, will perform short int mltiplication Really is modlar arithmetic Comptes for xx: 1513 mod 553 = 7753 Comptes for xx: (int) 555U = 13 Note that xx == (xx << 1) Powerof Mltiply with Shift Operation << gies * Both signed and nsigned Operands: w bits Tre Prodct: w bits Discard bits: w bits UMlt w (, ) Examples << 3 == * << 5 << 3 == * 1 Most machines shift and add mch faster than mltiply Compiler will generate this code atomatically 3 * TMlt w (, ) Unsigned Powerof Diide with Shift Qotient of Unsigned by Power of >> gies / Uses logical shift Operands: Diision: Qotient: / / / 1. Binary Point Diision Compted Hex Binary x B D x >> D B x >> B x >> B Page
7 s Comp Powerof Diide with Shift Qotient of Signed by Power of >> gies / Uses arithmetic shift Ronds wrong direction when < Operands: Diision: Reslt: / / RondDown( / ) 1. Binary Point Diision Compted Hex Binary y C y >> E y >> FC y >> FF C Correct Powerof Diide Qotient of Negatie Nmber by Power of Want / (Rond Toward ) Compte as ( 1)/ In C: ( (1<<)1) >> Biases diidend toward Case 1: No ronding Diidend: Diisor: / / Biasing has no effect Binary Point Correct Powerof Diide (Cont.) Case : Ronding Diidend: Correct Powerof Diide Examples Diisor: / / 1 Incremented by 1 Binary Point Incremented by 1 y/ Compted Hex Binary y C y1 151 C (y1)>> E A y C y C A (y15)>> FC A y C y C (y55)>> FF C Biasing adds 1 to final reslt 7 Page 7
8 Properties of Unsigned Arithmetic Unsigned Mltiplication with Addition Forms Commtatie Ring Addition is commtatie grop Closed nder mltiplication UMlt w (, ) w 1 Mltiplication Commtatie UMlt w (, ) = UMlt w (, ) Mltiplication is Associatie UMlt w (t, UMlt w (, )) = UMlt w (UMlt w (t, ), ) 1 is mltiplicatie identity UMlt w (, 1) = Mltiplication distribtes oer addtion UMlt w (t, (, )) = (UMlt w (t, ), UMlt w (t, )) Properties of Two s Comp. Arithmetic Isomorphic Algebras Unsigned mltiplication and addition Trncating to w bits Two s complement mltiplication and addition Trncating to w bits Both Form Rings Isomorphic to ring of integers mod w Comparison to Integer Arithmetic Both are rings Integers obey ordering properties, e.g., > > >, > > These properties are not obeyed by two s complement arithmetic TMax 1 == TMin 1513 * 3 == 13 (1bit words) 9 3 C Pzzle Answers Assme machine with 3 bit word size, two s complement integers TMin maes a good conterexample in many cases x < ((x*) < ) False: TMin x >= Tre: = UMin x & 7 == 7 (x<<3) < Tre: x 1 = 1 x > 1 False: x > y x < y False: 1, TMin x * x >= False: 5535 (x*x = 13171) x > && y > x y > False: TMax, TMax x >= x <= Tre: TMax < x <= x >= False: TMin 31 Page
C Puzzles! Taken from old exams. Integers Sep 3, Encoding Integers Unsigned. Encoding Example (Cont.) The course that gives CMU its Zip!
15-13 The corse that gies CMU its Zip! Topics class3.ppt Integers Sep 3,! Nmeric Encodings " Unsigned & Two s complement! Programming Implications " C promotion rles! Basic operations " Addition, negation,
More informationPage # CISC360. Integers Sep 11, Encoding Integers Unsigned. Encoding Example (Cont.) Topics. Twoʼs Complement. Sign Bit
Topics CISC3 Integers Sep 11, 28 Nmeric Encodings Unsigned & Twoʼs complement Programming Implications C promotion rles Basic operations Addition, negation, mltiplication Programming Implications Conseqences
More informationPage 1 CISC360. Encoding Integers Unsigned. Integers Sep 8, Numeric Ranges. Encoding Example (Cont.)
CISC3 Integers Sep, 9 Encoding Integers Unsigned w 1 BU(X) = x i i i= short int x = 1513; short int y = -1513; Twoʼs Complement w BT(X) = x w 1 w 1 + x i i i= Sign Bit Decimal Hex Binary x 1513 3B D 11111
More informationIntegers Sep 3, 2002
15-213 The course that gives CMU its Zip! Topics Numeric Encodings Unsigned & Two s complement Programming Implications C promotion rules Basic operations Integers Sep 3, 2002 Addition, negation, multiplication
More informationSystems 1. Integers. Unsigned & Twoʼs complement. Addition, negation, multiplication
Systems 1 Integers Topics Numeric Encodings Unsigned & Twoʼs complement Programming Implications C promotion rules Basic operations Addition, negation, multiplication Programming Implications Consequences
More informationIntegers. Dr. Steve Goddard Giving credit where credit is due
CSCE 23J Computer Organization Integers Dr. Steve Goddard goddard@cse.unl.edu http://cse.unl.edu/~goddard/courses/csce23j Giving credit where credit is due Most of slides for this lecture are based on
More informationInteger Arithmetic. CS 347 Lecture 03. January 20, 1998
Integer Arithmetic CS 347 Lecture 03 January 20, 1998 Topics Numeric Encodings Unsigned & Two s complement Programming Implications C promotion rules Consequences of overflow Basic operations Addition,
More informationBits, Bytes, and Integer
19.3 Compter Architectre Spring 1 Bits, Bytes, and Integers Nmber Representations Bits, Bytes, and Integer Representing information as bits Bit-level maniplations Integers Representation: nsigned and signed
More informationBits, Bytes, and Integers. Bits, Bytes, and Integers. The Decimal System and Bases. Everything is bits. Converting from Decimal to Binary
with contribtions from Dr. Bin Ren, College of William & Mary Addition, negation, mltiplication, shifting 1 Everything is bits The Decimal System and Bases Each bit is or 1 By encoding/interpreting sets
More informationTopics of this Slideset. CS429: Computer Organization and Architecture. Encoding Integers: Unsigned. C Puzzles. Integers
Topics of this Slideset CS429: Computer Organization and Architecture Dr. Bill Young Department of Computer Science University of Texas at Austin Last updated: July 5, 2018 at 11:55 Numeric Encodings:
More informationCS429: Computer Organization and Architecture
CS429: Computer Organization and Architecture Dr. Bill Young Department of Computer Science University of Texas at Austin Last updated: July 5, 2018 at 11:55 CS429 Slideset 3: 1 Topics of this Slideset
More informationSystems Programming and Computer Architecture ( )
Systems Group Department of Computer Science ETH Zürich Systems Programming and Computer Architecture (252-0061-00) Timothy Roscoe Herbstsemester 2016 1 3: Integers in C Computer Architecture and Systems
More informationToday: Bits, Bytes, and Integers. Bits, Bytes, and Integers. For example, can count in binary. Everything is bits. Encoding Byte Values
Today: Bits, Bytes, and Integers Representing information as bits Bits, Bytes, and Integers CSci : Machine Architectre and Organization September th-9th, Yor instrctor: Stephen McCamant Bit-level maniplations
More informationIntegers. Today. Next time. ! Numeric Encodings! Programming Implications! Basic operations. ! Floats
Integers Today! Numeric Encodings! Programming Implications! Basic operations! Programming Implications Next time! Floats Fabián E. Bustamante, 2007 Integers in C! C supports several integral data types
More informationBits, Bytes, and Integers August 26, 2009
15-213 The Class That Gives CMU Its Zip! Bits, Bytes, and Integers August 26, 2009 Topics Representing information as bits Bit-level manipulations Boolean algebra Expressing in C Representations of Integers
More informationArithmetic and Bitwise Operations on Binary Data
Arithmetic and Bitwise Operations on Binary Data CSCI 2400: Computer Architecture ECE 3217: Computer Architecture and Organization Instructor: David Ferry Slides adapted from Bryant & O Hallaron s slides
More informationBits, Bytes, and Integers. Data Representa+on: Base- 2 number representa+on. Binary Representa+ons. Encoding Byte Values. Example Data Representa+ons
Bits, Bytes, and Data Representa+on: Bits, Bytes, and CSci 1 - Machine Architectre and Organiza+on Professor Pen- Chng Yew Bit- level manipla+ons Representa9on: nsigned and signed Expanding, trnca9ng Addi9on,
More informationBits, Bytes, and Integers Part 2
Bits, Bytes, and Integers Part 2 15-213: Introduction to Computer Systems 3 rd Lecture, Jan. 23, 2018 Instructors: Franz Franchetti, Seth Copen Goldstein, Brian Railing 1 First Assignment: Data Lab Due:
More informationCS 270: Computer Organization. Integer Arithmetic Operations
CS 270: Computer Organization Integer Arithmetic Operations Instructor: Professor Stephen P. Carl Unsigned Addition Operands: w bits True Sum: w+1 bits u + v u + v Discard Carry UAdd w (u, v) Standard
More informationComputer Systems CEN591(502) Fall 2011
Computer Systems CEN591(502) Fall 2011 Sandeep K. S. Gupta Arizona State University 4 th lecture Data representation in computer systems (Slides adapted from CSAPP book) Announcements Programming assignment
More informationManipulating Integers
Manipulating Integers Jinkyu Jeong (jinkyu@skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu SSE2030: Introduction to Computer Systems, Spring 2018, Jinkyu Jeong (jinkyu@skku.edu)
More informationCS 33. Data Representation, Part 2. CS33 Intro to Computer Systems VII 1 Copyright 2018 Thomas W. Doeppner. All rights reserved.
CS 33 Data Representation, Part 2 CS33 Intro to Computer Systems VII 1 Copyright 2018 Thomas W. Doeppner. All rights reserved. Signed Integers Two s complement b w-1 = 0 Þ non-negative number value = b
More informationRepresenta7on of integers: unsigned and signed Conversion, cas7ng Expanding, trunca7ng Addi7on, nega7on, mul7plica7on, shiaing
Today s Topics Representa7on of integers: unsigned and signed Conversion, cas7ng Expanding, trunca7ng Addi7on, nega7on, mul7plica7on, shiaing CSE351 Inaugural Edi7on Spring 2010 1 Encoding Integers C short
More informationArithmetic and Bitwise Operations on Binary Data
Arithmetic and Bitwise Operations on Binary Data CSCI 224 / ECE 317: Computer Architecture Instructor: Prof. Jason Fritts Slides adapted from Bryant & O Hallaron s slides 1 Boolean Algebra Developed by
More informationBits, Bytes, and Integers
Bits, Bytes, and Integers with contributions from Dr. Bin Ren, College of William & Mary 1 Bits, Bytes, and Integers Representing information as bits Bit-level manipulations Integers Representation: unsigned
More informationCS 33. Data Representation, Part 2. CS33 Intro to Computer Systems VIII 1 Copyright 2017 Thomas W. Doeppner. All rights reserved.
CS 33 Data Representation, Part 2 CS33 Intro to Computer Systems VIII 1 Copyright 2017 Thomas W. Doeppner. All rights reserved. Numeric Ranges Unsigned Values UMin = 0 000 0 UMax = 2 w 1 111 1 Two s Complement
More informationCsci 2021 Class Web Pages. Data Representa?on: Bits, Bytes, and Integers. Binary Representa?ons. Bits, Bytes, and Integers
Csci 1 Class Web Pages Departmental Class Web Page: Pblic access withot login Corse syllabs, schedle, lectre notes, other sefl info h7p://www- sers.cselabs.mn.ed/classes/spring- 1/csci1/ Yo shold read
More informationRepresenting and Manipulating Integers. Jo, Heeseung
Representing and Manipulating Integers Jo, Heeseung Unsigned Integers Encoding unsigned integers B [ bw 1, bw 2,..., b0 ] x = 0000 0111 1101 0011 2 D( B) w 1 b i i 0 2 i D(x) = 2 10 + 2 9 + 2 8 + 2 7 +
More informationJin-Soo Kim Systems Software & Architecture Lab. Seoul National University. Integers. Spring 2019
Jin-Soo Kim (jinsoo.kim@snu.ac.kr) Systems Software & Architecture Lab. Seoul National University Integers Spring 2019 4190.308: Computer Architecture Spring 2019 Jin-Soo Kim (jinsoo.kim@snu.ac.kr) 2 A
More informationInts and Floating Point
Ints and Floating Point CSE 351 Winter 2017 http://xkcd.com/899/ Administriia Lab 1 due Friday How is it going? HW 1 out today Numerical representation and executable inspection 2 Using Shifts and Masks
More informationInteger Encoding and Manipulation
CSE 2421: Systems I Low-Level Programming and Computer Organization Integer Encoding and Manipulation Presentation D Study: Bryant Chapter 2.1 2.3 Gojko Babić 01-24-2018 Unsigned & Signed Integer Encoding
More informationFoundations of Computer Systems
18-600 Foundations of Computer Systems Lecture 3: Bits, Bytes, and Integers September 6, 2017 Required Reading Assignment: Chapter 2 of CS:APP (3 rd edition) by Randy Bryant & Dave O Hallaron Assignments
More informationCS140 Lecture 08: Data Representation: Bits and Ints. John Magee 13 February 2017
CS140 Lecture 08: Data Representation: Bits and Ints John Magee 13 February 2017 Material From Computer Systems: A Programmer's Perspective, 3/E (CS:APP3e) Randal E. Bryant and David R. O'Hallaron, Carnegie
More informationBut first, encode deck of cards. Integer Representation. Two possible representations. Two better representations WELLESLEY CS 240 9/8/15
Integer Representation Representation of integers: unsigned and signed Sign extension Arithmetic and shifting Casting But first, encode deck of cards. cards in suits How do we encode suits, face cards?
More informationLemma 1 Let the components of, Suppose. Trees. A tree is a graph which is. (a) Connected and. (b) has no cycles (acyclic). (b)
Trees Lemma Let the components of ppose "! be (a) $&%('*)+ - )+ / A tree is a graph which is (b) 0 %(')+ - 3)+ / 6 (a) (a) Connected and (b) has no cycles (acyclic) (b) roof Eery path 8 in which is not
More informationBITS, BYTES, AND INTEGERS
BITS, BYTES, AND INTEGERS CS 045 Computer Organization and Architecture Prof. Donald J. Patterson Adapted from Bryant and O Hallaron, Computer Systems: A Programmer s Perspective, Third Edition ORIGINS
More informationLecture 5-6: Bits, Bytes, and Integers
CSCI-UA.0201-003 Computer Systems Organization Lecture 5-6: Bits, Bytes, and Integers Mohamed Zahran (aka Z) mzahran@cs.nyu.edu http://www.mzahran.com Slides adapted from: Jinyang Li Bryant and O Hallaron
More informationPOWER-OF-2 BOUNDARIES
Warren.3.fm Page 5 Monday, Jne 17, 5:6 PM CHAPTER 3 POWER-OF- BOUNDARIES 3 1 Ronding Up/Down to a Mltiple of a Known Power of Ronding an nsigned integer down to, for eample, the net smaller mltiple of
More informationCarnegie Mellon. Bryant and O Hallaron, Computer Systems: A Programmer s Perspective, Third Edition
Carnegie Mellon 1 Bits, Bytes and Integers Part 1 15-213/18-213/15-513: Introduction to Computer Systems 2 nd Lecture, Aug. 31, 2017 Today s Instructor: Randy Bryant 2 Announcements Recitations are on
More informationFloating Point Puzzles The course that gives CMU its Zip! Floating Point Jan 22, IEEE Floating Point. Fractional Binary Numbers.
class04.ppt 15-213 The course that gives CMU its Zip! Topics Floating Point Jan 22, 2004 IEEE Floating Point Standard Rounding Floating Point Operations Mathematical properties Floating Point Puzzles For
More informationf x y z ds f P S (,, ) lim ( ) ds f P S S S.
4.7 rface Integral We diide srface into patches patch, mltiply by the area with area, and form the sm n n i j f P ( ). We ealate f at a point P, in each Then we take the limit as the patch size approaches
More informationEE 109 Unit 6 Binary Arithmetic
EE 109 Unit 6 Binary Arithmetic 1 2 Semester Transition Point At this point we are going to start to transition in our class to look more at the hardware organization and the low-level software that is
More informationChapter 2 Float Point Arithmetic. Real Numbers in Decimal Notation. Real Numbers in Decimal Notation
Chapter 2 Float Point Arithmetic Topics IEEE Floating Point Standard Fractional Binary Numbers Rounding Floating Point Operations Mathematical properties Real Numbers in Decimal Notation Representation
More informationFloating Point January 24, 2008
15-213 The course that gives CMU its Zip! Floating Point January 24, 2008 Topics IEEE Floating Point Standard Rounding Floating Point Operations Mathematical properties class04.ppt 15-213, S 08 Floating
More informationSemester Transition Point. EE 109 Unit 11 Binary Arithmetic. Binary Arithmetic ARITHMETIC
1 2 Semester Transition Point EE 109 Unit 11 Binary Arithmetic At this point we are going to start to transition in our class to look more at the hardware organization and the low-level software that is
More informationBits, Bytes and Integers
Bits, Bytes and Integers Computer Systems Organization (Spring 2016) CSCI-UA 201, Section 2 Instructor: Joanna Klukowska Slides adapted from Randal E. Bryant and David R. O Hallaron (CMU) Mohamed Zahran
More informationBits, Bytes and Integers Part 1
Bits, Bytes and Integers Part 1 15-213/18-213/15-513: Introduction to Computer Systems 2 nd Lecture, Jan. 18, 2018 Instructors: Franz Franchetti Seth Copen Goldstein Brian Railing 1 Announcements Waitlist
More informationCS:APP Web Aside DATA:TNEG: Bit-Level Representation of Two s Complement Negation
CS:APP Web Aside DATA:TNEG: Bit-Level Representation of Two s Complement Negation Randal E. Bryant David R. O Hallaron August 27, 2016 Notice The material in this document is supplementary material to
More informationSystems I. Floating Point. Topics IEEE Floating Point Standard Rounding Floating Point Operations Mathematical properties
Systems I Floating Point Topics IEEE Floating Point Standard Rounding Floating Point Operations Mathematical properties IEEE Floating Point IEEE Standard 754 Established in 1985 as uniform standard for
More informationThe single-cycle design from last time
lticycle path Last time we saw a single-cycle path and control nit for or simple IPS-based instrction set. A mlticycle processor fies some shortcomings in the single-cycle CPU. Faster instrctions are not
More informationFloating Point Puzzles. Lecture 3B Floating Point. IEEE Floating Point. Fractional Binary Numbers. Topics. IEEE Standard 754
Floating Point Puzzles Topics Lecture 3B Floating Point IEEE Floating Point Standard Rounding Floating Point Operations Mathematical properties For each of the following C expressions, either: Argue that
More informationThe course that gives CMU its Zip! Floating Point Arithmetic Feb 17, 2000
15-213 The course that gives CMU its Zip! Floating Point Arithmetic Feb 17, 2000 Topics IEEE Floating Point Standard Rounding Floating Point Operations Mathematical properties IA32 floating point Floating
More informationCS33 Project Gear Up. Data
CS33 Project Gear Up Data Project Overview You will be solving a series of puzzles using your knowledge of data representations. IMPORTANT: Collaboration This project has a different collaboration policy
More informationSystem Programming CISC 360. Floating Point September 16, 2008
System Programming CISC 360 Floating Point September 16, 2008 Topics IEEE Floating Point Standard Rounding Floating Point Operations Mathematical properties Powerpoint Lecture Notes for Computer Systems:
More informationCAPL Scripting Quickstart
CAPL Scripting Qickstart CAPL (Commnication Access Programming Langage) For CANalyzer and CANoe V1.01 2015-12-03 Agenda Important information before getting started 3 Visal Seqencer (GUI based programming
More informationFloating Point Puzzles. Lecture 3B Floating Point. IEEE Floating Point. Fractional Binary Numbers. Topics. IEEE Standard 754
Floating Point Puzzles Topics Lecture 3B Floating Point IEEE Floating Point Standard Rounding Floating Point Operations Mathematical properties For each of the following C expressions, either: Argue that
More informationThe final datapath. M u x. Add. 4 Add. Shift left 2. PCSrc. RegWrite. MemToR. MemWrite. Read data 1 I [25-21] Instruction. Read. register 1 Read.
The final path PC 4 Add Reg Shift left 2 Add PCSrc Instrction [3-] Instrction I [25-2] I [2-6] I [5 - ] register register 2 register 2 Registers ALU Zero Reslt ALUOp em Data emtor RegDst ALUSrc em I [5
More informationChapter 4. Operations on Data
Chapter 4 Operations on Data 1 OBJECTIVES After reading this chapter, the reader should be able to: List the three categories of operations performed on data. Perform unary and binary logic operations
More informationCS 557 Lecture IX. Drexel University Dept. of Computer Science
CS 7 Lectre IX Dreel Uniersity Dept. of Compter Science Fall 00 Shortest Paths Finding the Shortest Paths in a graph arises in many different application: Transportation Problems: Finding the cheapest
More informationGiving credit where credit is due
CSCE 230J Computer Organization Floating Point Dr. Steve Goddard goddard@cse.unl.edu http://cse.unl.edu/~goddard/courses/csce230j Giving credit where credit is due Most of slides for this lecture are based
More informationSystems Programming and Computer Architecture ( )
(252-0061-00) Session 9 Floating Point Systems Group Department of Computer Science ETH Zürich 1 Floating Point Recap for the Assignment 2 Floating Point Representation Numerical Form Scientific Notation
More informationGiving credit where credit is due
JDEP 284H Foundations of Computer Systems Floating Point Dr. Steve Goddard goddard@cse.unl.edu Giving credit where credit is due Most of slides for this lecture are based on slides created by Drs. Bryant
More informationCS421 COMPILERS AND INTERPRETERS. the point it was passed (line 11). explicit vs implicit memory de-allocation? (malloc-free vs. garbage collection)
rocedre arameters (in ascal) rocedre parameters permit procedres to be invoked ot-of-scope ; 1 program main(inpt, otpt); 2 3 procedre b(fnction h(n : integer): integer); 4 var m : integer; 5 begin m :=
More informationMore on Runtime Environments. Procedure Parameters (in Pascal) Traditional Stack Scheme. Restrictions in C & Pascal. code.
More on Rntime Environments How to efficiently implement procedre call and retrn in the presence of higher-order fnctions? 1. what are higher-order fnctions? 2. how to ext frames to spport higher-order
More informationECE250: Algorithms and Data Structures Single Source Shortest Paths Dijkstra s Algorithm
ECE0: Algorithms and Data Strctres Single Sorce Shortest Paths Dijkstra s Algorithm Ladan Tahildari, PEng, SMIEEE Associate Professor Software Technologies Applied Research (STAR) Grop Dept. of Elect.
More informationCS429: Computer Organization and Architecture
CS429: Computer Organization and Architecture Dr. Bill Young Department of Computer Sciences University of Texas at Austin Last updated: September 18, 2017 at 12:48 CS429 Slideset 4: 1 Topics of this Slideset
More informationBits, Bytes, and Integers
Bits, Bytes, and Integers CENG331 - Computer Organization Instructors: Murat Manguoglu (Section 1) Adapted from slides of the textbook: http://csapp.cs.cmu.edu/ Hello World! What happens under the hood?
More informationThe multicycle datapath. Lecture 10 (Wed 10/15/2008) Finite-state machine for the control unit. Implementing the FSM
Lectre (Wed /5/28) Lab # Hardware De Fri Oct 7 HW #2 IPS programming, de Wed Oct 22 idterm Fri Oct 2 IorD The mlticycle path SrcA Today s objectives: icroprogramming Etending the mlti-cycle path lti-cycle
More informationThe extra single-cycle adders
lticycle Datapath As an added bons, we can eliminate some of the etra hardware from the single-cycle path. We will restrict orselves to sing each fnctional nit once per cycle, jst like before. Bt since
More informationCS367 Test 1 Review Guide
CS367 Test 1 Review Guide This guide tries to revisit what topics we've covered, and also to briefly suggest/hint at types of questions that might show up on the test. Anything on slides, assigned reading,
More informationCS 261 Fall Mike Lam, Professor Integer Encodings
CS 261 Fall 2018 Mike Lam, Professor https://xkcd.com/571/ Integer Encodings Integers Topics C integer data types Unsigned encoding Signed encodings Conversions Integer data types in C99 1 byte 2 bytes
More informationIntegers. N = sum (b i * 2 i ) where b i = 0 or 1. This is called unsigned binary representation. i = 31. i = 0
Integers So far, we've seen how to convert numbers between bases. How do we represent particular kinds of data in a certain (32-bit) architecture? We will consider integers floating point characters What
More informationDigital Image Processing Chapter 5: Image Restoration
Digital Image Processing Chapter 5: Image Restoration Concept of Image Restoration Image restoration is to restore a degraded image back to the original image while image enhancement is to maniplate the
More informationMa Lesson 18 Section 1.7
Ma 15200 Lesson 18 Section 1.7 I Representing an Ineqality There are 3 ways to represent an ineqality. (1) Using the ineqality symbol (sometime within set-bilder notation), (2) sing interval notation,
More informationBits, Bytes, and Integers
Bits, Bytes, and Integers B&O Readings: 2.1-2.3 CSE 361: Introduc=on to Systems So@ware Instructor: I- Ting Angelina Le e Note: these slides were originally created by Markus Püschel at Carnegie Mellon
More informationReview Multicycle: What is Happening. Controlling The Multicycle Design
Review lticycle: What is Happening Reslt Zero Op SrcA SrcB Registers Reg Address emory em Data Sign etend Shift left Sorce A B Ot [-6] [5-] [-6] [5-] [5-] Instrction emory IR RegDst emtoreg IorD em em
More informationXiang Li. Temple University. September 6, 2016
Introdction to Matlab Xiang Li Temple University September 6, 2016 Otline Matlab Introdction Get yor own copy of Matlab Data Types Matrices Operators MAT-LAB Introdction Matlab is a programming langage
More informationSimple Data Types in C. Alan L. Cox
Simple Data Types in C Alan L. Cox alc@rice.edu Objectives Be able to explain to others what a data type is Be able to use basic data types in C programs Be able to see the inaccuracies and limitations
More informationICS Instructor: Aleksandar Kuzmanovic TA: Ionut Trestian Recitation 2
ICS 2008 Instructor: Aleksandar Kuzmanovic TA: Ionut Trestian Recitation 2 Data Representations Sizes of C Objects (in Bytes) C Data Type Compaq Alpha Typical 32-bit Intel IA32 int 4 4 4 long int 8 4 4
More informationDr Paolo Guagliardo. Fall 2018
The NULL vale Dr Paolo Gagliardo dbs-lectrer@ed.ac.k Fall 2018 NULL: all-prpose marker to represent incomplete information Main sorce of problems and inconsistencies... this topic cannot be described in
More informationOperations On Data CHAPTER 4. (Solutions to Odd-Numbered Problems) Review Questions
CHAPTER 4 Operations On Data (Solutions to Odd-Numbered Problems) Review Questions 1. Arithmetic operations interpret bit patterns as numbers. Logical operations interpret each bit as a logical values
More informationToday. B-splines. B-splines. B-splines. Computergrafik. Curves NURBS Surfaces. Bilinear patch Bicubic Bézier patch Advanced surface modeling
Comptergrafik Matthias Zwicker Uniersität Bern Herbst 29 Cres Srfaces Parametric srfaces Bicbic Bézier patch Adanced srface modeling Piecewise Bézier cres Each segment spans for control points Each segment
More informationThe Volcano Optimizer Generator: Extensibility and Efficient Search
The Volcano Optimizer Generator: Extensibility and Efficient Search - Prithvi Lakshminarayanan - 301313262 Athors Goetz Graefe, Portland State University Won the Most Inflential Paper award in 1993 Worked
More informationIntegers II. CSE 351 Autumn Instructor: Justin Hsia
Integers II CSE 351 Autumn 2017 Instructor: Justin Hsia Teaching Assistants: Lucas Wotton Michael Zhang Parker DeWilde Ryan Wong Sam Gehman Sam Wolfson Savanna Yee Vinny Palaniappan http://xkcd.com/557/
More informationInteger Representation Floating point Representation Other data types
Chapter 2 Bits, Data Types & Operations Integer Representation Floating point Representation Other data types Why do Computers use Base 2? Base 10 Number Representation Natural representation for human
More informationIntegers II. CSE 351 Autumn Instructor: Justin Hsia
Integers II CSE 351 Autumn 2016 Instructor: Justin Hsia Teaching Assistants: Chris Ma Hunter Zahn John Kaltenbach Kevin Bi Sachin Mehta Suraj Bhat Thomas Neuman Waylon Huang Xi Liu Yufang Sun http://xkcd.com/571/
More informationOperators and Type Conversion. By Avani M. Sakhapara Assistant Professor, IT Dept, KJSCE
Operators and Type Conversion By Avani M. Sakhapara Assistant Professor, IT Dept, KJSCE Introduction An operator is a symbol which represents a particular operation that can be performed on some data.
More informationReview. How to represent real numbers
PCWrite PC IorD Review ALUSrcA emread Address Write data emory emwrite em Data IRWrite [3-26] [25-2] [2-6] [5-] [5-] RegDst Read register Read register 2 Write register Write data RegWrite Read data Read
More informationLAB A Translating Data to Binary
LAB A Translating Data to Binary Create a directory for this lab and perform in it the following groups of tasks: LabA1.java 1. Write the Java app LabA1 that takes an int via a command-line argument args[0]
More information1 Computer arithmetic with unsigned integers
1 Computer arithmetic with unsigned integers All numbers are w-bit unsigned integers unless otherwise noted. A w-bit unsigned integer x can be written out in binary as x x x w 2...x 2 x 1 x 0, where x
More informationComputer Organization: A Programmer's Perspective
A Programmer's Perspective Bits, Bytes, Nibbles, Words and Strings Gal A. Kaminka galk@cs.biu.ac.il Topics Why bits? Why 0/1? Basic terms: Bits, Bytes, Nibbles, Words Representing information as bits Characters
More informationDigital Image Processing Chapter 5: Image Restoration
Digital Image Processing Chapter 5: Image Restoration Concept of Image Restoration Image restoration is to restore a degraded image back to the original image while image enhancement is to maniplate the
More informationRepresenting Integers
Representing Integers Jinkyu Jeong (jinkyu@skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu SSE2030: Introduction to Computer Systems, Spring 2018, Jinkyu Jeong (jinkyu@skku.edu)
More informationImage Restoration Image Degradation and Restoration
Image Degradation and Restoration hxy Image Degradation Model: Spatial domain representation can be modeled by: g x y h x y f x y x y Freqency domain representation can be modeled by: G F N Prepared By:
More informationEXAMINATIONS 2003 END-YEAR COMP 203. Computer Organisation
EXAINATIONS 2003 COP203 END-YEAR Compter Organisation Time Allowed: 3 Hors (180 mintes) Instrctions: Answer all qestions. There are 180 possible marks on the eam. Calclators and foreign langage dictionaries
More informationCOMP2611: Computer Organization. Data Representation
COMP2611: Computer Organization Comp2611 Fall 2015 2 1. Binary numbers and 2 s Complement Numbers 3 Bits: are the basis for binary number representation in digital computers What you will learn here: How
More informationRepresenting and Manipulating Integers Part I
Representing and Manipulating Integers Part I Jin-Soo Kim (jinsookim@skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu Introduction The advent of the digital age Analog
More informationFloating point. Today. IEEE Floating Point Standard Rounding Floating Point Operations Mathematical properties Next time.
Floating point Today IEEE Floating Point Standard Rounding Floating Point Operations Mathematical properties Next time The machine model Fabián E. Bustamante, Spring 2010 IEEE Floating point Floating point
More informationBasic operators, Arithmetic, Relational, Bitwise, Logical, Assignment, Conditional operators. JAVA Standard Edition
Basic operators, Arithmetic, Relational, Bitwise, Logical, Assignment, Conditional operators JAVA Standard Edition Java - Basic Operators Java provides a rich set of operators to manipulate variables.
More informationObject Pose from a Single Image
Object Pose from a Single Image How Do We See Objects in Depth? Stereo Use differences between images in or left and right eye How mch is this difference for a car at 00 m? Moe or head sideways Or, the
More information