[Benchmark] Add micro benchmark 8-bit adder synthesized by Quicklogic script

This commit is contained in:
tangxifan 2021-02-01 12:05:04 -07:00
parent b215b868c1
commit 7f0f7a1c70
3 changed files with 204 additions and 0 deletions

View File

@ -0,0 +1,39 @@
# Generated by Yosys 0.9+2406 (git sha1 e6ff764e, clang 12.0.0 -fPIC -Os)
.model adder_8
.inputs a[0] a[1] a[2] a[3] a[4] a[5] a[6] a[7] b[0] b[1] b[2] b[3] b[4] b[5] b[6] b[7] cin
.outputs cout sum[0] sum[1] sum[2] sum[3] sum[4] sum[5] sum[6] sum[7]
.names $false
.names $true
1
.names $undef
.subckt adder_lut4 in[3]=$false in[2]=sum_frac_lut4_lut4_out_lut2_out_carry_follower_a_cout[7] in[1]=$false in[0]=$false lut2_out[1]=cout_frac_lut4_lut4_out_lut2_out[1] lut2_out[0]=cout_frac_lut4_lut4_out_lut2_out[0] lut4_out=cout
.param LUT 0110100101100001
.subckt adder_lut4 in[3]=$false in[2]=sum_frac_lut4_lut4_out_lut2_out_carry_follower_a_cout[6] in[1]=a[7] in[0]=b[7] lut2_out[1]=sum_frac_lut4_lut4_out_lut2_out[1] lut2_out[0]=sum_frac_lut4_lut4_out_lut2_out[0] lut4_out=sum[7]
.param LUT 0110100101100001
.subckt adder_lut4 in[3]=$false in[2]=sum_frac_lut4_lut4_out_lut2_out_carry_follower_a_cout[5] in[1]=a[6] in[0]=b[6] lut2_out[1]=sum_frac_lut4_lut4_out_1_lut2_out[1] lut2_out[0]=sum_frac_lut4_lut4_out_1_lut2_out[0] lut4_out=sum[6]
.param LUT 0110100101100001
.subckt carry_follower a=sum_frac_lut4_lut4_out_1_lut2_out[1] b=sum_frac_lut4_lut4_out_lut2_out_carry_follower_a_cout[5] cin=sum_frac_lut4_lut4_out_1_lut2_out[0] cout=sum_frac_lut4_lut4_out_lut2_out_carry_follower_a_cout[6]
.subckt adder_lut4 in[3]=$false in[2]=sum_frac_lut4_lut4_out_lut2_out_carry_follower_a_cout[4] in[1]=a[5] in[0]=b[5] lut2_out[1]=sum_frac_lut4_lut4_out_2_lut2_out[1] lut2_out[0]=sum_frac_lut4_lut4_out_2_lut2_out[0] lut4_out=sum[5]
.param LUT 0110100101100001
.subckt carry_follower a=sum_frac_lut4_lut4_out_2_lut2_out[1] b=sum_frac_lut4_lut4_out_lut2_out_carry_follower_a_cout[4] cin=sum_frac_lut4_lut4_out_2_lut2_out[0] cout=sum_frac_lut4_lut4_out_lut2_out_carry_follower_a_cout[5]
.subckt adder_lut4 in[3]=$false in[2]=sum_frac_lut4_lut4_out_lut2_out_carry_follower_a_cout[3] in[1]=a[4] in[0]=b[4] lut2_out[1]=sum_frac_lut4_lut4_out_3_lut2_out[1] lut2_out[0]=sum_frac_lut4_lut4_out_3_lut2_out[0] lut4_out=sum[4]
.param LUT 0110100101100001
.subckt carry_follower a=sum_frac_lut4_lut4_out_3_lut2_out[1] b=sum_frac_lut4_lut4_out_lut2_out_carry_follower_a_cout[3] cin=sum_frac_lut4_lut4_out_3_lut2_out[0] cout=sum_frac_lut4_lut4_out_lut2_out_carry_follower_a_cout[4]
.subckt adder_lut4 in[3]=$false in[2]=sum_frac_lut4_lut4_out_lut2_out_carry_follower_a_cout[2] in[1]=a[3] in[0]=b[3] lut2_out[1]=sum_frac_lut4_lut4_out_4_lut2_out[1] lut2_out[0]=sum_frac_lut4_lut4_out_4_lut2_out[0] lut4_out=sum[3]
.param LUT 0110100101100001
.subckt carry_follower a=sum_frac_lut4_lut4_out_4_lut2_out[1] b=sum_frac_lut4_lut4_out_lut2_out_carry_follower_a_cout[2] cin=sum_frac_lut4_lut4_out_4_lut2_out[0] cout=sum_frac_lut4_lut4_out_lut2_out_carry_follower_a_cout[3]
.subckt adder_lut4 in[3]=$false in[2]=sum_frac_lut4_lut4_out_lut2_out_carry_follower_a_cout[1] in[1]=a[2] in[0]=b[2] lut2_out[1]=sum_frac_lut4_lut4_out_5_lut2_out[1] lut2_out[0]=sum_frac_lut4_lut4_out_5_lut2_out[0] lut4_out=sum[2]
.param LUT 0110100101100001
.subckt carry_follower a=sum_frac_lut4_lut4_out_5_lut2_out[1] b=sum_frac_lut4_lut4_out_lut2_out_carry_follower_a_cout[1] cin=sum_frac_lut4_lut4_out_5_lut2_out[0] cout=sum_frac_lut4_lut4_out_lut2_out_carry_follower_a_cout[2]
.subckt adder_lut4 in[3]=$false in[2]=sum_frac_lut4_lut4_out_lut2_out_carry_follower_a_cout[0] in[1]=a[1] in[0]=b[1] lut2_out[1]=sum_frac_lut4_lut4_out_6_lut2_out[1] lut2_out[0]=sum_frac_lut4_lut4_out_6_lut2_out[0] lut4_out=sum[1]
.param LUT 0110100101100001
.subckt carry_follower a=sum_frac_lut4_lut4_out_6_lut2_out[1] b=sum_frac_lut4_lut4_out_lut2_out_carry_follower_a_cout[0] cin=sum_frac_lut4_lut4_out_6_lut2_out[0] cout=sum_frac_lut4_lut4_out_lut2_out_carry_follower_a_cout[1]
.subckt adder_lut4 in[3]=$false in[2]=sum_frac_lut4_lut4_out_7_in in[1]=a[0] in[0]=b[0] lut2_out[1]=sum_frac_lut4_lut4_out_7_lut2_out[1] lut2_out[0]=sum_frac_lut4_lut4_out_7_lut2_out[0] lut4_out=sum[0]
.param LUT 0110100101100001
.subckt carry_follower a=sum_frac_lut4_lut4_out_7_lut2_out[1] cin=sum_frac_lut4_lut4_out_7_lut2_out[0] cout=sum_frac_lut4_lut4_out_7_in
.subckt adder_lut4 in[3]=$undef in[2]=$undef in[1]=cin in[0]=$undef lut2_out[1]=sum_frac_lut4_lut4_out_7_lut2_out[1] lut2_out[0]=sum_frac_lut4_lut4_out_7_lut2_out[0]
.param LUT 1100000000000011
.subckt carry_follower a=sum_frac_lut4_lut4_out_lut2_out[1] b=sum_frac_lut4_lut4_out_lut2_out_carry_follower_a_cout[6] cin=sum_frac_lut4_lut4_out_lut2_out[0] cout=sum_frac_lut4_lut4_out_lut2_out_carry_follower_a_cout[7]
.subckt carry_follower a=sum_frac_lut4_lut4_out_7_lut2_out[1] b=sum_frac_lut4_lut4_out_7_in cin=sum_frac_lut4_lut4_out_7_lut2_out[0] cout=sum_frac_lut4_lut4_out_lut2_out_carry_follower_a_cout[0]
.end

