Commit Graph

205 Commits

Author SHA1 Message Date
couriersud
60379b658a netlist: code maintenance. (nw)
- Separate code out into pmath.h and pstonum.h.
- Fix VC build error
- optimize pfmtlog.h a bit
2019-11-03 23:19:52 +01:00
couriersud
34ccb11c53 netlist: Completed __float128 support. [Couriersud]
Both compiling the core and the shaders with __float128 now work.
The support was added to be ready to deal with academic edge cases.

Performance drops to 10% of double - thus disabled by default.
2019-11-03 15:25:01 +01:00
couriersud
cabfd7188a netlist: fix regression, preliminary __float128 support. (nw)
__float128 is a gnu extension delivering true 128 bit floating point
support. Currently not supported by clang. In addition, the quadmath
library needs to be linked. For the time being therefore disabled.
2019-11-03 01:33:48 +01:00
couriersud
db0dbeaea5 netlist: improve readability. (nw)
Renamed cast member of the constants struct to magic to clearly identify
magic numbers.

Introduced nlconst struct inheriting from plib::constants<nl_fptype> to
make code better understandable.
2019-11-02 23:39:24 +01:00
couriersud
77ea61bac7 netlist: add RELTOL/VNTOL solver parameters. Type safety. [Couriersud]
The newly added RELTOL and VNTOL parameters implement Newton convergence
checks comparable following other SPICE implementations.
The ACCURACY solver parameter now is only used for convergence checks in
iterative solvers.

In addition, type safety was significantly improved and a lot of "magic"
numbers are identifiable now.
2019-11-02 22:25:11 +01:00
couriersud
6573037934 netlist: Support for float, double and long double solvers. [Couriersud]
- Added new solver parameter FPTYPE. This determines in which floating
  point domain the linear system is solved. May be one of "FLOAT",
  "DOUBLE" or "LONGDOUBLE"
- Added option "--fperr" to nltool. This enables floating point
  exceptions. This helps debugging the code under gdb.

The purpose of this going forward is to have more choice in
optimization. Non-dynamic systems should be just fine in the float
domain. Dynamic systems (i.e. diodes, bjts, mosfets) should in general
work with double. Certain edge cases may require long double resolution.
2019-11-02 12:25:50 +01:00
couriersud
5f1427ab0f netlist: code maintenance and bugfixes. (nw)
- fixed a bug in the parray constructor
- replaced NL_NOEXCEPT with noexcept where appropriate
2019-11-01 18:49:22 +01:00
couriersud
a9d7e55ac2 netlist: convert constexpr constants into constexpr inline funcs. (nw) 2019-11-01 01:50:33 +01:00
couriersud
47d938b149 netlist: further solver refactoring. (nw) 2019-11-01 01:21:43 +01:00
AJR
e37b9b7b88 It's C++14 where constexpr variables still aren't inlined, making ridiculous workarounds like this necessary to fix builds (nw) 2019-10-31 19:46:14 -04:00
couriersud
c6b281685d netlist: Compile with float/double floating point. [Couriersud]
Added ability to compile using float instead of double. Specifically the
the solver as well as the infrastructure now can have their own floating
point type. Currently this is only an academic exercise since
numerically demanding circuits like kidniki only work with double/double
support. Using float here is pushing numerical stability over the
limits.

The long term design goal is too have the matrix type (double/float)
being a parameter.
2019-10-31 21:53:50 +01:00
couriersud
6c075e602c netlist: maintenance and simplifcation. (nw)
- solver: align matrix population along the various solvers
- solver: delete dead code
- renamed nl_double to nl_fptype and use nl_fptype where previously
  double has been used.
