source: soft/giet_vm/applications/rosenfeld/nrc2/src/nrio1x.c @ 826

Last change on this file since 826 was 822, checked in by meunier, 8 years ago

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 size: 4.4 KB
Line 
1/* ---------------- */
2/* --- nrio1x.c --- */
3/* ---------------- */
4
5/*
6 * Copyright (c) 2000-2014, Lionel Lacassagne, All rights reserved
7 * Univ Paris Sud XI, CNRS
8 */
9
10#include <stdlib.h>
11#include <stdio.h>
12
13#include "nrc_os_config.h"
14#include "mypredef.h"
15#include "nrtype.h"
16#include "nrdef.h"
17#include "nrkernel.h"
18#include "nrmacro.h"
19
20#include "nralloc1.h"
21#include "nrio1x.h"
22
23#undef display_type_vector_circular
24#define display_type_vector_circular(t) \
25void short_name(t,display_,vector_circular)(t * v, int32_t nl, int32_t nh, int32_t c0, int32_t c1, char * format, char * name) \
26{                                        \
27    int32_t n = nh - nl + 1;             \
28    if (name != NULL) {                  \
29        printf("%s\n", name);            \
30    }                                    \
31    for (int32_t i = c0; i <= c1; i++) { \
32        printf(format, v[i % n + nl]);   \
33    }                                    \
34    printf("\n");                        \
35}
36
37
38display_type_vector_circular(int8_t);
39display_type_vector_circular(uint8_t);
40display_type_vector_circular(int16_t);
41display_type_vector_circular(uint16_t);
42display_type_vector_circular(int32_t);
43display_type_vector_circular(uint32_t);
44display_type_vector_circular(int64_t);
45display_type_vector_circular(uint64_t);
46display_type_vector_circular(float);
47display_type_vector_circular(double);
48
49
50
51#undef display_type_vector_circular_number
52#define display_type_vector_circular_number(t) \
53void short_name(t,display_,vector_circular_number)(t * v, int32_t nl, int32_t nh, int32_t c0, int32_t c1, char * format, char * name) \
54{                                        \
55    int32_t n = nh - nl + 1;             \
56    if (name != NULL) {                  \
57        printf("%s", name);              \
58    }                                    \
59    printf("#");                         \
60    for (int32_t i = c0; i <= c1; i++) { \
61        printf(format, i % n + nl);      \
62    }                                    \
63    printf("\n ");                       \
64    for (int32_t i = c0; i <= c1; i++) { \
65        printf(format, v[i % n + nl]);   \
66    }                                    \
67    printf("\n");                        \
68}
69
70
71display_type_vector_circular_number(int8_t);
72display_type_vector_circular_number(uint8_t);
73display_type_vector_circular_number(int16_t);
74display_type_vector_circular_number(uint16_t);
75display_type_vector_circular_number(int32_t);
76display_type_vector_circular_number(uint32_t);
77display_type_vector_circular_number(int64_t);
78display_type_vector_circular_number(uint64_t);
79display_type_vector_circular_number(float);
80display_type_vector_circular_number(double);
81
82
83
84#undef display_type_vector_cycle
85#define display_type_vector_cycle(t) \
86void short_name(t,display_,vector_cycle)(t * v, int32_t nl, int32_t nh, char * format, char * name) \
87{                                        \
88    uint8_t first;                       \
89    uint8_t next;                        \
90    uint8_t * displayed;                 \
91                                         \
92    if (name != NULL) {                  \
93        printf("%s", name);              \
94    }                                    \
95    displayed = ui8vector0(nl, nh);      \
96    for (int32_t i = nl; i <= nh; i++) { \
97        if (!displayed[i]) {             \
98            displayed[i] = 1;            \
99            printf(format, i);           \
100            first = (t) i;               \
101            next = v[i];                 \
102            while (first != next) {      \
103                displayed[next] = 1;     \
104                printf(format, next);    \
105                next = v[next];          \
106            }                            \
107            printf("\n");                \
108        }                                \
109    }                                    \
110    printf("\n");                        \
111    free_ui8vector(displayed, nl, nh);   \
112}
113
114
115display_type_vector_cycle(int8_t);
116display_type_vector_cycle(uint8_t);
117display_type_vector_cycle(int16_t);
118display_type_vector_cycle(uint16_t);
119display_type_vector_cycle(int32_t);
120display_type_vector_cycle(uint32_t);
121display_type_vector_cycle(int64_t);
122display_type_vector_cycle(uint64_t);
123display_type_vector_cycle(float);
124display_type_vector_cycle(double);
125
126
127// Local Variables:
128// tab-width: 4
129// c-basic-offset: 4
130// c-file-offsets:((innamespace . 0)(inline-open . 0))
131// indent-tabs-mode: nil
132// End:
133
134// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4
135
Note: See TracBrowser for help on using the repository browser.