EmbDev.net

Forum: FPGA, VHDL & Verilog Array Multiplier


von O'Shea (Guest)


Rate this post
useful
not useful
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
);

von Lothar M. (Company: Titel) (lkmiller) (Moderator)


Rate this post
useful
not useful
O'Shea wrote:
> I'm having trouble getting this array multiplier working correctly
And what kind of trouble is that?
Are there any errors or warnings?

von O'Shea (Guest)


Rate this post
useful
not useful
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

von Duke Scarring (Guest)


Rate this post
useful
not useful
> 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

von O'Shea (Guest)


Rate this post
useful
not useful
Simulation

von O'Shea (Guest)


Rate this post
useful
not useful
Bump

von User (Guest)


Rate this post
useful
not useful
Hello, maybe someone know how to implement divider in VHDL when i have 
just Multiplier ?

thanks.

von Lothar M. (Company: Titel) (lkmiller) (Moderator)


Rate this post
useful
not useful
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...)...

Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
No account? Register here.