rtems_task Floating_point_task_2(
  rtems_task_argument argument
)
{
  Thread_Control *executing;
  FP_DECLARE;

  context_switch_save_restore_idle_time = benchmark_timer_read();

  executing = _Thread_Executing;

  _Thread_Executing =
       (Thread_Control *) _Thread_Ready_chain[FP1_PRIORITY].first;

  FP_LOAD( 1.0 );

  /* do not force context switch */

  _Context_Switch_necessary = false;

  _Thread_Disable_dispatch();

  benchmark_timer_initialize();
#if (CPU_HARDWARE_FP == 1) || (CPU_SOFTWARE_FP == 1)
    _Context_Save_fp( &executing->fp_context );
    _Context_Restore_fp( &_Thread_Executing->fp_context );
#endif
    _Context_Switch( &executing->Registers, &_Thread_Executing->Registers );
  /* switch to Floating_point_task_1 */

  context_switch_save_restore_initted_time = benchmark_timer_read();

  complete_test();
}
Exemple #2
0
rtems_task Floating_point_task_2(
  rtems_task_argument argument
)
{
  Scheduler_priority_Context *scheduler_context =
    _Scheduler_priority_Get_context( _Scheduler_Get( _Thread_Get_executing() ) );
  Thread_Control             *executing;
  FP_DECLARE;

  context_switch_save_restore_idle_time = benchmark_timer_read();

  executing = _Thread_Get_executing();

  set_thread_executing(
    (Thread_Control *) _Chain_First(&scheduler_context->Ready[FP1_PRIORITY])
  );

  FP_LOAD( 1.0 );

  benchmark_timer_initialize();
#if (CPU_HARDWARE_FP == 1) || (CPU_SOFTWARE_FP == 1)
    _Context_Save_fp( &executing->fp_context );
    _Context_Restore_fp( &_Thread_Get_executing()->fp_context );
#endif
    _Context_Switch(
      &executing->Registers,
      &_Thread_Get_executing()->Registers
    );
  /* switch to Floating_point_task_1 */

  context_switch_save_restore_initted_time = benchmark_timer_read();

  complete_test();
}
Exemple #3
0
rtems_task Floating_point_task_1(
  rtems_task_argument argument
)
{
  Chain_Control   *ready_queues;
  Thread_Control  *executing;
  FP_DECLARE;

  context_switch_restore_1st_fp_time = benchmark_timer_read();

  executing = _Thread_Executing;

  ready_queues      = (Chain_Control *) _Scheduler.information;
  _Thread_Executing =
        (Thread_Control *) _Chain_First(&ready_queues[FP2_PRIORITY]);

  /* do not force context switch */

  _Thread_Dispatch_necessary = false;

  _Thread_Disable_dispatch();

  benchmark_timer_initialize();
#if (CPU_HARDWARE_FP == 1) || (CPU_SOFTWARE_FP == 1)
    _Context_Save_fp( &executing->fp_context );
    _Context_Restore_fp( &_Thread_Executing->fp_context );
#endif
    _Context_Switch( &executing->Registers, &_Thread_Executing->Registers );
  /* switch to Floating_point_task_2 */

  context_switch_save_idle_restore_initted_time = benchmark_timer_read();

  FP_LOAD( 1.0 );

  executing = _Thread_Executing;

  ready_queues      = (Chain_Control *) _Scheduler.information;
  _Thread_Executing =
        (Thread_Control *) _Chain_First(&ready_queues[FP2_PRIORITY]);

  /* do not force context switch */

  _Thread_Dispatch_necessary = false;

  _Thread_Disable_dispatch();

  benchmark_timer_initialize();
#if (CPU_HARDWARE_FP == 1) || (CPU_SOFTWARE_FP == 1)
    _Context_Save_fp( &executing->fp_context );
    _Context_Restore_fp( &_Thread_Executing->fp_context );
#endif
    _Context_Switch( &executing->Registers, &_Thread_Executing->Registers );
  /* switch to Floating_point_task_2 */
}
Exemple #4
0
static inline void  qpx_data_fn_strided_c0 (void                  * target,
        void                  * src,
        size_t                  bytes,
        void                  * cookie,
        size_t                  c0)
{
    if (bytes < 512) {
        data_fn_strided(target, src, bytes, cookie);
        return;
    }

    double *s0 = (double *) src;
    double *s1;
    double *d0;
    register size_t inc = 0;
    size_t offset = 0;
    size_t i = 0, j;

    A1PAMI_Info_t *ainfo =  (A1PAMI_Info_t *) cookie;
    size_t sy, ey;
    size_t stride = ainfo->dstride;
    size_t n = c0 / 32;

    size_t poffset = ((size_t)target - (size_t)ainfo->dstaddr);
    sy = poffset / c0;
    ey = (poffset+512)  / c0;

    register double f0  FP_REG(0);
    register double f1  FP_REG(1);
    register double f2  FP_REG(2);
    register double f4  FP_REG(4);
    //f2 = ainfo->scale;
    double *scale_ptr = &(ainfo->scale);
    FP_LOAD(scale_ptr, inc, f2);

    inc = 32;
    s0 -= 4;
    for (j = sy; j < ey; ++j) {
        offset = (j*stride) / sizeof(double);
        d0     = (double*)((char*)target + offset);
        d0    -= 4;
        s1     = d0;
        for (i = 0; i < n; ++i) {
            //d[offset + i] += scale * s[nd++];
            QPX_LOAD(s0,inc,f0);
            QPX_LOAD(s1,inc,f1);
            ASM("qvfmadd 4, 0, 2, 1" ::: FP_REG1(4) );
            QPX_STORE(d0,inc,f4);
        }
    }

    A1PAMI_Assert ((size_t)s0 == (size_t)((char*)src+512-32));
}
Exemple #5
0
rtems_task First_FP_task(
  rtems_task_argument argument
)
{
  rtems_status_code status;
  rtems_id          tid;
  rtems_time_of_day time;
  uint32_t    task_index;
  INTEGER_DECLARE;
  FP_DECLARE;

  status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid );
  directive_failed( status, "rtems_task_ident" );

  task_index = task_number( tid );

  INTEGER_LOAD( INTEGER_factors[ task_index ] );
  FP_LOAD( FP_factors[ task_index ] );

  put_name( Task_name[ task_index ], FALSE );
  printf(
    " - integer base = (0x%" PRIx32 ")\n",
    INTEGER_factors[ task_index ]
  );
  put_name( Task_name[ task_index ], FALSE );
  #if ( RTEMS_HAS_HARDWARE_FP == 1 )
    printf( " - float base = (%g)\n", FP_factors[ task_index ] );
  #else
    printf( " - float base = (NA)\n" );
  #endif

  if ( argument == 0 ) {
    status = rtems_task_restart( RTEMS_SELF, 1 );
    directive_failed( status, "rtems_task_restart of RTEMS_SELF" );
  } else {
    build_time( &time, 12, 31, 1988, 9, 0, 0, 0 );
    status = rtems_clock_set( &time );
    directive_failed( status, "rtems_clock_set" );

    status = rtems_task_delete( RTEMS_SELF );
    directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
  }
}
Exemple #6
0
static inline void     qpx_data_fn_sx (void                  * target,
                                       void                  * src,
                                       size_t                  bytes,
                                       double                * scale)
{
    double *src0     = (double *) src;
    double *src1     = (double *) target;
    double *dst      = (double *) target;

    unsigned num_dbls = 64;
    register double f0  FP_REG(0);
    register double f1  FP_REG(1);
    register double f2  FP_REG(2);
    register double f3  FP_REG(3);
    register double f4  FP_REG(4);
    register double f5  FP_REG(5);
    register double f6  FP_REG(6);
    register double f7  FP_REG(7);
    register double f8  FP_REG(8);
    register double f9  FP_REG(9);
    register double f10 FP_REG(10);
    register double f11 FP_REG(11);
    register double f12 FP_REG(12);
    /*f12 = *scale;*/  /* compiler may optimize this away*/

    register int inc = 0;
    FP_LOAD(scale, inc, f12);

    unsigned niter = num_dbls >> 5;
    niter --;

    double *src0_1, *src1_1;
    double *src0_2, *src1_2;
    double *dst_1, *dst_2;

    src0_1 = src0 -8;
    src1_1 = src1 -8;
    src0_2 = src0 -4;
    src1_2 = src1 -4;

    dst_1 = dst -8;
    dst_2 = dst -4;

    inc=64;

    QPX_LOAD(src0_1,inc,f0);
    QPX_LOAD(src1_1,inc,f1);
    QPX_LOAD(src0_1,inc,f2);
    QPX_LOAD(src1_1,inc,f3);
    QPX_LOAD(src0_1,inc,f4);
    QPX_LOAD(src1_1,inc,f5);
    QPX_LOAD(src0_1,inc,f6);
    QPX_LOAD(src1_1,inc,f7);
    ASM("qvfmadd 8, 0, 12, 1" ::: FP_REG1(8) );

    QPX_LOAD(src0_2,inc,f0);
    QPX_LOAD(src1_2,inc,f1);

    ASM("qvfmadd 9, 2, 12, 3" ::: FP_REG1(9) );
    QPX_LOAD(src0_2,inc,f2);
    QPX_LOAD(src1_2,inc,f3);

    ASM("qvfmadd 10, 4, 12, 5" ::: FP_REG1(10) );
    QPX_LOAD(src0_2,inc,f4);
    QPX_LOAD(src1_2,inc,f5);

    ASM("qvfmadd 11, 6, 12, 7" ::: FP_REG1(11) );
    QPX_LOAD(src0_2,inc,f6);
    QPX_LOAD(src1_2,inc,f7);

    while (niter --) {
        QPX_STORE(dst_1,inc,f8);
        ASM("qvfmadd 8, 0, 12, 1" ::: FP_REG1(8)  );
        QPX_LOAD(src0_1,inc,f0);
        QPX_LOAD(src1_1,inc,f1);

        QPX_STORE(dst_1,inc,f9);
        ASM("qvfmadd 9, 2, 12, 3" ::: FP_REG1(9)  );
        QPX_LOAD(src0_1,inc,f2);
        QPX_LOAD(src1_1,inc,f3);

        QPX_STORE(dst_1,inc,f10);
        ASM("qvfmadd 10, 4, 12, 5" ::: FP_REG1(10)  );
        QPX_LOAD(src0_1,inc,f4);
        QPX_LOAD(src1_1,inc,f5);

        QPX_STORE(dst_1,inc,f11);
        ASM("qvfmadd 11, 6, 12, 7" ::: FP_REG1(11)  );
        QPX_LOAD(src0_1,inc,f6);
        QPX_LOAD(src1_1,inc,f7);

        QPX_STORE(dst_2,inc,f8);
        ASM("qvfmadd 8, 0, 12, 1" ::: FP_REG1(8)  );
        QPX_LOAD(src0_2,inc,f0);
        QPX_LOAD(src1_2,inc,f1);

        QPX_STORE(dst_2,inc,f9);
        ASM("qvfmadd 9, 2, 12, 3" ::: FP_REG1(9)  );
        QPX_LOAD(src0_2,inc,f2);
        QPX_LOAD(src1_2,inc,f3);

        QPX_STORE(dst_2,inc,f10);
        ASM("qvfmadd 10, 4, 12, 5" ::: FP_REG1(10)  );
        QPX_LOAD(src0_2,inc,f4);
        QPX_LOAD(src1_2,inc,f5);

        QPX_STORE(dst_2,inc,f11);
        ASM("qvfmadd 11, 6, 12, 7" ::: FP_REG1(11)  );
        QPX_LOAD(src0_2,inc,f6);
        QPX_LOAD(src1_2,inc,f7);
    }

    QPX_STORE(dst_1,inc,f8);
    ASM("qvfmadd 8, 0, 12, 1" ::: FP_REG1(8) );
    QPX_STORE(dst_1,inc,f9);
    ASM("qvfmadd 9, 2, 12, 3" ::: FP_REG1(9) );
    QPX_STORE(dst_1,inc,f10);
    ASM("qvfmadd 10, 4, 12, 5" ::: FP_REG1(10) );
    QPX_STORE(dst_1,inc,f11);
    ASM("qvfmadd 11, 6, 12, 7" ::: FP_REG1(11) );

    QPX_STORE(dst_2,inc,f8);
    QPX_STORE(dst_2,inc,f9);
    QPX_STORE(dst_2,inc,f10);
    QPX_STORE(dst_2,inc,f11);
}
rtems_task FP_task(
  rtems_task_argument argument
)
{
  rtems_status_code status;
  rtems_id          tid;
  rtems_time_of_day time;
  uint32_t    task_index;
  uint32_t    previous_seconds;
  INTEGER_DECLARE;
  FP_DECLARE;

  status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid );
  directive_failed( status, "rtems_task_ident of self" );

  task_index = task_number( tid );

  INTEGER_LOAD( INTEGER_factors[ task_index ] );
  FP_LOAD( FP_factors[ task_index ] );

  put_name( Task_name[ task_index ], FALSE );
  printf( " - integer base = (0x%x)\n", INTEGER_factors[ task_index ] );
  put_name( Task_name[ task_index ], FALSE );
#if ( RTEMS_HAS_HARDWARE_FP == 1 )
  printf( " - float base = (%g)\n", FP_factors[ task_index ] );
#else
  printf( " - float base = (NA)\n" );
#endif

  previous_seconds = -1;

  while( FOREVER ) {

    status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time );
    directive_failed( status, "rtems_clock_get" );

    if ( time.second >= 16 ) {

      if ( task_number( tid ) == 4 ) {
        puts( "TA4 - rtems_task_delete - self" );
        status = rtems_task_delete( RTEMS_SELF );
        directive_failed( status, "rtems_task_delete of TA4" );
      }
      puts( "TA5 - rtems_task_delete - TA3" );
      status = rtems_task_delete( Task_id[ 3 ] );
      directive_failed( status, "rtems_task_delete of TA3" );

      puts( "*** END OF TEST 19 *** " );
      rtems_test_exit( 0 );
    }

    if (previous_seconds != time.second)
    {
      put_name( Task_name[ task_index ], FALSE );
      print_time( " - rtems_clock_get - ", &time, "\n" );
      previous_seconds = time.second;
    }

    INTEGER_CHECK( INTEGER_factors[ task_index ] );
    FP_CHECK( FP_factors[ task_index ] );

    /* for the first 4 seconds we spin as fast as possible
     * so that we likely are interrupted
     * After that, we go to sleep for a second at a time
     */
    if (time.second >= 4)
    {
      status = rtems_task_wake_after( TICKS_PER_SECOND );
      directive_failed( status, "rtems_task_wake_after" );
    }
  }
}