- renamed param_double_t to param_fp_t
2019-10-31 18:39:09 +01:00
couriersud
65fb297023 netlist: move solver stuff into separate namespace. (nw)
- new namespace "solver"
- minor ptime modifications
2019-10-31 01:15:43 +01:00
couriersud
7c6fdaf499 netlist solvers: fix some bad design. (nw) 2019-10-30 20:42:49 +01:00
couriersud
beab34006a netlist: code maintenance. (nw)
Simplification, remove some trampolines.
2019-10-30 19:10:40 +01:00
couriersud
cebd828fcd netlist: improve localized storage. (nw) 2019-10-29 22:05:45 +01:00
couriersud
cac86fb1b4 netlist: code maintenance. (nw)
- Removed code no longer used
- Add noexcept where appropriate
- split pparser.[c|h] into ppreprocessor and ptokenizer
- smaller optimizations, e.g. use of std::size_t
- fix lint warnings
2019-10-29 19:55:53 +01:00
couriersud
db318046c4 Netlist: code maintenance and bug fixes. (nw)
- solver now uses dynamic allocation on systems larger than 512x512
- fixed osx build
- moved nl_lists.h classes to plists.h
- fixed netlist makefile clint section
- readability and typos
2019-10-17 10:21:00 +02:00
couriersud
e5cceda218 Netlist: code maintenance and bug fixes. [Couriersud]
- optimized the core queue dispatching logic. Minor performance
increase.
- fixed a number of bugs in parray. Now parray<double, 0> will be purely
dynamic allocation with the number of elements passed in the
constructor.
- Added noexpr where appropriate.
- Simplified the queue

Checked with gcc-7 (ubuntu), gcc-9, clang-10, macosx clang 10, mingw
cross compile on linux.
2019-10-15 23:36:48 +02:00
couriersud
6daeb4b4d1 netlist: Use unique_ptr where possible. (nw)
Also improve code readability.
2019-10-15 11:30:05 +02:00
couriersud
a89b7d194d netlist: mame netlist reorganization. [Couriersud]
- moved netlists out of driver code into audio/ or machine/ as
nl_xxx.cpp files.
- identified and documented extended validation
- updated arcade, mess and nl targets
2019-10-13 16:45:30 +02:00
couriersud
777f93b083 netlist: fix issues with 1x1 matrix. [Tafoid]
- fixes gamemachine.cpp, breakout.cpp
2019-10-12 21:57:26 +02:00
couriersud
8f83e4392f netlist: code maintenance (nw)
- clang lint and pedantic fixes
- mat_cr.h: separate solving linear systems from underlying matrix
2019-10-12 19:36:50 +02:00
couriersud
161cc143a5 netlist: code maintenance. (nw)
- some readability improvements
- some simplifications
- kidniki uses frontiers again (speed improvement)
2019-10-11 18:36:40 +02:00
couriersud
17ae349ce6 netlist: fix error on compilers having issues with std::pair. (nw) 2019-10-08 00:32:25 +02:00
couriersud
545f8069ef netlist: maintenance and lint fixes. (nw) 2019-10-06 23:50:13 +02:00
couriersud
de6b84a533 netlist: More unique_ptr use. GMRES update, new preconditioner (nw) 2019-10-06 15:58:23 +02:00
couriersud
2de7ed7ddc netlist: more code cleanup. (nw)
- avoid duplication in solver parameter code
- matrix sort type is now a parameter
2019-10-05 01:26:54 +02:00
couriersud
43cac214a4 netlist: code maintenance (nw)
- Fix SUBMODEL
- move to strongly typed matrix sort constant
- extend maximum matrix size to 512x512
- optionally do parallel processing based on total operations
- templatize GMRES solver loops
2019-10-04 22:34:46 +02:00
couriersud
9672337a76 netlist: code simplification. (nw) 2019-10-03 15:57:44 +02:00
couriersud
545ebe832d netlist: more lint corrections. (nw)
- fixed lint corrections
- added NOLINT where needed
2019-09-28 21:45:59 +02:00
couriersud
441fb63087 netlist: switch to c++ streams. (nw)
Removed the home-brew implementation pstreams and replaced those with
c++ streams.
2019-09-25 01:10:39 +02:00
couriersud
500ca5b8fc netlist code maintenance. (nw)
- remove a lot of c library use and instead use c++
- improved pstring compatibility to std::string
- prepare removal of pstream
2019-09-17 21:05:01 +02:00
couriersud
49c05c24a2 netlist: runtime performance statistics on demand.
Runtime performance statistics can now be enabled with nltool
option "-s". To enable those with MAME you need to run

