# CHAPTER 3 Number System and Codes

Save this PDF as:

Size: px
Start display at page:

## Transcription

1 CHAPTER 3 Number System and Codes 3.1 Introduction On hearing the word number, we immediately think of familiar decimal number system with its 10 digits; 0,1, 2,3,4,5,6, 7, 8 and 9. these numbers are called Arabic. Our present number system provides modern mathematicians and scientists with a great advantage over those of previous civilizations and is an important factor in our advancement. Since hands are the most convenient tools nature has provided human being have always tended to use them in counting. So the decimal number system followed naturally from this usage. 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. To determine the quantity that the number represents, it is necessary to multiply each digit by an integer power of r, and then form the sum of all weighed digits. It is possible to use any whole number greater than one as a base in building a numeration system. There are four systems of arithmetic which are often used in digital system. These are: Decimal Binary Hexadecimal Octal 3.2 Decimal and Binary Numbers The decimal system of counting and keeping track of items was first created by Hindu mathematicians in India in A.D Since it involved the use of fingers and thumbs, it was natural that this system would have 10 digits. The system found its way to all the Arab countries by A.D. 800, where it was named the Arabic number system, and from there it was eventually adopted by nearly all the European countries by A.D. 1200, 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 10 number system which means that it uses 10 digits (0 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 would represent a number in base 7 (using the digits 0 to 6) number system. Example and 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 10) number system. The second number is a number in the base 2 number system called the binary number system. We shall look at the binary number system later.

2 26 CHAPTER 3 Decimal Numbers Written Using Positional Notation Consider the decimal number Each digit in this number has a positional value. The last digit 7 is the units digit. Its positional value is 7 x 1. The 3 is the tens digit. Its positional value is 3 x 10. The 2 is the hundreds digit. Its positional value is 2 x 100. The 5 is the thousands digits. Its positional value is 5 x We may write then that: = 5 x x x x 1 using positional value notation. The position, then, of each digit of a decimal number determines the weight of that digit. The digit which contributes the least weight is called the LSD (least significant digit) and the digit which contributes the most weight is called the MSD. In our example, 7 is the LSD and 5 is the MSD. In chart form, we can write: Positional Name thousands hundreds tens units Positional Weight Value in Positional Notation Problem Write using positional value notation x x x x The Binary Number System Counting in the Decimal (Base 10) Number System You know how to count in the decimal system: Start Counting: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9. When you reach 9, you run out of units digits to use. So you reset the units digit to 0 and carry 1 to the tens column. Then you can keep counting. Continue Counting: 10, 11, 12,..., 19. When you reach 19, you must reset the units digit to 0 again and carry 1 over to the tens column which when added to the one there gives 2 and you may continue counting. Count some More: 20, 21, 22, 23,..., all the way to 98, 99 When you reach 99, you have to reset the units column to 0 and carry 1 which will cause the tens column to have to be reset to 0 and 1 carried over to the hundreds column. Continue Counting: 100, 101, 102, and... well, Counting in the Binary (Base 2) Number System

3 Number System and Codes 27 The binary system is a base two system. The only digits that can be used are 0 and 1. Let's start counting: Start counting: 0, 1 We have used both 0 and 1 for the units digit. That's it for the units digit. The units digit must now be reset to 0 and a 1 carried to the next digit. Continue counting: 10, 11 Now the units digit has to be reset again to 0 and a 1 carried to the left. This will cause the second digit from the right to have to be reset making the third digit from the left now 1. Keep Counting: The next 8 binary numbers are: 100, 101, 110, 111, 1000, 1001,1010, 1011 Keep your finger off the scroll bar and see if you can list the next four binary numbers, then check the table below: The first 17 decimal integers and their binary equivalents: Decimal Binary Decimal Binary Positional Notation in the Binary Number System We saw that each digit in a decimal number carries its own weight. The rightmost digit in a decimal number is the units digit; the weight of each digit increases by a factor of 10 as one moves to the left. Computers use binary number notation extensively. In computers, each digit in a binary number is called a bit. Eight bits make up one byte. The rightmost digit in a binary number is the units digit. The weight of each digit increases by a factor of 2 as one moves from right to left in a binary number. The following table gives the positional weight of each bit in the byte and uses the positional weight of each column to express the number in decimal form: Positional Weight Value Number Positional Notation = 1x x64 + 0x32 + 0x16 + 0x8 + 1x4 + 0x2 + 1x1 = 197 Note the LSD in is the right most digit which is 1 and the MSD is the left most digit which is 1. Problems Convert to decimal numbers: a) b)

4 28 CHAPTER Converting Decimal Numbers to Binary Numbers Method A - Write the Number as a Sum of Powers of 2 Any decimal number between 1 and 8 can be quickly converted into a binary number between 0 2 and by writing the number as the sum of powers of 2. Example Convert to binary by writing 11 as a sum of powers of 2 Solution: The powers of 2 are: 1, 2, 4, 8, 16, 32 etc. Powers of = = Any decimal number between 8 and 128 can also be converted to binary reasonably easily using this method: Example Convert to binary: Powers of = = Method B - Use Repeated Division To convert a decimal number to binary, we can also use repeated division and note the remainder after each division. Example Convert to binary converted to a binary number: Division Remainder 1 LSD MSD

