-
Notifications
You must be signed in to change notification settings - Fork 37
Adding vx4b support to lib_mic_array #296
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
Open
xalbertoisorna
wants to merge
18
commits into
develop
Choose a base branch
from
vx4b
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
989d6a9
Translate mic_array core assembly files to VX4
xalbertoisorna bb5d740
Add VX4 architecture support for examples
xalbertoisorna 7f3054c
Add VX4 support to Jenkins
xalbertoisorna d6f295f
Add VX4 support to tests/unit
xalbertoisorna 13d496a
Add VX4 support to tests/signal
xalbertoisorna cee5d87
Add support for single stage decimation and mic_array task in C
xalbertoisorna ee89cdd
Add support for single stage decimation. Add support for 1-mic override.
79dae8e
Document single stage decimator and 1-mic override features
5ee6528
Add 1-mic override example, app_1mic_override
61a61c1
Address review comments
shuchitak b774f16
Merge pull request #297 from shuchitak/feature/1mic_override
shuchitak 2e44763
Add delay before xscope_ep_request_upload() to fix test failures on v…
088f884
Merge pull request #300 from shuchitak/add_delay_xscope_send
shuchitak 2ec3350
Merge branch 'develop' of github.com:xmos/lib_mic_array into vx4b
xalbertoisorna 8b9b2b7
Add basic example for vx4 only
xalbertoisorna f8d4976
Mic array /api doc update
xalbertoisorna 7a90c19
Add support for vx4 tests/signal
xalbertoisorna 6c9a6c3
Update lib_unity version in CMakeLists.txt to v2.7.0
xalbertoisorna File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,3 +7,4 @@ LICENSE.rst | |
| build.xcore | ||
| tests/**/.pytest_cache/*.md | ||
| tests/.pytest_cache/*.md | ||
| **/app_mic_array_basic*/*.md | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,14 +4,13 @@ | |
| Custom decimation filters | ||
| ************************* | ||
|
|
||
| In the :cpp:class:`TwoStageDecimator <mic_array::TwoStageDecimator>`, the tap count and decimation factor | ||
| for the first stage decimator are fixed to ``256`` and ``32`` respectively, as described in :ref:`decimator_stage_1`. | ||
| The :cpp:class:`Decimator <mic_array::Decimator>` supports 1-, 2-, or 3-stage decimation pipelines configured via custom filters. | ||
| This flexibility allows applications to tailor the filter chain to their specific latency and computational requirements. | ||
|
|
||
| These parameters cannot be changed without implementing a custom decimator, which is outside the scope of this document. | ||
| Custom filters must comply with implementation requirements for each stage. See :ref:`stage_constraints_custom` | ||
| for details on stage-specific constraints. | ||
|
|
||
| However, both the first-stage and second-stage filter coefficients may be | ||
| replaced, and the second-stage decimation factor and tap count may be freely | ||
| modified by running the mic array component with custom filters. This is described in the following sections. | ||
| This document explains how to design and deploy custom decimation filters for 1-, 2-, or 3-stage configurations. | ||
|
|
||
| .. _designing_custom_filters: | ||
|
|
||
|
|
@@ -24,8 +23,8 @@ of ``lib_mic_array`` and save them as ``.pkl`` files. Using these functions as | |
| a guide, the script can be extended to generate custom filters tailored to the | ||
| application's needs. | ||
|
|
||
| Note that in :cpp:class:`TwoStageDecimator <mic_array::TwoStageDecimator>`, | ||
| both the first and second stage filters are implemented | ||
| Note that in :cpp:class:`Decimator <mic_array::Decimator>`, | ||
| the filters are implemented | ||
| using fixed-point arithmetic, which requires the coefficients to be presented | ||
| in a specific format. | ||
| The helper scripts ``python/stage1.py`` and ``python/stage2.py`` generate | ||
|
|
@@ -68,24 +67,9 @@ From the ``python`` directory, the workflow is typically: | |
| Using custom filters | ||
| ==================== | ||
|
|
||
| When using the :cpp:class:`TwoStageDecimator <mic_array::TwoStageDecimator>` provided by the | ||
| When using the :cpp:class:`Decimator <mic_array::Decimator>` provided by the | ||
| library, the :c:func:`mic_array_init_custom_filter` function is used to | ||
| initialize a mic array instance with a custom 2-stage decimation filter. | ||
|
|
||
| .. note:: | ||
|
|
||
| The custom filter provided to :c:func:`mic_array_init_custom_filter` must | ||
| be compatible with the :cpp:class:`TwoStageDecimator | ||
| <mic_array::TwoStageDecimator>` requirements. Specifically, it must be a | ||
| 2-stage filter. The tap count and decimation factor for the first-stage | ||
| decimator are fixed at ``256`` and ``32``, respectively, and the filter must | ||
| be compatible with the :ref:`stage_1_filter_impl`. | ||
|
|
||
| The second-stage decimation filter tap count and decimation ratio are flexible, | ||
| provided it is a standard FIR filter compatible with :ref:`stage_2_filter_impl`. | ||
| Using custom filters that are incompatible with the implementation in | ||
| :cpp:class:`TwoStageDecimator <mic_array::TwoStageDecimator>` is outside the | ||
| scope of this documentation. | ||
| initialize a mic array instance with a custom decimation filter. | ||
|
|
||
| The :c:type:`mic_array_conf_t` structure is populated with the decimator and | ||
| PDM RX configurations before calling | ||
|
|
@@ -178,3 +162,66 @@ and started by calling :c:func:`mic_array_start`: | |
| as including the mic array in an application, declaring resources, and overriding | ||
| build-time default configuration, are exactly the same as in the default usage | ||
| model described in :ref:`using_mic_array`. | ||
|
|
||
| .. _stage_constraints_custom: | ||
|
|
||
| Filter stage constraints | ||
| ======================== | ||
|
|
||
| **Stage 1 (mandatory)** | ||
|
|
||
| The first stage decimator has fixed constraints that cannot be changed: | ||
|
|
||
| - Tap count: ``256`` (fixed) | ||
| - Decimation factor: ``32`` (fixed) | ||
| - Implementation: Must be compatible with :c:func:`fir_1x16_bit` as described in :ref:`stage_1_filter_impl` | ||
|
|
||
| Only the filter coefficients may be customized. The coefficients must be quantized to 16-bit precision | ||
| and formatted appropriately for the VPU implementation. Use the Python helper script ``python/stage1.py`` | ||
| to convert floating-point coefficients to the required format. | ||
|
|
||
| **Stage 2 (optional)** | ||
|
|
||
| If a second stage is included, it must meet these requirements: | ||
|
|
||
| - Implementation: Must be compatible with the 32-bit FIR filter from `lib_xcore_math <https://github.com/xmos/lib_xcore_math>`_, | ||
| specifically :c:func:`xs3_filter_fir_s32()` as described in :ref:`stage_2_filter_impl` | ||
| - Tap count: Configurable (no fixed constraint) | ||
| - Decimation factor: Configurable integer value | ||
|
|
||
| Use the Python helper script ``python/stage2.py`` to convert floating-point coefficients to the required format. | ||
|
|
||
| **Stage 3 (optional)** | ||
|
|
||
| A third stage, if included, must also be compatible with the 32-bit FIR filter from `lib_xcore_math <https://github.com/xmos/lib_xcore_math>`_. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As previous comment. |
||
| It has the same flexibility as stage 2: | ||
|
|
||
| - Tap count: Configurable | ||
| - Decimation factor: Configurable integer value | ||
|
|
||
| **Single-stage decimator configuration** | ||
|
|
||
| Single-stage decimation is a special case in which additional decimation is | ||
| expected to be performed in the application. This is useful when downstream | ||
| decimation requirements are not directly represented by the integer-factor FIR | ||
| stages used by :cpp:class:`Decimator <mic_array::Decimator>` (for example, | ||
| rational-factor resampling). | ||
|
|
||
| When only stage 1 is used, the decimation factor is fixed at ``32``. If a | ||
| different final output sample rate is required, the application must perform | ||
| the remaining decimation after receiving the stage-1 output from the mic array. | ||
|
|
||
| Because further decimation is expected downstream, single-stage operation has | ||
| the following additional constraints: | ||
|
|
||
| - The DCOE filter is forcibly disabled, and | ||
| :c:macro:`MIC_ARRAY_CONFIG_USE_DC_ELIMINATION` is ignored. If required, | ||
| the application must apply DC elimination after all decimation is complete. | ||
| - The number of output words per channel from PDM RX | ||
| (:c:member:`pdm_rx_conf_t.pdm_out_words_per_channel`) must match | ||
| :c:macro:`MIC_ARRAY_CONFIG_SAMPLES_PER_FRAME`. | ||
| - :c:member:`pdm_rx_conf_t.pdm_out_words_per_channel` must not exceed | ||
| :cpp:member:`mic_array::MicArray::MAX_PDM_OUT_WORDS_PER_CHANNEL`. | ||
|
|
||
| These two conditions are checked at runtime. If either condition is violated, | ||
| the mic array initialization asserts. | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
ideally link libs to their xmos.com home (the is a link there to github repo). So in this instance https://www.xmos.com/libraries/lib_xcore_math (https://xmosjira.atlassian.net/wiki/spaces/SDTR/pages/4773380097/Documentation+Guidance#Linking-to-Other-XMOS-Libraries-or-App-Notes)