- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi all,
I am trying to implement a full adder with generate-endgenerate approach. But I got a error message("Error (10028): Can't resolve multiple constant drivers for net "cout" at fulladder.v(33)"), and there seems to be something wrong with my code in line "cout=(a&b)|(a&c[i-1])|(b&c[i-1]);" Anyone can help me out of this...? Thanks in advance:)
module fulladder# (parameter width=4)
(output reg sum,
output reg cout,neg,overflow,
input a,b,
input cin);
reg c;
generate
genvar i;
for(i=0;i<=width-1;i=i+1)begin:stage
case(i)
0:begin
always@(*)begin
sum=a^b^cin;
c=(a&b)|(a&cin)|(b&cin);
end
end
width-1:begin
always@(*)begin
sum=a^b^c;
cout=(a&b)|(a&c)|(b&c);
neg=sum;
overflow=cout^c;
end
end
default:begin
always@(*)begin
sum=a^b^c;
cout=(a&b)|(a&c)|(b&c);
end
end
endcase
end
endgenerate
endmodule
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The implementation is incorrect. You would want to assign c[i] instead of cout in case default
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks a lot...FvM
Kinda felt embarrassed about this mistake...
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page