-
Notifications
You must be signed in to change notification settings - Fork 2
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
fofb_shaper_filt: add module #30
Conversation
guilhermerc
commented
Sep 20, 2023
•
edited
Loading
edited
- Shaper filters intended to equalize the open-loop response among all controllers.
b85a9f8
to
5be2152
Compare
5be2152
to
482bb38
Compare
hdl/modules/fofb_shaper_filt/cheby/wb_fofb_shaper_filt_regs.cheby
Outdated
Show resolved
Hide resolved
hdl/modules/fofb_shaper_filt/cheby/wb_fofb_shaper_filt_regs.cheby
Outdated
Show resolved
Hide resolved
fdef3ad
to
9e7fe3f
Compare
c9c5fd1
to
627e7e6
Compare
I've figured out how to expose the RAM interface instead of instantiating it internally using cheby, unfortunately the memory-map:
bus: wb-32-be
name: wb_fofb_shaper_filt_regs
description: Interface to FOFB IIR shaper filters regs
x-hdl:
busgroup: True
children:
- repeat:
name: ch
count: 12
children:
- memory:
name: coeffs
memsize: 200
interface: sram
description: |
Coefficients for the ceil('max_filt_order'/2) IIR internal
biquads.
Each biquad takes 5 coefficients: b0, b1, b2, a1 and a2 (a0 = 1).
The 'coeffs' array should be populated in the following manner:
coeffs[0 + 5*{biquad_idx}] = b0 of biquad {biquad_idx}
coeffs[1 + 5*{biquad_idx}] = b1 of biquad {biquad_idx}
coeffs[2 + 5*{biquad_idx}] = b2 of biquad {biquad_idx}
coeffs[3 + 5*{biquad_idx}] = a1 of biquad {biquad_idx}
coeffs[4 + 5*{biquad_idx}] = a2 of biquad {biquad_idx}
This array acts like a 'shadow' for the real coefficients and is
only effectivated when '1' is written to 'eff_coeffs' bit of
'ctl' register.
NOTE: This ABI supports up to 20th order filters, but only the
coefficients corresponding to the first 'max_filt_order' filters
are meaningful for the gateware.
children:
- reg:
name: val
width: 32
access: rw
description: |
Coefficient value using 'coeffs_fp_repr' fixed-point
representation. It should be aligned to the left.
- reg:
name: max_filt_order
width: 32
access: ro
description: |
Maximum filter order supported by the gateware.
- reg:
name: coeffs_fp_repr
width: 32
access: ro
description: |
Fixed-point signed representation of coefficients.
The coefficients should be aligned to the left. The fixed-point
position is then given by 32 - 'int_width' (i.e. one should divide
this register's content by 2**{32 - 'int_width'} to get the
represented decimal number.
children:
- field:
name: int_width
range: 4-0
description: |
Integer width (accounting for the signal bit).
- field:
name: frac_width
range: 9-5
description: |
Fractionary width.
- reg:
name: ctl
width: 32
access: rw
description: |
Control register.
children:
- field:
name: eff_coeffs
x-hdl:
type: autoclear
range: 0
description: |
Strobe for effectivating (i.e. updating) coefficients.
comment: |
write 0: no effect
write 1: effectivates coefficients (this bit autoclears)
|
@augustofg does the Also, does changing the interface to use RAM mean the |
@ericonr I deliver you good news, the generated ABI is exactly the same, except that |
66ab9c4
to
beefcc9
Compare
Optimizations for easing timing closure.
Instead of instantiating a "shadow" RAM for holding the coefficients, simply access'em through a RAM interface. This optmizes resource usage and might ease timing closure. NOTE: The ABI wasn't broken. The only thing that's changed is the removal of the control register (no need to effectivate the coefficients anymore).
c3e105d
to
91b303d
Compare
hdl/modules/fofb_shaper_filt/cheby/wb_fofb_shaper_filt_regs.cheby
Outdated
Show resolved
Hide resolved
hdl/modules/fofb_shaper_filt/cheby/wb_fofb_shaper_filt_regs.cheby
Outdated
Show resolved
Hide resolved
In order to reduce the logic needed to decode coefficients' addresses, align biquads' base addresses to a power of 2. NOTE: This breaks the ABI.
Even with the optimizations from the latest commits, synthesis can't close timing. By now, the two options we found that solve this issue are: 1. Reduce the number of supported channels from 12 to 8. 2. Reduce the maximum filter order from 10 to 8. We picked option 2: Although current operation doesn't require more than 8 channels, we want to keep those 4 extras as a backup for any malfuction. Also, we currently don't have a real demand for {9,10}th order filters. The testbench files changed accordingly.
Which is 2's complement.
91b303d
to
4a14de2
Compare
Instead of defining the maximum order, use a generic to define the number of internal biquads (the order is twice this value). This simplifies things since we can use it directly (i.e. no intermediate computation) for defining internal dimensions, number of iterations etc. NOTE: The ABI was broken. The register 'max_filt_order' was changed to 'num_biquads'.
4a14de2
to
403fbea
Compare
Critial assertions should have its severity set to FAILURE so synthesis/simulation breaks if it fails. The argument '--assert-level=error' to ghdl isn't needed anymore.
We used to define constants in packages for constraining dimensions of array types, which was required by VHDL standards older than 2008's. We use VHDL 2008 now, so array types can be unconstrainedly defined and these constants can be moved to the top level file.
We're evaluating NVC [1] simulator. [1] https://github.com/nickg/nvc
994918b
to
64c5bf1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