Array Multiplier

Guest #2641200
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
);
Guest #2642001
Sorry I should have been more specific, it compiles okay it just doesn't 
function properly.  When both A[0] and B[0] are 1's then it produces a 
number with a 1 in P[0] like it should.  However, when either A[0] and 
B[0] are not 1 it produces zero in P[15:0].  In my vector file I have 
Sum as a variable to watch but it says that it cannot find any instances 
of Sum (any of them, it gives me many many warnings), which is 
unfortunate because I could use that to do a little debugging
Guest #2642935
> Sorry I should have been more specific, it compiles okay it just doesn't
function properly.
Where did you check the function? In simulation or on hardware?

Duke
Moderator (Company: Titel) #2724763
Why does everybody add his/hers NEW question to and ancient post?
With a new question start a new thread, pls.!

And there you can write, whether you want the division for synthesis or 
"only" for simulation. And maybe also, which toolchain from which 
supplier you use. And all the necessary additional information that may 
be helpful (word width, speed, precision...)...

Reply

A question of your own? This thread is over 14 years old. Ask it in a thread of its own – more people read along there, and it gets answered more often and sooner.

Start a new thread

A fix, an addition or feedback on this thread? Then reply here.

Formatting
  • [c]C-Code[/c]
  • [vhdl]VHDL-Code[/vhdl]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]
  • [[Title]] – link to an article
  • Link to another post: right-click its post ID (#8078628), copy the address, paste it into the text

More about formatting

Post long source code as an attachment, not in the text.

Already registered? Log in

Not shown to anyone. We send you a link; your post appears once you confirm it there.

By submitting you create a free account and accept the terms of use.