Experiment 7 Arithmetic Circuits Design and Implementation Introduction: Addition is just what you would expect in computers. Digits are added bit by bit from right to left, with carries passed to the next digit to the left, just as you would do by hand. Subtraction uses addition: the appropriate operand is simply negated before being added. Objectives: To understand the concept of Half and Full Adders. Design and build Ripple Carry Adder. Introduce 4-bit magnitude comparator. Design and implement binary multiplier Half Adder: Half adder is a combinational circuit that adds only two one bit numbers,since there are two inputs (x and y), only four possible combinations of inputs can applied. These four possibilities, and the resulting sums are shown in following truth table. Figure(1) Page 1 of 6
Full Adder: Full adder is a combinational circuit that adds three bits and generates a sum and carry.. ad outputs two one-bit binary numbers, a sum (S) and a carry (C1). From the truth table, we can obtain the Boolean expression of C & S outputs as follows : Using Map-simplification method, we can get the simplified forms as follows : Now, we can construct the full-adder circuit based on the simplified Boolean expression of S and C outputs Figure(2) Page 2 of 6
Ripple Adder Two binary numbers, each of n bits, can be added using a ripple adder, a cascade of n full adders; each full adder handles one bit. Each Cout of a full adder is connected to the Cin of the higher full adder. The Cin of the least significant full adder is set to 0. Adder-Subtractor circuit The subtraction of two binary numbers can be done by taking the 2 s complement of the subtrahend and adding it to the minued. The 2 s complement can be obtained by taking the 1 s complement and adding 1. To perform A - B, we complement the four bits of B, add them to the four bits of A, and add 1 to the input carry. We may use XOR gate as an inverter if placing a logic 1 at one of the inputs. This helps in getting the 1 s complement of the subtrahend; then we add 1 to get the 2 s complement; which in turn is added to the minued to get the final result of the subtraction. Figure below shows adder-subtractor circuit; the mode input M controls the operation; when M=0, the circuit is an adder. When M=1, the circuit becomes a subtractor. This circuit can be cascaded for any number of inputs. Figure(3) Page 3 of 6
Multiplier: If we want to multiply tow numbers(a,b),each of them is consist of two bit as follows: B = {B1 B0}, A = {A1 A0} Then we multiply by doing single-bit multiplications and shifts. Figure(4) Page 4 of 6
Comparator: The 74LS85 is a 4-Bit Magnitude Comparator which compares two 4-bit words (A, B), each word having four Parallel Inputs (A0 A3, B0 B3); A3, B3 being the most significant inputs. Three outputs are provided: 1- A greater than B (out A>B). 2- A less than B (out A<B). 3- A equal to B (out A=B). Three Expander Inputs, In A>B, In A<B, In A=B, allow cascading without external gates. - For proper compare operation, the Expander Inputs to the least significant position must be connected as follows: In A<B= In A>B = L, In A=B = H. - For serial (ripple) expansion (more than 4-bit), the out A>B, out A<B and out A=B from the least significant comparator (which considered to be the output of comparing 4 least significant bits) are connected respectively to the In A>B, In A<B, and In A=B Inputs of the next most significant comparator and so on. Figure(5) The truth table below describes the operation of this comparator under all possible logic conditions. The upper 8 lines describe the normal operation under all conditions that will occur in a single device or in a series expansion scheme. The lower five lines describe the operation under abnormal conditions on the cascading inputs. Page 5 of 6
Procedure: I. Use the following pin assignment for inputs and outputs when needed: In1: SW [1] (Pin_AB26) In2: SW [2] (Pin_AB25) In3: SW [3] (Pin_AC27) In4: SW [4] (Pin_AC26) In5: SW [5] (Pin_AC24) In6: SW [6] (Pin_AC23) In7: SW [7] (Pin_AD25) In8: SW [8] (Pin_AD24) Out0: LEDR [0] (Pin_AJ6) Out1: LEDR [1] (Pin_AK5) Out2: LEDR [2] (Pin_AJ5) Out3: LEDR [3] (Pin_AJ4) Out4: LEDR [4] (Pin_AK3) Out5: LEDR [5] (Pin_AH4) Part 1: Design and Implement Adder 1- Design the Full Adder circuit shown in Figure 1, and then implement it on Quatrus II (verilog). Figure 1 2- Use the design of Full adder in step1 to implement 3-Bit Ripple Carry Adder as shown in Figure 2 on Quatrus II (verilog). 3-Modify the circuit you built in step 2 to detect overflow and support subtraction operation. Part 2: Comparator 1- Use Quatrus II (schematic) to expand the 4-bit Magnitude Comparator IC 7485 to obtain 8 bit Magnitude Comparator and test it. Part 3: Design and Implement Multiplier 1- Design and implement a multi-bit Multiplier that will multiply (A1A0 B2B1B0) and produce the product (C4C3C2C1C0) using 4-bit parallel adder ( ICs 7483). Page 6 of 6