ES210, Digital Design Lab Reporter Name: Date: Partner Names Group No.: Lab 8: 2-Bit by 2-Bit Binary Multiplier A. Objectives 1. Learn what a binary multiplier is and how a binary multiplier operates. 2. Design a binary multiplier using half-adder and implement a binary multiplier on the protoboard. 3. Build the Verilog design and test bench programs for a binary multiplier and simulate it for the input and output waveforms. B. Introduction Multiplication of binary numbers is similar to multiplication of decimal numbers. The multiplicand is multiplied by each bit of the multiplier starting from the least significant bit. Each of the resulting partial products is shifted one position to the left. The summation of these shifted partial products makes the final product (see Mano, ed. 5, Section 4.7). A bit 0 0 1 1 B bit 0 1 0 1 Product A x B 0 0 0 1 2-bit by 2-bit Multiplier Multiplicand Multiplier Partial product 1-> Partial product 2-> Carries of previous bit-> Final product bits-> Example Bit 2^1 Bit 2^0 1 1 1 1 1 1 1 0 0 C1 = 0 C0 = 1 A1 and A0 bits-> B1 and B2 bits-> 1 C3 = 1 1 1 C2 = 0 Decimal Equivalent =3 =3 =3 =6 =9 Note that the max product value of two 2-bit binary numbers requires 4 bit positions. C. Parts needed A Digital Multimeter A +5 V power supply A breadboard/protoboard and wires Two 7408 Quad 2-input AND gates One 7486 Quad XOR gates Datasheets of the gates from the Internet D. Procedure 1. Fig. 1 (below, from Fig. 4.15 in Mano ed. 5) shows a 2-bit (A1A0) by 2-bit (B1B0) binary multiplier. Express the bit positions of the final product (C3, C2, C1, C0) in terms of A1, A0, B1, B0 with only AND and XOR gates in the table below. Also express these product bits in terms of NOT, AND, OR gates. The subscript “0” in each case represents the lowest significant bit (LSB). Product Bit Positions C0 = C1 = C2 = C3 = Product Bit Positions in terms of A1, A0, B1, B0 2. How many gates do you need for such a 2-bit by 2-bit multiplier? Number of AND gates needed Dr. Ali Kujoory 6/30/2016 Number of XOR gates needed 1 2. Redraw Fig.1, a 2-bit by 2-bit multiplier, with only AND and XOR gates in the table below. Let the instructor check it for you to make sure you can connect it properly in the next section. Fig. 1. Two-bit by two-bit binary multiplier 3. Connect your diagram on the breadboard. Use AND and XOR gates, 4 switches to represent A1, A0, B1, and B0 inputs, and 4 LEDs to display the status of the output product bits in proper order. Power up the circuit and check your results for the following input binary combinations. Show the circuit to the instructor when in full operation. Switches A1 A0 B1 B0 0 0 0 0 1 0 0 1 1 1 1 0 1 1 1 1 Write the product binary bits C3C2C1C0 in terms of the binary bits A1, A0, B1, and B0. C3 Product Binary Bits C2 C1 C0 Decimal equivalent of product bits C3C2C1C0 4. To simulate the above circuit write a Verilog design program, called two_bit_multiplier.v, in the table below and compile it to ensure it is error-free. Use G0, G1, G2, G3, etc., to identify instances of the AND gates and XOR1 and XOR2, etc. Use w0, w1, w2, w3, etc., to identify the wires indicated. 5. Then, write the corresponding Verilog test bench program in the table below and compile it to ensure it is error-free. Include all the 4 combinations for A1, A0, B1, B0 with 50 ms delay between each combination entry in the program. 6. Simulate the program to display the waveforms of the inputs and output bits C3, C2, C1, C0 and copy the display in the table below. Show your displays to the instructor. // two_bit_multiplier.v program module // two_bit_multiplier_tb.v program module Waveforms of inputs and outputs E. Feedback/Comments (your comments will help improving this lab) Was the instruction clear enough? Any error? How difficult was it for you? Do you have any observations to make? F. Report 1. In the answers you obtained and the display of waveforms in the tables above. Do not include the unnecessary paragraphs such as the objectives, instructions, and procedures. 2. Each member should submit her/his Verilog section in the report to make sure that every one does the Verilog program. Dr. Ali Kujoory 6/30/2016 2