5 Number System and Codes 29 Note that the first remainder gives the LSD and the last remainder the MSD. Then, = Check: = = 837 Problems Convert to binary numbers using Method A expressing the number as a sum of powers of 2: a) b) Convert to binary number using Method B -repeated division by 2 a) b) Binary Numbers and Computers Binary is the language of computers. Everything you type, input, output, send, retrieve, draw or paint is, in the end, converted to the computer's native language, binary. Each byte of memory consists of 8 bits. Each bit is a binary 1 or 0. When you type the letter A, the decimal number 65 is stored in the computer's memory in a byte of memory in binary form as The table below gives ASCII (American Standard Code for Information Interchange) codes for the letters A through I. Letter Decimal Representation 7 bit Binary Representation A B C D E F G H I Suppose your IBM ThinkPad has 9.76 gigabytes of memory. A gigabyte is roughly 1 billion bytes, so you could store roughly 10 billion letters in your computer's memory. That's 80 billion 0's and 1's. A page of word processing contains about characters. That means you could store 3.5 million pages of information in your computer's memory, again all in 0's and 1's. For Discussion: In a computer, registers are used to store information. An 8-bit register is one which can hold up to 8 digits. Many computers work with 8-bit registers or multiples of 8-bit registers (that is 16, 24, 32, etc). a) How many different binary representations can be stored in an 8-bit register? b) Repeat a) for a 16 bit register c) Generalize to come up with a rule: If you have an x-bit register, how many different binary representations can be stored in the register?

6 30 CHAPTER 3 d) What is the smallest and largest decimal number that can be stored in an 8-bit register? in a 16-bit register? Problem Assignment Give the next three binary numbers after the following binary numbers: a) 10 2 b) c) d) e) Convert the following binary numbers to numbers in base 10: a) b) c) d) Use a sum to convert the following decimal numbers to binary numbers: a) b) c) d) Convert the following decimal numbers to binary using division: a) b) What are the full names for the acronyms LSD sand MSD. Answers Problem x x x 1 Problems a) 8 b) 13 Problems a) b) a) b) Problem Assignment a) 10, 11, 100, 101 b) 100, 101, 110, 111 c) 110, 111, 1000, 1001 d) 1010, 1011, 1100, 1101 e) 1111, , , a) 11 b) 9 c) 13 d) a) b) c) d) a) b) LSD =least significant digit MSD = most significant digit 3.4 Hexadecimal Numbers In the previous section we looked at the decimal (base 10) and binary (base 2) number systems. In this section we look at the hexadecimal (base 16) number system. Both binary and hexadecimal numbers are used in computing. The decimal (base 10) number system uses 10 digits: 0, 1, 2, 3,..., 9 The binary (base 2) number system uses 2 digits: 0, 1 The hexadecimal (base 16) number system uses 16 digits: 0, 1, 2, 3,..., 9, A, B, C, D, E and F. The first 10 whole numbers in the hexadecimal system are: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9. Once we reach 9, we run out of ordinary digits, since there are only ten digits available. Hexadecimal uses the following convention: The number = A 16, = B 16, = C 16, = D 16, = E 16, = F 16. So the first sixteen whole numbers in the hexadecimal number system are: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E and F. After we reach the number F there are no more digits left to use for the units digit. The next number is 10. Continuing to count we have: 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 1A, 1B, 1C, 1D, 1E, 1F, 20,..., 2F, 30,..., 3F

9 Number System and Codes 33 Answers Problems a) 49, 4A, 4B, 4C, 4D,... b) 119, 11A, 11B, 11C, 11D.. c) 3AA, 3AB, 3AC, 3AD, 3AE.. d) AE, AF, B0, B1, B2. e) A99A, A99B, A99C, A99D, A99E... Problems a) 8C5 16 = b) AEF1 16 = Problem = Problems a) 2BF9 16 = b) = CE1 16 Problem Assignment a) 10 b) 2 c) , 1D BF7A , 2B 16

11 Number System and Codes Problem Assignment Perform the following additions of binary numbers: a) 1 +1 b) 1 +0 c) d) e) f) g) h) i) j) Add: (check by converting to decimal) 3. Add +18 and +12 in binary and convert back to decimal. 4. Add +30 and +34 in binary and convert back to decimal. Answers 1. a) 10 b) 1 c) 11 d) 100 e) 101 f) 110 g) 1001 h) 1011 i) j) = = Storing Integers in Binary - Sign-Magnitude Representation As we have seen in previous sections, information is stored in computers in binary form. Traditionally information is stored in bytes consisting of 8 bits or in words consisting of 2 bytes (16 bits) or double words consisting of 4 bytes or 32 bits. The meaning of a "word" is computers can vary from machine to machine. In larger mainframes a word is defined as 64 bits. Another term that is used is nibble (or nibble). A nibble is half a byte or four bits. Example For example, the letter A is stored in a computer in ASCII code form as the number 65 which stored in a byte in binary is Example If a byte contains the bits , the decimal representation is = 123. The character having ASCII code 123 is the left bracket "(". We also discussed earlier than when working with binary numbers, people involved with computers often use hex notation rather than binary notation. Problem Write and in hexadecimal form.

