Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

error for 64 bit ripple carry adder

Status
Not open for further replies.

Mahammad

Member level 3
Joined
Jul 8, 2011
Messages
56
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,288
Activity points
1,632

Code Verilog - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
module rippl(
    input [63:0] a,
    input [63:0] b,
    input cin,
    output [63:0] s,
    output cout
    );
wire temp[63:0];
assign temp[0]=cin;
genvar i;
always @(*)
for(i=0;i<64;i=i+1)
begin
s[i]<=(a[i]^(b[i]^temp[i]));
temp[i+1]<=(((a[i]&b[i])|(b[i]&temp[i]))|(temp[i]&a[i]));
end
 
assign cout=temp[63];
end
 
endmodule

 
Last edited by a moderator:

You will avoid a lot of problems if you use blocking assignments "=" in combinatorial always blocks and non-blocking assignments "<=" in clocked always blocks until you understand when to break this rule.
 

what exactly is the error, need some explanation
 

temp is too small. The generate will assign to temp[63+1].
 

temp is too small. The generate will assign to temp[63+1].

besides that, it should be doing the following assign for cout to get the carry output of the add.

Code:
assign cout = temp[64];
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top