ASSIGNMENT TITLE: DESIGN OF DIGITAL CALCULATORSUBJECT: UEEA1323 DIGITAL ELECTRONICS LECTURERS: Dr LEE KIM YEE / Mr YAP WUN SHE DATE OF SUBMISSION: GROUP MEMBERS: Name ID Course 1 Lecture Group the input number which is pressed by the user will be converted to the binary number by using priority encoder. the result which is computed will be displayed out on the seven-segment displays. Basically. When 2 . to understand the properties of register as a set of flip-flops used to store the binary data or information. able to use decimal adder to perform addition operation and to perform subtraction operation by using XOR gate function and learn how to use the seven-segment displays. The others objectives are to use priority encoder to encode decimal input to binary output.INTRODUCTION AND OBJECTIVES This assignment is about how to design a basic digital calculator that is able to do the operation of addition (+) and subtraction (-) of two single decimal number (0-9) using a Deeds software. BRIEF OF THE DESIGNED CALCULATOR Figure 1 shows the initial part of the design that is the input push-button. Next. the binary number will be stored in the register and then perform the addition or subtraction operation based on the user wish. each button represents a number or an operation to interact with the user. As such. Figure 1 Those number buttons except “0” are connected to a priority encoder as shown in Figure 2. The encoder is used to convert the decimal number to binary number. Finally. the main objective of this assignment is to learn how to use the software to design a logic circuit which is able to perform addition and subtraction operation. thus it is connected to 1 all the time in order to turn it on. Figure 2 The output of the priority encoder is connected to the parallel-in-parallel-out register as shown in Figure 3. The first and third registers involve in the computation of two binary numbers. Next. it will be transferred to the third register when “EQUAL (=)” button is pressed. Whenever the number button is pushed. However. second register is used to store the first input number when the second input number is pressed. different binary output is produced at the output of the priority encoder. The E input means enable / disable. 3 . “1000” is produced as the output. For example. The binary will be stored in the register to carry out further computation. when number “7” button is pressed.different button is pushed. It is then inverted to “0111” by using 4 NOT gates. it will act as a clock input for each register. For example. 1001 will be inverted to 0110.Figure 3 When the “ADD (+)” or “MINUS (-)” button is pushed. 4 . the binary inputs for addition operation remain unchanged. On the other hand. while the outputs of the third register are directly connected to the adder as shown in Figure 6. Figure 4 Figure 5 Each output from first register is passed through a XOR gate to the adder. The function of the XOR gates is to invert the binary inputs (to perform 1’s complement) for subtraction operation. the data ‘0’ (ADD) and ‘1’ (MINUS) will be sent to a D-flip flop to store the memory which is shown in Figure 4 and 5. Negative output numbers detection is done by comparing the carry output from most significant bit. The carry output will be ‘1’ only when the output is negative number. then add 0110 (6) to the binary number. those numbers that are more than 9 are detected and corrected by adding 0110 (6) to it with the subsequent adder. Let say. The XOR gate connected to carry input of the second adder is to determine whether adding ‘1’ or ‘0’. The following logic circuit in Figure 7 is used to detect the overflow of binary output and correct the output numbers. It will add ‘1’ to the binary number for subtraction because this calculator is designed in 2’s complement. For example. one of the pins of four XOR gates was input with ‘1’ to invert the binary number (to perform 1’s complement). Additional logic circuit (a NOT gate and an AND gate) was added to detect negative output numbers which is circled in Figure 7. second and third from most significant bit (from left to right). the hex display will show “F” instead of “15” when the output is directly connected to it. if the binary output after addition operation is 1111 (15). When negative output number is detected. the data stored will be added or subtracted.Figure 6 After passing through the first adder circuit. Therefore. This is done by comparing the first bit binary number. “3” – “5” is equal to “0011” – “0101” in binary 5 . If two of them are equal to ‘1’. the function of second adder are to add 6 to those output numbers more than 9 for addition operation and add 1 to those negative output numbers for subtraction operation. Figure 7 A D flip-flop as shown in Figure 8 is used to control the negative sign show for the negative output numbers. it will show the correct output since “EQUAL (=)” button acts as clock input. “-5” is representing “1011” in 2’s complement. it will only do the computation. the flip-flop does not turn on the negative sign LED at the right time due to the clock input. On the other hand. Furthermore. The idea calculator is that when “EQUAL (=)” button is pressed. when the output number is negative that is detected by a NOT gate and an AND 6 . ‘1’ will store inside the register. In short. When “MINUS (-)” button is pressed. Thus. When “EQUAL (=)” button is pressed. The sum of these two numbers is “10010” and “1” acts as a carry output in this case. the negative sign only stores inside the register instead of sending it. ‘0’ will be added to the binary number when addition operation is activated. This problem is solved by using an AND gate. However.number. the LEDs will be deactivated. Figure 8 The “+” sign LEDs or “-” sign LEDs will be lighted up when “ADD (+)” or “MINUS (-)” button is pushed. By using a NOT gate and XOR gate. If “CLEAR/ON” is pressed. ‘1’ will be sent to one of the input pins of the AND gate. Thus. However. an AND gate is connected to the output of D flip-flop where the output for “ADD (+)” is ‘0’ and “MINUS (-)” is ‘1’. The bottom AND gate is used to determine whether to turn it on or off. 7 . the “-” sign LEDs will be lighted up in both addition and subtraction operation. Since both inputs of the AND gate are ‘1’. the clock input for this register is the buttons of “ADD (+)” and “MINUS (-)” which is shown in Figure 9. “|” sign LEDs will only light up when user press “ADD (+)” button. the “-” sign LEDs will be lighted up as long as there is clock input of the register. thus the negative sign LED will be lighted up. Thus. the output would be 1 despite of the input is ‘0’ or ‘1’.gate which is circled in Figure 7. Hence. when “EQUAL (=)” button is pressed. This is done by a D flip-flop. Figure 10 8 .Figure 9 Last but not least. Hence. The “=”sign LEDs will light up when “EQUAL (=)” button is pressed. the “EQUAL (=)” button acts as a clock input and there is always ‘1’ connected to the preset and the flip-flop input. the output ‘1’ produced from the flip-flop lights up the “=” sign LEDs. D as shown in Figure 10. the hex display will display the answer computed when “EQUAL (=)” button is pressed. Then. Press the second input number. 3. if the user press “3” button. Repeat the steps 2 to 6 in order to use the calculator repetitively. there are four LEDs turn on to show the “+” sign. 7. The user must clear the memory each time after each computation. For example. Press “EQUAL(=)” button to display the result of the computation. 4. press “5” button and “EQUAL(=)” button. 6. press “5” button and “EQUAL(=)” button. Press the first input number. In order to use the calculator. -) are on the upper left corner of the designed logic circuit . select the function wanted (“ADD(+)” or “MINUS(-)”). which is shown in Figure 13. 8. press the “CLEAR/ON” button. Moreover. 4. 7. 9) and operation buttons (+. the output display will show the number “-2”. the user should follow the steps above strictly. To start the calculator. 5. Remarks: This calculator designed is only for ADDITION(+) and SUBTRACTION(-) operations of two single decimal number (0-9). 6. 1. In short.USER MANUAL The input numbers (0. Steps to use the calculator are in below: 1. 2. the user must press the “CLEAR/ON” button. Press “CLEAR/ON” button again to clear the memory of the computation. Next. the user must key in an operation (addition or subtraction) after first input. there is a LED turns on to show the “-” sign. there are two LEDs turn on to show the “-” sign. 3. then press “ADD(+)” button. if the user press “3” button. then press “MINUS(-)” button. as shown in Figure 11. On the other hand. 5.and the display is on the upper right corner. Next. which is shown in Figure 12. the output display will show the number “8”. 2. whenever the result is negative number. Figure 11 9 . the logic functions which are used in the assignment are learned. the function of each logic gate which is used in the assignment is understood and known.Figure 12 Figure 13 CONCLUSION In conclusion. 10 . In addition. The addition and subtraction operation of the logic circuit designed is studied and understood. the digital calculator is designed by using Deeds software. Furthermore. APPENDIX 11 .