12 36 CHAPTER 3 Labeling of Bits In Example above we indicated that the ASCII code for the letter A is the decimal number 65. In binary, this number is The bits in a byte are labeled from 0 (the least significant bit) to 7 (the most significant bit) Bit Number Binary Representation of the letter A MSB Current computers also use 16 bit, 32 bit and even 64 bit "words" to store information. However, at this point we shall restrict ourselves to dealing with looking at information stored in 4 bits (a nibble) or in bytes Representing Integers in Binary ASCII codes are pure or true binary numbers. By that we mean there is no positive or negative sign attached to these numbers. We are now going to look at representing integers in binary. For example, points on a grid are represented using ordered pairs. You may recall from high school math that the ordered pair P(-4,2) represents a point in the second quadrant of an xy-plane. To store this ordered pair would require the storage of the negative integer -4. In other example, we want to add +17 and -11 on a computer to yield the result +6. The integers +17 and -11 would be stored somewhere in the computer's memory. To be added, they would both have to be brought into the central processing unit (CPU) of the computer and put into registers where they would be added. Here are some of the challenges we face when we move to representing integers in binary: 1. Integers can be positive or negative. Any representation of an integer must have the sign as part of the representation of the number. 2. Each integer should have a unique representation. 3. We added two binary numbers in the last section. Once we represent positive and negative integers in binary form, we want to be able to add and subtract them. 4. The addition and subtraction should be as efficient as possible. We would like to perform these operations using the smallest number of circuits possible. LSB Sign-Magnitude Binary Number System The sign and magnitude number system is a simple binary code system used to represent positive and negative integers. In this system, the first bit (the MSB) in a binary representation is a sign bit (0 for positive and 1 for negative) followed by the magnitude bits. Example If information is stored in nibbles using sign-magnitude notation, 0101 represents a positive integer because the MSB is 0 while 1010 represents a negative integer because the MSB is 1. In particular situations, the number of bits is specified and if not all bits are used, they are filled with zeroes.

13 Number System and Codes Representation of Positive Integers using Sign-Magnitude Notation Example When a 4-bit sign-magnitude convention for representing numbers is used, the number 0101 represents the number +5. The most significant bit (MSB) is the first bit which is a 0. The 0 indicates the number is positive. The remaining 3 bits represent the magnitude of the number. The decimal value of binary 101 is = 5. Therefore, 0101, using a 4-bit sign-magnitude convention is the integer +5. The following table lists all the positive numbers that can be represented using 4 bits: Decimal Number Binary Representation Using 4 bit sign-magnitude notation Problem How many positive binary numbers can be represented in a byte using the signmagnitude notation? Representation of Negative Integers using Sign-Magnitude Notation Example When an 8-bit sign-magnitude convention for representing numbers is used, the number represents the negative integer -55. The first bit, the MSB, is 1 indicating the integer is negative. The next 7 bits represent the magnitude of the integer. Binary has decimal value = 55. Example Store -5 using a 4-bit sign-magnitude convention. Solution: -5 is stored as 1101 The first digit, the MSB, is 1 because the number is negative. The last three digits 101 is 5 in binary. 3.8 Problem Assignment List all of the negative integers that can be stored in a nibble (4-bits) in binary using the sign-magnitude notation. 2. How many different negative integers can be stored in a byte using the signmagnitude notation?

14 38 CHAPTER 3 3. What are the decimal values of these bytes storing sign-magnitude integers? Write '-93' in sign-magnitude representation, using an 8-bit register. 5. What is the largest positive number which can be represented in an 8-bit register, using the sign-magnitude method of representation? 6. What is the largest negative number which can be represented in an 8-bit register, using the sign-magnitude method of representation? 7. Give the range of possible numbers which can be represented in a 16-bit register, using the sign-magnitude method. 8. A drawback to the sign-magnitude notation is that there are two representations of the integer 0. What are they? 9. We now have two ways of representing integers in binary: true binary form and sign-magnitude notation. Complete the following table: A byte contains the following bits a) b) c) d) What integer does this byte represent if the bits represent an integer in true binary form? What integer does this byte represent if the bits represent an integer using sign-magnitude notation? 10. Complete the following table: A decimal number is to be stored in a byte. a) +11 Give the representation if true binary form is used. Give the representation if the sign-magnitude form is used? b) +147 c) -17 d) -57 As indicated in the above problems, a drawback to using the sign-magnitude notation to represent integers is that there are two representations of the integer 0. In computers, equality of numbers is usually determined by checking bit by bit for equality. There would have to be a special algorithm for equality just to deal with the integer 0. The sign-magnitude notation is used to store integers in computers. For example, signmagnitude notation would be appropriate to store the components of the ordered pair (- 5,7) if this ordered pair represents a point on a plane. However, there is another way of storing positive and negative integers that proves to be a representation that makes addition and subtraction of integers easy and efficient. This notation will be discussed in the next section.

