summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/netlist/nl_config.h
blob: 439e779b1ce5775533ffffbd55932d0ead74d155 (plain) (blame)
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
// license:GPL-2.0+
// copyright-holders:Couriersud
/*
 * nlconfig.h
 *
 */

#ifndef NLCONFIG_H_
#define NLCONFIG_H_

#include "plib/pconfig.h"

//============================================================
//  SETUP
//============================================================

/*
 * The following options determine how object::update is called.
 * NL_PMF_TYPE_VIRTUAL
 * 		Use stock virtual call
 *
 * NL_PMF_TYPE_GNUC_PMF
 * 		Use standard pointer to member function syntax
 *
 * 	NL_PMF_TYPE_GNUC_PMF_CONV
 * 		Use gnu extension and convert the pmf to a function pointer.
 * 		This is not standard compliant and needs
 * 		-Wno-pmf-conversions to compile.
 *
 * 	NL_PMF_TYPE_INTERNAL
 * 		Use the same approach as MAME for deriving the function pointer.
 * 		This is compiler-dependant as well
 *
 * 	Benchmarks for ./nltool -c run -f src/mame/drivers/nl_pong.c -t 10 -n pong_fast
 *
 * 	NL_PMF_TYPE_INTERNAL: 		215%
 *	NL_PMF_TYPE_GNUC_PMF: 		163%
 * 	NL_PMF_TYPE_GNUC_PMF_CONV: 	215%
 *  NL_PMF_TYPE_VIRTUAL:	 	213%
 *
 *	The whole exercise was done to avoid virtual calls. In prior versions of
 *	netlist, the INTERNAL and GNUC_PMF_CONV approach provided significant improvement.
 *	Since than, ATTR_COLD was removed from functions declared as virtual.
 *	This may explain that the recent benchmarks show no difference at all.
 *
 *	Disappointing is the GNUC_PMF performance.
 */

// This will be autodetected
//#define NL_PMF_TYPE 3

#define NL_PMF_TYPE_VIRTUAL			0
#define NL_PMF_TYPE_GNUC_PMF		1
#define NL_PMF_TYPE_GNUC_PMF_CONV	2
#define NL_PMF_TYPE_INTERNAL		3

#ifndef NL_PMF_TYPE
	#if PHAS_PMF_INTERNAL
		#define NL_PMF_TYPE NL_PMF_TYPE_INTERNAL
	#else
		#define NL_PMF_TYPE NL_PMF_TYPE_VIRTUAL
	#endif
#endif

#if (NL_PMF_TYPE == NL_PMF_TYPE_GNUC_PMF_CONV)
#pragma GCC diagnostic ignored "-Wpmf-conversions"
#endif

/*
 *  This increases performance in circuits with a lot of gates
 *  but is not guaranteed to be absolutely timing correct.
 *
 *  Performance increase about 10% (breakout) to 20% (pong)
 *
 */


// moved to parameter NETLIST.USE_DEACTIVATE
// #define USE_DEACTIVE_DEVICE     (0)

#define USE_TRUTHTABLE          (1)

// The following adds about 10% performance ...

#if !defined(USE_OPENMP)
#define USE_OPENMP              (0)
#endif // !defined(USE_OPENMP)

// Use nano-second resolution - Sufficient for now
#define NETLIST_INTERNAL_RES        (U64(1000000000))
//#define NETLIST_INTERNAL_RES      (U64(1000000000000))

#define NETLIST_CLOCK               (NETLIST_INTERNAL_RES)

#define NETLIST_GMIN_DEFAULT    (1e-9)

//#define nl_double float
//#define NL_FCONST(x) (x ## f)

#define nl_double double
#define NL_FCONST(x) x


//============================================================
//  Solver defines
//============================================================

#define USE_MATRIX_GS (0)
#define USE_PIVOT_SEARCH (0)
#define USE_GABS (1)
// savings are eaten up by effort
// FIXME: Convert into solver parameter
#define USE_LINEAR_PREDICTION (0)


//============================================================
//  DEBUGGING
//============================================================

#define NL_VERBOSE                  (0)
#define NL_KEEP_STATISTICS          (0)

#if (NL_VERBOSE)
	#define NL_VERBOSE_OUT(x)       netlist().log x
#else
	#define NL_VERBOSE_OUT(x)       do { if(0) netlist().log x ; } while (0)
#endif

//============================================================
//  General Macros
//============================================================

#if defined(_OPENMP)
#define HAS_OPENMP ( _OPENMP >= 200805 )
#else
#define HAS_OPENMP (0)
#endif

// prevent implicit copying
#define NETLIST_PREVENT_COPYING(_name)          \
	private:                                    \
		_name(const _name &);                   \
		_name &operator=(const _name &);

//============================================================
//  Performance tracking
//============================================================

#if NL_KEEP_STATISTICS
#include "eminline.h"
#define add_to_stat(v,x)        do { v += (x); } while (0)
#define inc_stat(v)             add_to_stat(v, 1)
#define begin_timing(v)         do { v -= get_profile_ticks(); } while (0)
#define end_timing(v)           do { v += get_profile_ticks(); } while (0)
#else
#define add_to_stat(v,x)        do { } while (0)
#define inc_stat(v)             add_to_stat(v, 1)
#define begin_timing(v)         do { } while (0)
#define end_timing(v)           do { } while (0)
#endif

// this macro passes an item followed by a string version of itself as two consecutive parameters
#define NLNAME(x) x, #x

//============================================================
//  WARNINGS
//============================================================

#if (USE_OPENMP)
#if (!(HAS_OPENMP))
#error To use openmp compile and link with "-fopenmp"
#endif
#endif


#endif /* NLCONFIG_H_ */