├── .gitattributes ├── Carry Lookahead Adder ├── CarryLookaheadAdder.v └── Test.v ├── Carry Ripple Adder ├── CarryRippleAdder.v └── Test.v ├── Carry Select Adder ├── CarrySelectAdder.v └── Test.v ├── Carry Skip Adder ├── CarrySkipAdder.v └── Test.v ├── Hybrid Adder ├── HybridAdder.v └── Test.v ├── Kogge-Stone Adder ├── KoggeStoneAdder.v ├── Test.v └── x ├── LICENSE └── README.md /.gitattributes: -------------------------------------------------------------------------------- 1 | *.v linguist-language=Verilog 2 | -------------------------------------------------------------------------------- /Carry Lookahead Adder/Test.v: -------------------------------------------------------------------------------- 1 | /* (c) Krishna Subramanian 2 | * For Issues & Bugs, report to 3 | */ 4 | 5 | module tb_CLA8; 6 | wire [7:0] sum; 7 | wire cout; 8 | reg [7:0] a, b; 9 | reg cin; 10 | 11 | CLA8 cla8(sum[7:0], cout, a[7:0], b[7:0]); 12 | 13 | initial 14 | begin 15 | $display("a|b||cout|sum"); 16 | end 17 | 18 | initial 19 | begin 20 | $monitor("%b|%b||%b|%b", a[7:0], b[7:0], cout, sum[7:0]); 21 | end 22 | 23 | initial 24 | begin 25 | a=8'b11111010; b=8'b11110000; 26 | #10 a=8'b11111010; b=8'b11110001; 27 | #10 a=8'b00111000; b=8'b10010000; 28 | #10 a=8'b11000010; b=8'b10110000; 29 | 30 | end 31 | 32 | endmodule 33 | 34 | 35 | module tb_CLA16; 36 | wire [15:0] sum; 37 | wire cout; 38 | reg [15:0] a, b; 39 | reg cin; 40 | 41 | CLA16 cla16(sum[15:0], cout, a[15:0], b[15:0]); 42 | 43 | initial 44 | begin 45 | $display("a |b ||cout|sum "); 46 | end 47 | 48 | initial 49 | begin 50 | $monitor("%b|%b||%b |%b", a[15:0], b[15:0], cout, sum[15:0]); 51 | end 52 | 53 | initial 54 | begin 55 | a=16'b1010000010100000; b=16'b1010000010100000; 56 | #10 a=16'b0101100011110100; b=16'b1111010011110100; 57 | #10 a=16'b0000111100111101; b=16'b0000111100001111; 58 | #10 a=16'b1100100011001010; b=16'b1100100011001010; 59 | 60 | end 61 | endmodule 62 | 63 | module tb_CLA32; 64 | wire [31:0] sum; 65 | wire cout; 66 | reg [31:0] a, b; 67 | reg cin; 68 | 69 | CLA32 cla32(sum[31:0], cout, a[31:0], b[31:0]); 70 | 71 | initial 72 | begin 73 | $display("a|b||cout|sum"); 74 | end 75 | 76 | initial 77 | begin 78 | $monitor("%d|%d||%d|%d", a[31:0], b[31:0], cout, sum[31:0]); 79 | end 80 | 81 | initial 82 | begin 83 | a='d999; b='d98999; 84 | 85 | end 86 | endmodule 87 | 88 | module tb_CLA64; 89 | wire [63:0] sum; 90 | wire cout; 91 | reg [63:0] a, b; 92 | reg cin; 93 | 94 | CLA64 cla64(sum[63:0], cout, a[63:0], b[63:0]); 95 | 96 | initial 97 | begin 98 | $display("a|b||cout|sum"); 99 | end 100 | 101 | initial 102 | begin 103 | $monitor("%d|%d||%d|%d", a[63:0], b[63:0], cout, sum[63:0]); 104 | end 105 | 106 | initial 107 | begin 108 | a=64'd9991; b=64'd8810; 109 | 110 | end 111 | endmodule 112 | 113 | -------------------------------------------------------------------------------- /Carry Ripple Adder/CarryRippleAdder.v: -------------------------------------------------------------------------------- 1 | /* (c) Krishna Subramanian 2 | * For Issues & Bugs, report to 3 | */ 4 | 5 | // Full Adder 6 | module FA(output sum, cout, input a, b, cin); 7 | wire w0, w1, w2; 8 | 9 | xor (w0, a, b); 10 | xor (sum, w0, cin); 11 | 12 | and (w1, w0, cin); 13 | and (w2, a, b); 14 | or (cout, w1, w2); 15 | endmodule 16 | 17 | // Ripple Carry Adder - 8 bits 18 | module RCA8(output [7:0] sum, output cout, input [7:0] a, b); 19 | 20 | wire [7:1] c; 21 | 22 | FA fa0(sum[0], c[1], a[0], b[0], 0); 23 | FA fa[6:1](sum[6:1], c[7:2], a[6:1], b[6:1], c[6:1]); 24 | FA fa31(sum[7], cout, a[7], b[7], c[7]); 25 | 26 | endmodule 27 | 28 | // Ripple Carry Adder - 16 bits 29 | module RCA16(output [15:0] sum, output cout, input [15:0] a, b); 30 | 31 | wire [15:1] c; 32 | 33 | FA fa0(sum[0], c[1], a[0], b[0], 0); 34 | FA fa[14:1](sum[14:1], c[15:2], a[14:1], b[14:1], c[14:1]); 35 | FA fa31(sum[15], cout, a[15], b[15], c[15]); 36 | 37 | endmodule 38 | 39 | // Ripple Carry Adder - 32 bits 40 | module RCA32(output [31:0] sum, output cout, input [31:0] a, b); 41 | 42 | wire [31:1] c; 43 | 44 | FA fa0(sum[0], c[1], a[0], b[0], 0); 45 | FA fa[30:1](sum[30:1], c[31:2], a[30:1], b[30:1], c[30:1]); 46 | FA fa31(sum[31], cout, a[31], b[31], c[31]); 47 | 48 | endmodule 49 | 50 | // Ripple Carry Adder - 64 bits 51 | module RCA64(output [63:0] sum, output cout, input [63:0] a, b); 52 | 53 | wire [63:1] c; 54 | 55 | FA fa0(sum[0], c[1], a[0], b[0], 0); 56 | FA fa[62:1](sum[62:1], c[63:2], a[62:1], b[62:1], c[62:1]); 57 | FA fa31(sum[63], cout, a[63], b[63], c[63]); 58 | 59 | endmodule -------------------------------------------------------------------------------- /Carry Ripple Adder/Test.v: -------------------------------------------------------------------------------- 1 | /* (c) Krishna Subramanian 2 | * For Issues & Bugs, report to 3 | */ 4 | 5 | 6 | module tb_FA; 7 | wire sum, cout; 8 | reg a, b, cin; 9 | 10 | FA fa(sum, cout, a, b, cin); 11 | 12 | initial 13 | begin 14 | $display("a|b|cin||cout|sum"); 15 | end 16 | 17 | initial 18 | begin 19 | $monitor("%b|%b|%b ||%b |%b ", a, b, cin, cout, sum); 20 | end 21 | 22 | initial 23 | begin 24 | a=0; b=0; cin=0; 25 | #10 a=0; b=0; cin=1; 26 | #10 a=0; b=1; cin=0; 27 | #10 a=0; b=1; cin=1; 28 | #10 a=1; b=0; cin=0; 29 | #10 a=1; b=0; cin=1; 30 | #10 a=1; b=1; cin=0; 31 | #10 a=1; b=1; cin=1; 32 | end 33 | endmodule 34 | 35 | 36 | module tb_RCA8; 37 | wire [7:0] sum; 38 | wire cout; 39 | reg [7:0] a, b; 40 | reg cin; 41 | 42 | reg [15:0] i; 43 | 44 | RCA8 rca8(sum[7:0], cout, a[7:0], b[7:0]); 45 | 46 | initial 47 | begin 48 | $display("a|b||cout|sum"); 49 | end 50 | 51 | reg checkCarry; 52 | reg [7:0] checkSum; 53 | 54 | initial 55 | begin 56 | for(i=0; i<65536; i=i+1) 57 | begin 58 | #20; {checkCarry,checkSum} = a+b; 59 | $display("a=%b|b=%b||carry=%b|sum=%b", a[7:0], b[7:0], cout, sum[7:0]); 60 | $display("isCarryOK=%b|isSumOK=%b", ~(checkCarry^cout), ~|(checkSum^sum[7:0])); 61 | $display("---------------------------"); 62 | {a[7:0], b[7:0]}=i; 63 | 64 | end 65 | end 66 | 67 | endmodule 68 | 69 | module tb_RCA16; 70 | wire [15:0] sum; 71 | wire cout; 72 | reg [15:0] a, b; 73 | reg cin; 74 | 75 | RCA16 rca16(sum[15:0], cout, a[15:0], b[15:0]); 76 | 77 | initial 78 | begin 79 | $display("a|b||cout|sum"); 80 | end 81 | 82 | initial 83 | begin 84 | $monitor("%b|%b||%b |%b", a[15:0], b[15:0], cout, sum[15:0]); 85 | end 86 | 87 | initial 88 | begin 89 | a=16'b1010000010100000; b=16'b1010000010100000; 90 | #10 a=16'b0101100011110100; b=16'b1111010011110100; 91 | #10 a=16'b0000111100111101; b=16'b0000111100001111; 92 | #10 a=16'b1100100011001010; b=16'b1100100011001010; 93 | 94 | end 95 | endmodule 96 | 97 | module tb_RCA32; 98 | wire [31:0] sum; 99 | wire cout; 100 | reg [31:0] a, b; 101 | reg cin; 102 | 103 | RCA32 rca32(sum[31:0], cout, a[31:0], b[31:0]); 104 | 105 | initial 106 | begin 107 | $display("a|b||cout|sum"); 108 | end 109 | 110 | initial 111 | begin 112 | $monitor("%b|%b||%b|%b", a[31:0], b[31:0], cout, sum[31:0]); 113 | end 114 | 115 | initial 116 | begin 117 | a='b10100000101000001111111111111111; b='b10100000101111111111111111100000; 118 | #10 a='b01011000111111111111111111110100; b='b11110100111101001111111111111111; 119 | #10 a='b11111111111111110000111100111101; b='b00001111000011111111111111111111; 120 | #10 a='b11011111111111111110100011001010; b='b11001111111111111111100011001010; 121 | 122 | end 123 | endmodule 124 | 125 | module tb_RCA64; 126 | wire [63:0] sum; 127 | wire cout; 128 | reg [63:0] a, b; 129 | reg cin; 130 | 131 | RCA64 rca64(sum[63:0], cout, a[63:0], b[63:0]); 132 | 133 | initial 134 | begin 135 | $display("a|b||cout|sum"); 136 | end 137 | 138 | initial 139 | begin 140 | $monitor("%d|%d||%d|%d", a[63:0], b[63:0], cout, sum[63:0]); 141 | end 142 | 143 | initial 144 | begin 145 | a=64'd998; b=64'd128; 146 | #10 a=64'd9998; b=64'd9028; 147 | #10 a=64'd09989998; b=64'd769028; 148 | 149 | end 150 | endmodule -------------------------------------------------------------------------------- /Carry Select Adder/CarrySelectAdder.v: -------------------------------------------------------------------------------- 1 | /* (c) Krishna Subramanian 2 | * For Issues & Bugs, report to 3 | */ 4 | 5 | 6 | // Full Adder 7 | module FA(output sum, cout, input a, b, cin); 8 | wire w0, w1, w2; 9 | 10 | xor #(2) (w0, a, b); 11 | xor #(2) (sum, w0, cin); 12 | 13 | and #(1) (w1, w0, cin); 14 | and #(1) (w2, a, b); 15 | or #(1) (cout, w1, w2); 16 | endmodule 17 | 18 | 19 | // Ripple Carry Adder with cin - 4 bits 20 | module RCA4(output [3:0] sum, output cout, input [3:0] a, b, input cin); 21 | 22 | wire [3:1] c; 23 | 24 | FA fa0(sum[0], c[1], a[0], b[0], cin); 25 | FA fa[2:1](sum[2:1], c[3:2], a[2:1], b[2:1], c[2:1]); 26 | FA fa31(sum[3], cout, a[3], b[3], c[3]); 27 | 28 | endmodule 29 | 30 | module MUX2to1_w1(output y, input i0, i1, s); 31 | 32 | wire e0, e1; 33 | not #(1) (sn, s); 34 | 35 | and #(1) (e0, i0, sn); 36 | and #(1) (e1, i1, s); 37 | 38 | or #(1) (y, e0, e1); 39 | 40 | endmodule 41 | 42 | module MUX2to1_w4(output [3:0] y, input [3:0] i0, i1, input s); 43 | 44 | wire [3:0] e0, e1; 45 | not #(1) (sn, s); 46 | 47 | and #(1) (e0[0], i0[0], sn); 48 | and #(1) (e0[1], i0[1], sn); 49 | and #(1) (e0[2], i0[2], sn); 50 | and #(1) (e0[3], i0[3], sn); 51 | 52 | and #(1) (e1[0], i1[0], s); 53 | and #(1) (e1[1], i1[1], s); 54 | and #(1) (e1[2], i1[2], s); 55 | and #(1) (e1[3], i1[3], s); 56 | 57 | or #(1) (y[0], e0[0], e1[0]); 58 | or #(1) (y[1], e0[1], e1[1]); 59 | or #(1) (y[2], e0[2], e1[2]); 60 | or #(1) (y[3], e0[3], e1[3]); 61 | 62 | endmodule 63 | 64 | // Carry Select Adder - 8 bits 65 | module CSelA8(output [7:0] sum, output cout, input [7:0] a, b); 66 | 67 | wire [7:0] sum0, sum1; 68 | wire c1; 69 | 70 | RCA4 rca0_0(sum0[3:0], cout0_0, a[3:0], b[3:0], 0); 71 | RCA4 rca0_1(sum1[3:0], cout0_1, a[3:0], b[3:0], 1); 72 | MUX2to1_w4 mux0_sum(sum[3:0], sum0[3:0], sum1[3:0], 0); 73 | MUX2to1_w1 mux0_cout(c1, cout0_0, cout0_1, 0); 74 | 75 | RCA4 rca1_0(sum0[7:4], cout1_0, a[7:4], b[7:4], 0); 76 | RCA4 rca1_1(sum1[7:4], cout1_1, a[7:4], b[7:4], 1); 77 | MUX2to1_w4 mux1_sum(sum[7:4], sum0[7:4], sum1[7:4], c1); 78 | MUX2to1_w1 mux1_cout(cout, cout1_0, cout1_1, c1); 79 | 80 | endmodule 81 | 82 | // Carry Select Adder - 16 bits 83 | module CSelA16(output [15:0] sum, output cout, input [15:0] a, b); 84 | 85 | wire [15:0] sum0, sum1; 86 | wire c1, c2, c3; 87 | 88 | RCA4 rca0_0(sum0[3:0], cout0_0, a[3:0], b[3:0], 0); 89 | RCA4 rca0_1(sum1[3:0], cout0_1, a[3:0], b[3:0], 1); 90 | MUX2to1_w4 mux0_sum(sum[3:0], sum0[3:0], sum1[3:0], 0); 91 | MUX2to1_w1 mux0_cout(c1, cout0_0, cout0_1, 0); 92 | 93 | RCA4 rca1_0(sum0[7:4], cout1_0, a[7:4], b[7:4], 0); 94 | RCA4 rca1_1(sum1[7:4], cout1_1, a[7:4], b[7:4], 1); 95 | MUX2to1_w4 mux1_sum(sum[7:4], sum0[7:4], sum1[7:4], c1); 96 | MUX2to1_w1 mux1_cout(c2, cout1_0, cout1_1, c1); 97 | 98 | RCA4 rca2_0(sum0[11:8], cout2_0, a[11:8], b[11:8], 0); 99 | RCA4 rca2_1(sum1[11:8], cout2_1, a[11:8], b[11:8], 1); 100 | MUX2to1_w4 mux2_sum(sum[11:8], sum0[11:8], sum1[11:8], c2); 101 | MUX2to1_w1 mux2_cout(c3, cout2_0, cout2_1, c1); 102 | 103 | RCA4 rca3_0(sum0[15:12], cout3_0, a[15:12], b[15:12], 0); 104 | RCA4 rca3_1(sum1[15:12], cout3_1, a[15:12], b[15:12], 1); 105 | MUX2to1_w4 mux3_sum(sum[15:12], sum0[15:12], sum1[15:12], c3); 106 | MUX2to1_w1 mux3_cout(cout, cout3_0, cout3_1, c1); 107 | 108 | endmodule 109 | 110 | // Carry Select Adder - 32 bits 111 | module CSelA32(output [31:0] sum, output cout, input [31:0] a, b); 112 | 113 | wire [31:0] sum0, sum1; 114 | wire [7:1] c; 115 | wire [7:0] cout0, cout1; 116 | 117 | RCA4 rca0_0(sum0[3:0], cout0[0], a[3:0], b[3:0], 0); 118 | RCA4 rca0_1(sum1[3:0], cout1[0], a[3:0], b[3:0], 1); 119 | MUX2to1_w4 mux0_sum(sum[3:0], sum0[3:0], sum1[3:0], 0); 120 | MUX2to1_w1 mux0_cout(c[1], cout0[0], cout1[0], 0); 121 | 122 | RCA4 rca_other_0[6:1](sum0[27:4], cout0[6:1], a[27:4], b[27:4], 1'b0); 123 | RCA4 rca_other_1[6:1](sum1[27:4], cout1[6:1], a[27:4], b[27:4], 1'b1); 124 | MUX2to1_w4 mux_other_sum[6:1](sum[27:4], sum0[27:4], sum1[27:4], c[6:1]); 125 | MUX2to1_w1 mux_other_cout[6:1](c[7:2], cout0[6:1], cout1[6:1], c[6:1]); 126 | 127 | RCA4 rca_last_0(sum0[31:28], cout0[7], a[31:28], b[31:28], 0); 128 | RCA4 rca_last_1(sum1[31:28], cout1[7], a[31:28], b[31:28], 1); 129 | MUX2to1_w4 mux_last_sum(sum[31:28], sum0[31:28], sum1[31:28], c[7]); 130 | MUX2to1_w1 mux_last_cout(cout, cout0[7], cout1[7], c[7]); 131 | 132 | endmodule 133 | 134 | // Carry Select Adder - 64 bits 135 | module CSelA64(output [63:0] sum, output cout, input [63:0] a, b); 136 | 137 | wire [63:0] sum0, sum1; 138 | wire [15:1] c; 139 | wire [15:0] cout0, cout1; 140 | 141 | RCA4 rca0_0(sum0[3:0], cout0[0], a[3:0], b[3:0], 0); 142 | RCA4 rca0_1(sum1[3:0], cout1[0], a[3:0], b[3:0], 1); 143 | MUX2to1_w4 mux0_sum(sum[3:0], sum0[3:0], sum1[3:0], 0); 144 | MUX2to1_w1 mux0_cout(c[1], cout0[0], cout1[0], 0); 145 | 146 | RCA4 rca_other_0[14:1](sum0[59:4], cout0[14:1], a[59:4], b[59:4], 1'b0); 147 | RCA4 rca_other_1[14:1](sum1[59:4], cout1[14:1], a[59:4], b[59:4], 1'b1); 148 | MUX2to1_w4 mux_other_sum[14:1](sum[59:4], sum0[59:4], sum1[59:4], c[14:1]); 149 | MUX2to1_w1 mux_other_cout[14:1](c[15:2], cout0[14:1], cout1[14:1], c[14:1]); 150 | 151 | RCA4 rca_last_0(sum0[63:60], cout0[15], a[63:60], b[63:60], 0); 152 | RCA4 rca_last_1(sum1[63:60], cout1[15], a[63:60], b[63:60], 1); 153 | MUX2to1_w4 mux_last_sum(sum[63:60], sum0[63:60], sum1[63:60], c[15]); 154 | MUX2to1_w1 mux_last_cout(cout, cout0[15], cout1[15], c[15]); 155 | 156 | endmodule -------------------------------------------------------------------------------- /Carry Select Adder/Test.v: -------------------------------------------------------------------------------- 1 | /* (c) Krishna Subramanian 2 | * For Issues & Bugs, report to 3 | */ 4 | 5 | 6 | module tb_CSelA8; 7 | wire [7:0] sum; 8 | wire cout; 9 | reg [7:0] a, b; 10 | reg cin; 11 | 12 | CSelA8 csa8(sum[7:0], cout, a[7:0], b[7:0]); 13 | 14 | initial 15 | begin 16 | $display("a |b ||cout|sum "); 17 | end 18 | 19 | initial 20 | begin 21 | $monitor("%b|%b||%b |%b", a[7:0], b[7:0], cout, sum[7:0]); 22 | end 23 | 24 | initial 25 | begin 26 | a=8'b10100000; b=8'b10100000; 27 | #10 a=8'b01011000; b=8'b11110100; 28 | #10 a=8'b00111101; b=8'b00001111; 29 | #10 a=8'b11001010; b=8'b11001000; 30 | #10 a=8'b10100110; b=8'b11110100; 31 | #10 a=8'b11110011; b=8'b11001100; 32 | #10 a=8'b11110011; b=8'b01010111; 33 | 34 | end 35 | endmodule 36 | 37 | module tb_CSelA16; 38 | wire [15:0] sum; 39 | wire cout; 40 | reg [15:0] a, b; 41 | reg cin; 42 | 43 | CSelA16 csa16(sum[15:0], cout, a[15:0], b[15:0]); 44 | 45 | initial 46 | begin 47 | $display("a |b ||cout|sum "); 48 | end 49 | 50 | initial 51 | begin 52 | $monitor("%b|%b||%b |%b", a[15:0], b[15:0], cout, sum[15:0]); 53 | end 54 | 55 | initial 56 | begin 57 | a=16'b1010000010100000; b=16'b1010000010100000; 58 | #10 a=16'b0101100011110100; b=16'b1111010011110100; 59 | #10 a=16'b0000111100111101; b=16'b0000111100001111; 60 | #10 a=16'b1100100011001010; b=16'b1100100011001010; 61 | 62 | end 63 | endmodule 64 | 65 | module tb_CSelA32; 66 | wire [31:0] sum; 67 | wire cout; 68 | reg [31:0] a, b; 69 | reg cin; 70 | 71 | CSelA32 csa32(sum[31:0], cout, a[31:0], b[31:0]); 72 | 73 | initial 74 | begin 75 | $display("a|b||cout|sum"); 76 | end 77 | 78 | initial 79 | begin 80 | $monitor("%h|%h||%b|%h", a[31:0], b[31:0], cout, sum[31:0]); 81 | end 82 | 83 | initial 84 | begin 85 | a='b10100000101000001111111111111111; b='b10100000101111111111111111100000; 86 | #10 a='b01011000111111111111111111110100; b='b11110100111101001111111111111111; 87 | #10 a='b11111111111111110000111100111101; b='b00001111000011111111111111111111; 88 | #10 a='b11011111111111111110100011001010; b='b11001111111111111111100011001010; 89 | 90 | end 91 | endmodule 92 | 93 | 94 | module tb_CSelA64; 95 | wire [63:0] sum; 96 | wire cout; 97 | reg [63:0] a, b; 98 | reg cin; 99 | 100 | CSelA64 csa64(sum[63:0], cout, a[63:0], b[63:0]); 101 | 102 | initial 103 | begin 104 | $display("a|b||cout|sum"); 105 | end 106 | 107 | initial 108 | begin 109 | $monitor("%d|%d||%d|%d", a[63:0], b[63:0], cout, sum[63:0]); 110 | end 111 | 112 | initial 113 | begin 114 | a=64'd998; b=64'd128; 115 | #10 a=64'd9998; b=64'd9028; 116 | #10 a=64'd09989998; b=64'd769028; 117 | 118 | end 119 | endmodule -------------------------------------------------------------------------------- /Carry Skip Adder/CarrySkipAdder.v: -------------------------------------------------------------------------------- 1 | /* (c) Krishna Subramanian 2 | * For Issues & Bugs, report to 3 | */ 4 | 5 | 6 | // Full Adder 7 | module FA(output sum, cout, input a, b, cin); 8 | wire w0, w1, w2; 9 | 10 | xor (w0, a, b); 11 | xor (sum, w0, cin); 12 | 13 | and (w1, w0, cin); 14 | and (w2, a, b); 15 | or (cout, w1, w2); 16 | endmodule 17 | 18 | // Ripple Carry Adder - 4 bits 19 | module RCA4(output [3:0] sum, output cout, input [3:0] a, b, input cin); 20 | 21 | wire [3:1] c; 22 | 23 | FA fa0(sum[0], c[1], a[0], b[0], cin); 24 | FA fa[2:1](sum[2:1], c[3:2], a[2:1], b[2:1], c[2:1]); 25 | FA fa31(sum[3], cout, a[3], b[3], c[3]); 26 | 27 | endmodule 28 | 29 | module SkipLogic(output cin_next, 30 | input [3:0] a, b, input cin, cout); 31 | 32 | wire p0, p1, p2, p3, P, e; 33 | 34 | or (p0, a[0], b[0]); 35 | or (p1, a[1], b[1]); 36 | or (p2, a[2], b[2]); 37 | or (p3, a[3], b[3]); 38 | 39 | and (P, p0, p1, p2, p3); 40 | and (e, P, cin); 41 | 42 | or (cin_next, e, cout); 43 | 44 | endmodule 45 | 46 | // Carry Skip Adder - 8 bits 47 | module CSkipA8(output [7:0] sum, output cout, input [7:0] a, b); 48 | 49 | wire cout0, cout1, e; 50 | 51 | RCA4 rca0(sum[3:0], cout0, a[3:0], b[3:0], 0); 52 | RCA4 rca1(sum[7:4], cout1, a[7:4], b[7:4], e); 53 | 54 | SkipLogic skip0(e, a[3:0], b[3:0], 0, cout0); 55 | SkipLogic skip1(cout, a[7:4], b[7:4], e, cout1); 56 | 57 | endmodule 58 | 59 | // Carry Skip Adder - 16 bits 60 | module CSkipA16(output [15:0] sum, output cout, input [15:0] a, b); 61 | 62 | wire [3:0] couts; 63 | wire [2:0] e; 64 | 65 | RCA4 rca0(sum[3:0], couts[0], a[3:0], b[3:0], 0); 66 | RCA4 rca[3:1](sum[15:4], couts[3:1], a[15:4], b[15:4], e[2:0]); 67 | 68 | SkipLogic skip0(e[0], a[3:0], b[3:0], 0, couts[0]); 69 | SkipLogic skip[2:1](e[2:1], a[11:4], b[11:4], e[1:0], couts[2:1]); 70 | SkipLogic skip3(cout, a[15:12], b[15:12], e[2], couts[3]); 71 | 72 | endmodule 73 | 74 | // Carry Skip Adder - 32 bits 75 | module CSkipA32(output [31:0] sum, output cout, input [31:0] a, b); 76 | 77 | wire [7:0] couts; 78 | wire [6:0] e; 79 | 80 | RCA4 rca0(sum[3:0], couts[0], a[3:0], b[3:0], 0); 81 | RCA4 rca[7:1](sum[31:4], couts[7:1], a[31:4], b[31:4], e[6:0]); 82 | 83 | SkipLogic skip0(e[0], a[3:0], b[3:0], 0, couts[0]); 84 | SkipLogic skip[6:1](e[6:1], a[27:4], b[27:4], e[5:0], couts[6:1]); 85 | SkipLogic skip7(cout, a[31:28], b[31:24], e[6], couts[7]); 86 | 87 | endmodule 88 | 89 | // Carry Skip Adder - 64 bits 90 | module CSkipA64(output [63:0] sum, output cout, input [63:0] a, b); 91 | 92 | wire [15:0] couts; 93 | wire [14:0] e; 94 | 95 | RCA4 rca0(sum[3:0], couts[0], a[3:0], b[3:0], 0); 96 | RCA4 rca[15:1](sum[63:4], couts[15:1], a[63:4], b[63:4], e[14:0]); 97 | 98 | SkipLogic skip0(e[0], a[3:0], b[3:0], 0, couts[0]); 99 | SkipLogic skip[14:1](e[14:1], a[59:4], b[59:4], e[13:0], couts[14:1]); 100 | SkipLogic skip15(cout, a[63:60], b[63:60], e[14], couts[15]); 101 | 102 | endmodule -------------------------------------------------------------------------------- /Carry Skip Adder/Test.v: -------------------------------------------------------------------------------- 1 | /* (c) Krishna Subramanian 2 | * For Issues & Bugs, report to 3 | */ 4 | 5 | 6 | module tb_RCA4; 7 | wire [3:0] sum; 8 | wire cout; 9 | reg [3:0] a, b; 10 | reg cin; 11 | 12 | RCA4 rca4(sum[3:0], cout, a[3:0], b[3:0]); 13 | 14 | initial 15 | begin 16 | $display("a|b||cout|sum"); 17 | end 18 | 19 | initial 20 | begin 21 | $monitor("%b|%b||%b|%b", a[3:0], b[3:0], cout, sum[3:0]); 22 | end 23 | 24 | initial 25 | begin 26 | a=4'b1010; b=4'b1010; 27 | #10 a=4'b1000; b=4'b1100; 28 | #10 a=4'b0011; b=4'b1111; 29 | 30 | end 31 | endmodule 32 | 33 | module tb_CSkipA8; 34 | wire [7:0] sum; 35 | wire cout; 36 | reg [7:0] a, b; 37 | 38 | CSkipA8 csa8(sum[7:0], cout, a[7:0], b[7:0]); 39 | 40 | initial 41 | begin 42 | $display("a |b ||cout|sum "); 43 | end 44 | 45 | initial 46 | begin 47 | $monitor("%b|%b||%b |%b", a[7:0], b[7:0], cout, sum[7:0]); 48 | end 49 | 50 | initial 51 | begin 52 | a=8'b10100000; b=8'b10100000; 53 | #10 a=8'b01011000; b=8'b11110100; 54 | #10 a=8'b00111101; b=8'b00001111; 55 | #10 a=8'b11001010; b=8'b11001000; 56 | #10 a=8'b10100110; b=8'b11110100; 57 | #10 a=8'b11110011; b=8'b11001100; 58 | #10 a=8'b11110011; b=8'b01010111; 59 | 60 | end 61 | endmodule 62 | 63 | module tb_CSkipA16; 64 | wire [15:0] sum; 65 | wire cout; 66 | reg [15:0] a, b; 67 | 68 | CSkipA16 csa16(sum[15:0], cout, a[15:0], b[15:0]); 69 | 70 | initial 71 | begin 72 | $display("a |b ||cout|sum "); 73 | end 74 | 75 | initial 76 | begin 77 | $monitor("%b|%b||%b |%b", a[15:0], b[15:0], cout, sum[15:0]); 78 | end 79 | 80 | initial 81 | begin 82 | a=16'b1010000010100000; b=16'b1010000010100000; 83 | #10 a=16'b0101100011110100; b=16'b1111010011110100; 84 | #10 a=16'b0000111100111101; b=16'b0000111100001111; 85 | #10 a=16'b1100100011001010; b=16'b1100100011001010; 86 | end 87 | endmodule 88 | 89 | module tb_CSkipA32; 90 | wire [31:0] sum; 91 | wire cout; 92 | reg [31:0] a, b; 93 | reg cin; 94 | 95 | CSkipA32 sca32(sum[31:0], cout, a[31:0], b[31:0]); 96 | 97 | initial 98 | begin 99 | $display("a|b||cout|sum"); 100 | end 101 | 102 | initial 103 | begin 104 | $monitor("%b|%b||%b|%b", a[31:0], b[31:0], cout, sum[31:0]); 105 | end 106 | 107 | initial 108 | begin 109 | a='b10100000101000001111111111111111; b='b10100000101111111111111111100000; 110 | #10 a='b01011000111111111111111111110100; b='b11110100111101001111111111111111; 111 | #10 a='b11111111111111110000111100111101; b='b00001111000011111111111111111111; 112 | #10 a='b11011111111111111110100011001010; b='b11001111111111111111100011001010; 113 | 114 | end 115 | endmodule 116 | 117 | module tb_CSkipA64; 118 | wire [63:0] sum; 119 | wire cout; 120 | reg [63:0] a, b; 121 | reg cin; 122 | 123 | CSkipA64 csa64(sum[63:0], cout, a[63:0], b[63:0]); 124 | 125 | initial 126 | begin 127 | $display("a|b||cout|sum"); 128 | end 129 | 130 | initial 131 | begin 132 | $monitor("%d|%d||%d|%d", a[63:0], b[63:0], cout, sum[63:0]); 133 | end 134 | 135 | initial 136 | begin 137 | a=64'd998; b=64'd128; 138 | #10 a=64'd9998; b=64'd9028; 139 | #10 a=64'd999909989998; b=64'd769028; 140 | 141 | end 142 | endmodule -------------------------------------------------------------------------------- /Hybrid Adder/HybridAdder.v: -------------------------------------------------------------------------------- 1 | /* (c) Krishna Subramanian 2 | * For Issues & Bugs, report to 3 | */ 4 | 5 | 6 | module BigCircle(output G, P, input Gi, Pi, GiPrev, PiPrev); 7 | 8 | wire e; 9 | and #(1) (e, Pi, GiPrev); 10 | or #(1) (G, e, Gi); 11 | and #(1) (P, Pi, PiPrev); 12 | 13 | endmodule 14 | 15 | module CLA16(output [15:0] sum, output cout, input [15:0] a, b, input cin); 16 | wire [2079:0] g, p, c; 17 | wire [135:0] e; 18 | 19 | //c[0] 20 | and #(1) (e[0], cin, p[0]); 21 | or #(1) (c[0], e[0], g[0]); 22 | 23 | //c[1] 24 | and #(1) (e[1], cin, p[0], p[1]); 25 | and #(1) (e[2], g[0], p[1]); 26 | or #(1) (c[1], e[1], e[2], g[1]); 27 | 28 | //c[2] 29 | and #(1) (e[3], cin, p[0], p[1], p[2]); 30 | and #(1) (e[4], g[0], p[1], p[2]); 31 | and #(1) (e[5], g[1], p[2]); 32 | or #(1) (c[2], e[3], e[4], e[5], g[2]); 33 | 34 | //c[3] 35 | and #(1) (e[6], cin, p[0], p[1], p[2], p[3]); 36 | and #(1) (e[7], g[0], p[1], p[2], p[3]); 37 | and #(1) (e[8], g[1], p[2], p[3]); 38 | and #(1) (e[9], g[2], p[3]); 39 | or #(1) (c[3], e[6], e[7], e[8], e[9], g[3]); 40 | 41 | //c[4] 42 | and #(1) (e[10], cin, p[0], p[1], p[2], p[3], p[4]); 43 | and #(1) (e[11], g[0], p[1], p[2], p[3], p[4]); 44 | and #(1) (e[12], g[1], p[2], p[3], p[4]); 45 | and #(1) (e[13], g[2], p[3], p[4]); 46 | and #(1) (e[14], g[3], p[4]); 47 | or #(1) (c[4], e[10], e[11], e[12], e[13], e[14], g[4]); 48 | 49 | //c[5] 50 | and #(1) (e[15], cin, p[0], p[1], p[2], p[3], p[4], p[5]); 51 | and #(1) (e[16], g[0], p[1], p[2], p[3], p[4], p[5]); 52 | and #(1) (e[17], g[1], p[2], p[3], p[4], p[5]); 53 | and #(1) (e[18], g[2], p[3], p[4], p[5]); 54 | and #(1) (e[19], g[3], p[4], p[5]); 55 | and #(1) (e[20], g[4], p[5]); 56 | or #(1) (c[5], e[15], e[16], e[17], e[18], e[19], e[20], g[5]); 57 | 58 | //c[6] 59 | and #(1) (e[21], cin, p[0], p[1], p[2], p[3], p[4], p[5], p[6]); 60 | and #(1) (e[22], g[0], p[1], p[2], p[3], p[4], p[5], p[6]); 61 | and #(1) (e[23], g[1], p[2], p[3], p[4], p[5], p[6]); 62 | and #(1) (e[24], g[2], p[3], p[4], p[5], p[6]); 63 | and #(1) (e[25], g[3], p[4], p[5], p[6]); 64 | and #(1) (e[26], g[4], p[5], p[6]); 65 | and #(1) (e[27], g[5], p[6]); 66 | or #(1) (c[6], e[21], e[22], e[23], e[24], e[25], e[26], e[27], g[6]); 67 | 68 | //c[7] 69 | and #(1) (e[28], cin, p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7]); 70 | and #(1) (e[29], g[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7]); 71 | and #(1) (e[30], g[1], p[2], p[3], p[4], p[5], p[6], p[7]); 72 | and #(1) (e[31], g[2], p[3], p[4], p[5], p[6], p[7]); 73 | and #(1) (e[32], g[3], p[4], p[5], p[6], p[7]); 74 | and #(1) (e[33], g[4], p[5], p[6], p[7]); 75 | and #(1) (e[34], g[5], p[6], p[7]); 76 | and #(1) (e[35], g[6], p[7]); 77 | or #(1) (c[7], e[28], e[29], e[30], e[31], e[32], e[33], e[34], e[35], g[7]); 78 | 79 | //c[8] 80 | and #(1) (e[36], cin, p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8]); 81 | and #(1) (e[37], g[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8]); 82 | and #(1) (e[38], g[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8]); 83 | and #(1) (e[39], g[2], p[3], p[4], p[5], p[6], p[7], p[8]); 84 | and #(1) (e[40], g[3], p[4], p[5], p[6], p[7], p[8]); 85 | and #(1) (e[41], g[4], p[5], p[6], p[7], p[8]); 86 | and #(1) (e[42], g[5], p[6], p[7], p[8]); 87 | and #(1) (e[43], g[6], p[7], p[8]); 88 | and #(1) (e[44], g[7], p[8]); 89 | or #(1) (c[8], e[36], e[37], e[38], e[39], e[40], e[41], e[42], e[43], e[44], g[8]); 90 | 91 | //c[9] 92 | and #(1) (e[45], cin, p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9]); 93 | and #(1) (e[46], g[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9]); 94 | and #(1) (e[47], g[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9]); 95 | and #(1) (e[48], g[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9]); 96 | and #(1) (e[49], g[3], p[4], p[5], p[6], p[7], p[8], p[9]); 97 | and #(1) (e[50], g[4], p[5], p[6], p[7], p[8], p[9]); 98 | and #(1) (e[51], g[5], p[6], p[7], p[8], p[9]); 99 | and #(1) (e[52], g[6], p[7], p[8], p[9]); 100 | and #(1) (e[53], g[7], p[8], p[9]); 101 | and #(1) (e[54], g[8], p[9]); 102 | or #(1) (c[9], e[45], e[46], e[47], e[48], e[49], e[50], e[51], e[52], e[53], e[54], g[9]); 103 | 104 | //c[10] 105 | and #(1) (e[55], cin, p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10]); 106 | and #(1) (e[56], g[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10]); 107 | and #(1) (e[57], g[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10]); 108 | and #(1) (e[58], g[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10]); 109 | and #(1) (e[59], g[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10]); 110 | and #(1) (e[60], g[4], p[5], p[6], p[7], p[8], p[9], p[10]); 111 | and #(1) (e[61], g[5], p[6], p[7], p[8], p[9], p[10]); 112 | and #(1) (e[62], g[6], p[7], p[8], p[9], p[10]); 113 | and #(1) (e[63], g[7], p[8], p[9], p[10]); 114 | and #(1) (e[64], g[8], p[9], p[10]); 115 | and #(1) (e[65], g[9], p[10]); 116 | or #(1) (c[10], e[55], e[56], e[57], e[58], e[59], e[60], e[61], e[62], e[63], e[64], e[65], g[10]); 117 | 118 | //c[11] 119 | and #(1) (e[66], cin, p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11]); 120 | and #(1) (e[67], g[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11]); 121 | and #(1) (e[68], g[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11]); 122 | and #(1) (e[69], g[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11]); 123 | and #(1) (e[70], g[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11]); 124 | and #(1) (e[71], g[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11]); 125 | and #(1) (e[72], g[5], p[6], p[7], p[8], p[9], p[10], p[11]); 126 | and #(1) (e[73], g[6], p[7], p[8], p[9], p[10], p[11]); 127 | and #(1) (e[74], g[7], p[8], p[9], p[10], p[11]); 128 | and #(1) (e[75], g[8], p[9], p[10], p[11]); 129 | and #(1) (e[76], g[9], p[10], p[11]); 130 | and #(1) (e[77], g[10], p[11]); 131 | or #(1) (c[11], e[66], e[67], e[68], e[69], e[70], e[71], e[72], e[73], e[74], e[75], e[76], e[77], g[11]); 132 | 133 | //c[12] 134 | and #(1) (e[78], cin, p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12]); 135 | and #(1) (e[79], g[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12]); 136 | and #(1) (e[80], g[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12]); 137 | and #(1) (e[81], g[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12]); 138 | and #(1) (e[82], g[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12]); 139 | and #(1) (e[83], g[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12]); 140 | and #(1) (e[84], g[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12]); 141 | and #(1) (e[85], g[6], p[7], p[8], p[9], p[10], p[11], p[12]); 142 | and #(1) (e[86], g[7], p[8], p[9], p[10], p[11], p[12]); 143 | and #(1) (e[87], g[8], p[9], p[10], p[11], p[12]); 144 | and #(1) (e[88], g[9], p[10], p[11], p[12]); 145 | and #(1) (e[89], g[10], p[11], p[12]); 146 | and #(1) (e[90], g[11], p[12]); 147 | or #(1) (c[12], e[78], e[79], e[80], e[81], e[82], e[83], e[84], e[85], e[86], e[87], e[88], e[89], e[90], g[12]); 148 | 149 | //c[13] 150 | and #(1) (e[91], cin, p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13]); 151 | and #(1) (e[92], g[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13]); 152 | and #(1) (e[93], g[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13]); 153 | and #(1) (e[94], g[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13]); 154 | and #(1) (e[95], g[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13]); 155 | and #(1) (e[96], g[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13]); 156 | and #(1) (e[97], g[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13]); 157 | and #(1) (e[98], g[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13]); 158 | and #(1) (e[99], g[7], p[8], p[9], p[10], p[11], p[12], p[13]); 159 | and #(1) (e[100], g[8], p[9], p[10], p[11], p[12], p[13]); 160 | and #(1) (e[101], g[9], p[10], p[11], p[12], p[13]); 161 | and #(1) (e[102], g[10], p[11], p[12], p[13]); 162 | and #(1) (e[103], g[11], p[12], p[13]); 163 | and #(1) (e[104], g[12], p[13]); 164 | or #(1) (c[13], e[91], e[92], e[93], e[94], e[95], e[96], e[97], e[98], e[99], e[100], e[101], e[102], e[103], e[104], g[13]); 165 | 166 | //c[14] 167 | and #(1) (e[105], cin, p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14]); 168 | and #(1) (e[106], g[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14]); 169 | and #(1) (e[107], g[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14]); 170 | and #(1) (e[108], g[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14]); 171 | and #(1) (e[109], g[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14]); 172 | and #(1) (e[110], g[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14]); 173 | and #(1) (e[111], g[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14]); 174 | and #(1) (e[112], g[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14]); 175 | and #(1) (e[113], g[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14]); 176 | and #(1) (e[114], g[8], p[9], p[10], p[11], p[12], p[13], p[14]); 177 | and #(1) (e[115], g[9], p[10], p[11], p[12], p[13], p[14]); 178 | and #(1) (e[116], g[10], p[11], p[12], p[13], p[14]); 179 | and #(1) (e[117], g[11], p[12], p[13], p[14]); 180 | and #(1) (e[118], g[12], p[13], p[14]); 181 | and #(1) (e[119], g[13], p[14]); 182 | or #(1) (c[14], e[105], e[106], e[107], e[108], e[109], e[110], e[111], e[112], e[113], e[114], e[115], e[116], e[117], e[118], e[119], g[14]); 183 | 184 | //c[15] 185 | and #(1) (e[120], cin, p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15]); 186 | and #(1) (e[121], g[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15]); 187 | and #(1) (e[122], g[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15]); 188 | and #(1) (e[123], g[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15]); 189 | and #(1) (e[124], g[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15]); 190 | and #(1) (e[125], g[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15]); 191 | and #(1) (e[126], g[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15]); 192 | and #(1) (e[127], g[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15]); 193 | and #(1) (e[128], g[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15]); 194 | and #(1) (e[129], g[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15]); 195 | and #(1) (e[130], g[9], p[10], p[11], p[12], p[13], p[14], p[15]); 196 | and #(1) (e[131], g[10], p[11], p[12], p[13], p[14], p[15]); 197 | and #(1) (e[132], g[11], p[12], p[13], p[14], p[15]); 198 | and #(1) (e[133], g[12], p[13], p[14], p[15]); 199 | and #(1) (e[134], g[13], p[14], p[15]); 200 | and #(1) (e[135], g[14], p[15]); 201 | or #(1) (c[15], e[120], e[121], e[122], e[123], e[124], e[125], e[126], e[127], e[128], e[129], e[130], e[131], e[132], e[133], e[134], e[135], g[15]); 202 | 203 | xor #(2) (sum[0],p[0],cin); 204 | xor #(2) x[15:1](sum[15:1],p[15:1],c[14:0]); 205 | buf #(1) (cout, c[15]); 206 | PGGen pggen[15:0](g[15:0],p[15:0],a[15:0],b[15:0]); 207 | 208 | endmodule 209 | 210 | 211 | module CLA32(output [31:0] sum, output cout, input [31:0] a, b, input cin); 212 | wire [31:0] g, p, c; 213 | wire [1000:0] e; 214 | 215 | //c[0] 216 | and #(1) (e[0], cin, p[0]); 217 | or #(1) (c[0], e[0], g[0]); 218 | 219 | //c[1] 220 | and #(1) (e[1], cin, p[0], p[1]); 221 | and #(1) (e[2], g[0], p[1]); 222 | or #(1) (c[1], e[1], e[2], g[1]); 223 | 224 | //c[2] 225 | and #(1) (e[3], cin, p[0], p[1], p[2]); 226 | and #(1) (e[4], g[0], p[1], p[2]); 227 | and #(1) (e[5], g[1], p[2]); 228 | or #(1) (c[2], e[3], e[4], e[5], g[2]); 229 | 230 | //c[3] 231 | and #(1) (e[6], cin, p[0], p[1], p[2], p[3]); 232 | and #(1) (e[7], g[0], p[1], p[2], p[3]); 233 | and #(1) (e[8], g[1], p[2], p[3]); 234 | and #(1) (e[9], g[2], p[3]); 235 | or #(1) (c[3], e[6], e[7], e[8], e[9], g[3]); 236 | 237 | //c[4] 238 | and #(1) (e[10], cin, p[0], p[1], p[2], p[3], p[4]); 239 | and #(1) (e[11], g[0], p[1], p[2], p[3], p[4]); 240 | and #(1) (e[12], g[1], p[2], p[3], p[4]); 241 | and #(1) (e[13], g[2], p[3], p[4]); 242 | and #(1) (e[14], g[3], p[4]); 243 | or #(1) (c[4], e[10], e[11], e[12], e[13], e[14], g[4]); 244 | 245 | //c[5] 246 | and #(1) (e[15], cin, p[0], p[1], p[2], p[3], p[4], p[5]); 247 | and #(1) (e[16], g[0], p[1], p[2], p[3], p[4], p[5]); 248 | and #(1) (e[17], g[1], p[2], p[3], p[4], p[5]); 249 | and #(1) (e[18], g[2], p[3], p[4], p[5]); 250 | and #(1) (e[19], g[3], p[4], p[5]); 251 | and #(1) (e[20], g[4], p[5]); 252 | or #(1) (c[5], e[15], e[16], e[17], e[18], e[19], e[20], g[5]); 253 | 254 | //c[6] 255 | and #(1) (e[21], cin, p[0], p[1], p[2], p[3], p[4], p[5], p[6]); 256 | and #(1) (e[22], g[0], p[1], p[2], p[3], p[4], p[5], p[6]); 257 | and #(1) (e[23], g[1], p[2], p[3], p[4], p[5], p[6]); 258 | and #(1) (e[24], g[2], p[3], p[4], p[5], p[6]); 259 | and #(1) (e[25], g[3], p[4], p[5], p[6]); 260 | and #(1) (e[26], g[4], p[5], p[6]); 261 | and #(1) (e[27], g[5], p[6]); 262 | or #(1) (c[6], e[21], e[22], e[23], e[24], e[25], e[26], e[27], g[6]); 263 | 264 | //c[7] 265 | and #(1) (e[28], cin, p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7]); 266 | and #(1) (e[29], g[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7]); 267 | and #(1) (e[30], g[1], p[2], p[3], p[4], p[5], p[6], p[7]); 268 | and #(1) (e[31], g[2], p[3], p[4], p[5], p[6], p[7]); 269 | and #(1) (e[32], g[3], p[4], p[5], p[6], p[7]); 270 | and #(1) (e[33], g[4], p[5], p[6], p[7]); 271 | and #(1) (e[34], g[5], p[6], p[7]); 272 | and #(1) (e[35], g[6], p[7]); 273 | or #(1) (c[7], e[28], e[29], e[30], e[31], e[32], e[33], e[34], e[35], g[7]); 274 | 275 | //c[8] 276 | and #(1) (e[36], cin, p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8]); 277 | and #(1) (e[37], g[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8]); 278 | and #(1) (e[38], g[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8]); 279 | and #(1) (e[39], g[2], p[3], p[4], p[5], p[6], p[7], p[8]); 280 | and #(1) (e[40], g[3], p[4], p[5], p[6], p[7], p[8]); 281 | and #(1) (e[41], g[4], p[5], p[6], p[7], p[8]); 282 | and #(1) (e[42], g[5], p[6], p[7], p[8]); 283 | and #(1) (e[43], g[6], p[7], p[8]); 284 | and #(1) (e[44], g[7], p[8]); 285 | or #(1) (c[8], e[36], e[37], e[38], e[39], e[40], e[41], e[42], e[43], e[44], g[8]); 286 | 287 | //c[9] 288 | and #(1) (e[45], cin, p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9]); 289 | and #(1) (e[46], g[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9]); 290 | and #(1) (e[47], g[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9]); 291 | and #(1) (e[48], g[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9]); 292 | and #(1) (e[49], g[3], p[4], p[5], p[6], p[7], p[8], p[9]); 293 | and #(1) (e[50], g[4], p[5], p[6], p[7], p[8], p[9]); 294 | and #(1) (e[51], g[5], p[6], p[7], p[8], p[9]); 295 | and #(1) (e[52], g[6], p[7], p[8], p[9]); 296 | and #(1) (e[53], g[7], p[8], p[9]); 297 | and #(1) (e[54], g[8], p[9]); 298 | or #(1) (c[9], e[45], e[46], e[47], e[48], e[49], e[50], e[51], e[52], e[53], e[54], g[9]); 299 | 300 | //c[10] 301 | and #(1) (e[55], cin, p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10]); 302 | and #(1) (e[56], g[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10]); 303 | and #(1) (e[57], g[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10]); 304 | and #(1) (e[58], g[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10]); 305 | and #(1) (e[59], g[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10]); 306 | and #(1) (e[60], g[4], p[5], p[6], p[7], p[8], p[9], p[10]); 307 | and #(1) (e[61], g[5], p[6], p[7], p[8], p[9], p[10]); 308 | and #(1) (e[62], g[6], p[7], p[8], p[9], p[10]); 309 | and #(1) (e[63], g[7], p[8], p[9], p[10]); 310 | and #(1) (e[64], g[8], p[9], p[10]); 311 | and #(1) (e[65], g[9], p[10]); 312 | or #(1) (c[10], e[55], e[56], e[57], e[58], e[59], e[60], e[61], e[62], e[63], e[64], e[65], g[10]); 313 | 314 | //c[11] 315 | and #(1) (e[66], cin, p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11]); 316 | and #(1) (e[67], g[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11]); 317 | and #(1) (e[68], g[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11]); 318 | and #(1) (e[69], g[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11]); 319 | and #(1) (e[70], g[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11]); 320 | and #(1) (e[71], g[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11]); 321 | and #(1) (e[72], g[5], p[6], p[7], p[8], p[9], p[10], p[11]); 322 | and #(1) (e[73], g[6], p[7], p[8], p[9], p[10], p[11]); 323 | and #(1) (e[74], g[7], p[8], p[9], p[10], p[11]); 324 | and #(1) (e[75], g[8], p[9], p[10], p[11]); 325 | and #(1) (e[76], g[9], p[10], p[11]); 326 | and #(1) (e[77], g[10], p[11]); 327 | or #(1) (c[11], e[66], e[67], e[68], e[69], e[70], e[71], e[72], e[73], e[74], e[75], e[76], e[77], g[11]); 328 | 329 | //c[12] 330 | and #(1) (e[78], cin, p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12]); 331 | and #(1) (e[79], g[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12]); 332 | and #(1) (e[80], g[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12]); 333 | and #(1) (e[81], g[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12]); 334 | and #(1) (e[82], g[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12]); 335 | and #(1) (e[83], g[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12]); 336 | and #(1) (e[84], g[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12]); 337 | and #(1) (e[85], g[6], p[7], p[8], p[9], p[10], p[11], p[12]); 338 | and #(1) (e[86], g[7], p[8], p[9], p[10], p[11], p[12]); 339 | and #(1) (e[87], g[8], p[9], p[10], p[11], p[12]); 340 | and #(1) (e[88], g[9], p[10], p[11], p[12]); 341 | and #(1) (e[89], g[10], p[11], p[12]); 342 | and #(1) (e[90], g[11], p[12]); 343 | or #(1) (c[12], e[78], e[79], e[80], e[81], e[82], e[83], e[84], e[85], e[86], e[87], e[88], e[89], e[90], g[12]); 344 | 345 | //c[13] 346 | and #(1) (e[91], cin, p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13]); 347 | and #(1) (e[92], g[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13]); 348 | and #(1) (e[93], g[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13]); 349 | and #(1) (e[94], g[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13]); 350 | and #(1) (e[95], g[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13]); 351 | and #(1) (e[96], g[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13]); 352 | and #(1) (e[97], g[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13]); 353 | and #(1) (e[98], g[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13]); 354 | and #(1) (e[99], g[7], p[8], p[9], p[10], p[11], p[12], p[13]); 355 | and #(1) (e[100], g[8], p[9], p[10], p[11], p[12], p[13]); 356 | and #(1) (e[101], g[9], p[10], p[11], p[12], p[13]); 357 | and #(1) (e[102], g[10], p[11], p[12], p[13]); 358 | and #(1) (e[103], g[11], p[12], p[13]); 359 | and #(1) (e[104], g[12], p[13]); 360 | or #(1) (c[13], e[91], e[92], e[93], e[94], e[95], e[96], e[97], e[98], e[99], e[100], e[101], e[102], e[103], e[104], g[13]); 361 | 362 | //c[14] 363 | and #(1) (e[105], cin, p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14]); 364 | and #(1) (e[106], g[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14]); 365 | and #(1) (e[107], g[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14]); 366 | and #(1) (e[108], g[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14]); 367 | and #(1) (e[109], g[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14]); 368 | and #(1) (e[110], g[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14]); 369 | and #(1) (e[111], g[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14]); 370 | and #(1) (e[112], g[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14]); 371 | and #(1) (e[113], g[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14]); 372 | and #(1) (e[114], g[8], p[9], p[10], p[11], p[12], p[13], p[14]); 373 | and #(1) (e[115], g[9], p[10], p[11], p[12], p[13], p[14]); 374 | and #(1) (e[116], g[10], p[11], p[12], p[13], p[14]); 375 | and #(1) (e[117], g[11], p[12], p[13], p[14]); 376 | and #(1) (e[118], g[12], p[13], p[14]); 377 | and #(1) (e[119], g[13], p[14]); 378 | or #(1) (c[14], e[105], e[106], e[107], e[108], e[109], e[110], e[111], e[112], e[113], e[114], e[115], e[116], e[117], e[118], e[119], g[14]); 379 | 380 | //c[15] 381 | and #(1) (e[120], cin, p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15]); 382 | and #(1) (e[121], g[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15]); 383 | and #(1) (e[122], g[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15]); 384 | and #(1) (e[123], g[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15]); 385 | and #(1) (e[124], g[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15]); 386 | and #(1) (e[125], g[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15]); 387 | and #(1) (e[126], g[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15]); 388 | and #(1) (e[127], g[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15]); 389 | and #(1) (e[128], g[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15]); 390 | and #(1) (e[129], g[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15]); 391 | and #(1) (e[130], g[9], p[10], p[11], p[12], p[13], p[14], p[15]); 392 | and #(1) (e[131], g[10], p[11], p[12], p[13], p[14], p[15]); 393 | and #(1) (e[132], g[11], p[12], p[13], p[14], p[15]); 394 | and #(1) (e[133], g[12], p[13], p[14], p[15]); 395 | and #(1) (e[134], g[13], p[14], p[15]); 396 | and #(1) (e[135], g[14], p[15]); 397 | or #(1) (c[15], e[120], e[121], e[122], e[123], e[124], e[125], e[126], e[127], e[128], e[129], e[130], e[131], e[132], e[133], e[134], e[135], g[15]); 398 | 399 | //c[16] 400 | and #(1) (e[136], cin, p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16]); 401 | and #(1) (e[137], g[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16]); 402 | and #(1) (e[138], g[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16]); 403 | and #(1) (e[139], g[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16]); 404 | and #(1) (e[140], g[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16]); 405 | and #(1) (e[141], g[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16]); 406 | and #(1) (e[142], g[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16]); 407 | and #(1) (e[143], g[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16]); 408 | and #(1) (e[144], g[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16]); 409 | and #(1) (e[145], g[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16]); 410 | and #(1) (e[146], g[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16]); 411 | and #(1) (e[147], g[10], p[11], p[12], p[13], p[14], p[15], p[16]); 412 | and #(1) (e[148], g[11], p[12], p[13], p[14], p[15], p[16]); 413 | and #(1) (e[149], g[12], p[13], p[14], p[15], p[16]); 414 | and #(1) (e[150], g[13], p[14], p[15], p[16]); 415 | and #(1) (e[151], g[14], p[15], p[16]); 416 | and #(1) (e[152], g[15], p[16]); 417 | or #(1) (c[16], e[136], e[137], e[138], e[139], e[140], e[141], e[142], e[143], e[144], e[145], e[146], e[147], e[148], e[149], e[150], e[151], e[152], g[16]); 418 | 419 | //c[17] 420 | and #(1) (e[153], cin, p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17]); 421 | and #(1) (e[154], g[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17]); 422 | and #(1) (e[155], g[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17]); 423 | and #(1) (e[156], g[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17]); 424 | and #(1) (e[157], g[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17]); 425 | and #(1) (e[158], g[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17]); 426 | and #(1) (e[159], g[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17]); 427 | and #(1) (e[160], g[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17]); 428 | and #(1) (e[161], g[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17]); 429 | and #(1) (e[162], g[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17]); 430 | and #(1) (e[163], g[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17]); 431 | and #(1) (e[164], g[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17]); 432 | and #(1) (e[165], g[11], p[12], p[13], p[14], p[15], p[16], p[17]); 433 | and #(1) (e[166], g[12], p[13], p[14], p[15], p[16], p[17]); 434 | and #(1) (e[167], g[13], p[14], p[15], p[16], p[17]); 435 | and #(1) (e[168], g[14], p[15], p[16], p[17]); 436 | and #(1) (e[169], g[15], p[16], p[17]); 437 | and #(1) (e[170], g[16], p[17]); 438 | or #(1) (c[17], e[153], e[154], e[155], e[156], e[157], e[158], e[159], e[160], e[161], e[162], e[163], e[164], e[165], e[166], e[167], e[168], e[169], e[170], g[17]); 439 | 440 | //c[18] 441 | and #(1) (e[171], cin, p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18]); 442 | and #(1) (e[172], g[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18]); 443 | and #(1) (e[173], g[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18]); 444 | and #(1) (e[174], g[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18]); 445 | and #(1) (e[175], g[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18]); 446 | and #(1) (e[176], g[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18]); 447 | and #(1) (e[177], g[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18]); 448 | and #(1) (e[178], g[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18]); 449 | and #(1) (e[179], g[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18]); 450 | and #(1) (e[180], g[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18]); 451 | and #(1) (e[181], g[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18]); 452 | and #(1) (e[182], g[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18]); 453 | and #(1) (e[183], g[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18]); 454 | and #(1) (e[184], g[12], p[13], p[14], p[15], p[16], p[17], p[18]); 455 | and #(1) (e[185], g[13], p[14], p[15], p[16], p[17], p[18]); 456 | and #(1) (e[186], g[14], p[15], p[16], p[17], p[18]); 457 | and #(1) (e[187], g[15], p[16], p[17], p[18]); 458 | and #(1) (e[188], g[16], p[17], p[18]); 459 | and #(1) (e[189], g[17], p[18]); 460 | or #(1) (c[18], e[171], e[172], e[173], e[174], e[175], e[176], e[177], e[178], e[179], e[180], e[181], e[182], e[183], e[184], e[185], e[186], e[187], e[188], e[189], g[18]); 461 | 462 | //c[19] 463 | and #(1) (e[190], cin, p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19]); 464 | and #(1) (e[191], g[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19]); 465 | and #(1) (e[192], g[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19]); 466 | and #(1) (e[193], g[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19]); 467 | and #(1) (e[194], g[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19]); 468 | and #(1) (e[195], g[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19]); 469 | and #(1) (e[196], g[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19]); 470 | and #(1) (e[197], g[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19]); 471 | and #(1) (e[198], g[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19]); 472 | and #(1) (e[199], g[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19]); 473 | and #(1) (e[200], g[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19]); 474 | and #(1) (e[201], g[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19]); 475 | and #(1) (e[202], g[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19]); 476 | and #(1) (e[203], g[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19]); 477 | and #(1) (e[204], g[13], p[14], p[15], p[16], p[17], p[18], p[19]); 478 | and #(1) (e[205], g[14], p[15], p[16], p[17], p[18], p[19]); 479 | and #(1) (e[206], g[15], p[16], p[17], p[18], p[19]); 480 | and #(1) (e[207], g[16], p[17], p[18], p[19]); 481 | and #(1) (e[208], g[17], p[18], p[19]); 482 | and #(1) (e[209], g[18], p[19]); 483 | or #(1) (c[19], e[190], e[191], e[192], e[193], e[194], e[195], e[196], e[197], e[198], e[199], e[200], e[201], e[202], e[203], e[204], e[205], e[206], e[207], e[208], e[209], g[19]); 484 | 485 | //c[20] 486 | and #(1) (e[210], cin, p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20]); 487 | and #(1) (e[211], g[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20]); 488 | and #(1) (e[212], g[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20]); 489 | and #(1) (e[213], g[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20]); 490 | and #(1) (e[214], g[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20]); 491 | and #(1) (e[215], g[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20]); 492 | and #(1) (e[216], g[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20]); 493 | and #(1) (e[217], g[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20]); 494 | and #(1) (e[218], g[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20]); 495 | and #(1) (e[219], g[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20]); 496 | and #(1) (e[220], g[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20]); 497 | and #(1) (e[221], g[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20]); 498 | and #(1) (e[222], g[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20]); 499 | and #(1) (e[223], g[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20]); 500 | and #(1) (e[224], g[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20]); 501 | and #(1) (e[225], g[14], p[15], p[16], p[17], p[18], p[19], p[20]); 502 | and #(1) (e[226], g[15], p[16], p[17], p[18], p[19], p[20]); 503 | and #(1) (e[227], g[16], p[17], p[18], p[19], p[20]); 504 | and #(1) (e[228], g[17], p[18], p[19], p[20]); 505 | and #(1) (e[229], g[18], p[19], p[20]); 506 | and #(1) (e[230], g[19], p[20]); 507 | or #(1) (c[20], e[210], e[211], e[212], e[213], e[214], e[215], e[216], e[217], e[218], e[219], e[220], e[221], e[222], e[223], e[224], e[225], e[226], e[227], e[228], e[229], e[230], g[20]); 508 | 509 | //c[21] 510 | and #(1) (e[231], cin, p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21]); 511 | and #(1) (e[232], g[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21]); 512 | and #(1) (e[233], g[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21]); 513 | and #(1) (e[234], g[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21]); 514 | and #(1) (e[235], g[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21]); 515 | and #(1) (e[236], g[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21]); 516 | and #(1) (e[237], g[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21]); 517 | and #(1) (e[238], g[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21]); 518 | and #(1) (e[239], g[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21]); 519 | and #(1) (e[240], g[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21]); 520 | and #(1) (e[241], g[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21]); 521 | and #(1) (e[242], g[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21]); 522 | and #(1) (e[243], g[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21]); 523 | and #(1) (e[244], g[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21]); 524 | and #(1) (e[245], g[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21]); 525 | and #(1) (e[246], g[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21]); 526 | and #(1) (e[247], g[15], p[16], p[17], p[18], p[19], p[20], p[21]); 527 | and #(1) (e[248], g[16], p[17], p[18], p[19], p[20], p[21]); 528 | and #(1) (e[249], g[17], p[18], p[19], p[20], p[21]); 529 | and #(1) (e[250], g[18], p[19], p[20], p[21]); 530 | and #(1) (e[251], g[19], p[20], p[21]); 531 | and #(1) (e[252], g[20], p[21]); 532 | or #(1) (c[21], e[231], e[232], e[233], e[234], e[235], e[236], e[237], e[238], e[239], e[240], e[241], e[242], e[243], e[244], e[245], e[246], e[247], e[248], e[249], e[250], e[251], e[252], g[21]); 533 | 534 | //c[22] 535 | and #(1) (e[253], cin, p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22]); 536 | and #(1) (e[254], g[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22]); 537 | and #(1) (e[255], g[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22]); 538 | and #(1) (e[256], g[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22]); 539 | and #(1) (e[257], g[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22]); 540 | and #(1) (e[258], g[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22]); 541 | and #(1) (e[259], g[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22]); 542 | and #(1) (e[260], g[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22]); 543 | and #(1) (e[261], g[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22]); 544 | and #(1) (e[262], g[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22]); 545 | and #(1) (e[263], g[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22]); 546 | and #(1) (e[264], g[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22]); 547 | and #(1) (e[265], g[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22]); 548 | and #(1) (e[266], g[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22]); 549 | and #(1) (e[267], g[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22]); 550 | and #(1) (e[268], g[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22]); 551 | and #(1) (e[269], g[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22]); 552 | and #(1) (e[270], g[16], p[17], p[18], p[19], p[20], p[21], p[22]); 553 | and #(1) (e[271], g[17], p[18], p[19], p[20], p[21], p[22]); 554 | and #(1) (e[272], g[18], p[19], p[20], p[21], p[22]); 555 | and #(1) (e[273], g[19], p[20], p[21], p[22]); 556 | and #(1) (e[274], g[20], p[21], p[22]); 557 | and #(1) (e[275], g[21], p[22]); 558 | or #(1) (c[22], e[253], e[254], e[255], e[256], e[257], e[258], e[259], e[260], e[261], e[262], e[263], e[264], e[265], e[266], e[267], e[268], e[269], e[270], e[271], e[272], e[273], e[274], e[275], g[22]); 559 | 560 | //c[23] 561 | and #(1) (e[276], cin, p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23]); 562 | and #(1) (e[277], g[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23]); 563 | and #(1) (e[278], g[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23]); 564 | and #(1) (e[279], g[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23]); 565 | and #(1) (e[280], g[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23]); 566 | and #(1) (e[281], g[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23]); 567 | and #(1) (e[282], g[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23]); 568 | and #(1) (e[283], g[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23]); 569 | and #(1) (e[284], g[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23]); 570 | and #(1) (e[285], g[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23]); 571 | and #(1) (e[286], g[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23]); 572 | and #(1) (e[287], g[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23]); 573 | and #(1) (e[288], g[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23]); 574 | and #(1) (e[289], g[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23]); 575 | and #(1) (e[290], g[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23]); 576 | and #(1) (e[291], g[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23]); 577 | and #(1) (e[292], g[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23]); 578 | and #(1) (e[293], g[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23]); 579 | and #(1) (e[294], g[17], p[18], p[19], p[20], p[21], p[22], p[23]); 580 | and #(1) (e[295], g[18], p[19], p[20], p[21], p[22], p[23]); 581 | and #(1) (e[296], g[19], p[20], p[21], p[22], p[23]); 582 | and #(1) (e[297], g[20], p[21], p[22], p[23]); 583 | and #(1) (e[298], g[21], p[22], p[23]); 584 | and #(1) (e[299], g[22], p[23]); 585 | or #(1) (c[23], e[276], e[277], e[278], e[279], e[280], e[281], e[282], e[283], e[284], e[285], e[286], e[287], e[288], e[289], e[290], e[291], e[292], e[293], e[294], e[295], e[296], e[297], e[298], e[299], g[23]); 586 | 587 | //c[24] 588 | and #(1) (e[300], cin, p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24]); 589 | and #(1) (e[301], g[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24]); 590 | and #(1) (e[302], g[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24]); 591 | and #(1) (e[303], g[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24]); 592 | and #(1) (e[304], g[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24]); 593 | and #(1) (e[305], g[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24]); 594 | and #(1) (e[306], g[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24]); 595 | and #(1) (e[307], g[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24]); 596 | and #(1) (e[308], g[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24]); 597 | and #(1) (e[309], g[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24]); 598 | and #(1) (e[310], g[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24]); 599 | and #(1) (e[311], g[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24]); 600 | and #(1) (e[312], g[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24]); 601 | and #(1) (e[313], g[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24]); 602 | and #(1) (e[314], g[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24]); 603 | and #(1) (e[315], g[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24]); 604 | and #(1) (e[316], g[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24]); 605 | and #(1) (e[317], g[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24]); 606 | and #(1) (e[318], g[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24]); 607 | and #(1) (e[319], g[18], p[19], p[20], p[21], p[22], p[23], p[24]); 608 | and #(1) (e[320], g[19], p[20], p[21], p[22], p[23], p[24]); 609 | and #(1) (e[321], g[20], p[21], p[22], p[23], p[24]); 610 | and #(1) (e[322], g[21], p[22], p[23], p[24]); 611 | and #(1) (e[323], g[22], p[23], p[24]); 612 | and #(1) (e[324], g[23], p[24]); 613 | or #(1) (c[24], e[300], e[301], e[302], e[303], e[304], e[305], e[306], e[307], e[308], e[309], e[310], e[311], e[312], e[313], e[314], e[315], e[316], e[317], e[318], e[319], e[320], e[321], e[322], e[323], e[324], g[24]); 614 | 615 | //c[25] 616 | and #(1) (e[325], cin, p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25]); 617 | and #(1) (e[326], g[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25]); 618 | and #(1) (e[327], g[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25]); 619 | and #(1) (e[328], g[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25]); 620 | and #(1) (e[329], g[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25]); 621 | and #(1) (e[330], g[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25]); 622 | and #(1) (e[331], g[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25]); 623 | and #(1) (e[332], g[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25]); 624 | and #(1) (e[333], g[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25]); 625 | and #(1) (e[334], g[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25]); 626 | and #(1) (e[335], g[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25]); 627 | and #(1) (e[336], g[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25]); 628 | and #(1) (e[337], g[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25]); 629 | and #(1) (e[338], g[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25]); 630 | and #(1) (e[339], g[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25]); 631 | and #(1) (e[340], g[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25]); 632 | and #(1) (e[341], g[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25]); 633 | and #(1) (e[342], g[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25]); 634 | and #(1) (e[343], g[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25]); 635 | and #(1) (e[344], g[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25]); 636 | and #(1) (e[345], g[19], p[20], p[21], p[22], p[23], p[24], p[25]); 637 | and #(1) (e[346], g[20], p[21], p[22], p[23], p[24], p[25]); 638 | and #(1) (e[347], g[21], p[22], p[23], p[24], p[25]); 639 | and #(1) (e[348], g[22], p[23], p[24], p[25]); 640 | and #(1) (e[349], g[23], p[24], p[25]); 641 | and #(1) (e[350], g[24], p[25]); 642 | or #(1) (c[25], e[325], e[326], e[327], e[328], e[329], e[330], e[331], e[332], e[333], e[334], e[335], e[336], e[337], e[338], e[339], e[340], e[341], e[342], e[343], e[344], e[345], e[346], e[347], e[348], e[349], e[350], g[25]); 643 | 644 | //c[26] 645 | and #(1) (e[351], cin, p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26]); 646 | and #(1) (e[352], g[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26]); 647 | and #(1) (e[353], g[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26]); 648 | and #(1) (e[354], g[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26]); 649 | and #(1) (e[355], g[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26]); 650 | and #(1) (e[356], g[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26]); 651 | and #(1) (e[357], g[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26]); 652 | and #(1) (e[358], g[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26]); 653 | and #(1) (e[359], g[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26]); 654 | and #(1) (e[360], g[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26]); 655 | and #(1) (e[361], g[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26]); 656 | and #(1) (e[362], g[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26]); 657 | and #(1) (e[363], g[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26]); 658 | and #(1) (e[364], g[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26]); 659 | and #(1) (e[365], g[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26]); 660 | and #(1) (e[366], g[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26]); 661 | and #(1) (e[367], g[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26]); 662 | and #(1) (e[368], g[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26]); 663 | and #(1) (e[369], g[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26]); 664 | and #(1) (e[370], g[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26]); 665 | and #(1) (e[371], g[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26]); 666 | and #(1) (e[372], g[20], p[21], p[22], p[23], p[24], p[25], p[26]); 667 | and #(1) (e[373], g[21], p[22], p[23], p[24], p[25], p[26]); 668 | and #(1) (e[374], g[22], p[23], p[24], p[25], p[26]); 669 | and #(1) (e[375], g[23], p[24], p[25], p[26]); 670 | and #(1) (e[376], g[24], p[25], p[26]); 671 | and #(1) (e[377], g[25], p[26]); 672 | or #(1) (c[26], e[351], e[352], e[353], e[354], e[355], e[356], e[357], e[358], e[359], e[360], e[361], e[362], e[363], e[364], e[365], e[366], e[367], e[368], e[369], e[370], e[371], e[372], e[373], e[374], e[375], e[376], e[377], g[26]); 673 | 674 | //c[27] 675 | and #(1) (e[378], cin, p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27]); 676 | and #(1) (e[379], g[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27]); 677 | and #(1) (e[380], g[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27]); 678 | and #(1) (e[381], g[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27]); 679 | and #(1) (e[382], g[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27]); 680 | and #(1) (e[383], g[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27]); 681 | and #(1) (e[384], g[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27]); 682 | and #(1) (e[385], g[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27]); 683 | and #(1) (e[386], g[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27]); 684 | and #(1) (e[387], g[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27]); 685 | and #(1) (e[388], g[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27]); 686 | and #(1) (e[389], g[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27]); 687 | and #(1) (e[390], g[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27]); 688 | and #(1) (e[391], g[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27]); 689 | and #(1) (e[392], g[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27]); 690 | and #(1) (e[393], g[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27]); 691 | and #(1) (e[394], g[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27]); 692 | and #(1) (e[395], g[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27]); 693 | and #(1) (e[396], g[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27]); 694 | and #(1) (e[397], g[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27]); 695 | and #(1) (e[398], g[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27]); 696 | and #(1) (e[399], g[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27]); 697 | and #(1) (e[400], g[21], p[22], p[23], p[24], p[25], p[26], p[27]); 698 | and #(1) (e[401], g[22], p[23], p[24], p[25], p[26], p[27]); 699 | and #(1) (e[402], g[23], p[24], p[25], p[26], p[27]); 700 | and #(1) (e[403], g[24], p[25], p[26], p[27]); 701 | and #(1) (e[404], g[25], p[26], p[27]); 702 | and #(1) (e[405], g[26], p[27]); 703 | or #(1) (c[27], e[378], e[379], e[380], e[381], e[382], e[383], e[384], e[385], e[386], e[387], e[388], e[389], e[390], e[391], e[392], e[393], e[394], e[395], e[396], e[397], e[398], e[399], e[400], e[401], e[402], e[403], e[404], e[405], g[27]); 704 | 705 | //c[28] 706 | and #(1) (e[406], cin, p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27], p[28]); 707 | and #(1) (e[407], g[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27], p[28]); 708 | and #(1) (e[408], g[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27], p[28]); 709 | and #(1) (e[409], g[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27], p[28]); 710 | and #(1) (e[410], g[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27], p[28]); 711 | and #(1) (e[411], g[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27], p[28]); 712 | and #(1) (e[412], g[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27], p[28]); 713 | and #(1) (e[413], g[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27], p[28]); 714 | and #(1) (e[414], g[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27], p[28]); 715 | and #(1) (e[415], g[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27], p[28]); 716 | and #(1) (e[416], g[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27], p[28]); 717 | and #(1) (e[417], g[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27], p[28]); 718 | and #(1) (e[418], g[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27], p[28]); 719 | and #(1) (e[419], g[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27], p[28]); 720 | and #(1) (e[420], g[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27], p[28]); 721 | and #(1) (e[421], g[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27], p[28]); 722 | and #(1) (e[422], g[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27], p[28]); 723 | and #(1) (e[423], g[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27], p[28]); 724 | and #(1) (e[424], g[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27], p[28]); 725 | and #(1) (e[425], g[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27], p[28]); 726 | and #(1) (e[426], g[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27], p[28]); 727 | and #(1) (e[427], g[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27], p[28]); 728 | and #(1) (e[428], g[21], p[22], p[23], p[24], p[25], p[26], p[27], p[28]); 729 | and #(1) (e[429], g[22], p[23], p[24], p[25], p[26], p[27], p[28]); 730 | and #(1) (e[430], g[23], p[24], p[25], p[26], p[27], p[28]); 731 | and #(1) (e[431], g[24], p[25], p[26], p[27], p[28]); 732 | and #(1) (e[432], g[25], p[26], p[27], p[28]); 733 | and #(1) (e[433], g[26], p[27], p[28]); 734 | and #(1) (e[434], g[27], p[28]); 735 | or #(1) (c[28], e[406], e[407], e[408], e[409], e[410], e[411], e[412], e[413], e[414], e[415], e[416], e[417], e[418], e[419], e[420], e[421], e[422], e[423], e[424], e[425], e[426], e[427], e[428], e[429], e[430], e[431], e[432], e[433], e[434], g[28]); 736 | 737 | //c[29] 738 | and #(1) (e[435], cin, p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27], p[28], p[29]); 739 | and #(1) (e[436], g[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27], p[28], p[29]); 740 | and #(1) (e[437], g[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27], p[28], p[29]); 741 | and #(1) (e[438], g[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27], p[28], p[29]); 742 | and #(1) (e[439], g[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27], p[28], p[29]); 743 | and #(1) (e[440], g[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27], p[28], p[29]); 744 | and #(1) (e[441], g[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27], p[28], p[29]); 745 | and #(1) (e[442], g[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27], p[28], p[29]); 746 | and #(1) (e[443], g[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27], p[28], p[29]); 747 | and #(1) (e[444], g[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27], p[28], p[29]); 748 | and #(1) (e[445], g[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27], p[28], p[29]); 749 | and #(1) (e[446], g[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27], p[28], p[29]); 750 | and #(1) (e[447], g[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27], p[28], p[29]); 751 | and #(1) (e[448], g[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27], p[28], p[29]); 752 | and #(1) (e[449], g[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27], p[28], p[29]); 753 | and #(1) (e[450], g[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27], p[28], p[29]); 754 | and #(1) (e[451], g[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27], p[28], p[29]); 755 | and #(1) (e[452], g[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27], p[28], p[29]); 756 | and #(1) (e[453], g[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27], p[28], p[29]); 757 | and #(1) (e[454], g[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27], p[28], p[29]); 758 | and #(1) (e[455], g[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27], p[28], p[29]); 759 | and #(1) (e[456], g[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27], p[28], p[29]); 760 | and #(1) (e[457], g[21], p[22], p[23], p[24], p[25], p[26], p[27], p[28], p[29]); 761 | and #(1) (e[458], g[22], p[23], p[24], p[25], p[26], p[27], p[28], p[29]); 762 | and #(1) (e[459], g[23], p[24], p[25], p[26], p[27], p[28], p[29]); 763 | and #(1) (e[460], g[24], p[25], p[26], p[27], p[28], p[29]); 764 | and #(1) (e[461], g[25], p[26], p[27], p[28], p[29]); 765 | and #(1) (e[462], g[26], p[27], p[28], p[29]); 766 | and #(1) (e[463], g[27], p[28], p[29]); 767 | and #(1) (e[464], g[28], p[29]); 768 | or #(1) (c[29], e[435], e[436], e[437], e[438], e[439], e[440], e[441], e[442], e[443], e[444], e[445], e[446], e[447], e[448], e[449], e[450], e[451], e[452], e[453], e[454], e[455], e[456], e[457], e[458], e[459], e[460], e[461], e[462], e[463], e[464], g[29]); 769 | 770 | //c[30] 771 | and #(1) (e[465], cin, p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27], p[28], p[29], p[30]); 772 | and #(1) (e[466], g[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27], p[28], p[29], p[30]); 773 | and #(1) (e[467], g[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27], p[28], p[29], p[30]); 774 | and #(1) (e[468], g[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27], p[28], p[29], p[30]); 775 | and #(1) (e[469], g[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27], p[28], p[29], p[30]); 776 | and #(1) (e[470], g[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27], p[28], p[29], p[30]); 777 | and #(1) (e[471], g[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27], p[28], p[29], p[30]); 778 | and #(1) (e[472], g[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27], p[28], p[29], p[30]); 779 | and #(1) (e[473], g[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27], p[28], p[29], p[30]); 780 | and #(1) (e[474], g[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27], p[28], p[29], p[30]); 781 | and #(1) (e[475], g[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27], p[28], p[29], p[30]); 782 | and #(1) (e[476], g[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27], p[28], p[29], p[30]); 783 | and #(1) (e[477], g[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27], p[28], p[29], p[30]); 784 | and #(1) (e[478], g[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27], p[28], p[29], p[30]); 785 | and #(1) (e[479], g[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27], p[28], p[29], p[30]); 786 | and #(1) (e[480], g[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27], p[28], p[29], p[30]); 787 | and #(1) (e[481], g[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27], p[28], p[29], p[30]); 788 | and #(1) (e[482], g[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27], p[28], p[29], p[30]); 789 | and #(1) (e[483], g[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27], p[28], p[29], p[30]); 790 | and #(1) (e[484], g[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27], p[28], p[29], p[30]); 791 | and #(1) (e[485], g[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27], p[28], p[29], p[30]); 792 | and #(1) (e[486], g[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27], p[28], p[29], p[30]); 793 | and #(1) (e[487], g[21], p[22], p[23], p[24], p[25], p[26], p[27], p[28], p[29], p[30]); 794 | and #(1) (e[488], g[22], p[23], p[24], p[25], p[26], p[27], p[28], p[29], p[30]); 795 | and #(1) (e[489], g[23], p[24], p[25], p[26], p[27], p[28], p[29], p[30]); 796 | and #(1) (e[490], g[24], p[25], p[26], p[27], p[28], p[29], p[30]); 797 | and #(1) (e[491], g[25], p[26], p[27], p[28], p[29], p[30]); 798 | and #(1) (e[492], g[26], p[27], p[28], p[29], p[30]); 799 | and #(1) (e[493], g[27], p[28], p[29], p[30]); 800 | and #(1) (e[494], g[28], p[29], p[30]); 801 | and #(1) (e[495], g[29], p[30]); 802 | or #(1) (c[30], e[465], e[466], e[467], e[468], e[469], e[470], e[471], e[472], e[473], e[474], e[475], e[476], e[477], e[478], e[479], e[480], e[481], e[482], e[483], e[484], e[485], e[486], e[487], e[488], e[489], e[490], e[491], e[492], e[493], e[494], e[495], g[30]); 803 | 804 | //c[31] 805 | and #(1) (e[496], cin, p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27], p[28], p[29], p[30], p[31]); 806 | and #(1) (e[497], g[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27], p[28], p[29], p[30], p[31]); 807 | and #(1) (e[498], g[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27], p[28], p[29], p[30], p[31]); 808 | and #(1) (e[499], g[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27], p[28], p[29], p[30], p[31]); 809 | and #(1) (e[500], g[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27], p[28], p[29], p[30], p[31]); 810 | and #(1) (e[501], g[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27], p[28], p[29], p[30], p[31]); 811 | and #(1) (e[502], g[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27], p[28], p[29], p[30], p[31]); 812 | and #(1) (e[503], g[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27], p[28], p[29], p[30], p[31]); 813 | and #(1) (e[504], g[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27], p[28], p[29], p[30], p[31]); 814 | and #(1) (e[505], g[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27], p[28], p[29], p[30], p[31]); 815 | and #(1) (e[506], g[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27], p[28], p[29], p[30], p[31]); 816 | and #(1) (e[507], g[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27], p[28], p[29], p[30], p[31]); 817 | and #(1) (e[508], g[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27], p[28], p[29], p[30], p[31]); 818 | and #(1) (e[509], g[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27], p[28], p[29], p[30], p[31]); 819 | and #(1) (e[510], g[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27], p[28], p[29], p[30], p[31]); 820 | and #(1) (e[511], g[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27], p[28], p[29], p[30], p[31]); 821 | and #(1) (e[512], g[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27], p[28], p[29], p[30], p[31]); 822 | and #(1) (e[513], g[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27], p[28], p[29], p[30], p[31]); 823 | and #(1) (e[514], g[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27], p[28], p[29], p[30], p[31]); 824 | and #(1) (e[515], g[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27], p[28], p[29], p[30], p[31]); 825 | and #(1) (e[516], g[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27], p[28], p[29], p[30], p[31]); 826 | and #(1) (e[517], g[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27], p[28], p[29], p[30], p[31]); 827 | and #(1) (e[518], g[21], p[22], p[23], p[24], p[25], p[26], p[27], p[28], p[29], p[30], p[31]); 828 | and #(1) (e[519], g[22], p[23], p[24], p[25], p[26], p[27], p[28], p[29], p[30], p[31]); 829 | and #(1) (e[520], g[23], p[24], p[25], p[26], p[27], p[28], p[29], p[30], p[31]); 830 | and #(1) (e[521], g[24], p[25], p[26], p[27], p[28], p[29], p[30], p[31]); 831 | and #(1) (e[522], g[25], p[26], p[27], p[28], p[29], p[30], p[31]); 832 | and #(1) (e[523], g[26], p[27], p[28], p[29], p[30], p[31]); 833 | and #(1) (e[524], g[27], p[28], p[29], p[30], p[31]); 834 | and #(1) (e[525], g[28], p[29], p[30], p[31]); 835 | and #(1) (e[526], g[29], p[30], p[31]); 836 | and #(1) (e[527], g[30], p[31]); 837 | or #(1) (c[31], e[496], e[497], e[498], e[499], e[500], e[501], e[502], e[503], e[504], e[505], e[506], e[507], e[508], e[509], e[510], e[511], e[512], e[513], e[514], e[515], e[516], e[517], e[518], e[519], e[520], e[521], e[522], e[523], e[524], e[525], e[526], e[527], g[31]); 838 | 839 | xor #(2) (sum[0],p[0],cin); 840 | xor #(2) x[31:1](sum[31:1],p[31:1],c[30:0]); 841 | buf #(1) (cout, c[31]); 842 | PGGen pggen[31:0](g[31:0],p[31:0],a[31:0],b[31:0]); 843 | 844 | endmodule 845 | 846 | module CLA4(output [3:0] sum, output cout, input [3:0] a, b, input cin); 847 | wire [3:0] g, p, c; 848 | wire [135:0] e; 849 | //c[0] 850 | and #(1) (e[0], cin, p[0]); 851 | or #(1) (c[0], e[0], g[0]); 852 | 853 | //c[1] 854 | and #(1) (e[1], cin, p[0], p[1]); 855 | and #(1) (e[2], g[0], p[1]); 856 | or #(1) (c[1], e[1], e[2], g[1]); 857 | 858 | //c[2] 859 | and #(1) (e[3], cin, p[0], p[1], p[2]); 860 | and #(1) (e[4], g[0], p[1], p[2]); 861 | and #(1) (e[5], g[1], p[2]); 862 | or #(1) (c[2], e[3], e[4], e[5], g[2]); 863 | 864 | //c[3] 865 | and #(1) (e[6], cin, p[0], p[1], p[2], p[3]); 866 | and #(1) (e[7], g[0], p[1], p[2], p[3]); 867 | and #(1) (e[8], g[1], p[2], p[3]); 868 | and #(1) (e[9], g[2], p[3]); 869 | or #(1) (c[3], e[6], e[7], e[8], e[9], g[3]); 870 | 871 | xor #(2) (sum[0],p[0],cin); 872 | xor #(2) x[3:1](sum[3:1],p[3:1],c[2:0]); 873 | buf #(1) (cout, c[3]); 874 | PGGen pggen[3:0](g[3:0],p[3:0],a[3:0],b[3:0]); 875 | endmodule 876 | 877 | module CLA8(output [7:0] sum, output cout, input [7:0] a, b, input cin); 878 | wire [7:0] g, p, c; 879 | wire [135:0] e; 880 | 881 | //c[0] 882 | and #(1) (e[0], cin, p[0]); 883 | or #(1) (c[0], e[0], g[0]); 884 | 885 | //c[1] 886 | and #(1) (e[1], cin, p[0], p[1]); 887 | and #(1) (e[2], g[0], p[1]); 888 | or #(1) (c[1], e[1], e[2], g[1]); 889 | 890 | //c[2] 891 | and #(1) (e[3], cin, p[0], p[1], p[2]); 892 | and #(1) (e[4], g[0], p[1], p[2]); 893 | and #(1) (e[5], g[1], p[2]); 894 | or #(1) (c[2], e[3], e[4], e[5], g[2]); 895 | 896 | //c[3] 897 | and #(1) (e[6], cin, p[0], p[1], p[2], p[3]); 898 | and #(1) (e[7], g[0], p[1], p[2], p[3]); 899 | and #(1) (e[8], g[1], p[2], p[3]); 900 | and #(1) (e[9], g[2], p[3]); 901 | or #(1) (c[3], e[6], e[7], e[8], e[9], g[3]); 902 | 903 | //c[4] 904 | and #(1) (e[10], cin, p[0], p[1], p[2], p[3], p[4]); 905 | and #(1) (e[11], g[0], p[1], p[2], p[3], p[4]); 906 | and #(1) (e[12], g[1], p[2], p[3], p[4]); 907 | and #(1) (e[13], g[2], p[3], p[4]); 908 | and #(1) (e[14], g[3], p[4]); 909 | or #(1) (c[4], e[10], e[11], e[12], e[13], e[14], g[4]); 910 | 911 | //c[5] 912 | and #(1) (e[15], cin, p[0], p[1], p[2], p[3], p[4], p[5]); 913 | and #(1) (e[16], g[0], p[1], p[2], p[3], p[4], p[5]); 914 | and #(1) (e[17], g[1], p[2], p[3], p[4], p[5]); 915 | and #(1) (e[18], g[2], p[3], p[4], p[5]); 916 | and #(1) (e[19], g[3], p[4], p[5]); 917 | and #(1) (e[20], g[4], p[5]); 918 | or #(1) (c[5], e[15], e[16], e[17], e[18], e[19], e[20], g[5]); 919 | 920 | //c[6] 921 | and #(1) (e[21], cin, p[0], p[1], p[2], p[3], p[4], p[5], p[6]); 922 | and #(1) (e[22], g[0], p[1], p[2], p[3], p[4], p[5], p[6]); 923 | and #(1) (e[23], g[1], p[2], p[3], p[4], p[5], p[6]); 924 | and #(1) (e[24], g[2], p[3], p[4], p[5], p[6]); 925 | and #(1) (e[25], g[3], p[4], p[5], p[6]); 926 | and #(1) (e[26], g[4], p[5], p[6]); 927 | and #(1) (e[27], g[5], p[6]); 928 | or #(1) (c[6], e[21], e[22], e[23], e[24], e[25], e[26], e[27], g[6]); 929 | 930 | //c[7] 931 | and #(1) (e[28], cin, p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7]); 932 | and #(1) (e[29], g[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7]); 933 | and #(1) (e[30], g[1], p[2], p[3], p[4], p[5], p[6], p[7]); 934 | and #(1) (e[31], g[2], p[3], p[4], p[5], p[6], p[7]); 935 | and #(1) (e[32], g[3], p[4], p[5], p[6], p[7]); 936 | and #(1) (e[33], g[4], p[5], p[6], p[7]); 937 | and #(1) (e[34], g[5], p[6], p[7]); 938 | and #(1) (e[35], g[6], p[7]); 939 | or #(1) (c[7], e[28], e[29], e[30], e[31], e[32], e[33], e[34], e[35], g[7]); 940 | 941 | xor #(2) (sum[0],p[0],cin); 942 | xor #(2) x[7:1](sum[7:1],p[7:1],c[6:0]); 943 | buf #(1) (cout, c[7]); 944 | PGGen pggen[7:0](g[7:0],p[7:0],a[7:0],b[7:0]); 945 | endmodule 946 | 947 | module HA16(output [15:0] sum, output cout, input [15:0] a, b); 948 | 949 | // KSA + CLA 950 | CLA8 cla8(sum[7:0], cout_1, a[7:0], b[7:0], 1'b0); 951 | KSA8 ksa8(sum[15:8], cout, a[15:8], b[15:8], cout_1); 952 | 953 | endmodule 954 | 955 | 956 | module HA32(output [31:0] sum, output cout, input [31:0] a, b); 957 | 958 | // KSA + CLA 959 | CLA16 cla16(sum[15:0], cout_1, a[15:0], b[15:0], 1'b0); 960 | KSA16 ksa16(sum[31:16], cout, a[31:16], b[31:16], cout_1); 961 | 962 | endmodule 963 | 964 | 965 | module HA64(output [63:0] sum, output cout, input [63:0] a, b); 966 | 967 | // KSA + CLA 968 | CLA32 cla32(sum[31:0], cout_1, a[31:0], b[31:0], 1'b0); 969 | KSA32 ksa32(sum[63:32], cout, a[63:32], b[63:32], cout_1); 970 | 971 | endmodule 972 | 973 | 974 | module HA8(output [7:0] sum, output cout, input [7:0] a, b); 975 | 976 | // KSA + CLA 977 | CLA4 cla4(sum[3:0], cout_1, a[3:0], b[3:0], 1'b0); 978 | KSA4 ksa4(sum[7:4], cout, a[7:4], b[7:4], cout_1); 979 | 980 | endmodule 981 | 982 | 983 | module KSA16(output [15:0] sum, output cout, input [15:0] a, b, input cin); 984 | 985 | wire [15:0] c; 986 | wire [15:0] g, p; 987 | Square sq[15:0](g, p, a, b); 988 | 989 | // first line of circles 990 | wire [15:1] g2, p2; 991 | SmallCircle sc0_0(c[0], g[0]); 992 | BigCircle bc0[15:1](g2[15:1], p2[15:1], g[15:1], p[15:1], g[14:0], p[14:0]); 993 | 994 | // second line of circle 995 | wire [15:3] g3, p3; 996 | SmallCircle sc1[2:1](c[2:1], g2[2:1]); 997 | BigCircle bc1[15:3](g3[15:3], p3[15:3], g2[15:3], p2[15:3], g2[13:1], p2[13:1]); 998 | 999 | // third line of circle 1000 | wire [15:7] g4, p4; 1001 | SmallCircle sc2[6:3](c[6:3], g3[6:3]); 1002 | BigCircle bc2[15:7](g4[15:7], p4[15:7], g3[15:7], p3[15:7], g3[11:3], p3[11:3]); 1003 | 1004 | // fourth line of circle 1005 | wire [15:15] g5, p5; 1006 | SmallCircle sc3[14:7](c[14:7], g4[14:7]); 1007 | BigCircle bc3_15(g5[15], p5[15], g4[15], p4[15], g4[7], p4[7]); 1008 | 1009 | // fifth line of circle 1010 | SmallCircle sc4_15(c[15], g5[15]); 1011 | 1012 | // last line - triangles 1013 | Triangle tr0(sum[0], p[0], cin); 1014 | Triangle tr[15:1](sum[15:1], p[15:1], c[14:0]); 1015 | 1016 | // generate cout 1017 | buf #(1) (cout, c[15]); 1018 | 1019 | endmodule 1020 | 1021 | 1022 | module KSA32(output [31:0] sum, output cout, input [31:0] a, b, input cin); 1023 | 1024 | wire [31:0] c; 1025 | wire [31:0] g, p; 1026 | Square sq[31:0](g, p, a, b); 1027 | 1028 | // first line of circles 1029 | wire [31:1] g2, p2; 1030 | SmallCircle sc0_0(c[0], g[0]); 1031 | BigCircle bc0[31:1](g2[31:1], p2[31:1], g[31:1], p[31:1], g[30:0], p[30:0]); 1032 | 1033 | // second line of circles 1034 | wire [31:3] g3, p3; 1035 | SmallCircle sc1[2:1](c[2:1], g2[2:1]); 1036 | BigCircle bc1[31:3](g3[31:3], p3[31:3], g2[31:3], p2[31:3], g2[29:1], p2[29:1]); 1037 | 1038 | // third line of circles 1039 | wire [31:7] g4, p4; 1040 | SmallCircle sc2[6:3](c[6:3], g3[6:3]); 1041 | BigCircle bc2[31:7](g4[31:7], p4[31:7], g3[31:7], p3[31:7], g3[27:3], p3[27:3]); 1042 | 1043 | // fourth line of circles 1044 | wire [31:15] g5, p5; 1045 | SmallCircle sc3[14:7](c[14:7], g4[14:7]); 1046 | BigCircle bc3[31:15](g5[31:15], p5[31:15], g4[31:15], p4[31:15], g4[23:7], p4[23:7]); 1047 | 1048 | // fifth line of circles 1049 | wire [31:31] g6, p6; 1050 | SmallCircle sc4[30:15](c[30:15], g5[30:15]); 1051 | BigCircle bc4_31(g6[31], p6[31], g5[31], p5[31], g5[15], p5[15]); 1052 | 1053 | // sixth line of circles 1054 | SmallCircle sc5_31(c[31], g6[31]); 1055 | 1056 | // last line - triangless 1057 | Triangle tr0(sum[0], p[0], cin); 1058 | Triangle tr[31:1](sum[31:1], p[31:1], c[30:0]); 1059 | 1060 | // generate cout 1061 | buf #(1) (cout, c[31]); 1062 | 1063 | endmodule 1064 | 1065 | 1066 | module KSA4(output [3:0] sum, output cout, input [3:0] a, b, input cin); 1067 | 1068 | wire [3:0] c; 1069 | wire [3:0] g, p; 1070 | Square sq[3:0](g, p, a, b); 1071 | 1072 | // first line of circles 1073 | wire [3:1] g2, p2; 1074 | SmallCircle sc0_0(c[0], g[0]); 1075 | BigCircle bc0[3:1](g2[3:1], p2[3:1], g[3:1], p[3:1], g[2:0], p[2:0]); 1076 | 1077 | // second line of circle 1078 | wire [3:3] g3, p3; 1079 | SmallCircle sc1[2:1](c[2:1], g2[2:1]); 1080 | BigCircle bc1[3:3](g3[3:3], p3[3:3], g2[3:3], p2[3:3], g2[1:1], p2[1:1]); 1081 | 1082 | // fourth line of circle 1083 | SmallCircle sc3_7(c[3], g3[3]); 1084 | 1085 | // last line - triangles 1086 | Triangle tr0(sum[0], p[0], cin); 1087 | Triangle tr[3:1](sum[3:1], p[3:1], c[2:0]); 1088 | 1089 | // generate cout 1090 | buf #(1) (cout, c[3]); 1091 | 1092 | endmodule 1093 | 1094 | 1095 | module KSA8(output [7:0] sum, output cout, input [7:0] a, b, input cin); 1096 | 1097 | wire [7:0] c; 1098 | wire [7:0] g, p; 1099 | Square sq[7:0](g, p, a, b); 1100 | 1101 | // first line of circles 1102 | wire [7:1] g2, p2; 1103 | SmallCircle sc0_0(c[0], g[0]); 1104 | BigCircle bc0[7:1](g2[7:1], p2[7:1], g[7:1], p[7:1], g[6:0], p[6:0]); 1105 | 1106 | // second line of circle 1107 | wire [7:3] g3, p3; 1108 | SmallCircle sc1[2:1](c[2:1], g2[2:1]); 1109 | BigCircle bc1[7:3](g3[7:3], p3[7:3], g2[7:3], p2[7:3], g2[5:1], p2[5:1]); 1110 | 1111 | // third line of circle 1112 | wire [7:7] g4, p4; 1113 | SmallCircle sc2[6:3](c[6:3], g3[6:3]); 1114 | BigCircle bc2_7(g4[7], p4[7], g3[7], p3[7], g3[3], p3[3]); 1115 | 1116 | // fourth line of circle 1117 | SmallCircle sc3_7(c[7], g4[7]); 1118 | 1119 | // last line - triangles 1120 | Triangle tr0(sum[0], p[0], cin); 1121 | Triangle tr[7:1](sum[7:1], p[7:1], c[6:0]); 1122 | 1123 | // generate cout 1124 | buf #(1) (cout, c[7]); 1125 | 1126 | endmodule 1127 | 1128 | 1129 | module PGGen(output g, p, input a, b); 1130 | 1131 | and #(1) (g, a, b); 1132 | xor #(2) (p, a, b); 1133 | 1134 | endmodule 1135 | 1136 | module SmallCircle(output Ci, input Gi); 1137 | 1138 | buf #(1) (Ci, Gi); 1139 | 1140 | endmodule 1141 | 1142 | 1143 | module Square(output G, P, input Ai, Bi); 1144 | 1145 | and #(1) (G, Ai, Bi); 1146 | xor #(2) (P, Ai, Bi); 1147 | 1148 | endmodule 1149 | 1150 | module Triangle(output Si, input Pi, CiPrev); 1151 | 1152 | xor #(2) (Si, Pi, CiPrev); 1153 | 1154 | endmodule 1155 | -------------------------------------------------------------------------------- /Hybrid Adder/Test.v: -------------------------------------------------------------------------------- 1 | /* (c) Krishna Subramanian 2 | * For Issues & Bugs, report to 3 | */ 4 | 5 | module tb_HA8; 6 | wire [7:0] sum; 7 | wire cout; 8 | reg [7:0] a, b; 9 | reg cin; 10 | 11 | HA8 ha8(sum, cout, a, b); 12 | 13 | initial 14 | begin 15 | $display("a|b||cout|sum"); 16 | end 17 | 18 | initial 19 | begin 20 | $monitor("%b|%b||%b|%b", a, b, cout, sum); 21 | end 22 | 23 | initial 24 | begin 25 | a=8'b11111010; b=8'b11110000; 26 | #40 a=8'b11111010; b=8'b11110001; 27 | #40 a=8'b00111000; b=8'b10010000; 28 | #40 a=8'b11000010; b=8'b10110000; 29 | 30 | end 31 | 32 | endmodule 33 | 34 | module tb_HA16; 35 | wire [15:0] sum; 36 | wire cout; 37 | reg [15:0] a, b; 38 | reg cin; 39 | 40 | HA16 ha16(sum, cout, a, b); 41 | 42 | initial 43 | begin 44 | $display("a|b||cout|sum"); 45 | end 46 | 47 | initial 48 | begin 49 | $monitor("%b|%b||%b|%b", a, b, cout, sum); 50 | end 51 | 52 | initial 53 | begin 54 | a=16'b1111101011111010; b=16'b1111101011110000; 55 | #40 a=16'b1111101000111000; b=16'b0000000011110001; 56 | #40 a=16'b0011100000111000; b=16'b1001000011110001; 57 | #40 a=16'b1111110001000010; b=16'b1011111100010000; 58 | 59 | end 60 | 61 | endmodule 62 | 63 | module tb_HA32; 64 | wire [31:0] sum; 65 | wire cout; 66 | reg [31:0] a, b; 67 | reg cin; 68 | 69 | HA32 ha32(sum, cout, a, b); 70 | 71 | initial 72 | begin 73 | $display("a|b||cout|sum"); 74 | end 75 | 76 | initial 77 | begin 78 | $monitor("%b|%b||%b|%b", a, b, cout, sum); 79 | end 80 | 81 | initial 82 | begin 83 | a=32'b11111010111110000000011110001111; b=32'b01010101111100000000000011110001; 84 | #100 a=32'b11111010001110001111111111111111; b=32'b00000000111100101010101001010001; 85 | #100 a=32'b00111000001110010101010011101010; b=32'b10010000111100000111111100011101; 86 | #100 a=32'b11111100010011111100000111110010; b=32'b10111111000100111100011100010100; 87 | 88 | end 89 | 90 | endmodule 91 | 92 | 93 | module tb_HA64; 94 | wire [63:0] sum; 95 | wire cout; 96 | reg [63:0] a, b; 97 | reg cin; 98 | 99 | HA64 ha64(sum, cout, a, b); 100 | 101 | initial 102 | begin 103 | $display("a|b||cout|sum"); 104 | end 105 | 106 | initial 107 | begin 108 | $monitor("%b|%b||%b|%b", a, b, cout, sum); 109 | end 110 | 111 | initial 112 | begin 113 | a=64'b1111111101011111000000001111000111111010111110000000011110001111; b=64'b0101010111110000000111110101111100000000111100011110000011110001; 114 | #200 a=64'b1111101011111000111110101111100000000111100011110000011110001111; b=64'b0101010111110111110101111100000000111100011110000000000011110001; 115 | end 116 | 117 | endmodule 118 | -------------------------------------------------------------------------------- /Kogge-Stone Adder/KoggeStoneAdder.v: -------------------------------------------------------------------------------- 1 | /* (c) Krishna Subramanian 2 | * For Issues & Bugs, report to 3 | */ 4 | 5 | module BigCircle(output G, P, input Gi, Pi, GiPrev, PiPrev); 6 | 7 | wire e; 8 | and #(1) (e, Pi, GiPrev); 9 | or #(1) (G, e, Gi); 10 | and #(1) (P, Pi, PiPrev); 11 | 12 | endmodule 13 | 14 | module SmallCircle(output Ci, input Gi); 15 | 16 | buf #(1) (Ci, Gi); 17 | 18 | endmodule 19 | 20 | module Square(output G, P, input Ai, Bi); 21 | 22 | and #(1) (G, Ai, Bi); 23 | xor #(2) (P, Ai, Bi); 24 | 25 | endmodule 26 | 27 | module Triangle(output Si, input Pi, CiPrev); 28 | 29 | xor #(2) (Si, Pi, CiPrev); 30 | 31 | endmodule 32 | 33 | module KSA8(output [7:0] sum, output cout, input [7:0] a, b); 34 | 35 | wire cin = 1'b0; 36 | wire [7:0] c; 37 | wire [7:0] g, p; 38 | Square sq[7:0](g, p, a, b); 39 | 40 | // first line of circles 41 | wire [7:1] g2, p2; 42 | SmallCircle sc0_0(c[0], g[0]); 43 | BigCircle bc0[7:1](g2[7:1], p2[7:1], g[7:1], p[7:1], g[6:0], p[6:0]); 44 | 45 | // second line of circle 46 | wire [7:3] g3, p3; 47 | SmallCircle sc1[2:1](c[2:1], g2[2:1]); 48 | BigCircle bc1[7:3](g3[7:3], p3[7:3], g2[7:3], p2[7:3], g2[5:1], p2[5:1]); 49 | 50 | // third line of circle 51 | wire [7:7] g4, p4; 52 | SmallCircle sc2[6:3](c[6:3], g3[6:3]); 53 | BigCircle bc2_7(g4[7], p4[7], g3[7], p3[7], g3[3], p3[3]); 54 | 55 | // fourth line of circle 56 | SmallCircle sc3_7(c[7], g4[7]); 57 | 58 | // last line - triangles 59 | Triangle tr0(sum[0], p[0], cin); 60 | Triangle tr[7:1](sum[7:1], p[7:1], c[6:0]); 61 | 62 | // generate cout 63 | buf #(1) (cout, c[7]); 64 | 65 | endmodule 66 | 67 | module KSA16(output [15:0] sum, output cout, input [15:0] a, b); 68 | 69 | wire cin = 1'b0; 70 | wire [15:0] c; 71 | wire [15:0] g, p; 72 | Square sq[15:0](g, p, a, b); 73 | 74 | // first line of circles 75 | wire [15:1] g2, p2; 76 | SmallCircle sc0_0(c[0], g[0]); 77 | BigCircle bc0[15:1](g2[15:1], p2[15:1], g[15:1], p[15:1], g[14:0], p[14:0]); 78 | 79 | // second line of circle 80 | wire [15:3] g3, p3; 81 | SmallCircle sc1[2:1](c[2:1], g2[2:1]); 82 | BigCircle bc1[15:3](g3[15:3], p3[15:3], g2[15:3], p2[15:3], g2[13:1], p2[13:1]); 83 | 84 | // third line of circle 85 | wire [15:7] g4, p4; 86 | SmallCircle sc2[6:3](c[6:3], g3[6:3]); 87 | BigCircle bc2[15:7](g4[15:7], p4[15:7], g3[15:7], p3[15:7], g3[11:3], p3[11:3]); 88 | 89 | // fourth line of circle 90 | wire [15:15] g5, p5; 91 | SmallCircle sc3[14:7](c[14:7], g4[14:7]); 92 | BigCircle bc3_15(g5[15], p5[15], g4[15], p4[15], g4[7], p4[7]); 93 | 94 | // fifth line of circle 95 | SmallCircle sc4_15(c[15], g5[15]); 96 | 97 | // last line - triangles 98 | Triangle tr0(sum[0], p[0], cin); 99 | Triangle tr[15:1](sum[15:1], p[15:1], c[14:0]); 100 | 101 | // generate cout 102 | buf #(1) (cout, c[15]); 103 | 104 | endmodule 105 | 106 | module KSA32(output [31:0] sum, output cout, input [31:0] a, b); 107 | 108 | wire cin = 1'b0; 109 | wire [31:0] c; 110 | wire [31:0] g, p; 111 | Square sq[31:0](g, p, a, b); 112 | 113 | // first line of circles 114 | wire [31:1] g2, p2; 115 | SmallCircle sc0_0(c[0], g[0]); 116 | BigCircle bc0[31:1](g2[31:1], p2[31:1], g[31:1], p[31:1], g[30:0], p[30:0]); 117 | 118 | // second line of circles 119 | wire [31:3] g3, p3; 120 | SmallCircle sc1[2:1](c[2:1], g2[2:1]); 121 | BigCircle bc1[31:3](g3[31:3], p3[31:3], g2[31:3], p2[31:3], g2[29:1], p2[29:1]); 122 | 123 | // third line of circles 124 | wire [31:7] g4, p4; 125 | SmallCircle sc2[6:3](c[6:3], g3[6:3]); 126 | BigCircle bc2[31:7](g4[31:7], p4[31:7], g3[31:7], p3[31:7], g3[27:3], p3[27:3]); 127 | 128 | // fourth line of circles 129 | wire [31:15] g5, p5; 130 | SmallCircle sc3[14:7](c[14:7], g4[14:7]); 131 | BigCircle bc3[31:15](g5[31:15], p5[31:15], g4[31:15], p4[31:15], g4[23:7], p4[23:7]); 132 | 133 | // fifth line of circles 134 | wire [31:31] g6, p6; 135 | SmallCircle sc4[30:15](c[30:15], g5[30:15]); 136 | BigCircle bc4_31(g6[31], p6[31], g5[31], p5[31], g5[15], p5[15]); 137 | 138 | // sixth line of circles 139 | SmallCircle sc5_31(c[31], g6[31]); 140 | 141 | // last line - triangless 142 | Triangle tr0(sum[0], p[0], cin); 143 | Triangle tr[31:1](sum[31:1], p[31:1], c[30:0]); 144 | 145 | // generate cout 146 | buf #(1) (cout, c[31]); 147 | 148 | endmodule 149 | 150 | module KSA64(output [63:0] sum, output cout, input [63:0] a, b); 151 | 152 | wire cin = 1'b0; 153 | wire [63:0] c; 154 | wire [63:0] g, p; 155 | Square sq[63:0](g, p, a, b); 156 | 157 | // first line of circles 158 | wire [63:1] g2, p2; 159 | SmallCircle sc0_0(c[0], g[0]); 160 | BigCircle bc0[63:1](g2[63:1], p2[63:1], g[63:1], p[63:1], g[62:0], p[62:0]); 161 | 162 | // second line of circles 163 | wire [63:3] g3, p3; 164 | SmallCircle sc1[2:1](c[2:1], g2[2:1]); 165 | BigCircle bc1[63:3](g3[63:3], p3[63:3], g2[63:3], p2[63:3], g2[61:1], p2[61:1]); 166 | 167 | // third line of circles 168 | wire [63:7] g4, p4; 169 | SmallCircle sc2[6:3](c[6:3], g3[6:3]); 170 | BigCircle bc2[63:7](g4[63:7], p4[63:7], g3[63:7], p3[63:7], g3[59:3], p3[59:3]); 171 | 172 | // fourth line of circles 173 | wire [63:15] g5, p5; 174 | SmallCircle sc3[14:7](c[14:7], g4[14:7]); 175 | BigCircle bc3[63:15](g5[63:15], p5[63:15], g4[63:15], p4[63:15], g4[55:7], p4[55:7]); 176 | 177 | // fifth line of circles 178 | wire [63:31] g6, p6; 179 | SmallCircle sc4[30:15](c[30:15], g5[30:15]); 180 | BigCircle bc4[63:31](g6[63:31], p6[63:31], g5[63:31], p5[63:31], g5[47:15], p5[47:15]); 181 | 182 | // sixth line of circles 183 | wire [63:63] g7, p7; 184 | SmallCircle sc5[62:31](c[62:31], g6[62:31]); 185 | BigCircle bc4_63(g7[63], p7[63], g6[63], p6[63], g6[31], p6[31]); 186 | 187 | // seventh line of circles 188 | SmallCircle sc6(c[63], g7[63]); 189 | 190 | // last line - triangles 191 | Triangle tr0(sum[0], p[0], cin); 192 | Triangle tr[63:1](sum[63:1], p[63:1], c[62:0]); 193 | 194 | // generate cout 195 | buf #(1) (cout, c[63]); 196 | 197 | endmodule 198 | -------------------------------------------------------------------------------- /Kogge-Stone Adder/Test.v: -------------------------------------------------------------------------------- 1 | /* (c) Krishna Subramanian 2 | * For Issues & Bugs, report to 3 | */ 4 | 5 | 6 | module tb_KSA8; 7 | wire [7:0] sum; 8 | wire cout; 9 | reg [7:0] a, b; 10 | reg cin; 11 | 12 | KSA8 ksa8(sum[7:0], cout, a[7:0], b[7:0]); 13 | 14 | initial 15 | begin 16 | $display("a |b ||cout|sum "); 17 | end 18 | 19 | initial 20 | begin 21 | $monitor("%b|%b||%b |%b", a[7:0], b[7:0], cout, sum[7:0]); 22 | end 23 | 24 | initial 25 | begin 26 | a=8'b10100000; b=8'b10100000; 27 | #10 a=8'b01011000; b=8'b11110100; 28 | #10 a=8'b00111101; b=8'b00001111; 29 | #10 a=8'b11001010; b=8'b11001000; 30 | #10 a=8'b10100110; b=8'b11110100; 31 | #10 a=8'b11110011; b=8'b11001100; 32 | #10 a=8'b11110011; b=8'b01010111; 33 | 34 | end 35 | endmodule 36 | 37 | module tb_KSA16; 38 | wire [15:0] sum; 39 | wire cout; 40 | reg [15:0] a, b; 41 | reg cin; 42 | 43 | KSA16 ksa16(sum[15:0], cout, a[15:0], b[15:0]); 44 | 45 | initial 46 | begin 47 | $display("a |b ||cout|sum "); 48 | end 49 | 50 | initial 51 | begin 52 | $monitor("%b|%b||%b |%b", a[15:0], b[15:0], cout, sum[15:0]); 53 | end 54 | 55 | initial 56 | begin 57 | a=16'b1010000010100000; b=16'b1010000010100000; 58 | #10 a=16'b0101100011110100; b=16'b1111010011110100; 59 | #10 a=16'b0000111100111101; b=16'b0000111100001111; 60 | #10 a=16'b1100100011001010; b=16'b1100100011001010; 61 | 62 | end 63 | endmodule 64 | 65 | 66 | module tb_KSA32; 67 | wire [31:0] sum; 68 | wire cout; 69 | reg [31:0] a, b; 70 | reg cin; 71 | 72 | KSA32 ksa32(sum[31:0], cout, a[31:0], b[31:0]); 73 | 74 | initial 75 | begin 76 | $display("a|b||cout|sum"); 77 | end 78 | 79 | initial 80 | begin 81 | $monitor("%b|%b||%b|%b", a[31:0], b[31:0], cout, sum[31:0]); 82 | end 83 | 84 | initial 85 | begin 86 | a='b10100000101000001111111111111111; b='b10100000101111111111111111100000; 87 | #10 a='b01011000111111111111111111110100; b='b11110100111101001111111111111111; 88 | #10 a='b11111111111111110000111100111101; b='b00001111000011111111111111111111; 89 | #10 a='b11011111111111111110100011001010; b='b11001111111111111111100011001010; 90 | 91 | end 92 | endmodule 93 | 94 | module tb_KSA64; 95 | wire [63:0] sum; 96 | wire cout; 97 | reg [63:0] a, b; 98 | reg cin; 99 | 100 | KSA64 ksa64(sum[63:0], cout, a[63:0], b[63:0]); 101 | 102 | initial 103 | begin 104 | $display("a|b||cout|sum"); 105 | end 106 | 107 | initial 108 | begin 109 | $monitor("%d|%d||%d|%h", a[63:0], b[63:0], cout, sum[63:0]); 110 | end 111 | 112 | initial 113 | begin 114 | a=64'd998; b=64'd128; 115 | #10 a=64'd9998; b=64'd9028; 116 | #10 a=64'hfaaaaaaafaaaaaaa; b=64'hfaaaaaaadbbbbbbb; 117 | 118 | end 119 | endmodule -------------------------------------------------------------------------------- /Kogge-Stone Adder/x: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Verilog-Adders 2 | Implementing Different Adder Structures in Verilog 3 | 4 | The Aim of this project is to describe and differentiate different types of adders in verilog and distinguish them at simulation level. 5 | All adders have been defined for **8, 16, 32 and 64 bit** addition along with test benches for each type of adder. 6 | This project implements the following adders : 7 | 8 | * Carry Lookahead Adder 9 | * Carry Ripple Adder 10 | * Carry Select Adder 11 | * Carry Skip Adder 12 | * Kogge Stone Adder 13 | * Hybrid Adder 14 | 15 | ## Carry Lookaheaed Adder 16 | 17 | ![alt text](https://upload.wikimedia.org/wikipedia/commons/thumb/0/04/4-bit_carry_lookahead_adder.svg/500px-4-bit_carry_lookahead_adder.svg.png) 18 | 4-bit Carry Lookahead Adder 19 | 20 | A carry-look ahead adder improves speed by reducing the amount of time required to determine carry bits. It can be contrasted with the simpler, but usually slower, ripple-carry adder (RCA), for which the carry bit is calculated alongside the sum bit, and each stage must wait until the previous carry bit has been calculated to begin calculating its own sum bit and carry bit. The carry-lookahead adder calculates one or more carry bits before the sum, which reduces the wait time to calculate the result of the larger-value bits of the adder. The Kogge–Stone adder (KSA) and Brent–Kung adder (BKA) are examples of this type of adder. 21 | Carry-lookahead depends on two things: 22 | * Calculating for each digit position whether that position is going to propagate a carry if one comes in from the right. 23 | * Combining these calculated values to be able to deduce quickly whether, for each group of digits, that group is going to propagate a carry that comes in from the right. 24 | 25 | ## Carry Ripple Adder 26 | 27 | ![alt text](https://www.researchgate.net/publication/283037309/figure/fig2/AS:454461651984390@1485363509931/Eight-bit-Ripple-Carry-adder.png) 28 | 8-bit Carry Ripple Adder 29 | 30 | 31 | It is possible to create a logical circuit using multiple full adders to add N-bit numbers. Each full adder inputs a Cin, which is the Cout of the previous adder. This kind of adder is called a ripple-carry adder (RCA), since each carry bit "ripples" to the next full adder. Note that the first (and only the first) full adder may be replaced by a half adder (under the assumption that Cin = 0). 32 | The layout of a ripple-carry adder is simple, which allows fast design time; however, the ripple-carry adder is relatively slow, since each full adder must wait for the carry bit to be calculated from the previous full adder. 33 | 34 | 35 | ## Carry Select Adder 36 | 37 | ![alt text](https://upload.wikimedia.org/wikipedia/en/thumb/1/10/Carry-select-adder-detailed-block.png/712px-Carry-select-adder-detailed-block.png) 38 | 4-bit Carry Select Adder 39 | 40 | 41 | The carry-select adder generally consists of two ripple carry adders and a multiplexer. Adding two n-bit numbers with a carry-select adder is done with two adders (therefore two ripple carry adders), in order to perform the calculation twice, one time with the assumption of the carry-in being zero and the other assuming it will be one. After the two results are calculated, the correct sum, as well as the correct carry-out, is then selected with the multiplexer once the correct carry-in is known 42 | 43 | 44 | ## Carry Skip Adder 45 | 46 | ![alt text](https://www.researchgate.net/profile/Sujan_Sarkar3/publication/322057640/figure/fig3/AS:631632960700450@1527604441337/8-bit-Carry-Skip-Adder.png) 47 | 4-bit Carry Skip Adder 48 | 49 | 50 | The worst case for a simple one level carry-ripple-adder occurs, when the propagate-condition is true for each digit pair. Then the carry-in ripples through the n n-bit adder and appears as the carry-out after definitive delay 51 | For each operand input bit pair the propagate-conditions using an XOR-Gate (see ). When all propagate-conditions are true, then the carry-in bit determines the carry-out bit. The n-bit-carry-skip adder consists of a n-bit-carry-ripple-chain, a n-input AND-gate and one multiplexer. Each propagate bit that is provided by the carry-ripple-chain is connected to the n-input AND-gate. The resulting bit is used as the select bit of a multiplexer that switches either the last carry-bit or the carry-in to the carry-out signal. 52 | 53 | 54 | ## Kogge Stone Adder 55 | 56 | ![alt text](https://elnndccpro.files.wordpress.com/2017/01/4bit-kogge-stone-adder.jpg) 57 | 4-bit Kogge Stone Adder 58 | 59 | 60 | Each vertical stage produces a "propagate" and a "generate" bit, as shown. The culminating generate bits (the carries) are produced in the last stage (vertically), and these bits are XOR'd with the initial propagate after the input (the red boxes) to produce the sum bits. E.g., the first (least-significant) sum bit is calculated by XORing the propagate in the farthest-right red box (a "1") with the carry-in (a "0"), producing a "1". The second bit is calculated by XORing the propagate in second box from the right (a "0") with C0 (a "0"), producing a "0". 61 | --------------------------------------------------------------------------------