File: glue-vhdl.c

package info (click to toggle)
fauhdlc 20180504-2
  • links: PTS
  • area: main
  • in suites: buster
  • size: 2,956 kB
  • sloc: cpp: 23,188; ansic: 6,077; yacc: 3,764; lex: 763; makefile: 605; sh: 494; xml: 403
file content (289 lines) | stat: -rw-r--r-- 6,680 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
/* $Id$
 *
 *  Glue layer between fauhdli and FAUmachine to access FAUmachine signals 
 *  from VHDL.
 *  This file is only used for the standalone fauhdli interpreter, and
 *  does nothing but log a few error messages.
 *  Since the standalone interpreter uses free/malloc from glibc, it's
 *  safe to use these here as well.
 *
 * Copyright (C) 2008-2009 FAUmachine Team <info@faumachine.org>.
 * This program is free software. You can redistribute it and/or modify it
 * under the terms of the GNU General Public License, either version 2 of
 * the License, or (at your option) any later version. See COPYING.
 */

#include "glue-vhdl.h"
#include "glue-log.h"
#include <assert.h>
#include <stdlib.h>

struct glue_vhdl {
	unsigned int max_sig_id;
	unsigned int max_comp_id;
	unsigned int max_arch_id;
};


void
glue_vhdl_proc_set(
	void *_cpssp,
	const char *proc,
	const char *param,
	union fauhdli_value value
)
{
	fauhdli_log(FAUHDLI_LOG_WARNING, "fauhdli", "glue-vhdl",
		"Set foreign parameter %s of procedure %s. Skipping.\n",
		param, proc);
}

void
glue_vhdl_proc_call(void *_cpssp, const char *proc)
{
	fauhdli_log(FAUHDLI_LOG_WARNING, "fauhdli", "glue-vhdl",
		"Foreign procedure call of %s requested. Skipping.\n",
		proc);
}

void
glue_vhdl_set(
	void *_cpssp,
	unsigned int sig_id, 
	union fauhdli_value data,
	void *drv
)
{
	struct glue_vhdl *cpssp = (struct glue_vhdl *)_cpssp;
	assert(sig_id <= cpssp->max_sig_id);
	fauhdli_log(FAUHDLI_LOG_WARNING, "fauhdli", "glue-vhdl",
		"Setting foreign signal %d requested. Skipping.\n", sig_id);
}

void
glue_vhdl_connect_out(
	void *_cpssp, 
	unsigned int sig_id,
	union fauhdli_value init,
	void *drv
)
{
	struct glue_vhdl *cpssp = (struct glue_vhdl *)_cpssp;
	assert(sig_id <= cpssp->max_sig_id);
	fauhdli_log(FAUHDLI_LOG_WARNING, "fauhdli", "glue-vhdl",
		"Connecting a driver to a foreign signal %d requested. "
		"Skipping.\n", sig_id);
}

void
glue_vhdl_connect_in(
	void *_cpssp,
	unsigned int sig_id,
	void *drv
)
{
	struct glue_vhdl *cpssp = (struct glue_vhdl *)_cpssp;
	assert(sig_id <= cpssp->max_sig_id);
	fauhdli_log(FAUHDLI_LOG_WARNING, "fauhdli", "glue-vhdl",
		"Connecting a signal to a foreign signal %d requested. "
		"Skipping.\n", sig_id);
}

unsigned int
glue_vhdl_create_signal(
	void *_cpssp, 
	const char *type,
	const char *name
)
{
	struct glue_vhdl *cpssp = (struct glue_vhdl *)_cpssp;
	fauhdli_log(FAUHDLI_LOG_WARNING, "fauhdli", "glue-vhdl", 
		"Foreign signal %s of type %s requested. Skipping.\n",
		name, type);
	cpssp->max_sig_id++;
	return cpssp->max_sig_id;
}

unsigned int
glue_vhdl_comp_create(
	void *_cpssp, 
	const char *type, 
	const char *name
)
{
	struct glue_vhdl *cpssp = (struct glue_vhdl*)_cpssp;

	fauhdli_log(FAUHDLI_LOG_WARNING, "fauhdli", "glue-vhdl",
		"Foreign component %s of type %s requested. Skipping\n",
		name, type);
	cpssp->max_comp_id++;
	return cpssp->max_comp_id;
}

unsigned int
glue_vhdl_arch_create(
	void *_cpssp,
	const char *type, 
	const char *name
)
{
	struct glue_vhdl *cpssp = (struct glue_vhdl *)_cpssp;
	fauhdli_log(FAUHDLI_LOG_WARNING, "fauhdli", "glue-vhdl",
		"Foreign architecture %s of type %s requested. Skipping\n",
		name, type);
	cpssp->max_arch_id++;
	return cpssp->max_arch_id;
}


