source: soft/giet_vm/applications/rosenfeld/nrc2/src/nrio1xf.c

Last change on this file 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: 2.0 KB
RevLine 
[772]1/* ----------------- */
2/* --- nrio1fx.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
[822]13#include "nrc_os_config.h"
[772]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"
[822]21#include "nrio1x.h"
[772]22
23
24/* --------------------------- */
25/* -- write_vector_circular -- */
26/* --------------------------- */
27
[822]28#undef write_type_vector_circular
29#define write_type_vector_circular(t) \
30void short_name(t,write_,vector_circular)(t * v, int32_t nl, int32_t nh, int32_t c0, int32_t c1, char * format, char * filename) \
31{                                                                  \
32    int32_t n = nh - nl + 1;                                       \
33    FILE * f = fopen(filename, "wt");                              \
34    if (f == NULL) {                                               \
35        nrerror("Can't open file %s in %s\n", filename, __func__); \
36    }                                                              \
37    for (int32_t i = c0; i <= c1; i++) {                           \
38        fprintf(f, format, v[i % n + nl]);                         \
39    }                                                              \
40    fprintf(f, "\n");                                              \
41    fclose(f);                                                     \
42}
[772]43
[822]44write_type_vector_circular(int8_t);
45write_type_vector_circular(uint8_t);
46write_type_vector_circular(int16_t);
47write_type_vector_circular(uint16_t);
48write_type_vector_circular(int32_t);
49write_type_vector_circular(uint32_t);
50write_type_vector_circular(int64_t);
51write_type_vector_circular(uint64_t);
52write_type_vector_circular(float);
53write_type_vector_circular(double);
54
55
56
57// Local Variables:
58// tab-width: 4
59// c-basic-offset: 4
60// c-file-offsets:((innamespace . 0)(inline-open . 0))
61// indent-tabs-mode: nil
62// End:
63
64// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4
65
Note: See TracBrowser for help on using the repository browser.