Ignore:
Timestamp:
Jun 1, 2016, 10:25:43 AM (8 years ago)
Author:
meunier
Message:

In rosenfeld:

  • Updated nrio0, nrio1, nrio2, nrio1f, nrio2f, nrio1x, nrbool1, nrbool2 and nralloc1 in the nrc2 lib in order to use macro-typed functions
  • Updated the simulation script to include performance evaluation with random images, and a script to generate graphs
  • Updated the clock.h to use 64-bit integers, which potentially breaks the printing on the giet
File:
1 edited

Legend:

Unmodified
Added
Removed
  • soft/giet_vm/applications/rosenfeld/nrc2/src/nrio0.c

    r777 r822  
    2626
    2727/* --------------------------------------------------------------------------------------------------- */
    28 IMAGE_EXPORT(void) generate_filename_k_ndigit(char *filename, int k, int ndigit, char *complete_filename, int maxlen)
     28void generate_filename_k_ndigit(char * filename, int k, int ndigit, char * complete_filename, int maxlen)
    2929/* --------------------------------------------------------------------------------------------------- */
    3030{
    31   char *format = "%s%d.txt";
     31    char * format = "%s%d.txt";
    3232
    33   switch(ndigit) {
    34     case 0 : format = "%s%d.txt";   break;
    35     case 1 : format = "%s%01d.txt"; break;
    36     case 2 : format = "%s%02d.txt"; break;
    37     case 3 : format = "%s%03d.txt"; break;
    38     case 4 : format = "%s%04d.txt"; break;
    39     case 5 : format = "%s%05d.txt"; break;
    40     case 6 : format = "%s%06d.txt"; break;
    41     case 7 : format = "%s%07d.txt"; break;
    42     case 8 : format = "%s%08d.txt"; break;
    43     case 9 : format = "%s%09d.txt"; break;
    44   }
    45   snprintf(complete_filename, maxlen, format, filename, k);
     33    switch (ndigit) {
     34        case 0 : format = "%s%d.txt";   break;
     35        case 1 : format = "%s%01d.txt"; break;
     36        case 2 : format = "%s%02d.txt"; break;
     37        case 3 : format = "%s%03d.txt"; break;
     38        case 4 : format = "%s%04d.txt"; break;
     39        case 5 : format = "%s%05d.txt"; break;
     40        case 6 : format = "%s%06d.txt"; break;
     41        case 7 : format = "%s%07d.txt"; break;
     42        case 8 : format = "%s%08d.txt"; break;
     43        case 9 : format = "%s%09d.txt"; break;
     44    }
     45    snprintf(complete_filename, maxlen, format, filename, k);
    4646}
    4747/* ------------------------------------------------------------------------------------------------------------------------------------------ */
    48 IMAGE_EXPORT(void) generate_filename_k_ndigit_extension(char *filename, int k, int ndigit, char *extension, char *complete_filename, int maxlen)
     48void generate_filename_k_ndigit_extension(char * filename, int k, int ndigit, char * extension, char * complete_filename, int maxlen)
    4949/* ------------------------------------------------------------------------------------------------------------------------------------------ */
    5050{
    51   char *format = "%s%d.%s";
     51    char * format = "%s%d.%s";
    5252
    53   switch(ndigit) {
    54     case 0 : format = "%s%d.%s";   break;
    55     case 1 : format = "%s%01d.%s"; break;
    56     case 2 : format = "%s%02d.%s"; break;
    57     case 3 : format = "%s%03d.%s"; break;
    58     case 4 : format = "%s%04d.%s"; break;
    59     case 5 : format = "%s%05d.%s"; break;
    60     case 6 : format = "%s%06d.%s"; break;
    61     case 7 : format = "%s%07d.%s"; break;
    62     case 8 : format = "%s%08d.%s"; break;
    63     case 9 : format = "%s%09d.%s"; break;
    64   }
    65   snprintf(complete_filename, maxlen, format, filename, k, extension);
     53    switch (ndigit) {
     54        case 0 : format = "%s%d.%s";   break;
     55        case 1 : format = "%s%01d.%s"; break;
     56        case 2 : format = "%s%02d.%s"; break;
     57        case 3 : format = "%s%03d.%s"; break;
     58        case 4 : format = "%s%04d.%s"; break;
     59        case 5 : format = "%s%05d.%s"; break;
     60        case 6 : format = "%s%06d.%s"; break;
     61        case 7 : format = "%s%07d.%s"; break;
     62        case 8 : format = "%s%08d.%s"; break;
     63        case 9 : format = "%s%09d.%s"; break;
     64    }
     65    snprintf(complete_filename, maxlen, format, filename, k, extension);
    6666}
     67
     68
    6769/* ---------------------------------------------------------------------------------------------------- */
    68 IMAGE_EXPORT(void) generate_path_filename(char *path, char *filename, char *complete_filename, int maxlen)
     70void generate_path_filename(char * path, char * filename, char * complete_filename, int maxlen)
    6971/* ---------------------------------------------------------------------------------------------------- */
    7072{
    71   snprintf(complete_filename, maxlen, "%s%s", path, filename);
     73    snprintf(complete_filename, maxlen, "%s%s", path, filename);
    7274}
     75
     76
    7377/* ------------------------------------------------------------------------------------------------------------------------------- */
    74 IMAGE_EXPORT(void) generate_path_filename_extension(char *path, char *filename, char *extension, char *complete_filename, int maxlen)
     78void generate_path_filename_extension(char * path, char * filename, char * extension, char * complete_filename, int maxlen)
    7579/* ------------------------------------------------------------------------------------------------------------------------------- */
    7680{
    77   snprintf(complete_filename, maxlen, "%s%s.%s", path, filename, extension);
     81    snprintf(complete_filename, maxlen, "%s%s.%s", path, filename, extension);
    7882}
     83
     84
    7985/* ---------------------------------------------------------------------------------------------------------------------------------------------------- */
    80 IMAGE_EXPORT(void) generate_path_filename_suffix_extension(char *path, char *filename, char *suffix, char *extension, char *complete_filename, int maxlen)
     86void generate_path_filename_suffix_extension(char * path, char * filename, char * suffix, char * extension, char * complete_filename, int maxlen)
    8187/* ---------------------------------------------------------------------------------------------------------------------------------------------------- */
    8288{
    8389    snprintf(complete_filename, maxlen, "%s%s%s.%s", path, filename, suffix, extension);
    8490}
     91
     92
    8593/* ----------------------------------------------------------------------------------------------------------------------------------------------------------- */
    86 IMAGE_EXPORT(void) generate_path_filename_k_ndigit_extension(char *path, char *filename, int k, int ndigit, char *extension, char *complete_filename, int maxlen)
     94void generate_path_filename_k_ndigit_extension(char * path, char * filename, int k, int ndigit, char * extension, char * complete_filename, int maxlen)
    8795/* ----------------------------------------------------------------------------------------------------------------------------------------------------------- */
    8896{
    89   char *format = "%s%s%d.%s";
     97    char * format = "%s%s%d.%s";
    9098
    91   switch(ndigit) {
    92     case 0 : format = "%s%s%d.%s";   break;
    93     case 1 : format = "%s%s%01d.%s"; break;
    94     case 2 : format = "%s%s%02d.%s"; break;
    95     case 3 : format = "%s%s%03d.%s"; break;
    96     case 4 : format = "%s%s%04d.%s"; break;
    97     case 5 : format = "%s%s%05d.%s"; break;
    98     case 6 : format = "%s%s%06d.%s"; break;
    99     case 7 : format = "%s%s%07d.%s"; break;
    100     case 8 : format = "%s%s%08d.%s"; break;
    101     case 9 : format = "%s%s%09d.%s"; break;
    102   }
    103   snprintf(complete_filename, maxlen, format, path, filename, k, extension);
     99    switch(ndigit) {
     100        case 0 : format = "%s%s%d.%s";   break;
     101        case 1 : format = "%s%s%01d.%s"; break;
     102        case 2 : format = "%s%s%02d.%s"; break;
     103        case 3 : format = "%s%s%03d.%s"; break;
     104        case 4 : format = "%s%s%04d.%s"; break;
     105        case 5 : format = "%s%s%05d.%s"; break;
     106        case 6 : format = "%s%s%06d.%s"; break;
     107        case 7 : format = "%s%s%07d.%s"; break;
     108        case 8 : format = "%s%s%08d.%s"; break;
     109        case 9 : format = "%s%s%09d.%s"; break;
     110    }
     111    snprintf(complete_filename, maxlen, format, path, filename, k, extension);
    104112}
     113
     114
    105115/* -------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
    106 IMAGE_EXPORT(void) generate_path_filename_k_ndigit_l_extension(char *path, char *filename, int k, int ndigit, int l, char *extension, char *complete_filename, int maxlen)
     116void generate_path_filename_k_ndigit_l_extension(char * path, char * filename, int k, int ndigit, int l, char * extension, char * complete_filename, int maxlen)
    107117/* -------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
    108118{
    109   char *format = "%s%s%d_%d.%s";
     119    char * format = "%s%s%d_%d.%s";
    110120
    111   switch(ndigit) {
    112     case 0 : format = "%s%s%d_%d.%s";   break;
    113     case 1 : format = "%s%s%01d_%01d.%s"; break;
    114     case 2 : format = "%s%s%02d_%02d.%s"; break;
    115     case 3 : format = "%s%s%03d_%03d.%s"; break;
    116     case 4 : format = "%s%s%04d_%04d.%s"; break;
    117     case 5 : format = "%s%s%05d_%05d.%s"; break;
    118     case 6 : format = "%s%s%06d_%06d.%s"; break;
    119     case 7 : format = "%s%s%07d_%07d.%s"; break;
    120     case 8 : format = "%s%s%08d_%08d.%s"; break;
    121     case 9 : format = "%s%s%09d_%09d.%s"; break;
    122   }
    123   snprintf(complete_filename, maxlen, format, path, filename, k, l, extension);
     121    switch (ndigit) {
     122        case 0 : format = "%s%s%d_%d.%s";     break;
     123        case 1 : format = "%s%s%01d_%01d.%s"; break;
     124        case 2 : format = "%s%s%02d_%02d.%s"; break;
     125        case 3 : format = "%s%s%03d_%03d.%s"; break;
     126        case 4 : format = "%s%s%04d_%04d.%s"; break;
     127        case 5 : format = "%s%s%05d_%05d.%s"; break;
     128        case 6 : format = "%s%s%06d_%06d.%s"; break;
     129        case 7 : format = "%s%s%07d_%07d.%s"; break;
     130        case 8 : format = "%s%s%08d_%08d.%s"; break;
     131        case 9 : format = "%s%s%09d_%09d.%s"; break;
     132    }
     133    snprintf(complete_filename, maxlen, format, path, filename, k, l, extension);
    124134}
    125 // ----------------------------------------------------------------------------
    126 void select_display_positive_parameters(int iformat, char **format, char **str)
    127 // ----------------------------------------------------------------------------
     135
     136
     137// ------------------------------------------------------------------------------
     138void select_display_positive_parameters(int iformat, char ** format, char ** str)
     139// ------------------------------------------------------------------------------
    128140{
    129     char *format1 = "%1d", *str1 = " ";
    130     char *format2 = "%2d", *str2 = "  ";
    131     char *format3 = "%3d", *str3 = "   ";
    132     char *format4 = "%4d", *str4 = "    ";
    133     char *format5 = "%5d", *str5 = "     ";
    134     char *format6 = "%6d", *str6 = "      ";
    135     char *format7 = "%7d", *str7 = "       ";
    136     char *format8 = "%8d", *str8 = "        ";
    137     char *format9 = "%9d", *str9 = "         ";
    138    
    139     switch(iformat) {
     141    char * format1 = "%1d", * str1 = " ";
     142    char * format2 = "%2d", * str2 = "  ";
     143    char * format3 = "%3d", * str3 = "   ";
     144    char * format4 = "%4d", * str4 = "    ";
     145    char * format5 = "%5d", * str5 = "     ";
     146    char * format6 = "%6d", * str6 = "      ";
     147    char * format7 = "%7d", * str7 = "       ";
     148    char * format8 = "%8d", * str8 = "        ";
     149    char * format9 = "%9d", * str9 = "         ";
     150
     151    switch (iformat) {
    140152        case 1:  *format = format1; *str = str1; break;
    141153        case 2:  *format = format2; *str = str2; break;
     
    150162    }
    151163}
     164
     165// Local Variables:
     166// tab-width: 4
     167// c-basic-offset: 4
     168// c-file-offsets:((innamespace . 0)(inline-open . 0))
     169// indent-tabs-mode: nil
     170// End:
     171
     172// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4
     173
Note: See TracChangeset for help on using the changeset viewer.