DIGITAL ARITHMETIC: OPERATIONS AND CIRCUITS


 Veronica Butler
 4 years ago
 Views:
Transcription
1 C H A P T E R 6 DIGITAL ARITHMETIC: OPERATIONS AND CIRCUITS OUTLINE 6 Binary Addition 62 Representing Signed Numbers 63 Addition in the 2 s Complement System 64 Subtraction in the 2 s Complement System 65 Multiplication of Binary Numbers 66 Binary Division 67 BCD Addition 68 Hexadecimal Arithmetic 69 Arithmetic Circuits 6 Parallel Binary Adder 6 Design of a Full Adder 62 Complete Parallel Adder with Registers 63 Carry Propagation 64 IntegratedCircuit Parallel Adder scomplement System 66 ALU Integrated Circuits 67 Troubleshooting Case Study 68 Using TTL Library Functions with Altera 69 Logical Operations on Bit Arrays 62 HDL Adders 62 Expanding the Bit Capacity of a Circuit
2 OBJECTIVES Upon completion of this chapter, you will be able to: Perform binary addition, subtraction, multiplication, and division on two binary numbers. Add and subtract hexadecimal numbers. Know the difference between binary addition and OR addition. Compare the advantages and disadvantages among three different systems of representing signed binary numbers. Manipulate signed binary numbers using the 2 scomplement system. Understand the BCD addition process. Describe the basic operation of an arithmetic/logic unit. Employ full adders in the design of parallel binary adders. Cite the advantages of parallel adders with the lookahead carry feature. Explain the operation of a parallel adder/subtractor circuit. Use an ALU integrated circuit to perform various logic and arithmetic operations on input data. Analyze troubleshooting case studies of adder/subtractor circuits. Use HDL forms of standard TTL parts from libraries to implement more complicated circuits. Use the Boolean equation form of description to perform operations on entire sets of bits. Apply software engineering techniques to expand the capacity of a hardware description. INTRODUCTION Digital computers and calculators perform the various arithmetic operations on numbers that are represented in binary form. The subject of digital arithmetic can be a very complex one if we want to understand all the various methods of computation and the theory behind them. Fortunately, this level of knowledge is not required by most technicians, at least not until they become experienced computer programmers. Our approach in this chapter will be to concentrate on those basic principles that are necessary for understanding how digital machines (i.e., computers) perform the basic arithmetic operations. First, we will see how the various arithmetic operations are performed on binary numbers using pencil and paper, and then we will study the 297
3 298 CHAPTER 6/DIGITAL ARITHMETIC: OPERATIONS AND CIRCUITS actual logic circuits that perform these operations in a digital system. Finally, we will learn how to describe these simple circuits using HDL techniques. Several methods of expanding the capacity of these circuits will also be covered. The focus will be on the fundamentals of HDL, using arithmetic circuits as an example. The powerful capability of HDL combined with PLD hardware will provide the basis for further study, design, and experimentation with much more sophisticated arithmetic circuits in more advanced courses. 6 BINARY ADDITION The addition of two binary numbers is performed in exactly the same manner as the addition of decimal numbers. In fact, binary addition is simpler because there are fewer cases to learn. Let us first review decimal addition: LSD The leastsignificantdigit (LSD) position is operated on first, producing a sum of 7. The digits in the second position are then added to produce a sum of 3, which produces a carry of into the third position.this produces a sum of 8 in the third position. The same general steps are followed in binary addition. However, only four cases can occur in adding the two binary digits (bits) in any position. They are: carry of into next position carry of into next position The last case occurs when the two bits in a certain position are and there is a carry from the previous position. Here are several examples of the addition of two binary numbers (decimal equivalents are in parentheses): (3) + (6) (9) (9) + (5) (24). (3.375) +. (2.75). (6.25) It is not necessary to consider the addition of more than two binary numbers at a time because in all digital systems the circuitry that actually performs the addition can handle only two numbers at a time. When more than two numbers are to be added, the first two are added together and then their sum is added to the third number, and so on. This is not a serious drawback because modern digital computers can typically perform an addition operation in several nanoseconds. Addition is the most important arithmetic operation in digital systems. As we shall see, the operations of subtraction, multiplication, and division as
4 SECTION 62/REPRESENTING SIGNED NUMBERS 299 they are performed in most modern digital computers and calculators actually use only addition as their basic operation. REVIEW QUESTION. Add the following pairs of binary numbers. (a) + (b). +. (c) REPRESENTING SIGNED NUMBERS In digital computers, the binary numbers are represented by a set of binary storage devices (e.g., flipflops). Each device represents one bit. For example, a sixbit FF register can store binary numbers ranging from to ( to 63 in decimal). This represents the magnitude of the number. Because most digital computers and calculators handle negative as well as positive numbers, some means is required for representing the sign of the number ( or ).This is usually done by adding to the number another bit called the sign bit. In general, the common convention is that a in the sign bit represents a positive number and a in the sign bit represents a negative number. This is illustrated in Figure 6. Register A contains the bits. The in the leftmost bit ( A 6 ) is the sign bit that represents +. The other six bits are the magnitude of the number 2, which is equal to 52 in decimal. Thus, the number stored in the A register is +52. Similarly, the number stored in the B register is 52 because the sign bit is, representing. The sign bit is used to indicate the positive or negative nature of the stored binary number. The numbers in Figure 6 consist of a sign bit and six magnitude bits. The magnitude bits are the true binary equivalent of the decimal value being represented. This is called the signmagnitude system for representing signed binary numbers. Although the signmagnitude system is straightforward, calculators and computers do not normally use it because the circuit implementation is more complex than in other systems. The most commonly used system for representing signed binary numbers is the 2 scomplement system. Before we see how this is done, we must first see how to form the s complement and 2 s complement of a binary number. FIGURE 6 Representation of signed numbers in signmagnitude form. A 6 A 5 A 4 A 3 A 2 A A = +52 Sign bit (+) Magnitude = 52 B 6 B 5 B 4 B 3 B 2 B B = 52 Sign bit ( ) Magnitude = 52
5 3 CHAPTER 6/DIGITAL ARITHMETIC: OPERATIONS AND CIRCUITS scomplement Form The s complement of a binary number is obtained by changing each to a and each to a. In other words, change each bit in the number to its complement. The process is shown below. original binary number complement each bit to form s complement Thus, we say that the s complement of is. 2 s Complement Form The 2 s complement of a binary number is formed by taking the s complement of the number and adding to the leastsignificantbit position. The process is illustrated below for 2 = binary equivalent of 45 complement each bit to form s complement add to form 2 s complement 2 s complement of original binary number Thus, we say that is the 2 s complement representation of. Here s another example of converting a binary number to its 2 scomplement representation: + original binary number s complement add 2 s complement of original number Representing Signed Numbers Using 2 s Complement The 2 scomplement system for representing signed numbers works like this: If the number is positive, the magnitude is represented in its true binary form, and a sign bit of is placed in front of the MSB. This is shown in Figure 62 for +45. If the number is negative, the magnitude is represented in its 2 scomplement form, and a sign bit of is placed in front of the MSB. This is shown in Figure 62 for 45. FIGURE 62 Representation of signed numbers in the 2 scomplement system. Sign bit (+) True binary = +45 = 45 Sign bit ( ) 2's complement
6 SECTION 62/REPRESENTING SIGNED NUMBERS 3 The 2 scomplement system is used to represent signed numbers because, as we shall see, it allows us to perform the operation of subtraction by actually performing addition. This is significant because it means that a digital computer can use the same circuitry both to add and to subtract, thereby realizing a saving in hardware. EXAMPLE 6 Represent each of the following signed decimal numbers as a signed binary number in the 2 scomplement system. Use a total of five bits, including the sign bit. (a) +3 (b) 9 (c) +3 (d) 2 (e) 8 Solution (a) The number is positive, so the magnitude (3) will be represented in its truemagnitude form, that is, 3 = 2. Attaching the sign bit of, we have 3 sign bit (b) The number is negative, so the magnitude (9) must be represented in 2 scomplement form: 9 = 2 + s complement2 add to LSB2 2 s complement2 When we attach the sign bit of, the complete signed number becomes 9 sign bit The procedure we have just followed required two steps. First, we determined the 2 s complement of the magnitude, and then we attached the sign bit. This can be accomplished in one step if we include the sign bit in the 2 scomplement process. For example, to find the representation for 9, we start with the representation for +9, including the sign bit, and we take the 2 s complement of it in order to obtain the representation for = + 9 = s complement of each bit including sign bit2 add to LSB2 2 scomplement representation of  92 The result is, of course, the same as before. (c) The decimal value 3 can be represented in binary using only two bits. However, the problem statement requires a fourbit magnitude preceded by a sign bit. Thus, we have 3
7 32 CHAPTER 6/DIGITAL ARITHMETIC: OPERATIONS AND CIRCUITS In many situations the number of bits is fixed by the size of the registers that will be holding the binary numbers, so that s may have to be added in order to fill the required number of bit positions. (d) Start by writing +2 using five bits: +2 = + 2 = s complement2 add 2 2 scomplement representation of  22 (e) Start with +8: +8 = + 8 = complement each bit2 add 2 2 scomplement representation of  82 Sign Extension Example 6 required that we use a total of five bits to represent the signed numbers. The size of a register (number of flipflops) determines the number of binary digits that are stored for each number. Most digital systems today store numbers in registers sized in even multiples of four bits. In other words, the storage registers will be made up of 4, 8, 2, 6, 32, or 64 bits. In a system that stores eightbit numbers, seven bits represent the magnitude and the MSB represents the sign. If we need to store a positive fivebit number in an eightbit register, it makes sense to simply add leading zeros. The MSB (sign bit) is still, indicating a positive value. appended leading s binary value for 9 What happens when we try to store fivebit negative numbers in an eightbit register? In the previous section we found that the fivebit, 2 scomplement binary representation for 9 is. If we appended leading s, this would no longer be a negative number in eightbit format. The proper way to extend a negative number is to append leading s. Thus, the value stored for negative 9 is 2 s complement magnitude sign in fivebit format sign extension to eightbit format
8 SECTION 62/REPRESENTING SIGNED NUMBERS 33 Negation Negation is the operation of converting a positive number to its negative equivalent or a negative number to its positive equivalent. When signed binary numbers are represented in the 2 scomplement system, negation is performed simply by performing the 2 scomplement operation. To illustrate, let s start with +9 in eightbit binary form. Its signed representation is. If we take its 2 s complement we get, which represents the signed value 9. Likewise, we can start with the representation of 9, which is, and take its 2 s complement to get, which represents +9. These steps are diagrammed below. Start with 9 2 s complement (negate) 9 negate again 9 Thus, we negate a signed binary number by 2 scomplementing it. This negation changes the number to its equivalent of opposite sign. We used negation in steps (d) and (e) of Example 6 to convert positive numbers to their negative equivalents. EXAMPLE 62 Each of the following numbers is a fivebit signed binary number in the 2 scomplement system. Determine the decimal value in each case: (a) (b) (c) Solution (a) The sign bit is, so the number is positive and the other four bits represent the true magnitude of the number. That is, 2 = 2. Thus, the decimal number is +2. (b) The sign bit of is a, so we know that the number is negative, but we can t tell what the magnitude is. We can find the magnitude by negating (2 scomplementing) the number to convert it to its positive equivalent. + original negative number2 s complement2 add Because the result of the negation is = +6, the original number must be equivalent to 6. (c) Follow the same procedure as in (b): + original negative number2 s complement2 add Thus, = 5.
9 34 CHAPTER 6/DIGITAL ARITHMETIC: OPERATIONS AND CIRCUITS Special Case in 2 scomplement Representation Whenever a signed number has a in the sign bit and all s for the magnitude bits, its decimal equivalent is 2 N, where N is the number of bits in the magnitude. For example, and so on. Notice that in this special case, taking the 2 s complement of these numbers produces the value we started with because we are at the negative limit of the range of numbers that can be represented by this many bits. If we extend the sign of these special numbers, the normal negation procedure works fine. For example, extending the number (8) to (fivebit negative 8) and taking its 2 s complement we get (8), which is the magnitude of the negative number. Thus, we can state that the complete range of values that can be represented in the 2 scomplement system having N magnitude bits is There are a total of different values, including zero. For example, Table 6 lists all signed numbers that can be represented in four bits using the 2 scomplement system (note there are three magnitude bits, so N = 3). Note that the sequence starts at 2 N = 2 3 = 8 = 2 and proceeds upward to +(2 N  ) = = +7 = 2 by adding at each step as in an up counter. 2 N+ 2 N to +(2 N  ) TABLE 6 Decimal Value Signed Binary Using 2 s Complement +7 = = 2 3
10 SECTION 62/REPRESENTING SIGNED NUMBERS 35 EXAMPLE 63 What is the range of unsigned decimal values that can be represented in a byte? Solution Recall that a byte is eight bits. We are interested in unsigned numbers here, so there is no sign bit, and all of the eight bits are used for the magnitude. Therefore, the values will range from to 2 = 2 = 255 This is a total of 256 different values, which we could have predicted because 2 8 = 256. EXAMPLE 64 What is the range of signed decimal values that can be represented in a byte? Solution Because the MSB is to be used as the sign bit, there are seven bits for the magnitude. The largest negative value is The largest positive value is 2 = 2 7 = = = +27 Thus, the range is 28 to +27; this is a total of 256 different values, including zero. Alternatively, because there are seven magnitude bits ( N = 7), then there are 2 N+ = 2 8 = 256 different values. EXAMPLE 65 A certain computer is storing the following two signed numbers in its memory using the 2 scomplement system: 2 = +3 2 = 2 While executing a program, the computer is instructed to convert each number to its opposite sign; that is, change the +3 to 3 and change the 2 to +2. How will it do this? Solution This is the negation operation whereby a signed number can have its polarity changed simply by performing the 2 scomplement operation on the complete number, including the sign bit. The computer circuitry will take the signed number from memory, find its 2 s complement, and put the result back in memory.
11 36 CHAPTER 6/DIGITAL ARITHMETIC: OPERATIONS AND CIRCUITS REVIEW QUESTIONS. Represent each of the following values as an eightbit signed number in the 2 scomplement system. (a) +3 (b) 7 (c) Each of the following is a signed binary number in the 2 scomplement system. Determine the decimal equivalent for each. (a) (b) (c) 3. What range of signed decimal values can be represented in 2 bits (including the sign bit)? 4. How many bits are required to represent decimal values ranging from 5 to +5? 5. What is the largest negative decimal value that can be represented by a twobyte number? 6. Perform the 2 scomplement operation on each of the following. (a) (b) (c) 7. Define the negation operation. 63 ADDITION IN THE 2 scomplement SYSTEM We will now investigate how the operations of addition and subtraction are performed in digital machines that use the 2 scomplement representation for negative numbers. In the various cases to be considered, it is important to note that the sign bit of each number is operated on in the same manner as the magnitude bits. Case I: Two Positive Numbers. The addition of two positive numbers is straightforward. Consider the addition of +9 and +4: 9 (augend) 4 (addend) (sum 3) sign bits Note that the sign bits of the augend and the addend are both and the sign bit of the sum is, indicating that the sum is positive. Also note that the augend and the addend are made to have the same number of bits. This must always be done in the 2 scomplement system. Case II: Positive Number and Smaller Negative Number. Consider the addition of +9 and 4. Remember that the 4 will be in its 2 scomplement form. Thus, +4 () must be converted to 4 (). sign bits 9 (augend) 4 (addend) This carry is disregarded; the result is (sum 5). In this case, the sign bit of the addend is. Note that the sign bits also participate in the addition process. In fact, a carry is generated in the last position
12 SECTION 64/SUBTRACTION IN THE 2 SCOMPLEMENT SYSTEM 37 of addition. This carry is always disregarded, so that the final sum is, which is equivalent to +5. Consider the ad Case III: Positive Number and Larger Negative Number. dition of 9 and +4: The sum here has a sign bit of, indicating a negative number. Because the sum is negative, it is in 2 scomplement form, so that the last four bits,, actually represent the 2 s complement of the sum. To find the true magnitude of the sum, we must negate (2 scomplement) ; the result is = +5. Thus, represents 5. Case IV: Two Negative Numbers 9 4 sign bit This carry is disregarded; the result is (sum 3). This final result is again negative and in 2 scomplement form with a sign bit of. Negating (2 scomplementing) this result produces = +3. Case V: Equal and Opposite Numbers 9 4 (sum 5) negative sign bit 9 9 Disregard; the result is (sum ). The result is obviously +, as expected. REVIEW QUESTIONS Assume the 2 scomplement system for both questions.. True or false: Whenever the sum of two signed binary numbers has a sign bit of, the magnitude of the sum is in 2 scomplement form. 2. Add the following pairs of signed numbers. Express the sum as a signed binary number and as a decimal number. (a) + (b) SUBTRACTION IN THE 2 scomplement SYSTEM The subtraction operation using the 2 scomplement system actually involves the operation of addition and is really no different from the various cases for addition considered in Section 63. When subtracting one binary number
13 38 CHAPTER 6/DIGITAL ARITHMETIC: OPERATIONS AND CIRCUITS (the subtrahend) from another binary number (the minuend), use the following procedure:. Negate the subtrahend. This will change the subtrahend to its equivalent value of opposite sign. 2. Add this to the minuend. The result of this addition will represent the difference between the subtrahend and the minuend. Once again, as in all 2 scomplement arithmetic operations, it is necessary that both numbers have the same number of bits in their representations. Let us consider the case where +4 is to be subtracted from +9. minuend ( +9) : subtrahend ( +4) : Negate the subtrahend to produce, which represents 4. Now add this to the minuend. ( 9) ( 4) ( 5) Disregard, so the result is 5. When the subtrahend is changed to its 2 s complement, it actually becomes 4, so that we are adding 4 and +9, which is the same as subtracting +4 from +9. This is the same as case II of Section 63. Any subtraction operation, then, actually becomes one of addition when the 2 scomplement system is used. This feature of the 2 scomplement system has made it the most widely used of the methods available because it allows addition and subtraction to be performed by the same circuitry. Here s another example showing +9 subtracted from 4: (4)  (+9) Negate the subtrahend ( +9) to produce (9) and add this to the minuend (4). ( 4) ( 9) ( 3) Disregard The reader should verify the results of using the above procedure for the following subtractions: (a) +9  (4); (b) 9  (+4); (c) 9  (4); (d) +4  (4). Remember that when the result has a sign bit of, it is negative and in 2 scomplement form. Arithmetic Overflow In each of the previous addition and subtraction examples, the numbers that were added consisted of a sign bit and four magnitude bits. The answers also consisted of a sign bit and four magnitude bits. Any carry into the sixth bit position was disregarded. In all of the cases considered, the
14 SECTION 64/SUBTRACTION IN THE 2 SCOMPLEMENT SYSTEM 39 magnitude of the answer was small enough to fit into four bits. Let s look at the addition of +9 and +8. incorrect sign 9 8 incorrect magnitude The answer has a negative sign bit, which is obviously incorrect because we are adding two positive numbers. The answer should be +7, but the magnitude 7 requires more than four bits and therefore overflows into the signbit position. This overflow condition can occur only when two positive or two negative numbers are being added, and it always produces an incorrect result. Overflow can be detected by checking to see that the sign bit of the result is the same as the sign bits of the numbers being added. Subtraction in the 2 scomplement system is performed by negating the minuend and adding it to the subtrahend, so overflow can occur only when the minuend and subtrahend have different signs. For example, if we are subtracting 8 from +9, the 8 is negated to become +8 and is added to +9, just as shown above, and overflow produces an erroneous negative result because the magnitude is too large. A computer will have a special circuit to detect any overflow condition when two numbers are added or subtracted. This detection circuit will signal the computer s control unit that overflow has occurred and the result is incorrect. We will examine such a circuit in an endofchapter problem. Number Circles and Binary Arithmetic The concept of signed arithmetic and overflow can be illustrated by taking the numbers from Table 6 and bending them into a number circle as shown in Figure 63. Notice that there are two ways to look at this circle. It can be thought of as a circle of unsigned numbers (as shown in the outer ring) with minimum value and maximum 5, or as signed 2 scomplement numbers (as shown in the inner ring) with maximum value 7 and minimum 8. To add using a number circle, simply start at the value of the augend and FIGURE 63 A fourbit number circle UNSIGNED (MAX) (MIN) 5 NEGATIVE 5 6 SIGNED MIN MAX POSITIVE
15 3 CHAPTER 6/DIGITAL ARITHMETIC: OPERATIONS AND CIRCUITS advance around the number circle clockwise by the number of spaces in the addend. For example, to add 2 + 3, start at 2 () and then advance clockwise three more spaces to arrive at 5 (). Overflow occurs when the sum is too big to fit into fourbit signed format, meaning we have exceeded the maximum value of 7. On the number circle this is indicated when adding two positive values causes us to cross the line between (max positive) and (max negative). The number circle can also illustrate how 2 scomplement subtraction really works. For example, let s perform the subtraction of 5 from 3. Of course, we know the answer is 2, but let s run the problem through the number circle. First we start at the number 3 () on the number circle. The most apparent way to subtract is to move counterclockwise around the circle five spaces, which lands us on the number (2). The less obvious operation that illustrates 2 scomplement arithmetic is to add 5 to the number 3. Negative five (the 2 s complement of ) is which, interpreted as an unsigned binary number, represents the value (eleven) in decimal. Start at the number 3 () and move clockwise around the circle spaces and you will once again find yourself arriving at the number (2), which is the correct result. Any subtraction operation between fourbit numbers of opposite sign that produces a result greater than 7 or less than 8 is an overflow of the fourbit format and results in an incorrect answer. For example, 3 minus 6 should produce the answer 9, but moving clockwise six spaces from 3 lands us on the signed number 7: an overflow condition has occurred, giving us an incorrect answer. REVIEW QUESTIONS. Perform the subtraction on the following pairs of signed numbers using the 2 scomplement system. Express the results as signed binary numbers and as decimal values. (a)  (b)  2. How can arithmetic overflow be detected when signed numbers are being added? Subtracted? 65 MULTIPLICATION OF BINARY NUMBERS The multiplication of binary numbers is done in the same manner as the multiplication of decimal numbers. The process is actually simpler because the multiplier digits are either or and so we are always multiplying by or and no other digits. The following example illustrates for unsigned binary numbers: multiplicand 9 multiplier partial products } final product 99 In this example the multiplicand and the multiplier are in true binary form and no sign bits are used. The steps followed in the process are exactly the
16 SECTION 66/BINARY DIVISION 3 same as in decimal multiplication. First, the LSB of the multiplier is examined; in our example, it is a. This multiplies the multiplicand to produce, which is written down as the first partial product. Next, the second bit of the multiplier is examined. It is a, and so is written for the second partial product. Note that this second partial product is shifted one place to the left relative to the first one. The third bit of the multiplier is, and is written as the third partial product; again, it is shifted one place to the left relative to the previous partial product. The fourth multiplier bit is, and so the last partial product is shifted again one position to the left.the four partial products are then summed to produce the final product. Most digital machines can add only two binary numbers at a time. For this reason, the partial products formed during multiplication cannot all be added together at the same time. Instead, they are added together two at a time; that is, the first is added to the second, their sum is added to the third, and so on. This process is now illustrated for the example above: first partial product Add second partial product shifted left Add sum of first two partial products third partial product shifted left Add sum of first three partial products fourth partial product shifted left sum of four partial products, which equals final total product Multiplication in the 2 scomplement System In computers that use the 2 scomplement representation, multiplication is carried on in the manner described above, provided that both the multiplicand and the multiplier are put in true binary form. If the two numbers to be multiplied are positive, they are already in true binary form and are multiplied as they are. The resulting product is, of course, positive and is given a sign bit of. When the two numbers are negative, they will be in 2 scomplement form. The 2 s complement of each is taken to convert it to a positive number, and then the two numbers are multiplied. The product is kept as a positive number and is given a sign bit of. When one of the numbers is positive and the other is negative, the negative number is first converted to a positive magnitude by taking its 2 s complement. The product will be in truemagnitude form. However, the product must be negative because the original numbers are of opposite sign. Thus, the product is then changed to 2 scomplement form and is given a sign bit of. REVIEW QUESTION. Multiply the unsigned numbers and. 66 BINARY DIVISION The process for dividing one binary number (the dividend) by another (the divisor) is the same as that followed for decimal numbers, that which we usually refer to as long division. The actual process is simpler in binary because
17 32 CHAPTER 6/DIGITAL ARITHMETIC: OPERATIONS AND CIRCUITS when we are checking to see how many times the divisor goes into the dividend, there are only two possibilities, or. To illustrate, consider the following simple division examples:. / /. In the first example, we have 2 divided by 2, which is equivalent to 9, 3 in decimal. The resulting quotient is 2 = 3. In the second example, 2 is divided by 2, or, 4 in decimal. The result is. 2 = 2.5. In most modern digital machines, the subtractions that are part of the division operation are usually carried out using 2 scomplement subtraction, that is, taking the 2 s complement of the subtrahend and then adding. The division of signed numbers is handled in the same way as multiplication. Negative numbers are made positive by complementing, and the division is then carried out. If the dividend and the divisor are of opposite sign, the resulting quotient is changed to a negative number by taking its 2 scomplement and is given a sign bit of. If the dividend and the divisor are of the same sign, the quotient is left as a positive number and is given a sign bit of. 67 BCD ADDITION In Chapter 2, we stated that many computers and calculators use the BCD code to represent decimal numbers. Recall that this code takes each decimal digit and represents it by a fourbit code ranging from to. The addition of decimal numbers that are in BCD form can be best understood by considering the two cases that can occur when two decimal digits are added. Sum Equals 9 or Less Consider adding 5 and 4 using BCD to represent each digit: 5 BCD for 5 4 BCD for 4 9 BCD for 9 The addition is carried out as in normal binary addition, and the sum is, which is the BCD code for 9. As another example, take 45 added to 33: 45 BCD for BCD for BCD for 78 In this example, the fourbit codes for 5 and 3 are added in binary to produce, which is BCD for 8. Similarly, adding the seconddecimaldigit positions produces, which is BCD for 7. The total is, which is the BCD code for 78. In the examples above, none of the sums of the pairs of decimal digits exceeded 9; therefore, no decimal carries were produced. For these cases, the BCD addition process is straightforward and is actually the same as binary addition.
18 SECTION 67/BCD ADDITION 33 Sum Greater than 9 Consider the addition of 6 and 7 in BCD: 6 BCD for 6 7 BCD for 7 3 invalid code group for BCD The sum does not exist in the BCD code; it is one of the six forbidden or invalid fourbit code groups. This has occurred because the sum of the two digits exceeds 9. Whenever this occurs, the sum must be corrected by the addition of six () to take into account the skipping of the six invalid code groups: BCD for 6 BCD for 7 invalid sum add 6 for correction BCD for 3 3 As shown above, is added to the invalid sum and produces the correct BCD result. Note that with the addition of, a carry is produced in the second decimal position. This addition must be performed whenever the sum of the two decimal digits is greater than 9. As another example, take 47 plus 35 in BCD: 47 BCD for BCD for invalid sum in first digit add 6 to correct correct BCD sum 8 2 The addition of the fourbit codes for the 7 and 5 digits results in an invalid sum and is corrected by adding. Note that this generates a carry of, which is carried over to be added to the BCD sum of the secondposition digits. Consider the addition of 59 and 38 in BCD: 59 BCD for BCD for perform addition add 6 to correct BCD for Here, the addition of the least significant digits (LSDs) produces a sum of 7 =. This generates a carry into the next digit position to be added to the codes for 5 and 3. Since 7 7 9, a correction factor of 6 must be added to
19 34 CHAPTER 6/DIGITAL ARITHMETIC: OPERATIONS AND CIRCUITS the LSD sum. Addition of this correction does not generate a carry; the carry was already generated in the original addition. To summarize the BCD addition procedure:. Using ordinary binary addition, add the BCD code groups for each digit position. 2. For those positions where the sum is 9 or less, no correction is needed. The sum is in proper BCD form. 3. When the sum of two digits is greater than 9, a correction of should be added to that sum to get the proper BCD result. This case always produces a carry into the next digit position, either from the original addition (step ) or from the correction addition. The procedure for BCD addition is clearly more complicated than straight binary addition. This is also true of the other BCD arithmetic operations. Readers should perform the addition of Then check the correct procedure below. 275 BCD for BCD for perform addition add 6 to correct second digit BCD for 96 BCD Subtraction The process of subtracting BCD numbers is more difficult than addition. It involves a complementthenadd procedure similar to the 2 scomplement method. We do not cover it in this book. REVIEW QUESTIONS. How can you tell when a correction is needed in BCD addition? 2. Represent 35 and 265 in BCD and then perform BCD addition. Check your work by converting the result back to decimal. 68 HEXADECIMAL ARITHMETIC Hex numbers are used extensively in machinelanguage computer programming and in conjunction with computer memories (i.e., addresses). When working in these areas, you will encounter situations where hex numbers must be added or subtracted. Hex Addition Addition of hexadecimal numbers is done in much the same way as decimal addition, as long as you remember that the largest hex digit is F instead of 9. The following procedure is suggested:. Add the two hex digits in decimal, mentally inserting the decimal equivalent for those digits larger than 9.
20 SECTION 68/HEXADECIMAL ARITHMETIC If the sum is 5 or less, it can be directly expressed as a hex digit. 3. If the sum is greater than or equal to 6, subtract 6 and carry a to the next digit position. The following examples will illustrate the procedure. EXAMPLE 66 Add the hex numbers 58 and 24. Solution C Adding the LSDs (8 and 4) produces 2, which is C in hex. There is no carry into the next digit position. Adding 5 and 2 produces 7. EXAMPLE 67 Add the hex numbers 58 and 4B. Solution 58 +4B A3 Start by adding 8 and B, mentally substituting decimal for B. This produces a sum of 9. Because 9 is greater than 6, subtract 6 to get 3; write down the 3 and carry a into the next position. This carry is added to the 5 and 4 to produce a sum of, which is then converted to hexadecimal A. EXAMPLE 68 Add 3AF to 23C. Solution 3AF +23C 5EB The sum of F and C is considered as = 27. Because this is greater than 6, subtract 6 to get, which is hexadecimal B, and carry a into the second position. Add this carry to A and 3 to obtain E. There is no carry into the MSD position. Hex Subtraction Remember that hex numbers are just an efficient way to represent binary numbers.thus, we can subtract hex numbers using the same method we used for binary numbers. The 2 s complement of the hex subtrahend will be taken and then added to the minuend, and any carry out of the MSD position will be disregarded.
21 36 CHAPTER 6/DIGITAL ARITHMETIC: OPERATIONS AND CIRCUITS How do we find the 2 s complement of a hex number? One way is to convert it to binary, take the 2 s complement of the binary equivalent, and then convert it back to hex. This process is illustrated below. 73A hex number convert to binary take 2 s complement 8C6 convert back to hex There is a quicker procedure: subtract each hex digit from F; then add. Let s try this for the same hex number from the example above. F F F 7 3 A subtract each digit from F 8 C 5 add 8 C 6 hex equivalent of 2 s complement Try either of the procedures above on the hex number E63. The correct result for the 2 s complement is 9D. CALCULATOR HINT On a hex calculator, you can subtract the hex digits from a string of F s and then add one as we just demonstrated, or you can add one to the string of all F s and then subtract. For example, adding to FFF 6 yields 6. On the hex calculator enter:  73A = The answer is 8C6 EXAMPLE 69 Subtract 3A5 6 from Solution First, convert the subtrahend (3A5) to its 2 scomplement form by using either method presented above. The result is C5B. Then add this to the minuend (592): 592 C5B ED Disregard carry. Ignore the carry out of the MSD addition; the result is ED. We can prove that this is correct by adding ED to 3A5 and checking to see that it equals Hex Representation of Signed Numbers The data stored in a microcomputer s internal working memory or on a hard disk or CD ROM are typically stored in bytes (groups of eight bits). The data
22 SECTION 69/ARITHMETIC CIRCUITS 37 TABLE 62 Hex Address Stored Binary Data Hex Value Decimal Value 4 3A E byte stored in a particular memory location is often expressed in hexadecimal because it is more efficient and less errorprone than expressing it in binary. When the data consist of signed numbers, it is helpful to be able to recognize whether a hex value represents a positive or a negative number. For example, Table 62 lists the data stored in a small segment of memory starting at address 4. Each memory location stores a single byte (eight bits), which is the binary equivalent of a signed decimal number. The table also shows the hex equivalent of each byte. For a negative data value, the sign bit (MSB) of the binary number will be a ; this will always make the MSD of the hex number 8 or greater. When the data value is positive, the sign bit will be a, and the MSD of the hex number will be 7 or less. The same holds true no matter how many digits are in the hex number. When the MSD is 8 or greater, the number being represented is negative; when the MSD is 7 or less, the number is positive. REVIEW QUESTIONS. Add 67F + 2A4. 2. Subtract 67F  2A4. 3. Which of the following hex numbers represent positive values: 2F, 77EC, C, 6D, FFFF? 69 ARITHMETIC CIRCUITS One essential function of most computers and calculators is the performance of arithmetic operations. These operations are all performed in the arithmetic/logic unit of a computer, where logic gates and flipflops are combined so that they can add, subtract, multiply, and divide binary numbers. These circuits perform arithmetic operations at speeds that are not humanly possible. Typically, an addition operation will take less than ns. We will now study some of the basic arithmetic circuits that are used to perform the arithmetic operations discussed earlier. In some cases, we will go through the actual design process, even though the circuits may be commercially available in integratedcircuit form, to provide more practice in the use of the techniques learned in Chapter 4. Arithmetic/Logic Unit All arithmetic operations take place in the arithmetic/logic unit (ALU) of a computer. Figure 64 is a block diagram showing the major elements included in a typical ALU. The main purpose of the ALU is to accept binary
23 38 CHAPTER 6/DIGITAL ARITHMETIC: OPERATIONS AND CIRCUITS FIGURE 64 Functional parts of an ALU. Accumulator Memory unit Logic circuits Control unit B register Arithmetic/logic unit data that are stored in the memory and to execute arithmetic and logic operations on these data according to instructions from the control unit. The arithmetic/logic unit contains at least two flipflop registers: the B register and the accumulator register. It also contains combinational logic, which performs the arithmetic and logic operations on the binary numbers that are stored in the B register and the accumulator. A typical sequence of operations may occur as follows:. The control unit receives an instruction (from the memory unit) specifying that a number stored in a particular memory location (address) is to be added to the number presently stored in the accumulator register. 2. The number to be added is transferred from memory to the B register. 3. The number in the B register and the number in the accumulator register are added together in the logic circuits (upon command from the control unit). The resulting sum is then sent to the accumulator to be stored. 4. The new number in the accumulator can remain there so that another number can be added to it or, if the particular arithmetic process is finished, it can be transferred to memory for storage. These steps should make it apparent how the accumulator register derives its name. This register accumulates the sums that occur when performing successive additions between new numbers acquired from memory and the previously accumulated sum. In fact, for any arithmetic problem containing several steps, the accumulator usually contains the results of the intermediate steps as they are completed as well as the final result when the problem is finished. 6 PARALLEL BINARY ADDER Computers and calculators perform the addition operation on two binary numbers at a time, where each binary number can have several binary digits. Figure 65 illustrates the addition of two fivebit numbers. The augend is stored in the accumulator register; that is, the accumulator contains five FFs, storing the values in successive FFs. Similarly, the addend, the number that is to be added to the augend, is stored in the B register (in this case, ). The addition process starts by adding the least significant bits (LSBs) of the augend and addend. Thus, + =, which means that the sum for that position is, with a carry of.
24 SECTION 6/PARALLEL BINARY ADDER 39 FIGURE 65 Typical binary addition process. Augend Stored in accumulator register Addend Stored in B register Sum Carry (To be added to next position) This carry must be added to the next position along with the augend and addend bits in that position. Thus, in the second position, + + =, which is again a sum of and a carry of. This carry is added to the next position together with the augend and addend bits in that position, and so on, for the remaining positions, as shown in Figure 65. At each step in this addition process, we are performing the addition of three bits: the augend bit, the addend bit, and a carry bit from the previous position. The result of the addition of these three bits produces two bits: a sum bit, and a carry bit that is to be added to the next position. It should be clear that the same process is followed for each bit position. Thus, if we can design a logic circuit that can duplicate this process, then all we have to do is to use the identical circuit for each of the bit positions. This is illustrated in Figure 66. In this diagram, variables A 4, A 3, A 2, A,and A represent the bits of the augend that are stored in the accumulator (which is also called the A register). Variables B 4, B 3, B 2, B, and B represent the bits of the addend stored in the B register.variables C 4, C 3, C 2, C,and C represent the carry bits into the corresponding positions. Variables S4, S 3, S 2, S, S are the sum output bits for each position. Corresponding bits of the augend and addend are fed to a logic circuit called a full adder (FA), along with a carry bit from the previous position. For example, bits and are fed into full adder along A B B 4 B 3 B 2 B B Addend bits from B register C 5 C 4 C 3 C 2 C C FA #4 FA #3 FA #2 FA # Full adder # S 4 S 3 S 2 S S A 4 A 3 A 2 A A Augend bits from A register Sum appears at S 4, S 3, S 2, S, S outputs. FIGURE 66 Block diagram of a fivebit parallel adder circuit using full adders.
25 32 CHAPTER 6/DIGITAL ARITHMETIC: OPERATIONS AND CIRCUITS C with, which is the carry bit produced by the addition of the and B bits. Bits A and B are fed into full adder along with C. A and B are the LSBs of the augend and addend, so it appears that C would always have to be because there can be no carry into that position. We shall see, however, that there will be situations when C can also be. The fulladder circuit used in each position has three inputs: an A bit, a B bit, and a C bit. It also produces two outputs: a sum bit and a carry bit. For example, full adder has inputs A, B, and C, and it produces outputs S and C. Full adder had A, B, and C as inputs and S and C 2 as outputs, and so on. This arrangement is repeated for as many positions as there are in the augend and addend. Although this illustration is for fivebit numbers, in modern computers the numbers usually range from 8 to 64 bits. The arrangement in Figure 66 is called a parallel adder because all of the bits of the augend and addend are present and are fed into the adder circuits simultaneously. This means that the additions in each position are taking place at the same time. This is different from how we add on paper, taking each position one at a time starting with the LSB. Clearly, parallel addition is extremely fast. More will be said about this later. A REVIEW QUESTIONS. How many inputs does a full adder have? How many outputs? 2. Assume the following input levels in Figure 66: A 4 A 3 A 2 A A = ; B 4 B 3 B 2 B B = ; C =. (a) What are the logic levels at the outputs of FA #2? (b) What is the logic level at the C 5 output? 6 DESIGN OF A FULL ADDER Now that we know the function of the full adder, we can design a logic circuit that will perform this function. First, we must construct a truth table showing the various input and output values for all possible cases. Figure 67 shows the truth table having three inputs, A, B, and C IN, and two outputs, S and C OUT. There are eight possible cases for the three inputs, and for each FIGURE 67 Truth table for a fulladder circuit. Augend bit input A Addend bit input B Carry bit input C IN Sum bit output S Carry bit output C OUT C IN B FA S C OUT A
26 SECTION 6/DESIGN OF A FULL ADDER 32 case the desired output values are listed. For example, consider the case A =, B =, and C IN =. The full adder (FA) must add these bits to produce a sum (S) of and a carry ( C OUT ) of.the reader should check the other cases to be sure they are understood. Because there are two outputs, we will design the circuitry for each output individually, starting with the S output. The truth table shows that there are four cases where S is to be a. Using the sumofproducts method, we can write the expression for S as S = A BC IN + ABC IN + ABC IN + ABC IN (6) We can now try to simplify this expression by factoring. Unfortunately, none of the terms in the expression has two variables in common with any of the other terms. However, A can be factored from the first two terms, and A can be factored from the last two terms: S = A(BC IN + BC IN ) + A(B C IN + BC IN ) The first term in parentheses should be recognized as the exclusiveor combination of B and C IN, which can be written as B { C IN. The second term in parentheses should be recognized as the exclusivenor of B and C IN, which can be written as B { C IN. Thus, the expression for S becomes S = A(B { C IN ) + A(B { C IN ) If we let X = B { C IN, this can be written as S = A # X + A # X = A { X which is simply the exclusiveor of A and X. Replacing the expression for X, we have S = A { [B { C IN ] (62) C OUT Consider now the output in the truth table of Figure 67. We can write the sumofproducts expression for as follows: C OUT C OUT = ABC IN + ABC IN + ABC IN + ABC IN This expression can be simplified by factoring. We will employ the trick introduced in Chapter 4, whereby we will use the ABC IN term three times because it has common factors with each of the other terms. Hence, C OUT = BC IN (A + A) + AC IN (B + B) + AB(C IN + C IN ) = BC IN + AC IN + AB (63) This expression cannot be simplified further. Expressions (62) and (63) can be implemented as shown in Figure 68. Several other implementations can be used to produce the same expressions for S and C OUT, none of which has any particular advantage over those shown.the complete circuit with inputs A, B, and C IN and outputs S and C OUT represents the full adder. Each of the FAs in Figure 66 contains this same circuitry (or its equivalent).
27 322 CHAPTER 6/DIGITAL ARITHMETIC: OPERATIONS AND CIRCUITS FIGURE 68 Complete circuitry for a full adder. A B S C IN C OUT FA KMap Simplification We simplified the expressions for S and C OUT using algebraic methods. The K map method can also be used. Figure 69(a) shows the K map for the S output. This map has no adjacent s, and so there are no pairs or quads to loop. Thus, the expression for S cannot be simplified using the K map. This points out a limitation of the Kmap method compared with the algebraic method. We were able to simplify the expression for S through factoring and the use of XOR and XNOR operations. The K map for the C OUT output is shown in Figure 69(b). The three pairs that are looped will produce the same expression obtained from the algebraic method. Half Adder The FA operates on three inputs to produce a sum and carry output. In some cases, a circuit is needed that will add only two input bits, to produce FIGURE 69 K mappings for the fulladder outputs. AB C IN C IN AB C IN C IN AB AB AB AB AB AB K map for S K map for C OUT S = ABC IN + ABC IN + ABC IN + ABC IN (a) C OUT = BC IN + AC IN + AB (b)
CO Computer Architecture and Programming Languages CAPL. Lecture 9
CO20320241 Computer Architecture and Programming Languages CAPL Lecture 9 Dr. Kinga Lipskoch Fall 2017 A Fourbit Number Circle CAPL Fall 2017 2 / 38 Functional Parts of an ALU CAPL Fall 2017 3 / 38 Addition
More informationBinary Addition. Add the binary numbers and and show the equivalent decimal addition.
Binary Addition The rules for binary addition are 0 + 0 = 0 Sum = 0, carry = 0 0 + 1 = 0 Sum = 1, carry = 0 1 + 0 = 0 Sum = 1, carry = 0 1 + 1 = 10 Sum = 0, carry = 1 When an input carry = 1 due to a previous
More informationD I G I T A L C I R C U I T S E E
D I G I T A L C I R C U I T S E E Digital Circuits Basic Scope and Introduction This book covers theory solved examples and previous year gate question for following topics: Number system, Boolean algebra,
More informationDLD VIDYA SAGAR P. potharajuvidyasagar.wordpress.com. Vignana Bharathi Institute of Technology UNIT 1 DLD P VIDYA SAGAR
UNIT I Digital Systems: Binary Numbers, Octal, Hexa Decimal and other base numbers, Number base conversions, complements, signed binary numbers, Floating point number representation, binary codes, error
More informationDigital Arithmetic. Digital Arithmetic: Operations and Circuits Dr. Farahmand
Digital Arithmetic Digital Arithmetic: Operations and Circuits Dr. Farahmand Binary Arithmetic Digital circuits are frequently used for arithmetic operations Fundamental arithmetic operations on binary
More informationcarry in carry 1101 carry carry
Chapter Binary arithmetic Arithmetic is the process of applying a mathematical operator (such as negation or addition) to one or more operands (the values being operated upon). Binary arithmetic works
More information(+A) + ( B) + (A B) (B A) + (A B) ( A) + (+ B) (A B) + (B A) + (A B) (+ A) (+ B) + (A  B) (B A) + (A B) ( A) ( B) (A B) + (B A) + (A B)
COMPUTER ARITHMETIC 1. Addition and Subtraction of Unsigned Numbers The direct method of subtraction taught in elementary schools uses the borrowconcept. In this method we borrow a 1 from a higher significant
More information1. NUMBER SYSTEMS USED IN COMPUTING: THE BINARY NUMBER SYSTEM
1. NUMBER SYSTEMS USED IN COMPUTING: THE BINARY NUMBER SYSTEM 1.1 Introduction Given that digital logic and memory devices are based on two electrical states (on and off), it is natural to use a number
More informationDLD VIDYA SAGAR P. potharajuvidyasagar.wordpress.com. Vignana Bharathi Institute of Technology UNIT 3 DLD P VIDYA SAGAR
DLD UNIT III Combinational Circuits (CC), Analysis procedure, Design Procedure, Combinational circuit for different code converters and other problems, Binary Adder Subtractor, Decimal Adder, Binary Multiplier,
More information*Instruction Matters: Purdue Academic Course Transformation. Introduction to Digital System Design. Module 4 Arithmetic and Computer Logic Circuits
Purdue IM:PACT* Fall 2018 Edition *Instruction Matters: Purdue Academic Course Transformation Introduction to Digital System Design Module 4 Arithmetic and Computer Logic Circuits Glossary of Common Terms
More informationChapter 10  Computer Arithmetic
Chapter 10  Computer Arithmetic Luis Tarrataca luis.tarrataca@gmail.com CEFETRJ L. Tarrataca Chapter 10  Computer Arithmetic 1 / 126 1 Motivation 2 Arithmetic and Logic Unit 3 Integer representation
More informationChapter 1 Review of Number Systems
1.1 Introduction Chapter 1 Review of Number Systems Before the inception of digital computers, the only number system that was in common use is the decimal number system which has a total of 10 digits
More informationEE 109 Unit 6 Binary Arithmetic
EE 109 Unit 6 Binary Arithmetic 1 2 Semester Transition Point At this point we are going to start to transition in our class to look more at the hardware organization and the lowlevel software that is
More informationCOMPUTER ARITHMETIC (Part 1)
Eastern Mediterranean University School of Computing and Technology ITEC255 Computer Organization & Architecture COMPUTER ARITHMETIC (Part 1) Introduction The two principal concerns for computer arithmetic
More informationCOMBINATIONAL LOGIC CIRCUITS
COMBINATIONAL LOGIC CIRCUITS 4.1 INTRODUCTION The digital system consists of two types of circuits, namely: (i) Combinational circuits and (ii) Sequential circuits A combinational circuit consists of logic
More informationDigital Fundamentals. CHAPTER 2 Number Systems, Operations, and Codes
Digital Fundamentals CHAPTER 2 Number Systems, Operations, and Codes Decimal Numbers The decimal number system has ten digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9 The decimal numbering system has a base of
More informationChapter 2: Number Systems
Chapter 2: Number Systems Logic circuits are used to generate and transmit 1s and 0s to compute and convey information. This twovalued number system is called binary. As presented earlier, there are many
More informationChapter 4 Arithmetic Functions
Logic and Computer Design Fundamentals Chapter 4 Arithmetic Functions Charles Kime & Thomas Kaminski 2008 Pearson Education, Inc. (Hyperlinks are active in View Show mode) Overview Iterative combinational
More informationCS/COE 0447 Example Problems for Exam 2 Spring 2011
CS/COE 0447 Example Problems for Exam 2 Spring 2011 1) Show the steps to multiply the 4bit numbers 3 and 5 with the fast shiftadd multipler. Use the table below. List the multiplicand (M) and product
More informationDigital Systems and Binary Numbers
Digital Systems and Binary Numbers Prof. Wangrok Oh Dept. of Information Communications Eng. Chungnam National University Prof. Wangrok Oh(CNU) 1 / 51 Overview 1 Course Summary 2 Binary Numbers 3 NumberBase
More informationCHAPTER TWO. Data Representation ( M.MORRIS MANO COMPUTER SYSTEM ARCHITECTURE THIRD EDITION ) IN THIS CHAPTER
1 CHAPTER TWO Data Representation ( M.MORRIS MANO COMPUTER SYSTEM ARCHITECTURE THIRD EDITION ) IN THIS CHAPTER 21 Data Types 22 Complements 23 FixedPoint Representation 24 FloatingPoint Representation
More informationCOMPUTER ARCHITECTURE AND ORGANIZATION. Operation Add Magnitudes Subtract Magnitudes (+A) + ( B) + (A B) (B A) + (A B)
Computer Arithmetic Data is manipulated by using the arithmetic instructions in digital computers. Data is manipulated to produce results necessary to give solution for the computation problems. The Addition,
More informationSemester Transition Point. EE 109 Unit 11 Binary Arithmetic. Binary Arithmetic ARITHMETIC
1 2 Semester Transition Point EE 109 Unit 11 Binary Arithmetic At this point we are going to start to transition in our class to look more at the hardware organization and the lowlevel software that is
More informationChapter 5: Computer Arithmetic. In this chapter you will learn about:
Slide 1/29 Learning Objectives In this chapter you will learn about: Reasons for using binary instead of decimal numbers Basic arithmetic operations using binary numbers Addition (+) Subtraction () Multiplication
More informationEE292: Fundamentals of ECE
EE292: Fundamentals of ECE Fall 2012 TTh 10:0011:15 SEB 1242 Lecture 22 121115 http://www.ee.unlv.edu/~b1morris/ee292/ 2 Outline Review Binary Number Representation Binary Arithmetic Combinatorial Logic
More informationChapter 3: part 3 Binary Subtraction
Chapter 3: part 3 Binary Subtraction Iterative combinational circuits Binary adders Half and full adders Ripple carry and carry lookahead adders Binary subtraction Binary addersubtractors Signed binary
More informationDIGITAL SYSTEM FUNDAMENTALS (ECE 421) DIGITAL ELECTRONICS FUNDAMENTAL (ECE 422) COURSE / CODE NUMBER SYSTEM
COURSE / CODE DIGITAL SYSTEM FUNDAMENTALS (ECE 421) DIGITAL ELECTRONICS FUNDAMENTAL (ECE 422) NUMBER SYSTEM A considerable subset of digital systems deals with arithmetic operations. To understand the
More informationNumber System. Introduction. Decimal Numbers
Number System Introduction Number systems provide the basis for all operations in information processing systems. In a number system the information is divided into a group of symbols; for example, 26
More informationWeek 7: Assignment Solutions
Week 7: Assignment Solutions 1. In 6bit 2 s complement representation, when we subtract the decimal number +6 from +3, the result (in binary) will be: a. 111101 b. 000011 c. 100011 d. 111110 Correct answer
More informationLearning Objectives. Binary over Decimal. In this chapter you will learn about:
Ref Page Slide 1/29 Learning Objectives In this chapter you will learn about: Reasons for using binary instead of decimal numbers Basic arithmetic operations using binary numbers Addition (+) Subtraction
More informationMC1601 Computer Organization
MC1601 Computer Organization Unit 1 : Digital Fundamentals Lesson1 : Number Systems and Conversions (KSB) (MCA) (200912/ODD) (200910/1 A&B) Coverage  Lesson1 Shows how various data types found in digital
More informationELECTRICAL AND COMPUTER ENGINEERING DEPARTMENT, OAKLAND UNIVERSITY ECE278: Digital Logic Design Fall Notes  Unit 4. hundreds.
ECE78: Digital Logic Design Fall 6 UNSIGNED INTEGER NUMBERS Notes  Unit 4 DECIMAL NUMBER SYSTEM A decimal digit can take values from to 9: Digitbydigit representation of a positive integer number (powers
More informationELECTRICAL AND COMPUTER ENGINEERING DEPARTMENT, OAKLAND UNIVERSITY ECE2700: Digital Logic Design Winter Notes  Unit 4. hundreds.
UNSIGNED INTEGER NUMBERS Notes  Unit 4 DECIMAL NUMBER SYSTEM A decimal digit can take values from to 9: Digitbydigit representation of a positive integer number (powers of ): DIGIT 3 4 5 6 7 8 9 Number:
More informationChapter 5: Computer Arithmetic
Slide 1/29 Learning Objectives Computer Fundamentals: Pradeep K. Sinha & Priti Sinha In this chapter you will learn about: Reasons for using binary instead of decimal numbers Basic arithmetic operations
More informationChapter 5 : Computer Arithmetic
Chapter 5 Computer Arithmetic Integer Representation: (Fixedpoint representation): An eight bit word can be represented the numbers from zero to 255 including = 1 = 1 11111111 = 255 In general if an nbit
More informationIT 201 Digital System Design Module II Notes
IT 201 Digital System Design Module II Notes 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.
More information2. BOOLEAN ALGEBRA 2.1 INTRODUCTION
2. BOOLEAN ALGEBRA 2.1 INTRODUCTION In the previous chapter, we introduced binary numbers and binary arithmetic. As you saw in binary arithmetic and in the handling of floatingpoint numbers, there is
More informationCHW 261: Logic Design
CHW 261: Logic Design Instructors: Prof. Hala Zayed Dr. Ahmed Shalaby http://www.bu.edu.eg/staff/halazayed14 http://bu.edu.eg/staff/ahmedshalaby14# Slide 1 Slide 2 Slide 3 Digital Fundamentals CHAPTER
More informationNH 67, Karur Trichy Highways, Puliyur C.F, Karur District UNITII COMBINATIONAL CIRCUITS
NH 67, Karur Trichy Highways, Puliyur C.F, 639 114 Karur District DEPARTMENT OF ELETRONICS AND COMMUNICATION ENGINEERING COURSE NOTES SUBJECT: DIGITAL ELECTRONICS CLASS: II YEAR ECE SUBJECT CODE: EC2203
More informationExcerpt from "Art of Problem Solving Volume 1: the Basics" 2014 AoPS Inc.
Chapter 5 Using the Integers In spite of their being a rather restricted class of numbers, the integers have a lot of interesting properties and uses. Math which involves the properties of integers is
More informationMicrocomputers. Outline. Number Systems and Digital Logic Review
Microcomputers Number Systems and Digital Logic Review Lecture 11 Outline Number systems and formats Common number systems Base Conversion Integer representation Signed integer representation Binary coded
More informationBINARY SYSTEM. Binary system is used in digital systems because it is:
CHAPTER 2 CHAPTER CONTENTS 2.1 Binary System 2.2 Binary Arithmetic Operation 2.3 Signed & Unsigned Numbers 2.4 Arithmetic Operations of Signed Numbers 2.5 Hexadecimal Number System 2.6 Octal Number System
More informationExcerpt from: Stephen H. Unger, The Essence of Logic Circuits, Second Ed., Wiley, 1997
Excerpt from: Stephen H. Unger, The Essence of Logic Circuits, Second Ed., Wiley, 1997 APPENDIX A.1 Number systems and codes Since tenfingered humans are addicted to the decimal system, and since computers
More informationUNIT  I: COMPUTER ARITHMETIC, REGISTER TRANSFER LANGUAGE & MICROOPERATIONS
UNIT  I: COMPUTER ARITHMETIC, REGISTER TRANSFER LANGUAGE & MICROOPERATIONS (09 periods) Computer Arithmetic: Data Representation, Fixed Point Representation, Floating Point Representation, Addition and
More information1010 2?= ?= CS 64 Lecture 2 Data Representation. Decimal Numbers: Base 10. Reading: FLD Digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
CS 64 Lecture 2 Data Representation Reading: FLD 1.21.4 Decimal Numbers: Base 10 Digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 Example: 3271 = (3x10 3 ) + (2x10 2 ) + (7x10 1 ) + (1x10 0 ) 1010 10?= 1010 2?= 1
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 informationDepartment of Electrical and Computer Engineering University of Wisconsin  Madison. ECE/CS 352 Digital System Fundamentals.
Department of Electrical and Computer Engineering University of Wisconsin  Madison ECE/C 352 Digital ystem Fundamentals Quiz #2 Thursday, March 7, 22, 7:158:3PM 1. (15 points) (a) (5 points) NAND, NOR
More informationNumber Systems Base r
King Fahd University of Petroleum & Minerals Computer Engineering Dept COE 2 Fundamentals of Computer Engineering Term 22 Dr. Ashraf S. Hasan Mahmoud Rm 2244 Ext. 724 Email: ashraf@ccse.kfupm.edu.sa 3/7/23
More informationCOMPUTER ARCHITECTURE AND ORGANIZATION Register Transfer and Microoperations 1. Introduction A digital system is an interconnection of digital
Register Transfer and Microoperations 1. Introduction A digital system is an interconnection of digital hardware modules that accomplish a specific informationprocessing task. Digital systems vary in
More informationRead this before starting!
Points missed: Student's Name: Total score: /100 points East Tennessee State University Department of Computer and Information Sciences CSCI 2150 (Tarnoff) Computer Organization TEST 1 for Spring Semester,
More informationNumber Systems and Computer Arithmetic
Number Systems and Computer Arithmetic Counting to four billion two fingers at a time What do all those bits mean now? bits (011011011100010...01) instruction Rformat Iformat... integer data number text
More informationBits, Words, and Integers
Computer Science 52 Bits, Words, and Integers Spring Semester, 2017 In this document, we look at how bits are organized into meaningful data. In particular, we will see the details of how integers are
More informationCombinational Circuits
Combinational Circuits Combinational circuit consists of an interconnection of logic gates They react to their inputs and produce their outputs by transforming binary information n input binary variables
More informationCOMPUTER ORGANIZATION AND ARCHITECTURE
COMPUTER ORGANIZATION AND ARCHITECTURE For COMPUTER SCIENCE COMPUTER ORGANIZATION. SYLLABUS AND ARCHITECTURE Machine instructions and addressing modes, ALU and datapath, CPU control design, Memory interface,
More information1. Mark the correct statement(s)
1. Mark the correct statement(s) 1.1 A theorem in Boolean algebra: a) Can easily be proved by e.g. logic induction b) Is a logical statement that is assumed to be true, c) Can be contradicted by another
More informationChapter 4. Combinational Logic
Chapter 4. Combinational Logic Tong In Oh 1 4.1 Introduction Combinational logic: Logic gates Output determined from only the present combination of inputs Specified by a set of Boolean functions Sequential
More informationII/IV B.Tech (Regular/Supplementary) DEGREE EXAMINATION. Answer ONE question from each unit.
Hall Ticket Number: 14CS IT303 November, 2017 Third Semester Time: Three Hours Answer Question No.1 compulsorily. II/IV B.Tech (Regular/Supplementary) DEGREE EXAMINATION Common for CSE & IT Digital Logic
More informationGet Free notes at ModuleI One s Complement: Complement all the bits.i.e. makes all 1s as 0s and all 0s as 1s Two s Complement: One s complement+1 SIGNED BINARY NUMBERS Positive integers (including zero)
More informationUNITII. Part2: CENTRAL PROCESSING UNIT
Page1 UNITII Part2: CENTRAL PROCESSING UNIT Stack Organization Instruction Formats Addressing Modes Data Transfer And Manipulation Program Control Reduced Instruction Set Computer (RISC) Introduction:
More informationDigital Fundamentals
Digital Fundamentals Tenth Edition Floyd Chapter 2 2009 Pearson Education, Upper 2008 Pearson Saddle River, Education NJ 07458. All Rights Reserved Decimal Numbers The position of each digit in a weighted
More informationLogic, Words, and Integers
Computer Science 52 Logic, Words, and Integers 1 Words and Data The basic unit of information in a computer is the bit; it is simply a quantity that takes one of two values, 0 or 1. A sequence of k bits
More informationUNIT 2 NUMBER SYSTEM AND PROGRAMMING LANGUAGES
UNIT 2 NUMBER SYSTEM AND PROGRAMMING LANGUAGES Structure 2.0 Introduction 2.1 Unit Objectives 2.2 Number Systems 2.3 Bits and Bytes 2.4 Binary Number System 2.5 Decimal Number System 2.6 Octal Number System
More informationSigned umbers. Sign/Magnitude otation
Signed umbers So far we have discussed unsigned number representations. In particular, we have looked at the binary number system and shorthand methods in representing binary codes. With m binary digits,
More informationCPE 323 REVIEW DATA TYPES AND NUMBER REPRESENTATIONS IN MODERN COMPUTERS
CPE 323 REVIEW DATA TYPES AND NUMBER REPRESENTATIONS IN MODERN COMPUTERS Aleksandar Milenković The LaCASA Laboratory, ECE Department, The University of Alabama in Huntsville Email: milenka@uah.edu Web:
More informationLogic Circuits I ECE 1411 Thursday 4:45pm7:20pm. Nathan Pihlstrom.
Logic Circuits I ECE 1411 Thursday 4:45pm7:20pm Nathan Pihlstrom www.uccs.edu/~npihlstr My Background B.S.E.E. from Colorado State University M.S.E.E. from Colorado State University M.B.A. from UCCS Ford
More informationNUMBER SYSTEMS AND CODES
C H A P T E R 69 Learning Objectives Number Systems The Decimal Number System Binary Number System Binary to Decimal Conversion Binary Fractions DoubleDadd Method Decimal to Binary Conversion Shifting
More informationSlide Set 1. for ENEL 339 Fall 2014 Lecture Section 02. Steve Norman, PhD, PEng
Slide Set 1 for ENEL 339 Fall 2014 Lecture Section 02 Steve Norman, PhD, PEng Electrical & Computer Engineering Schulich School of Engineering University of Calgary Fall Term, 2014 ENEL 353 F14 Section
More informationInternal Data Representation
Appendices This part consists of seven appendices, which provide a wealth of reference material. Appendix A primarily discusses the number systems and their internal representation. Appendix B gives information
More information(Refer Slide Time 6:48)
Digital Circuits and Systems Prof. S. Srinivasan Department of Electrical Engineering Indian Institute of Technology Madras Lecture  8 Karnaugh Map Minimization using Maxterms We have been taking about
More information60265: Winter ANSWERS Exercise 4 Combinational Circuit Design
60265: Winter 2010 Computer Architecture I: Digital Design ANSWERS Exercise 4 Combinational Circuit Design Question 1. Onebit Comparator [ 1 mark ] Consider two 1bit inputs, A and B. If we assume that
More informationChapter 2. Data Representation in Computer Systems
Chapter 2 Data Representation in Computer Systems Chapter 2 Objectives Understand the fundamentals of numerical data representation and manipulation in digital computers. Master the skill of converting
More informationDIGITAL SYSTEM DESIGN
DIGITAL SYSTEM DESIGN UNIT I: Introduction to Number Systems and Boolean Algebra Digital and Analog Basic Concepts, Some history of Digital SystemsIntroduction to number systems, Binary numbers, Number
More informationCPE 323 REVIEW DATA TYPES AND NUMBER REPRESENTATIONS IN MODERN COMPUTERS
CPE 323 REVIEW DATA TYPES AND NUMBER REPRESENTATIONS IN MODERN COMPUTERS Aleksandar Milenković The LaCASA Laboratory, ECE Department, The University of Alabama in Huntsville Email: milenka@uah.edu Web:
More informationCombinational Logic. Prof. Wangrok Oh. Dept. of Information Communications Eng. Chungnam National University. Prof. Wangrok Oh(CNU) 1 / 93
Combinational Logic Prof. Wangrok Oh Dept. of Information Communications Eng. Chungnam National University Prof. Wangrok Oh(CNU) / 93 Overview Introduction 2 Combinational Circuits 3 Analysis Procedure
More informationLogic design Ibn Al Haitham collage /Computer science Eng. Sameer
DEMORGAN'S THEOREMS One of DeMorgan's theorems stated as follows: The complement of a product of variables is equal to the sum of the complements of the variables. DeMorgan's second theorem is stated as
More informationKorea University of Technology and Education
MEC52 디지털공학 Binary Systems JeeHwan Ryu School of Mechanical Engineering Binary Numbers a 5 a 4 a 3 a 2 a a.a  a 2 a 3 base or radix = a n r n a n r n...a 2 r 2 a ra a  r  a 2 r 2...a m r m
More informationComputer Organization
Computer Organization Register Transfer Logic Number System Department of Computer Science Missouri University of Science & Technology hurson@mst.edu 1 Decimal Numbers: Base 10 Digits: 0, 1, 2, 3, 4, 5,
More informationArithmetic Logic Unit. Digital Computer Design
Arithmetic Logic Unit Digital Computer Design Arithmetic Circuits Arithmetic circuits are the central building blocks of computers. Computers and digital logic perform many arithmetic functions: addition,
More informationComputer Sc. & IT. Digital Logic. Computer Sciencee & Information Technology. 20 Rank under AIR 100. Postal Correspondence
GATE Postal Correspondence Computer Sc. & IT 1 Digital Logic Computer Sciencee & Information Technology (CS) 20 Rank under AIR 100 Postal Correspondence Examination Oriented Theory, Practice Set Key concepts,
More informationLOGIC CIRCUITS. Kirti P_Didital Design 1
LOGIC CIRCUITS Kirti P_Didital Design 1 Introduction The digital system consists of two types of circuits, namely (i) Combinational circuits and (ii) Sequential circuit A combinational circuit consists
More informationBasic Arithmetic (adding and subtracting)
Basic Arithmetic (adding and subtracting) Digital logic to show add/subtract Boolean algebra abstraction of physical, analog circuit behavior 1 0 CPU components ALU logic circuits logic gates transistors
More informationCode No: R Set No. 1
Code No: R059210504 Set No. 1 II B.Tech I Semester Regular Examinations, November 2007 DIGITAL LOGIC DESIGN ( Common to Computer Science & Engineering, Information Technology and Computer Science & Systems
More informationAgenda EE 224: INTRODUCTION TO DIGITAL CIRCUITS & COMPUTER DESIGN. Lecture 1: Introduction. Go over the syllabus 3/31/2010
// EE : INTRODUCTION TO DIGITAL CIRCUITS & COMPUTER DESIGN Lecture : Introduction /9/ Avinash Kodi, kodi@ohio.edu Agenda Go over the syllabus Introduction ti to Digital it Systems // Why Digital Systems?
More informationChapter 4. Operations on Data
Chapter 4 Operations on Data 1 OBJECTIVES After reading this chapter, the reader should be able to: List the three categories of operations performed on data. Perform unary and binary logic operations
More informationCHAPTER 1 Numerical Representation
CHAPTER 1 Numerical Representation To process a signal digitally, it must be represented in a digital format. This point may seem obvious, but it turns out that there are a number of different ways to
More informationSCHOOL OF ENGINEERING & BUILT ENVIRONMENT. Mathematics. Numbers & Number Systems
SCHOOL OF ENGINEERING & BUILT ENVIRONMENT Mathematics Numbers & Number Systems Introduction Numbers and Their Properties Multiples and Factors The Division Algorithm Prime and Composite Numbers Prime Factors
More information9/3/2015. Data Representation II. 2.4 Signed Integer Representation. 2.4 Signed Integer Representation
Data Representation II CMSC 313 Sections 01, 02 The conversions we have so far presented have involved only unsigned numbers. To represent signed integers, computer systems allocate the highorder bit
More informationNumbering systems. Dr Abu Arqoub
Numbering systems The decimal numbering system is widely used, because the people Accustomed (معتاد) to use the hand fingers in their counting. But with the development of the computer science another
More informationCS 5803 Introduction to High Performance Computer Architecture: Arithmetic Logic Unit. A.R. Hurson 323 CS Building, Missouri S&T
CS 5803 Introduction to High Performance Computer Architecture: Arithmetic Logic Unit A.R. Hurson 323 CS Building, Missouri S&T hurson@mst.edu 1 Outline Motivation Design of a simple ALU How to design
More informationChapter 3 Part 2 Combinational Logic Design
University of Wisconsin  Madison ECE/Comp Sci 352 Digital Systems Fundamentals Kewal K. Saluja and Yu Hen Hu Spring 2002 Chapter 3 Part 2 Combinational Logic Design Originals by: Charles R. Kime and Tom
More informationArithmetic and Bitwise Operations on Binary Data
Arithmetic and Bitwise Operations on Binary Data CSCI 2400: Computer Architecture ECE 3217: Computer Architecture and Organization Instructor: David Ferry Slides adapted from Bryant & O Hallaron s slides
More informationArithmetic Logic Unit
Arithmetic Logic Unit A.R. Hurson Department of Computer Science Missouri University of Science & Technology A.R. Hurson 1 Arithmetic Logic Unit It is a functional bo designed to perform "basic" arithmetic,
More informationNH 67, Karur Trichy Highways, Puliyur C.F, Karur District DEPARTMENT OF INFORMATION TECHNOLOGY CS 2202 DIGITAL PRINCIPLES AND SYSTEM DESIGN
NH 67, Karur Trichy Highways, Puliyur C.F, 639 114 Karur District DEPARTMENT OF INFORMATION TECHNOLOGY CS 2202 DIGITAL PRINCIPLES AND SYSTEM DESIGN UNIT 2 COMBINATIONAL LOGIC Combinational circuits Analysis
More informationChapter 4 Arithmetic
Computer Eng 1 (ECE290) Chapter 4 Arithmetic Functions and Circuits HOANG Trang Reference: 2008 Pearson Education, Inc. Lecture note of Prof.Donna J.Brown Overview Binary adders Half and full adders Ripple
More information4 Operations On Data 4.1. Foundations of Computer Science Cengage Learning
4 Operations On Data 4.1 Foundations of Computer Science Cengage Learning Objectives After studying this chapter, the student should be able to: List the three categories of operations performed on data.
More information2. (a) Compare the characteristics of a floppy disk and a hard disk. (b) Discuss in detail memory interleaving. [8+7]
Code No: A109211202 R09 Set No. 2 1. (a) Explain the purpose of the following registers: i. IR ii. PC iii. MDR iv. MAR. (b) Explain with an example the steps in subtraction of two ndigit unsigned numbers.
More informationKinds Of Data CHAPTER 3 DATA REPRESENTATION. Numbers Are Different! Positional Number Systems. Text. Numbers. Other
Kinds Of Data CHAPTER 3 DATA REPRESENTATION Numbers Integers Unsigned Signed Reals FixedPoint FloatingPoint BinaryCoded Decimal Text ASCII Characters Strings Other Graphics Images Video Audio Numbers
More informationNumber representations
Number representations Number bases Three number bases are of interest: Binary, Octal and Hexadecimal. We look briefly at conversions among them and between each of them and decimal. Binary Basetwo, or
More informationUser. Application program. Interfaces. Operating system. Hardware
Operating Systems Introduction to Operating Systems and Computer Hardware Introduction and Overview The operating system is a set of system software routines that interface between an application program
More information4 Operations On Data 4.1. Foundations of Computer Science Cengage Learning
4 Operations On Data 4.1 Foundations of Computer Science Cengage Learning Objectives After studying this chapter, the student should be able to: List the three categories of operations performed on data.
More information