Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 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
0456a52
Deprecating Xcommon Support
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
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
5 changes: 5 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
lib_mic_array change log
========================

UNRELEASED
----------

* DEPRECATED: Removed XCommon support.

6.0.0
-----

Expand Down
124 changes: 62 additions & 62 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// This file relates to internal XMOS infrastructure and should be ignored by external users

@Library('xmos_jenkins_shared_library@v0.44.0') _
@Library('xmos_jenkins_shared_library@v0.45.0') _

getApproval()
pipeline {
Expand All @@ -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 @@ -116,56 +121,31 @@ pipeline {
} // parallel
} // stage 'Build'

stage('Test') {
parallel {
stage('XCommon build ') {
agent {
label "x86_64 && linux"
}
steps {
println "Stage running on ${env.NODE_NAME}"
dir(REPO_NAME){
checkoutScmShallow()
dir("tests") {
withTools(params.TOOLS_VERSION) {
sh 'cmake -B build -G "Unix Makefiles"'
// Note no -C build so builds the xcommon Makefile
sh "xmake all -j 16"
}
archiveArtifacts artifacts: "**/*.xe", allowEmptyArchive: true
}
}
}
post {
cleanup {
xcoreCleanSandbox()
}
} //post
} // stage('XCommon build')
stage('Custom CMake build') {
agent {
label "x86_64 && linux"
}
steps {
sh "git clone git@github.com:xmos/xmos_cmake_toolchain.git --branch v1.0.0"
dir(REPO_NAME) {
checkoutScmShallow()
withTools(params.TOOLS_VERSION) {
sh "cmake -B build.xcore -DDEV_LIB_MIC_ARRAY=1 -DCMAKE_TOOLCHAIN_FILE=../xmos_cmake_toolchain/xs3a.cmake"
sh "cd build.xcore && make all -j 16"
}
}
}
post {
cleanup {
xcoreCleanSandbox()
}
}
} // stage('Custom CMake build')
stage('HW tests') {
agent {
label 'xcore.ai'
stage('Custom CMake build test') {
agent {
label "x86_64 && linux"
}
steps {
sh "git clone git@github.com:xmos/xmos_cmake_toolchain.git --branch v1.0.0"
dir(REPO_NAME) {
checkoutScmShallow()
withTools(params.TOOLS_VERSION) {
sh "cmake -B build.xcore -DDEV_LIB_MIC_ARRAY=1 -DCMAKE_TOOLCHAIN_FILE=../xmos_cmake_toolchain/xs3a.cmake"
sh "cd build.xcore && make all -j 16"
}
}
}
post {
cleanup {
xcoreCleanSandbox()
}
}
} // stage('Custom CMake build')

stage('Tests') {
parallel {
stage('XS3 Tests') {
agent {label 'xcore.ai'}
stages {
stage("Checkout and Build") {
steps {
Expand All @@ -184,8 +164,6 @@ pipeline {
dir("${REPO_NAME}/tests") {
withTools(params.TOOLS_VERSION) {
withVenv {
// Use xtagctl to reset the relevent adapters first, if attached, to be safe.
// sh "xtagctl reset_all XVF3800_INT XVF3600_USB"

// This ensures a project for XS2 can be built and runs OK
sh "xsim test_xs2_benign/bin/xs2.xe"
Expand Down Expand Up @@ -217,7 +195,6 @@ pipeline {
}
}
}

dir("signal/TwoStageDecimator") {
runPytest('-v --numprocesses=1')
}
Expand All @@ -235,20 +212,43 @@ pipeline {
} // stage('Run tests')
} // stages
post {
cleanup {
xcoreCleanSandbox()
}
}
} // stage('HW tests')
cleanup {xcoreCleanSandbox()}
} // post
} // XS3 Tests

stage('VX4 Tests') {
agent {label "x86_64 && linux"}
stages {
stage("Checkout and Build") {
steps {
dir(REPO_NAME){
checkoutScmShallow()
dir("tests/unit") {
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 "xsim bin/tests-unit.xe"}
}}}} // stage('Run tests')
} // stages
post {
cleanup {xcoreCleanSandbox()}
} //post
} // VX4 Tests

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

stage('🚀 Release') {
when {
expression { triggerRelease.isReleasable() }
}
steps {
triggerRelease()
}
}
} // Release stage
} // stages
} // pipeline
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()
6 changes: 6 additions & 0 deletions examples/app_mic_array_basic/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
xrun --xscope bin/app_mic_array.xe
pyhton convert.py

output:

Converted mic_array_output.bin to output.wav with 1 channels, 16000 Hz sample rate, and 32 bits per sample.
25 changes: 25 additions & 0 deletions examples/app_mic_array_basic/convert.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

import numpy as np
import wave
import soundfile as sf


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=16000,
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>
18 changes: 18 additions & 0 deletions examples/app_mic_array_basic/src/XK-EVK-XU316-AIV.xscope
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>

<!-- ======================================================= -->
<!-- The 'ioMode' attribute on the xSCOPEconfig -->
<!-- element can take the following values: -->
<!-- "none", "basic", "timed" -->
<!-- -->
<!-- The 'type' attribute on Probe -->
<!-- elements can take the following values: -->
<!-- "STARTSTOP", "CONTINUOUS", "DISCRETE", "STATEMACHINE" -->
<!-- -->
<!-- The 'datatype' attribute on Probe -->
<!-- elements can take the following values: -->
<!-- "NONE", "UINT", "INT", "FLOAT" -->
<!-- ======================================================= -->

<xSCOPEconfig ioMode="basic" enabled="true">
</xSCOPEconfig>
67 changes: 67 additions & 0 deletions examples/app_mic_array_basic/src/app.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>

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

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

// -------------------- Frecuency and Port definitions --------------------
#define MIC_ARRAY_CONFIG_MCLK_FREQ (24576000)
#define MIC_ARRAY_CONFIG_PDM_FREQ (3072000)
#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 defines
#define APP_N_SAMPLES (320)
#define APP_OUT_FREQ_HZ (16000)
#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_FILENAME ("mic_array_output.bin")

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 user_mic(chanend_t c_mic_audio)
{
printf("Mic Init\n");
device_pll_init();
mic_array_init(&pdm_res, NULL, APP_OUT_FREQ_HZ);
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);
printf("Done\n");
exit(0);
}
Loading