NL_STATS=1 ./mamenl64 -v -oslog game
2019-04-22 14:49:43 +02:00
couriersud
7dfd781e22 netlist: Add more validations and fix issues identified. 2019-04-21 18:28:01 +02:00
couriersud
6392b345e6 netlist: scalable error messages.
This approach uses functors for logging messages.
2019-04-18 01:18:01 +02:00
couriersud
e7652e14d6 netlist: Improve validation code.
Adjust warning levels and fix a number of topics identified.
2019-04-16 01:49:44 +02:00
couriersud
106990d8c9 netlist: clang lint fixes and pedantic warning fixes. (nw) 2019-04-12 14:00:46 +02:00
couriersud
140dc2237e netlist: TYPE=2 opamp model and MB3614 fixes.
- Untie diode code
- Fix some typos
- add TYPE=2 opamp model which omits output voltage limitation
  Useful for determining causes of non-convergence
- Fix MB3614 opamp parameters to match datasheet
2019-04-07 19:08:33 +02:00
couriersud
e4ff0d3322 netlist: Improved MOS transistor model. [Couriersud]
This is a significant improvement to the MOS transistor model. It adds
modelling of the Meyer capacitance model.
This is a somewhat academic addition since the effects occur on a
nanosecond time scale and have a huge impact on performance. I plan to
make the capacitance model selectable. Both on a model level as well as
by introducing a global solver parameter.
The model delivers comparable results to LTSpice.
2019-03-29 19:40:39 +01:00
Vas Crabb
97b6717027 (nw) Clean up the mess on master
This effectively reverts b380514764 and
c24473ddff, restoring the state at
598cd52272.

Before pushing, please check that what you're about to push is sane.
Check your local commit log and ensure there isn't anything out-of-place
before pushing to mainline.  When things like this happen, it wastes
everyone's time.  I really don't need this in a week when real work™ is
busting my balls and I'm behind where I want to be with preparing for
MAME release.
2019-03-26 11:13:37 +11:00
andreasnaive
b380514764 Revert "conflict resolution (nw)"
This reverts commit c24473ddff, reversing
changes made to 009cba4fb8.
2019-03-25 23:13:40 +01:00
couriersud
39a7c420b1 netlist: add MOSFET model. [Couriersud]
- added MOSFET model. Currently capacitances are not modelled.
  This is a 3-pin model (Bulk connected to Source) with provisions to
  extend it to 4-pin at a later stage.
- Add a capacitor generic model which is charge conserving.
  Switch netlist to use this model instead of constant capacity model.
- Start putting constants into a central place.

Please expect minor timing differences due to a different numerical
path.
The cmos inverter example illustrates the analog implementation of a
cmos inverter gate. These were used a lot back in the 70s/80s to
generate sinus waves. The model should also be able to better emulate
4066 analog switches.
The addition of a relatively simple capacitor model is planned at a
later stage.
Expect everything from the MOSFET model at the current stage. Wrong
results as well as convergence issues and crashes.
2019-03-25 21:45:37 +01:00
couriersud
618f33f586 netlist: refactoring. (nw) 2019-03-01 19:52:19 +01:00
couriersud
17fcc38a25 netlist: memory code refactoring. (nw) 2019-03-01 10:30:24 +01:00
couriersud
20551e42a7 Netlist: improve readability. (nw) 2019-03-01 07:48:01 +01:00
couriersud
893e676387 netlist: cosmetic changes - mostly indentation. (nw) 2019-03-01 07:48:00 +01:00
couriersud
d00de16b41 netlist: analog readability refactoring. (nw)
Change the sign of go (or in other terms a12 and a21 matrix stencil
elements). This should make further optimization of matrix population
easier.
In addition hopefully improve the readability of the code by sacrifying
overloads for more verbose member names.
2019-02-25 22:11:04 +01:00
couriersud
6a3efe52d6 netlist: fix bugs in the alignment code. (nw) 2019-02-25 21:17:59 +01:00
couriersud
2e055aa97b netlist: tidy changes and better constexpr support for ptime class. (nw) 2019-02-24 18:45:16 +01:00