View File

@ -0,0 +1,21 @@
// Creating a scaleable adder
module adder_8(cout, sum, a, b, cin);
parameter size = 8; /* declare a parameter. default required */
output cout;
output [size-1:0] sum; // sum uses the size parameter
input cin;
input [size-1:0] a, b; // 'a' and 'b' use the size parameter
assign {cout, sum} = a + b + cin;
endmodule

View File

@ -0,0 +1,144 @@
/* Generated by Yosys 0.9+2406 (git sha1 e6ff764e, clang 12.0.0 -fPIC -Os) */
module adder_8(cout, sum, a, b, cin);
input [7:0] a;
input [7:0] b;
input cin;
output cout;
wire [0:1] cout_frac_lut4_lut4_out_lut2_out;
output [7:0] sum;
wire [0:1] sum_frac_lut4_lut4_out_1_lut2_out;
wire [0:1] sum_frac_lut4_lut4_out_2_lut2_out;
wire [0:1] sum_frac_lut4_lut4_out_3_lut2_out;
wire [0:1] sum_frac_lut4_lut4_out_4_lut2_out;
wire [0:1] sum_frac_lut4_lut4_out_5_lut2_out;
wire [0:1] sum_frac_lut4_lut4_out_6_lut2_out;
wire sum_frac_lut4_lut4_out_7_in;
wire [0:1] sum_frac_lut4_lut4_out_7_lut2_out;
wire [0:1] sum_frac_lut4_lut4_out_lut2_out;
wire [8:0] sum_frac_lut4_lut4_out_lut2_out_carry_follower_a_cout;
frac_lut4 #(
.LUT(16'b0110100101100001)
) cout_frac_lut4_lut4_out (
.in({ 2'b00, sum_frac_lut4_lut4_out_lut2_out_carry_follower_a_cout[7], 1'b0 }),
.lut2_out(cout_frac_lut4_lut4_out_lut2_out),
.lut4_out(cout)
);
frac_lut4 #(
.LUT(16'b0110100101100001)
) sum_frac_lut4_lut4_out (
.in({ b[7], a[7], sum_frac_lut4_lut4_out_lut2_out_carry_follower_a_cout[6], 1'b0 }),
.lut2_out(sum_frac_lut4_lut4_out_lut2_out),
.lut4_out(sum[7])
);
frac_lut4 #(
.LUT(16'b0110100101100001)
) sum_frac_lut4_lut4_out_1 (
.in({ b[6], a[6], sum_frac_lut4_lut4_out_lut2_out_carry_follower_a_cout[5], 1'b0 }),
.lut2_out(sum_frac_lut4_lut4_out_1_lut2_out),
.lut4_out(sum[6])
);
carry_follower sum_frac_lut4_lut4_out_1_lut2_out_carry_follower_a (
.a(sum_frac_lut4_lut4_out_1_lut2_out[1]),
.b(sum_frac_lut4_lut4_out_lut2_out_carry_follower_a_cout[5]),
.cin(sum_frac_lut4_lut4_out_1_lut2_out[0]),
.cout(sum_frac_lut4_lut4_out_lut2_out_carry_follower_a_cout[6])
);
frac_lut4 #(
.LUT(16'b0110100101100001)
) sum_frac_lut4_lut4_out_2 (
.in({ b[5], a[5], sum_frac_lut4_lut4_out_lut2_out_carry_follower_a_cout[4], 1'b0 }),
.lut2_out(sum_frac_lut4_lut4_out_2_lut2_out),
.lut4_out(sum[5])
);
carry_follower sum_frac_lut4_lut4_out_2_lut2_out_carry_follower_a (
.a(sum_frac_lut4_lut4_out_2_lut2_out[1]),
.b(sum_frac_lut4_lut4_out_lut2_out_carry_follower_a_cout[4]),
.cin(sum_frac_lut4_lut4_out_2_lut2_out[0]),
.cout(sum_frac_lut4_lut4_out_lut2_out_carry_follower_a_cout[5])
);
frac_lut4 #(
.LUT(16'b0110100101100001)
) sum_frac_lut4_lut4_out_3 (
.in({ b[4], a[4], sum_frac_lut4_lut4_out_lut2_out_carry_follower_a_cout[3], 1'b0 }),
.lut2_out(sum_frac_lut4_lut4_out_3_lut2_out),
.lut4_out(sum[4])
);
carry_follower sum_frac_lut4_lut4_out_3_lut2_out_carry_follower_a (
.a(sum_frac_lut4_lut4_out_3_lut2_out[1]),
.b(sum_frac_lut4_lut4_out_lut2_out_carry_follower_a_cout[3]),
.cin(sum_frac_lut4_lut4_out_3_lut2_out[0]),
.cout(sum_frac_lut4_lut4_out_lut2_out_carry_follower_a_cout[4])
);
frac_lut4 #(
.LUT(16'b0110100101100001)
) sum_frac_lut4_lut4_out_4 (
.in({ b[3], a[3], sum_frac_lut4_lut4_out_lut2_out_carry_follower_a_cout[2], 1'b0 }),
.lut2_out(sum_frac_lut4_lut4_out_4_lut2_out),
.lut4_out(sum[3])
);
carry_follower sum_frac_lut4_lut4_out_4_lut2_out_carry_follower_a (
.a(sum_frac_lut4_lut4_out_4_lut2_out[1]),
.b(sum_frac_lut4_lut4_out_lut2_out_carry_follower_a_cout[2]),
.cin(sum_frac_lut4_lut4_out_4_lut2_out[0]),
.cout(sum_frac_lut4_lut4_out_lut2_out_carry_follower_a_cout[3])
);
frac_lut4 #(
.LUT(16'b0110100101100001)
) sum_frac_lut4_lut4_out_5 (
.in({ b[2], a[2], sum_frac_lut4_lut4_out_lut2_out_carry_follower_a_cout[1], 1'b0 }),
.lut2_out(sum_frac_lut4_lut4_out_5_lut2_out),
.lut4_out(sum[2])
);
carry_follower sum_frac_lut4_lut4_out_5_lut2_out_carry_follower_a (
.a(sum_frac_lut4_lut4_out_5_lut2_out[1]),
.b(sum_frac_lut4_lut4_out_lut2_out_carry_follower_a_cout[1]),
.cin(sum_frac_lut4_lut4_out_5_lut2_out[0]),
.cout(sum_frac_lut4_lut4_out_lut2_out_carry_follower_a_cout[2])
);
frac_lut4 #(
.LUT(16'b0110100101100001)
) sum_frac_lut4_lut4_out_6 (
.in({ b[1], a[1], sum_frac_lut4_lut4_out_lut2_out_carry_follower_a_cout[0], 1'b0 }),
.lut2_out(sum_frac_lut4_lut4_out_6_lut2_out),
.lut4_out(sum[1])
);
carry_follower sum_frac_lut4_lut4_out_6_lut2_out_carry_follower_a (
.a(sum_frac_lut4_lut4_out_6_lut2_out[1]),
.b(sum_frac_lut4_lut4_out_lut2_out_carry_follower_a_cout[0]),
.cin(sum_frac_lut4_lut4_out_6_lut2_out[0]),
.cout(sum_frac_lut4_lut4_out_lut2_out_carry_follower_a_cout[1])
);
frac_lut4 #(
.LUT(16'b0110100101100001)
) sum_frac_lut4_lut4_out_7 (
.in({ b[0], a[0], sum_frac_lut4_lut4_out_7_in, 1'b0 }),
.lut2_out(sum_frac_lut4_lut4_out_7_lut2_out),
.lut4_out(sum[0])
);
carry_follower sum_frac_lut4_lut4_out_7_in_carry_follower_cout (
.a(sum_frac_lut4_lut4_out_7_lut2_out[1]),
.b(),
.cin(sum_frac_lut4_lut4_out_7_lut2_out[0]),
.cout(sum_frac_lut4_lut4_out_7_in)
);
frac_lut4 #(
.LUT(16'b1100000000000011)
) sum_frac_lut4_lut4_out_7_lut2_out_frac_lut4_lut2_out (
.in({ 1'bx, cin, 2'bxx }),
.lut2_out(sum_frac_lut4_lut4_out_7_lut2_out),
.lut4_out()
);
carry_follower sum_frac_lut4_lut4_out_lut2_out_carry_follower_a (
.a(sum_frac_lut4_lut4_out_lut2_out[1]),
.b(sum_frac_lut4_lut4_out_lut2_out_carry_follower_a_cout[6]),
.cin(sum_frac_lut4_lut4_out_lut2_out[0]),
.cout(sum_frac_lut4_lut4_out_lut2_out_carry_follower_a_cout[7])
);
carry_follower sum_frac_lut4_lut4_out_lut2_out_carry_follower_a_cout_carry_follower_cout (
.a(sum_frac_lut4_lut4_out_7_lut2_out[1]),
.b(sum_frac_lut4_lut4_out_7_in),
.cin(sum_frac_lut4_lut4_out_7_lut2_out[0]),
.cout(sum_frac_lut4_lut4_out_lut2_out_carry_follower_a_cout[0])
);
endmodule