You are on page 1of 9

10 Bit Array Multiplier (using gate level modeling &

instantiation)
In 10 bit array multiplier, two inputs are taken (such as A,B) of 10 bits each.
Using the method given in the figure, we took two 10 bits inputs and multiplied
them…

After multiplication, we come to know that the total number minterms formed
are 100. ( As in the above figure the total number of minterms are 6*6=36. In
10 bits case it is 10*10=100). After multiplication the main thing that occurs is
the addition of the minterms to form the main product. The answer will be of
20 bits.
As it was shown, in this pic that first we had to made the And gates in the block
diagram. The total
number of And gates
was equal to the
number of minterms,
therefore, firstly we
made 100 And gates
according to our minterms. After doing this we had to use half adders and full
adders in order to add the minterms and form a product output. The block
diagram is given blow

1)

2)

3)
4)

5)

Source Code
module HA (cary, sm, A, B); //half adder
input A,B;
output cary, sm;
and j1 (cary,A,B);
xor j2 (sm, A, B);
endmodule

module FA (carry, sum, C, D, E);//full adder


input E,D,C;
output carry, sum;
wire w1, w2, w3;
HA j3(w2, w1, C ,D);
HA j4(w3,sum, w1, E);
or j5(carry, w2, w3);
endmodule

module Project(h, n, s);


input [9:0]n,s; // inputs
output [19:0]h; //outputs
wire [260:0]w; //wires
and g1( h[0], n[0], s[0] ); //and gates instantiation
and g2( w[0], n[0], s[1] );
and g3( w[1], n[1], s[0] );
and g4( w[2], n[1], s[1] );
and g5( w[3], n[0], s[2] );
and g6( w[4], n[2], s[0] );
and g7( w[5], n[0], s[3] );
and g8( w[6], n[1], s[2] );
and g9( w[7], n[2], s[1] );
and g10( w[8], n[3], s[0] );
and g11( w[9], n[0], s[4] );
and g12( w[10], n[1], s[3] );
and g13( w[11], n[2], s[2] );
and g14( w[12], n[3], s[1] );
and g15( w[13], n[4], s[0] );
and g16( w[14], n[0], s[5] );
and g17( w[15], n[1], s[4] );
and g18( w[16], n[2], s[3] );
and g19( w[17], n[3], s[2] );
and g20( w[18], n[4], s[1] );
and g21( w[19], n[5], s[0] );
and g22( w[20], n[0], s[6] );
and g23( w[21], n[1], s[5] );
and g24( w[22], n[2], s[4] );
and g25( w[23], n[3], s[3] );
and g26( w[24], n[4], s[2] );
and g27( w[25], n[5], s[1] );
and g28( w[26], n[6], s[0] );
and g29( w[27], n[0], s[7] );
and g30( w[28], n[1], s[6] );
and g31( w[29], n[2], s[5] );
and g32( w[30], n[3], s[4] );
and g33( w[31], n[4], s[3] );
and g34( w[32], n[5], s[2] );
and g35( w[33], n[6], s[1] );
and g36( w[34], n[7], s[0] );
and g37( w[35], n[0], s[8] );
and g38( w[36], n[1], s[7] );
and g39( w[37], n[2], s[6] );
and g40( w[38], n[3], s[5] );
and g41( w[39], n[4], s[4] );
and g42( w[40], n[5], s[3] );
and g43( w[41], n[6], s[2] );
and g44( w[42], n[7], s[1] );
and g45( w[43], n[8], s[0] );
and g46( w[44], n[0], s[9] );
and g47( w[45], n[1], s[8] );
and g48( w[46], n[2], s[7] );
and g49( w[47], n[3], s[6] );
and g50( w[48], n[4], s[5] );
and g51( w[49], n[5], s[4] );
and g52( w[50], n[6], s[3] );
and g53( w[51], n[7], s[2] );
and g54( w[52], n[8], s[1] );
and g55( w[53], n[9], s[0] );
and g56( w[54], n[1], s[9] );
and g57( w[55], n[2], s[8] );
and g58( w[56], n[3], s[7] );
and g59( w[57], n[4], s[6] );
and g60( w[58], n[5], s[5] );
and g61( w[59], n[6], s[4] );
and g62( w[60], n[7], s[3] );
and g63( w[61], n[8], s[2] );
and g64( w[62], n[9], s[1] );
and g65( w[63], n[2], s[9] );
and g66( w[64], n[3], s[8] );
and g67( w[65], n[4], s[7] );
and g68( w[66], n[5], s[6] );
and g69( w[67], n[6], s[5] );
and g70( w[68], n[7], s[4] );
and g71( w[69], n[8], s[3] );
and g72( w[70], n[9], s[2] );
and g73( w[71], n[3], s[9] );
and g74( w[72], n[4], s[8] );
and g75( w[73], n[5], s[7] );
and g76( w[74], n[6], s[6] );
and g77( w[75], n[7], s[5] );
and g78( w[76], n[8], s[4] );
and g79( w[77], n[9], s[3] );
and g80( w[78], n[4], s[9] );
and g81( w[79], n[5], s[8] );
and g82( w[80], n[6], s[7] );
and g83( w[81], n[7], s[6] );
and g84( w[82], n[8], s[5] );
and g85( w[83], n[9], s[4] );
and g86( w[84], n[5], s[9] );
and g87( w[85], n[6], s[8] );
and g88( w[86], n[7], s[7] );
and g89( w[87], n[8], s[6] );
and g90( w[88], n[9], s[5] );
and g91( w[89], n[6], s[9] );
and g92( w[90], n[7], s[8] );
and g93( w[91], n[8], s[7] );
and g94( w[92], n[9], s[6] );
and g95( w[93], n[7], s[9] );
and g96( w[94], n[8], s[8] );
and g97( w[95], n[9], s[7] );
and g98( w[96], n[8], s[9] );
and g99( w[97], n[9], s[8] );
and g100( w[98], n[9], s[9] );

