Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
689fb7a
Adding VX4 Support
xalbertoisorna Feb 11, 2026
9eb3a5c
Fix library version format in Jenkinsfile
xalbertoisorna Feb 11, 2026
9e2b650
Add steps block to 'Test VX4' stage in Jenkinsfile
xalbertoisorna Feb 11, 2026
4bf09c4
Update Jenkinsfile to use the latest shared library version
xalbertoisorna Feb 11, 2026
efad027
Refactor 'Test VX4' stage to improve structure and add SCM checkout
xalbertoisorna Feb 11, 2026
1c937c0
Update 'Test VX4' stage to use correct tools version for unit tests
xalbertoisorna Feb 11, 2026
cb3a105
Update dependent module version in lib_build_info.cmake to use 'devel…
xalbertoisorna Feb 11, 2026
6a01bca
Add cleanup step to 'Test' stage for sandbox environment
xalbertoisorna Feb 11, 2026
5dbab52
Update Jenkinsfile to revert library version and restructure 'Test VX…
xalbertoisorna Feb 12, 2026
f0eff4f
removing module build info
xalbertoisorna Feb 12, 2026
cf21f70
Merge branch 'delete/xcommon' into vx4
xalbertoisorna Feb 12, 2026
a73950d
Add VX4 Tests stage and correct XS3 Tests casing in Jenkinsfile
xalbertoisorna Feb 12, 2026
6ee68b2
Implement VX4 support in deinterleave4 and update test configurations
xalbertoisorna Feb 12, 2026
512bfb8
Refactor deinterleave4 assembly code to use indexed load/store instru…
xalbertoisorna Feb 13, 2026
a1873ab
Fix VX4 compatibility in deinterleave2 and deinterleave4 assembly cod…
xalbertoisorna Feb 13, 2026
cd8b3da
Fix indentation in 'Run tests' stage and ensure proper directory cont…
xalbertoisorna Feb 13, 2026
614f61c
Fix VX4 compiler flags configuration in CMakeLists.txt
xalbertoisorna Feb 13, 2026
3f80782
adding basic example
xalbertoisorna Feb 13, 2026
a034b20
Add FIR 1x16-bit implementation and corresponding unit tests
xalbertoisorna Feb 13, 2026
28be345
Enhance FIR 1x16-bit implementation for VX4 compatibility and add uni…
xalbertoisorna Feb 16, 2026
0dda494
Remove shift_buffer test case from fir_1x16_bit test group
xalbertoisorna Feb 16, 2026
f5cec64
Refactor architecture-specific assembly code for VX4 compatibility an…
xalbertoisorna Feb 16, 2026
566d3a4
Remove unnecessary preprocessor directive for XS3A in PdmRx.hpp
xalbertoisorna Feb 16, 2026
b72bb69
Refactor CLEAR_KEDI function to a macro for XS3A architecture compati…
xalbertoisorna Feb 16, 2026
54d2362
Fix inline assembly instruction for VX4 architecture in mic_array_inp…
xalbertoisorna Feb 16, 2026
855a426
Add copyright notice and license terms to test_fir_1x16_bit.c
xalbertoisorna Feb 16, 2026
583bb9e
Uncomment test groups in main.c to enable all unit tests
xalbertoisorna Feb 16, 2026
ee9634c
Update copyright notices and add new configuration file for app_mic_a…
xalbertoisorna Feb 16, 2026
5ef4dd8
Refactor app_mic_array_basic example: replace README.rst with README.…
xalbertoisorna Feb 17, 2026
bb0694b
Add output.wav to .gitignore to prevent tracking of generated audio f…
xalbertoisorna Feb 17, 2026
75df892
Update .gitignore and enhance app_mic_array_basic: add mic_array_outp…
xalbertoisorna Feb 17, 2026
ea1931a
Update VX4 Tests agent label to use 'vx4' for improved environment sp…
xalbertoisorna Feb 18, 2026
a9f10ec
Add copyright notice and license terms to app_config.h
xalbertoisorna Feb 18, 2026
b6b37b1
Replacing BasicMicArray Test XC with C code
xalbertoisorna Feb 20, 2026
a06f275
Merge branch 'develop' of github.com:xmos/lib_mic_array into vx4
xalbertoisorna Feb 20, 2026
2b382d5
Merge branch 'feature/replace-xc' into vx4
xalbertoisorna Feb 20, 2026
bfd5918
adding mic array ports
xalbertoisorna Feb 20, 2026
e3c3f9a
Enhance Jenkins pipeline and add app_config.h for BasicMicArray tests
xalbertoisorna Feb 20, 2026
d145c63
Define CLEAR_KEDI as a no-op for non-XS3A architectures
xalbertoisorna Feb 20, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,5 @@ build.xcore

