Forget safety. Live where you fear to live. Destroy your reputation. Be notorious. Rumi
Idea Transcript
DALHOUSIE UNIVERSITY Department of Electrical & Computer Engineering Digital Circuits - ECED 2200 Experiment 2 - Arithmetic Elements Objectives: 1. To implement a Half subtractor circuit 2. To implement a Full subtractor circuit Theory: How to add and subtract in binary: Binary addition and subtraction is very similar to decimal addition and subtraction. For instance, in decimal addition and subtraction carries and borrows are used: 14 +8 22
Carry has occurred (4+8=12 The tens place in ‘12’ is carried over to next column)
24 - 8 16
Borrow has occurred (4 must borrow 10 from tens place giving 14-8=6) Similarly, binary addition and subtraction involves carries and borrows: 01 +01 10
Carry has occurred (1+1=2 so The ‘1’ is carried to the ‘twos’ place giving 10)
10 -01 01
Borrow has occurred (0 must borrow 2 from ‘twos’ place giving 2-1=1)
Note that these operations involve two numbers with two places each. (The numbers being operated on are each 2-places). Our goal in this lab is to implement subtraction using logic gates. In the half subtractor, the inputs (switch 1 & 2) represent the two numbers we are subtracting. The output LEDs show the resulting difference and whether a borrow has occurred. Procedure: Part 1. Half Subtractor In the half subtractor we have two single place inputs, S1 and S2 that are subtracted from each other (S1-S2). The outputs (LED1 & 2) show the result (difference) and whether or not a ‘borrow’ occurred (borrow). a) Construct the Half Subtractor as shown on the attached schematic. b) Simulate the Half Subtractor: vary the inputs and construct a truth table showing your results. c) Implement the Half Subtractor on your Binary Explorer Board. Test your circuit. d) What effect does a negative result have on the outputs? (0 – 1 = -1) 1
Part 2. Full Subtractor The full subtractor is composed of two half subtractors chained together. The ‘difference’ output of the first half subtractor becomes one of the inputs for the second half subtractor. Again, note the third switch, S3. This switch is used to tell the logic that a ‘borrow’ occurred from the previous stage when chaining many full subtractors together. The ‘final borrow’ output of the previous stage is tied to S3 of the next stage. a) Construct the Full Subtractor as shown on the attached schematic. b) Simulate the Full Subtractor: vary the inputs and construct a truth table showing your results. c) Implement the Full Subtractor on your Binary Explorer Board. Test your circuit. d) What effect does the ‘borrow’ input (S3) have on the circuit?
Some Useful Terms: You might find these terms handy when you are writing your report: Minuend: The first number in a subtraction Subtrahend: The second number in a subtraction Difference: The result of the Minuend – Subtrahend