Hi there, I'm having trouble getting this array multiplier working correctly and I can't figure out what the problem is. If someone could just glance at my code it'd really help
1 | module array_multiplier |
2 | (
|
3 | output [15:0]P, |
4 | input [7:0]A, |
5 | input [7:0]B |
6 | );
|
7 | wire [55:0]Sum; |
8 | wire [6:0]Cout; |
9 | |
10 | assign P[0] = A[0] & B[0]; |
11 | |
12 | //Level 1 |
13 | ripple_carry_adder RCA1(Cout[0], Sum[7:0], {1'b0, B[0] & A[7:1]}, B[1] & A[7:0],1'b0); |
14 | assign P[1] = Sum[0]; |
15 | |
16 | //Level 2 |
17 | ripple_carry_adder RCA2(Cout[1], Sum[15:8], {Cout[0], Sum[7:1]}, B[2] & A[7:0],1'b0); |
18 | assign P[2] = Sum[8]; |
19 | |
20 | //repeat.... |
21 | |
22 | //Level 7 (last level) |
23 | ripple_carry_adder RCA7(Cout[6], Sum[55:48], {Cout[5], Sum[47:41]}, B[7] & A[7:0],1'b0); |
24 | assign P[7] = Sum[48]; |
25 | |
26 | assign P[8] = Sum[49]; |
27 | assign P[9] = Sum[50]; |
28 | assign P[10]= Sum[51]; |
29 | assign P[11]= Sum[52]; |
30 | assign P[12]= Sum[53]; |
31 | assign P[13]= Sum[54]; |
32 | assign P[14]= Sum[55]; |
33 | assign P[15]= Cout[6]; |
34 | |
35 | //module |
36 | module ripple_carry_adder |
37 | (
|
38 | output Cout, |
39 | output [7:0]Sum, |
40 | input [7:0]A, |
41 | input [7:0]B, |
42 | input Cin |
43 | );
|