Commit Graph

55 Commits

Author SHA1 Message Date
Aaron Giles
0718a20df2 netlist: Align design VARCLOCK to AFUNC. 2020-07-03 20:36:59 +02:00
couriersud
215aa82cec netlist: Change use of NETLIB_DELEGATE macro. (nw)
The macro now has only one parameter, the local name of the delegate.
2020-06-01 19:59:51 +02:00
couriersud
82a2535d38 netlist: remove family_setter and other maintenance. (nw)
- removed family_setter
- naming alignment, family becomes model.
- architecture cleanups.)
- reviewed reset logic.
- pass truthtable family as string to factory.

This is another set of changes on the path to align logic families and
models. As a side effect, the object model now makes a clear
distinction between analog models and logic models.

The number of macros in nl_base.h has decreased significantly due to
these changes.
2020-05-09 21:49:36 +02:00
couriersud
b2c40086e6 netlist: Add two noise sources. [Couriersud]
The two sources act as voltage sources, though noise may also be
injected as conductivy or current noise.

SYS_NOISE_MT_U: Mersenne Twister uniform noise
SYS_NOISE_MT_N: Mersenne Twister normal noise

nld_sys_noise is templated:

	using NETLIB_NAME(sys_noise_mt_u) =
		NETLIB_NAME(sys_noise)<plib::mt19937_64,
plib::uniform_distribution_t>;

Thus the approach is scalable. The implementation is state save aware,
and thus reproducible results are guaranteed.

An example use case is provided as well, see examples/noise.cpp.
2020-05-03 17:23:50 +02:00
couriersud
13f6e92cec netlist: Add the NE566 as a macro device. [Couriersud]
The device can be found in nlm_other.cpp.
Removed nld_ne566.*
Added SYS_SW, SYS_SW2 and SYS_COMP. These are single switch,
alternating switch and a analog comparator with digital outputs.
Renamed RES_SWITCH to SYS_SW.
Added example ne566.cpp in netlist/examples.
2020-05-01 10:04:22 +02:00
couriersud
eac1218d59 netlist: use initializer_list. (nw)
- Use initializer_list in object_array_t.
- Added constructor which accepts a format string for object names.
- Started work on logic_input8 which provides 8 logic outputs.
2020-03-02 14:23:32 +01:00
couriersud
9d7cbcaa40 netlist: Code maintenance. (nw)
Introduce an additional absolute time type netlist_time_ext to identify
whether absolute or relative time is used in the netlist code.
Extend ptime code to allow operations between ptime derived types with
different internal types.

In addition rewrote main queue serve loops. Adds a very small
performance increase.
2020-01-12 17:16:25 +01:00
couriersud
bcfa9eae6f netlist: maintenance and bug fixes, remove DUMMY_INPUT. [Couriersud]
- Removed DUMMY_INPUT. NC (not connected) pins should now use NC_PIN.
  If a NC_PIN is actually connected, an error will be logged and
  validation will fail.
- Enabled "extended" validation. This will catch now if power terminals
  are not connected.
- Added const and noexcept where appropriate.
- Removed dead code.
- Fixed the 7414 Schmitt-Trigger device to use nld_power_pins
2019-11-15 22:16:37 +01:00
couriersud
b8c43342d5 netlist: first steps on the way to calculated parameters. [Couriersud]
This commit is a first step towards using formulas in parameters, i.e.

MAINCLOCK(clock, 20 * 30)

The intention is to improve readability and scalability.
Since device registration already provides all necessary information
about parameters, the code to create an include file for all
devices has been improved. Long term, this will remove the need for
device specific header files.

In addition going forward devices will accept either no connections or
all specified connections, i.e.

TTL_7400_NAND(name, chip1.2, chip2.3)

or

TTL_7400_NAND(name)
NET_C(...)
NET_C(...)

