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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [gdb-5.0/] [sim/] [igen/] [misc.h] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 106 markom
/*  This file is part of the program psim.
2
 
3
    Copyright (C) 1994-1995, Andrew Cagney <cagney@highland.com.au>
4
 
5
    This program is free software; you can redistribute it and/or modify
6
    it under the terms of the GNU General Public License as published by
7
    the Free Software Foundation; either version 2 of the License, or
8
    (at your option) any later version.
9
 
10
    This program is distributed in the hope that it will be useful,
11
    but WITHOUT ANY WARRANTY; without even the implied warranty of
12
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
    GNU General Public License for more details.
14
 
15
    You should have received a copy of the GNU General Public License
16
    along with this program; if not, write to the Free Software
17
    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18
 
19
    */
20
 
21
 
22
/* Frustrating header junk */
23
 
24
#include "config.h"
25
 
26
 
27
enum {
28
  default_insn_bit_size = 32,
29
  max_insn_bit_size = 64,
30
};
31
 
32
 
33
/* Define a 64bit data type */
34
 
35
#if defined __GNUC__ || defined _WIN32
36
#ifdef __GNUC__
37
 
38
typedef long long signed64;
39
typedef unsigned long long unsigned64;
40
 
41
#else   /* _WIN32 */
42
 
43
typedef __int64 signed64;
44
typedef unsigned __int64 unsigned64;
45
 
46
#endif /* _WIN32 */
47
#else /* Not GNUC or WIN32 */
48
/* Not supported */
49
#endif
50
 
51
 
52
#include <stdio.h>
53
#include <ctype.h>
54
 
55
#ifdef HAVE_STRING_H
56
#include <string.h>
57
#else
58
#ifdef HAVE_STRINGS_H
59
#include <strings.h>
60
#endif
61
#endif
62
 
63
#ifdef HAVE_STDLIB_H
64
#include <stdlib.h>
65
#endif
66
 
67
#if !defined (__attribute__) && (!defined(__GNUC__) || __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7))
68
#define __attribute__(arg)
69
#endif
70
 
71
 
72
 
73
#include "filter_host.h"
74
 
75
typedef struct _line_ref line_ref;
76
struct _line_ref {
77
  const char *file_name;
78
  int line_nr;
79
};
80
 
81
/* Error appends a new line, warning and notify do not */
82
typedef void error_func
83
(const line_ref *line,
84
 char *msg,
85
 ...);
86
 
87
extern error_func error;
88
extern error_func warning;
89
extern error_func notify;
90
 
91
 
92
#define ERROR(EXPRESSION) \
93
do { \
94
  line_ref line; \
95
  line.file_name = filter_filename (__FILE__); \
96
  line.line_nr = __LINE__; \
97
  error (&line, EXPRESSION); \
98
} while (0)
99
 
100
#define ASSERT(EXPRESSION) \
101
do { \
102
  if (!(EXPRESSION)) { \
103
    line_ref line; \
104
    line.file_name = filter_filename (__FILE__); \
105
    line.line_nr = __LINE__; \
106
    error(&line, "assertion failed - %s\n", #EXPRESSION); \
107
  } \
108
} while (0)
109
 
110
#define ZALLOC(TYPE) ((TYPE*) zalloc (sizeof(TYPE)))
111
#define NZALLOC(TYPE,N) ((TYPE*) zalloc (sizeof(TYPE) * (N)))
112
#if 0
113
#define STRDUP(STRING) (strcpy (zalloc (strlen (STRING) + 1), (STRING)))
114
#define STRNDUP(STRING,LEN) (strncpy (zalloc ((LEN) + 1), (STRING), (LEN)))
115
#endif
116
 
117
extern void *zalloc
118
(long size);
119
 
120
extern unsigned target_a2i
121
(int ms_bit_nr,
122
 const char *a);
123
 
124
extern unsigned i2target
125
(int ms_bit_nr,
126
 unsigned bit);
127
 
128
extern unsigned long long a2i
129
(const char *a);
130
 
131
 
132
/* Try looking for name in the map table (returning the corresponding
133
   integer value).
134
 
135
   If the the sentinal (NAME == NULL) its value if >= zero is returned
136
   as the default. */
137
 
138
typedef struct _name_map {
139
  const char *name;
140
  int i;
141
} name_map;
142
 
143
extern int name2i
144
(const char *name,
145
 const name_map *map);
146
 
147
extern const char *i2name
148
(const int i,
149
 const name_map *map);

powered by: WebSVN 2.1.0

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