15 Number System and Codes 39 Answers Problem B Problem If 0 is counted as a positive integer, the numbers range from to which is 0 to 127 which is 128 different integers Problem Assignment Binary Decimal Value if 0 is included ( ) ( ) 7. from to and A byte contains the following bits What integer does this byte represent if the bits represent an integer in pure binary form? a) What integer does this byte represent if the bits represent an integer using sign-magnitude notation? b) c) d) A decimal number is to be stored in a byte. Give the representation if true binary form is used. Give the representation if the signmagnitude form is used? a) b) cannot be represented using a byte c) -17 d) -57 no true binary representation in computers -- must use a sign bit no true binary representation in computers

16 40 CHAPTER One's Complement Notation We saw in previous sections that there are different ways of storing binary numbers in computers. A number, such as decimal 84, may be stored in true binary form in a byte as When this same number 84 is thought of as the integer +84, then the sign must be stored as part of the representation. The convention we used to store this positive integer in a byte was the sign-magnitude notation. The sign-magnitude representation of +84 in a byte, , is the same as the representation of 84 in true binary form in a byte. Although the representations are the same, the MSB of 0, which is bit 7 has a different interpretation in each notation. When the number 84 is stored without a sign in true binary form as in a byte, the MSB of 0 is part of the magnitude of the number. When the positive integer +84 is stored in a byte, using sign-magnitude notation, as , the MSB of 0 indicates that the integer is positive. The magnitude of the integer is determined from the remaining bits 0 to 6. We have also stored negative integers, such as -47, in a byte using sign-magnitude notation. Can you explain why the sign-magnitude representation of -47 stored in a byte using signmagnitude notation is ? We also saw that there are two representations of the integer 0 using sign-magnitude notation. Using bytes, these representations are and We also commented that it is not easy to perform both addition and subtraction electronically using integers stored in bytes in either true binary or sign-magnitude notation. Therefore, in this section we look at another way of storing integers in computers. This method is called the 1's complement notation. We introduce this notation in this section so that in the next section we can determine the 2's complement of an integer and from there go on to add and subtract integers The 1's Complement in Binary of a Positive Integer The 1's complement representation in binary of a positive integer is no different from the sign-magnitude representation of that integer. Example Using a byte, the 1's complement in binary of +84 is Problems Using a byte, what is the 1's complement in binary of +73? 2. Using a byte, what is the 1's complement in binary of +23?

17 Number System and Codes The 1's Complement in Binary of a Negative Integer The determination of the 1's complement in binary of a negative integer is not quite so straightforward as calculating the 1's complement in binary of a positive integer. The formal way to determine the 1's complement in binary of a negative integer uses the following rule: Rule: The 1's complement in binary of a negative integer is obtained by subtracting its magnitude from 2 n -1 where n is the number of bits used to store the integer in binary. This is best illustrated using an example. From this point on we replace 1's complement in binary with 1's complement. We assume that we are working in binary. Example Store the integer -36 in a byte in 1's complement form. Step 1: = [convert the magnitude of the integer to binary] Step 2: A byte contains 8 bits. Therefore, subtract from = 255. In binary 255 is This determination of the 1's complement of a negative integer would seem to be awkward and one would imagine that the computer circuitry needed to accomplish finding the 1's complement would be complex. However, we note the following: Using a byte, the 1's complement of +36 is Using a byte, the 1's complement of -36 is If these representations are compared bit by bit, one can see that corresponding bits are inverted. There is in fact, then, an easy way to determine the 1's complement of a negative integer. Determine the 1's complement of the corresponding positive integer and invert all bits. Example Using a byte, find the 1's complement of -57. Solution: +57 stored in a byte in 1's complement form is Invert all bits to determine the 1's complement of -57 to be Problems Determine the 1's complement, in byte form, of the decimal integers a) -10 b) -45 c) -111

18 42 CHAPTER 3 2. Using a nibble, determine the 1's complement, of the decimal integers a) -6 b) -28 The 1's complement notation was popular in early digital systems. Integers in these early digital systems were stored in 1's complement form. There are still two representations of the integer 0 (can you give them?) and both addition and subtraction cannot be performed easily Converting from 1's Complement Notation to Decimal Notation We look only at integers stored in bytes in the following discussion. The same rules apply if an integer is stored in 4-bits, 16-bits, 32-bits or other bit form. Case 1: The MSB of the Byte is 0 If a byte contains, for example, which represents an integer stored in 1's complement form, we know that since the MSB = 0, this is a positive integer. The decimal integer value of the byte then is : This 0 indicates the integer is positive Therefore which represent a binary number in 1's complement form is the decimal integer = +89 Case 2: The MSB of the Byte is 1 Method A - Reverse the Steps Carried out When Converting to 1's Complement Form Example In Example above we determined that -57 stored in a byte in 1's complement form is If you are told that a byte contains these same bits and that this information represents a decimal integer in 1's complement form, how would you determine that this represents the integer -57? Solution: If you know that the bits represent an integer in 1's complement form, first examine the MSB which is 1. This indicates the integer is negative. You inverted bits to find the 1's complement. Therefore, invert again and then take the magnitude of the resulting binary expression to find the decimal integer vale. When you invert all bits of you get The corresponding decimal integer is = +57. Therefore, the integer stored is -57. Method B - Add the Weight of all Bits Containing a 0