This will allow to remove all duplicate definitions which are currently
necessary, i.e. TTL_7400_NAND/TTL_7400_GATE
2019-11-10 19:54:26 +01:00
couriersud
f60ed79ed6 netlist: code maintenance. (nw)
- more doxygen \file annotations
- moved MAINCLOCK back to nl_base.h
- remove some const from simple function parameters
2019-11-10 01:18:57 +01:00
couriersud
ae2cad64f4 netlist: code and documentation maintenance fixes. [Couriersud]
-	"nltool -c docheader" now scans sources and creates
    usage focussed doxy documentation for devices. Very early
    stage, but works. For an example, please see ne555 source.
-	Started migrating to pure C++, i.e. "//" comments.
-   Various documentation fixes.
-   Added cppcheck configuration to netlist/build
-   Some smaller code changes.
2019-11-07 20:25:51 +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
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
6daeb4b4d1 netlist: Use unique_ptr where possible. (nw)
Also improve code readability.
2019-10-15 11:30:05 +02:00
couriersud
58e6383ada netlist: MB3614 again, function controlled VARCLOCK and other
improvements.

- fix MB3614 parameter
- Added VARCLOCK which derives step size from function
- optimized function handling in CS and VS
- fixed a bug in ppreprocessor
- add trunc to pfunction
- added opamp_amplification_curve to derive characteristic
  amplification curve
2019-04-07 19:09:48 +02: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
a65390cad5 netlist: Fix relative include paths and a conflict. (nw)
nl_types.h is part of libc++. Any project with a file with the same name
on the include path just fails to compile. Renamed to nltypes.h
2019-02-23 18:54:29 +01:00
couriersud
6a7c3a8079 netlist: align solver calls. (nw) 2019-02-04 23:17:18 +01:00
couriersud
c87a487d6d netlist: Refactoring and some functionality enhancements. (nw)
- Removed dead code.
- nltool now adds a define NLTOOL_VERSION. This can be tested in
  netlists. It is used in kidniki to ensure I stop committing
  debug parameters.
- Optimized the proposal for no-deactivate hints.
- Documented in breakout that hints were manually optimized.
- Minor optimizations in the order of 2% enhancement.
2019-02-04 00:27:23 +01:00
couriersud
75146fd159 netlist: All devices now specify parameters in factory constructor. (nw)
This previously was part of net_lib.cpp and repeatedly caused bugs.
2019-02-01 22:46:43 +01:00
couriersud
b952577370 netlist: remove trampoline code. (nw) 2019-02-01 08:45:32 +01:00
couriersud
b4ba8dc552 netlist: code maintenance and fixing kidniki ... (nw)
to run at acceptable speed again.
2019-02-01 02:07:48 +01:00
couriersud
7079d0f5fe Move information where it belongs ... into the drivers. (nw) 2019-01-10 02:07:14 +01:00
couriersud
e9a5e08b41 Fix state saving for pfunction lfsr. (nw) 2017-05-28 09:03:29 +02:00
couriersud
49d50c3045 Netlist code refactoring:
- more use of c++ features
- some CRTP in pfmtlog
- demangled code for truthtables
- use more constexpr
- rewrite main loop
- use default constructors and assignment operators were applicable.
- optimized 7448 and 9316

All of this has decreased startup time by approx. 25% to 30%. Complex
netlists like pong or kidniki are parsed, analyzed and constructed in
around 15 ms. Run performance has increased by about 5%.

All in all not to bad. A game like pong uses a clock of 7 MHz (after
division by 2). Thats 14 MHz clock invocations. Running at over 200%, 28
MHz. On a 3.9 GHz Machine about 140 cycles/clock change.

