Binary Representation and Computer Arithmetic


 Elfreda McGee
 1 years ago
 Views:
Transcription
1 Binary Representation and Computer Arithmetic The decimal system of counting and keeping track of items was first created by Hindu mathematicians in India in A.D. 4. Since it involved the use of fingers and thumbs, it was natural that this system would have digits. The system found its way to all the Arab countries by A.D. 8, where it was named the Arabic number system, and from there it was eventually adopted by nearly all the European countries by A.D. 2, where it was called the decimal number system. The key feature that distinguishes one number system from another is the number system's base or radix. This base indicates the number of digits that will be used. The decimal number system, for example, is a base number system which means that it uses digits ( to 9) to communicate information about an amount. A subscript is something included after a number when different number systems are being used to indicate the base of the number. For example 5327 would represent a number in base 7 (using the digits to 6) number system. and 2 are two numbers which contain the same digits but which are written using different bases. The first number we recognize as one thousand one hundred in the decimal (base ) number system. The second number is a number in the base 2 number system called the binary number system. The Decimal System This uses ten digits (,, 2, 3, 4, 5, 6, 7, 8, 9) to represent numbers. Consider a decimal number, 847. This means eight hundreds, four tens plus seven. 847 = 8* + 4* + 7 The system has a base or radix of ten. This means that each digit in a decimal number is multiplied by ten raised to a power corresponding to its position. Thus 847 = 8 * * + 7 * Fractional values can be represented in the same way = 4 * * + 2 * + 8 * * 2 The Binary System The binary system uses just two digits, and, as it is easier for a computer to distinguish between two different voltage levels than ten. This means that it has a base of two. Each digit in a binary number is multiplied by two raised to a power corresponding to its position. = * * * 2 + * 2 = * 8 + * 4 + * 2 + = When confusion is possible, we can show the base of a number by using a subscript. For example, 2 = Converting Decimal Numbers to Binary Numbers
2 To convert a decimal number to binary, we can also use repeated division and note the remainder after each division. Example..5 Convert 837 to binary. 837 converted to a binary number: Division Remainder LSD MSD Note that the first remainder gives the LSD and the last remainder the MSD. Then, 837 = 2 Check: 2 = = 837 Octal and Hexadecimal Notation Binary notation is extremely awkward for humans to use, so other notations are common. Decimal notation is of course easy for us to use, but has the disadvantage that conversion between decimal and binary is complicated. One system which is sometimes used is octal. This system uses the first eight digits of the decimal system to represent groups of three bits, and so is base 8. For example, 2 = 53
3 The leading before the number 53 is a common way to indicate an octal number. This has the disadvantage that three does not go into eight, and as we have seen the fundamental unit of information is a chunk of eight bits. Therefore, another commonly used notation is hexadecimal, or simply hex. This breaks the data into nybbles (nibbles) (four bit chunks), so each byte may be represented by two hex digits. Unfortunately, this makes hexadecimal notation base 6 (hence the name), and so we must use the first six letters of the alphabet as well as the ten digits of the decimal system. For example, 2 = xbc The leading x before the number is a common way to indicate a hexadecimal number. Binary Arithmetic The basic rules for binary addition are listed in the table below. Rule Rule 2 Rule 3 Rule 4 Rule The basic rules for binary subtraction are listed in the table below. Rule Rule 2 Rule 3 Rule ALL ABOUT INTEGER REPRESENTATION Computers operate on binary values (as a result of being built from transistors). There are different binary representations for integers possible qualifications:. Positive numbers only 2. Positive and negative numbers 3. Ease of human readability 4. Speed of computer operations There are 4 commonly known ( not common) integer reprentations. All have been used at various times for various reasons.. Unsigned 2. Sign magnitude 3. One's complement 4. Two's complement 5. biased (not commonly known)
4 Virtually all modern computers operate based on 2's complement representation. Why?. Hardware is faster 2. Hardware is simpler (which makes it faster) UNSIGNED The standard binary encoding already given Only positive values Range: to 2**n , for n bits Example: 4 bits, values to 5 n=4, 2**4  is 5 Binary dec. hex binary decimal hex a 3 3 b c d e f SIGN MAGNITUDE A human readable way of getting both positive and negative integers. The hardware that does arithmetic on sign magnitude integers is not fast, and it is more complex than the hardware that does arithmetic on 's comp. and 2's comp. integers. Use bit of integer to represent the sign of the integer Let sign bit of be positive, be negative. The rest of the integer is a magnitude, using same encoding as unsigned integers Example: 4 bits is 5 is 5 To get the additive inverse of a number, just flip (not, invert, complement, negate) the sign bit. range: (2**(n)) + to 2**(n)  where n is the number of bits 4 bits, 7 to +7 n=4,  2**3 + to 2** to 8 
5 Because of the sign bit, there are 2 representations for. This is a problem for hardware... is, is The computer must do all calculations such that they come out correctly and the same whichever representation is used. ONE's COMPLEMENT Historically important, and we use this representation to get 2's complement integers. Now, nobody builds machines that are based on 's comp. integers. In the past, early computers built by Semour Cray (while at CDC) were based on 's comp. integers. Positive integers use the same representation as unsigned. is is 7, etc. The formal way to determine the 's complement in binary of a negative integer uses the following rule: Rule: The 's complement in binary of a negative integer is obtained by subtracting its magnitude from 2 n  where n is the number of bits used to store the integer in binary. Example Store the integer 36 in a byte in 's complement form. Step : +36 = 2 [convert the magnitude of the integer to binary] Step 2:  A byte contains 8 bits. Therefore, subtract from = 255. In binary 255 is. However, we note the following: Using a byte, the 's complement of +36 is Using a byte, the 's complement of 36 is If these representations are compared bit by bit, one can see that corresponding bits are inverted. Negation (finding an additive inverse) is done by taking a bitwise complement of the positive representation. COMPLEMENT. INVERT. NOT. FLIP. NEGATE. A logical operation done on a single bit The complement of is. The complement of is.  > take +, Complement each bit
6 That is . Don t add or take away any bits. EXAMPLES: this must be a negative number. to find out which, find the additive inverse! is +3 by sight, so must be 3 Things to notice:. any negative number will have a in the MSB. 2. There are 2 representations for, and. Converting from 's Complement Notation to Decimal Notation Case : The MSB of the Byte is If a byte contains, for example, which represents an integer stored in 's complement form, we know that since the MSB =, this is a positive integer. The decimal integer value of the byte then is : This indicates the integer is positive Therefore which represent a binary number in 's complement form is the decimal integer = +89 Case 2: The MSB of the Byte is Add the Weight of all Bits Containing a Convert to decimal. The MSB has value. Therefore, the integer is negative. Bits 5, 4, 3 and have value. Therefore, the integer value is ( ) = 57. These steps are summarized in the following table: Binary Number in 's Complement Notation Weight of Bits Containing 's This is the sign bit indicating the integer is negative Therefore which represents a binary number stored in 's complement notation has decimal value ( ) = 57 TWO's COMPLEMENT
7 Rule: To determine the 2's complement of a negative integer, determine the 's complement and add. A variation on 's complement that does NOT have 2 representations for. This makes the hardware that does arithmetic faster than for the other representations. A 3 bit example: Bit pattern: 's comp: 's comp.: The negative values are all "slid" down by one, eliminating the extra zero representation. Example Store 27 in a byte using 2's complement notation. Steps and 2 determine the 's complement: Step : +27 in binary is. Step 2: Invert bits to yield. Then the 's complement of 27 is. Step 3 is the additional step needed to find the 2's complement. Step 3: Add to the 's complement: + The 2's complement of 27 is. Finding the Decimal Integer Values of Positive and Negative Numbers Stored in Bytes in 2's Complement Form Case : The MSB of the Byte is If a byte contains the integer in 2's complement form, we know that since the MSB =, this is a positive integer. The integer value of the byte then is = +89 in decimal. Case 2: The MSB of the Byte is If a byte contains the integer in 2'complement form, we know that since the MSB =, the integer is negative. The quickest way to find the decimal value for the integer is to add the weight of all columns containing a and then add to the result. The decimal integer value of is Sign
8 represents the integer 39 (Remember to add +) Check: Write 39 in 2's complement byte form: Step Procedure 2 Write +39 in binary 39 = Take the one's complement (invert the contents of the byte) Binary Answer in Byte Form 3 Add to the LSB + The answer is the two's complement of 39. Therefore we store the integer 39 in a byte in 2's complement form as. This is the binary representation in 2's complement form that we were asked to convert to a decimal integer. BIASED REPRESENTATION An integer representation that skews the bit patterns so as to look just like unsigned but actually represents negative numbers. Examples: given 4 bits, we BIAS values by 2**3 (8) TRUE VALUE to be represented 3 Add in the bias Unsigned value So the bit pattern of 3 in 4bit biased8 representation will be Going the other way, suppose we were given a biased8 representation as Unsigned represent 6 Subtract out the bias TRUE VALUE represented 2 This representation allows operations on the biased numbers to be the same as for unsigned integers, but actually represents both positive and negative values. Choosing a bias: The bias chosen is most often based on the number of bits available for representing an integer. To get an approx. equal distribution of true values above and below, the bias should be 2 ** (n) or (2**(n))  Two's Complement Arithmetic To perform mathematical functions, a computer's central processing unit, or CPU, contains several circuits, and one of these circuits is called the arithmeticlogic unit or ALU.
9 This unit is the number crunching circuit of every digital system, and, as its name implies, it can be controlled to perform arithmetic operations such as addition and subtraction or logic operations such as AND and OR A schematic of a simplified ALU is drawn below. You can see that the arithmeticlogic unit has two parallel inputs, one parallel output, and a set of function select control lines. If we wanted to add two integers, for example, the two integers would be retrieved, probably from memory, and would become inputs to the ALU. The function select part of the ALU would allow the decision to be made to add the numbers. The integers would be added [we shall describe how that addition occurs electronically in the next unit] most likely using 2's complement arithmetic. The sum of the integers would be the output from the ALU. The schematic and the explanation of addition are highly simplified. For example, the Intel Pentium 4 microprocessor has 6 integer execution units, and each of them has a 32bit ALU. A schematic of a simplified ALU is drawn below. You can see that the arithmeticlogic unit has two parallel inputs, one parallel output, and a set of function select control lines. If we wanted to add two integers, for example, the two integers would be retrieved, probably from memory, and would become inputs to the ALU. The function select part of the ALU would allow the decision to be made to add the numbers. The integers would be added [we shall describe how that addition occurs electronically in the next unit] most likely using 2's complement arithmetic. The sum of the integers would be the output from the ALU. The schematic and the explanation of addition are highly simplified. For example, the Intel Pentium 4 microprocessor has 6 integer execution units, and each of them has a 32bit ALU. The ALU has to be able to perform the four basic operations, namely addition, subtraction, multiplication and division. The fact that all numbers are stored in 2's complement form allows the ALU to use just one circuit for all four basic mathematical operations of addition, subtraction, multiplication and division. Multiplications can be thought of as repeated additions and divisions as repeated subtractions. Adding Positive Integers in 2's Complement Form
10 In the examples that follow, variables will be used to represent integers. This is consistent with what actually happens when you process numbers in a computer. When you write a computer program, you may include statements such as cost = sales_tax = 7 total_cost = cost + sales_tax When the program is run, the variable names cost and sales_tax and their values would be stored in the computer's memory. The value of the variable total_cost would be determined by retrieving the values of cost and sales tax and inputting them to the ALU. After the values of the variables are added in the ALU, the output would be the value of the variable total_cost. And, of course, every letter of every variable would be stored in a byte [likely in ASCII form] as a true binary number. The values of the variables would be stored as signed number in 2's complement form. We want to look now at how signed integers such as + and +7, stored using 2's complement notation, are added and subtracted. Example.6. If R = +9 and S = +5, find R + S in byteform using 2's complement notation. Solution: Each of the integers is written in 2's complement notation [remember that these representations are the same as signmagnitude notation.] The two integers are then added using regular binary addition. Decimal Addition 2's Complement Addition Overflow in Binary Addition The largest positive integer that can be stored in a byte in 2's complement form is +27, that is. Therefore, any time two positive 2's complement integers are added and the sum of the integers is greater than +27 an overflow will occur. This situation is illustrated in Example.6.2 when + and +3 are added. Example.6.2 If R = + and S = +3, find R + S Solution: Decimal Addition 2's Complement Addition
11 +3 The sum of the two integers here is indicated to be. Clearly, this sum cannot be a correct representation of the actual sum of +3 because the MSB is which indicates that this binary expression represents a negative number in 2's complement notation. [What negative integer is represented by? How is this related to the actual sum of + and +3?] If we designed a circuit to add two positive numbers, some part of the circuit would have to determine when an overflow occurs. The rule is: 2's complement overflow occurs when the carry into the MSB is not equal to the carry out from the MSB. An overflow detector circuit makes this determination. The schematic below illustrates this concept. The concept of overflow is examined by looking again at Example.6. and Example.6.2. Example.6. Add +9 and +5 using 2's complement notation. Decimal Addition 2's Complement Addition The following graphic illustrates what happens in bits 5, 6 and 7 as they are added. In particular, we are interested in the values of the carry in to byte 7 and the carry out from byte 7. If they are equal, no overflow occurs.
12 Both the carry in and carry out values for bit 7, the MSB, have value. No overflow occurs. Example.6.2 Add + and +3. Show that an overflow occurs by checking the carry in to and the carry out from the MSB of the sum. Decimal Addition 2's Complement Addition
13 The carry in to the MSB of is not equal to the carry out of from the MSB. An overflow occurs. Subtraction with One's Complement Let's consider how we would solve our problem of subtracting from 7 using 's complement.. First, we need to convert 2 to its negative equivalent in 's complement. 2. To do this we change all the 's to 's and 's to 's. Notice that the mostsignificant digit is now since the number is negative. 3. Next, we add the negative value we computed to 2. This gives us a result of Notice that our addition caused an overflow bit. Whenever we have an overflow bit in 's complement, we add this bit to our sum to get the correct answer. If there is no overflow bit, then we leave the sum as it is. 5. This gives us a final answer of 2 (or 6 ). (7)   () > (7) + +() (?) + (6) (7)   () (6) Now let's look at an example where our problem does not generate an overflow bit. We will subtract 7 from using 's complement.. First, we state our problem in binary. ()   (7)
14 2. Next, we convert 2 to its negative equivalent and add this to This time our results does not cause an overflow, so we do not need to adjust the sum. Notice that our final answer is a negative number since it begins with a. Remember that our answer is in 's complement notation so the correct decimal value for our answer is 6 and not 9. () + +(7) (?) () + +(7) (6) REPRESENTATION OF FLOATING POINT NUMBERS Computers represent real values in a form similar to that of scientific notation. There are standards which define what the representation means so that across computers there will be consistency. Note that this is not the only way to represent floating point numbers, it is just the IEEE standard way of doing it. Here's what we do: the representation S E F S is one bit representing the sign of the number E is an 8 bit biased integer representing the exponent F is an unsigned integer The value represented is: () S x F x 2 E Where e = E  bias f = F/2 n + For single precision numbers (the emphasis in this class) n = 23 Bias = 27 Now, what does all this mean? (Everything here is for IEEE single precision floating point representation.) > S, E, F all represent fields within a representation. Each is just a bunch of bits. > S is just a sign bit. for positive, for negative. > E is an exponent field. The E field is a biased27 representation. So, the true exponent represented is (E  bias). The radix for the number is ALWAYS 2.
15 Note: Computers that did not use this representation, like those built before the standard, did not always use a radix of 2. Example: some IBM machines had radix of 6. > F is the mantissa. It is in a somewhat modified form. There are 23 bits available for the mantissa. It turns out that if fl. pt. numbers are always stored in a normalized form, then the leading bit (the one on the left, or MSB) is always a. So, why store it at all? It gets put back into the number (giving 24 bits of precision for the mantissa) for any calculation, but we only have to store 23 bits. This MSB is called the HIDDEN BIT. An example: put the decimal number 64.2 into the IEEE single precision representation. First step: Get a binary representation for 64.2 To do this, get binary reps. for the stuff to the left and right of the decimal point separately. 64 is.2 can be gotten using the algorithm:.2 x 2 =.4 (msb).4 x 2 =.8.8 x 2 =.6.6 x 2 =.2.2 x 2 =.4 now this whole pattern () repeats..4 x 2 =.8.8 x 2 =.6.6 x 2 =.2 So a binary representation for.2 is.... Putting the halves back together again: 64.2 is.... Second step: Normalize the binary representation. (make it look like scientific notation) x 2 Third step: Represent exponent in the standard form(biased) 6 is the true exponent. For the standard form, it needs to be in biased27 form (value of biased exponent) 33 in 8 bit, unsigned representation is
16 This is bit pattern used for E in the standard form. Fourth step: The mantissa stored (F) is the stuff to the right of the radix point in the normal form. We need 23 bits of it. Put it all together (and include the correct sign bit): S E F The values are often given in hex, so here it is x Or h Some extra details: > Since floating point numbers are always stored in normal form, how do we represent? (What does the fl. pt. number x3f8 represent?) (What does the fl. pt. number x8 represent?) We take the bit patterns x and x8 to represent the value. (What fl. pt. numbers cannot be represented because of this?) > Other special values: +infinity... (x7f8 ) infinity... (xff8 ) NaN (Not a Number)??????... (S is either or, E=xff, and F is anything but all zeros) Example Notation Value Ordinary Decimal Scientific Decimal.7825 E 2 Scientific Binary. E 2 Scientific Binary (Biased Exponent). E 2 SingleReal Format Sign Biased Exponent Normalized Significand (. implied => JBit)
17 When performing normalized floatingpoint computations, an FPU normally operates on normalized numbers and produces normalized numbers as results. Denormalized numbers represent an underflow condition. A denormalized number is computed through a technique called gradual underflow. Table 2 gives an example of gradual underflow in the denormalization process. Here the singlereal format is being used, so the minimum exponent (unbiased) is 26. The true result in this example requires an exponent of 29 in order to have a normalized number. Since 29 is beyond the allowable exponent range, the result is denormalized by inserting leading zeros until the minimum exponent of 26 is reached. Operation Sign Exponent* Significand True Result Denormalize Denormalize Denormalize Denormal Result NOTE: * Expressed as an unbiased, decimal number. Table 2: Denormalization Process In the extreme case, all the significant bits are shifted out to the right by leading zeros, creating a zero result. The FPU deals with denormal values in the following ways: It avoids creating denormals by normalizing numbers whenever possible. It provides the floatingpoint underflow exception to permit programmers to detect cases when denormals are created. It provides the floatingpoint denormaloperand exception to permit procedures or programs to detect when denormals are being used as source operands for computations. BINARY CODED DECIMAL In today s technology, you hear a great deal about microprocessors. A microprocessor is an integrated circuit designed for two purposes: data processing and control. Computers and microprocessors both operate on a series of electrical pulses called words. A word can be represented by a binary number such as 2. Binarycoded decimal, or BCD, is a method of using binary digits to represent the decimal digits through 9. A decimal digit is represented by four binary digits, as shown below:
18 Example Represent 49 in BCD 4 > 9 > Therefore, 49 in BCD is BCD REFERENCES
198:211 Computer Architecture
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 1 Computer Architecture What do computers do? Manipulate stored
More informationOct: 50 8 = 6 (r = 2) 6 8 = 0 (r = 6) Writing the remainders in reverse order we get: (50) 10 = (62) 8
ECE Department Summer LECTURE #5: Number Systems EEL : Digital Logic and Computer Systems Based on lecture notes by Dr. Eric M. Schwartz Decimal Number System: Our standard number system is base, also
More informationBinary Division. Decimal Division. Hardware for Binary Division. Simple 16bit Divider Circuit
Decimal Division Remember 4th grade long division? 43 // quotient 12 521 // divisor dividend 480 4136 5 // remainder Shift divisor left (multiply by 10) until MSB lines up with dividend s Repeat until
More informationFractional Numbers. Fractional Number Notations. Fixedpoint Notation. Fixedpoint Notation
2 Fractional Numbers Fractional Number Notations 2010  Claudio Fornaro Ver. 1.4 Fractional numbers have the form: xxxxxxxxx.yyyyyyyyy where the x es constitute the integer part of the value and the y
More informationNumbering Systems. InThisAppendix...
G InThisAppendix... Introduction Binary Numbering System Hexadecimal Numbering System Octal Numbering System Binary Coded Decimal (BCD) Numbering System Real (Floating Point) Numbering System BCD/Binary/Decimal/Hex/Octal
More informationThe string of digits 101101 in the binary number system represents the quantity
Data Representation Section 3.1 Data Types Registers contain either data or control information Control information is a bit or group of bits used to specify the sequence of command signals needed for
More informationThis Unit: Floating Point Arithmetic. CIS 371 Computer Organization and Design. Readings. Floating Point (FP) Numbers
This Unit: Floating Point Arithmetic CIS 371 Computer Organization and Design Unit 7: Floating Point App App App System software Mem CPU I/O Formats Precision and range IEEE 754 standard Operations Addition
More informationDivide: Paper & Pencil. Computer Architecture ALU Design : Division and Floating Point. Divide algorithm. DIVIDE HARDWARE Version 1
Divide: Paper & Pencil Computer Architecture ALU Design : Division and Floating Point 1001 Quotient Divisor 1000 1001010 Dividend 1000 10 101 1010 1000 10 (or Modulo result) See how big a number can be
More informationSigned Binary Arithmetic
Signed Binary Arithmetic In the real world of mathematics, computers must represent both positive and negative binary numbers. For example, even when dealing with positive arguments, mathematical operations
More informationComputer Science 281 Binary and Hexadecimal Review
Computer Science 281 Binary and Hexadecimal Review 1 The Binary Number System Computers store everything, both instructions and data, by using many, many transistors, each of which can be in one of two
More informationLecture 2. Binary and Hexadecimal Numbers
Lecture 2 Binary and Hexadecimal Numbers Purpose: Review binary and hexadecimal number representations Convert directly from one base to another base Review addition and subtraction in binary representations
More informationLSN 2 Number Systems. ECT 224 Digital Computer Fundamentals. Department of Engineering Technology
LSN 2 Number Systems Department of Engineering Technology LSN 2 Decimal Number System Decimal number system has 10 digits (09) Base 10 weighting system... 10 5 10 4 10 3 10 2 10 1 10 0. 101 102 103
More informationECE 0142 Computer Organization. Lecture 3 Floating Point Representations
ECE 0142 Computer Organization Lecture 3 Floating Point Representations 1 Floatingpoint arithmetic We often incur floatingpoint programming. Floating point greatly simplifies working with large (e.g.,
More informationBinary Numbers. Bob Brown Information Technology Department Southern Polytechnic State University
Binary Numbers Bob Brown Information Technology Department Southern Polytechnic State University Positional Number Systems The idea of number is a mathematical abstraction. To use numbers, we must represent
More informationNumber Systems, Base Conversions, and Computer Data Representation
, Base Conversions, and Computer Data Representation Decimal and Binary Numbers When we write decimal (base 10) numbers, we use a positional notation system. Each digit is multiplied by an appropriate
More informationRestoring division. 2. Run the algorithm Let s do 0111/0010 (7/2) unsigned. 3. Find remainder here. 4. Find quotient here.
Binary division Dividend = divisor q quotient + remainder CS/COE447: Computer Organization and Assembly Language Given dividend and divisor, we want to obtain quotient (Q) and remainder (R) Chapter 3 We
More informationLevent EREN levent.eren@ieu.edu.tr A306 Office Phone:4889882 INTRODUCTION TO DIGITAL LOGIC
Levent EREN levent.eren@ieu.edu.tr A306 Office Phone:4889882 1 Number Systems Representation Positive radix, positional number systems A number with radix r is represented by a string of digits: A n
More informationEE 261 Introduction to Logic Circuits. Module #2 Number Systems
EE 261 Introduction to Logic Circuits Module #2 Number Systems Topics A. Number System Formation B. Base Conversions C. Binary Arithmetic D. Signed Numbers E. Signed Arithmetic F. Binary Codes Textbook
More information1. Give the 16 bit signed (twos complement) representation of the following decimal numbers, and convert to hexadecimal:
Exercises 1  number representations Questions 1. Give the 16 bit signed (twos complement) representation of the following decimal numbers, and convert to hexadecimal: (a) 3012 (b)  435 2. For each of
More informationBase Conversion written by Cathy Saxton
Base Conversion written by Cathy Saxton 1. Base 10 In base 10, the digits, from right to left, specify the 1 s, 10 s, 100 s, 1000 s, etc. These are powers of 10 (10 x ): 10 0 = 1, 10 1 = 10, 10 2 = 100,
More informationBinary Representation. Number Systems. Base 10, Base 2, Base 16. Positional Notation. Conversion of Any Base to Decimal.
Binary Representation The basis of all digital data is binary representation. Binary  means two 1, 0 True, False Hot, Cold On, Off We must be able to handle more than just values for real world problems
More informationDecimal Numbers: Base 10 Integer Numbers & Arithmetic
Decimal Numbers: Base 10 Integer Numbers & Arithmetic Digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 Example: 3271 = (3x10 3 ) + (2x10 2 ) + (7x10 1 )+(1x10 0 ) Ward 1 Ward 2 Numbers: positional notation Number
More informationquotient = dividend / divisor, with a remainder Given dividend and divisor, we want to obtain quotient (Q) and remainder (R)
Binary division quotient = dividend / divisor, with a remainder dividend = divisor quotient + remainder Given dividend and divisor, we want to obtain quotient (Q) and remainder (R) We will start from our
More informationUseful Number Systems
Useful Number Systems Decimal Base = 10 Digit Set = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9} Binary Base = 2 Digit Set = {0, 1} Octal Base = 8 = 2 3 Digit Set = {0, 1, 2, 3, 4, 5, 6, 7} Hexadecimal Base = 16 = 2
More informationBinary Numbers. Binary Octal Hexadecimal
Binary Numbers Binary Octal Hexadecimal Binary Numbers COUNTING SYSTEMS UNLIMITED... Since you have been using the 10 different digits 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9 all your life, you may wonder how
More informationplc numbers  13.1 Encoded values; BCD and ASCII Error detection; parity, gray code and checksums
plc numbers  3. Topics: Number bases; binary, octal, decimal, hexadecimal Binary calculations; s compliments, addition, subtraction and Boolean operations Encoded values; BCD and ASCII Error detection;
More information4 Operations On Data
4 Operations On Data 4.1 Source: Foundations of Computer Science Cengage Learning Objectives After studying this chapter, students should be able to: List the three categories of operations performed on
More informationChapter 6 Digital Arithmetic: Operations & Circuits
Chapter 6 Digital Arithmetic: Operations & Circuits Chapter 6 Objectives Selected areas covered in this chapter: Binary addition, subtraction, multiplication, division. Differences between binary addition
More informationTo convert an arbitrary power of 2 into its English equivalent, remember the rules of exponential arithmetic:
Binary Numbers In computer science we deal almost exclusively with binary numbers. it will be very helpful to memorize some binary constants and their decimal and English equivalents. By English equivalents
More informationSimulation & Synthesis Using VHDL
Floating Point Multipliers: Simulation & Synthesis Using VHDL By: Raj Kumar Singh  B.E. (Hons.) Electrical & Electronics Shivananda Reddy  B.E. (Hons.) Electrical & Electronics BITS, PILANI Outline Introduction
More informationCPEN 214  Digital Logic Design Binary Systems
CPEN 4  Digital Logic Design Binary Systems C. Gerousis Digital Design 3 rd Ed., Mano Prentice Hall Digital vs. Analog An analog system has continuous range of values A mercury thermometer Vinyl records
More informationCSI 333 Lecture 1 Number Systems
CSI 333 Lecture 1 Number Systems 1 1 / 23 Basics of Number Systems Ref: Appendix C of Deitel & Deitel. Weighted Positional Notation: 192 = 2 10 0 + 9 10 1 + 1 10 2 General: Digit sequence : d n 1 d n 2...
More information2011, The McGrawHill Companies, Inc. Chapter 3
Chapter 3 3.1 Decimal System The radix or base of a number system determines the total number of different symbols or digits used by that system. The decimal system has a base of 10 with the digits 0 through
More informationELECTRICAL AND COMPUTER ENGINEERING DEPARTMENT, OAKLAND UNIVERSITY ECE470/570: MicroprocessorBased System Design Fall 2014.
REVIEW OF NUMBER SYSTEMS Notes Unit 2 BINARY NUMBER SYSTEM In the decimal system, a decimal digit can take values from to 9. For the binary system, the counterpart of the decimal digit is the binary digit,
More informationNumber Representation
Number Representation CS10001: Programming & Data Structures Pallab Dasgupta Professor, Dept. of Computer Sc. & Engg., Indian Institute of Technology Kharagpur Topics to be Discussed How are numeric data
More informationThe Essentials of Computer Organization and Architecture. Linda Null and Julia Lobur Jones and Bartlett Publishers, 2003
The Essentials of Computer Organization and Architecture Linda Null and Julia Lobur Jones and Bartlett Publishers, 2003 Chapter 2 Instructor's Manual Chapter Objectives Chapter 2, Data Representation,
More informationCDA 3200 Digital Systems. Instructor: Dr. Janusz Zalewski Developed by: Dr. Dahai Guo Spring 2012
CDA 3200 Digital Systems Instructor: Dr. Janusz Zalewski Developed by: Dr. Dahai Guo Spring 2012 Outline Data Representation Binary Codes Why 6311 and Excess3? Data Representation (1/2) Each numbering
More informationLecture 11: Number Systems
Lecture 11: Number Systems Numeric Data Fixed point Integers (12, 345, 20567 etc) Real fractions (23.45, 23., 0.145 etc.) Floating point such as 23. 45 e 12 Basically an exponent representation Any number
More informationSection 1.4 Place Value Systems of Numeration in Other Bases
Section.4 Place Value Systems of Numeration in Other Bases Other Bases The HinduArabic system that is used in most of the world today is a positional value system with a base of ten. The simplest reason
More informationSystems I: Computer Organization and Architecture
Systems I: Computer Organization and Architecture Lecture 2: Number Systems and Arithmetic Number Systems  Base The number system that we use is base : 734 = + 7 + 3 + 4 = x + 7x + 3x + 4x = x 3 + 7x
More informationCS 16: Assembly Language Programming for the IBM PC and Compatibles
CS 16: Assembly Language Programming for the IBM PC and Compatibles First, a little about you Your name Have you ever worked with/used/played with assembly language? If so, talk about it Why are you taking
More informationThis 3digit ASCII string could also be calculated as n = (Data[2]0x30) +10*((Data[1]0x30)+10*(Data[0]0x30));
Introduction to Embedded Microcomputer Systems Lecture 5.1 2.9. Conversions ASCII to binary n = 100*(Data[0]0x30) + 10*(Data[1]0x30) + (Data[2]0x30); This 3digit ASCII string could also be calculated
More informationToday. Binary addition Representing negative numbers. Andrew H. Fagg: Embedded Real Time Systems: Binary Arithmetic
Today Binary addition Representing negative numbers 2 Binary Addition Consider the following binary numbers: 0 0 1 0 0 1 1 0 0 0 1 0 1 0 1 1 How do we add these numbers? 3 Binary Addition 0 0 1 0 0 1 1
More information= Chapter 1. The Binary Number System. 1.1 Why Binary?
Chapter The Binary Number System. Why Binary? The number system that you are familiar with, that you use every day, is the decimal number system, also commonly referred to as the base0 system. When you
More informationBinary Numbering Systems
Binary Numbering Systems April 1997, ver. 1 Application Note 83 Introduction Binary numbering systems are used in virtually all digital systems, including digital signal processing (DSP), networking, and
More informationSolution for Homework 2
Solution for Homework 2 Problem 1 a. What is the minimum number of bits that are required to uniquely represent the characters of English alphabet? (Consider upper case characters alone) The number of
More informationNUMBER SYSTEMS. 1.1 Introduction
NUMBER SYSTEMS 1.1 Introduction There are several number systems which we normally use, such as decimal, binary, octal, hexadecimal, etc. Amongst them we are most familiar with the decimal number system.
More informationCS321. Introduction to Numerical Methods
CS3 Introduction to Numerical Methods Lecture Number Representations and Errors Professor Jun Zhang Department of Computer Science University of Kentucky Lexington, KY 405060633 August 7, 05 Number in
More informationData Representation. Data Representation, Storage, and Retrieval. Data Representation. Data Representation. Data Representation. Data Representation
, Storage, and Retrieval ULM/HHIM Summer Program Project 3, Day 3, Part 3 Digital computers convert the data they process into a digital value. Text Audio Images/Graphics Video Digitizing 00000000... 6/8/20
More informationNumber and codes in digital systems
Number and codes in digital systems Decimal Numbers You are familiar with the decimal number system because you use them everyday. But their weighted structure is not understood. In the decimal number
More informationDigital System Design Prof. D Roychoudhry Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur
Digital System Design Prof. D Roychoudhry Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur Lecture  04 Digital Logic II May, I before starting the today s lecture
More informationBinary math. Resources and methods for learning about these subjects (list a few here, in preparation for your research):
Binary math This worksheet and all related files are licensed under the Creative Commons Attribution License, version 1.0. To view a copy of this license, visit http://creativecommons.org/licenses/by/1.0/,
More informationNUMBER SYSTEMS. William Stallings
NUMBER SYSTEMS William Stallings The Decimal System... The Binary System...3 Converting between Binary and Decimal...3 Integers...4 Fractions...5 Hexadecimal Notation...6 This document available at WilliamStallings.com/StudentSupport.html
More information6 3 4 9 = 6 10 + 3 10 + 4 10 + 9 10
Lesson The Binary Number System. Why Binary? The number system that you are familiar with, that you use every day, is the decimal number system, also commonly referred to as the base system. When you
More information1. Convert the following base 10 numbers into 8bit 2 s complement notation 0, 1, 12
C5 Solutions 1. Convert the following base 10 numbers into 8bit 2 s complement notation 0, 1, 12 To Compute 0 0 = 00000000 To Compute 1 Step 1. Convert 1 to binary 00000001 Step 2. Flip the bits 11111110
More informationBinary Numbers The Computer Number System
Binary Numbers The Computer Number System Number systems are simply ways to count things. Ours is the base0 or radix0 system. Note that there is no symbol for 0 or for the base of any system. We count,2,3,4,5,6,7,8,9,
More informationNumeral Systems. The number twentyfive can be represented in many ways: Decimal system (base 10): 25 Roman numerals:
Numeral Systems Which number is larger? 25 8 We need to distinguish between numbers and the symbols that represent them, called numerals. The number 25 is larger than 8, but the numeral 8 above is larger
More informationChapter 4: Computer Codes
Slide 1/30 Learning Objectives In this chapter you will learn about: Computer data Computer codes: representation of data in binary Most commonly used computer codes Collating sequence 36 Slide 2/30 Data
More informationInteger multiplication
Integer multiplication Suppose we have two unsigned integers, A and B, and we wish to compute their product. Let A be the multiplicand and B the multiplier: A n 1... A 1 A 0 multiplicand B n 1... B 1 B
More informationData Storage 3.1. Foundations of Computer Science Cengage Learning
3 Data Storage 3.1 Foundations of Computer Science Cengage Learning Objectives After studying this chapter, the student should be able to: List five different data types used in a computer. Describe how
More informationBinary Number System. 16. Binary Numbers. Base 10 digits: 0 1 2 3 4 5 6 7 8 9. Base 2 digits: 0 1
Binary Number System 1 Base 10 digits: 0 1 2 3 4 5 6 7 8 9 Base 2 digits: 0 1 Recall that in base 10, the digits of a number are just coefficients of powers of the base (10): 417 = 4 * 10 2 + 1 * 10 1
More information2010/9/19. Binary number system. Binary numbers. Outline. Binary to decimal
2/9/9 Binary number system Computer (electronic) systems prefer binary numbers Binary number: represent a number in base2 Binary numbers 2 3 + 7 + 5 Some terminology Bit: a binary digit ( or ) Hexadecimal
More informationChapter 2. Binary Values and Number Systems
Chapter 2 Binary Values and Number Systems Numbers Natural numbers, a.k.a. positive integers Zero and any number obtained by repeatedly adding one to it. Examples: 100, 0, 45645, 32 Negative numbers A
More informationNumber Conversions Dr. Sarita Agarwal (Acharya Narendra Dev College,University of Delhi)
Conversions Dr. Sarita Agarwal (Acharya Narendra Dev College,University of Delhi) INTRODUCTION System A number system defines a set of values to represent quantity. We talk about the number of people
More information3. Convert a number from one number system to another
3. Convert a number from one number system to another Conversion between number bases: Hexa (16) Decimal (10) Binary (2) Octal (8) More Interest Way we need conversion? We need decimal system for real
More informationDIGITAL FUNDAMENTALS lesson 4 Number systems
The decimal number system In the decimal number system the base is 0. For example the number 4069 means 4x000 + 0x00 + 6x0 + 9x. The powers of 0 with the number 4069 in tabelvorm are: power 0 3 0 2 0 0
More informationReview 1/2. CS61C Characters and Floating Point. Lecture 8. February 12, Review 2/2 : 12 new instructions Arithmetic:
Review 1/2 CS61C Characters and Floating Point Lecture 8 February 12, 1999 Handling case when number is too big for representation (overflow) Representing negative numbers (2 s complement) Comparing signed
More informationBinary Representation
Binary Representation The basis of all digital data is binary representation. Binary  means two 1, 0 True, False Hot, Cold On, Off We must tbe able to handle more than just values for real world problems
More informationGoals. Unary Numbers. Decimal Numbers. 3,148 is. 1000 s 100 s 10 s 1 s. Number Bases 1/12/2009. COMP370 Intro to Computer Architecture 1
Number Bases //9 Goals Numbers Understand binary and hexadecimal numbers Be able to convert between number bases Understand binary fractions COMP37 Introduction to Computer Architecture Unary Numbers Decimal
More informationLecture 2: Number Representation
Lecture 2: Number Representation CSE 30: Computer Organization and Systems Programming Summer Session II 2011 Dr. Ali Irturk Dept. of Computer Science and Engineering University of California, San Diego
More informationFixedPoint Arithmetic
FixedPoint Arithmetic FixedPoint Notation A Kbit fixedpoint number can be interpreted as either: an integer (i.e., 20645) a fractional number (i.e., 0.75) 2 1 Integer FixedPoint Representation Nbit
More informationDNA Data and Program Representation. Alexandre David 1.2.05 adavid@cs.aau.dk
DNA Data and Program Representation Alexandre David 1.2.05 adavid@cs.aau.dk Introduction Very important to understand how data is represented. operations limits precision Digital logic built on 2valued
More informationHOMEWORK # 2 SOLUTIO
HOMEWORK # 2 SOLUTIO Problem 1 (2 points) a. There are 313 characters in the Tamil language. If every character is to be encoded into a unique bit pattern, what is the minimum number of bits required to
More informationLab 4 Large Number Arithmetic. ECE 375 Oregon State University Page 29
Lab 4 Large Number Arithmetic ECE 375 Oregon State University Page 29 Objectives Understand and use arithmetic and ALU operations Manipulate and handle large numbers Create and handle functions and subroutines
More informationLecture 8: Binary Multiplication & Division
Lecture 8: Binary Multiplication & Division Today s topics: Addition/Subtraction Multiplication Division Reminder: get started early on assignment 3 1 2 s Complement Signed Numbers two = 0 ten 0001 two
More informationBinary, Hexadecimal, Octal, and BCD Numbers
23CH_PHCalter_TMSETE_949118 23/2/2007 1:37 PM Page 1 Binary, Hexadecimal, Octal, and BCD Numbers OBJECTIVES When you have completed this chapter, you should be able to: Convert between binary and decimal
More informationA Step towards an Easy Interconversion of Various Number Systems
A towards an Easy Interconversion of Various Number Systems Shahid Latif, Rahat Ullah, Hamid Jan Department of Computer Science and Information Technology Sarhad University of Science and Information Technology
More informationCHAPTER 5 Roundoff errors
CHAPTER 5 Roundoff errors In the two previous chapters we have seen how numbers can be represented in the binary numeral system and how this is the basis for representing numbers in computers. Since any
More informationData Storage. Chapter 3. Objectives. 31 Data Types. Data Inside the Computer. After studying this chapter, students should be able to:
Chapter 3 Data Storage Objectives After studying this chapter, students should be able to: List five different data types used in a computer. Describe how integers are stored in a computer. Describe how
More informationActivity 1: Bits and Bytes
ICS3U (Java): Introduction to Computer Science, Grade 11, University Preparation Activity 1: Bits and Bytes The Binary Number System Computers use electrical circuits that include many transistors and
More informationEverything you wanted to know about using Hexadecimal and Octal Numbers in Visual Basic 6
Everything you wanted to know about using Hexadecimal and Octal Numbers in Visual Basic 6 Number Systems No course on programming would be complete without a discussion of the Hexadecimal (Hex) number
More informationComputers. Hardware. The Central Processing Unit (CPU) CMPT 125: Lecture 1: Understanding the Computer
Computers CMPT 125: Lecture 1: Understanding the Computer Tamara Smyth, tamaras@cs.sfu.ca School of Computing Science, Simon Fraser University January 3, 2009 A computer performs 2 basic functions: 1.
More informationChapter 2 Logic Gates and Introduction to Computer Architecture
Chapter 2 Logic Gates and Introduction to Computer Architecture 2.1 Introduction The basic components of an Integrated Circuit (IC) is logic gates which made of transistors, in digital system there are
More informationBinary. ! You are probably familiar with decimal
Arithmetic operations in assembly language Prof. Gustavo Alonso Computer Science Department ETH Zürich alonso@inf.ethz.ch http://www.inf.ethz.ch/department/is/iks/ Binary! You are probably familiar with
More informationCS201: Architecture and Assembly Language
CS201: Architecture and Assembly Language Lecture Three Brendan Burns CS201: Lecture Three p.1/27 Arithmetic for computers Previously we saw how we could represent unsigned numbers in binary and how binary
More informationUnsigned Conversions from Decimal or to Decimal and other Number Systems
Page 1 of 5 Unsigned Conversions from Decimal or to Decimal and other Number Systems In all digital design, analysis, troubleshooting, and repair you will be working with binary numbers (or base 2). It
More informationSection 1.5 Arithmetic in Other Bases
Section Arithmetic in Other Bases Arithmetic in Other Bases The operations of addition, subtraction, multiplication and division are defined for counting numbers independent of the system of numeration
More informationBinary Adders: Half Adders and Full Adders
Binary Adders: Half Adders and Full Adders In this set of slides, we present the two basic types of adders: 1. Half adders, and 2. Full adders. Each type of adder functions to add two binary bits. In order
More informationRepresentation of Floating Point Numbers in
Representation of Floating Point Numbers in Single Precision IEEE 754 Standard Value = N = (1) S X 2 E127 X (1.M) 0 < E < 255 Actual exponent is: e = E  127 sign 1 8 23 S E M exponent: excess 127 binary
More informationCorrectly Rounded Floatingpoint BinarytoDecimal and DecimaltoBinary Conversion Routines in Standard ML. By Prashanth Tilleti
Correctly Rounded Floatingpoint BinarytoDecimal and DecimaltoBinary Conversion Routines in Standard ML By Prashanth Tilleti Advisor Dr. Matthew Fluet Department of Computer Science B. Thomas Golisano
More informationPROGRAMMABLE LOGIC CONTROLLERS Unit code: A/601/1625 QCF level: 4 Credit value: 15 TUTORIAL OUTCOME 2 Part 1
UNIT 22: PROGRAMMABLE LOGIC CONTROLLERS Unit code: A/601/1625 QCF level: 4 Credit value: 15 TUTORIAL OUTCOME 2 Part 1 This work covers part of outcome 2 of the Edexcel standard module. The material is
More informationChapter 1: Digital Systems and Binary Numbers
Chapter 1: Digital Systems and Binary Numbers Digital age and information age Digital computers general purposes many scientific, industrial and commercial applications Digital systems telephone switching
More informationLecture 4 Representing Data on the Computer. Ramani Duraiswami AMSC/CMSC 662 Fall 2009
Lecture 4 Representing Data on the Computer Ramani Duraiswami AMSC/CMSC 662 Fall 2009 x = ±(1+f) 2 e 0 f < 1 f = (integer < 2 52 )/ 2 521022 e 1023 e = integer Effects of floating point Effects of floating
More informationNumerical Matrix Analysis
Numerical Matrix Analysis Lecture Notes #10 Conditioning and / Peter Blomgren, blomgren.peter@gmail.com Department of Mathematics and Statistics Dynamical Systems Group Computational Sciences Research
More informationNumber Systems. Introduction / Number Systems
Number Systems Introduction / Number Systems Data Representation Data representation can be Digital or Analog In Analog representation values are represented over a continuous range In Digital representation
More informationDigital Design. Assoc. Prof. Dr. Berna Örs Yalçın
Digital Design Assoc. Prof. Dr. Berna Örs Yalçın Istanbul Technical University Faculty of Electrical and Electronics Engineering Office Number: 2318 Email: siddika.ors@itu.edu.tr Grading 1st Midterm 
More informationPositional Numbering System
APPENDIX B Positional Numbering System A positional numbering system uses a set of symbols. The value that each symbol represents, however, depends on its face value and its place value, the value associated
More informationAttention: This material is copyright 19951997 Chris Hecker. All rights reserved.
Attention: This material is copyright 19951997 Chris Hecker. All rights reserved. You have permission to read this article for your own education. You do not have permission to put it on your website
More informationLecture N 1 PHYS 3330. Microcontrollers
Lecture N 1 PHYS 3330 Microcontrollers If you need more than a handful of logic gates to accomplish the task at hand, you likely should use a microcontroller instead of discrete logic gates 1. Microcontrollers
More informationAddition Methods. Methods Jottings Expanded Compact Examples 8 + 7 = 15
Addition Methods Methods Jottings Expanded Compact Examples 8 + 7 = 15 48 + 36 = 84 or: Write the numbers in columns. Adding the tens first: 47 + 76 110 13 123 Adding the units first: 47 + 76 13 110 123
More information