OpenCores
URL https://opencores.org/ocsvn/csa/csa/trunk

Subversion Repositories csa

[/] [csa/] [trunk/] [sw_sim/] [misc.h] - Blame information for rev 30

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 17 simon111
 
2
#define READ_DATA(a,n)                      \
3
do{                                         \
4
        int i;                              \
5
        int c;                              \
6
        memset(a    ,0,sizeof     a);       \
7
        for (i=n-1 ;i>=0;i--)               \
8
        {                                   \
9
             c=getchar();                   \
10
             if(c=='1')                     \
11
             {                              \
12
                     a    [i/8]|=(1<<(i%8));\
13
             }                              \
14
        }                                   \
15
}while(0)
16
 
17
#define WRITE_DATA(a,n)                     \
18
do {                                        \
19
        int i;                              \
20
        for (i= n-1;i>=0;i--)               \
21
        {                                   \
22
                if(a    [i/8]&(1<<(i%8)))   \
23
                        printf("1");        \
24
                else                        \
25
                        printf("0");        \
26
        }                                   \
27
        printf("\n");                       \
28
}while(0)
29 20 simon111
 
30 22 simon111
#define DEBUG_OUTPUT_ARR( a , n )            \
31 20 simon111
    do{                                      \
32
        int i;                               \
33 22 simon111
        printf("%s:\n",#a);                  \
34 20 simon111
        for(i=n-1;i>=0;i--)                  \
35
        {                                    \
36 22 simon111
                printf("%x ",(a)[i]);        \
37 20 simon111
        }                                    \
38
        printf("\n");                        \
39
    }while(0)
40
 
41
#define DEBUG_OUTPUT_VAL( a )                 \
42
    do{                                      \
43
                printf(" %s=%x ",#a,a);          \
44
        printf("\n");                        \
45
    }while(0)

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.