actually I play a little bit around with the vector functions from the lib_dsp.
But I get stuck with with: dsp_vector_mulv_addv
It seems, that this function only make the addition, but not the multiplication.
Maybe someone had an idea what I do wrong in this example.
dsp_vector_mulv_subv
produces the result as expected.
Here is my simple example + make file + xrun output
I'm using: 14.3.0 and lib_dsp: 3.1.0 (last commit from 27.Apr)
Bests,
Sebastian
Code: Select all
#include <stdio.h>
#include <xs1.h>
#include <dsp.h>
#include <platform.h>
#define Q_N 24
#define SHORT_SAMPLE_LENGTH 5
int32_t Src[] = { Q24(.11), Q24(.12), Q24(.13), Q24(.14), Q24(.15)};
int32_t Src2[] = { Q24(.51), Q24(.52), Q24(.53), Q24(.54), Q24(.55)};
int32_t Src3[] = { Q24(8.0), Q24(-8.62), Q24(.63), Q24(.64), Q24(.65)};
int32_t Dst[SHORT_SAMPLE_LENGTH];
void calc (void){
int32_t i;
dsp_vector_mulv_addv (Src, // Input vector
Src2, // Input vector 2
Src3, // Input vector 2
Dst, // Output vector
SHORT_SAMPLE_LENGTH, // Vector length
Q_N); // Q Format N
printf ("Vector / Vector multiplication and vector addition Result\n");
for (i = 0; i < SHORT_SAMPLE_LENGTH; i++)
{
printf ("Dst[%d] = %lf\n", i, F24 (Dst[i]));
}
dsp_vector_mulv_subv (Src, // Input vector
Src2, // Input vector 2
Src3, // Input vector 2
Dst, // Output vector
SHORT_SAMPLE_LENGTH, // Vector length
Q_N); // Q Format N
printf ("Vector / Vector multiplication and vector subtraction Result\n");
for (i = 0; i < SHORT_SAMPLE_LENGTH; i++)
{
printf ("Dst[%d] = %lf\n", i, F24 (Dst[i]));
}
}
int main(void)
{
par
{
on tile[0]: calc();
}
return (0);
}
Code: Select all
# The TARGET variable determines what target system the application is
# compiled for. It either refers to an XN file in the source directories
# or a valid argument for the --target option when compiling.
TARGET = XEF232-1024-FB374-C40.xn
# The APP_NAME variable determines the name of the final .xe file. It should
# not include the .xe postfix. If left blank the name will default to
# the project name
APP_NAME =
# This variable controls where the include files for the app are found.
# In this application the extra include files may be found in a target
# specific directory for XMOS development boards
INCLUDE_DIRS = src
# This header file is marked as optional since it is only included for
# a known XMOS development board
OPTIONAL_HEADERS =
# The flags passed to xcc when building the application
# You can also set the following to override flags for a particular language:
#
# XCC_XC_FLAGS, XCC_C_FLAGS, XCC_ASM_FLAGS, XCC_CPP_FLAGS
#
# If the variable XCC_MAP_FLAGS is set it overrides the flags passed to
# xcc for the final link (mapping) stage.
XCC_FLAGS = -O0 -g -report
USED_MODULES = lib_dsp
#=============================================================================
# The following part of the Makefile includes the common build infrastructure
# for compiling XMOS applications. You should not need to edit below here.
XMOS_MAKE_PATH ?= ../..
include $(XMOS_MAKE_PATH)/xcommon/module_xcommon/build/Makefile.common
Code: Select all
Vector / Vector multiplication and vector addition Result
Dst[0] = 8.000000
Dst[1] = -8.620000
Dst[2] = 0.630000
Dst[3] = 0.640000
Dst[4] = 0.650000
Vector / Vector multiplication and vector subtraction Result
Dst[0] = -7.943900
Dst[1] = 8.682400
Dst[2] = -0.561100
Dst[3] = -0.564400
Dst[4] = -0.567500