HA ha0(w[99], h[1], w[0], w[1] ); // Half adder instantiation


Ha ha1(w[100], w[108], w[2], w[3] );
Ha ha2(w[101], w[109], w[5], w[6] );
Ha ha3(w[102], w[110], w[9], w[10] );
Ha ha4(w[103], w[111], w[14], w[15] );
Ha ha5(w[104], w[112], w[20], w[21] );
Ha ha6(w[105], w[113], w[27], w[28] );
Ha ha7(w[116], w[114], w[35], w[36] );
Ha ha8(w[106], w[115], w[44], w[45] );
Ha ha9(w[107], h[10], w[117], w[118] );

FA fa0(w[119], h[2], w[108], w[4], w[99] );


FA fa1(w[121], w[120], w[7], w[109], w[100] );
FA fa2(w[122], h[3], w[8], w[120], w[119] );
FA fa3(w[123], w[124], w[11], w[110], w[101] );
FA fa4(w[125], w[126], w[12], w[124], w[121] );
FA fa5(w[127], h[4], w[13], w[126], w[122] );
FA fa6(w[128], w[129], w[16], w[111], w[102] );
FA fa7(w[130], w[131], w[17], w[129], w[123] );
FA fa8(w[132], w[133], w[18], w[131], w[125] );
FA fa9(w[134], h[5], w[19], w[133], w[127] );
FA fa10(w[135], w[136], w[22], w[112], w[103] );
FA fa11(w[137], w[138], w[23], w[136], w[128] );
FA fa12(w[139], w[140], w[24], w[138], w[130] );
FA fa13(w[141], w[142], w[25], w[140], w[132] );
FA fa14(w[143], h[6], w[26], w[142], w[134] );
FA fa15(w[145], w[144], w[113], w[29], w[104] );
FA fa16(w[147], w[146], w[144], w[30], w[135] );
FA fa17(w[149], w[148], w[146], w[31], w[137] );
FA fa18(w[151], w[150], w[148], w[32], w[139] );
FA fa19(w[152], w[153], w[150], w[33], w[141] );
FA fa20(w[154], h[7], w[153], w[34], w[143] );
FA fa21(w[155], w[156], w[114], w[37], w[105] );
FA fa22(w[157], w[158], w[156], w[38], w[145] );
FA fa23(w[159], w[160], w[158], w[39], w[147] );
FA fa24(w[161], w[162], w[160], w[40], w[149] );
FA fa25(w[163], w[164], w[162], w[41], w[151] );
FA fa26(w[165], w[166], w[164], w[42], w[152] );
FA fa27(w[167], h[8], w[166], w[43], w[154] );
FA fa28(w[175], w[168], w[46], w[115], w[116] );
FA fa29(w[176], w[169], w[47], w[168], w[155] );
FA fa30(w[177], w[170], w[48], w[169], w[157] );
FA fa31(w[178], w[171], w[49], w[170], w[159] );
FA fa32(w[179], w[172], w[50], w[171], w[161] );
FA fa33(w[180], w[173], w[51], w[172], w[163] );
FA fa34(w[181], w[174], w[52], w[173], w[165] );
FA fa35(w[117], h[9], w[53], w[174], w[167] );
FA fa36(w[189], w[182], w[55], w[54], w[106] );
FA fa37(w[190], w[183], w[56], w[182], w[175] );
FA fa38(w[191], w[184], w[57], w[183], w[176] );
FA fa39(w[192], w[185], w[58], w[184], w[177] );
FA fa40(w[193], w[186], w[59], w[185], w[178] );
FA fa41(w[194], w[187], w[60], w[186], w[179] );
FA fa42(w[195], w[188], w[61], w[187], w[180] );
FA fa43(w[196], w[118], w[62], w[188], w[181] );
FA fa44(w[204], w[197], w[64], w[63], w[189] );
FA fa45(w[205], w[198], w[65], w[197], w[190] );
FA fa46(w[206], w[199], w[66], w[198], w[191] );
FA fa47(w[207], w[200], w[67], w[199], w[192] );
FA fa48(w[208], w[201], w[68], w[200], w[193] );
FA fa49(w[209], w[202], w[69], w[201], w[194] );
FA fa50(w[210], w[203], w[70], w[202], w[195] );
FA fa51(w[211], h[11], w[203], w[196], w[107] );
FA fa52(w[218], w[212], w[72], w[71], w[204] );
FA fa53(w[219], w[213], w[73], w[212], w[205] );
FA fa54(w[220], w[214], w[74], w[213], w[206] );
FA fa55(w[221], w[215], w[75], w[214], w[207] );
FA fa56(w[222], w[216], w[76], w[215], w[208] );
FA fa57(w[223], w[217], w[77], w[216], w[209] );
FA fa58(w[224], h[12], w[217], w[210], w[211] );
FA fa59(w[230], w[225], w[79], w[78], w[218] );
FA fa60(w[231], w[226], w[80], w[225], w[219] );
FA fa61(w[232], w[227], w[81], w[226], w[220] );
FA fa62(w[233], w[228], w[82], w[227], w[221] );
FA fa63(w[234], w[229], w[83], w[228], w[222] );
FA fa64(w[235], h[13], w[229], w[223], w[224] );
FA fa65(w[240], w[236], w[85], w[84], w[230] );
FA fa66(w[241], w[237], w[86], w[236], w[231] );
FA fa67(w[242], w[238], w[87], w[237], w[232] );
FA fa68(w[243], w[239], w[88], w[238], w[233] );
FA fa69(w[244], h[14], w[239], w[234], w[235] );
FA fa70(w[248], w[245], w[90], w[89], w[240] );
FA fa71(w[249], w[246], w[91], w[245], w[241] );
FA fa72(w[250], w[247], w[92], w[246], w[242] );
FA fa73(w[251], h[15], w[247], w[243], w[244] );
FA fa74(w[254], w[252], w[94], w[93], w[248] );
FA fa75(w[255], w[253], w[95], w[252], w[249] );
FA fa76(w[256], h[16], w[252], w[250], w[251] );
FA fa77(w[258], w[257], w[97], w[96], w[254] );
FA fa78(w[259], h[17], w[257], w[256], w[255] );
FA fa79(h[19], h[18], w[98], w[258], w[259] );

endmodule

module testbench_project();
reg [9:0]n,s;
wire [19:0]h;
Project dld(h, n, s);
initial
begin
n=10'b 0010101001; s=10'b1010100100;
#20 n=10'b1100011110; s=10'b0001011101;
#20 n=10'b10000001101; s=10'b1110111001;
end
endmodule

Simulation Waveform

Conclusion/Lesson Learnt
The lesson we learnt in making of this project was that we come to know how
to use full adders and half adders in the case of multipliers. We also come to
know that when we have to use a half adder and when to use a full adder in
making of a multiplier.
Problems Faced
The only problem that we faced was during the simulation of the program. The
error was coming like that
Loading program error…
Then we checked the program thoroughly and we come to know that we were
having a problem in the sequence of the inputs of the full adders. Then we
arranged them and the problem was solved easily.

You might also like