Skip to content
Snippets Groups Projects
Commit e8faeb94 authored by Simon Bjurek's avatar Simon Bjurek
Browse files

work in progress, seems like feed-forward part of direct-form I is working

parent cd864c72
No related branches found
No related tags found
1 merge request!461Finalize earliest deadline scheduler
Pipeline #154753 passed
......@@ -275,6 +275,7 @@ def direct_form_I_iir(
input_op = Input()
output = Output()
# construct the feed-forward part
muls = [ConstantMultiplication(b[0], input_op, **mult_properties)]
delays = []
prev_delay = input_op
......@@ -284,10 +285,27 @@ def direct_form_I_iir(
if i < len(b) - 1:
muls.append(ConstantMultiplication(coeff, prev_delay, **mult_properties))
# mul_pairs = [(muls[i], muls[i+1]) for i in range(len(muls)-1)]
for i in range(len(muls)):
Addition(muls[i], delays[i], **add_properties)
op_a = muls[-1]
for i in range(len(muls) - 1):
op_a = Addition(op_a, muls[-i - 2], **add_properties)
# construct the feedback part
tmp_add = Addition(op_a, None, **add_properties)
muls = [ConstantMultiplication(a[0], tmp_add, **mult_properties)]
output <<= muls[0]
delays = []
prev_delay = muls[0]
for i, coeff in enumerate(a[1:]):
prev_delay = Delay(prev_delay)
delays.append(prev_delay)
if i < len(a) - 1:
muls.append(ConstantMultiplication(coeff, prev_delay, **mult_properties))
op_a = muls[-1]
for i in range(len(muls) - 1):
op_a = Addition(op_a, muls[-i - 2], **add_properties)
tmp_add.input(1).connect(op_a)
return SFG([input_op], [output], name=Name(name))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment