4 * Copyright (c) 2001 Stephen Williams (steve@icarus.com)
6 * This source code is free software; you can redistribute it
7 * and/or modify it in source code form under the terms of the GNU
8 * General Public License as published by the Free Software
9 * Foundation; either version 2 of the License, or (at your option)
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
23 * This header file describes the various "pointer" integral types
24 * that are used in vvp, along with functions that can be used to
25 * manipulate those pointers.
28 # include "vvp/config.h"
31 * The vvp_ipoint_t is a 32bit integer that encodes the address of a
34 * The typedef below gets the type properly declared as an integral
35 * type that is big enough. The config.h header file has the defines
36 * needed for the following pre-processor magic to work.
38 typedef uint32_t vvp_ipoint_t
;
41 * This is a native-pointer version of the vvp_ipoint_t
43 typedef struct functor_s
*functor_t
;
46 * Given a functor generic address and a desired port, this function
47 * makes a complete vvp_ipoint_t that points to the port of the given
48 * functor. The The result points to the same functor as the input
49 * pointer, but addresses the supplied port instead.
51 inline vvp_ipoint_t
ipoint_make(vvp_ipoint_t func
, unsigned port
)
53 return (func
& ~3) | (port
& 3);
57 * This implements pointer arithmetic for vvp_point_t pointers. Add
58 * the given index to the functor part of the pointer.
60 inline vvp_ipoint_t
ipoint_index(vvp_ipoint_t base
, unsigned idx
)
62 return base
+ (idx
<<2);
66 * Return the ipoint of an input into a multi-functor input vector.
68 inline vvp_ipoint_t
ipoint_input_index(vvp_ipoint_t base
, unsigned idx
)
70 return (base
& ~3) + idx
;
74 * This function returns the port index of a functor given a complete
75 * vvp_ipoint_t pointer.
77 inline unsigned ipoint_port(vvp_ipoint_t func
)
83 * The functor event mode uses a pointer of this type to point to the
84 * extended event data.
86 typedef struct event_functor_s
*vvp_event_t
;
89 typedef struct vthread_s
*vthread_t
;
92 /* vector of functors */
94 typedef struct vvp_fvector_s
*vvp_fvector_t
;
96 /* Forward declarations. */