Floating Point Arithmetic
|
|
- Anna Byrd
- 6 years ago
- Views:
Transcription
1 Floating Point Arithmetic Floating point numbers are frequently used in many applications. Implementation of arithmetic units such as adder, multiplier, etc for Floating point numbers are more complex than for fixed point arithmetic. In the below sections we discuss the representation of Floating point numbers, the Algorithm for Floating point multiplication, VHDL Implementation of a floating point multiplier & the procedures for Floating point addition, subtraction & division are described. REPRESENTATION OF FLOATING POINT NUMBERS Data type representations in VHDL: Floating Point Types A floating point type has a set of values in a given range of real numbers. Examples of floating point type declarations are type TTL_VOLTAGE is range -5.5 to -1.4; type REAL_DATA is range 0.0 to 31.9; An example of an object declaration is variable LENGTH: REAL_DATA range 0.0 to 15.9;... variable LI, L2, L3: REAL_DATA range 0.0 to 15.9; LENGTH is a variable object of type REAL_DATA that has been constrained to take real values in the range 0.0 through 15.9 only. Notice that in this case, the range constraint was specified in the variable declaration itself. Alternately, it is possible to declare a subtype and then use this subtype in the variable declarations as shown. subtype RD16 is REAL_DATA range 0.0 to 15.9;... variable LENGTH: RD16;... variable Li, L2, L3: RD16; The range bounds specified in a floating point type declaration must be constants or locally static expressions. Floating -point literals are values of a floating point type. Examples of floating point literals are _1.4_2
2 Floating point literals differ from integer literals by the presence of the dot (. ) character. Thus 0 is an integer literal while 0.0 is a floating point literal. Floating point literals can also be expressed in an exponential form. The exponent represents a power of ten and the exponent value must be an integer. Examples are 62.3 E E+2 Integer and floating point literals can also be written in a base other than 10 (decimal). The base can be any value between 2 and 16. Such literals are called based literals. In this case, the exponent represents a power of the specified base. The syntax for a based literal is Examples are base # based-value # -- form 1 base # based-value # E exponent -- form 2 2#101_101_000# represents ( )2 (360) in decimal, 16#FA# represents (FA)16 ( )2 (250) in decimal, 16#E#E1 represents (E)16* (16^1) 14* 16 (224) in decimal, 2# # represents (110.01)2 (6.25) in decimal. The base and the exponent values in a based literal must be in decimal notation. The only predefined floating point type is REAL. The range of REAL is again implementation dependent but it must at least cover the range -I.OE38 to +I.OE38 and it must allow for at least six decimal digits of precision.
3 Computation of floating point values Consider a floating point number N F x 2 E Assume that the fraction F and exponent E are allocated 4 bits each. Example 1. Compute the value of the floating point number N when F & E 0101 Solution: In F the MSB represents the sign bit. Hence 0 represents a positive number. The magnitude of F is calculated as shown in the table. Sign MSB Decimal Point Digits of F Inference Positive fraction F i.e., F ½ + ¼ 5/8 Similarly the magnitude of E is calculated as shown in the table Sign MSB Digits of E Inference Positive exponent E Hence the value of the floating point number N F x 2 E +5/8 x 2 5
4 Example 2. Repeat the above example for F & E 1011 Note : for negative numbers represented in the 2 s complement form the magnitude of the number is computed as (sign bit value) + (magnitude of rest of bits). The magnitude of F is calculated as shown in the table. Magnitude Of bit position Sign (MSB) Decimal Point Digits of F Inference Negative fraction F -1 + ( ) i.e., F -1 + ( ¼ + 1/8) /8-5/8 Similarly the magnitude of E is calculated as shown in the table below Sign (MSB) Digits of E Inference Negative exponent E -8 + (2 + 1) -5 Hence the value of the floating point number N F x 2 E -5/8 x 2-5
5 Normalization of floating point numbers In order to utilize all the bits in F and have the maximum number of significant figures, F should be normalized so that its magnitude is as large as possible. If F is not normalized, we can normalize F by shifting it left until the sign bit and the next bit are different. Shifting F left is equivalent to multiplying by 2, so every time we shift we must decrement E by 1 to keep N the same. After normalization the magnitude of F will be as large as possible, since any further shifting would change the sign bit. In the following examples, F is normalized to start with and then it is normalized by shifting left.
6 Representations for number 0 (zero) Zero can be represented with a 4-bit exponent & a 4-bit fraction as x 2-8 as shown in table below. Zero cannot be normalized, so F when N 0. Any exponent could then be used; however, it is best to have a uniform representation of 0.We will associate the negative exponent with the largest magnitude with the fraction 0. In a 4-bit 2 s complement integer number system, the most negative number is 1000, which represents 8. Thus when F and E are 4 bits, 0 is represented by x 2-8 (negative exponents implies a smaller number. For example 2-2 ¼ 0.25 is smaller than 2-1 ½ 0.5. ) The smallest magnitude of F is calculated as shown in the table. Magnitude Of bit position Sign (MSB) Decimal Point Digits of F Inference positive fraction F 0 Similarly the smallest magnitude of E is calculated as shown in the table below Sign (MSB) Digits of E Inference Negative exponent E -8 + (0) -8 Smallest nonzero positive number that can be represented with a 4-bit exponent & a 4-bit fraction is x x 2-8
7 Floating point operations Floating point Addition Consider the design of an adder for floating point numbers. Two floating point numbers will be added to form a floating point sum ; (F 1 X 2 E1 ) + (F 2 X 2 E2 ) FX2 E Assume that the numbers to be added are properly normalized and that the answer should be put in normalized form. In order to add two fractions, the associated exponents must be equal. Thus, if the exponents E 1, E 2, are different, we must unnormalize one of the fractions and adjust the exponent accordingly. To illustrate the process, we add F 1 x 2 E x 2 5 and F 2 x 2 E x 2 3 Since E 2, E 1, are different we unnormalize F 2 by shifting right two times and adding 2 to the exponent : F x x x 2 5 Note that shifting right one place is equivalent to dividing by 2, so each time we shift we must add 1 to the exponent to compensate. When the exponents are equal, we add the fractions. (0.111 x 2 5) + ( x 2 5 ) x 2 5 This addition caused an overflow into the sign bit position, so we shift right and add 1 to the exponent to correct the fraction overflow. The final result is F x 2 E x 2 6
8 When one of the fractions is negative, the result of adding fractions may be unnormalized, as illustrated in the following example: (1.100 x 2-2 ) + (0.100 x 2-1 ) (1.110 x 2-1 ) + (0.100 x 2-1 ) (after shifting F 1 ) x 2-1 (result of adding fractions is unnormalized) x 2-2 (normalized by shifting left and subtracting 1 from exponent) In summary, the steps required to carry ort floating-point addition are as follows: 1. If the exponents are not equal, shift the fraction with the smaller exponent right and add 1 to its exponent; repeat until the exponents are equal. 2. Add the fractions. 3. (a) If fraction overflow occurs, shift right and add 1 to the exponent to correct the overflow. (b) If the fraction is unnormalized, shift left and subtract 1 from the exponent until the fraction is normalized. (c) If the fraction is 0, set the exponent to the appropriate value. 4. Check for exponent overflow. Step 4 is necessary, since step 3a or 3b may produce an exponent overflow. If E 1 >> E 2 and F 2 is positive, F 2 will become all 0s as we right-shift F 2 to equalize the exponents. In this case, the result is F F 1 and E E 1, so it is a waste of time to do the shifting. If E 1 >> E 2 and F 2 is negative, F 2 will become all 1s (instead of all 0s) as we rightshift F 2 to equalize the exponents. When we add the fractions, we will get the wrong answer. To avoid this problem, we can skip the shifting when E 1 >>E 2 and set F F 1 and E E 1.
9 Similarly, if E 2 >> E 1, we can skip the shifting and set F F 2 and E E 2. For the 4-bit fractions is our example, if E 1 E 2 > 3, we can skip the shifting. Floating-point subtraction Floating-point subtraction is the same as floating-point addition, except in step 2 we must subtract the fractions instead of adding them. Floating-point Division The quotient of two floating-point numbers is (F 1 x 2 E 1) / (F 2 x 2 E 2) (F 1 / F 2 ) X 2 E 1 - E 2 F X 2 E Thus, the basic rule for floating-point division is divide the fractions and subtract the exponents. In addition to considering the same special cases as for multiplication (explained below), we must test for divide the fractions and subtract the exponents. In addition to considering the same special cases as for multiplication, we must test for divide by 0 before dividing. If F 1 and F 2 are normalized, then the largest positive quotient (F) will be / which is less than 10 2, so the fraction overflow is easily corrected. For example, ( ) ( ) Alternatively, if F 1 > F 2, we can shift F 1 right before dividing and avoid fraction overflow in the first place.
10 FLOATING-POINT MULTIPLICATION.Given two floating point numbers, N1 F 1 x 2 E1 & N2 F 2 X 2 E2 the product N1 x N2 is (F 1 x 2 E1 ) x (F 2 x 2 E2 ) (F 1 x F 2 ) x 2 (E1+E2) F x 2 E The fraction part of the product is the product of the fractions - F F 1 x F 2, and the exponent part of the product is the sum of a the exponents E E1+E2. In the algorithm below we assume that F 1 and F 2 are properly normalized to start with, and also that the final result is to be normalized.
11 Special cases Though only multiplying the fractions and adding the exponents is required there are several special cases that must be considered. 1. if F (fraction part of product) is 0, the exponent E must be set to the largest negative value (1000). (refer section on representation of zero) 2. Fraction overflow If multiplication of 1 by 1 (1.000 x 1.000) is carried out the result should be + 1. Since we cannot represent + 1 as 2 s complement fraction, we call this as a special case a fraction overflow. To correct this situation, we set F ½ (0.100) and add 1 to the exponent E. This is justified, since 1 x 2 E ½ x 2 E Normalization of the product Consider the multiplication example given below (0.1x 2 E1 ) x (0.1 x 2 E2 ) 0.01 x 2 E1+E2 0.1x 2 E1+E2-1
12 In this example, we normalize the result (0.01 x 2 E1+E2 ) by shifting the fraction (0.01) left one place (i.e., F becomes 0.1) and subtracting 1 from the exponent to compensate. 4. Exponent overflow If the resulting exponent is too large in magnitude to represent in our number system (i.e., say with 4 bits in our case), we have an exponent overflow. (Sometimes, an overflow in the negative direction is referred to as an underflow). Since we are using 4- bit exponents, if the exponent is not in the range 1000 to 0111 (-8 to +7), an overflow has occurred. Since an exponent overflow cannot be corrected, an overflow, an overflow indicator should be turned on.
13 A flowchart for the floating point multiplier is shown in Figure 1. After the fraction multiply is completed, all the special cases must be tested for. Since we have assumed that F 1 and F 2 are normalized, the smallest possible magnitude for the product is 0.01, (as indicated in the preceding example). Therefore, only one left shift is required to normalize F. Figure 1
14 Hardware for the exponent adder and fraction multiplier The hardware required to implement the floating point multiplier consists of an exponent adder and a fraction multiplier. Exponent adder Since each floating point number has a 4-bit exponent, addition of two 4-bit exponents (E1 & E2) requires a 5-bit adder as shown below
15 Special cases: Examples of exponent overflow: (Maximum allowable value is 7) -7 + (-6) (Most negative allowable value is 8 ) When the exponents are added, an overflow can occur. If E 1 and E 2 are positive and the sum (E) is negative, or if E 1 and E 2 are negative and the sum is positive, the result is a 2 s complement overflow. However, this overflow might be corrected when 1 is added to or subtracted from E during normalization of fraction overflow. To allow for this case, we have made the X register 5 bits long. When E 1 is loaded into X, the sign bit must be extended so that we have a correct 2 s complement representation. Since there are two sign bits, if the addition of E 1 and E 2 produces an overflow, the lower sign bit will get changed, but the high order sign bit will be unchanged. Each of the above examples has an overflow, since the lower sign bit has the wrong value Correction of exponent overflow The input & output signals required for the exponent adder are as follows 1. Load Load E 1, E 2 into the appropriate registers 2. Adx Add exponents; this signal also starts the fraction multiplier. 3. SM8 Set exponent to minus 8 4. RSF Shift fraction right; also increment E. 5. LSF Shift fraction left; also decrement E. 6. V Overflow indicator.
16 FRACTION MULTIPLIER (refer previous chapter for block diagram & working of faster multiplier i.e, 2 s complement multiplier ). Since we are multiplying 3 bits plus sign by 3 bits plus sign, the result will be 6 bits plus sign. After the fraction multiply, the 7-bit result (F) will be the lower 3 bits of A concatenated with B. The control signals required for the fraction multiplier are 1. St Start the floating point multiplication. 2. Mdone Fraction multiply is done 3. Load F 1, F 2, into the appropriate registers (also clear A in preparation for multiplication) 4. Adx this signal starts the fraction multiplier. 5. RSF Shift fraction (F) right; 6. LSF Shift fraction left; 7. MDone Floating point multiplication is complete. The state graph for the multiplier control (Figure 4) is similar to the state graph of 2 s complement multiplier dealt in chapter design of networks for arithmetic operation, except the load state is not needed, because the registers are loaded by the main
17 controller. When Adx 1, the multiplier is started, and done is turned on when the multiplication in completed. Figure 4 : state graph for multiplier control MAIN CONTROLLER FOR FLOATING POINT MULTIPLICATION Fig.2 Block diagram showing the main controller & its I/O signals
18 The SM Chart (Fig.3) for the main controller shown in Fig 2 above of the floating point multiplier is based on the flowchart shown in Fig.1. In the SM chart the controller for the multiplier is a separate state machine, which is linked into the main controller. The SM chart uses the following inputs and control signals 1. St Start the floating point multiplication. 2. Mdone Fraction multiply is done 3. FZ Fraction is Zero 4. FV Fraction overflow. 5. Fnrom F is normalized. 6. EV Exponent overflow 7. Load Load F 1, E 1, F 2, E 2 into the appropriate registers (also clear A in preparation for multiplication) 8. Adx Add exponents; this signal also starts the fraction multiplier. 9. SM8 Set exponent to minus RSF Shift fraction right; also increment E. 11. LSF Shift fraction left; also decrement E. 12. V Overflow indicator. 13. Done Floating point multiplication is complete. The SM chart for the main controller has four states. In S0, the registers are loaded when the start signal is 1. In S1, the exponents are added, and fraction multiply is started. In S2, wait until the fraction multiply is done and then test for special cases and take appropriate action. It may seem surprising that the tests on FZ, FV, and Fnorm can all be done in the same state, since they are done in sequence on the flowchart. However, FZ, FV, and fnorm are generated by combinational circuits that operate in parallel and hence can be tested in the same state. However, we must wait until the exponent has been
19 incremented or decremented at the next clock before we can check for exponent overflow in S3, In S3, the Done signal is turned on and the controller waits for ST 0 before returning to S0. Figure 3: SM Chart for floating-point Multiplication
20 The VHDL behavioral description in the program uses three processes. The main process generated control signals based on the SM chart. A second process generates the control signals for the fraction multiplier. The third process tests the control signals and updates the appropriate registers on the rising edge of the clock. In state S2 of the main process, A 0000 implies that F 0 (FZ 1 on SM chart). If we multiply 1,000 x 1.000, the result is A&B , and a fraction overflow has occurred (FV 1). If A(2) A(1), i.e., the sign bit of F and the following bits are the same then F is unnormalized (Fnorm 0). In state S3, if the two high order bits of X are different, an exponent overflow has occurred (EV 1)
COMPUTER ARCHITECTURE AND ORGANIZATION. Operation Add Magnitudes Subtract Magnitudes (+A) + ( B) + (A B) (B A) + (A B)
Computer Arithmetic Data is manipulated by using the arithmetic instructions in digital computers. Data is manipulated to produce results necessary to give solution for the computation problems. The Addition,
More informationChapter 03: Computer Arithmetic. Lesson 09: Arithmetic using floating point numbers
Chapter 03: Computer Arithmetic Lesson 09: Arithmetic using floating point numbers Objective To understand arithmetic operations in case of floating point numbers 2 Multiplication of Floating Point Numbers
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 informationUNIT - I: COMPUTER ARITHMETIC, REGISTER TRANSFER LANGUAGE & MICROOPERATIONS
UNIT - I: COMPUTER ARITHMETIC, REGISTER TRANSFER LANGUAGE & MICROOPERATIONS (09 periods) Computer Arithmetic: Data Representation, Fixed Point Representation, Floating Point Representation, Addition and
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 information(+A) + ( B) + (A B) (B A) + (A B) ( A) + (+ B) (A B) + (B A) + (A B) (+ A) (+ B) + (A - B) (B A) + (A B) ( A) ( B) (A B) + (B A) + (A B)
COMPUTER ARITHMETIC 1. Addition and Subtraction of Unsigned Numbers The direct method of subtraction taught in elementary schools uses the borrowconcept. In this method we borrow a 1 from a higher significant
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 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 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 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 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 informationChapter 10 - Computer Arithmetic
Chapter 10 - Computer Arithmetic Luis Tarrataca luis.tarrataca@gmail.com CEFET-RJ L. Tarrataca Chapter 10 - Computer Arithmetic 1 / 126 1 Motivation 2 Arithmetic and Logic Unit 3 Integer representation
More informationChapter 4 Section 2 Operations on Decimals
Chapter 4 Section 2 Operations on Decimals Addition and subtraction of decimals To add decimals, write the numbers so that the decimal points are on a vertical line. Add as you would with whole numbers.
More informationThe ALU consists of combinational logic. Processes all data in the CPU. ALL von Neuman machines have an ALU loop.
CS 320 Ch 10 Computer Arithmetic The ALU consists of combinational logic. Processes all data in the CPU. ALL von Neuman machines have an ALU loop. Signed integers are typically represented in sign-magnitude
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 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 informationNumber Systems and Binary Arithmetic. Quantitative Analysis II Professor Bob Orr
Number Systems and Binary Arithmetic Quantitative Analysis II Professor Bob Orr Introduction to Numbering Systems We are all familiar with the decimal number system (Base 10). Some other number systems
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 informationSigned Multiplication Multiply the positives Negate result if signs of operand are different
Another Improvement Save on space: Put multiplier in product saves on speed: only single shift needed Figure: Improved hardware for multiplication Signed Multiplication Multiply the positives Negate result
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 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 informationNumerical Representations On The Computer: Negative And Rational Numbers
Numerical Representations On The Computer: Negative And Rational Numbers How are negative and rational numbers represented on the computer? How are subtractions performed by the computer? Subtraction In
More informationAt the ith stage: Input: ci is the carry-in Output: si is the sum ci+1 carry-out to (i+1)st state
Chapter 4 xi yi Carry in ci Sum s i Carry out c i+ At the ith stage: Input: ci is the carry-in Output: si is the sum ci+ carry-out to (i+)st state si = xi yi ci + xi yi ci + xi yi ci + xi yi ci = x i yi
More informationCMPSCI 145 MIDTERM #1 Solution Key. SPRING 2017 March 3, 2017 Professor William T. Verts
CMPSCI 145 MIDTERM #1 Solution Key NAME SPRING 2017 March 3, 2017 PROBLEM SCORE POINTS 1 10 2 10 3 15 4 15 5 20 6 12 7 8 8 10 TOTAL 100 10 Points Examine the following diagram of two systems, one involving
More informationECE 2030B 1:00pm Computer Engineering Spring problems, 5 pages Exam Two 10 March 2010
Instructions: This is a closed book, closed note exam. Calculators are not permitted. If you have a question, raise your hand and I will come to you. Please work the exam in pencil and do not separate
More informationECE 30 Introduction to Computer Engineering
ECE 30 Introduction to Computer Engineering Study Problems, Set #6 Spring 2015 1. With x = 1111 1111 1111 1111 1011 0011 0101 0011 2 and y = 0000 0000 0000 0000 0000 0010 1101 0111 2 representing two s
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 informationCHAPTER 5: Representing Numerical Data
CHAPTER 5: Representing Numerical Data The Architecture of Computer Hardware and Systems Software & Networking: An Information Technology Approach 4th Edition, Irv Englander John Wiley and Sons 2010 PowerPoint
More informationNumerical Representations On The Computer: Negative And Rational Numbers
Numerical Representations On The Computer: Negative And Rational Numbers How are negative and rational numbers represented on the computer? How are subtractions performed by the computer? Subtraction In
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 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 informationLecture 8: Addition, Multiplication & Division
Lecture 8: Addition, Multiplication & Division Today s topics: Signed/Unsigned Addition Multiplication Division 1 Signed / Unsigned The hardware recognizes two formats: unsigned (corresponding to the C
More informationChapter 5 : Computer Arithmetic
Chapter 5 Computer Arithmetic Integer Representation: (Fixedpoint representation): An eight bit word can be represented the numbers from zero to 255 including = 1 = 1 11111111 = 255 In general if an nbit
More informationUNIVERSITY OF MASSACHUSETTS Dept. of Electrical & Computer Engineering. Digital Computer Arithmetic ECE 666
UNIVERSITY OF MASSACHUSETTS Dept. of Electrical & Computer Engineering Digital Computer Arithmetic ECE 666 Part 4-A Floating-Point Arithmetic Israel Koren ECE666/Koren Part.4a.1 Preliminaries - Representation
More informationIn this lesson you will learn: how to add and multiply positive binary integers how to work with signed binary numbers using two s complement how fixed and floating point numbers are used to represent
More informationExponential Notation
Exponential Notation INTRODUCTION Chemistry as a science deals with the qualitative and quantitative aspects of substances. In the qualitative part, we deal with the general and specific properties of
More informationECE232: Hardware Organization and Design
ECE232: Hardware Organization and Design Lecture 11: Floating Point & Floating Point Addition Adapted from Computer Organization and Design, Patterson & Hennessy, UCB Last time: Single Precision Format
More informationEE260: Logic Design, Spring n Integer multiplication. n Booth s algorithm. n Integer division. n Restoring, non-restoring
EE 260: Introduction to Digital Design Arithmetic II Yao Zheng Department of Electrical Engineering University of Hawaiʻi at Mānoa Overview n Integer multiplication n Booth s algorithm n Integer division
More information4 Operations On Data 4.1. Foundations of Computer Science Cengage Learning
4 Operations On Data 4.1 Foundations of Computer Science Cengage Learning Objectives After studying this chapter, the student should be able to: List the three categories of operations performed on data.
More informationComputer Organisation CS303
Computer Organisation CS303 Module Period Assignments 1 Day 1 to Day 6 1. Write a program to evaluate the arithmetic statement: X=(A-B + C * (D * E-F))/G + H*K a. Using a general register computer with
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 informationCS Computer Architecture. 1. Explain Carry Look Ahead adders in detail
1. Explain Carry Look Ahead adders in detail A carry-look ahead adder (CLA) is a type of adder used in digital logic. A carry-look ahead adder improves speed by reducing the amount of time required to
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 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 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 information3.1 DATA REPRESENTATION (PART C)
3.1 DATA REPRESENTATION (PART C) 3.1.3 REAL NUMBERS AND NORMALISED FLOATING-POINT REPRESENTATION In decimal notation, the number 23.456 can be written as 0.23456 x 10 2. This means that in decimal notation,
More informationArithmetic Logic Unit
Arithmetic Logic Unit A.R. Hurson Department of Computer Science Missouri University of Science & Technology A.R. Hurson 1 Arithmetic Logic Unit It is a functional bo designed to perform "basic" arithmetic,
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 informationChapter 2 Data Representations
Computer Engineering Chapter 2 Data Representations Hiroaki Kobayashi 4/21/2008 4/21/2008 1 Agenda in Chapter 2 Translation between binary numbers and decimal numbers Data Representations for Integers
More informationDigital Arithmetic. Digital Arithmetic: Operations and Circuits Dr. Farahmand
Digital Arithmetic Digital Arithmetic: Operations and Circuits Dr. Farahmand Binary Arithmetic Digital circuits are frequently used for arithmetic operations Fundamental arithmetic operations on binary
More informationComputer Architecture and Organization
3-1 Chapter 3 - Arithmetic Computer Architecture and Organization Miles Murdocca and Vincent Heuring Chapter 3 Arithmetic 3-2 Chapter 3 - Arithmetic Chapter Contents 3.1 Fixed Point Addition and Subtraction
More informationSection 1.4 Mathematics on the Computer: Floating Point Arithmetic
Section 1.4 Mathematics on the Computer: Floating Point Arithmetic Key terms Floating point arithmetic IEE Standard Mantissa Exponent Roundoff error Pitfalls of floating point arithmetic Structuring computations
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 informationUNIT-III COMPUTER ARTHIMETIC
UNIT-III COMPUTER ARTHIMETIC INTRODUCTION Arithmetic Instructions in digital computers manipulate data to produce results necessary for the of activity solution of computational problems. These instructions
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 informationRules of Exponents Part 1[Algebra 1](In Class Version).notebook. August 22, 2017 WARM UP. Simplify using order of operations. SOLUTION.
WARM UP Simplify using order of operations. Aug 22 3:22 PM 1 Aug 22 4:09 PM 2 WARM UP a) The equation 3(4x) = (4x)3 illustrates which property? b) Which property of real numbers is illustrated by the equation
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 informationChapter 2: Number Systems
Chapter 2: Number Systems Logic circuits are used to generate and transmit 1s and 0s to compute and convey information. This two-valued number system is called binary. As presented earlier, there are many
More informationNumber representations
Number representations Number bases Three number bases are of interest: Binary, Octal and Hexadecimal. We look briefly at conversions among them and between each of them and decimal. Binary Base-two, or
More informationGroups of two-state devices are used to represent data in a computer. In general, we say the states are either: high/low, on/off, 1/0,...
Chapter 9 Computer Arithmetic Reading: Section 9.1 on pp. 290-296 Computer Representation of Data Groups of two-state devices are used to represent data in a computer. In general, we say the states are
More informationData Representations & Arithmetic Operations
Data Representations & Arithmetic Operations Hiroaki Kobayashi 7/13/2011 7/13/2011 Computer Science 1 Agenda Translation between binary numbers and decimal numbers Data Representations for Integers Negative
More informationPrinciples of Computer Architecture. Chapter 3: Arithmetic
3-1 Chapter 3 - Arithmetic Principles of Computer Architecture Miles Murdocca and Vincent Heuring Chapter 3: Arithmetic 3-2 Chapter 3 - Arithmetic 3.1 Overview Chapter Contents 3.2 Fixed Point Addition
More informationCPE300: Digital System Architecture and Design
CPE300: Digital System Architecture and Design Fall 2011 MW 17:30-18:45 CBC C316 Arithmetic Unit 10122011 http://www.egr.unlv.edu/~b1morris/cpe300/ 2 Outline Recap Fixed Point Arithmetic Addition/Subtraction
More informationVTU NOTES QUESTION PAPERS NEWS RESULTS FORUMS Arithmetic (a) The four possible cases Carry (b) Truth table x y
Arithmetic A basic operation in all digital computers is the addition and subtraction of two numbers They are implemented, along with the basic logic functions such as AND,OR, NOT,EX- OR in the ALU subsystem
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 informationEE 486 Winter The role of arithmetic. EE 486 : lecture 1, the integers. SIA Roadmap - 2. SIA Roadmap - 1
EE 486 Winter 2-3 The role of arithmetic EE 486 : lecture, the integers M. J. Flynn With increasing circuit density available with sub micron feature sizes, there s a corresponding broader spectrum of
More informationA. Incorrect! To simplify this expression you need to find the product of 7 and 4, not the sum.
Problem Solving Drill 05: Exponents and Radicals Question No. 1 of 10 Question 1. Simplify: 7u v 4u 3 v 6 Question #01 (A) 11u 5 v 7 (B) 8u 6 v 6 (C) 8u 5 v 7 (D) 8u 3 v 9 To simplify this expression you
More informationCHAPTER 1 Numerical Representation
CHAPTER 1 Numerical Representation To process a signal digitally, it must be represented in a digital format. This point may seem obvious, but it turns out that there are a number of different ways to
More informationCOMPUTER ORGANIZATION AND ARCHITECTURE
COMPUTER ORGANIZATION AND ARCHITECTURE For COMPUTER SCIENCE COMPUTER ORGANIZATION. SYLLABUS AND ARCHITECTURE Machine instructions and addressing modes, ALU and data-path, CPU control design, Memory interface,
More informationMicrocomputers. Outline. Number Systems and Digital Logic Review
Microcomputers Number Systems and Digital Logic Review Lecture 1-1 Outline Number systems and formats Common number systems Base Conversion Integer representation Signed integer representation Binary coded
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 informationFLOATING POINT NUMBERS
Exponential Notation FLOATING POINT NUMBERS Englander Ch. 5 The following are equivalent representations of 1,234 123,400.0 x 10-2 12,340.0 x 10-1 1,234.0 x 10 0 123.4 x 10 1 12.34 x 10 2 1.234 x 10 3
More informationAdvanced Computer Architecture-CS501
Advanced Computer Architecture Lecture No. 34 Reading Material Vincent P. Heuring & Harry F. Jordan Chapter 6 Computer Systems Design and Architecture 6.1, 6.2 Summary Introduction to ALSU Radix Conversion
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 informationOrganisasi Sistem Komputer
LOGO Organisasi Sistem Komputer OSK 8 Aritmatika Komputer 1 1 PT. Elektronika FT UNY Does the calculations Arithmetic & Logic Unit Everything else in the computer is there to service this unit Handles
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 informationCOMPUTER ARITHMETIC (Part 1)
Eastern Mediterranean University School of Computing and Technology ITEC255 Computer Organization & Architecture COMPUTER ARITHMETIC (Part 1) Introduction The two principal concerns for computer arithmetic
More informationCS321 Introduction To Numerical Methods
CS3 Introduction To Numerical Methods Fuhua (Frank) Cheng Department of Computer Science University of Kentucky Lexington KY 456-46 - - Table of Contents Errors and Number Representations 3 Error Types
More informationFoundations of Computer Systems
18-600 Foundations of Computer Systems Lecture 4: Floating Point Required Reading Assignment: Chapter 2 of CS:APP (3 rd edition) by Randy Bryant & Dave O Hallaron Assignments for This Week: Lab 1 18-600
More information1. NUMBER SYSTEMS USED IN COMPUTING: THE BINARY NUMBER SYSTEM
1. NUMBER SYSTEMS USED IN COMPUTING: THE BINARY NUMBER SYSTEM 1.1 Introduction Given that digital logic and memory devices are based on two electrical states (on and off), it is natural to use a number
More informationComputer System and programming in C
1 Basic Data Types Integral Types Integers are stored in various sizes. They can be signed or unsigned. Example Suppose an integer is represented by a byte (8 bits). Leftmost bit is sign bit. If the sign
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 informationMIPS Integer ALU Requirements
MIPS Integer ALU Requirements Add, AddU, Sub, SubU, AddI, AddIU: 2 s complement adder/sub with overflow detection. And, Or, Andi, Ori, Xor, Xori, Nor: Logical AND, logical OR, XOR, nor. SLTI, SLTIU (set
More informationECE 2030D Computer Engineering Spring problems, 5 pages Exam Two 8 March 2012
Instructions: This is a closed book, closed note exam. Calculators are not permitted. If you have a question, raise your hand and I will come to you. Please work the exam in pencil and do not separate
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 informationDEPARTMENT OF MATHS, MJ COLLEGE
T. Y. B.Sc. Mathematics MTH- 356 (A) : Programming in C Unit 1 : Basic Concepts Syllabus : Introduction, Character set, C token, Keywords, Constants, Variables, Data types, Symbolic constants, Over flow,
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 7 Number System and Bases. 7.1 Number System. 7.2 Binary Numbers. 7.3 Adding and Subtracting Binary Numbers. 7.4 Multiplying Binary Numbers
Contents STRAND B: Number Theory Unit 7 Number System and Bases Student Text Contents Section 7. Number System 7.2 Binary Numbers 7.3 Adding and Subtracting Binary Numbers 7.4 Multiplying Binary Numbers
More information60-265: Winter ANSWERS Exercise 4 Combinational Circuit Design
60-265: Winter 2010 Computer Architecture I: Digital Design ANSWERS Exercise 4 Combinational Circuit Design Question 1. One-bit Comparator [ 1 mark ] Consider two 1-bit inputs, A and B. If we assume that
More informationDigital Logic. The Binary System is a way of writing numbers using only the digits 0 and 1. This is the method used by the (digital) computer.
Digital Logic 1 Data Representations 1.1 The Binary System The Binary System is a way of writing numbers using only the digits 0 and 1. This is the method used by the (digital) computer. The system we
More informationComputer Architecture Chapter 3. Fall 2005 Department of Computer Science Kent State University
Computer Architecture Chapter 3 Fall 2005 Department of Computer Science Kent State University Objectives Signed and Unsigned Numbers Addition and Subtraction Multiplication and Division Floating Point
More information±M R ±E, S M CHARACTERISTIC MANTISSA 1 k j
ENEE 350 c C. B. Silio, Jan., 2010 FLOATING POINT REPRESENTATIONS It is assumed that the student is familiar with the discussion in Appendix B of the text by A. Tanenbaum, Structured Computer Organization,
More informationChapter 5: Computer Arithmetic. In this chapter you will learn about:
Slide 1/29 Learning Objectives In this chapter you will learn about: Reasons for using binary instead of decimal numbers Basic arithmetic operations using binary numbers Addition (+) Subtraction (-) Multiplication
More informationAn instruction set processor consist of two important units: Data Processing Unit (DataPath) Program Control Unit
DataPath Design An instruction set processor consist of two important units: Data Processing Unit (DataPath) Program Control Unit Add & subtract instructions for fixed binary numbers are found in the
More informationLe L c e t c ur u e e 2 To T p o i p c i s c t o o b e b e co c v o e v r e ed e Variables Operators
Course Name: Advanced Java Lecture 2 Topics to be covered Variables Operators Variables -Introduction A variables can be considered as a name given to the location in memory where values are stored. One
More informationFloating Point Arithmetic
Floating Point Arithmetic Clark N. Taylor Department of Electrical and Computer Engineering Brigham Young University clark.taylor@byu.edu 1 Introduction Numerical operations are something at which digital
More informationBy, Ajinkya Karande Adarsh Yoga
By, Ajinkya Karande Adarsh Yoga Introduction Early computer designers believed saving computer time and memory were more important than programmer time. Bug in the divide algorithm used in Intel chips.
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 representations
Lecture 10 Floating-point representations Methods of representing real numbers (1) 1. Fixed-point number system limited range and/or limited precision results must be scaled 100101010 1111010 100101010.1111010
More informationLearning Objectives. Binary over Decimal. In this chapter you will learn about:
Ref Page Slide 1/29 Learning Objectives In this chapter you will learn about: Reasons for using binary instead of decimal numbers Basic arithmetic operations using binary numbers Addition (+) Subtraction
More information