This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

runtime in cortex M4

I am using cortex M4 simulator in ARM DS.

I am having a function with name function1. Attached the code for reference

Can anybody suggest me any modification in that function such that runtime will be reduced ?

Regards

GBS

  • Unable to add code . Now attaching here.

    /*
    ============================================================================
    Name : runtime_opt.c
    Author : GB
    Version :
    Copyright : Your copyright notice
    Description : Hello World in C, Ansi-style
    ============================================================================
    */

    #include <stdio.h>
    #include <stdlib.h>
    #include "stdint.h"
    #include <arm_acle.h>

    typedef unsigned char uint8;
    typedef unsigned short uint16;
    typedef unsigned int uint32;
    typedef signed char sint8;
    typedef signed short sint16;
    typedef signed int sint32;
    typedef unsigned char boolean;

    # define D_LENGTH 400
    # define B_LENGTH 64
    # define P_PER_GR 16u


    typedef struct
    {
    uint16 u_IdxD;
    uint16 u_bField[3];
    }struct1;

    typedef struct
    {
    uint16 u_IdxB;
    boolean b_Is;
    uint16 u_SR;
    uint16 u_BI;
    uint16 u_BIRND;
    uint16 u_BIRNDP;
    uint16 u_BIRNDN;
    uint16 u_BIRPD;
    uint16 u_BIRPDP;
    uint16 u_BIRPDN;
    uint16 u_MfPS;
    uint16 u_MfPSRP;
    uint16 u_MfPSRN;
    uint16 u_IDMO;
    uint16 u_IDPO;

    }struct2;

    void function1(const struct1* ind,
    const uint16 a_SpRext[][B_LENGTH],
    const uint16* p_IdMaxMf,
    const uint32 u_NP,
    struct2* p_Pks);

    int main(void) {
    uint16 index = 0;

    // Function arguments
    struct1 arg1[2][P_PER_GR];
    uint16 arg2[2][D_LENGTH * B_LENGTH];
    uint16 arg3[2][D_LENGTH];
    uint8 arg4[2];
    struct2 arg5[P_PER_GR];

    //Inputs
    for(index=0;index<P_PER_GR;index++)
    {
    arg1[0][index].u_IdxD = 0;
    arg1[0][index].u_bField[0] = 0;
    arg1[0][index].u_bField[1] = 0;
    arg1[0][index].u_bField[2] = 0;

    }

    for(index=0;index<D_LENGTH * B_LENGTH;index++)
    {
    arg2[0][index] = 16384;
    arg2[1][index] = 16384;
    }


    for(index=0;index<D_LENGTH;index+=7)
    {
    arg3[0][index] = 1;
    arg3[0][index+1] = 5;
    arg3[0][index+2] = 10;
    arg3[0][index+3] = 15;
    arg3[0][index+4] = 20;
    arg3[0][index+5] = 25;
    arg3[0][index+6] = 31;

    }
    arg4[0] = 0;
    arg4[0] = 1;

    function1(&arg1[0][0],
    &arg2[1][0],
    &arg3[1][0],
    arg4[0],
    &arg5[0]);

    return EXIT_SUCCESS;
    }

    void function1(const struct1* ind,
    const uint16 a_SpRext[][B_LENGTH],
    const uint16* p_IdMaxMf,
    const uint32 u_NP,
    struct2* p_Pks)

    {
    uint32 u_Cnt;
    uint32 u_NP_L = u_NP;
    uint16 u_IdxD;
    uint16 u_IDMO ;
    uint16 u_IDPO ;
    uint16 u_NofDoppler = (uint16)D_LENGTH;
    const uint16* p_SBNextIn, *p_SBPrevIn;
    struct2* p_DPCurr;
    struct1* p_HPCurr;

    for (u_Cnt = 0u; u_Cnt < u_NP_L; u_Cnt++)
    {

    p_HPCurr = (ind + u_Cnt);
    p_DPCurr = (p_Pks+u_Cnt);

    u_IdxD = p_HPCurr->u_IdxD;
    u_IDMO = p_DPCurr->u_IDMO;
    u_IDPO = p_DPCurr->u_IDPO;


    p_SBNextIn = a_SpRext[u_IdxD];
    p_DPCurr->u_MfPSRN = *(p_SBNextIn+p_DPCurr->u_IdxB);

    p_DPCurr->u_BIRND = *(p_IdMaxMf+u_IdxD);
    p_DPCurr->u_BIRNDN = *(p_IdMaxMf+u_IDPO);
    p_DPCurr->u_BIRNDP = *(p_IdMaxMf+u_IDMO);

    }

    }