Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xwb_fofb_shaper_filt.vhd: fix wrong internal sizes #36

Merged
merged 1 commit into from
May 17, 2024

Conversation

guilhermerc
Copy link
Contributor

@guilhermerc guilhermerc commented May 17, 2024

Although the ABI supports up to 10 biquads, internal signals were sized to hold g_NUM_BIQUADS coefficients only. This can lead to wrong register accesses depending on the dimensions. So, proper size these signals to avoid this.

Copy link
Member

@ericonr ericonr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From what I can understand of VHDL, this makes sense to me

Although the ABI supports up to 10 biquads, internal signals were sized
to hold g_NUM_BIQUADS coefficients only. This can lead to wrong register
accesses depending on the dimensions. So, proper size these signals to
avoid this.
@augustofg
Copy link
Member

👍

@guilhermerc guilhermerc merged commit 4ee6a32 into devel May 17, 2024
1 check passed
ericonr added a commit to lnls-dig/uhal that referenced this pull request May 17, 2024
The static assertion for the amount of coefficients was written to make
sure the sizeof expressions were correct, but it also works as a check
for if the ABI ever changes.

The discrepancy in the amount of coefficients for Core and Controller is
intentional: for Core, we have only the actually relevant coefficients;
for Controller, we support the highest amount, so library clients don't
need to implement logic based on num_biquads. However, we can loop only
through the valid coefficients in both cases, for a slight optimization.

When actually writing to hardware, only the valid coefficients can be
written: both the 3 unused coefficients and the unused biquads must be
skipped. This was a bug noticed during development of the library, and
might be fixed in the future [1].

[1] lnls-dig/fofb-ctrl-gw#36
@guilhermerc guilhermerc deleted the fix-shaper-filt-regs branch May 17, 2024 19:46
ericonr added a commit to lnls-dig/uhal that referenced this pull request May 17, 2024
The static assertion for the amount of coefficients was written to make
sure the sizeof expressions were correct, but it also works as a check
for if the ABI ever changes.

The discrepancy in the amount of coefficients for Core and Controller is
intentional: for Core, we have only the actually relevant coefficients;
for Controller, we support the highest amount, so library clients don't
need to implement logic based on num_biquads. However, we can loop only
through the valid coefficients in both cases, for a slight optimization.

When actually writing to hardware, only the valid coefficients can be
written: both the 3 unused coefficients and the unused biquads must be
skipped. This was a bug noticed during development of the library, and
might be fixed in the future [1].

[1] lnls-dig/fofb-ctrl-gw#36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants