* Currently devices use the "update" function if no handler is given for
an input.
* For this to work the update function has to be virtual. This will
cause issues on shared execution schemes like CPU/GPU using nvcc.
* This is the first batch of changes to ensure that handler resolution
is static.
* For truthtable cmos devices the power pin names will now be set
according to the logic family.
* Fix some issues for CD4538
* Change "already connected" warning to info level. Some ICs (CD4538)
connect pins internally to GND and the schematics again externally. This
will cause this info to be printed. The warning now is a lot more
verbose.
* No changes for well-behaved netlists.
* Netlists reporting "newton loops exceeded" messages should now report
a lot less of these messages.
* In case newton-raphson does not converge, netlist will reset the state
back to the beginning of the timestep. It will than use a number of very
small timesteps to hopefully deal with the non-convergence due to a too
big timesteps. Afterwards solving continues using dynamic timestepping
until the time-slice is complete.
* This is a lot better than the previous approach.
* This is meant as a performance optimization helper. Ideally, your
netlists never produce "newton loops exceeded" messages.
* Any events for connected analog and digital inputs will happen after
the timeslice is complete. Thus this approach - as the previous one -
are not suited for high-frequency (such as video outputs) situations. In
these case, only dynamic timestepping or reducing the fixed timestep are
a suitable solution.
* Electronic circuits and base components like resistors or capacitors
do not have a reset line. You can use them to create reset circuits.
There is thus no point to support soft reset, the equivalent to pressing
the reset button.
* Fixed some bugs around reset and start up logic.
* This also fixes the "scramble F3" crash.
* Add google test syntax compatible unit testing support. This is a very
limited subset of the google test framework and not intended ever to be
a replacement. Adding a dependency to google test for the functionality
required was considered to be an overkill.
* nltool -c tests runs unit tests if linked in. This is *not* the case
for the version of nltool compiled with TOOLS=1.
* Added unit tests for plib::pfunction.
Comparison operators evaluate either into 0.0 or 1.0. Thus they can be
used like "(a==1)*(b==2)" which will only result in 1.0 if a equal 1 and
b equal 1. From the yet to be released test code:
* PFUNCEXPECT("1==1", 1.0)
* PFUNCEXPECT("1 *0 == 2-1-1", 1.0)
* PFUNCEXPECT("0!=1", 1.0)
* PFUNCEXPECT("0<1", 1.0)
* PFUNCEXPECT("1>0", 1.0)
* PFUNCEXPECT("0<=1", 1.0)
* PFUNCEXPECT("1>=0", 1.0)
* PFUNCEXPECT("1<=1", 1.0)
* PFUNCEXPECT("1>=1", 1.0)
* PFUNCEXPECT("if(1>0, 2, 0)", 2.0)
* PFUNCEXPECT("if(0>1, 2, 3)", 3.0)
* PFUNCEXPECT("if(sin(1)>0, 2, 3)", 3.0) // fail
A single missing sector was causing it to give up on an images,
as incompatible. Being a little more permissive here helps working
with some old recovered disk images with some lost sectors.
* palloc.h/pmatrix2d.h: Fix static_assert warnings at the origin.
* Rework hints to broaden their use and fix NC hint.
* 74377: use NC hint
* plists.h: Fix debugging in MSVC
* Include cleanup: Move everything not needed by netlists from
nl_setup.h into core/setup.h
* Fix some clang tidy warnings
* srcclean
* Logic and analogue outputs can now be flagged as "NC" (not connected).
* Example: "HINT(IC13.4, NC)".
* This will suppress info messages to be logged.
* The HINT must apply to an existing terminal. HINTs for non-existing
terminals are treated as fatal errors.
* Terminals and logic inputs not connected are still treated as
warnings. These need though and a proper fix.
The purpose of this ongoing exercise is to remove unnecessary
dependencies in header files. netlist implementations should only have
access to what they need. The same applies to device implementations.
Core stuff will be moved to the core subdirectory going forward.
Kidniki now achieves up to 910% when run with static solvers and with
nltool. That is significant better than the 860% we have seen
previously.
This increase is driven by using a global memory pool in the solver
code.
In addition the following refactoring and code maintenance work is
included. Please excuse the large commit, some of this took interfered
with other work and the detail development steps were ugly.
- gsl support: This commit adds pgsl.h which implements a very limited
number of the functionality of the gsl header described in the c++ core
guidelines.
- clang-tidy fixes
- A significant refactoring of palloc.h. Aligned hints were removed,
they added complexity without a significant performance gain. Vector
operations should better be done on special spans/views.
The code has been tested on linux with g++-7, g++-9, clang-11.
On Windows mingw-10 and VS2019, OSX clang-11.
Move towards a pure c++ constexpr solution to derive the optimal
pointer to member function solution.
All the macro madness is centralized to a compile_info struct with
static members.
For the time being the evaluation result is compared against the
previous approach. Going forward this will be dropped as well as the
support for MINGW with GCC <= 4.6
- more c++14, use enable_if_t instead of enable_if
- cleaned up the use of memory allocation arenas
- reduce MACRO usage, use std::conditional where possible
Factory elements can now pass additional parameters to device
constructors. This makes the design of interface objects like analog
callbacks easier.
The change also allowed to remove some "deep" calls into the core from
the MAME interface in netlist.h
* mw8080bw: update 280zzzap audio API in preparation for netlist audio
This is only API changes, following the pattern used by cuavas within the
past year to update other games in mw8080bw.
* mw8080bw: new netlist audio implementation for 280zzzap
New netlist-based audio implementation for 280zzzap (280-ZZZAP, 1976),
derived from Midway game logic board schematic. The sound generally
matches that heard in videos of the machine, though the real machine
seems to have more bass and less treble. This may be a cabinet effect
or something else, such as a difference in component values.
Due to the number of complex components being emulated and the nature
of the circuits, this netlist adds a lot of overhead, but it's still
fast enough to run at greater than real speed on modern hardware.
With minor changes, this implementation should also support lagunar
(Laguna Racer, 1977); with somewhat more substantial changes, it
would also support sspeedr (Super Speed Race, 1979). Both of these
games use sound circuits based on those for 280-ZZZAP.
plists.h was splitted into plists.h, pmulti_threading.h and
ptimed_queue.h. In addition removed plists.h from a number of files it
wasn't used in.
Certain minor adjustment needed to be made for cuda toolkit 10.1 and
10.2.
pongf now peaks at 589% compared to 570% before.
Amongst a number of improvements in nl_base.h, the 7493 was touched.
Also has some code cleanup and hopefully faster compilation due to
extern template declarations.
For reasons unknown to me compile optimizations do not behave for
template code. If the implementation is in separate compile units, the
code compiles and performs.
This needs more attention since for certain compilers there is a
considerable performance degregation. It looks like this is only
triggered if too many variants are declared in one cpp file and the
compiler stops inlining.
Rom and prom devices now properly support tristate outputs. Native OC
output still on the todo list.
In addition this commit fixes a number of bugs around dealing with macro
level parameters and improves documentation by adding a parameter table.
Also srcclean.
This change will make it a lot easier to add enhanced functionality to
the factory infrastructure.
Using integral constants also improves linking stability.
During object creation netlist tracks the source files which provide
object creation. This is later used e.g. by nltool to create
documentation from source.
These tristate buffers natively support tristate outputs. For use cases
with fixed enable inputs the devices support a parameter
FORCE_TRISTATE_LOGIC which if being set to 1 makes the device behave
like a logic output.
Added additional syntax and consistency checks for tristate outputs.
Updated the example and added dip implementations including
documentation.
Thanks to Aaron Giles who made me think about a different approach.
This is a rewrite from scratch for rom devices. It uses a generic
template to implement rom devices which is used together with a
description struct to define a rom device. This leads to highly
efficient code since all information is available at compile time.
This is also a step forward to support tristate outputs. All rom devices
covered by this approach have tristate or open collector outputs and
thus all code changes to support tristate outputs can now be made
consistently in one file.
Code cleanup to better separate the following stages:
- parsing
- setup
- run
In addition preliminary native tristate support was added. Not yet
production ready, please don't use it.
- working macro level parameters
- simplified code significantly
- fixed a number of hidden issue
- dead code removal
It is now possible to define netlist level parameters using:
static NETLIST_START(chip)
DEFPARAM(parameter, 123)
RES(R1, $(@.parameter))
....
NETLIST_END()
NETLIST_START(main)
chip(X1)
PARAM(X1.parameter, 1000)
...
NETLIST_END()
This will pass on 1000 to R1 as a parameter.
"@." will resolve to the current namespace. In this case it is X1, thus
"X1.parameter. This is during parsing. During evalution, i.e. device
creation, $(X1.parameter) is evaluated to 1000.
This also means, that global parameters are possible and accessible ...
DEFPARAM(P, 234)
...
RES(R1, $(P))
or going forward
RES(R1, 1000)
CAP(C1, 1.0 / $(R1.R))
This opens up the path to more possibilities ...
static NETLIST_START(DM9456_DIP)
DEFPARAM(MODEL, "74XX")
DM9456_GATE(X1)
DM9456_GATE(X2)
PARAM(X1.MODEL, $(@.MODEL))
PARAM(X2.MODEL, $(@.MODEL))
...
NETLIST_END()
NETLIST_START(main)
DM9456_DIP(X1)
PARAM(X1.MODEL, "LS74XX")
...
NETLIST_END()
The code also has been prepared to allow something along the lines of
LIBENTRY_MODEL(DM74LS00_DIP, DM7400_DIP, "LS74XX")
to define a LS version on top of an DM7400_DIP bare TTL implementation.
This however will need more efforts to existing devices to honour some
timing adjustment in the model definition. It will already honour
different output specifications between LS series and bare TTL if
connected to analog components.
This a big forward to allow reuse of code. Still a longer way to go
but the foundation there.
Also brings quite a number of simplifications and dead code removal.
- 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.
Reduce the usage of NETLIB_CONSTRUCTOR_DERIVED to implement
dip package objects. This aligns the programmatic approach
with the approach used in the macro folder, i.e. using netlists.
Untangle model definition and interpretation as well.
This changes are a first step in aligning models and families and thus
simplify the source further.
nlwav now supports 16 and 32 bit integer format (wav16s, wav32s)
as well as 32 bit float format (wav32f).
The "wav" format is no longer supported.
Added support for high and low pass filtering the wav output.
Dynamic volume adjustment (use "-a 0")
--hpboost can suppress spikes at the beginning of the file (<10ms)
The addition of the float format simplifies debugging significantly
since it covers the whole dynamic format.
Added nlwav to the local VS 2019 build.
This change makes state saving contract based. Objects which need to
save state need to have the following template member:
template <typename ST>
void save_state(ST &st)
{
/* Example */
st.save_item(m_p, "m_p");
st.save_item(m_buf, "m_buf");
}
This member function is called when the object is passed to the
state manager save function.
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.
The model is driven by three additional model parameters: NBV, IBV, BV.
Example code how to define a typical 7.5V Zener diode:
ZDIODE(ZD, "D(BV=7.5 IBV=0.01 NBV=3)")
or
NET_MODEL("A1234 D(BV=7.5 IBV=0.01 NBV=3)")
ZDIODE(ZD, "A1234")
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.
Documentation should be created on Windows using
make mingw PARAMS=doc
Admittedly this is ugly and the makefile needs to be changed to
use something like "make HOSTOS=windows doc".
Make some calls private which were public before.
Eliminate functions which would be executed only once.
Make terminal reference functions in twoterm.h return const.
Clearly identify the use cases which need a non-const ref
to terminals.
Calls to the solver used different paths. These changes unify these
calls and provide a common call for discontinuous state changes on
analog components (change_state).
"Edge cases" are compiles were the floting point type used for the core
may be different from the one used by solvers, e.g. double/float.
This does not happen in MAME, here currently this is always
double/double. Since floats are better suited for GPUs whose double
performance is limited it was time to review the code.
This commit fixes warnings about type conversions and precision loss.
In addition there is better support for INT128 and FLOAT128.
The MAT solver has seen some minor performance increases.
Added a define NL_USE_ACADEMIC_SOLVERS and disabled it in the build.
This will not compile in solvers which are either illustrative or only
perform for large sparse matrices like GMRES.
This commit simplifies the creation of static solvers. For this to
happen the following changes were made:
- nltool does no longer support the "-f netlist_file.cpp" option.
All parts of netlist which used the option now expect the file
to be specified after all other options.
Before: nltool -t 10 -f somenetlist.cpp
Now : nltool -t 10 somenetlist.cpp
- The static compile command now supports an "--output" option
to specify the file to be created and accepts multiple input
files. To be create the static solver file for MAME use the
script provided or:
./nltool --cmd static
--output=src/lib/netlist/generated/static_solvers.cpp
src/mame/audio/nl_*.cpp src/mame/machine/nl_*.cpp
- Updated documentation and examples provided by nltool --help
The CD4016 is an analog switch IC. Document an experimental approach
to implement the analog switch as a 3 terminal element which is
completely being dealt with as part as the linear system.
The intention was to improve convergence when the switch is in a
feedback loop. One example are two-opamp tridiagonal wave generators.
Unfortunately the approach did not work out and in addition was
performing far worse than the net-separating original code.
Also updated comment in nld_generic_models.h.
This commit introduces precompiled static solver code. Due to
additional optimizations the compiler can use because the detail
calculation steps for the solution are known e.g. the kidniki netlist
sees a 100% speed increase.
In all environments (windows/*nix/osx) the source for the static
solver code can be created using
bash src/lib/netlist/nl_create_mame_solvers.sh
This will create src/lib/netlist/generated/static_solvers.cpp which is
compiled into the mame binary.
The script is just a temporary workaround. The intention is that nltool
whill be able to create this file with one call.
There are other improvements in this commit speeding up the processing
of timestep and dynamic calculations.
The only link dependency left is emu_fatalerror. The format handlers
really shouldn't be throwing fatal errors at all - they should just
fail to load an image they can't handle. Maybe the interface should
be enhanced to allow better propagation of errors up from the format
handlers so they can be displayed in a UI rather than just logged.
The only other two dependencies are on logmacro.h (pure macros) and
the PAIR type from emucore.h (possibly worth moving to util).
../../../../../src/lib/formats/apridisk.cpp: In member function 'virtual bool apridisk_format::load(io_generic*, uint32_t, floppy_image*)':
../../../../../src/lib/formats/apridisk.cpp:99:7: error: 'fatalerror' was not declared in this scope; did you mean 'strerror'?
Document linearized diode model in the range exceeding maximum
dissipation. The intention is to have a faster convergence but this yet
not really is observable.
* Add doxygen comments for bit manipulation functions
* Add an overload of BIT that works like the AArch64 UBFX instruction
* Kill off some of the silly concatenating overloads for emu_file::open
* Make searchpath acually useful for devices
This is a checkpoint - I'm planning to improve ROM loading behaviour at
least a little.
Change color levels for williams2 hardware to better color display.
Output levels are computed in netlist. These levels are aligned to
LTspice modelling I did.
Also improved the modelling to do what the actual hardware for mysticm
did: Color decoding depends on W13..W11. These are actually flip screen
versions of V13..V11. Fixed treatment on Bit0 although not used by the
game code.
Added R,G,B gain and offset sliders for the williams2 hardware. MAME
only supports one setting for all channels. This is not good enough
to come close to video recordings found on youtube.
Minor changes to nltool to better measure time taken to run a
simulation.
This example shows how the netlist tools can be used to derive
RGB tables from a schematic. All steps are given in
serc/lib/netlist/examples/turkey_shoot.cpp
Using this output format nlwav will pick point samples at regular
intervals from log files. This can be used to e.g. calculate
RGB output levels with netlist.
- 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.
(nw) I've triple-checked the code and it looks sane, but I'm still a bit nervous about changing
such a fundamental part of MAME. If integer formatting appears to have changed after this, let
me know ASAP. Also removed a workaround for older versions of GNU libstdc++ with incomplete
C++14 support.
It is necessary to return a higher score on success, higher than
returned by the default method, in order for a general 'identify' to
succeed over competitive matches.
Add a get_track_format() method that can be overridden to supply format
variations for any track and head. The code is generalised to account for such
variations. The default method returns the passed format, so this change is
neutral for existing formats.
Simplify the FLEX DSK format code. There are now simply format variation
descriptions for the second track that have the sector ID continuing in
sequence from the first track, rather than specialized code.
Extend the FLEX format to support variations in the sectors ID of the first
two sectors. The FLEX 6800 boot sectors have IDs based at zero rather than
one. Extend the FLEX format to support variations for which the first track,
on both sides, is single density on an otherwise double density disk which was
historically a common format.
Extend the OS9 disk format to support variations for which the first track, on
only the first side, is single density on an otherwise double density
disk. OS9 for the SWTPC and Gimix typically used such formats.
Extend the OS9 disk format to support variations with a base sector ID of zero
in contrast to the existing COCO OS9 format which uses a based sector ID of
one. The OS9 format identification code is extended to rely on the optional
information stored in the OS9 LSN0 header to identify COCO format disks, and
all COCO format disks appear to have this optional information in a regular
enough format.
Parameters are now passed to the netlist core as strings. During netlist
creation they are evaluated as functions. This opens the path to
parameters on subdevice level.
Examples:
PARAM(device.XY, (1+2*0.005))
RES(R1, 2.05*RES_K(1)+1)
In addition the commit contains dead code removal.
- Fixed some clang lint warnings
- Removed dead code
- Experimental parser code to allow calculations in parameter value.
This already works for compiled netlists. These changes are
currently disabled. Updated pong netlist (and CRC/SHA) to work
with this new code.
"./nltool -c convert -f UA741.mod" now runs without errors. UA741.mod is
the official TI SPICE subckt for the 741 opamp.
This commit fixes a number of issues and adds linear POLY support for
E/F SPICE models.
This commit fixes an issue with parsing netlists. To cut a long story
short: The separation of nets into independant groups of nets failed
under some circumstances for four terminal devices (controlled
voltage/current devices). Everything worked as long as an external
feedback loop existed. Without external feedback loop, the separation
would either fail or create "false" separated nets.
This fix also highlighted an issue with cmos switches (4066/4016).
There is a slight chance that other bugs may surface due to this change.
- add CD4006 and CD4070 devices
- add TL084 opamp model
- Clock now supports proxies, i.e. can be connected to
analog devices.
- Fixed netlists using CLOCK
- added some comments
- removed a forgotten header file.
- remove pthrow trampline as proposed by Vas.
- identify throwing code by adding noexcept(false)
- move "connected term" information to setup code.
- srcclean
The APPLE2_TRACK_COUNT macro was not being expanded here, at least on gcc8.
This resulted in the string "APPLE2_TRACK_COUNT" being within the specification
and that in turn broke option_resolution::lookup_in_specification leading to
an assertion fail with the debug checks enabled. So bake in the numeric
constant to at least get things working again.
Increase the time resolution from 1 nano second to 100 pico seconds.
Make sure that icount and netlist internal time are better synched by
tracking the remainder of the division.
Fixed the netlist sound device. There is a one sample overflow every 13
seconds at 48000 Hz due to integer truncation which is now ignored.
Added more doxygen documentation.
Long story: The diode model uses log-stepping as proposed in "Circuit
Simulation" (Farid N. Najm) page 183. If the previous voltage was
sufficiently negative the new voltage after a log step could not have
increased enough to alter matrix and rhs vector.
This bug surfaced in stuntcyc video signal mixing which uses a diode for
the composite signal.
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.
Added netlist version information. This is used to enforce the
invalidation of save states when the major/minor netlist version
changes.
This catches edge cases for which neither the size or names of saved
items changes during releases.
* Got rid of some more simple_list in core debugger code
* Fixed a buffer overrun in wavwrite (buffer half requried size)
* Slightly reduced dependencies and overhead in wavwrite
* Made new disassembly windows in Qt debugger default to current CPU
- 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
- Devices ttlhigh and ttlhow are no longer automatically created.
- All logic input devices (e.g. TTL_INPUT, LOGIC_INPUT) now need to have
their power terminals (VCC, GND) connected. This opens the route
for more appropriate proxy devices but comes at a cost. If the
connections are omitted your circuit will not work as expected.
Example:
LOGIC_INPUT(I_SD0, 1, "AY8910PORT")
NET_C(VCC, I_SD0.VCC)
NET_C(GND, I_SD0.GND)
- Updated all netlists.
- Removed proxy information from terminal objects. This was replaced by
a lookup hash whose life-span does not exceed netlest setup.
These changes enable the removal of a number of hacks from the
source going forward.
- fixed a code in the netlist creation which caused multiple proxies
to be created for output->terminal connections. A nice side effect of
this fix is a performance increase ~9% for kidniki and ~4% for pong.
Speaking about pong ... maximum is 490%. Dice is running at
280 FPS/60 FPS = 466%, however without any analog emulation.
- Replaced NL_NOEXCEPT with noexcept. assert is now exception-free.
- cppcheck and lint fixes.
- move memory pool to netlist_state_t removing one static allocation.
- add memory allocation stats to verbose output
- nl_assert no longer throws, first step to remove NL_EXCEPT macro.
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
- comment style migration continues.
- Fixed a two bugs in the truthtable ignore inputs code
- refactored the truthtable code a bit for better readability.
- updated netlist specific gitignore.
- "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.
- more const
- explicitly raise exceptions instead of leaving this to log.fatal()
- correct a number of cppcheck findings.
- dead code removal
- clang lint corrections, e.g. include order
This fixes a case where:
* m_soundbuf_samples == processedsamples
* processedsamples > 0
* processedsamples * stream->channels() == m_soundbuf.size()
In this scenario, the std::memmove() would do nothing (moving zero
bytes), but the operator[] on the second parameter to std::memmove()
overflows the array. This can be benign in optimized builds (because
the third parameter to std::memmove() is 0), but on debugging builds
this can cause an assert.
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.
__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.
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.
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.
- 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.
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.
- 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
- 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
The builtin preprocessor now behaves closer to cpp:
- supports macro parameters, i.e. define x(a) a
- supports stringification, i.e. define x(a) #a
- supports concatenation, i.e. define x(a) a ## _ext
In addition, error reporting now provides a source context including the
include history.
fundamental change to show device delegates are configured.
Device delegates are now aware of the current device during
configuration and will resolve string tags relative to it. This means
that device delegates need a device to be supplied on construction so
they can find the machine configuration object. There's a
one-dimensional array helper to make it easier to construct arrays of
device delegates with the same owner. (I didn't make an n-dimensional
one because I didn't hit a use case, but it would be a simple addition.)
There's no more bind_relative_to member - just call resolve() like you
would for a devcb. There's also no need to cast nullptr when creating a
late bind device delegate. The flip side is that for an overloaded or
non-capturing lambda you'll need to cast to the desired type.
There is one less conditional branch in the hot path for calls for
delegates bound to a function pointer of member function pointer. This
comes at the cost of one additional unconditional branch in the hot
path for calls to delegates bound to functoids (lambdas, functions that
don't take an object reference, other callable objects). This applies
to all delegates, not just device delegates.
Address spaces will now print an error message if a late bind error is
encountered while installing a handler. This will give the range and
address range, hopefully making it easier to guess which memory map is
faulty.
For the simple case of allowing a device_delegate member to be
configured, use a member like this:
template <typename... T> void set_foo(T &&...args) { m_foo_cb.set(std::forward<T>(args)...); }
For a case where different delegates need to be used depending on the
function signature, see src/emu/screen.h (the screen update function
setters).
Device delegates now take a target specification and function pointer.
The target may be:
* Target omitted, implying the current device being configured. This
can only be used during configuration. It will work as long as the
current device is not removed/replaced.
* A tag string relative to the current device being configured. This
can only be used during configuration. It will not be callable until
.resolve() is called. It will work as long as the current device is
not removed/replaced.
* A device finder (required_device/optional_device). The delegate will
late bind to the current target of the device finder. It will not
be callable until .resolve() is called. It will work properly if the
target device is replaced, as long as the device finder's base object
isn't removed/replaced.
* A reference to an object. It will be callable immediately. It will
work as long as the target object is not removed/replaced.
The target types and restrictions are pretty similar to what you already
have on object finders and devcb, so it shouldn't cause any surprises.
Note that dereferencing a device finder will changes the effect. To
illustrate this:
...
required_device<some_device> m_dev;
...
m_dev(*this, "dev")
...
// will late bind to "dev" relative to *this
// will work if "dev" hasn't been created yet or is replaced later
// won't work if *this is removed/replaced
// won't be callable until resolve() is called
cb1.set(m_dev, FUNC(some_device::w));
...
// will bind to current target of m_dev
// will not work if m_dev is not resolved
// will not work if "dev" is replaced later
// will be callable immediately
cb2.set(*m_dev, FUNC(some_device::w));
...
The order of the target and name has been reversed for functoids
(lambdas and other callable objects). This allows the NAME macro to
be used on lambdas and functoids. For example:
foo.set_something(NAME([this] (u8 data) { m_something = data; }));
I realise the diagnostic messages get ugly if you use NAME on a large
lambda. You can still give a literal name, you just have to place it
after the lambda rather than before. This is uglier, but it's
intentional. I'm trying to drive developers away from a certain style.
While it's nice that you can put half the driver code in the memory map,
it detracts from readability. It's hard to visualise the memory range
mappings if the memory map functions are punctuated by large lambdas.
There's also slightly higher overhead for calling a delegate bound to a
functoid.
If the code is prettier for trivial lambdas but uglier for non-trivial
lambdas in address maps, it will hopefully steer people away from
putting non-trivial lambdas in memory maps.
There were some devices that were converted from using plain delegates
without adding bind_relative_to calls. I fixed some of them (e.g.
LaserDisc) but I probably missed some. These will likely crash on
unresolved delegate calls.
There are some devices that reset delegates at configuration complete or
start time, preventing them from being set up during configuration (e.g.
src/devices/video/ppu2c0x.cpp and src/devices/machine/68307.cpp). This
goes against the design principles of how device delegates should be
used, but I didn't change them because I don't trust myself to find all
the places they're used.
I've definitely broken some stuff with this (I know about asterix), so
report issues and bear with me until I get it all fixed.
- Added support for line markers to the preprocessor and parser.
- Added support for include processing to the preprocessor.
- Moved sources base type to plib to be used for preprocessor includes.
This enables to include e.g. from rom memory regions.
- Renamed some defines
- 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
- 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.
- 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
- 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
(nw) This has been a long time coming but it's here at last. It should
be easier now that logerror, popmessage and osd_printf_* behave like
string_format and stream_format. Remember the differences from printf:
* Any object with a stream out operator works with %s
* %d, %i, %o, %x, %X, etc. work out the size by magic
* No sign extending promotion to int for short/char
* No widening/narrowing conversions for characters/strings
* Same rules on all platforms, insulated from C runtime library
* No format warnings from compiler
* Assert in debug builds if number of arguments doesn't match format
(nw) Also removed a pile of redundant c_str and string_format, and some
workarounds for not being able to portably format 64-bit integers or
long long.
* Fixed a compiltion bug under clang-cl
Oddly, this problem does not seem to manifest under clang on
gcc.godbolt.org. I suspect that this might be related to the fact that
sizeof(std::size_t) != sizeof(long) on Windows.
* Couriersud feedback
Some unknown system library seems to force the use of the global locale
on OSX. This is not the case for other *nix or Windows builds. This
commit fixes this by forcing the C locale in pfmt.
* hp9825: fixed a bug in 9825t
* hp9845: TACO driver re-written from scratch, DC100 tape separated into
a new device, various adaptations
* hp9845: "new TACO" renamed to just "TACO"
This now works with both single density and double density floppy disks, and
dynamically identifies boot sector IDs required for 6800 booting, and supports
writing back to the 'dsk' image files.
The UniFLEX disk format is not compatible with the Flex format. Significantly it
does not use a mix of single density for booting on some double density disks
which makes it simpler - hardware required a new boot ROM to run UniFLEX.
Further, the UniFLEX sector size is 512 bytes versus 256 for Flex, and the
UniFLEX 'SIR' info sector record is completely different to the info on Flex
disk, and the file system format is also not at all compatible.
Thus the UniFlex format can rely largely on the WD17xx format, with an
overload to handle the sector numbering on the second side continuing from the
first side (one feature in common with the Flex format). This gives a quick
'save' capability and shares code.
Support for 8" disks is included as this was the initial distribution format
and the only one found so far.
The CPU tries to read data in a tight loop, so there must be
some way for it to be halted until data is ready. The current
solution works good enough to boot CP/M.
Also:
- Change FDC to KR1818VG93
- Change disk format from 3.5" to 5.25"
- Add single sided disk format
- Add softlist