19 Number System and Codes 43 Time saving methods is always being sought in the computer industry. They can, indeed, be worth much money. In converting from 1's complement notation to decimal value notation in Method A above, we carried out three steps: Step 1: Examine the MSB. If it is 1, the integer is negative. Step 2: Invert each bit of the integer in 1's complement form. Step 3: Convert all bits (excluding the MSB) to corresponding decimal form. Steps 2 and 3 can be combined by adding the weight of all bits in the original representation containing a 0. In our example above, to convert to decimal, the MSB has value 1. Therefore, the integer is negative. Bits 5, 4, 3 and 0 have value 0. Therefore, the integer value is - ( ) = -57. These steps are summarized in the following table: Binary Number in 1's Complement Notation Weight of Bits Containing 0's This is the sign bit indicating the integer is negative Therefore which represents a binary number stored in 1's complement notation has decimal value -( ) = -57 Problems The following bytes represent integers in 1's complement form. Find their decimal values: a) b) c) d)

20 44 CHAPTER Problem Assignment Write all of the different representations of numbers in binary that can be stored in 1's complement form in a nibble and their corresponding decimal integer values. 1's Complement Representation Decimal Integer We now have three ways of representing integers in binary: true binary form, signmagnitude notation, and 1's complement notation. Complete the following table: A byte contains the following bits a) b) c) d) What integer does this byte represent if the bits represent an integer in pure binary form? What integer does this byte represent if the bits represent an integer using sign-magnitude notation?. 3. Store +6 in 1's complement form using 4 bits. 4. Store -7 in 1's complement form using 4 bits. 5. Store +83 in 1's complement form in a byte. What integer does this byte represent if the bits represent an integer in 1's complement notation?

21 6. Store -107 in 1's complement form in a byte. Number System and Codes Convert the following numbers stored in 1's complement form in a byte to decimal: a) b) Express the decimal number -39 as an 8-bit number in sign-magnitude and 1's complement form. Answers Problems Problems a) -10 b) -45 c) a) 1001 b) +28 in binary is This number cannot be stored in a nibble. Problems a) b) c) d) Two's Complement Notation We saw in previous sections that there are different ways of storing binary numbers in computers. The number 50 can be stored in a byte in true binary form as When the sign of the number is relevant, as in a number such as +50, we can store it in a byte using sign-magnitude notation as The MSB, which has value 0, indicates the number is positive. The number -50 is stored in a byte using sign-magnitude notation as The MSB, which has value 1, indicates the number is negative. The number +50 can also be stored in a byte in 1's complement form as The number -50 is stored in a byte in 1's complement form as Problems Complete the following table: Integer to be Stored in a Byte n/a True Binary Representation Two's Complement Notation Sign-Magnitude Representation 1's Complement Representation The last notation that we look at is called the two s complement notation. The 2's complement notation is used almost exclusively in digital systems to store positive and negative integers. We look then at writing integers in binary in 2's complement form.

22 46 CHAPTER The 2's Complement in Binary of a Positive Integer As was the case with the 1's complement, the 2's complement of a positive number is no different from the representation of that number using sign-magnitude notation. Example Store the integer +27 in a byte using sign-magnitude form and using the two's complement form. +27 is stored exactly the same using either the sign-magnitude notation or the 2's complement notation The number +27 is stored as: The MSB is 0 since the number is positive is 27 in binary. Example What is the decimal integer value of stored in a byte if the representation is: a) sign-magnitude form b) 2's complement form? Solution: There is no difference between the forms. Since the MSB is 0, the number is positive. The other 7 bytes in decimal form is 89. The integer stored is +89. Problems Store these integers in bytes using the 2's complement notation: a) + 36 b) Storing Negative Integers in Bytes Using Two's Complement Notation We indicated in the last section that the formal way to determine the 1's complement of a negative integer to be stored in binary in n bits is to subtract the integer in binary from 2 n - 1. It turned out that the short way to do this is to simply invert all the bits of the representation of the corresponding positive integer. Example To find the 1's complement of -77 we note that +77 in binary is Inverting bits, we determine that the representation of -77 in binary in 1's complement form is The formal way to determine the 2's complement of a negative integer to be stored in binary in n bits is to subtract the integer in binary from 2 n. To determine 1's complement of a negative integer to be stored in n bits you subtract from 2 n 1 and to find the 2 s complement of a negative integer to be stored in n bits you subtract from 2 n. It follows that the 2's complement is just 1 more than the 1's complement. This gives us a method to determine quickly the 2's complement of a negative integer. Rule: To determine the 2's complement of a negative integer, determine the 1's complement and add 1.

23 Example Store -27 in a byte using 2's complement notation. Steps 1 and 2 determine the 1's complement: Step 1: +27 in binary is Number System and Codes 47 Step 2: Invert bits to yield Then the complement of -27 is Step 3 is the additional step needed to find the 2's complement. Step 3: Add 1 to the 1's complement: The 2's complement of -27 is Example Store the integer -70 in a byte using the two's complement notation. The steps are carried out in the table that follows: Step Procedure Binary Answer in Byte Form 1 2 Write +70 in binary 70 = Take the one's complement (invert the contents of the byte) Add 1 to the LSB + 1 The answer is the two's complement of Therefore we store the integer -70 in a byte in 2's complement form as Problems Store -26 and -67 in bytes in 2's complement form Finding the Decimal Integer Values of Positive and Negative Numbers Stored in Bytes in 2's Complement Form Case 1: The MSB of the Byte is 0 If a byte contains the integer in 2's complement form, we know that since the MSB = 0, this is a positive integer. The integer value of the byte then is = +89 in decimal. Case 2: The MSB of the Byte is 1 If a byte contains the integer in 2'complement form, we know that since the MSB = 1, 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 0 and then add 1 to the result.

24 48 CHAPTER 3 The decimal integer value of is Sign represents the integer -39 (Remember to add +1) Check: Write -39 in 2's complement byte form: Step Procedure Binary Answer in Byte Form 1 2 Write +39 in binary 39 = Take the one's complement (invert the contents of the byte) Add 1 to the LSB + 1 The answer is the two's complement of 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 Problem Assignment Determine the integer decimal equivalent of the following byte-sized 2's complement numbers: a) b) c) d) Write the 16 different 2's complement representations of decimal integers that can be stored in a nybble and their corresponding decimal integer values. 2's Complement Representation Decimal Integer

25 Number System and Codes We now have four ways of representing integers in binary: true binary form, signmagnitude notation, 1's complement notation, and 2's complement notation. Complete the following table: A byte contains the following bits a) b) c) d) What decimal integer is stored in the byte for each of the following representations: True binary Signmagnitude 1's Complement. 4. a) Store +6 in 2's complement form using 4 bits. b) Store -7 in 1's complement form using 4 bits. 2's Complement 5. Convert the following numbers stored in 2's complement form in a byte to decimal: a) b) Express the decimal number -39 as an 8-bit number in sign-magnitude, 1's complement, and 2's complement form. 7. How many representations of the integer zero are there in the 2's complement notation using bytes? 8. We have learned to store integers in true binary form, sign-magnitude form, 1's complement form, and 2's complement form. There are additional ways. One other way is called BCD form. Answers Problems Integer to be Stored in a Byte True Binary Representation Sign-Magnitude Representation 1's Complement Representation n/a Problems Store these integers in bytes using the 2's complement notation: a) b) in binary is This integer is too large to be stored in 2's complement form in a byte. Problems Problem Assignment a) b) c) d)

26 50 CHAPTER 3 2's Complement Representation Decimal Integer A byte contains the following bits What decimal integer is stored in the byte for each of the following representations: True binary Signmagnitude 1's Complement 2's Complement a) b) c) d) = a) 0110 b) a) b) sign-magnitude 's complement 's complement Just Two's Complement Arithmetic We have been discussing storing information, particularly integers, in computers mostly in byte form. In this section we look at how addition and subtraction are performed in modern computers. To perform mathematical functions, a computer's central processing unit, or CPU, contains several circuits, and one of these circuits is called the arithmetic-logic unit or ALU.

29 Example If R = +100 and S = +30, find R + S Solution: Decimal Addition Number System and Codes 53 2's Complement Addition The sum of the two integers here is indicated to be Clearly, this sum cannot be a correct representation of the actual sum of +130 because the MSB is 1 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 +100 and +30?] 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 and Example Example Add +9 and +5 using 2's complement notation. Decimal Addition 2's Complement Addition

30 54 CHAPTER 3 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. Both the carry in and carry out values for bit 7, the MSB, have value 0. No overflow occurs. Example Add +100 and +30. 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 The carry in to the MSB of 1 is not equal to the carry out of 0 from the MSB. An overflow occurs.

### Base 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,

### Oct: 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

### Binary 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

### Number 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

### LSN 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 (0-9) Base 10 weighting system... 10 5 10 4 10 3 10 2 10 1 10 0. 10-1 10-2 10-3

### Signed 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

### EE 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

### Lecture 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

### 2011, The McGraw-Hill 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

### Section 1.4 Place Value Systems of Numeration in Other Bases

Section.4 Place Value Systems of Numeration in Other Bases Other Bases The Hindu-Arabic system that is used in most of the world today is a positional value system with a base of ten. The simplest reason

### To 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