void
glue_vhdl_comp_init(void *_cpssp, unsigned int comp)
{
	struct glue_vhdl *cpssp = (struct glue_vhdl *)_cpssp;
	assert(comp <= cpssp->max_comp_id);

	fauhdli_log(FAUHDLI_LOG_WARNING, "fauhdli", "glue-vhdl",
		"Initialization of foreign component %d requested."
		"Skipping.\n", comp);
}

void
glue_vhdl_arch_init(void *_cpssp, unsigned int arch)
{
	struct glue_vhdl *cpssp = (struct glue_vhdl*)_cpssp;
	assert(arch <= cpssp->max_comp_id);

	fauhdli_log(FAUHDLI_LOG_WARNING, "fauhdli", "glue-vhdl",
		"Initialization of foreign architecture %d requested."
		"Skipping.\n", arch);
}


void
glue_vhdl_comp_port_connect(
	void *_cpssp,
	unsigned int comp,
	const char *port,
	unsigned int sig
)
{
	struct glue_vhdl *cpssp = (struct glue_vhdl *)_cpssp;
	assert(cpssp != NULL);
	assert(comp <= cpssp->max_comp_id);
	assert(sig <= cpssp->max_sig_id);

	fauhdli_log(FAUHDLI_LOG_WARNING, "fauhdli", "glue-vhdl",
		"Foreign port %s of component %d request to connect to "
		"signal %d. Skipping\n", port, comp, sig);
}

void
glue_vhdl_arch_port_connect(
	void *_cpssp,
	unsigned int arch,
	const char *port,
	unsigned int sig
)
{
	struct glue_vhdl *cpssp = (struct glue_vhdl *)_cpssp;
	assert(cpssp != NULL);
	assert(arch <= cpssp->max_arch_id);
	assert(sig <= cpssp->max_sig_id);

	fauhdli_log(FAUHDLI_LOG_WARNING, "fauhdli", "glue-vhdl",
		"Foreign port %s of architecture %d request to connect to "
		"signal %d. Skipping\n", port, arch, sig);
}

void
glue_vhdl_comp_generic_nonarray_set(
	void *_cpssp,
	unsigned int comp,
	const char *generic,
	union fauhdli_value val,
	const char *type
)
{
	struct glue_vhdl *cpssp = (struct glue_vhdl *)_cpssp;
	assert(cpssp != NULL);
	assert(comp <= cpssp->max_comp_id);
	
	fauhdli_log(FAUHDLI_LOG_WARNING, "fauhdli", "glue-vhdl",
		"Setting foreign generic %s of component %d requested. "
		"Skipping.\n", generic, comp);
}

void
glue_vhdl_arch_generic_nonarray_set(
	void *_cpssp,
	unsigned int arch,
	const char *generic,
	union fauhdli_value val,
	const char *type
)
{
	struct glue_vhdl *cpssp = (struct glue_vhdl *)_cpssp;
	assert(cpssp != NULL);
	assert(arch <= cpssp->max_arch_id);
	
	fauhdli_log(FAUHDLI_LOG_WARNING, "fauhdli", "glue-vhdl",
		"Setting foreign generic %s of architecture %d requested. "
		"Skipping.\n", generic, arch);
}


void
glue_vhdl_comp_generic_array_set(
	void *_cpssp,
	unsigned int comp,
	const char *generic,
	const char *element_type,
	union fauhdli_value base,
	universal_integer array_size
)
{
	struct glue_vhdl *cpssp = (struct glue_vhdl *)_cpssp;
	assert(cpssp != NULL);
	assert(comp <= cpssp->max_comp_id);

	fauhdli_log(FAUHDLI_LOG_WARNING, "fauhdli", "glue-vhdl",
		"Setting foreign generic %s of component %d requested. "
		"Skipping.\n", generic, comp);
}

void
glue_vhdl_arch_generic_array_set(
	void *_cpssp,
	unsigned int arch,
	const char *generic,
	const char *element_type,
	union fauhdli_value base,
	universal_integer array_size
)
{
	struct glue_vhdl *cpssp = (struct glue_vhdl *)_cpssp;
	assert(cpssp != NULL);
	assert(arch <= cpssp->max_arch_id);

	fauhdli_log(FAUHDLI_LOG_WARNING, "fauhdli", "glue-vhdl",
		"Setting foreign generic %s of architecture %d requested. "
		"Skipping.\n", generic, arch);
}


void *
glue_vhdl_create(void)
{
	struct glue_vhdl *ret = malloc(sizeof(struct glue_vhdl));
	ret->max_sig_id = 0;
	ret->max_comp_id = 0;
	ret->max_arch_id = 0;
	return ret;
}

void
glue_vhdl_destroy(void *_cpssp)
{
	assert(_cpssp != NULL);
	free(_cpssp);
}