Shyam Joe
Junior Member level 3
- Joined
- Aug 21, 2013
- Messages
- 28
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1
- Activity points
- 322
I'm writing a coding for 256 bit adder using 64 bit adders and multiplexer
the coding is as follows
The sub module codings are as follows
addc:
addcc:
addccc:
mux:
when i simulate dis i get the output as follows
View attachment output.doc
help me to solve it
the coding is as follows
Code:
module add(a,b,cin,c1,c2,c3,c4,co);
input [255:0] a,b;
input cin;
output [63:0] c1,c2,c3,c4;
output co;
wire [63:0] d,e,f,g,h,i,j,k,l,m,q,r,s,t;
wire n,o,p;
addc a1(q,n,a[63:0],b[63:0],cin);
addcc a2(d,a[127:64],b[127:64]);
addcc a3(e,a[127:64],b[127:64]);
addccc a4(j,o,a[191:128],b[191:128]);
addccc a5(k,p,a[191:128],b[191:128]);
addcc a6(f,a[255:192],b[255:192]);
addcc a7(g,a[255:192],b[255:192]);
addcc a8(h,a[255:192],b[255:192]);
addcc a9(i,a[255:192],b[255:192]);
mux a10(r,d,e,n);
mux a11(l,f,g,o);
mux a12(m,h,i,p);
mux a13(s,j,k,n);
mux a14(t,l,m,n);
assign c1=q;
assign c2=r;
assign c3=s;
assign c4=t;
assign co=n;
endmodule
addc:
Code:
module addc(a,b,cin,s,co);
input [63:0] a,b;
input cin;
output [63:0] s;
output co;
wire [64:0]si;
assign si=a+b+cin;
assign s=si[63:0];
assign co=si[64];
endmodule
Code:
module addcc(a,b,s);
input [63:0] a,b;
output [63:0]s;
assign s=a+b;
endmodule
Code:
module addccc(a,b,s,co);
input [63:0] a,b;
output [63:0] s;
output co;
wire [64:0] si;
assign si=a+b;
assign s=si[63:0];
assign co=si[64];
endmodule
Code:
module mux(a,b,s,y);
input [63:0] a,b;
input s;
output [63:0] y;
reg [63:0] y;
always @(s)
case(s)
1'b0: y=a;
1'b1: y=b;
endcase
endmodule
View attachment output.doc
help me to solve it