[Couriersud]
2017-04-09 00:04:10 +02:00
couriersud
5c4b7cfef8 Clean up net_t interface and increase readability. (nw) 2017-02-22 02:04:01 +01:00
couriersud
ab17457707 Make sure netlist includes are not found directly on include path.
Instead, they have to be prefixed by "netlist/". Removed unneeded link
librariers for nltool and nlwav along the way. (nw)
2017-02-10 21:52:09 +01:00
couriersud
ba03118b09 More netlist refactoring:
- Remove virtual from some destructors and make them protected. 
- Various cleanups.
- Small performance improvement. 
- Fixed some inconsistencies. 
- More c++ refactoring. (nw)
2017-01-25 22:17:48 +01:00
couriersud
ca11021d73 Netlist:
- refactored reverse polish notation evaluator into own source files.
- added function parameter to current and voltage sources VS and CS.
  You can now use those to e.g. produce a sine wave.
- Changed code to allow devices to optionally be treated as dynamic or 
  timestepping devices.
[Couriersud]
2017-01-17 01:35:16 +01:00
couriersud
b1c3586789 Improve readability and remove some trampolines. (nw) 2017-01-12 23:20:23 +01:00
couriersud
c8c7e9a770 Fix timing issue in CD4538. Add "pow" (power) to the function model.
Minor documentation updates. Slight improvement of gorilla sound. (nw)
2017-01-12 23:20:22 +01:00
couriersud
5b4026d13f - setup_t is owned by netlist_t. Stop being complicated.
- Remove gnd() method. 
- Further simplification.
- Fix potential reset and initialization issues. (nw)
2017-01-12 23:20:21 +01:00
couriersud
63f4e52dae Moved proxy code into separate file. (nw) 2016-12-28 13:48:48 +01:00
couriersud
1e40d95e8b Netlist updates:
- Removed trampolines (OUTLOGIC, INPLOGIC and friends). 
- Started using doxygen comment and documentation style. Added doxygen
files to documentation folder. 
- Refactored code triggered by doxygen output. 
- Moved internal and support classes into namespace detail. 
- Use an anordered map in parser. 
- -Wconversion fixes - All done now. 
- Fixed -Wold-style-cast warnings in netlist code. 
- Added iterators to pstring. 
- Moved two macros, added more RAII and improved exceptions. Fixed some
bugs in parser code. 
- Fixed a number of bugs in parser code and exception handling. 
[Couriersud]
2016-07-21 11:05:55 +02:00
couriersud
caafc0f782 Netlist improvements:
- nltool now accepts -Ddefine=value to pass on to netlists
- improved option handling and added "dummy" options to add grouping and
  examples in help output.
- improved --cmd=listdevices output
- Fix dynamic timestepping. This will work with breakout using real
  capacitor modelling instead of delay devices. Really slow, but very
  useful to calibrate timings.
- Fix an awful bug in timing for delay devices.
- Switched to clang 3.8 and made code compile with
  -Weverything -Werror -Wno-old-style-cast -Wno-padded -Wno-weak-vtables
  -Wno-missing-variable-declarations -Wno-conversion -Wno-c++98-compat
  -Wno-float-equal -Wno-cast-align -Wno-global-constructors
  -Wno-c++98-compat-pedantic -Wno-exit-time-destructors
  -Wno-format-nonliteral -Wno-weak-template-vtables
  This was a helpful exercise since it brought forward some 
  serious issues with implicit constructors. 
