Commit 84480ab9 authored by Rémi's avatar Rémi
Browse files

Add ASIC results

parent 69e15def
......@@ -998,6 +998,181 @@ function plot_wcpg()
end
function maxdiff(b0_init,b1_init,b2_init,a1_init,a2_init, b0, b1, b2, a1, a2)
varepsilon = 0.0
a0 = 1.0
a0_init = 1.0
x = 0.0:0.01:1.0
y1 = [abs((b0*exp(2*pi*im*val)+b1*exp(im*pi*val)+b2)/(a0*exp(2*pi*im*val)+a1*exp(im*pi*val)+a2)) for val in x];
y2 = [abs((b0_init*exp(2*pi*im*val)+b1_init*exp(im*pi*val)+b2_init)/(a0_init*exp(2*pi*im*val)+a1_init*exp(im*pi*val)+a2_init)) for val in x];
println(y1)
println(y2)
varepsilon = maximum(abs.(y1 .- y2))
return varepsilon
end
function truncate(b0_init::Float64, b1_init::Float64, b2_init::Float64,
a1_init::Float64, a2_init::Float64,
instancename::String; write_files::Bool=true)
smallestwordlength_found = false
b0_saved, b1_saved, b2_saved, a1_saved, a2_saved = 0,0,0,0,0
shiftb_saved, shifta_saved = 0,0
wordlength_saved = 0
shifta_init = 0
shiftb_init = 0
while max(abs(b0_init),abs(b1_init),abs(b2_init),abs(a1_init),abs(a2_init)) < 1/2
b0_init,b1_init,b2_init,a1_init,a2_init = (b0_init,b1_init,b2_init,a1_init,a2_init).*2
shifta_init += 1
shiftb_init += 1
end
while max(abs(b0_init),abs(b1_init),abs(b2_init)) < 1/2
b0_init,b1_init,b2_init = (b0_init,b1_init,b2_init).*2
shiftb_init += 1
end
while max(abs(a1_init),abs(a2_init)) < 1/2
a1_init,a2_init = (a1_init,a2_init).*2
shifta_init += 1
end
while max(abs(b0_init),abs(b1_init),abs(b2_init),abs(a1_init),abs(a2_init)) >= 1
b0_init,b1_init,b2_init,a1_init,a2_init = (b0_init,b1_init,b2_init,a1_init,a2_init)./2
shifta_init -= 1
shiftb_init -= 1
end
while max(abs(b0_init),abs(b1_init),abs(b2_init)) >= 1
b0_init,b1_init,b2_init = (b0_init,b1_init,b2_init)./2
shiftb_init -= 1
end
while max(abs(a1_init),abs(a2_init)) >= 1
a1_init,a2_init = (a1_init,a2_init)./2
shifta_init -= 1
end
#println("b0_init: $b0_init, b1_init: $b1_init, b2_init: $b2_init, a1_init: $a1_init, a2_init: $a2_init")
for wordlength in 4:1:10
shifta = shifta_init + wordlength-1
shiftb = shiftb_init + wordlength-1
b0 = float_to_fxp(b0_init, wordlength)
b1 = float_to_fxp(b1_init, wordlength)
b2 = float_to_fxp(b2_init, wordlength)
a1 = float_to_fxp(a1_init, wordlength)
a2 = float_to_fxp(a2_init, wordlength)
if shifta >= 0
if !is_stable(a1/(1<<shifta), a2/(1<<shifta))
continue
end
else
if !is_stable(Float64(a1*(1<<-shifta)), Float64(a2*(1<<-shifta)))
continue
end
end
if shifta >= 0
a1_eps, a2_eps = a1/(1<<shifta), a2/(1<<shifta)
else
a1_eps, a2_eps = a1*(1<<-shifta), a2*(1<<-shifta)
end
if shiftb >= 0
b0_eps, b1_eps, b2_eps = b0/(1<<shiftb), b1/(1<<shiftb), b2/(1<<shiftb)
else
b0_eps, b1_eps, b2_eps = b0*(1<<-shiftb), b1*(1<<-shiftb), b2*(1<<-shiftb)
end
if shifta_init >= 0
a1_init_eps, a2_init_eps = a1/(1<<shifta_init), a2/(1<<shifta_init)
else
a1_init_eps, a2_init_eps = a1*(1<<-shifta_init), a2*(1<<-shifta_init)
end
if shiftb_init >= 0
b0_init_eps, b1_init_eps, b2_init_eps = b0/(1<<shiftb_init), b1/(1<<shiftb_init), b2/(1<<shiftb_init)
else
b0_init_eps, b1_init_eps, b2_init_eps = b0*(1<<-shiftb_init), b1*(1<<-shiftb_init), b2*(1<<-shiftb_init)
end
varepsilon = maxdiff(b0_init_eps, b1_init_eps, b2_init_eps,a1_init_eps, a2_init_eps,b0_eps, b1_eps, b2_eps, a1_eps, a2_eps)
if !smallestwordlength_found && varepsilon < 1e-7
smallestwordlength_found = true
b0_saved, b1_saved, b2_saved, a1_saved, a2_saved = (b0, b1, b2, a1, a2)
shiftb_saved, shifta_saved = (shiftb, shifta)
wordlength_saved = wordlength
println("MCM for $instancename -- $wordlength --- varepsilon: $varepsilon")
@time begin
model = Model(CPLEX.Optimizer)
set_silent(model)
solution_b = mcm(model, [b0, b1, b2], wordlength=wordlength, use_nlp=false, ilp=1, use_big_m=true, avoid_internal_shifts = true)
model = Model(CPLEX.Optimizer)
set_silent(model)
solution_a = mcm(model, [a1, a2], wordlength=wordlength, use_nlp=false, ilp=1, use_big_m=true, avoid_internal_shifts = true)
end # @time begin
if instancename != "compilation"
write_files && write_flopoco_solution([(a1, a2), (b0, b1, b2), solution_a, solution_b], instancename, wordlength, shifta, shiftb)
write_files && write_table_epsilon("$(instancename)_dw00_cw$(wordlength < 10 ? "0" : "")$(wordlength)_truncatedshiftandadd", sum(coef != 0 ? 1 : 0 for coef in [a1, a2, b0, b1, b2])-1+length(solution_b)+length(solution_a), varepsilon, wordlength)
write_files && write_table_epsilon("$(instancename)_dw00_cw$(wordlength < 10 ? "0" : "")$(wordlength)_truncatedplain", 0, varepsilon, wordlength)
write_files && write_table_epsilon("$(instancename)_dw00_cw$(wordlength < 10 ? "0" : "")$(wordlength)_truncatedplain0dsp", 0, varepsilon, wordlength)
end
end
end
if !smallestwordlength_found
for wordlength in 11:1:32
shifta = shifta_init + wordlength-1
shiftb = shiftb_init + wordlength-1
b0 = float_to_fxp(b0_init, wordlength)
b1 = float_to_fxp(b1_init, wordlength)
b2 = float_to_fxp(b2_init, wordlength)
a1 = float_to_fxp(a1_init, wordlength)
a2 = float_to_fxp(a2_init, wordlength)
if !is_stable(a1/(1<<shifta), a2/(1<<shifta))
continue
end
if shifta >= 0
a1_eps, a2_eps = a1/(1<<shifta), a2/(1<<shifta)
else
a1_eps, a2_eps = a1*(1<<-shifta), a2*(1<<-shifta)
end
if shiftb >= 0
b0_eps, b1_eps, b2_eps = b0/(1<<shiftb), b1/(1<<shiftb), b2/(1<<shiftb)
else
b0_eps, b1_eps, b2_eps = b0*(1<<-shiftb), b1*(1<<-shiftb), b2*(1<<-shiftb)
end
if shifta_init >= 0
a1_init_eps, a2_init_eps = a1/(1<<shifta_init), a2/(1<<shifta_init)
else
a1_init_eps, a2_init_eps = a1*(1<<-shifta_init), a2*(1<<-shifta_init)
end
if shiftb_init >= 0
b0_init_eps, b1_init_eps, b2_init_eps = b0/(1<<shiftb_init), b1/(1<<shiftb_init), b2/(1<<shiftb_init)
else
b0_init_eps, b1_init_eps, b2_init_eps = b0*(1<<-shiftb_init), b1*(1<<-shiftb_init), b2*(1<<-shiftb_init)
end
varepsilon = maxdiff(b0_init_eps, b1_init_eps, b2_init_eps,a1_init_eps, a2_init_eps,b0_eps, b1_eps, b2_eps, a1_eps, a2_eps)
println("\t$instancename -- $wordlength --- varepsilon: $varepsilon")
if !smallestwordlength_found && varepsilon < 1e-7
smallestwordlength_found = true
b0_saved, b1_saved, b2_saved, a1_saved, a2_saved = (b0, b1, b2, a1, a2)
shiftb_saved, shifta_saved = (shiftb, shifta)
wordlength_saved = wordlength
if instancename != "compilation"
solution_b = rpag([b0, b1, b2])
solution_a = rpag([a1, a2])
write_files && write_flopoco_solution([(a1, a2), (b0, b1, b2), solution_a, solution_b], instancename, wordlength, shifta, shiftb)
write_files && write_table_epsilon("$(instancename)_dw00_cw$(wordlength < 10 ? "0" : "")$(wordlength)_truncatedshiftandadd", sum(coef != 0 ? 1 : 0 for coef in [a1, a2, b0, b1, b2])-1+length(solution_b)+length(solution_a), varepsilon, wordlength)
write_files && write_table_epsilon("$(instancename)_dw00_cw$(wordlength < 10 ? "0" : "")$(wordlength)_truncatedplain", 0, varepsilon, wordlength)
write_files && write_table_epsilon("$(instancename)_dw00_cw$(wordlength < 10 ? "0" : "")$(wordlength)_truncatedplain0dsp", 0, varepsilon, wordlength)
end
end
end
end
return b0_saved, b1_saved, b2_saved, a1_saved, a2_saved, shiftb_saved, shifta_saved, wordlength_saved
end
function truncate_hp0()
verbose = true
......@@ -1059,6 +1234,24 @@ function truncate_hp0()
end
function truncate_hp0()
verbose = true
instancename = "hp0"
write_table_epsilon("$(instancename)_dw00_cw00_fixiir", 0, 0.0, 0)
b0, b1, b2 = 101.8, -203.4, 101.6
a1, a2 = -1.967, 0.968
write_flopoco_solution(b0, b1, b2, a1, a2, instancename)
b0,b1,b2,a1,a2,shiftb,shifta,wordlength = truncate(b0,b1,b2,a1,a2,instancename, write_files=true)
verbose && println("wordlength: $(wordlength)")
verbose && println("coefficients_b: $(b0), $(b1), $(b2)")
verbose && println("coefficients_a: $(a1), $(a2)")
verbose && println("shiftb: $shiftb")
verbose && println("shifta: $shifta")
#verbose && println("eps: $(varepsilon)")
end
function main()
......
This source diff could not be displayed because it is too large. You can view the blob instead.
flopoco FixIIR lsbIn=-16 lsbOut=-16 guardBits=-1 coeffb="0x3fedf6f34360bf43:0xbffdf6f34360bf43:0x3fedf6f34360bf43" coeffa="0xbffe68209a777626:0x3fecfe7849300552" outputFile=hp0_dw16_cw00_fixiir.vhd
flopoco FixIIR lsbIn=-12 lsbOut=-12 guardBits=-1 coeffb="0x3fedf6f34360bf43:0xbffdf6f34360bf43:0x3fedf6f34360bf43" coeffa="0xbffe68209a777626:0x3fecfe7849300552" outputFile=hp0_dw12_cw00_fixiir.vhd
flopoco FixIIR lsbIn=-8 lsbOut=-8 guardBits=-1 coeffb="0x3fedf6f34360bf43:0xbffdf6f34360bf43:0x3fedf6f34360bf43" coeffa="0xbffe68209a777626:0x3fecfe7849300552" outputFile=hp0_dw08_cw00_fixiir.vhd
flopoco FixIIR lsbIn=-16 lsbOut=-16 guardBits=-1 coeffb="0x3fd713df11810bb7:0x3fe32826f05611ca:0x3fd713df11810bb7" coeffa="0x3fbee0aad976cc5d:0x3fd6228d4db93927" outputFile=lp4_dw16_cw00_fixiir.vhd
flopoco FixIIR lsbIn=-12 lsbOut=-12 guardBits=-1 coeffb="0x3fd713df11810bb7:0x3fe32826f05611ca:0x3fd713df11810bb7" coeffa="0x3fbee0aad976cc5d:0x3fd6228d4db93927" outputFile=lp4_dw12_cw00_fixiir.vhd
flopoco FixIIR lsbIn=-8 lsbOut=-8 guardBits=-1 coeffb="0x3fd713df11810bb7:0x3fe32826f05611ca:0x3fd713df11810bb7" coeffa="0x3fbee0aad976cc5d:0x3fd6228d4db93927" outputFile=lp4_dw08_cw00_fixiir.vhd
flopoco FixIIR lsbIn=-16 lsbOut=-16 guardBits=-1 coeffb="0x3fca334c2df947b5:0x3fc8cbe9ab6479e7:0x3fca334c2df947b5" coeffa="0xbfe7c88f69e58411:0x3fda744a9efb62a7" outputFile=lp1x0_dw16_cw00_fixiir.vhd
flopoco FixIIR lsbIn=-12 lsbOut=-12 guardBits=-1 coeffb="0x3fca334c2df947b5:0x3fc8cbe9ab6479e7:0x3fca334c2df947b5" coeffa="0xbfe7c88f69e58411:0x3fda744a9efb62a7" outputFile=lp1x0_dw12_cw00_fixiir.vhd
flopoco FixIIR lsbIn=-8 lsbOut=-8 guardBits=-1 coeffb="0x3fca334c2df947b5:0x3fc8cbe9ab6479e7:0x3fca334c2df947b5" coeffa="0xbfe7c88f69e58411:0x3fda744a9efb62a7" outputFile=lp1x0_dw08_cw00_fixiir.vhd
flopoco FixIIR lsbIn=-16 lsbOut=-16 guardBits=-1 coeffb="0x3fca008441ca9136:0x3fcbb7c7de30f49f:0x3fca008441ca9136" coeffa="0xbfe6c7aa185b9b8a:0x3fd95cf68291c524" outputFile=lp1x1_dw16_cw00_fixiir.vhd
flopoco FixIIR lsbIn=-12 lsbOut=-12 guardBits=-1 coeffb="0x3fca008441ca9136:0x3fcbb7c7de30f49f:0x3fca008441ca9136" coeffa="0xbfe6c7aa185b9b8a:0x3fd95cf68291c524" outputFile=lp1x1_dw12_cw00_fixiir.vhd
flopoco FixIIR lsbIn=-8 lsbOut=-8 guardBits=-1 coeffb="0x3fca008441ca9136:0x3fcbb7c7de30f49f:0x3fca008441ca9136" coeffa="0xbfe6c7aa185b9b8a:0x3fd95cf68291c524" outputFile=lp1x1_dw08_cw00_fixiir.vhd
flopoco FixIIR lsbIn=-16 lsbOut=-16 guardBits=-1 coeffb="0x3fc9eb84ac7fa8a6:0x3fcecb77652acaef:0x3fc9eb84ac7fa8a6" coeffa="0xbfe5a7d3410f6385:0x3fd838a9b1d17d55" outputFile=lp1x2_dw16_cw00_fixiir.vhd
flopoco FixIIR lsbIn=-12 lsbOut=-12 guardBits=-1 coeffb="0x3fc9eb84ac7fa8a6:0x3fcecb77652acaef:0x3fc9eb84ac7fa8a6" coeffa="0xbfe5a7d3410f6385:0x3fd838a9b1d17d55" outputFile=lp1x2_dw12_cw00_fixiir.vhd
flopoco FixIIR lsbIn=-8 lsbOut=-8 guardBits=-1 coeffb="0x3fc9eb84ac7fa8a6:0x3fcecb77652acaef:0x3fc9eb84ac7fa8a6" coeffa="0xbfe5a7d3410f6385:0x3fd838a9b1d17d55" outputFile=lp1x2_dw08_cw00_fixiir.vhd
flopoco FixIIR lsbIn=-16 lsbOut=-16 guardBits=-1 coeffb="0x3fc9fbf805887d61:0x3fd10a41a15def2b:0x3fc9fbf805887d61" coeffa="0xbfe460bb361e42c7:0x3fd704b72ab5aa74" outputFile=lp1x3_dw16_cw00_fixiir.vhd
flopoco FixIIR lsbIn=-12 lsbOut=-12 guardBits=-1 coeffb="0x3fc9fbf805887d61:0x3fd10a41a15def2b:0x3fc9fbf805887d61" coeffa="0xbfe460bb361e42c7:0x3fd704b72ab5aa74" outputFile=lp1x3_dw12_cw00_fixiir.vhd
flopoco FixIIR lsbIn=-8 lsbOut=-8 guardBits=-1 coeffb="0x3fc9fbf805887d61:0x3fd10a41a15def2b:0x3fc9fbf805887d61" coeffa="0xbfe460bb361e42c7:0x3fd704b72ab5aa74" outputFile=lp1x3_dw08_cw00_fixiir.vhd
flopoco FixIIR lsbIn=-16 lsbOut=-16 guardBits=-1 coeffb="0x3fca3d37103fd7c1:0x3fd2d3a6daf6bf21:0x3fca3d37103fd7c1" coeffa="0xbfe2e632b9caea25:0x3fd5bda8af2c7fb4" outputFile=lp1x4_dw16_cw00_fixiir.vhd
flopoco FixIIR lsbIn=-12 lsbOut=-12 guardBits=-1 coeffb="0x3fca3d37103fd7c1:0x3fd2d3a6daf6bf21:0x3fca3d37103fd7c1" coeffa="0xbfe2e632b9caea25:0x3fd5bda8af2c7fb4" outputFile=lp1x4_dw12_cw00_fixiir.vhd
flopoco FixIIR lsbIn=-8 lsbOut=-8 guardBits=-1 coeffb="0x3fca3d37103fd7c1:0x3fd2d3a6daf6bf21:0x3fca3d37103fd7c1" coeffa="0xbfe2e632b9caea25:0x3fd5bda8af2c7fb4" outputFile=lp1x4_dw08_cw00_fixiir.vhd
flopoco FixIIR lsbIn=-16 lsbOut=-16 guardBits=-1 coeffb="0x3fca334c2df947b5:0x3fc8cbe9ab6479e7:0x3fca334c2df947b5" coeffa="0xbfe7c88f69e58411:0x3fda744a9efb62a7" outputFile=lp2x0_dw16_cw00_fixiir.vhd
flopoco FixIIR lsbIn=-12 lsbOut=-12 guardBits=-1 coeffb="0x3fca334c2df947b5:0x3fc8cbe9ab6479e7:0x3fca334c2df947b5" coeffa="0xbfe7c88f69e58411:0x3fda744a9efb62a7" outputFile=lp2x0_dw12_cw00_fixiir.vhd
flopoco FixIIR lsbIn=-8 lsbOut=-8 guardBits=-1 coeffb="0x3fca334c2df947b5:0x3fc8cbe9ab6479e7:0x3fca334c2df947b5" coeffa="0xbfe7c88f69e58411:0x3fda744a9efb62a7" outputFile=lp2x0_dw08_cw00_fixiir.vhd
flopoco FixIIR lsbIn=-16 lsbOut=-16 guardBits=-1 coeffb="0x3fca334c2df947b5:0x3fc8cbe9ab6479e7:0x3fca334c2df947b5" coeffa="0xbfe7c88f69e58411:0x3fda744a9efb62a7" outputFile=lp2x1_dw16_cw00_fixiir.vhd
flopoco FixIIR lsbIn=-12 lsbOut=-12 guardBits=-1 coeffb="0x3fca334c2df947b5:0x3fc8cbe9ab6479e7:0x3fca334c2df947b5" coeffa="0xbfe7c88f69e58411:0x3fda744a9efb62a7" outputFile=lp2x1_dw12_cw00_fixiir.vhd
flopoco FixIIR lsbIn=-8 lsbOut=-8 guardBits=-1 coeffb="0x3fca334c2df947b5:0x3fc8cbe9ab6479e7:0x3fca334c2df947b5" coeffa="0xbfe7c88f69e58411:0x3fda744a9efb62a7" outputFile=lp2x1_dw08_cw00_fixiir.vhd
flopoco FixIIR lsbIn=-16 lsbOut=-16 guardBits=-1 coeffb="0x3fca334c2df947b5:0x3fc8cbe9ab6479e7:0x3fca334c2df947b5" coeffa="0xbfe7c88f69e58411:0x3fda744a9efb62a7" outputFile=lp2x2_dw16_cw00_fixiir.vhd
flopoco FixIIR lsbIn=-12 lsbOut=-12 guardBits=-1 coeffb="0x3fca334c2df947b5:0x3fc8cbe9ab6479e7:0x3fca334c2df947b5" coeffa="0xbfe7c88f69e58411:0x3fda744a9efb62a7" outputFile=lp2x2_dw12_cw00_fixiir.vhd
flopoco FixIIR lsbIn=-8 lsbOut=-8 guardBits=-1 coeffb="0x3fca334c2df947b5:0x3fc8cbe9ab6479e7:0x3fca334c2df947b5" coeffa="0xbfe7c88f69e58411:0x3fda744a9efb62a7" outputFile=lp2x2_dw08_cw00_fixiir.vhd
flopoco FixIIR lsbIn=-16 lsbOut=-16 guardBits=-1 coeffb="0x3fca334c2df947b5:0x3fc8cbe9ab6479e7:0x3fca334c2df947b5" coeffa="0xbfe7c88f69e58411:0x3fda744a9efb62a7" outputFile=lp3x0_dw16_cw00_fixiir.vhd
flopoco FixIIR lsbIn=-12 lsbOut=-12 guardBits=-1 coeffb="0x3fca334c2df947b5:0x3fc8cbe9ab6479e7:0x3fca334c2df947b5" coeffa="0xbfe7c88f69e58411:0x3fda744a9efb62a7" outputFile=lp3x0_dw12_cw00_fixiir.vhd
flopoco FixIIR lsbIn=-8 lsbOut=-8 guardBits=-1 coeffb="0x3fca334c2df947b5:0x3fc8cbe9ab6479e7:0x3fca334c2df947b5" coeffa="0xbfe7c88f69e58411:0x3fda744a9efb62a7" outputFile=lp3x0_dw08_cw00_fixiir.vhd
flopoco FixIIR lsbIn=-16 lsbOut=-16 guardBits=-1 coeffb="0x3fceb225a2cfabff:0x3fd28702af12dcb3:0x3fceb225a2cfabff" coeffa="0xbfe0bf8511b58ac4:0x3fd8305361f502c1" outputFile=lp3x1_dw16_cw00_fixiir.vhd
flopoco FixIIR lsbIn=-12 lsbOut=-12 guardBits=-1 coeffb="0x3fceb225a2cfabff:0x3fd28702af12dcb3:0x3fceb225a2cfabff" coeffa="0xbfe0bf8511b58ac4:0x3fd8305361f502c1" outputFile=lp3x1_dw12_cw00_fixiir.vhd
flopoco FixIIR lsbIn=-8 lsbOut=-8 guardBits=-1 coeffb="0x3fceb225a2cfabff:0x3fd28702af12dcb3:0x3fceb225a2cfabff" coeffa="0xbfe0bf8511b58ac4:0x3fd8305361f502c1" outputFile=lp3x1_dw08_cw00_fixiir.vhd
flopoco FixIIR lsbIn=-16 lsbOut=-16 guardBits=-1 coeffb="0x3fd1c6097a9173d4:0x3fd8e9ffc1572149:0x3fd1c6097a9173d4" coeffa="0xbfd393720f61be23:0x3fd6c14df69400f8" outputFile=lp3x2_dw16_cw00_fixiir.vhd
flopoco FixIIR lsbIn=-12 lsbOut=-12 guardBits=-1 coeffb="0x3fd1c6097a9173d4:0x3fd8e9ffc1572149:0x3fd1c6097a9173d4" coeffa="0xbfd393720f61be23:0x3fd6c14df69400f8" outputFile=lp3x2_dw12_cw00_fixiir.vhd
flopoco FixIIR lsbIn=-8 lsbOut=-8 guardBits=-1 coeffb="0x3fd1c6097a9173d4:0x3fd8e9ffc1572149:0x3fd1c6097a9173d4" coeffa="0xbfd393720f61be23:0x3fd6c14df69400f8" outputFile=lp3x2_dw08_cw00_fixiir.vhd
This diff is collapsed.
using JuMP, jIIR2AG, CPLEX
function generate_passband(Fc, Fs, N)
f1 = Fc/(2^(1/6))
f2 = Fc*(2^(1/6))
Qr = Fc/(f2-f1)
Qd = Qr*(pi/(2*N))/sin(pi/(2*N))
alpha = (1+sqrt(1+4*Qd^2))/(2*Qd)
W1 = 2*Fc/(Fs*alpha)
W2 = 2*Fc*alpha/Fs
return (W1, W2)
end
function generate_passband(Fc, Fs, N)
W1 = 2*(Fc/sqrt(2))/Fs
W2 = 2*(Fc*sqrt(2))/Fs
return (W1, W2)
end
function generate_specifications(Fc, Fs, N)
specifications = Vector{Tuple{Float64, Float64, Float64}}()
w1, w2 = generate_passband(Fc, Fs, N)
println("w1: $w1 -- w2: $w2")
dbatten = 10^(-3/20)
onepercent = (w2-w1)/100
for i in 0.0:onepercent:(w1-onepercent)
push!(specifications, (i, 0.0, dbatten))
end
for i in (w1+onepercent):onepercent:(w2-onepercent)
push!(specifications, (i, dbatten, 1.0))
end
for i in (w2+onepercent):onepercent:1.0
push!(specifications, (i, 0.0, dbatten))
end
push!(specifications, (1.0, 0.0, dbatten))
println(length(specifications))
return specifications
end
wordlength = 6
model = Model(CPLEX.Optimizer)
verbose = true
design_second_order_iir(model, generate_specifications(1000, 44100, 2), wordlength, avoid_internal_shifts=true, use_big_m=true, presolve_time_sec=600, verbose=verbose)
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Design,area,power,timing
lp1x0_dw16_cw04_shiftandadd,204.291,32.96,917
lp1x0_dw16_cw10_truncatedplain,542.967,172.901,1354
lp1x0_dw16_cw10_truncatedshiftandadd,449.998,131.741,1434
lp1x1_dw16_cw04_shiftandadd,204.291,32.96,917
lp1x1_dw16_cw16_truncatedplain,706.245,233.497,1327
lp1x1_dw16_cw16_truncatedshiftandadd,616.007,188.452,1367
lp1x2_dw16_cw04_shiftandadd,214.64,36.28,932
lp1x2_dw16_cw06_truncatedplain,343.054,79.888,1097
lp1x2_dw16_cw06_truncatedshiftandadd,314.68,69.332,1093
lp1x3_dw16_cw04_shiftandadd,248.501,44.575,923
lp1x3_dw16_cw10_truncatedplain,421.638,118.626,1127
lp1x3_dw16_cw10_truncatedshiftandadd,391.065,112.814,1099
lp1x4_dw16_cw05_shiftandadd,281.7,56.43,1015
lp1x4_dw16_cw09_truncatedplain,492.646,147.941,1228
lp1x4_dw16_cw09_truncatedshiftandadd,395.159,117.521,1346
lp1x5_dw16_cw05_shiftandadd,281.7,56.43,1015
lp2x0_dw16_cw04_shiftandadd,204.291,32.96,917
lp2x0_dw16_cw10_truncatedplain,542.967,172.901,1354
lp2x0_dw16_cw10_truncatedshiftandadd,449.998,131.741,1434
lp2x1_dw16_cw04_shiftandadd,204.291,32.96,917
lp2x1_dw16_cw10_truncatedplain,542.967,172.901,1354
lp2x1_dw16_cw10_truncatedshiftandadd,449.998,131.741,1434
lp2x2_dw16_cw04_shiftandadd,260.876,54.001,1099
lp2x2_dw16_cw10_truncatedplain,542.967,172.901,1354
lp2x2_dw16_cw10_truncatedshiftandadd,449.998,131.741,1434
lp2x3_dw16_cw06_shiftandadd,295.146,64.961,1049
lp3x0_dw16_cw04_shiftandadd,204.291,32.96,917
lp3x0_dw16_cw10_truncatedplain,542.967,172.901,1354
lp3x0_dw16_cw10_truncatedshiftandadd,449.998,131.741,1434
lp3x1_dw16_cw04_shiftandadd,227.89,43.868,926
lp3x1_dw16_cw04_truncatedplain,227.554,43.653,925
lp3x1_dw16_cw04_truncatedshiftandadd,223.943,43.029,940
lp3x2_dw16_cw04_shiftandadd,247.484,52.683,1015
lp3x2_dw16_cw23_truncatedplain,908.237,347.851,1941
lp3x2_dw16_cw23_truncatedshiftandadd,822.967,271.889,2072
lp3x3_dw16_cw05_shiftandadd,262.364,51.528,974
lp4_dw16_cw04_shiftandadd,205.83,30.818,856
lp4_dw16_cw04_truncatedplain,264.436,55.358,982
lp4_dw16_cw04_truncatedshiftandadd,247.328,50.823,1028
hp0_dw16_cw06_shiftandadd,133.076,17.983,790
hp0_dw16_cw11_truncatedplain,552.6,174.589,1373
hp0_dw16_cw11_truncatedshiftandadd,477.703,145.209,1374
function main()
filename = "asic_results.csv"
lines = Vector{String}()
open(filename, "r") do f
lines = readlines(f)
end
area_shiftandadd = Vector{Float64}()
area_truncatedshiftandadd = Vector{Float64}()
area_truncatedplain = Vector{Float64}()
power_shiftandadd = Vector{Float64}()
power_truncatedshiftandadd = Vector{Float64}()
power_truncatedplain = Vector{Float64}()
delay_shiftandadd = Vector{Float64}()
delay_truncatedshiftandadd = Vector{Float64}()
delay_truncatedplain = Vector{Float64}()
for line in lines[2:end]
area, power, delay = parse.(Float64, split(line, ",")[2:4])
if occursin("_shiftandadd", line)
push!(area_shiftandadd, area)
push!(power_shiftandadd, power)
push!(delay_shiftandadd, delay)
end
if occursin("_truncatedshiftandadd", line)
push!(area_truncatedshiftandadd, area)
push!(power_truncatedshiftandadd, power)
push!(delay_truncatedshiftandadd, delay)
end
if occursin("_truncatedplain", line)
push!(area_truncatedplain, area)
push!(power_truncatedplain, power)
push!(delay_truncatedplain, delay)
end
end
all_positions = Vector{String}([
"1",
"1+1*\\xtickspaces",
"1+2*\\xtickspaces",
"1+3*\\xtickspaces",
"1+4*\\xtickspaces",
"1+5*\\xtickspaces",
"1+6*\\xtickspaces+1*\\xtickblockspaces",
"1+7*\\xtickspaces+1*\\xtickblockspaces",
"1+8*\\xtickspaces+1*\\xtickblockspaces",
"1+9*\\xtickspaces+1*\\xtickblockspaces",
"1+10*\\xtickspaces+2*\\xtickblockspaces",
"1+11*\\xtickspaces+2*\\xtickblockspaces",
"1+12*\\xtickspaces+2*\\xtickblockspaces",
"1+13*\\xtickspaces+2*\\xtickblockspaces",
"1+14*\\xtickspaces+3*\\xtickblockspaces",
"1+15*\\xtickspaces+4*\\xtickblockspaces"
])
all_positions_truncated = Vector{String}([
"1",
"1+1*\\xtickspaces",
"1+2*\\xtickspaces",
"1+3*\\xtickspaces",
"1+4*\\xtickspaces",
"1+6*\\xtickspaces+1*\\xtickblockspaces",
"1+7*\\xtickspaces+1*\\xtickblockspaces",
"1+8*\\xtickspaces+1*\\xtickblockspaces",
"1+10*\\xtickspaces+2*\\xtickblockspaces",
"1+11*\\xtickspaces+2*\\xtickblockspaces",
"1+12*\\xtickspaces+2*\\xtickblockspaces",
"1+14*\\xtickspaces+3*\\xtickblockspaces",
"1+15*\\xtickspaces+4*\\xtickblockspaces"
])
area_string_shiftandadd = "{"
area_string_truncatedshiftandadd = "{"
area_string_truncatedplain = "{"
power_string_shiftandadd = "{"
power_string_truncatedshiftandadd = "{"
power_string_truncatedplain = "{"
delay_string_shiftandadd = "{"
delay_string_truncatedshiftandadd = "{"
delay_string_truncatedplain = "{"
for i in 1:length(all_positions)
area_string_shiftandadd *= "($(all_positions[i]), $(area_shiftandadd[i]))"
power_string_shiftandadd *= "($(all_positions[i]), $(power_shiftandadd[i]))"
delay_string_shiftandadd *= "($(all_positions[i]), $(delay_shiftandadd[i]))"
end
for i in 1:length(all_positions_truncated)
area_string_truncatedshiftandadd *= "($(all_positions_truncated[i]), $(area_truncatedshiftandadd[i]))"
power_string_truncatedshiftandadd *= "($(all_positions_truncated[i]), $(power_truncatedshiftandadd[i]))"
delay_string_truncatedshiftandadd *= "($(all_positions_truncated[i]), $(delay_truncatedshiftandadd[i]))"
area_string_truncatedplain *= "($(all_positions_truncated[i]), $(area_truncatedplain[i]))"
power_string_truncatedplain *= "($(all_positions_truncated[i]), $(power_truncatedplain[i]))"
delay_string_truncatedplain *= "($(all_positions_truncated[i]), $(delay_truncatedplain[i]))"
end
area_string_shiftandadd *= "};"
area_string_truncatedshiftandadd *= "};"
area_string_truncatedplain *= "};"
power_string_shiftandadd *= "};"
power_string_truncatedshiftandadd *= "};"
power_string_truncatedplain *= "};"
delay_string_shiftandadd *= "};"
delay_string_truncatedshiftandadd *= "};"
delay_string_truncatedplain *= "};"
println(area_string_shiftandadd)
println(area_string_truncatedshiftandadd)
println(area_string_truncatedplain)
println(power_string_shiftandadd)
println(power_string_truncatedshiftandadd)
println(power_string_truncatedplain)
println(delay_string_shiftandadd)
println(delay_string_truncatedshiftandadd)
println(delay_string_truncatedplain)
return nothing
end
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment