aboutsummaryrefslogtreecommitdiffstats
path: root/src/grt/vhpi_thunk.c
blob: 602ce3724c0fd0573ad61dfea11ccab96f27ca47 (plain)
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
/* GHDL Run Time (GRT) - VHPI thunks
   Copyright (C) 2021 Marlon James

   This program is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation, either version 2 of the License, or
   (at your option) any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program.  If not, see <gnu.org/licenses>.

   As a special exception, if other files instantiate generics from this
   unit, or you link this unit with other files to produce an executable,
   this unit does not by itself cause the resulting executable to be
   covered by the GNU General Public License. This exception does not
   however invalidate any other reasons why the executable file might be
   covered by the GNU Public License.
*/
#include <stdarg.h>

/* Define PLI_PROTOTYPES so that vhpi_user.h does not import functions.  */
#define PLI_PROTOTYPES
#define XXTERN extern

#include "vhpi_user.h"
#include "vhpi_thunk.h"

// the function pointer table
vhpi_thunk *VHPI_THUNK;

// VHPI thunks

int
vhpi_assert (vhpiSeverityT severity, char *formatmsg, ...)
{
  va_list args;
  int res;

  va_start (args, formatmsg);
  res = VHPI_THUNK->vhpi_vassert (severity, formatmsg, args);
  va_end(args);

  return res;
}

vhpiHandleT vhpi_register_cb (vhpiCbDataT *cb_data_p, int32_t flags)
{
  return VHPI_THUNK->vhpi_register_cb (cb_data_p, flags);
}

int
vhpi_remove_cb (vhpiHandleT cb_obj)
{
  return VHPI_THUNK->vhpi_remove_cb (cb_obj);
}

int
vhpi_disable_cb (vhpiHandleT cb_obj)
{
  return VHPI_THUNK->vhpi_disable_cb (cb_obj);
}

int
vhpi_enable_cb (vhpiHandleT cb_obj)
{
  return VHPI_THUNK->vhpi_enable_cb (cb_obj);
}

int
vhpi_get_cb_info (vhpiHandleT object, vhpiCbDataT *cb_data_p)
{
  return VHPI_THUNK->vhpi_get_cb_info (object, cb_data_p);
}

int
vhpi_sens_first (vhpiValueT *sens)
{
  return VHPI_THUNK->vhpi_sens_first (sens);
}

int
vhpi_sens_zero (vhpiValueT *sens)
{
  return VHPI_THUNK->vhpi_sens_zero (sens);
}

int
vhpi_sens_clr (int obj, vhpiValueT *sens)
{
  return VHPI_THUNK->vhpi_sens_clr (obj, sens);
}

int
vhpi_sens_set (int obj, vhpiValueT *sens)
{
  return VHPI_THUNK->vhpi_sens_set (obj, sens);
}

int
vhpi_sens_isset (int obj, vhpiValueT *sens)
{
  return VHPI_THUNK->vhpi_sens_isset (obj, sens);
}

vhpiHandleT
vhpi_handle_by_name (const char *name, vhpiHandleT scope)
{
  return VHPI_THUNK->vhpi_handle_by_name (name, scope);
}

vhpiHandleT
vhpi_handle_by_index (vhpiOneToManyT itRel, vhpiHandleT parent, int32_t indx)
{
  return VHPI_THUNK->vhpi_handle_by_index (itRel, parent, indx);
}

vhpiHandleT
vhpi_handle (vhpiOneToOneT type, vhpiHandleT referenceHandle)
{
  return VHPI_THUNK->vhpi_handle (type, referenceHandle);
}

vhpiHandleT
vhpi_iterator (vhpiOneToManyT type, vhpiHandleT referenceHandle)
{
  return VHPI_THUNK->vhpi_iterator (type, referenceHandle);
}

vhpiHandleT
vhpi_scan (vhpiHandleT iterator)
{
  return VHPI_THUNK->vhpi_scan (iterator);
}

vhpiIntT
vhpi_get (vhpiIntPropertyT property, vhpiHandleT object)
{
  return VHPI_THUNK->vhpi_get (property, object);
}

const vhpiCharT *
vhpi_get_str (vhpiStrPropertyT property, vhpiHandleT object)
{
  return VHPI_THUNK->vhpi_get_str (property, object);
}

vhpiRealT
vhpi_get_real (vhpiRealPropertyT property, vhpiHandleT object)
{
  return VHPI_THUNK->vhpi_get_real (property, object);
}

vhpiPhysT
vhpi_get_phys (vhpiPhysPropertyT property, vhpiHandleT object)
{
  return VHPI_THUNK->vhpi_get_phys (property, object);
}

int
vhpi_protected_call (vhpiHandleT varHdl, vhpiUserFctT userFct, void *userData)
{
  return VHPI_THUNK->vhpi_protected_call (varHdl, userFct, userData);
}

int
vhpi_get_value (vhpiHandleT expr, vhpiValueT *value_p)
{
  return VHPI_THUNK->vhpi_get_value (expr, value_p);
}

int
vhpi_put_value (vhpiHandleT object, vhpiValueT *value_p, vhpiPutValueModeT mode)
{
  return VHPI_THUNK->vhpi_put_value (object, value_p, mode);
}

int
vhpi_schedule_transaction (vhpiHandleT drivHdl, vhpiValueT *value_p,
                           uint32_t numValues, vhpiTimeT *delayp,
                           vhpiDelayModeT delayMode, vhpiTimeT *pulseRejp)
{
  return VHPI_THUNK->vhpi_schedule_transaction (drivHdl, value_p, numValues,
                                                delayp, delayMode, pulseRejp);
}

int
vhpi_format_value (const vhpiValueT *in_value_p, vhpiValueT *out_value_p)
{
  return VHPI_THUNK->vhpi_format_value (in_value_p, out_value_p);
}

void
vhpi_get_time (vhpiTimeT *time_p, long *cycles)
{
  return VHPI_THUNK->vhpi_get_time (time_p, cycles);
}

int
vhpi_get_next_time (vhpiTimeT *time_p)
{
  return VHPI_THUNK->vhpi_get_next_time (time_p);
}

int
vhpi_control (vhpiSimControlT command, ...)
{
  va_list args;
  int status;
  int res;

  va_start (args, command);
  status = va_arg (args, int);
  res = VHPI_THUNK->vhpi_control_internal (command, status);
  va_end (args);

  return res;
}

int
vhpi_printf (const char *format, ...)
{
  va_list args;
  int res;

  va_start (args, format);
  res = VHPI_THUNK->vhpi_vprintf (format, args);
  va_end (args);

  return res;
}

int
vhpi_vprintf (const char *format, va_list args)
{
  return VHPI_THUNK->vhpi_vprintf (format, args);
}