### Binary 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

### Binary 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

### NUMBER 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.

### Number 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

### Computer 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

### = 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 base-0 system. When you

### 6 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

### Activity 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

### CSI 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...

### Numbering 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

### CDA 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 6-3-1-1 and Excess-3? Data Representation (1/2) Each numbering

### ELECTRICAL AND COMPUTER ENGINEERING DEPARTMENT, OAKLAND UNIVERSITY ECE-470/570: Microprocessor-Based 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,

### The 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

### CHAPTER 3 Numbers and Numeral Systems

CHAPTER 3 Numbers and Numeral Systems Numbers play an important role in almost all areas of mathematics, not least in calculus. Virtually all calculus books contain a thorough description of the natural,

### Number 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

### Chapter 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

### Useful 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

### CS 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

### Binary, 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

### CPEN 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

### Binary 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

### 3. 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

### Lecture 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

### Number 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

### Data 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

### Number 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

### Chapter 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

### Binary Numbers The Computer Number System

Binary Numbers The Computer Number System Number systems are simply ways to count things. Ours is the base-0 or radix-0 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,

### plc 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;

### Digital 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

### 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

### Everything 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

### NUMBER 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

### Chapter 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

### Decimal 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

### Levent EREN levent.eren@ieu.edu.tr A-306 Office Phone:488-9882 INTRODUCTION TO DIGITAL LOGIC

Levent EREN levent.eren@ieu.edu.tr A-306 Office Phone:488-9882 1 Number Systems Representation Positive radix, positional number systems A number with radix r is represented by a string of digits: A n

### Today. 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

### Unsigned 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

### COMP 250 Fall 2012 lecture 2 binary representations Sept. 11, 2012

Binary numbers The reason humans represent numbers using decimal (the ten digits from 0,1,... 9) is that we have ten fingers. There is no other reason than that. There is nothing special otherwise about

### 4 BOOLEAN ALGEBRA AND LOGIC SIMPLIFICATION

4 BOOLEAN ALGEBRA AND LOGIC SIMPLIFICATION BOOLEAN OPERATIONS AND EXPRESSIONS Variable, complement, and literal are terms used in Boolean algebra. A variable is a symbol used to represent a logical quantity.

### CHAPTER TWO. 2.1 Unsigned Binary Counting. Numbering Systems

CHAPTER TWO Numbering Systems Chapter one discussed how computers remember numbers using transistors, tiny devices that act like switches with only two positions, on or off. A single transistor, therefore,

### Decimal to Binary Conversion

Decimal to Binary Conversion A tool that makes the conversion of decimal values to binary values simple is the following table. The first row is created by counting right to left from one to eight, for

### Counting in base 10, 2 and 16

Counting in base 10, 2 and 16 1. Binary Numbers A super-important fact: (Nearly all) Computers store all information in the form of binary numbers. Numbers, characters, images, music files --- all of these

### Memory Systems. Static Random Access Memory (SRAM) Cell

Memory Systems This chapter begins the discussion of memory systems from the implementation of a single bit. The architecture of memory chips is then constructed using arrays of bit implementations coupled

### 2 Number Systems. Source: Foundations of Computer Science Cengage Learning. Objectives After studying this chapter, the student should be able to:

2 Number Systems 2.1 Source: Foundations of Computer Science Cengage Learning Objectives After studying this chapter, the student should be able to: Understand the concept of number systems. Distinguish

### Systems 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

### Chapter 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

### Bits, Bytes, and Codes

Bits, Bytes, and Codes Telecommunications 1 Peter Mathys Black and White Image Suppose we want to draw a B&W image on a computer screen. We first subdivide the screen into small rectangles or squares called

### Computer Systems. Computer Systems COMP1208. Objectives of the Module. Course Assessment. Reading List. What will you need

Computer Systems Computer Systems Lecturer: Ruth Coffey Room KE-4-027, email: ruth.coffey@dit.ie Today s Lecture >> Module Overview Objectives of Module Course Assessment Reading List Introduction to Computer

### Goals. 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

### Digital 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 E-mail: siddika.ors@itu.edu.tr Grading 1st Midterm -

### Number Systems I. CIS008-2 Logic and Foundations of Mathematics. David Goodwin. 11:00, Tuesday 18 th October

Number Systems I CIS008-2 Logic and Foundations of Mathematics David Goodwin david.goodwin@perisic.com 11:00, Tuesday 18 th October 2011 Outline 1 Number systems Numbers Natural numbers Integers Rational

### Binary. ! 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

### A 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

### Number Systems and Radix Conversion

Number Systems and Radix Conversion Sanjay Rajopadhye, Colorado State University 1 Introduction These notes for CS 270 describe polynomial number systems. The material is not in the textbook, but will

### 2 Number Systems 2.1. Foundations of Computer Science Cengage Learning

2 Number Systems 2.1 Foundations of Computer Science Cengage Learning 2.2 Objectives After studying this chapter, the student should be able to: Understand the concept of number systems. Distinguish between

