Changeset 295 for soft/giet_vm/sort


Ignore:
Timestamp:
Mar 26, 2014, 6:44:44 PM (10 years ago)
Author:
alain
Message:

Introducing a major release, to suppoort the tsar_generic_leti platform
and the various (external or internal) peripherals configurations.
The map.xml format has been modified, in order to support the new
vci_iopic componentand a new policy for peripherals initialisation.
The IRQs are nom described in the XICU and IOPIC components
(and not anymore in the processors).
To enforce this major change, the map.xml file signature changed:
The signature value must be: 0xDACE2014

This new release has been tested on the tsar_generic_leti platform
for the following mappings:

  • 4c_4p_sort_leti
  • 4c_4p_sort_leti_ext
  • 4c_4p_transpose_leti
  • 4c_4p_transpose_leti_ext
  • 4c_1p_four_leti_ext
File:
1 edited

Legend:

Unmodified
Added
Removed
  • soft/giet_vm/sort/main.c

    r292 r295  
    11///////////////////////////////////////////////////////////////////////////////
    2 // File :
    3 //     
    4 //      main.c
    5 //
    6 // Date :
    7 //     
    8 //      November 2013
    9 //
    10 // Author :
    11 //
    12 //      Cesar Fuguet Tortolero <cesar.fuguet-tortolero@lip6.fr>
     2// File   :  main.c
     3// Date   :  November 2013
     4// Author :  Cesar Fuguet Tortolero <cesar.fuguet-tortolero@lip6.fr>
    135//
    146// Description :
     
    3830#include "barrier.h"
    3931
    40 #define ARRAY_LENGTH    2048
     32#define ARRAY_LENGTH    512
    4133#define IPT             (ARRAY_LENGTH / *nb_thread) // ITEMS PER THREAD
    4234
     
    4739#define VERBOSE         1
    4840
    49 ///////////////////////////////////////////////////////////////////////
     41////////////////////////////////////////////////////////////////////////////////
    5042// Define printf according to verbosity option and number of available
    5143// TTY
    5244
    5345#if (VERBOSE == 1)
    54 #   define printf(...)     giet_tty_printf(__VA_ARGS__)
    55 #   define puts(...)       giet_tty_puts(__VA_ARGS__)
     46#   define printf(...)     giet_shr_printf(__VA_ARGS__)
    5647#else       // VERBOSE == 0
    5748#   define printf(...)
    58 #   define puts(...)
    5949#endif
    6050
    61 #define task0_printf(...) if(thread_id == 0) giet_tty_printf(__VA_ARGS__)
     51#define task0_printf(...) if(thread_id == 0) giet_shr_printf(__VA_ARGS__)
    6252
    6353#define exit    giet_exit
     
    8979giet_barrier_t barrier[8];
    9080
     81//////////////////////////////////////////
    9182__attribute__ ((constructor)) void sort()
    9283{
     
    10091    unsigned int time_end;   
    10192
    102     if( giet_vobj_get_vbase( "sort" ,
    103                              "nb_thread",
    104                              VOBJ_TYPE_CONST,
    105                              (unsigned int*)&nb_thread ) )
    106     {
    107         printf( "\n[ERROR] in sort task :\n");
    108         printf( "          undefined <nb_thread> constant: %d\n", nb_thread);
    109         exit();
    110     }   
     93    giet_vobj_get_vbase( "sort" ,
     94                         "nb_thread",
     95                         (unsigned int*)&nb_thread );
    11196   
    112     task0_printf("[Thread 0 ] Starting sort application with %d threads "
     97    task0_printf("\n[ Thread 0 ] Starting sort application with %d threads "
    11398                 "at cycle %d\n", *nb_thread, time_start);
    11499
     
    141126    // Parallel sort of array elements
    142127
    143     printf("[ Thread %d ] Stage 0: Processor Sorting...\n\r", thread_id);
     128    printf("[ Thread %d ] Stage 0: Sorting...\n\r", thread_id);
    144129
    145130    bubbleSort(array0, IPT, IPT * thread_id);
     
    154139        if((thread_id % (2 << i)) != 0)
    155140        {
    156             printf("[ Thread %d ] Quits\n\r", thread_id);
    157             exit();
    158         }
    159 
    160         printf("[ Thread %d ] Stage %d: Starting...\n\r", thread_id, i+1);
     141            printf("[ Thread %d ] Quit\n\r", thread_id );
     142            exit("Completed");
     143        }
     144
     145        printf("[ Thread %d ] Stage %d: Sorting...\n\r", thread_id, i+1);
    161146
    162147        if((i % 2) == 0)
     
    203188
    204189        time_end = giet_proctime();
     190
    205191        printf("[ Thread 0 ] Finishing sort application at cycle %d\n"
    206192               "[ Thread 0 ] Time elapsed = %d\n",
     
    209195        if (success)
    210196        {
    211 
    212             printf("[ Thread 0 ] Success!!\n\r");
     197            exit("!!! Success !!!");
    213198        }
    214199        else
    215200        {
    216             printf("[ Thread 0 ] Failure!! Incorrect element: %d\n\r", failure_index);
    217 
    218 
     201            printf("[ Thread 0 ] Failure!! Incorrect element: %d\n\r",
     202                   failure_index);
    219203            for(i=0; i<ARRAY_LENGTH; i++)
    220204            {
    221205                printf("array[%d] = %d\n", i, dst_array[i]);
    222206            }
    223         }
    224     }
    225 
    226     exit();
     207            exit("!!!  Failure !!!");
     208        }
     209    }
     210    exit("Completed");
    227211}
    228212
    229 void bubbleSort(
    230         int * array,
    231         unsigned int length,
    232         unsigned int init_pos)
     213////////////////////////////////////
     214void bubbleSort( int *        array,
     215                 unsigned int length,
     216                 unsigned int init_pos )
    233217{
    234218    int i;
     
    250234}
    251235
     236/////////////
    252237void merge(
    253238        int * array,
Note: See TracChangeset for help on using the changeset viewer.