[Couriersud]
2016-07-01 02:09:14 +02:00
couriersud
af750f143c Srcclean on netlist files. Avoid the merge massacre. (nw) 2016-06-25 00:20:17 +02:00
couriersud
404e589cff Merge netlist_dev branch, all code_refactoring: (nw)
Object model optimisation. 
    Merge remote-tracking branch 'origin/master' into netlist_dev
    Fix a merge issue. 
    #if ==> #elif. Ouch. 
    Default PHAS_PMF_INTERNAL=0 for 32bit windows mingw. 
    Change UINT8 to uint_[fast|least|8_t. 
    Move state_var so it can be used by base devices as well. 
    Remove last traces of ATTR_ALIGN. 
    Refactored netlist_time into a template.
    Removed implicit double assignment to netlist. Doomed to produce
bugs.
    Instead, use netlist_time::from_double.
    Switch to using proper (i.e. bool type) param_logic_t. 
    Formally differentiate between logic inputs (e.g. switches) and int
    inputs (e.g. resistor ladders or selection switches). 
    Added parameter USE_DEACTIVATE to truthtable devices.
    Added more constexpr to netlist_time.
    Fixed some ifdef code paths.
    - More c++.
    - Simplify main processing loop. As a nice side-effect that squeezed
out some cycles.
    - More cycle squeezing.
    - Removed pvector_t.
    - Use std::sort.
    - Refactored netlist state manager.
    - Introduction of state_var object template to be used on device
state
    members.
    - Changed remaining save occurrences to state_var.
    - Rewrote nltool's listdevices command. This allowed removal of one
    member from devices which served solely for listdevices.
    - Remove hashmap_t. Fix kidniki regression.
2016-06-16 00:01:47 +02:00
couriersud
81880659d2 - More code cleanup.
- Dead code removal and minor refactoring.
- Simplify. Align naming with stl. Fix somed pedantic warnings.
- More STL compatability.
- Remove ATTR_HOT and ATTR_COLD. Refactored netlist_time. 
- Fix long standing workaround which would ignore policy of change-only"
propagation.
- Rewrote for loops to use auto : semantics.
- Truthtable cleanup. (nw)
- Get rid of nl_math. Remove nl_util.h and moved contents to
plib/putil.h.
- Fix standalone build. Refactor ptypes.h. 
[Couriersud]
2016-06-07 21:44:15 +02:00
balr0g
b277908905 - Minor cosmetic refactoring. Added a "uninitialised array" template to
allow in-place creation (for increased locality) of netlist classes.
Main use is in truthtable class.
- Remove PLIB_NAMESPACE macros.
- Remove namespace macros. Use explicit namespace declarations.
- Moved device definitions into cpp files.
- Moved more device definitions into cpp files.
- New prefix "nlid" for include files flags purely internal include
files not to be leaked into userland. 
- Fix factory code.
2016-06-07 21:40:30 +02:00
couriersud
cac1c41edf Moved all parameter definitions in constructors. (nw) 2016-05-25 14:31:43 +02:00
couriersud
ee5b02ebfb Added == operator to netlist_time 2016-05-21 13:31:18 +02:00
couriersud
fdf63818de All netlist devices now follow new syntax. Removed dead code. All sub
devices are now forced to be initialized in the constructor. Device
setup now completely in constructor. Removed start call. [Couriersud]
2016-05-21 13:31:17 +02:00
couriersud
9102271ef7 More memory timebombs removed. (nw) 2016-05-21 12:58:24 +02:00
couriersud
332534cdf5 Continuing work to move object initialization from start to constructor.
Removed family_t. All of this can be determined at runtime from object
as well. As part of this, the "template" to write devices has changed.
Converted a number of devices to use the new template. [Couriersud]
2016-05-16 12:50:50 +02:00
couriersud
ccf66bee16 Align object registration syntax. (nw) 2016-05-10 00:47:21 +02:00
couriersud
4bf639f3e2 Rename connect_direct to connect_post_start to reflect usage. (nw) 2016-05-10 00:41:35 +02:00
couriersud
576189b169 Converted most subdevices to unique_ptr. This is a temporary measure
until the device initialisation is moved into the constructor. Started
converting constructors of devices to be passed name and netlist. (nw)
2016-05-02 21:56:57 +02:00
Miodrag Milanovic
89c5e1f681 Various cleanups suggested by static analyzer (nw) 2016-04-24 12:58:31 +02:00
couriersud
9d2f61ee92 netlist:
- more code optimization
- hide matrix_solver_t implementation
- use netlist_time for time deltas
2016-03-27 15:41:42 +02:00