Commit ea9f10db authored by Rémi's avatar Rémi
Browse files

Update with new DesignSolution name (Iir2AdderGraphs)

parent 300d0574
......@@ -655,7 +655,7 @@ function WCPG(a::Vector{Float64}, b::Vector{Float64}, solution=nothing)::Float64
return W[1]
end
function WCPG(solution::DesignSolution)::Float64
function WCPG(solution::Iir2AdderGraphs)::Float64
return WCPG(collect(solution.coefficients_a)./(2^solution.shifts[1]), collect(solution.coefficients_b)./(2^solution.shifts[2]),
(solution.coefficients_a, solution.coefficients_b, solution.shifts[1], solution.shifts[2]))
end
......@@ -680,7 +680,7 @@ function WCPG_eps(a::Vector{Float64}, b::Vector{Float64}, solution=nothing)::Flo
return W[1]
end
function WCPG_eps(solution::DesignSolution)::Float64
function WCPG_eps(solution::Iir2AdderGraphs)::Float64
return WCPG_eps(collect(solution.coefficients_a)./(2^solution.shifts[1]), collect(solution.coefficients_b)./(2^solution.shifts[2]),
(solution.coefficients_a, solution.coefficients_b, solution.shifts[1], solution.shifts[2]))
end
......
......@@ -17,7 +17,7 @@ function initialize_files()
end
################################################################################
function write_flopoco_solution_plain(solution::DesignSolution, instance::String, wordlength::Int, wcpg_val::Union{Float64, Int}, wcpg_eps_val::Union{Float64, Int})
function write_flopoco_solution_plain(solution::Iir2AdderGraphs, instance::String, wordlength::Int, wcpg_val::Union{Float64, Int}, wcpg_eps_val::Union{Float64, Int})
open(flopococalls_base_name*"_plain.txt", "a") do io
for lsbin in -16:4:-8
write(io, "flopoco FixIIRShiftAdd msbIn=-1 lsbIn=$(lsbin) lsbOut=$(lsbin) ")
......@@ -36,7 +36,7 @@ function write_flopoco_solution_plain(solution::DesignSolution, instance::String
return nothing
end
function write_flopoco_solution_shiftandadd(solution::DesignSolution, instance::String, wordlength::Int, wcpg_val::Union{Float64, Int}, wcpg_eps_val::Union{Float64, Int})
function write_flopoco_solution_shiftandadd(solution::Iir2AdderGraphs, instance::String, wordlength::Int, wcpg_val::Union{Float64, Int}, wcpg_eps_val::Union{Float64, Int})
open(flopococalls_base_name*"_shiftandadd.txt", "a") do io
for lsbin in -16:4:-8
write(io, "flopoco FixIIRShiftAdd msbIn=-1 lsbIn=$(lsbin) lsbOut=$(lsbin) ")
......@@ -57,7 +57,7 @@ function write_flopoco_solution_shiftandadd(solution::DesignSolution, instance::
return nothing
end
function write_flopoco_solution(solution::DesignSolution, instance::String, wordlength::Int, wcpg_val::Union{Float64, Int}, wcpg_eps_val::Union{Float64, Int})
function write_flopoco_solution(solution::Iir2AdderGraphs, instance::String, wordlength::Int, wcpg_val::Union{Float64, Int}, wcpg_eps_val::Union{Float64, Int})
write_flopoco_solution_plain(solution, instance, wordlength, wcpg_val, wcpg_eps_val)
write_flopoco_solution_shiftandadd(solution, instance, wordlength, wcpg_val, wcpg_eps_val)
return nothing
......
......@@ -21,7 +21,7 @@ function using_matlab()
if @mget(nb_sections) != 1
println("No second order IIR filter using $design_method ($match_exactly) for $instancename")
return DesignSolution()
return Iir2AdderGraphs()
end
eval_string("coef = coefs_str(1,:);")
......@@ -73,7 +73,7 @@ function using_matlab()
set_silent(model)
solution_a = mcm(model, [a1_truncated, a2_truncated], wordlength=wordlength, use_nlp=false, ilp=1, use_big_m=true, avoid_internal_shifts = true)
return DesignSolution((a1_truncated, a2_truncated), (b0_truncated, b1_truncated, b2_truncated), (shifta, shiftb), solution_a, solution_b)
return Iir2AdderGraphs((a1_truncated, a2_truncated), (b0_truncated, b1_truncated, b2_truncated), (shifta, shiftb), solution_a, solution_b)
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