source: soft/giet_vm/pgcd/main.c @ 408

Last change on this file since 408 was 295, checked in by alain, 11 years ago

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 size: 1.2 KB
Line 
1#include "stdio.h"
2#include "hard_config.h"
3
4/////////////////////////////////////////
5__attribute__ ((constructor)) void main()
6{
7    unsigned int opx;
8    unsigned int opy;
9
10    unsigned int    procid     = giet_procid();
11    unsigned int    cluster_xy = procid/NB_PROCS_MAX;
12    unsigned int    lpid       = procid%NB_PROCS_MAX;
13    unsigned int    x          = cluster_xy >> Y_WIDTH;
14    unsigned int    y          = cluster_xy & ((1<<Y_WIDTH)-1);
15
16    giet_tty_printf( "*** Starting task pgcd on processor[%d,%d,%d] at cycle %d\n\n", 
17                      x, y, lpid, giet_proctime() );
18
19    while (1) 
20    {
21        giet_tty_printf("\n*******************\n");
22        giet_tty_printf("operand X = ");
23        giet_tty_getw( &opx );
24        giet_tty_printf("\n");
25        giet_tty_printf("operand Y = ");
26        giet_tty_getw( &opy );
27        giet_tty_printf("\n");
28        if( (opx == 0) || (opy == 0) ) 
29        {
30           giet_tty_printf("operands must be larger than 0\n");
31        } 
32        else 
33        {
34            while (opx != opy) 
35            {
36                if(opx > opy)   opx = opx - opy;
37                else            opy = opy - opx;
38            }
39            giet_tty_printf("pgcd      = %d\n", opx);
40        }
41    }
42} // end pgcd
43
Note: See TracBrowser for help on using the repository browser.