10.1. Unit 10. Signed Representation Systems Binary Arithmetic
|
|
- Kory Lindsey
- 6 years ago
- Views:
Transcription
1 0. Unit 0 Signed Representation Systems Binary Arithmetic
2 0.2 BINARY REPRESENTATION SYSTEMS REVIEW
3 0.3 Interpreting Binary Strings Given a string of s and 0 s, you need to know the representation system being used, before you can understand the value of those s and 0 s. Information (value) = s + Context (System) Unsigned Binary system =? BCD System ASCII system 65 0 A ASCII 4 BCD
4 0.4 Binary Representation Systems Integer Systems Unsigned Unsigned (Normal) binary Signed Signed Magnitude 2 s complement Excess-N* s complement* Floating Point For very large and small (fractional) numbers Codes Text ASCII / Unicode Decimal Codes BCD (Binary Coded Decimal) / (842 Code) * = Not fully covered in this class
5 0.5 Review of Number Systems Number systems consist of. A base (radix) r 2. r coefficients [0 to r-] Human System: Decimal (Base 0): 0,,2,3,4,5,6,7,8,9 Computer System: Binary (Base 2): 0, Human systems for working with computer systems (shorthand for human to read/write binary) Octal (Base 8): 0,,2,3,4,5,6,7 Hexadecimal (Base 6): 0-9,A,B,C,D,E,F (A thru F = 0 thru 5)
6 0.6 Binary Examples (00.) 2 = = (0000) 2 = =
7 0.7 Unique Combinations Given n digits of base r, how many unique numbers can be formed? r n What is the range? [0 to r n -] 2-digit, decimal numbers (r=0, n=2) combinations: digit, decimal numbers (r=0, n=3) 000 combinations: bit, binary numbers (r=2, n=4) combinations: bit, binary numbers (r=2, n=6) 64 combinations: Main Point: Given n digits of base r, r n unique numbers can be made with the range [0 - (r n -)]
8 0.8 Approximating Large Powers of 2 Often need to find decimal approximation of a large powers of 2 like 2 6, 2 32, etc. Use following approximations: ( thousand) = Kilo ( million) = Mega ( billion) = Giga ( trillion) = Tera- For other powers of 2, decompose into product of 2 0 or 2 20 or 2 30 and a power of 2 that is less than bit half word: 64K numbers 32-bit word: 4G numbers 64-bit dword: 6 million trillion numbers 2 6 = 2 6 * * 0 3 = 64, = 2 4 * * 0 6 = 6,000, = 2 8 * * 0 6 = 256,000, = 2 2 * * 0 9 = 4,000,000,000
9 0.9 Decimal to Unsigned Binary To convert a decimal number, x, to binary: Only coefficients of or 0. So simply find place values that add up to the desired values, starting with larger place values and proceeding to smaller values and place a in those place values and 0 in all others 25 0 = For 25 0 the place value 32 is too large to include so we include 6. Including 6 means we have to make 9 left over. Include 8 and.
10 0.0 Decimal to Another Base To convert a decimal number, x, to base r: Use the place values of base r (powers of r). Starting with largest place values, fill in coefficients that sum up to desired decimal value without going over = 4 B 0 hex 256 6
11 0. Signed Magnitude 2 s Complement System SIGNED SYSTEMS
12 0.2 Binary Representation Systems Integer Systems Unsigned Unsigned (Normal) binary Signed Signed Magnitude 2 s complement s complement* Excess-N* Floating Point For very large and small (fractional) numbers Codes Text ASCII / Unicode Decimal Codes BCD (Binary Coded Decimal) / (842 Code) * = Not covered in this class
13 0.3 Unsigned and Signed Normal (unsigned) binary can only represent positive numbers All place values are positive To represent negative numbers we must use a modified binary representation that takes into account sign (pos. or neg.) We call these signed representations
14 0.4 Signed Number Representation 2 Primary Systems Signed Magnitude Two s Complement (most widely used for integer representation)
15 0.5 Signed numbers All systems used to represent negative numbers split the possible binary combinations in half (half for positive numbers / half for negative numbers) In both signed magnitude and 2 s complement, positive and negative numbers are separated using the MSB MSB= means negative MSB=0 means positive
16 0.6 Signed Magnitude System Use binary place values but now MSB represents the sign ( if negative, 0 if positive) 4-bit Unsigned to 5 4-bit Signed Magnitude to +7 +/ bit Signed Magnitude to +27 +/
17 0.7 Signed Magnitude Examples 0 = -5 4-bit Signed Magnitude 0 +/- +/ = +3 = -7 Notice that +3 in signed magnitude is the same as in the unsigned system +/ = -9 8-bit Signed Magnitude +/ = +25 +/ Important: Positive numbers have the same representation in signed magnitude as in normal unsigned binary
18 0.8 Signed Magnitude Range Given n bits MSB is sign Other n- bits = normal unsigned place values Range with n- unsigned bits = [0 to 2 n- -] Range with n-bits of Signed Magnitude [ -2 n- to +2 n- ]
19 0.9 Disadvantages of Signed Magnitude. Wastes a combination to represent = 000 = Addition and subtraction algorithms for signed magnitude are different than unsigned binary (we d like them to be the same to use same HW) 4-6 Swap & make res. negative 6-4 -
20 s Complement System Normal binary place values except MSB has negative weight MSB of = -2 n- 4-bit Unsigned to 5 4-bit 2 s complement to bit 2 s complement to
21 0.2 2 s Complement Examples 0 = -5 4-bit 2 s complement = +3 Notice that +3 in 2 s comp. is the same as in the unsigned system = = bit 2 s complement = Important: Positive numbers have the same representation in 2 s complement as in normal unsigned binary
22 s Complement Range Given n bits Max positive value = 0 Includes all n- positive place values Max negative value = Includes only the negative MSB place value Range with n-bits of 2 s complement [ -2 n- to +2 n- ] Side note What decimal value is? - 0
23 0.23 Comparison of Systems Signed Mag s comp
24 0.24 Unsigned and Signed Variables In C, unsigned variables use unsigned binary (normal power-of-2 place values) to represent numbers = In C, signed variables use the 2 s complement system (Neg. MSB weight) to represent numbers =
25 0.25 IMPORTANT NOTE All computer systems use the 2's complement system to represent signed integers! So from now on, if we say an integer is signed, we are actually saying it uses the 2's complement system unless otherwise specified We will not use "signed magnitude" unless explicitly indicated
26 0.26 Zero and Sign Extension Extension is the process of increasing the number of bits used to represent a number without changing its value Unsigned = Zero Extension (Always add leading 0 s): 0 = 000 Increase a 6-bit number to 8-bit number by zero extending 2 s complement = Sign Extension (Replicate sign bit): pos. neg. 000 = = 00 Sign bit is just repeated as many times as necessary
27 0.27 Zero and Sign Truncation Truncation is the process of decreasing the number of bits used to represent a number without changing its value Unsigned = Zero Truncation (Remove leading 0 s): 000 = 0 Decrease an 8-bit number to 6-bit number by truncating 0 s. Can t remove a because value is changed 2 s complement = Sign Truncation (Remove copies of sign bit): pos. neg = = 00 Any copies of the MSB can be removed without changing the numbers value. Be careful not to change the sign by cutting off ALL the sign bits.
28 0.28 Data Representation In C/C++ variables can be of different types and sizes Integer Types (signed and unsigned) C Type Bytes s ATmega328 [unsigned] char 8 byte [unsigned] short [int] 2 6 word [unsigned] long [int] [unsigned] long long [int] Can emulate but has no single-instruction support Floating Point Types C Type Bytes s ATmega328 float 4 32 N/A double 8 64 N/A
29 ARITHMETIC 0.29
30 0.30 Binary Arithmetic Can perform all arithmetic operations (+,-,*, ) on binary numbers Can use same methods as in decimal Still use carries and borrows, etc. Only now we carry when sum is 2 or more rather than 0 or more (decimal) We borrow 2 s not 0 s from other columns Easiest method is to add bits in your head in decimal (+ = 2) then convert the answer to binary (2 0 = 0 2 )
31 0.3 Binary Addition In decimal addition we carry when the sum is 0 or more In binary addition we carry when the sum is 2 or more Add bits in binary to produce a sum bit and a carry bit no need to carry sum bit no need to carry sum bit no need to carry sum bit carry into next column of bits sum bit
32 0.32 Binary Addition & Subtraction 0 (7) (3) 0 0(0) (0) (5) (5)
33 0.33 Binary Addition 0 00(6) (7) 0(3)
34 0.34 Binary Addition (6) (7) 0 0 (3) (6) + 0 (7) + 0 (3) 0 carry bit sum bit carry bit sum bit (6) + 0 (7) + 0 (3) (6) (7) (3) 0 carry bit sum bit carry bit sum bit
35 0.35 Hexadecimal Arithmetic Same style of operations Carry when sum is 6 or more, etc. 4 D 6 + B = 8 0 = = 6 0 =
36 0.36 "Taking the 2's complement" SUBTRACTION THE EASY WAY
37 0.37 Taking the Negative Given a number in signed magnitude or 2 s complement how do we find its negative (i.e. - * X) Signed Magnitude: Flip the sign bit 00 = +6 => 0 = -6 2 s complement: Take the 2 s complement 00 = +6 => -6 = 00 Operation defined as:. Flip/invert/not all the bits ( s complement) 2. Add and drop any carry (i.e. finish with the same # of bits as we start with)
38 0.38 Taking the 2 s Complement Invert (flip) each bit (take the s complement) s become 0 s 0 s become s Add (drop final carry-out, if any) Original number = +9 flip is called the s complement of a number Resulting number = -9 Important: Taking the 2 s complement is equivalent to taking the negative (negating)
39 0.39 Taking the 2 s Complement Original number = -22 Take the 2 s complement yields the negative of a number Resulting number = Original # = 0 Take the 2 s complement 2 s comp. of 0 is Taking the 2 s complement again yields the original number (the operation is symmetric) 000 Back to original = Original # = -8 Take the 2 s complement Negative of -8 is -8 (i.e. no positive equivalent, but this is not a huge problem)
40 s Complement System Facts Normal binary place values but MSB has negative weight MSB determines sign of the number 0 = positive / = negative Special Numbers 0 = All 0 s (00 00) - = All s ( ) Max Positive = 0 followed by all s (0..) Max Negative = followed by all 0 s (00 00) To take the negative of a number (e.g. -7 => +7 or +2 => -2), requires taking the complement 2 s complement of a # is found by flipping bits and adding x = -7 flip ( s comp.) Add -x = -(-7) = +7
41 ADDITION AND SUBTRACTION 0.4
42 s Complement Addition/Subtraction Addition Sign of the numbers do not matter Add column by column Drop any final carry-out Subtraction Any subtraction (A-B) can be converted to addition (A + -B) by taking the 2 s complement of B (A-B) becomes (A + s comp. of B + ) Drop any carry-out
43 s Complement Addition No matter the sign of the operands just add as normal Drop any extra carry out (3) 0(-3) + 000(2) 00(5) (2) (-) Drop final carry-out 0 00 (3) + 0(-2) 000 () 00 0(-3) + 0(-2) 0(-5)
44 0.44 Unsigned and Signed Addition Addition process is the same for both unsigned and signed numbers Add columns right to left Examples: If unsigned If signed (9) (3) (2) (-7) (3) (-4)
45 s Complement Subtraction Take the 2 s complement of the subtrahend and add to the original minuend Drop any extra carry out 00(+3) - 000(+2) 0(-3) - 0(-2) Drop final carry-out _ s comp. of +2 Add _ s comp. of -2 Add
46 0.46 Unsigned and Signed Subtraction Subtraction process is the same for both unsigned and signed numbers Convert A B to A + Comp. of B Drop any final carry out Examples: If unsigned (2) (2) If signed (-4) (2) A s comp. of B Add (0) (-6) If unsigned If signed
47 0.47 Important Note Almost all computers use 2's complement because The same addition and subtraction algorithm can be used on unsigned and 2's complement (signed) numbers Thus we only need one adder circuit (HW component) to perform operations on both unsigned and signed numbers
48 OVERFLOW 0.48
49 0.49 Overflow Overflow occurs when the result of an arithmetic operation is too large to be represented with the given number of bits Conditions and tests to determine overflow depend on sign
50 0.50 Unsigned Overflow Overflow occurs when you cross this discontinuity = Plus With 4-bit unsigned numbers we can only represent 0 5. Thus, we say overflow has occurred
51 0.5 2 s Complement Overflow = = -0 With 4-bit 2 s complement numbers we can only represent -8 to +7. Thus, we say overflow has occurred Overflow occurs when you cross this discontinuity
52 0.52 Overflow in Addition Overflow occurs when the result of the addition cannot be represented with the given number of bits. Tests for overflow: Unsigned: if Cout = Signed: if p + p = n or n + n = p If unsigned (3) (4) (7) If signed (-3) (4) (+) If unsigned (6) (5) () If signed (6) (5) (-5) Overflow Cout = No Overflow n + p No Overflow Cout = 0 Overflow p + p = n
53 0.53 Overflow in Subtraction Overflow occurs when the result of the subtraction cannot be represented with the given number of bits. Tests for overflow: Unsigned: if Cout = 0 Signed: if addition is p + p = n or n + n = p If unsigned (7) (8) (-) If signed (7) (-8) (5) Desired Results 0_ A s comp. of B Add (5) (-) If unsigned Overflow Cout = 0 If signed Overflow p + p = n
54 FLOATING POINT 0.54
55 0.55 Floating Point Used to represent very small numbers (fractions) and very large numbers Avogadro s Number: * 0 23 Planck s Constant: * 0-27 Note: 32 or 64-bit integers can t represent this range Floating Point representation is used in HLL s like C by declaring variables as float or double
56 0.56 Fixed Point Unsigned and 2 s complement fall under a category of representations called Fixed Point The radix point is assumed to be in a fixed location for all numbers [Note: we could represent fractions by implicitly assuming the binary point is at the left A variable just stores bits you can assume the binary point is anywhere you like] Integers: 000. (binary point to right of LSB) For 32-bits, unsigned range is 0 to ~4 billion Fractions:.000 (binary point to left of MSB) storage Fixed point Rep. Range [0 to ) Main point: By fixing the radix point, we limit the range of numbers that can be represented Floating point allows the radix point to be in a different location for each value
57 0.57 Floating Point Representation Similar to scientific notation used with decimal numbers ±D.DDD * 0 ±exp Floating Point representation uses the following form ±b.bbbb * 2 ±exp 3 Fields: sign, exponent, fraction (also called mantissa or significand) Overall Sign of # S Exp. fraction
58 0.58 Normalized FP Numbers Decimal Example *0 5 is not correct scientific notation Must have exactly one significant digit before decimal point: +7.54*0 4 In binary the only significant digit is Thus normalized FP format is: ±.bbbbbb * 2 ±exp FP numbers will always be normalized before being stored in memory or a reg. The. is actually not stored but assumed since we always will store normalized numbers If HW calculates a result of 0.000*2 5 it must normalize to.0000*2 2 before storing
59 0.59 IEEE Floating Point Formats Single Precision (32-bit format) Sign bit (0=pos/=neg) 8 Exponent bits Excess-27 representation More on next slides 23 fraction (significand or mantissa) bits Equiv. Decimal Range: 7 digits x 0 ±38 Double Precision (64-bit format) Sign bit (0=pos/=neg) Exponent bits Excess-023 representation More on next slides 52 fraction (significand or mantissa) bits Equiv. Decimal Range: 6 digits x 0 ± S Exp. Fraction S Exp. Fraction
60 0.60 Floating Point vs. Fixed Point Single Precision (32-bits) Equivalent Decimal Range: 7 significant decimal digits * 0 ±38 Compare that to 32-bit signed integer where we can represent ±2 billion. How does a 32-bit float allow us to represent such a greater range? FP allows for range but sacrifices precision (can t represent all numbers in its range) Double Precision (64-bits) Equivalent Decimal Range: 6 significant decimal digits * 0 ±308
61 0.6 Exponent Representation Exponent needs its own sign (+/-) Rather than using 2 s comp. system we use Excess-N representation Single-Precision uses Excess-27 Double-Precision uses Excess-023 This representation allows FP numbers to be easily compared Let E = stored exponent code and E = true exponent value For single-precision: E = E => E =, E = 28 0 = For double-precision: E = E => E = -2, E = 02 0 = s comp. E' (stored Exp.) Excess Comparison of 2 s comp. & Excess-N Q: Why don t we use Excess-N more to represent negative # s
62 0.62 Single-Precision Examples 2 7 =28 2 = =3 = = * * = = 26 = +.0 *
EE 109 Unit 19. IEEE 754 Floating Point Representation Floating Point Arithmetic
1 EE 109 Unit 19 IEEE 754 Floating Point Representation Floating Point Arithmetic 2 Floating Point Used to represent very small numbers (fractions) and very large numbers Avogadro s Number: +6.0247 * 10
More information1.1. Unit 1. Integer Representation
1.1 Unit 1 Integer Representation 1.2 Skills & Outcomes You should know and be able to apply the following skills with confidence Convert an unsigned binary number to and from decimal Understand the finite
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 informationFloating Point. EE 109 Unit 20. Floating Point Representation. Fixed Point
2.1 Floating Point 2.2 EE 19 Unit 2 IEEE 754 Floating Point Representation Floating Point Arithmetic Used to represent very numbers (fractions) and very numbers Avogadro s Number: +6.247 * 1 23 Planck
More informationEE 109 Unit 20. IEEE 754 Floating Point Representation Floating Point Arithmetic
1 EE 109 Unit 20 IEEE 754 Floating Point Representation Floating Point Arithmetic 2 Floating Point Used to represent very small numbers (fractions) and very large numbers Avogadro s Number: +6.0247 * 10
More informationEE 109 Unit 2. Binary Representation Systems
EE 09 Unit 2 Binary Representation Systems ANALOG VS. DIGITAL 2 3 Analog vs. Digital The analog world is based on continuous events. Observations can take on (real) any value. The digital world is based
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 informationSIGNED AND UNSIGNED SYSTEMS
EE 357 Unit 1 Fixed Point Systems and Arithmetic Learning Objectives Understand the size and systems used by the underlying HW when a variable is declared in a SW program Understand and be able to find
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 informationNumber Systems. Decimal numbers. Binary numbers. Chapter 1 <1> 8's column. 1000's column. 2's column. 4's column
1's column 10's column 100's column 1000's column 1's column 2's column 4's column 8's column Number Systems Decimal numbers 5374 10 = Binary numbers 1101 2 = Chapter 1 1's column 10's column 100's
More informationMACHINE LEVEL REPRESENTATION OF DATA
MACHINE LEVEL REPRESENTATION OF DATA CHAPTER 2 1 Objectives Understand how integers and fractional numbers are represented in binary Explore the relationship between decimal number system and number systems
More informationCHAPTER V NUMBER SYSTEMS AND ARITHMETIC
CHAPTER V-1 CHAPTER V CHAPTER V NUMBER SYSTEMS AND ARITHMETIC CHAPTER V-2 NUMBER SYSTEMS RADIX-R REPRESENTATION Decimal number expansion 73625 10 = ( 7 10 4 ) + ( 3 10 3 ) + ( 6 10 2 ) + ( 2 10 1 ) +(
More informationIT 1204 Section 2.0. Data Representation and Arithmetic. 2009, University of Colombo School of Computing 1
IT 1204 Section 2.0 Data Representation and Arithmetic 2009, University of Colombo School of Computing 1 What is Analog and Digital The interpretation of an analog signal would correspond to a signal whose
More information2.1. Unit 2. Integer Operations (Arithmetic, Overflow, Bitwise Logic, Shifting)
2.1 Unit 2 Integer Operations (Arithmetic, Overflow, Bitwise Logic, Shifting) 2.2 Skills & Outcomes You should know and be able to apply the following skills with confidence Perform addition & subtraction
More informationEE 109 Unit 3. Analog vs. Digital. Analog vs. Digital. Binary Representation Systems ANALOG VS. DIGITAL
3. 3. EE 9 Unit 3 Binary Representation Systems ANALOG VS. DIGITAL 3.3 3. Analog vs. Digital The analog world is based on continuous events. Observations can take on any (real) value. The digital world
More information3.1. Unit 3. Binary Representation
3.1 Unit 3 Binary Representation ANALOG VS. DIGITAL 3.2 3.3 Analog vs. Digital The analog world is based on continuous events. Observations can take on (real) any value. The digital world is based on discrete
More informationNumber System. Introduction. Decimal Numbers
Number System Introduction Number systems provide the basis for all operations in information processing systems. In a number system the information is divided into a group of symbols; for example, 26
More informationCHW 261: Logic Design
CHW 261: Logic Design Instructors: Prof. Hala Zayed Dr. Ahmed Shalaby http://www.bu.edu.eg/staff/halazayed14 http://bu.edu.eg/staff/ahmedshalaby14# Slide 1 Slide 2 Slide 3 Digital Fundamentals CHAPTER
More informationInf2C - Computer Systems Lecture 2 Data Representation
Inf2C - Computer Systems Lecture 2 Data Representation Boris Grot School of Informatics University of Edinburgh Last lecture Moore s law Types of computer systems Computer components Computer system stack
More informationEE 109 Unit 2. Analog vs. Digital. Analog vs. Digital. Binary Representation Systems ANALOG VS. DIGITAL
EE 9 Unit Binary Representation Systems ANALOG VS. DIGITAL Analog vs. Digital The analog world is based on continuous events. Observations can take on any (real) value. The digital world is based on discrete
More informationCOMP Overview of Tutorial #2
COMP 1402 Winter 2008 Tutorial #2 Overview of Tutorial #2 Number representation basics Binary conversions Octal conversions Hexadecimal conversions Signed numbers (signed magnitude, one s and two s complement,
More informationChapter 3: part 3 Binary Subtraction
Chapter 3: part 3 Binary Subtraction Iterative combinational circuits Binary adders Half and full adders Ripple carry and carry lookahead adders Binary subtraction Binary adder-subtractors Signed binary
More informationDecimal & Binary Representation Systems. Decimal & Binary Representation Systems
Decimal & Binary Representation Systems Decimal & binary are positional representation systems each position has a value: d*base i for example: 321 10 = 3*10 2 + 2*10 1 + 1*10 0 for example: 101000001
More informationNumber Systems Standard positional representation of numbers: An unsigned number with whole and fraction portions is represented as:
N Number Systems Standard positional representation of numbers: An unsigned number with whole and fraction portions is represented as: a n a a a The value of this number is given by: = a n Ka a a a a a
More informationBinary Addition. Add the binary numbers and and show the equivalent decimal addition.
Binary Addition The rules for binary addition are 0 + 0 = 0 Sum = 0, carry = 0 0 + 1 = 0 Sum = 1, carry = 0 1 + 0 = 0 Sum = 1, carry = 0 1 + 1 = 10 Sum = 0, carry = 1 When an input carry = 1 due to a previous
More informationTopic Notes: Bits and Bytes and Numbers
Computer Science 220 Assembly Language & Comp Architecture Siena College Fall 2010 Topic Notes: Bits and Bytes and Numbers Binary Basics At least some of this will be review, but we will go over it for
More informationWorld Inside a Computer is Binary
C Programming 1 Representation of int data World Inside a Computer is Binary C Programming 2 Decimal Number System Basic symbols: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 Radix-10 positional number system. The radix
More informationComputer (Literacy) Skills. Number representations and memory. Lubomír Bulej KDSS MFF UK
Computer (Literacy Skills Number representations and memory Lubomír Bulej KDSS MFF UK Number representations? What for? Recall: computer works with binary numbers Groups of zeroes and ones 8 bits (byte,
More informationTopic Notes: Bits and Bytes and Numbers
Computer Science 220 Assembly Language & Comp Architecture Siena College Fall 2011 Topic Notes: Bits and Bytes and Numbers Binary Basics At least some of this will be review for most of you, but we start
More informationComputer Science 324 Computer Architecture Mount Holyoke College Fall Topic Notes: Bits and Bytes and Numbers
Computer Science 324 Computer Architecture Mount Holyoke College Fall 2007 Topic Notes: Bits and Bytes and Numbers Number Systems Much of this is review, given the 221 prerequisite Question: how high can
More informationChapter 4: Data Representations
Chapter 4: Data Representations Integer Representations o unsigned o sign-magnitude o one's complement o two's complement o bias o comparison o sign extension o overflow Character Representations Floating
More informationl l l l l l l Base 2; each digit is 0 or 1 l Each bit in place i has value 2 i l Binary representation is used in computers
198:211 Computer Architecture Topics: Lecture 8 (W5) Fall 2012 Data representation 2.1 and 2.2 of the book Floating point 2.4 of the book Computer Architecture What do computers do? Manipulate stored information
More informationNumber Systems and Computer Arithmetic
Number Systems and Computer Arithmetic Counting to four billion two fingers at a time What do all those bits mean now? bits (011011011100010...01) instruction R-format I-format... integer data number text
More informationDigital Fundamentals
Digital Fundamentals Tenth Edition Floyd Chapter 2 2009 Pearson Education, Upper 2008 Pearson Saddle River, Education NJ 07458. All Rights Reserved Decimal Numbers The position of each digit in a weighted
More informationIntroduction to Computers and Programming. Numeric Values
Introduction to Computers and Programming Prof. I. K. Lundqvist Lecture 5 Reading: B pp. 47-71 Sept 1 003 Numeric Values Storing the value of 5 10 using ASCII: 00110010 00110101 Binary notation: 00000000
More informationBasic Definition INTEGER DATA. Unsigned Binary and Binary-Coded Decimal. BCD: Binary-Coded Decimal
Basic Definition REPRESENTING INTEGER DATA Englander Ch. 4 An integer is a number which has no fractional part. Examples: -2022-213 0 1 514 323434565232 Unsigned and -Coded Decimal BCD: -Coded Decimal
More informationKorea University of Technology and Education
MEC52 디지털공학 Binary Systems Jee-Hwan Ryu School of Mechanical Engineering Binary Numbers a 5 a 4 a 3 a 2 a a.a - a -2 a -3 base or radix = a n r n a n- r n-...a 2 r 2 a ra a - r - a -2 r -2...a -m r -m
More informationCS 101: Computer Programming and Utilization
CS 101: Computer Programming and Utilization Jul-Nov 2017 Umesh Bellur (cs101@cse.iitb.ac.in) Lecture 3: Number Representa.ons Representing Numbers Digital Circuits can store and manipulate 0 s and 1 s.
More informationM1 Computers and Data
M1 Computers and Data Module Outline Architecture vs. Organization. Computer system and its submodules. Concept of frequency. Processor performance equation. Representation of information characters, signed
More informationRepresenting Information. Bit Juggling. - Representing information using bits - Number representations. - Some other bits - Chapters 1 and 2.3,2.
Representing Information 0 1 0 Bit Juggling 1 1 - Representing information using bits - Number representations 1 - Some other bits 0 0 - Chapters 1 and 2.3,2.4 Motivations Computers Process Information
More informationFloating-Point Data Representation and Manipulation 198:231 Introduction to Computer Organization Lecture 3
Floating-Point Data Representation and Manipulation 198:231 Introduction to Computer Organization Instructor: Nicole Hynes nicole.hynes@rutgers.edu 1 Fixed Point Numbers Fixed point number: integer part
More informationCS101 Lecture 04: Binary Arithmetic
CS101 Lecture 04: Binary Arithmetic Binary Number Addition Two s complement encoding Briefly: real number representation Aaron Stevens (azs@bu.edu) 25 January 2013 What You ll Learn Today Counting in binary
More informationChapter 2. Data Representation in Computer Systems
Chapter 2 Data Representation in Computer Systems Chapter 2 Objectives Understand the fundamentals of numerical data representation and manipulation in digital computers. Master the skill of converting
More informationNumeric Encodings Prof. James L. Frankel Harvard University
Numeric Encodings Prof. James L. Frankel Harvard University Version of 10:19 PM 12-Sep-2017 Copyright 2017, 2016 James L. Frankel. All rights reserved. Representation of Positive & Negative Integral and
More informationModule 2: Computer Arithmetic
Module 2: Computer Arithmetic 1 B O O K : C O M P U T E R O R G A N I Z A T I O N A N D D E S I G N, 3 E D, D A V I D L. P A T T E R S O N A N D J O H N L. H A N N E S S Y, M O R G A N K A U F M A N N
More informationDivide: Paper & Pencil
Divide: Paper & Pencil 1001 Quotient Divisor 1000 1001010 Dividend -1000 10 101 1010 1000 10 Remainder See how big a number can be subtracted, creating quotient bit on each step Binary => 1 * divisor or
More informationBinary Addition & Subtraction. Unsigned and Sign & Magnitude numbers
Binary Addition & Subtraction Unsigned and Sign & Magnitude numbers Addition and subtraction of unsigned or sign & magnitude binary numbers by hand proceeds exactly as with decimal numbers. (In fact this
More informationNumber Systems CHAPTER Positional Number Systems
CHAPTER 2 Number Systems Inside computers, information is encoded as patterns of bits because it is easy to construct electronic circuits that exhibit the two alternative states, 0 and 1. The meaning of
More informationBINARY SYSTEM. Binary system is used in digital systems because it is:
CHAPTER 2 CHAPTER CONTENTS 2.1 Binary System 2.2 Binary Arithmetic Operation 2.3 Signed & Unsigned Numbers 2.4 Arithmetic Operations of Signed Numbers 2.5 Hexadecimal Number System 2.6 Octal Number System
More informationUnit 3. Analog vs. Digital. Analog vs. Digital ANALOG VS. DIGITAL. Binary Representation
3.1 3.2 Unit 3 Binary Representation ANALOG VS. DIGITAL 3.3 3.4 Analog vs. Digital The analog world is based on continuous events. Observations can take on (real) any value. The digital world is based
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 informationDRAM uses a single capacitor to store and a transistor to select. SRAM typically uses 6 transistors.
Data Representation Data Representation Goal: Store numbers, characters, sets, database records in the computer. What we got: Circuit that stores 2 voltages, one for logic 0 (0 volts) and one for logic
More informationChapter 3: Arithmetic for Computers
Chapter 3: Arithmetic for Computers Objectives Signed and Unsigned Numbers Addition and Subtraction Multiplication and Division Floating Point Computer Architecture CS 35101-002 2 The Binary Numbering
More informationFinal Labs and Tutors
ICT106 Fundamentals of Computer Systems - Topic 2 REPRESENTATION AND STORAGE OF INFORMATION Reading: Linux Assembly Programming Language, Ch 2.4-2.9 and 3.6-3.8 Final Labs and Tutors Venue and time South
More informationBinary Representations and Arithmetic
Binary Representations and Arithmetic 9--26 Common number systems. Base : decimal Base 2: binary Base 6: hexadecimal (memory addresses) Base 8: octal (obsolete computer systems) Base 64 (email attachments,
More informationCPS 104 Computer Organization and Programming Lecture-2 : Data representations,
CPS 104 Computer Organization and Programming Lecture-2 : Data representations, Sep. 1, 1999 Dietolf Ramm http://www.cs.duke.edu/~dr/cps104.html CPS104 Lec2.1 GK&DR Fall 1999 Data Representation Computers
More informationNumber Systems. Binary Numbers. Appendix. Decimal notation represents numbers as powers of 10, for example
Appendix F Number Systems Binary Numbers Decimal notation represents numbers as powers of 10, for example 1729 1 103 7 102 2 101 9 100 decimal = + + + There is no particular reason for the choice of 10,
More informationThe type of all data used in a C++ program must be specified
The type of all data used in a C++ program must be specified A data type is a description of the data being represented That is, a set of possible values and a set of operations on those values There are
More information9/3/2015. Data Representation II. 2.4 Signed Integer Representation. 2.4 Signed Integer Representation
Data Representation II CMSC 313 Sections 01, 02 The conversions we have so far presented have involved only unsigned numbers. To represent signed integers, computer systems allocate the high-order bit
More informationCO212 Lecture 10: Arithmetic & Logical Unit
CO212 Lecture 10: Arithmetic & Logical Unit Shobhanjana Kalita, Dept. of CSE, Tezpur University Slides courtesy: Computer Architecture and Organization, 9 th Ed, W. Stallings Integer Representation For
More informationECE/Comp Sci 352 Digital Systems Fundamentals. Charles R. Kime Section 2 Fall Logic and Computer Design Fundamentals
University of Wisconsin - Madison ECE/Comp Sci 352 Digital Systems Fundamentals Charles R. Kime Section 2 Fall 2001 Chapter 3 Combinational Logic Design Part 4 Charles Kime & Thomas Kaminski Complements
More informationComputer Organization
Computer Organization Register Transfer Logic Number System Department of Computer Science Missouri University of Science & Technology hurson@mst.edu 1 Decimal Numbers: Base 10 Digits: 0, 1, 2, 3, 4, 5,
More informationKinds Of Data CHAPTER 3 DATA REPRESENTATION. Numbers Are Different! Positional Number Systems. Text. Numbers. Other
Kinds Of Data CHAPTER 3 DATA REPRESENTATION Numbers Integers Unsigned Signed Reals Fixed-Point Floating-Point Binary-Coded Decimal Text ASCII Characters Strings Other Graphics Images Video Audio Numbers
More informationChapter 10 Binary Arithmetics
27..27 Chapter Binary Arithmetics Dr.-Ing. Stefan Werner Table of content Chapter : Switching Algebra Chapter 2: Logical Levels, Timing & Delays Chapter 3: Karnaugh-Veitch-Maps Chapter 4: Combinational
More informationCPE 323 REVIEW DATA TYPES AND NUMBER REPRESENTATIONS IN MODERN COMPUTERS
CPE 323 REVIEW DATA TYPES AND NUMBER REPRESENTATIONS IN MODERN COMPUTERS Aleksandar Milenković The LaCASA Laboratory, ECE Department, The University of Alabama in Huntsville Email: milenka@uah.edu Web:
More informationCPE 323 REVIEW DATA TYPES AND NUMBER REPRESENTATIONS IN MODERN COMPUTERS
CPE 323 REVIEW DATA TYPES AND NUMBER REPRESENTATIONS IN MODERN COMPUTERS Aleksandar Milenković The LaCASA Laboratory, ECE Department, The University of Alabama in Huntsville Email: milenka@uah.edu Web:
More informationFloating Point Arithmetic
Floating Point Arithmetic CS 365 Floating-Point What can be represented in N bits? Unsigned 0 to 2 N 2s Complement -2 N-1 to 2 N-1-1 But, what about? very large numbers? 9,349,398,989,787,762,244,859,087,678
More informationChapter 1 Review of Number Systems
1.1 Introduction Chapter 1 Review of Number Systems Before the inception of digital computers, the only number system that was in common use is the decimal number system which has a total of 10 digits
More informationThe type of all data used in a C (or C++) program must be specified
The type of all data used in a C (or C++) program must be specified A data type is a description of the data being represented That is, a set of possible values and a set of operations on those values
More informationCS 31: Introduction to Computer Systems. 03: Binary Arithmetic January 29
CS 31: Introduction to Computer Systems 03: Binary Arithmetic January 29 WiCS! Swarthmore Women in Computer Science Slide 2 Today Binary Arithmetic Unsigned addition Subtraction Representation Signed magnitude
More informationRecap from Last Time. CSE 2021: Computer Organization. It s All about Numbers! 5/12/2011. Text Pictures Video clips Audio
CSE 2021: Computer Organization Recap from Last Time load from disk High-Level Program Lecture-2(a) Data Translation Binary patterns, signed and unsigned integers Today s topic Data Translation Code Translation
More informationChapter 2 Bits, Data Types, and Operations
Chapter 2 Bits, Data Types, and Operations How do we represent data in a computer? At the lowest level, a computer is an electronic machine. works by controlling the flow of electrons Easy to recognize
More informationCOMP2121: Microprocessors and Interfacing. Number Systems
COMP2121: Microprocessors and Interfacing Number Systems http://www.cse.unsw.edu.au/~cs2121 Lecturer: Hui Wu Session 2, 2017 1 1 Overview Positional notation Decimal, hexadecimal, octal and binary Converting
More informationFloating Point Numbers. Lecture 9 CAP
Floating Point Numbers Lecture 9 CAP 3103 06-16-2014 Review of Numbers Computers are made to deal with numbers What can we represent in N bits? 2 N things, and no more! They could be Unsigned integers:
More informationCS 265. Computer Architecture. Wei Lu, Ph.D., P.Eng.
CS 265 Computer Architecture Wei Lu, Ph.D., P.Eng. 1 Part 1: Data Representation Our goal: revisit and re-establish fundamental of mathematics for the computer architecture course Overview: what are bits
More informationFloating Point (with contributions from Dr. Bin Ren, William & Mary Computer Science)
Floating Point (with contributions from Dr. Bin Ren, William & Mary Computer Science) Floating Point Background: Fractional binary numbers IEEE floating point standard: Definition Example and properties
More informationChapter 4 Arithmetic Functions
Logic and Computer Design Fundamentals Chapter 4 Arithmetic Functions Charles Kime & Thomas Kaminski 2008 Pearson Education, Inc. (Hyperlinks are active in View Show mode) Overview Iterative combinational
More informationRui Wang, Assistant professor Dept. of Information and Communication Tongji University.
Data Representation ti and Arithmetic for Computers Rui Wang, Assistant professor Dept. of Information and Communication Tongji University it Email: ruiwang@tongji.edu.cn Questions What do you know about
More informationChapter 2 Bits, Data Types, and Operations
Chapter Bits, Data Types, and Operations How do we represent data in a computer? At the lowest level, a computer is an electronic machine. works by controlling the flow of electrons Easy to recognize two
More informationFloating-point Arithmetic. where you sum up the integer to the left of the decimal point and the fraction to the right.
Floating-point Arithmetic Reading: pp. 312-328 Floating-Point Representation Non-scientific floating point numbers: A non-integer can be represented as: 2 4 2 3 2 2 2 1 2 0.2-1 2-2 2-3 2-4 where you sum
More informationFloating Point. The World is Not Just Integers. Programming languages support numbers with fraction
1 Floating Point The World is Not Just Integers Programming languages support numbers with fraction Called floating-point numbers Examples: 3.14159265 (π) 2.71828 (e) 0.000000001 or 1.0 10 9 (seconds in
More informationData Representation. DRAM uses a single capacitor to store and a transistor to select. SRAM typically uses 6 transistors.
Data Representation Data Representation Goal: Store numbers, characters, sets, database records in the computer. What we got: Circuit that stores 2 voltages, one for logic ( volts) and one for logic (3.3
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 information2. MACHINE REPRESENTATION OF TYPICAL ARITHMETIC DATA FORMATS (NATURAL AND INTEGER NUMBERS).
2. MACHINE REPRESENTATION OF TYPICAL ARITHMETIC DATA FORMATS (NATURAL AND INTEGER NUMBERS). 2.. Natural Binary Code (NBC). The positional code with base 2 (B=2), introduced in Exercise, is used to encode
More informationA Level Computing. Contents. For the Exam:
A Level Computing Contents For the Exam:... 1 Revision of Binary... 2 Computing Mathematics Revision... 2 Binary Addition/Subtraction revision... 3 BCD... 3 Sign and Magnitude... 4 2 s Compliment... 4
More informationSigned umbers. Sign/Magnitude otation
Signed umbers So far we have discussed unsigned number representations. In particular, we have looked at the binary number system and shorthand methods in representing binary codes. With m binary digits,
More informationData Representation 1
1 Data Representation Outline Binary Numbers Adding Binary Numbers Negative Integers Other Operations with Binary Numbers Floating Point Numbers Character Representation Image Representation Sound Representation
More informationQUIZ ch.1. 1 st generation 2 nd generation 3 rd generation 4 th generation 5 th generation Rock s Law Moore s Law
QUIZ ch.1 1 st generation 2 nd generation 3 rd generation 4 th generation 5 th generation Rock s Law Moore s Law Integrated circuits Density of silicon chips doubles every 1.5 yrs. Multi-core CPU Transistors
More informationChapter Three. Arithmetic
Chapter Three 1 Arithmetic Where we've been: Performance (seconds, cycles, instructions) Abstractions: Instruction Set Architecture Assembly Language and Machine Language What's up ahead: Implementing
More informationCOSC 243. Data Representation 3. Lecture 3 - Data Representation 3 1. COSC 243 (Computer Architecture)
COSC 243 Data Representation 3 Lecture 3 - Data Representation 3 1 Data Representation Test Material Lectures 1, 2, and 3 Tutorials 1b, 2a, and 2b During Tutorial a Next Week 12 th and 13 th March If you
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 Chris Riesbeck, Fall 2011 Checkpoint IEEE Floating point Floating
More informationNumber Systems. Both numbers are positive
Number Systems Range of Numbers and Overflow When arithmetic operation such as Addition, Subtraction, Multiplication and Division are performed on numbers the results generated may exceed the range of
More informationLecture Topics. Announcements. Today: Integer Arithmetic (P&H ) Next: continued. Consulting hours. Introduction to Sim. Milestone #1 (due 1/26)
Lecture Topics Today: Integer Arithmetic (P&H 3.1-3.4) Next: continued 1 Announcements Consulting hours Introduction to Sim Milestone #1 (due 1/26) 2 1 Overview: Integer Operations Internal representation
More informationUnder the Hood: Data Representation. Computer Science 104 Lecture 2
Under the Hood: Data Representation Computer Science 104 Lecture 2 Admin Piazza, Sakai Up Everyone should have access Homework 1 Posted Due Feb 6 PDF or Plain Text Only: No Word or RTF Recommended: Learn
More informationC NUMERIC FORMATS. Overview. IEEE Single-Precision Floating-point Data Format. Figure C-0. Table C-0. Listing C-0.
C NUMERIC FORMATS Figure C-. Table C-. Listing C-. Overview The DSP supports the 32-bit single-precision floating-point data format defined in the IEEE Standard 754/854. In addition, the DSP supports an
More informationD I G I T A L C I R C U I T S E E
D I G I T A L C I R C U I T S E E Digital Circuits Basic Scope and Introduction This book covers theory solved examples and previous year gate question for following topics: Number system, Boolean algebra,
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 informationECE 2020B Fundamentals of Digital Design Spring problems, 6 pages Exam Two Solutions 26 February 2014
Problem 1 (4 parts, 21 points) Encoders and Pass Gates Part A (8 points) Suppose the circuit below has the following input priority: I 1 > I 3 > I 0 > I 2. Complete the truth table by filling in the input
More informationChapter 1. Digital Systems and Binary Numbers
Chapter 1. Digital Systems and Binary Numbers Tong In Oh 1 1.1 Digital Systems Digital age Characteristic of digital system Generality and flexibility Represent and manipulate discrete elements of information
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 information