File: table_mod.h

package info (click to toggle)
iverilog 12.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 30,148 kB
  • sloc: cpp: 109,972; ansic: 62,713; yacc: 10,216; sh: 3,470; vhdl: 3,246; perl: 1,814; makefile: 1,774; python: 78; csh: 2
file content (101 lines) | stat: -rw-r--r-- 3,250 bytes parent folder | download | duplicates (6)
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
#ifndef IVL_table_mod_H
#define IVL_table_mod_H
/*
 *  Copyright (C) 2011-2014  Cary R. (cygcary@yahoo.com)
 *
 *  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, write to the Free Software Foundation, Inc.,
 *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */

#include <stdio.h>
#include <vpi_user.h>

/*
 * Define the allowed interpolation control values.
 */
#define IVL_CLOSEST_POINT    0 /* D */
#define IVL_LINEAR_INTERP    1 /* 1 - Default */
#define IVL_QUADRATIC_INTERP 2 /* 2 */
#define IVL_CUBIC_INTERP     3 /* 3 */
#define IVL_IGNORE_COLUMN    4 /* I */

/*
 * Define the allowed extrapolation control values.
 */
#define IVL_CONSTANT_EXTRAP 0 /* C */
#define IVL_LINEAR_EXTRAP   1 /* L - Default */
#define IVL_ERROR_EXTRAP    2 /* E */

/*
 * Structure that represents an individual iso line element.
 */
typedef struct t_indep {
      double value;
      struct t_indep *left;  /* previous element. */
      struct t_indep *right; /* next element. */
      union {
	    double data;
	    struct t_indep *child;
	    struct t_build *build;
      } data;
} s_indep, *p_indep;

/*
 * This is used as an interface element while building the iso lines. It will
 * be removed when the list is converted to a balanced threaded tree. It is
 * used to make in order insertion faster.
 */
typedef struct t_build {
      p_indep first;
      p_indep last;
      unsigned count;
} s_build, *p_build;

/*
 * This structure is saved for each table model instance.
 */
typedef struct t_table_mod {
      vpiHandle *indep;     /* Independent variable arguments. */
      double *indep_val;    /* Current independent variable values. */
      union {               /* Data file or argument to get the data file. */
	    char *name;
	    vpiHandle arg;
      } file;
      union {               /* Control string argument. */
	    struct {
		  char *interp;
		  char *extrap_low;
		  char *extrap_high;
	    } info;
	    vpiHandle arg;
      } control;
// HERE need a pointer to the dependent data and the final table.
      unsigned dims;        /* The number of independent variables. */
      unsigned fields;      /* The number of control fields. */
      unsigned depend;      /* Where the dependent column is located. */
      char have_fname;      /* Has the file name been allocated? */
      char have_ctl;        /* Has the file name been allocated? */
} s_table_mod, *p_table_mod;

/*
 * Define the non-static table model routines.
 */

extern unsigned parse_table_model(FILE *fp, vpiHandle callh, p_table_mod table);

extern int tblmodlex(void);
extern void destroy_tblmod_lexor(void);
extern void init_tblmod_lexor(FILE *fp);

#endif /* IVL_table_mod_H */