# Python cache information
lib_mic_array.egg-info
examples/app_mic_array_basic/output.wav
examples/app_mic_array_basic/mic_array_output.bin
54 changes: 43 additions & 11 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,13 @@ pipeline {
string(
name: 'XMOSDOC_VERSION',
defaultValue: 'v8.0.1',
description: 'The xmosdoc version')

description: 'The xmosdoc version'
)
string(
name: 'TOOLS_VX4_VERSION',
defaultValue: '-j --repo arch_vx_slipgate -b master -a XTC 112',
description: 'The XTC Slipgate tools version'
)
string(
name: 'INFR_APPS_VERSION',
defaultValue: 'v3.3.0',
Expand Down Expand Up @@ -139,10 +144,8 @@ pipeline {

stage('Tests') {
parallel {
stage('XS3 tests') {
agent {
label 'xcore.ai'
}
stage('XS3 Tests') {
agent {label 'xcore.ai'}
stages {
stage("Checkout and Build") {
steps {
Expand Down Expand Up @@ -209,11 +212,40 @@ pipeline {
} // stage('Run tests')
} // stages
post {
cleanup {
xcoreCleanSandbox()
}
}
} // stage('HW tests')
cleanup {xcoreCleanSandbox()}
} // post
} // XS3 Tests

stage('VX4 Tests') {
agent {label "vx4"}
stages {
stage("Checkout and Build") {
steps {
dir(REPO_NAME){
checkoutScmShallow()
dir("tests/unit") {
xcoreBuild(buildTool: "xmake", toolsVersion: params.TOOLS_VX4_VERSION)
}
dir ("tests/signal/BasicMicArray") {
createVenv(reqFile: "requirements.txt")
withVenv {
xcoreBuild(buildTool: "xmake", toolsVersion: params.TOOLS_VX4_VERSION)
}
}
}}
} // stage("Checkout and Build")
stage('Run tests') {
steps {
dir(REPO_NAME){
dir("tests/unit") {
withTools(params.TOOLS_VX4_VERSION) {sh "xrun --xscope bin/tests-unit.xe"}
}}}} // stage('Run tests')
} // stages
post {
cleanup {xcoreCleanSandbox()}
} //post
} // VX4 Tests

} // parallel
} // stage('Tests')

Expand Down
1 change: 1 addition & 0 deletions doc/exclude_patterns.inc
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ LICENSE.rst
build.xcore
tests/**/.pytest_cache/*.md
tests/.pytest_cache/*.md
**/app_mic_array_basic/*.md
1 change: 1 addition & 0 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ cmake_minimum_required(VERSION 3.21)
include($ENV{XMOS_CMAKE_PATH}/xcommon.cmake)
project(mic_array_examples)
add_subdirectory(app_mic_array)
add_subdirectory(app_mic_array_basic)
add_subdirectory(app_shutdown)
add_subdirectory(app_par_decimator)
add_subdirectory(app_custom_filter)
24 changes: 24 additions & 0 deletions examples/app_mic_array_basic/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
cmake_minimum_required(VERSION 3.21)
include($ENV{XMOS_CMAKE_PATH}/xcommon.cmake)
project(app_mic_array)

set(XMOS_SANDBOX_DIR ${CMAKE_CURRENT_LIST_DIR}/../../..)

set(APP_HW_TARGET src/XK-EVK-XU316-AIV.xn)
set(APP_DEPENDENT_MODULES "lib_mic_array")
set(APP_INCLUDES src)

set(APP_COMPILER_FLAGS
-Os
-g
-report
-Wall
-fxscope
-Wno-xcore-fptrgroup
# Mic array config
-DMIC_ARRAY_CONFIG_SAMPLES_PER_FRAME=320
-DMIC_ARRAY_CONFIG_MIC_COUNT=1
-DMIC_ARRAY_CONFIG_USE_PDM_ISR=1
)

XMOS_REGISTER_APP()
30 changes: 30 additions & 0 deletions examples/app_mic_array_basic/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Basic Mic Array Example

## Hardware Required

- **XK-EVK-XU316-AIV.XN**

## Compile

```sh
cmake -G "Unix Makefiles" -B build
xmake -C build
```

## Run

```sh
xrun --xscope bin/app_mic_array.xe
```

## Convert Binary Data to WAV

```sh
python convert.py
```

**Output:**

```
Converted mic_array_output.bin to output.wav with 1 channels, 16000 Hz sample rate, and 32 bits per sample.
```
28 changes: 28 additions & 0 deletions examples/app_mic_array_basic/convert.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Copyright 2026 XMOS LIMITED.
# This Software is subject to the terms of the XMOS Public Licence: Version 1.

import numpy as np
import wave
import soundfile as sf

APP_OUT_FREQ_HZ = 12000 # 4KHz

def convert_to_wav(
input_file, output_file, num_channels=1, sample_rate=16000, bits_per_sample=32
):
with open(input_file, "rb") as inp_f:
data = inp_f.read()
data = np.frombuffer(data, dtype=np.int32)

sf.write(output_file, data, sample_rate, subtype='PCM_32')
print(f"Converted {input_file} to {output_file} with {num_channels} channels, {sample_rate} Hz sample rate, and {bits_per_sample} bits per sample.")


if __name__ == "__main__":
convert_to_wav(
input_file="mic_array_output.bin",
output_file="output.wav",
num_channels=1,
sample_rate=APP_OUT_FREQ_HZ,
bits_per_sample=32
)
Binary file not shown.
Binary file added examples/app_mic_array_basic/output.wav
Binary file not shown.
66 changes: 66 additions & 0 deletions examples/app_mic_array_basic/src/XK-EVK-XU316-AIV.xn
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<?xml version="1.0" encoding="UTF-8"?>
<Network xmlns="http://www.xmos.com"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.xmos.com http://www.xmos.com">
<Type>Board</Type>
<Name>xcore.ai Vision Development Kit</Name>

<Declarations>
<Declaration>tileref tile[2]</Declaration>
</Declarations>

<Packages>
<Package id="0" Type="XS3-UnA-1024-TQ128">
<Nodes>
<Node Id="0" InPackageId="0" Type="XS3-L16A-1024" Oscillator="24MHz" SystemFrequency="600MHz" ReferenceFrequency="100MHz">
<Boot>
<Source Location="bootFlash"/>
</Boot>
<Tile Number="0" Reference="tile[0]">
<Port Location="XS1_PORT_1B" Name="PORT_SQI_CS"/>
<Port Location="XS1_PORT_1C" Name="PORT_SQI_SCLK"/>
<Port Location="XS1_PORT_4B" Name="PORT_SQI_SIO"/>
</Tile>
<Tile Number="1" Reference="tile[1]">
<Port Location="XS1_PORT_1C" Name="PORT_UART_TX"/>
<Port Location="XS1_PORT_1H" Name="PORT_BUTTON"/>
<Port Location="XS1_PORT_1L" Name="PORT_MIC_CLK"/>
<Port Location="XS1_PORT_1J" Name="PORT_MIC_DATA"/>
<Port Location="XS1_PORT_4E" Name="PORT_I2C"/> <!-- SDA: bit 0, SCL: bit 1 -->
<Port Location="XS1_PORT_32A" Name="PORT_LED"/>
</Tile>
</Node>
</Nodes>
</Package>
</Packages>

<!-- XTAG4 -->
<Nodes>
<Node Id="1" Type="device:" RoutingId="0x8000">
<Service Id="0" Proto="xscope_host_data(chanend c);">
<Chanend Identifier="c" end="3"/>
</Service>
</Node>
</Nodes>

<!-- XSCOPE LINK -->
<Links>
<Link Encoding="2wire" Delays="5clk" Flags="XSCOPE">
<LinkEndpoint NodeId="0" Link="XL1"/>
<LinkEndpoint NodeId="1" Chanend="1"/>
</Link>
</Links>

<ExternalDevices>
<Device NodeId="0" Tile="0" Class="SQIFlash" Name="bootFlash" Type="W25Q64JV" PageSize="256" SectorSize="4096" NumPages="32768">
<Attribute Name="PORT_SQI_CS" Value="PORT_SQI_CS"/>
<Attribute Name="PORT_SQI_SCLK" Value="PORT_SQI_SCLK"/>
<Attribute Name="PORT_SQI_SIO" Value="PORT_SQI_SIO"/>
</Device>
</ExternalDevices>

<JTAGChain>
<JTAGDevice NodeId="0"/>
</JTAGChain>

</Network>
117 changes: 117 additions & 0 deletions examples/app_mic_array_basic/src/app.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
// Copyright 2026 XMOS LIMITED.
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>

#include <platform.h>
#include <xcore/chanend.h>
#include <xcore/channel.h>
#include <xcore/parallel.h>

#include "mic_array.h"
#include "device_pll_ctrl.h"
#include "small_768k_to_12k_filter.h"

#include "app_config.h"

#define APP_FILENAME ("mic_array_output.bin")

DECLARE_JOB(user_mic, (chanend_t));
DECLARE_JOB(user_audio, (chanend_t));

static pdm_rx_resources_t pdm_res = PDM_RX_RESOURCES_SDR(
MIC_ARRAY_CONFIG_PORT_MCLK,
MIC_ARRAY_CONFIG_PORT_PDM_CLK,
MIC_ARRAY_CONFIG_PORT_PDM_DATA,
MIC_ARRAY_CONFIG_MCLK_FREQ,
MIC_ARRAY_CONFIG_PDM_FREQ,
MIC_ARRAY_CONFIG_CLOCK_BLOCK_A);



void init_mic_conf(mic_array_conf_t *mic_array_conf, mic_array_filter_conf_t filter_conf[2], unsigned *channel_map)
{
static int32_t stg1_filter_state[APP_MIC_COUNT][8];
static int32_t stg2_filter_state[APP_MIC_COUNT][SMALL_768K_TO_12K_FILTER_STG2_TAP_COUNT];
memset(mic_array_conf, 0, sizeof(mic_array_conf_t));

//decimator
mic_array_conf->decimator_conf.filter_conf = &filter_conf[0];
mic_array_conf->decimator_conf.num_filter_stages = 2;
// filter stage 1
filter_conf[0].coef = (int32_t*)small_768k_to_12k_filter_stg1_coef;
filter_conf[0].num_taps = SMALL_768K_TO_12K_FILTER_STG1_TAP_COUNT;
filter_conf[0].decimation_factor = SMALL_768K_TO_12K_FILTER_STG1_DECIMATION_FACTOR;
filter_conf[0].state = (int32_t*)stg1_filter_state;
filter_conf[0].shr = SMALL_768K_TO_12K_FILTER_STG1_SHR;
filter_conf[0].state_words_per_channel = filter_conf[0].num_taps/32; // works on 1-bit samples
// filter stage 2
filter_conf[1].coef = (int32_t*)small_768k_to_12k_filter_stg2_coef;
filter_conf[1].num_taps = SMALL_768K_TO_12K_FILTER_STG2_TAP_COUNT;
filter_conf[1].decimation_factor = SMALL_768K_TO_12K_FILTER_STG2_DECIMATION_FACTOR;
filter_conf[1].state = (int32_t*)stg2_filter_state;
filter_conf[1].shr = SMALL_768K_TO_12K_FILTER_STG2_SHR;
filter_conf[1].state_words_per_channel = SMALL_768K_TO_12K_FILTER_STG2_TAP_COUNT;

// pdm rx
static uint32_t pdmrx_out_block[APP_MIC_COUNT][SMALL_768K_TO_12K_FILTER_STG2_DECIMATION_FACTOR];
static uint32_t pdmrx_out_block_double_buf[2][APP_MIC_COUNT * SMALL_768K_TO_12K_FILTER_STG2_DECIMATION_FACTOR] __attribute__((aligned(8)));
mic_array_conf->pdmrx_conf.pdm_out_words_per_channel = SMALL_768K_TO_12K_FILTER_STG2_DECIMATION_FACTOR;
mic_array_conf->pdmrx_conf.pdm_out_block = (uint32_t*)pdmrx_out_block;
mic_array_conf->pdmrx_conf.pdm_in_double_buf = (uint32_t*)pdmrx_out_block_double_buf;
mic_array_conf->pdmrx_conf.channel_map = channel_map;
}

void user_mic(chanend_t c_mic_audio)
{
printf("Mic Init\n");
device_pll_init();
unsigned channel_map[1] = {0};
mic_array_conf_t mic_array_conf;
mic_array_filter_conf_t filter_conf[2];
init_mic_conf(&mic_array_conf, filter_conf, channel_map);
mic_array_init_custom_filter(&pdm_res, &mic_array_conf);
mic_array_start(c_mic_audio);
}

void user_audio(chanend_t c_mic_audio)
{
int32_t WORD_ALIGNED tmp_buff[APP_BUFF_SIZE] = {0};
int32_t *buff_ptr = &tmp_buff[0];
unsigned frame_counter = APP_N_FRAMES;
while (frame_counter--)
{
ma_frame_rx(buff_ptr, (chanend_t)c_mic_audio, MIC_ARRAY_CONFIG_MIC_COUNT, APP_N_SAMPLES);
buff_ptr += APP_N_SAMPLES;
for (unsigned i = 0; i < APP_N_SAMPLES; i++)
{
tmp_buff[i] <<= 6;
}
}

// write samples to a binary file
printf("Writing output to %s\n", APP_FILENAME);
FILE *f = fopen(APP_FILENAME, "wb");
assert(f != NULL);
fwrite(tmp_buff, sizeof(int32_t), APP_BUFF_SIZE, f);
fclose(f);
ma_shutdown(c_mic_audio);
printf("Done\n");
}

void main_tile_1(){
channel_t c_mic_audio = chan_alloc();
// Parallel Jobs
PAR_JOBS(
PJOB(user_mic, (c_mic_audio.end_a)),
PJOB(user_audio, (c_mic_audio.end_b))
);
chan_free(c_mic_audio);
}

void main_tile_0(){
// intentionally left empty
return;
}
20 changes: 20 additions & 0 deletions examples/app_mic_array_basic/src/app_config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Copyright 2026 XMOS LIMITED.
// This Software is subject to the terms of the XMOS Public Licence: Version 1.

#pragma once

// -------------------- Frecuency and Port definitions --------------------
#define MIC_ARRAY_CONFIG_MCLK_FREQ (24576000) /* 24 MHz */
#define MIC_ARRAY_CONFIG_PDM_FREQ (768000) /* 768 KHz */
#define MIC_ARRAY_CONFIG_PORT_MCLK XS1_PORT_1D /* X0D11, J14 - Pin 15, '11' */
#define MIC_ARRAY_CONFIG_PORT_PDM_CLK PORT_MIC_CLK /* X0D00, J14 - Pin 2, '00' */
#define MIC_ARRAY_CONFIG_PORT_PDM_DATA PORT_MIC_DATA /* X0D14..X0D21 | J14 - Pin 3,5,12,14 and Pin 6,7,10,11 */
#define MIC_ARRAY_CONFIG_CLOCK_BLOCK_A XS1_CLKBLK_2

// ------------------------- App Definitions -----------------------------------
#define APP_N_SAMPLES (320)
#define APP_OUT_FREQ_HZ (12000) // 12KHz
#define APP_SAMPLE_SECONDS (2)
#define APP_N_FRAMES (APP_OUT_FREQ_HZ * APP_SAMPLE_SECONDS / APP_N_SAMPLES)
#define APP_BUFF_SIZE (APP_N_FRAMES * APP_N_SAMPLES)
#define APP_MIC_COUNT (MIC_ARRAY_CONFIG_MIC_COUNT)
Loading