### CS101 Lecture 11: Number Systems and Binary Numbers. Aaron Stevens 14 February 2011

CS101 Lecture 11: Number Systems and Binary Numbers Aaron Stevens 14 February 2011 1 2 1 3!!! MATH WARNING!!! TODAY S LECTURE CONTAINS TRACE AMOUNTS OF ARITHMETIC AND ALGEBRA PLEASE BE ADVISED THAT CALCULTORS

### Numeral Systems. The number twenty-five 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

### MODULAR ARITHMETIC. a smallest member. It is equivalent to the Principle of Mathematical Induction.

MODULAR ARITHMETIC 1 Working With Integers The usual arithmetic operations of addition, subtraction and multiplication can be performed on integers, and the result is always another integer Division, on

### Solution 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

### 4.3 TABLE 3 TABLE 4. 1342 five 1 125 3 25 4 5 2 1 125 75 20 2 222.

.3 Conversion Between Number Bases 169.3 Conversion Between Number Bases Although the numeration systems discussed in the opening section were all base ten, other bases have occurred historically. For

### BINARY CODED DECIMAL: B.C.D.

BINARY CODED DECIMAL: B.C.D. ANOTHER METHOD TO REPRESENT DECIMAL NUMBERS USEFUL BECAUSE MANY DIGITAL DEVICES PROCESS + DISPLAY NUMBERS IN TENS IN BCD EACH NUMBER IS DEFINED BY A BINARY CODE OF 4 BITS.

### Machine Architecture and Number Systems. Major Computer Components. Schematic Diagram of a Computer. The CPU. The Bus. Main Memory.

1 Topics Machine Architecture and Number Systems Major Computer Components Bits, Bytes, and Words The Decimal Number System The Binary Number System Converting from Decimal to Binary Major Computer Components

### Binary Division. Decimal Division. Hardware for Binary Division. Simple 16-bit Divider Circuit

Decimal Division Remember 4th grade long division? 43 // quotient 12 521 // divisor dividend -480 41-36 5 // remainder Shift divisor left (multiply by 10) until MSB lines up with dividend s Repeat until

### Grade 6 Math Circles. Binary and Beyond

Faculty of Mathematics Waterloo, Ontario N2L 3G1 The Decimal System Grade 6 Math Circles October 15/16, 2013 Binary and Beyond The cool reality is that we learn to count in only one of many possible number

### Unit 1 Number Sense. In this unit, students will study repeating decimals, percents, fractions, decimals, and proportions.

Unit 1 Number Sense In this unit, students will study repeating decimals, percents, fractions, decimals, and proportions. BLM Three Types of Percent Problems (p L-34) is a summary BLM for the material

APPENDIX C The Hexadecimal Number System and Memory Addressing U nderstanding the number system and the coding system that computers use to store data and communicate with each other is fundamental to

### Addition 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

### The 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,

### Chapter 7 Lab - Decimal, Binary, Octal, Hexadecimal Numbering Systems

Chapter 7 Lab - Decimal, Binary, Octal, Hexadecimal Numbering Systems This assignment is designed to familiarize you with different numbering systems, specifically: binary, octal, hexadecimal (and decimal)

### Decimal Number (base 10) Binary Number (base 2)

LECTURE 5. BINARY COUNTER Before starting with counters there is some vital information that needs to be understood. The most important is the fact that since the outputs of a digital chip can only be

### Integer 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

### A single register, called the accumulator, stores the. operand before the operation, and stores the result. Add y # add y from memory to the acc

Other architectures Example. Accumulator-based machines A single register, called the accumulator, stores the operand before the operation, and stores the result after the operation. Load x # into acc

### CS201: 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

### 1. 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

### TYPES OF NUMBERS. Example 2. Example 1. Problems. Answers

TYPES OF NUMBERS When two or more integers are multiplied together, each number is a factor of the product. Nonnegative integers that have exactly two factors, namely, one and itself, are called prime

### Management Challenge. Managing Hardware Assets. Central Processing Unit. What is a Computer System?

Management Challenge Managing Hardware Assets What computer processing and storage capability does our organization need to handle its information and business transactions? What arrangement of computers

### Positional 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

### Lecture 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

### COMBINATIONAL CIRCUITS

COMBINATIONAL CIRCUITS http://www.tutorialspoint.com/computer_logical_organization/combinational_circuits.htm Copyright tutorialspoint.com Combinational circuit is a circuit in which we combine the different

### MULTIPLE CHOICE. Choose the one alternative that best completes the statement or answers the question.

CHAPTER01 QUESTIONS MULTIPLE CHOICE. Choose the one alternative that best completes the statement or answers the question. 1) Convert binary 010101 to octal. 1) A) 258 B) 58 C) 218 D) 158 2) Any number

### Section 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

### #5. Show and the AND function can be constructed from two NAND gates.

Study Questions for Digital Logic, Processors and Caches G22.0201 Fall 2009 ANSWERS Digital Logic Read: Sections 3.1 3.3 in the textbook. Handwritten digital lecture notes on the course web page. Study