Tuesday, May 9, 2017

Verilog Program for 8-bit Carry Skip Adder

module CSA8(cout,S,A,B,cin);
    output [7:0]S;
    output cout;
    input [7:0]A,B;
    input cin;
    wire c1,c2,c3,C4,C5,C6,C7,P0,P1,P2,P3,p4,p5,p6,p7;
    full_adder F1(S[0],c1,A[0],B[0],CIN);
    full_adder F2(S[1],c2,A[1],B[1],c1);
    full_adder F3(S[2],c3,A[2],B[2],c2);
    full_adder F4(S[3],C4,A[3],B[3],c3);
    full_adder F5(S[4],C5,A[4],B[4],C4);
    full_adder F6(S[5],C6,A[5],B[5],C5);
    full_adder F7(S[6],C7,A[6],B[6],C6);
    full_adder F8(S[7],cout,A[7],B[7],C7);
    and g0(p0,A[0],B[0]);
    and g1(p1,A[1],B[1]);
    and g2(p2,A[2],B[2]);
    and g3(p3,A[3],B[3]);
    and g4(p4,A[4],B[4]);
    and g5(p5,A[5],B[5]);
    and g6(p6,A[6],B[6]);
    and g7(p7,A[7],B[7]);
    mux2x1 m1(cout1,c3,cout,se1);
    mux2x1 m2(cout2,c7,cout1,se2);
    endmodule;

No comments:

Post a Comment