Skip to content

/github/workspace/src/StatisticsFunctions/kernels/plp_power_f32p_xpulpv2.c

Functions

Name
void plp_power_f32p_xpulpv2(void * S)
Parallel sum of squares of a 32-bit float vector for XPULPV2 extension.

Functions Documentation

function plp_power_f32p_xpulpv2

void plp_power_f32p_xpulpv2(
    void * S
)

Parallel sum of squares of a 32-bit float vector for XPULPV2 extension.

Parameters:

  • S points to the instance structure for floating-point parallel power

Return: none

Source code

/* =====================================================================
 * Project:      PULP DSP Library
 * Title:        plp_power_f32p_xpulpv2.c
 * Description:  Calculates the sum of squares on XPULPV2 cores
 *
 * $Date:        22.03.2022
 *
 * Target Processor: PULP cores
 * ===================================================================== */
/*
 * Copyright (C) 2020 ETH Zurich and University of Bologna.
 *
 * Author: Marco Bertuletti, ETH Zurich
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Licensed under the Apache License, Version 2.0 (the License); you may
 * not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an AS IS BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#include "plp_math.h"

void plp_power_f32p_xpulpv2(void* S) {

    float32_t *pSrc = (float32_t *)(((plp_power_instance_f32 *)S)->pSrc) + hal_core_id();
    uint32_t blkSizePE = ((plp_power_instance_f32 *)S)->blkSizePE;
    uint32_t nPE = ((plp_power_instance_f32 *)S)->nPE;
    float32_t *resBufferPE = &(((plp_power_instance_f32 *)S)->resBuffer[hal_core_id()]);

    uint32_t blkCnt = 0;
    float32_t accum = 0.0f, tmp;
    for (blkCnt = 0; blkCnt < blkSizePE; blkCnt++) {
        tmp = pSrc[nPE * blkCnt];
        accum += tmp*tmp;
    }
    *resBufferPE = accum;
}

Updated on 2023-03-01 at 16:16:33 +0000