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

Subversion Repositories or1k

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

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

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

powered by: WebSVN 2.1.0

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