the code present in ForSyDe.Shallow.Utility.FIR does not implement a simple FIR as expected. If we follow the agreed definition for FIR's with m taps and coefficients h, where h(0) is the least shifted or delayed tap and h(m) is the most shifted or delayed tap,
y(k) = \sum_{i = 0,...,m} h(i)*x(k - i)
one would expect the following definitions for coefficients and signals,
coef = vector [1.0, 0.5]
s = signal [1.0, 0.5, 1.0, 0.5]
y = firSY coef s
to result in {1.0, 1.0, 1.25, 1.0} by the mathematical definition. However, our result is reproducibly {0.0,0.5,1.25,1.0,1.25}.
The right result is easy to be checked by hand, but can also be checked out in other famous digital design aware environments like Matlab,
D = tf([1 0.5], [1 0], 1)
s = [1 0.5 1 0.5]
[y, t] = lsim(D, s)
that gives us y = [1;1;1.25;1], as expected.
The culprit in this case seems to be the fact that all signals are delayed between the unzip and zip constructors, whereas the definition requires the very first piece of the signal to flow without any delays. The evidence for this is the 0.0 at the beginning of the simulated signal which should never happen.
the code present in
ForSyDe.Shallow.Utility.FIR
does not implement a simple FIR as expected. If we follow the agreed definition for FIR's withm
taps and coefficientsh
, whereh(0)
is the least shifted or delayed tap andh(m)
is the most shifted or delayed tap,one would expect the following definitions for coefficients and signals,
to result in
{1.0, 1.0, 1.25, 1.0}
by the mathematical definition. However, our result is reproducibly{0.0,0.5,1.25,1.0,1.25}
. The right result is easy to be checked by hand, but can also be checked out in other famous digital design aware environments like Matlab,that gives us
y = [1;1;1.25;1]
, as expected.The culprit in this case seems to be the fact that all signals are delayed between the
unzip
andzip
constructors, whereas the definition requires the very first piece of the signal to flow without any delays. The evidence for this is the0.0
at the beginning of the simulated signal which should never happen.